diff --git a/CMakeLists.txt b/CMakeLists.txt index c7f02b72bf..08a0111d57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,16 +29,16 @@ endif(COMMAND cmake_policy) # #-----------------------------------------------------------------------------# -set(ALLEGRO_VERSION_REGEX_PATTERN "#define ALLEGRO_VERSION_STR[ ]+\"([0-9]+\\.[0-9]+\\.[0-9]+).*\"") -file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/include/allegro5/base.h" ALLEGRO_VERSION_MATCH - REGEX ${ALLEGRO_VERSION_REGEX_PATTERN} +set(A5O_VERSION_REGEX_PATTERN "#define A5O_VERSION_STR[ ]+\"([0-9]+\\.[0-9]+\\.[0-9]+).*\"") +file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/include/allegro5/base.h" A5O_VERSION_MATCH + REGEX ${A5O_VERSION_REGEX_PATTERN} LIMIT_COUNT 1 ) -string(REGEX REPLACE ${ALLEGRO_VERSION_REGEX_PATTERN} "\\1" ALLEGRO_VERSION "${ALLEGRO_VERSION_MATCH}") -if("${ALLEGRO_VERSION}" VERSION_GREATER_EQUAL 5.0.0) - message(STATUS "[Allegro] Allegro Version: [${ALLEGRO_VERSION}]") +string(REGEX REPLACE ${A5O_VERSION_REGEX_PATTERN} "\\1" A5O_VERSION "${A5O_VERSION_MATCH}") +if("${A5O_VERSION}" VERSION_GREATER_EQUAL 5.0.0) + message(STATUS "[Allegro] Allegro Version: [${A5O_VERSION}]") else() - message(FATAL_ERROR "[Allegro] Invalid Allegro Version: [${ALLEGRO_VERSION}]") + message(FATAL_ERROR "[Allegro] Invalid Allegro Version: [${A5O_VERSION}]") endif() @@ -49,17 +49,17 @@ endif() #-----------------------------------------------------------------------------# # Allow generating custom project name via command-line arguments (#1174) -set(ALLEGRO_PROJECT_NAME "ALLEGRO" CACHE STRING "Project default name") -set(ALLEGRO_PROJECT_SUFFIX "" CACHE STRING "Project suffix") +set(A5O_PROJECT_NAME "ALLEGRO" CACHE STRING "Project default name") +set(A5O_PROJECT_SUFFIX "" CACHE STRING "Project suffix") -project(${ALLEGRO_PROJECT_NAME}${ALLEGRO_PROJECT_SUFFIX} - VERSION ${ALLEGRO_VERSION} +project(${A5O_PROJECT_NAME}${A5O_PROJECT_SUFFIX} + VERSION ${A5O_VERSION} LANGUAGES C CXX DESCRIPTION "Allegro project" HOMEPAGE_URL "https://github.com/liballeg/allegro5" ) -set(ALLEGRO_SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}) +set(A5O_SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING @@ -74,7 +74,7 @@ if(ANDROID) option(WANT_ANDROID_LEGACY "Build for Android 4 (1.6)" OFF) set(ANDROID_TARGET "android-12" CACHE STRING "What Android target to compile for.") endif(ANDROID) -option(ALLEGRO_SDL "Build using the SDL backend (experimental)" OFF) +option(A5O_SDL "Build using the SDL backend (experimental)" OFF) option(WANT_STATIC_RUNTIME "Whether or not to link the C and C++ runtimes statically (currently only implemented on Windows)" OFF) # Search in the `cmake' directory for additional CMake modules. @@ -213,7 +213,7 @@ option(WANT_MUDFLAP "Enable gcc mudflap (requires gcc 4.0+)" off) option(WANT_RELEASE_LOGGING "Enable logging even in release mode" on) if(WANT_RELEASE_LOGGING) - set(ALLEGRO_CFG_RELEASE_LOGGING 1) + set(A5O_CFG_RELEASE_LOGGING 1) endif() # @@ -234,7 +234,7 @@ option(WANT_TESTS "Build test programs" on) option(WANT_WAIT_EVENT_SLEEP "Use sleep instead of threads in al_wait_for_event (only useful for emscripten without web workers)" off) if(WANT_WAIT_EVENT_SLEEP) - set(ALLEGRO_WAIT_EVENT_SLEEP 1) + set(A5O_WAIT_EVENT_SLEEP 1) endif() #-----------------------------------------------------------------------------# @@ -256,13 +256,13 @@ endif() if(WIN32) if(WANT_DLL_TLS AND SHARED) - set(ALLEGRO_CFG_DLL_TLS 1) + set(A5O_CFG_DLL_TLS 1) endif(WANT_DLL_TLS AND SHARED) endif(WIN32) if(MSVC) set(COMPILER_MSVC 1) - set(ALLEGRO_MSVC 1) + set(A5O_MSVC 1) # Guess VCINSTALLDIR from the value of CMAKE_C_COMPILER if it's not set. # XXX CMAKE_C_COMPILER will often be simply "cl" so this won't work. @@ -286,7 +286,7 @@ endif(MSVC) if(MINGW) # For alplatf.h - set(ALLEGRO_MINGW32 1) + set(A5O_MINGW32 1) # Guess MINGDIR from the value of CMAKE_C_COMPILER if it's not set. if("$ENV{MINGDIR}" STREQUAL "") @@ -328,7 +328,7 @@ if(MINGW) endif(MINGW) if(UNIX AND NOT APPLE AND NOT ANDROID) - set(ALLEGRO_UNIX 1) + set(A5O_UNIX 1) endif(UNIX AND NOT APPLE AND NOT ANDROID) if(APPLE AND NOT IPHONE) @@ -336,9 +336,9 @@ if(APPLE AND NOT IPHONE) endif(APPLE AND NOT IPHONE) if(MACOSX) - set(ALLEGRO_MACOSX 1) - set(ALLEGRO_CFG_PTHREADS_TLS 1) - set(ALLEGRO_UNIX 0) + set(A5O_MACOSX 1) + set(A5O_CFG_PTHREADS_TLS 1) + set(A5O_UNIX 0) set(WANT_X11 off) # This flag is required on some versions of Mac OS X to avoid linker @@ -348,10 +348,10 @@ if(MACOSX) endif(MACOSX) if(IPHONE) - set(ALLEGRO_CFG_PTHREADS_TLS 1) - set(ALLEGRO_IPHONE 1) - set(ALLEGRO_UNIX 0) - set(ALLEGRO_LITTLE_ENDIAN 1) + set(A5O_CFG_PTHREADS_TLS 1) + set(A5O_IPHONE 1) + set(A5O_UNIX 0) + set(A5O_LITTLE_ENDIAN 1) set(WANT_X11 off) set(GL_AUTO_BUILD_TYPE "gles2+") set(WANT_GLES3 yes) @@ -360,37 +360,37 @@ if(IPHONE) endif(IPHONE) if(BORLAND) - set(ALLEGRO_BCC32 1) + set(A5O_BCC32 1) endif(BORLAND) if(ANDROID) - set(ALLEGRO_ANDROID 1) - set(ALLEGRO_CFG_PTHREADS_TLS 1) + set(A5O_ANDROID 1) + set(A5O_CFG_PTHREADS_TLS 1) set(WANT_X11 off) set(GL_AUTO_BUILD_TYPE "gles2+") endif(ANDROID) -if(ALLEGRO_RASPBERRYPI) - set(ALLEGRO_CFG_PTHREADS_TLS 1) +if(A5O_RASPBERRYPI) + set(A5O_CFG_PTHREADS_TLS 1) set(GL_AUTO_BUILD_TYPE "gles2+") - set(ALLEGRO_EXCLUDE_GLX 1) -endif(ALLEGRO_RASPBERRYPI) + set(A5O_EXCLUDE_GLX 1) +endif(A5O_RASPBERRYPI) if(EMSCRIPTEN) set(GL_AUTO_BUILD_TYPE "gles2+") - set(ALLEGRO_LITTLE_ENDIAN 1) - if (NOT ALLEGRO_SDL) + set(A5O_LITTLE_ENDIAN 1) + if (NOT A5O_SDL) message(FATAL_ERROR - "Emscripten support currently requires the SDL backend (set ALLEGRO_SDL)") - endif(NOT ALLEGRO_SDL) + "Emscripten support currently requires the SDL backend (set A5O_SDL)") + endif(NOT A5O_SDL) endif() -if(ALLEGRO_SDL) - set(ALLEGRO_UNIX 0) - set(ALLEGRO_MACOSX 0) +if(A5O_SDL) + set(A5O_UNIX 0) + set(A5O_MACOSX 0) set(WANT_X11 off) include(FindSDL2) -endif(ALLEGRO_SDL) +endif(A5O_SDL) # Tell the compiler it can use SSE instructions on x86 architectures. # If compatibility with Pentium 2's and below is required then the user @@ -437,11 +437,11 @@ endif() if(COMPILER_GCC_OR_CLANG) set(WFLAGS "-W -Wall -Wpointer-arith") set(WFLAGS_C_ONLY "-Wmissing-declarations -Wstrict-prototypes") - if(ALLEGRO_UNIX) + if(A5O_UNIX) # Unfortunately we can't use this flag when magic main is used, # the mangled_main won't have a forward declaration. set(WFLAGS_C_ONLY "${WFLAGS_C_ONLY} -Wmissing-prototypes") - endif(ALLEGRO_UNIX) + endif(A5O_UNIX) if(STRICT_WARN) set(WFLAGS "${WFLAGS} -Werror") endif() @@ -503,48 +503,48 @@ include(FindPkgConfig) include(TestBigEndian) -if(NOT ALLEGRO_BIG_ENDIAN AND NOT ALLEGRO_LITTLE_ENDIAN) - test_big_endian(ALLEGRO_BIG_ENDIAN) - if(NOT ALLEGRO_BIG_ENDIAN) - set(ALLEGRO_LITTLE_ENDIAN 1) - endif(NOT ALLEGRO_BIG_ENDIAN) -endif(NOT ALLEGRO_BIG_ENDIAN AND NOT ALLEGRO_LITTLE_ENDIAN) - -check_include_files(dirent.h ALLEGRO_HAVE_DIRENT_H) -check_include_files(inttypes.h ALLEGRO_HAVE_INTTYPES_H) -check_include_files(linux/input.h ALLEGRO_HAVE_LINUX_INPUT_H) -check_include_files(stdbool.h ALLEGRO_HAVE_STDBOOL_H) -check_include_files(stdint.h ALLEGRO_HAVE_STDINT_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(time.h ALLEGRO_HAVE_TIME_H) -check_include_files(sys/utsname.h ALLEGRO_HAVE_SYS_UTSNAME_H) -check_include_files(sys/types.h ALLEGRO_HAVE_SYS_TYPES_H) -check_include_files(soundcard.h ALLEGRO_HAVE_SOUNDCARD_H) -check_include_files(sys/soundcard.h ALLEGRO_HAVE_SYS_SOUNDCARD_H) -check_include_files(machine/soundcard.h ALLEGRO_HAVE_MACHINE_SOUNDCARD_H) -check_include_files(linux/soundcard.h ALLEGRO_HAVE_LINUX_SOUNDCARD_H) -check_include_files(libkern/OSAtomic.h ALLEGRO_HAVE_OSATOMIC_H) -check_include_files(sys/inotify.h ALLEGRO_HAVE_SYS_INOTIFY_H) -check_include_files(sal.h ALLEGRO_HAVE_SAL_H) - -check_function_exists(getexecname ALLEGRO_HAVE_GETEXECNAME) -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(sysconf ALLEGRO_HAVE_SYSCONF) -check_function_exists(fseeko ALLEGRO_HAVE_FSEEKO) -check_function_exists(ftello ALLEGRO_HAVE_FTELLO) -check_function_exists(strerror_r ALLEGRO_HAVE_STRERROR_R) -check_function_exists(strerror_s ALLEGRO_HAVE_STRERROR_S) +if(NOT A5O_BIG_ENDIAN AND NOT A5O_LITTLE_ENDIAN) + test_big_endian(A5O_BIG_ENDIAN) + if(NOT A5O_BIG_ENDIAN) + set(A5O_LITTLE_ENDIAN 1) + endif(NOT A5O_BIG_ENDIAN) +endif(NOT A5O_BIG_ENDIAN AND NOT A5O_LITTLE_ENDIAN) + +check_include_files(dirent.h A5O_HAVE_DIRENT_H) +check_include_files(inttypes.h A5O_HAVE_INTTYPES_H) +check_include_files(linux/input.h A5O_HAVE_LINUX_INPUT_H) +check_include_files(stdbool.h A5O_HAVE_STDBOOL_H) +check_include_files(stdint.h A5O_HAVE_STDINT_H) +check_include_files(sys/io.h A5O_HAVE_SYS_IO_H) +check_include_files(sys/stat.h A5O_HAVE_SYS_STAT_H) +check_include_files(sys/time.h A5O_HAVE_SYS_TIME_H) +check_include_files(time.h A5O_HAVE_TIME_H) +check_include_files(sys/utsname.h A5O_HAVE_SYS_UTSNAME_H) +check_include_files(sys/types.h A5O_HAVE_SYS_TYPES_H) +check_include_files(soundcard.h A5O_HAVE_SOUNDCARD_H) +check_include_files(sys/soundcard.h A5O_HAVE_SYS_SOUNDCARD_H) +check_include_files(machine/soundcard.h A5O_HAVE_MACHINE_SOUNDCARD_H) +check_include_files(linux/soundcard.h A5O_HAVE_LINUX_SOUNDCARD_H) +check_include_files(libkern/OSAtomic.h A5O_HAVE_OSATOMIC_H) +check_include_files(sys/inotify.h A5O_HAVE_SYS_INOTIFY_H) +check_include_files(sal.h A5O_HAVE_SAL_H) + +check_function_exists(getexecname A5O_HAVE_GETEXECNAME) +check_function_exists(mkstemp A5O_HAVE_MKSTEMP) +check_function_exists(mmap A5O_HAVE_MMAP) +check_function_exists(mprotect A5O_HAVE_MPROTECT) +check_function_exists(sched_yield A5O_HAVE_SCHED_YIELD) +check_function_exists(sysconf A5O_HAVE_SYSCONF) +check_function_exists(fseeko A5O_HAVE_FSEEKO) +check_function_exists(ftello A5O_HAVE_FTELLO) +check_function_exists(strerror_r A5O_HAVE_STRERROR_R) +check_function_exists(strerror_s A5O_HAVE_STRERROR_S) if(WIN32) - check_function_exists(_ftelli64 ALLEGRO_HAVE_FTELLI64) - check_function_exists(_fseeki64 ALLEGRO_HAVE_FSEEKI64) + check_function_exists(_ftelli64 A5O_HAVE_FTELLI64) + check_function_exists(_fseeki64 A5O_HAVE_FSEEKI64) endif() -check_type_size("_Bool" ALLEGRO_HAVE__BOOL) +check_type_size("_Bool" A5O_HAVE__BOOL) run_c_compile_test(" #include @@ -553,7 +553,7 @@ run_c_compile_test(" psinfo.pr_argc = 0; return 0; }" - ALLEGRO_HAVE_PROCFS_ARGCV + A5O_HAVE_PROCFS_ARGCV ) run_c_compile_test(" @@ -564,7 +564,7 @@ run_c_compile_test(" ioctl(0, PIOCPSINFO, &psinfo); return 0; }" - ALLEGRO_HAVE_SV_PROCFS_H + A5O_HAVE_SV_PROCFS_H ) run_c_compile_test(" @@ -574,7 +574,7 @@ run_c_compile_test(" va_copy(a, b); return 0; }" - ALLEGRO_HAVE_VA_COPY + A5O_HAVE_VA_COPY ) #-----------------------------------------------------------------------------# @@ -598,7 +598,7 @@ run_c_compile_test(" # i.e. the user wants it and the system can support it. # # Those variables are internal to the CMake build. Allegro header files use -# preprocessor constants with names like ALLEGRO_WITH_* and ALLEGRO_HAVE_*. +# preprocessor constants with names like A5O_WITH_* and A5O_HAVE_*. # Sometimes we make use of those variables in this CMakeFile as well, but # generally that's just due to sloppiness. # @@ -626,10 +626,10 @@ if(WANT_OPENGL) if(GL_REAL_BUILD_TYPE MATCHES "gl$") if(OPENGL_FOUND AND OPENGL_GLU_FOUND) set(SUPPORT_OPENGL 1) - set(ALLEGRO_CFG_OPENGL 1) - set(ALLEGRO_CFG_OPENGL_FIXED_FUNCTION 1) + set(A5O_CFG_OPENGL 1) + set(A5O_CFG_OPENGL_FIXED_FUNCTION 1) # We assume that the OpenGL library is not very old. - set(ALLEGRO_CFG_OPENGL_PROGRAMMABLE_PIPELINE 1) + set(A5O_CFG_OPENGL_PROGRAMMABLE_PIPELINE 1) if(OPENGL_opengl_LIBRARY) # prefer GLVND if available set(OPENGL_LIBRARIES ${OPENGL_opengl_LIBRARY} ${OPENGL_glu_LIBRARY}) endif() @@ -659,23 +659,23 @@ if(WANT_OPENGL) set(SUPPORT_OPENGL 1) set(SUPPORT_OPENGLES 1) set(SUPPORT_OPENGLES2 1) - set(ALLEGRO_CFG_OPENGL 1) - set(ALLEGRO_CFG_OPENGLES 1) - set(ALLEGRO_CFG_OPENGLES2 1) - set(ALLEGRO_CFG_OPENGL_PROGRAMMABLE_PIPELINE 1) + set(A5O_CFG_OPENGL 1) + set(A5O_CFG_OPENGLES 1) + set(A5O_CFG_OPENGLES2 1) + set(A5O_CFG_OPENGL_PROGRAMMABLE_PIPELINE 1) set(OPENGL_LIBRARIES ${OPENGLES2_LIBRARIES}) set(OPENGLES_INCLUDE_DIR ${OPENGLES2_INCLUDE_DIR}) set(OPENGL_SUMMARY "- OpenGL: ES 2.0") if(WANT_GLES3 AND NOT ANDROID) set(SUPPORT_OPENGLES3 1) - set(ALLEGRO_CFG_OPENGLES3 1) + set(A5O_CFG_OPENGLES3 1) set(OPENGL_SUMMARY "- OpenGL: ES 3.0") elseif(WANT_GLES3 AND ANDROID) find_package(OpenGLES3) if(OPENGLES3_FOUND) set(SUPPORT_OPENGLES3 1) - set(ALLEGRO_CFG_OPENGLES3 1) + set(A5O_CFG_OPENGLES3 1) set(OPENGL_LIBRARIES ${OPENGLES3_LIBRARIES}) list(APPEND OPENGLES_INCLUDE_DIR ${OPENGLES3_INCLUDE_DIR}) set(OPENGL_SUMMARY "- OpenGL: ES 3.0") @@ -707,10 +707,10 @@ if(WANT_OPENGL) set(SUPPORT_OPENGL 1) set(SUPPORT_OPENGLES 1) set(SUPPORT_OPENGLES1 1) - set(ALLEGRO_CFG_OPENGL 1) - set(ALLEGRO_CFG_OPENGLES 1) - set(ALLEGRO_CFG_OPENGLES1 1) - set(ALLEGRO_CFG_OPENGL_FIXED_FUNCTION 1) + set(A5O_CFG_OPENGL 1) + set(A5O_CFG_OPENGLES 1) + set(A5O_CFG_OPENGLES1 1) + set(A5O_CFG_OPENGL_FIXED_FUNCTION 1) set(OPENGL_SUMMARY "- OpenGL: ES 1.1") set(OPENGL_LIBRARIES ${OPENGLES1_LIBRARIES}) if(NOT IPHONE) @@ -742,9 +742,9 @@ endif(UNIX) # SDL # -if(ALLEGRO_SDL AND NOT SUPPORT_OPENGL) +if(A5O_SDL AND NOT SUPPORT_OPENGL) message(FATAL_ERROR "SDL support currently requires OpenGL or OpenGL ES support.") -endif(ALLEGRO_SDL AND NOT SUPPORT_OPENGL) +endif(A5O_SDL AND NOT SUPPORT_OPENGL) # # X Window System @@ -754,14 +754,14 @@ if(WANT_X11) find_package(X11) if(X11_FOUND) set(SUPPORT_X11 1) - set(ALLEGRO_WITH_XWINDOWS 1) + set(A5O_WITH_XWINDOWS 1) endif(X11_FOUND) endif(WANT_X11) -if(ALLEGRO_UNIX AND NOT SUPPORT_X11 AND WANT_X11) # not MACOSX +if(A5O_UNIX AND NOT SUPPORT_X11 AND WANT_X11) # not MACOSX message(FATAL_ERROR "X11 not found. You may need to install X11 development libraries.") -endif(ALLEGRO_UNIX AND NOT SUPPORT_X11 AND WANT_X11) +endif(A5O_UNIX AND NOT SUPPORT_X11 AND WANT_X11) if(SUPPORT_X11 AND NOT SUPPORT_OPENGL) message(FATAL_ERROR "X11 support currently requires OpenGL or OpenGL ES support.") @@ -774,13 +774,13 @@ if(SUPPORT_X11) set(OPENGL_LIBRARIES "${OPENGL_LIBRARIES}" "${OPENGL_glx_LIBRARY}") endif() - if (NOT OPENGL_LIBRARIES MATCHES "(libGL\\.|libGLX\\.)" AND NOT ALLEGRO_EXCLUDE_GLX) + if (NOT OPENGL_LIBRARIES MATCHES "(libGL\\.|libGLX\\.)" AND NOT A5O_EXCLUDE_GLX) message(FATAL_ERROR "X11 support currently requires GLX (set OPENGL_glx_LIBRARY and OpenGL_GLX_FOUND).") endif() check_library_exists(Xcursor XcursorImageCreate "" CAN_XCURSOR) if(CAN_XCURSOR) - set(ALLEGRO_XWINDOWS_WITH_XCURSOR 1) + set(A5O_XWINDOWS_WITH_XCURSOR 1) find_library(XCURSOR_LIB "Xcursor") list(APPEND X11_LIBRARIES "${XCURSOR_LIB}") else(CAN_XCURSOR) @@ -795,7 +795,7 @@ if(SUPPORT_X11) ) if(CAN_XINPUT2 AND XINPUT2_COMPILES) list(APPEND X11_LIBRARIES "Xi") - set(ALLEGRO_XWINDOWS_WITH_XINPUT2 1) + set(A5O_XWINDOWS_WITH_XINPUT2 1) else() message("XInput2 library version 2.2 or higher not found, disabling touch support.") endif() @@ -804,7 +804,7 @@ if(SUPPORT_X11) check_include_file("X11/extensions/xf86vmode.h" HAVE_XF86VIDMODE_H) check_library_exists(Xxf86vm XF86VidModeQueryExtension "" CAN_XF86VIDMODE) if(CAN_XF86VIDMODE AND HAVE_XF86VIDMODE_H) - set(ALLEGRO_XWINDOWS_WITH_XF86VIDMODE 1) + set(A5O_XWINDOWS_WITH_XF86VIDMODE 1) list(APPEND X11_LIBRARIES "Xxf86vm") endif() endif(WANT_X11_XF86VIDMODE) @@ -813,7 +813,7 @@ if(SUPPORT_X11) check_include_file("X11/extensions/Xinerama.h" HAVE_XINERAMA_H) check_library_exists(Xinerama XineramaQueryExtension "" CAN_XINERAMA) if(CAN_XINERAMA AND HAVE_XINERAMA_H) - set(ALLEGRO_XWINDOWS_WITH_XINERAMA 1) + set(A5O_XWINDOWS_WITH_XINERAMA 1) find_library(XINERAMA_LIB "Xinerama") list(APPEND X11_LIBRARIES "${XINERAMA_LIB}") endif() @@ -823,7 +823,7 @@ if(SUPPORT_X11) check_include_file("X11/extensions/Xrandr.h" HAVE_XRANDR_H) check_library_exists(Xrandr XRRQueryExtension "" CAN_XRANDR) if(CAN_XRANDR AND HAVE_XRANDR_H) - set(ALLEGRO_XWINDOWS_WITH_XRANDR 1) + set(A5O_XWINDOWS_WITH_XRANDR 1) find_library(XRANDR_LIB "Xrandr") list(APPEND X11_LIBRARIES "${XRANDR_LIB}") endif() @@ -833,18 +833,18 @@ if(SUPPORT_X11) check_include_file("X11/extensions/scrnsaver.h" HAVE_XSCREENSAVER_H) check_library_exists(Xss XScreenSaverQueryExtension "" CAN_XSCREENSAVER) if(CAN_XSCREENSAVER AND HAVE_XSCREENSAVER_H) - set(ALLEGRO_XWINDOWS_WITH_XSCREENSAVER 1) + set(A5O_XWINDOWS_WITH_XSCREENSAVER 1) find_library(XSCREENSAVER_LIB "Xss") list(APPEND X11_LIBRARIES "${XSCREENSAVER_LIB}") endif() endif(WANT_X11_XSCREENSAVER) - if(NOT ALLEGRO_RASPBERRYPI) + if(NOT A5O_RASPBERRYPI) check_library_exists(X11 XOpenIM "" CAN_XIM) if(CAN_XIM) - set(ALLEGRO_XWINDOWS_WITH_XIM 1) + set(A5O_XWINDOWS_WITH_XIM 1) endif(CAN_XIM) - endif(NOT ALLEGRO_RASPBERRYPI) + endif(NOT A5O_RASPBERRYPI) set(CMAKE_REQUIRED_LIBRARIES) endif(SUPPORT_X11) @@ -875,23 +875,23 @@ if(WIN32) HAVE_XINPUT_CAPABILITIES_EX ) if(HAVE_XINPUT_CAPABILITIES_EX) - set(ALLEGRO_CFG_HAVE_XINPUT_CAPABILITIES_EX 1) + set(A5O_CFG_HAVE_XINPUT_CAPABILITIES_EX 1) endif() set(SUPPORT_XINPUT 1) - set(ALLEGRO_CFG_XINPUT 1) + set(A5O_CFG_XINPUT 1) endif(XINPUT_FOUND) if(WANT_D3D) if(D3D9_FOUND) set(SUPPORT_D3D 1) - set(ALLEGRO_CFG_D3D 1) + set(A5O_CFG_D3D 1) endif(D3D9_FOUND) endif(WANT_D3D) if(SUPPORT_D3D) if(D3DX9_FOUND) include_directories(BEFORE ${D3DX9_INCLUDE_DIR}) - set(ALLEGRO_CFG_D3DX9 1) + set(A5O_CFG_D3DX9 1) else() message("D3DX9 not found. You will not be able to compress or " "decompress textures on the GPU.") @@ -899,7 +899,7 @@ if(WIN32) endif(SUPPORT_D3D) if(WANT_D3D9EX AND SUPPORT_D3D) - set(ALLEGRO_CFG_D3D9EX 1) + set(A5O_CFG_D3D9EX 1) endif(WANT_D3D9EX AND SUPPORT_D3D) endif(WIN32) @@ -921,29 +921,29 @@ endif(WIN32 AND SHARED) # List of source files need to compile Allegro in this configuration on # this platform. set(LIBRARY_SOURCES - ${ALLEGRO_SRC_FILES} + ${A5O_SRC_FILES} ) # Libraries that we always need to link against on this platform. set(PLATFORM_LIBS) -if(ALLEGRO_UNIX) # not MACOSX - list(APPEND LIBRARY_SOURCES ${ALLEGRO_SRC_UNIX_FILES}) +if(A5O_UNIX) # not MACOSX + list(APPEND LIBRARY_SOURCES ${A5O_SRC_UNIX_FILES}) list(APPEND PLATFORM_LIBS m ${CMAKE_THREAD_LIBS_INIT}) -endif(ALLEGRO_UNIX) +endif(A5O_UNIX) -if(SUPPORT_X11 AND NOT ALLEGRO_RASPBERRYPI) - list(APPEND LIBRARY_SOURCES ${ALLEGRO_SRC_X_FILES}) +if(SUPPORT_X11 AND NOT A5O_RASPBERRYPI) + list(APPEND LIBRARY_SOURCES ${A5O_SRC_X_FILES}) list(APPEND PLATFORM_LIBS ${X11_LIBRARIES}) -endif(SUPPORT_X11 AND NOT ALLEGRO_RASPBERRYPI) +endif(SUPPORT_X11 AND NOT A5O_RASPBERRYPI) if(WIN32) - list(APPEND LIBRARY_SOURCES ${ALLEGRO_SRC_WIN_FILES}) + list(APPEND LIBRARY_SOURCES ${A5O_SRC_WIN_FILES}) list(APPEND PLATFORM_LIBS user32 gdi32 comdlg32 ole32 winmm kernel32 psapi shlwapi ) if(SUPPORT_D3D) - list(APPEND LIBRARY_SOURCES ${ALLEGRO_SRC_D3D_FILES}) + list(APPEND LIBRARY_SOURCES ${A5O_SRC_D3D_FILES}) list(APPEND PLATFORM_LIBS ${D3D9_LIBRARIES}) endif(SUPPORT_D3D) @@ -953,115 +953,115 @@ if(WIN32) endif(MINGW AND NOT SHARED) endif(WIN32) -if(ALLEGRO_MACOSX) - list(APPEND LIBRARY_SOURCES ${ALLEGRO_SRC_MACOSX_FILES}) +if(A5O_MACOSX) + list(APPEND LIBRARY_SOURCES ${A5O_SRC_MACOSX_FILES}) find_library(APPKIT_LIBRARY AppKit) find_library(IOKIT_LIBRARY IOKit) find_library(COREVIDEO_LIBRARY CoreVideo) list(APPEND PLATFORM_LIBS ${APPKIT_LIBRARY}) list(APPEND PLATFORM_LIBS ${IOKIT_LIBRARY}) list(APPEND PLATFORM_LIBS ${COREVIDEO_LIBRARY}) -endif(ALLEGRO_MACOSX) +endif(A5O_MACOSX) if(IPHONE) - list(APPEND LIBRARY_SOURCES ${ALLEGRO_SRC_IPHONE_FILES}) + list(APPEND LIBRARY_SOURCES ${A5O_SRC_IPHONE_FILES}) endif(IPHONE) if(ANDROID) - list(APPEND LIBRARY_SOURCES ${ALLEGRO_SRC_ANDROID_FILES}) + list(APPEND LIBRARY_SOURCES ${A5O_SRC_ANDROID_FILES}) list(APPEND PLATFORM_LIBS m log) endif(ANDROID) -if(ALLEGRO_RASPBERRYPI) - list(APPEND LIBRARY_SOURCES ${ALLEGRO_SRC_RASPBERRYPI_FILES}) +if(A5O_RASPBERRYPI) + list(APPEND LIBRARY_SOURCES ${A5O_SRC_RASPBERRYPI_FILES}) list(APPEND PLATFORM_LIBS ${X11_LIBRARIES}) -endif(ALLEGRO_RASPBERRYPI) +endif(A5O_RASPBERRYPI) if(SUPPORT_OPENGL) - list(APPEND LIBRARY_SOURCES ${ALLEGRO_SRC_OPENGL_FILES}) + list(APPEND LIBRARY_SOURCES ${A5O_SRC_OPENGL_FILES}) if(WIN32) - list(APPEND LIBRARY_SOURCES ${ALLEGRO_SRC_WGL_FILES}) + list(APPEND LIBRARY_SOURCES ${A5O_SRC_WGL_FILES}) endif(WIN32) list(APPEND PLATFORM_LIBS ${OPENGL_LIBRARIES}) endif(SUPPORT_OPENGL) -if(SUPPORT_OPENGL AND WANT_SHADERS_GL AND NOT ALLEGRO_CFG_OPENGLES1) - set(ALLEGRO_CFG_SHADER_GLSL 1) +if(SUPPORT_OPENGL AND WANT_SHADERS_GL AND NOT A5O_CFG_OPENGLES1) + set(A5O_CFG_SHADER_GLSL 1) endif() if(SUPPORT_D3D AND WANT_SHADERS_D3D AND D3DX9_FOUND) - set(ALLEGRO_CFG_SHADER_HLSL 1) + set(A5O_CFG_SHADER_HLSL 1) endif() # Header files that we need to install. -set(ALLEGRO_PUBLIC_HEADERS - ${ALLEGRO_INCLUDE_ALLEGRO_FILES} - ${ALLEGRO_INCLUDE_ALLEGRO_INLINE_FILES} - ${ALLEGRO_INCLUDE_ALLEGRO_INTERNAL_FILES} - ${ALLEGRO_INCLUDE_ALLEGRO_PLATFORM_FILES} +set(A5O_PUBLIC_HEADERS + ${A5O_INCLUDE_A5O_FILES} + ${A5O_INCLUDE_A5O_INLINE_FILES} + ${A5O_INCLUDE_A5O_INTERNAL_FILES} + ${A5O_INCLUDE_A5O_PLATFORM_FILES} ) if(WIN32) - list(APPEND ALLEGRO_PUBLIC_HEADERS - ${ALLEGRO_INCLUDE_ALLEGRO_WINDOWS_FILES} + list(APPEND A5O_PUBLIC_HEADERS + ${A5O_INCLUDE_A5O_WINDOWS_FILES} ) endif(WIN32) if(MACOSX) - list(APPEND ALLEGRO_PUBLIC_HEADERS - ${ALLEGRO_INCLUDE_ALLEGRO_MACOSX_FILES} + list(APPEND A5O_PUBLIC_HEADERS + ${A5O_INCLUDE_A5O_MACOSX_FILES} ) endif(MACOSX) if(IPHONE) - list(APPEND ALLEGRO_PUBLIC_HEADERS - ${ALLEGRO_INCLUDE_ALLEGRO_IPHONE_FILES} + list(APPEND A5O_PUBLIC_HEADERS + ${A5O_INCLUDE_A5O_IPHONE_FILES} ) endif(IPHONE) -if(SUPPORT_X11 AND NOT ALLEGRO_RASPBERRYPI) - list(APPEND ALLEGRO_PUBLIC_HEADERS - ${ALLEGRO_INCLUDE_ALLEGRO_X_FILES} +if(SUPPORT_X11 AND NOT A5O_RASPBERRYPI) + list(APPEND A5O_PUBLIC_HEADERS + ${A5O_INCLUDE_A5O_X_FILES} ) -endif(SUPPORT_X11 AND NOT ALLEGRO_RASPBERRYPI) +endif(SUPPORT_X11 AND NOT A5O_RASPBERRYPI) if(ANDROID) - list(APPEND ALLEGRO_PUBLIC_HEADERS ${ALLEGRO_INCLUDE_ALLEGRO_ANDROID_FILES}) + list(APPEND A5O_PUBLIC_HEADERS ${A5O_INCLUDE_A5O_ANDROID_FILES}) endif(ANDROID) if(SUPPORT_OPENGL) - list(APPEND ALLEGRO_PUBLIC_HEADERS - ${ALLEGRO_INCLUDE_ALLEGRO_OPENGL_FILES} - ${ALLEGRO_INCLUDE_ALLEGRO_OPENGL_GLEXT_FILES} + list(APPEND A5O_PUBLIC_HEADERS + ${A5O_INCLUDE_A5O_OPENGL_FILES} + ${A5O_INCLUDE_A5O_OPENGL_GLEXT_FILES} ) endif(SUPPORT_OPENGL) -foreach(genfile ${ALLEGRO_INCLUDE_ALLEGRO_PLATFORM_FILES_GENERATED}) - list(APPEND ALLEGRO_PUBLIC_HEADERS +foreach(genfile ${A5O_INCLUDE_A5O_PLATFORM_FILES_GENERATED}) + list(APPEND A5O_PUBLIC_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/${genfile} ) endforeach(genfile) -if(ALLEGRO_SDL) - list(APPEND LIBRARY_SOURCES ${ALLEGRO_SRC_SDL_FILES}) +if(A5O_SDL) + list(APPEND LIBRARY_SOURCES ${A5O_SRC_SDL_FILES}) list(APPEND PLATFORM_LIBS ${SDL2_LIBRARY} m) include_directories(${SDL2_INCLUDE_DIR}) -endif(ALLEGRO_SDL) +endif(A5O_SDL) -set_our_header_properties(${ALLEGRO_PUBLIC_HEADERS}) -unset(ALLEGRO_TARGETS CACHE) +set_our_header_properties(${A5O_PUBLIC_HEADERS}) +unset(A5O_TARGETS CACHE) if(NOT WANT_MONOLITH) - # ALLEGRO_LIB_BUILD is defined for all Allegro sources (core and addon) - # ALLEGRO_SRC is defined only while compiling the core sources (its use is + # A5O_LIB_BUILD is defined for all Allegro sources (core and addon) + # A5O_SRC is defined only while compiling the core sources (its use is # to get the DLL #defines right under Windows for creating DLL export # functions when it is defined or import DLL functions when it is not). add_our_library(allegro - Allegro-${ALLEGRO_SOVERSION} - "${LIBRARY_SOURCES};${ALLEGRO_PUBLIC_HEADERS}" - "${LIBRARY_CFLAGS} -DALLEGRO_SRC" + Allegro-${A5O_SOVERSION} + "${LIBRARY_SOURCES};${A5O_PUBLIC_HEADERS}" + "${LIBRARY_CFLAGS} -DA5O_SRC" "${PLATFORM_LIBS}" ) endif(NOT WANT_MONOLITH) # Addons and examples should link with this target. -set(ALLEGRO_LINK_WITH allegro) +set(A5O_LINK_WITH allegro) -install_our_headers(${ALLEGRO_PUBLIC_HEADERS}) +install_our_headers(${A5O_PUBLIC_HEADERS}) #-----------------------------------------------------------------------------# # @@ -1086,13 +1086,13 @@ if(WANT_MONOLITH) link_directories(${MONOLITH_LINK_DIRECTORIES}) add_our_library(allegro_monolith - AllegroMonolith-${ALLEGRO_SOVERSION} - "${MONOLITH_SOURCES};${ALLEGRO_PUBLIC_HEADERS}" - "${LIBRARY_CFLAGS} -DALLEGRO_SRC ${MONOLITH_DEFINES}" + AllegroMonolith-${A5O_SOVERSION} + "${MONOLITH_SOURCES};${A5O_PUBLIC_HEADERS}" + "${LIBRARY_CFLAGS} -DA5O_SRC ${MONOLITH_DEFINES}" "${PLATFORM_LIBS};${MONOLITH_LIBRARIES}" ) - set(ALLEGRO_MONOLITH_LINK_WITH allegro_monolith) + set(A5O_MONOLITH_LINK_WITH allegro_monolith) endif(WANT_MONOLITH) #-----------------------------------------------------------------------------# @@ -1102,7 +1102,7 @@ endif(WANT_MONOLITH) #-----------------------------------------------------------------------------# if(NO_FPU) - set(ALLEGRO_CFG_NO_FPU 1) + set(A5O_CFG_NO_FPU 1) endif(NO_FPU) # All relevant variables must be set before here. @@ -1254,11 +1254,11 @@ configure_package_config_file( NO_CHECK_REQUIRED_COMPONENTS_MACRO ) write_basic_package_version_file(${PKG_VERSION_FILE} - VERSION ${ALLEGRO_VERSION} + VERSION ${A5O_VERSION} COMPATIBILITY AnyNewerVersion ) install( - TARGETS ${ALLEGRO_TARGETS} + TARGETS ${A5O_TARGETS} EXPORT ${PKG_TARGETS_NAME} ) install( diff --git a/README_android.txt b/README_android.txt index 506009f86f..d678735342 100644 --- a/README_android.txt +++ b/README_android.txt @@ -335,9 +335,9 @@ native-lib.cpp and replace its code with this: al_flip_display(); redraw = false; } - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_TIMER) { + if (event.type == A5O_EVENT_TIMER) { redraw = true; } } diff --git a/README_macosx.txt b/README_macosx.txt index 66c823dec5..ff3d3326eb 100644 --- a/README_macosx.txt +++ b/README_macosx.txt @@ -49,11 +49,11 @@ will be larger than is reported by the OS. When changing the display DPI or moving the window between two displays with different DPIs, Allegro displays behave in the following way: -- If the ALLEGRO_DISPLAY was created with the ALLEGRO_RESIZABLE flag it will - send an ALLEGRO_DISPLAY_RESIZE event. This will have the effect of your app's +- If the A5O_DISPLAY was created with the A5O_RESIZABLE flag it will + send an A5O_DISPLAY_RESIZE event. This will have the effect of your app's window remaining visually the same, while the display size in pixels will increase or decrease. This is the recommended situation. -- If the ALLEGRO_DISPLAY was not created with the ALLEGRO_RESIZABLE flag, then +- If the A5O_DISPLAY was not created with the A5O_RESIZABLE flag, then the display size in pixels will remain the same, but the app's window will appear to grow or shrink. diff --git a/README_msvc.txt b/README_msvc.txt index 1b654c4850..633be97cf3 100644 --- a/README_msvc.txt +++ b/README_msvc.txt @@ -40,7 +40,7 @@ Once done, press "Configure" again. *Note:* As of the time this is written, CMake has a bug that causes the DLLs in MSVC 10 to be named incorrectly. To work around this, generate MSVC 9 projects -instead. You may need to uncomment the line "#define ALLEGRO_HAVE_STDINT_H" +instead. You may need to uncomment the line "#define A5O_HAVE_STDINT_H" in alplatf.h. Alternatively, use nmake instead of project files. 9. Open up the project solution with the MSVC IDE and start building. diff --git a/README_pkgconfig.txt b/README_pkgconfig.txt index e614673009..ab4bf41a8f 100644 --- a/README_pkgconfig.txt +++ b/README_pkgconfig.txt @@ -42,11 +42,11 @@ option provides that information. You can combine it with `--libs` as well: Most build systems will allow you to call pkg-config in a similar way to the shell. For example, a very basic Makefile might look like this: - ALLEGRO_LIBRARIES := allegro-5 allegro_image-5 - ALLEGRO_FLAGS := $(shell pkg-config --cflags --libs $(ALLEGRO_LIBRARIES)) + A5O_LIBRARIES := allegro-5 allegro_image-5 + A5O_FLAGS := $(shell pkg-config --cflags --libs $(A5O_LIBRARIES)) mygame: mygame.c - $(CC) -o $@ $^ $(ALLEGRO_FLAGS) + $(CC) -o $@ $^ $(A5O_FLAGS) Historical note diff --git a/README_sdl.txt b/README_sdl.txt index 7582acc0c7..df3fb2c463 100644 --- a/README_sdl.txt +++ b/README_sdl.txt @@ -14,7 +14,7 @@ SDL2 is required. Building -------- -Pass -D ALLEGRO_SDL=on to cmake to enable building for SDL2. +Pass -D A5O_SDL=on to cmake to enable building for SDL2. Limitations @@ -72,14 +72,14 @@ EM_CACHE=path-to-emsdk/upstream/emscripten/cache emcmake cmake .. \ -D CMAKE_BUILD_TYPE=Release \ - -D ALLEGRO_SDL=ON \ + -D A5O_SDL=ON \ -D SHARED=OFF \ -D WANT_MONOLITH=ON \ -D WANT_ALLOW_SSE=OFF \ -D WANT_DOCS=OFF \ -D WANT_TESTS=OFF \ -D WANT_OPENAL=OFF \ - -D ALLEGRO_WAIT_EVENT_SLEEP=ON \ + -D A5O_WAIT_EVENT_SLEEP=ON \ -D SDL2_INCLUDE_DIR=$EM_CACHE/sysroot/include \ -D CMAKE_C_FLAGS="${USE_FLAGS[*]}" \ -D CMAKE_CXX_FLAGS="${USE_FLAGS[*]}" \ diff --git a/README_windows.txt b/README_windows.txt index 1e36c2a6ac..f8eef38da4 100644 --- a/README_windows.txt +++ b/README_windows.txt @@ -9,12 +9,12 @@ scaled by the OS. This is mostly transparent on your end, the only complication comes when the DPI changes on the fly (e.g. your app's window gets moved between displays with different DPIs): -- If the ALLEGRO_DISPLAY was created with the ALLEGRO_RESIZABLE flag it will - send an ALLEGRO_DISPLAY_RESIZE event. This will have the effect of your app's +- If the A5O_DISPLAY was created with the A5O_RESIZABLE flag it will + send an A5O_DISPLAY_RESIZE event. This will have the effect of your app's window remaining visually the same, while the display size in pixels will increase or decrease. This is the recommended situation. -- If the ALLEGRO_DISPLAY was not created with the ALLEGRO_RESIZABLE flag, then +- If the A5O_DISPLAY was not created with the A5O_RESIZABLE flag, then the display size in pixels will remain the same, but the app's window will appear to grow or shrink. diff --git a/addons/CMakeLists.txt b/addons/CMakeLists.txt index 726bd8b19b..f11c273308 100644 --- a/addons/CMakeLists.txt +++ b/addons/CMakeLists.txt @@ -261,8 +261,8 @@ addons_summary("- Video addon" SUPPORT_VIDEO) add_subdirectory(main) # SUPPORT_MAIN and MAIN_LINK_WITH are spelt as such in this scope, # but are prefixed with ALLEGRO in the parent scope. -set(SUPPORT_ALLEGRO_MAIN ${SUPPORT_MAIN} PARENT_SCOPE) -set(ALLEGRO_MAIN_LINK_WITH ${MAIN_LINK_WITH} PARENT_SCOPE) +set(SUPPORT_A5O_MAIN ${SUPPORT_MAIN} PARENT_SCOPE) +set(A5O_MAIN_LINK_WITH ${MAIN_LINK_WITH} PARENT_SCOPE) list(APPEND ADDON_PKG_CONFIG_FILES allegro_main) set(MONOLITH_SOURCES ${MONOLITH_SOURCES} PARENT_SCOPE) diff --git a/addons/acodec/CMakeLists.txt b/addons/acodec/CMakeLists.txt index 6906a999da..ce6ce12008 100644 --- a/addons/acodec/CMakeLists.txt +++ b/addons/acodec/CMakeLists.txt @@ -124,7 +124,7 @@ endif(WANT_FLAC) if(SUPPORT_FLAC) include_directories(SYSTEM ${FLAC_INCLUDE_DIR}) - set(ALLEGRO_CFG_ACODEC_FLAC 1) + set(A5O_CFG_ACODEC_FLAC 1) list(APPEND ACODEC_SOURCES flac.c) list(APPEND ACODEC_INCLUDE_DIRECTORIES ${FLAC_INCLUDE_DIR}) @@ -135,12 +135,12 @@ if(SUPPORT_FLAC) message("WARNING: Dynamic loading will be disabled for FLAC as" " static library was found: ${FLAC_LIBRARY}") else() - get_dll_name(${FLAC_LIBRARY} ALLEGRO_CFG_ACODEC_FLAC_DLL) + get_dll_name(${FLAC_LIBRARY} A5O_CFG_ACODEC_FLAC_DLL) endif() endif() endif(WIN32) - if(NOT ALLEGRO_CFG_ACODEC_FLAC_DLL) + if(NOT A5O_CFG_ACODEC_FLAC_DLL) list(APPEND ACODEC_LIBRARIES ${FLAC_LIBRARIES}) endif() endif(SUPPORT_FLAC) @@ -184,7 +184,7 @@ endif(WANT_DUMB) if(SUPPORT_DUMB) include_directories(SYSTEM ${DUMB_INCLUDE_DIR}) - set(ALLEGRO_CFG_ACODEC_DUMB 1) + set(A5O_CFG_ACODEC_DUMB 1) list(APPEND ACODEC_SOURCES dumb.c) list(APPEND ACODEC_INCLUDE_DIRECTORIES ${DUMB_INCLUDE_DIR}) @@ -194,11 +194,11 @@ if(SUPPORT_DUMB) message("WARNING: Dynamic loading will be disabled for DUMB" " as static library was found: ${DUMB_LIBRARY}") else() - get_dll_name(${DUMB_LIBRARY} ALLEGRO_CFG_ACODEC_DUMB_DLL) + get_dll_name(${DUMB_LIBRARY} A5O_CFG_ACODEC_DUMB_DLL) endif() endif() - if(NOT ALLEGRO_CFG_ACODEC_DUMB_DLL) + if(NOT A5O_CFG_ACODEC_DUMB_DLL) list(APPEND ACODEC_LIBRARIES ${DUMB_LIBRARIES}) endif() endif() @@ -229,7 +229,7 @@ endif() if(SUPPORT_OPENMPT) include_directories(SYSTEM ${OPENMPT_INCLUDE_DIR}) - set(ALLEGRO_CFG_ACODEC_OPENMPT 1) + set(A5O_CFG_ACODEC_OPENMPT 1) list(APPEND ACODEC_SOURCES openmpt.c) list(APPEND ACODEC_INCLUDE_DIRECTORIES ${OPENMPT_INCLUDE_DIR}) list(APPEND ACODEC_LIBRARIES ${OPENMPT_LIBRARIES}) @@ -261,9 +261,9 @@ if(WANT_TREMOR) TREMOR_COMPILES) set(CMAKE_REQUIRED_INCLUDES) set(CMAKE_REQUIRED_LIBRARIES) - if(TREMOR_COMPILES OR IPHONE OR ALLEGRO_RASPBERRYPI) + if(TREMOR_COMPILES OR IPHONE OR A5O_RASPBERRYPI) set(SUPPORT_VORBIS 1) - endif(TREMOR_COMPILES OR IPHONE OR ALLEGRO_RASPBERRYPI) + endif(TREMOR_COMPILES OR IPHONE OR A5O_RASPBERRYPI) endif(TREMOR_FOUND) if(NOT SUPPORT_VORBIS) message("WARNING: Tremor not found although WANT_TREMOR was specified.") @@ -272,7 +272,7 @@ if(WANT_TREMOR) set(OGG_INCLUDE_DIR ${TREMOR_INCLUDE_DIR}) set(VORBIS_INCLUDE_DIR ${TREMOR_INCLUDE_DIR}) set(VORBIS_LIBRARIES ${TREMOR_LIBRARIES}) - set(ALLEGRO_CFG_ACODEC_TREMOR 1) + set(A5O_CFG_ACODEC_TREMOR 1) endif(NOT SUPPORT_VORBIS) elseif(WANT_VORBIS) find_package(Vorbis) @@ -310,7 +310,7 @@ endif() if(SUPPORT_VORBIS) include_directories(SYSTEM ${OGG_INCLUDE_DIR} ${VORBIS_INCLUDE_DIR}) - set(ALLEGRO_CFG_ACODEC_VORBIS 1) + set(A5O_CFG_ACODEC_VORBIS 1) list(APPEND ACODEC_SOURCES ogg.c) list(APPEND ACODEC_INCLUDE_DIRECTORIES ${OGG_INCLUDE_DIR} ${VORBIS_INCLUDE_DIR}) @@ -320,11 +320,11 @@ if(SUPPORT_VORBIS) message("WARNING: Dynamic loading will be disabled for Vorbis" " as static library was found: ${VORBISFILE_LIBRARY}") else() - get_dll_name(${VORBISFILE_LIBRARY} ALLEGRO_CFG_ACODEC_VORBISFILE_DLL) + get_dll_name(${VORBISFILE_LIBRARY} A5O_CFG_ACODEC_VORBISFILE_DLL) endif() endif() - if(NOT ALLEGRO_CFG_ACODEC_VORBISFILE_DLL) + if(NOT A5O_CFG_ACODEC_VORBISFILE_DLL) list(APPEND ACODEC_LIBRARIES ${VORBIS_LIBRARIES}) endif() endif(SUPPORT_VORBIS) @@ -369,7 +369,7 @@ endif() if(SUPPORT_OPUS) include_directories(SYSTEM ${OGG_INCLUDE_DIR} ${OPUS_INCLUDE_DIR}) - set(ALLEGRO_CFG_ACODEC_OPUS 1) + set(A5O_CFG_ACODEC_OPUS 1) list(APPEND ACODEC_SOURCES opus.c) list(APPEND ACODEC_INCLUDE_DIRECTORIES ${OGG_INCLUDE_DIR} ${OPUS_INCLUDE_DIR}) @@ -379,11 +379,11 @@ if(SUPPORT_OPUS) message("WARNING: Dynamic loading will be disabled for Opus" " as static library was found: ${OPUSFILE_LIBRARY}") else() - get_dll_name(${OPUSFILE_LIBRARY} ALLEGRO_CFG_ACODEC_OPUSFILE_DLL) + get_dll_name(${OPUSFILE_LIBRARY} A5O_CFG_ACODEC_OPUSFILE_DLL) endif() endif() - if(NOT ALLEGRO_CFG_ACODEC_OPUSFILE_DLL) + if(NOT A5O_CFG_ACODEC_OPUSFILE_DLL) list(APPEND ACODEC_LIBRARIES ${OPUS_LIBRARIES}) endif() endif(SUPPORT_OPUS) @@ -397,7 +397,7 @@ if(WANT_MP3) find_package(MiniMP3) if(MINIMP3_FOUND) include_directories(SYSTEM ${MINIMP3_INCLUDE_DIRS}) - set(ALLEGRO_CFG_ACODEC_MP3 1) + set(A5O_CFG_ACODEC_MP3 1) list(APPEND ACODEC_SOURCES mp3.c) endif(MINIMP3_FOUND) if(NOT MINIMP3_FOUND) @@ -414,9 +414,9 @@ configure_file( ) add_our_addon_library(allegro_acodec - AllegroAcodec-${ALLEGRO_SOVERSION} + AllegroAcodec-${A5O_SOVERSION} "${ACODEC_SOURCES};${ACODEC_INCLUDE_FILES}" - "-DALLEGRO_ACODEC_SRC ${FLAC__NO_DLL}" + "-DA5O_ACODEC_SRC ${FLAC__NO_DLL}" "${AUDIO_LINK_WITH};${ACODEC_LIBRARIES}" ) diff --git a/addons/acodec/acodec.c b/addons/acodec/acodec.c index bf8379249b..86d80d5428 100644 --- a/addons/acodec/acodec.c +++ b/addons/acodec/acodec.c @@ -12,7 +12,7 @@ static bool acodec_inited = false; */ uint32_t al_get_allegro_acodec_version(void) { - return ALLEGRO_VERSION_INT; + return A5O_VERSION_INT; } @@ -35,7 +35,7 @@ bool al_init_acodec_addon(void) ret &= al_register_sample_loader_f(".voc", _al_load_voc_f); ret &= al_register_sample_identifier(".voc", _al_identify_voc); -#ifdef ALLEGRO_CFG_ACODEC_FLAC +#ifdef A5O_CFG_ACODEC_FLAC ret &= al_register_sample_loader(".flac", _al_load_flac); ret &= al_register_audio_stream_loader(".flac", _al_load_flac_audio_stream); ret &= al_register_sample_loader_f(".flac", _al_load_flac_f); @@ -43,7 +43,7 @@ bool al_init_acodec_addon(void) ret &= al_register_sample_identifier(".flac", _al_identify_flac); #endif -#ifdef ALLEGRO_CFG_ACODEC_VORBIS +#ifdef A5O_CFG_ACODEC_VORBIS ret &= al_register_sample_loader(".ogg", _al_load_ogg_vorbis); ret &= al_register_audio_stream_loader(".ogg", _al_load_ogg_vorbis_audio_stream); ret &= al_register_sample_loader_f(".ogg", _al_load_ogg_vorbis_f); @@ -51,7 +51,7 @@ bool al_init_acodec_addon(void) ret &= al_register_sample_identifier(".ogg", _al_identify_ogg_vorbis); #endif -#ifdef ALLEGRO_CFG_ACODEC_OPUS +#ifdef A5O_CFG_ACODEC_OPUS ret &= al_register_sample_loader(".opus", _al_load_ogg_opus); ret &= al_register_audio_stream_loader(".opus", _al_load_ogg_opus_audio_stream); ret &= al_register_sample_loader_f(".opus", _al_load_ogg_opus_f); @@ -59,16 +59,16 @@ bool al_init_acodec_addon(void) ret &= al_register_sample_identifier(".opus", _al_identify_ogg_opus); #endif -#ifdef ALLEGRO_CFG_ACODEC_DUMB +#ifdef A5O_CFG_ACODEC_DUMB ret &= _al_register_dumb_loaders(); #endif -#ifdef ALLEGRO_CFG_ACODEC_OPENMPT +#ifdef A5O_CFG_ACODEC_OPENMPT ret &= _al_register_openmpt_loaders(); #endif /* MP3 will mis-identify a lot of mod files, so put its identifier last */ -#ifdef ALLEGRO_CFG_ACODEC_MP3 +#ifdef A5O_CFG_ACODEC_MP3 ret &= al_register_sample_loader(".mp3", _al_load_mp3); ret &= al_register_audio_stream_loader(".mp3", _al_load_mp3_audio_stream); ret &= al_register_sample_loader_f(".mp3", _al_load_mp3_f); diff --git a/addons/acodec/acodec.h b/addons/acodec/acodec.h index e78386b677..3e04ce45f9 100644 --- a/addons/acodec/acodec.h +++ b/addons/acodec/acodec.h @@ -3,88 +3,88 @@ #include "allegro5/internal/aintern_acodec_cfg.h" -ALLEGRO_SAMPLE *_al_load_wav(const char *filename); -ALLEGRO_SAMPLE *_al_load_wav_f(ALLEGRO_FILE *fp); -ALLEGRO_AUDIO_STREAM *_al_load_wav_audio_stream(const char *filename, +A5O_SAMPLE *_al_load_wav(const char *filename); +A5O_SAMPLE *_al_load_wav_f(A5O_FILE *fp); +A5O_AUDIO_STREAM *_al_load_wav_audio_stream(const char *filename, size_t buffer_count, unsigned int samples); -ALLEGRO_AUDIO_STREAM *_al_load_wav_audio_stream_f(ALLEGRO_FILE* f, +A5O_AUDIO_STREAM *_al_load_wav_audio_stream_f(A5O_FILE* f, size_t buffer_count, unsigned int samples); -bool _al_save_wav(const char *filename, ALLEGRO_SAMPLE *spl); -bool _al_save_wav_f(ALLEGRO_FILE *pf, ALLEGRO_SAMPLE *spl); -bool _al_identify_wav(ALLEGRO_FILE *f); +bool _al_save_wav(const char *filename, A5O_SAMPLE *spl); +bool _al_save_wav_f(A5O_FILE *pf, A5O_SAMPLE *spl); +bool _al_identify_wav(A5O_FILE *f); /* * Built-in Port of A4 Creative Voice file (.voc) Loader. * should not implement streams since it's unlikely this container * will ever be used as such. */ -ALLEGRO_SAMPLE *_al_load_voc(const char *filename); -ALLEGRO_SAMPLE *_al_load_voc_f(ALLEGRO_FILE *fp); -bool _al_identify_voc(ALLEGRO_FILE *f); +A5O_SAMPLE *_al_load_voc(const char *filename); +A5O_SAMPLE *_al_load_voc_f(A5O_FILE *fp); +bool _al_identify_voc(A5O_FILE *f); -#ifdef ALLEGRO_CFG_ACODEC_FLAC -ALLEGRO_SAMPLE *_al_load_flac(const char *filename); -ALLEGRO_SAMPLE *_al_load_flac_f(ALLEGRO_FILE *f); -ALLEGRO_AUDIO_STREAM *_al_load_flac_audio_stream(const char *filename, +#ifdef A5O_CFG_ACODEC_FLAC +A5O_SAMPLE *_al_load_flac(const char *filename); +A5O_SAMPLE *_al_load_flac_f(A5O_FILE *f); +A5O_AUDIO_STREAM *_al_load_flac_audio_stream(const char *filename, size_t buffer_count, unsigned int samples); -ALLEGRO_AUDIO_STREAM *_al_load_flac_audio_stream_f(ALLEGRO_FILE* f, +A5O_AUDIO_STREAM *_al_load_flac_audio_stream_f(A5O_FILE* f, size_t buffer_count, unsigned int samples); -bool _al_identify_flac(ALLEGRO_FILE *f); +bool _al_identify_flac(A5O_FILE *f); #endif -#ifdef ALLEGRO_CFG_ACODEC_DUMB +#ifdef A5O_CFG_ACODEC_DUMB bool _al_register_dumb_loaders(void); #endif -#ifdef ALLEGRO_CFG_ACODEC_OPENMPT +#ifdef A5O_CFG_ACODEC_OPENMPT bool _al_register_openmpt_loaders(void); #endif -#if defined(ALLEGRO_CFG_ACODEC_DUMB) || defined(ALLEGRO_CFG_ACODEC_OPENMPT) -bool _al_identify_it(ALLEGRO_FILE *f); -bool _al_identify_669(ALLEGRO_FILE *f); -bool _al_identify_amf(ALLEGRO_FILE *f); -bool _al_identify_asy(ALLEGRO_FILE *f); -bool _al_identify_mtm(ALLEGRO_FILE *f); -bool _al_identify_okt(ALLEGRO_FILE *f); -bool _al_identify_psm(ALLEGRO_FILE *f); -bool _al_identify_ptm(ALLEGRO_FILE *f); -bool _al_identify_riff(ALLEGRO_FILE *f); -bool _al_identify_stm(ALLEGRO_FILE *f); -bool _al_identify_mod(ALLEGRO_FILE *f); -bool _al_identify_s3m(ALLEGRO_FILE *f); -bool _al_identify_xm(ALLEGRO_FILE *f); +#if defined(A5O_CFG_ACODEC_DUMB) || defined(A5O_CFG_ACODEC_OPENMPT) +bool _al_identify_it(A5O_FILE *f); +bool _al_identify_669(A5O_FILE *f); +bool _al_identify_amf(A5O_FILE *f); +bool _al_identify_asy(A5O_FILE *f); +bool _al_identify_mtm(A5O_FILE *f); +bool _al_identify_okt(A5O_FILE *f); +bool _al_identify_psm(A5O_FILE *f); +bool _al_identify_ptm(A5O_FILE *f); +bool _al_identify_riff(A5O_FILE *f); +bool _al_identify_stm(A5O_FILE *f); +bool _al_identify_mod(A5O_FILE *f); +bool _al_identify_s3m(A5O_FILE *f); +bool _al_identify_xm(A5O_FILE *f); #endif -#ifdef ALLEGRO_CFG_ACODEC_VORBIS -ALLEGRO_SAMPLE *_al_load_ogg_vorbis(const char *filename); -ALLEGRO_SAMPLE *_al_load_ogg_vorbis_f(ALLEGRO_FILE *file); -ALLEGRO_AUDIO_STREAM *_al_load_ogg_vorbis_audio_stream(const char *filename, +#ifdef A5O_CFG_ACODEC_VORBIS +A5O_SAMPLE *_al_load_ogg_vorbis(const char *filename); +A5O_SAMPLE *_al_load_ogg_vorbis_f(A5O_FILE *file); +A5O_AUDIO_STREAM *_al_load_ogg_vorbis_audio_stream(const char *filename, size_t buffer_count, unsigned int samples); -ALLEGRO_AUDIO_STREAM *_al_load_ogg_vorbis_audio_stream_f(ALLEGRO_FILE* file, +A5O_AUDIO_STREAM *_al_load_ogg_vorbis_audio_stream_f(A5O_FILE* file, size_t buffer_count, unsigned int samples); -bool _al_identify_ogg_vorbis(ALLEGRO_FILE *f); +bool _al_identify_ogg_vorbis(A5O_FILE *f); #endif -#ifdef ALLEGRO_CFG_ACODEC_OPUS -ALLEGRO_SAMPLE *_al_load_ogg_opus(const char *filename); -ALLEGRO_SAMPLE *_al_load_ogg_opus_f(ALLEGRO_FILE *file); -ALLEGRO_AUDIO_STREAM *_al_load_ogg_opus_audio_stream(const char *filename, +#ifdef A5O_CFG_ACODEC_OPUS +A5O_SAMPLE *_al_load_ogg_opus(const char *filename); +A5O_SAMPLE *_al_load_ogg_opus_f(A5O_FILE *file); +A5O_AUDIO_STREAM *_al_load_ogg_opus_audio_stream(const char *filename, size_t buffer_count, unsigned int samples); -ALLEGRO_AUDIO_STREAM *_al_load_ogg_opus_audio_stream_f(ALLEGRO_FILE* file, +A5O_AUDIO_STREAM *_al_load_ogg_opus_audio_stream_f(A5O_FILE* file, size_t buffer_count, unsigned int samples); -bool _al_identify_ogg_opus(ALLEGRO_FILE *f); +bool _al_identify_ogg_opus(A5O_FILE *f); #endif -#ifdef ALLEGRO_CFG_ACODEC_MP3 -ALLEGRO_SAMPLE *_al_load_mp3(const char *filename); -ALLEGRO_SAMPLE *_al_load_mp3_f(ALLEGRO_FILE *f); -ALLEGRO_AUDIO_STREAM *_al_load_mp3_audio_stream(const char *filename, +#ifdef A5O_CFG_ACODEC_MP3 +A5O_SAMPLE *_al_load_mp3(const char *filename); +A5O_SAMPLE *_al_load_mp3_f(A5O_FILE *f); +A5O_AUDIO_STREAM *_al_load_mp3_audio_stream(const char *filename, size_t buffer_count, unsigned int samples); -ALLEGRO_AUDIO_STREAM *_al_load_mp3_audio_stream_f(ALLEGRO_FILE* f, +A5O_AUDIO_STREAM *_al_load_mp3_audio_stream_f(A5O_FILE* f, size_t buffer_count, unsigned int samples); -bool _al_identify_mp3(ALLEGRO_FILE *f); +bool _al_identify_mp3(A5O_FILE *f); #endif #endif diff --git a/addons/acodec/allegro5/allegro_acodec.h b/addons/acodec/allegro5/allegro_acodec.h index cdbe7e0151..21be215718 100644 --- a/addons/acodec/allegro5/allegro_acodec.h +++ b/addons/acodec/allegro5/allegro_acodec.h @@ -8,30 +8,30 @@ extern "C" { #endif -#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) - #ifndef ALLEGRO_STATICLINK - #ifdef ALLEGRO_ACODEC_SRC - #define _ALLEGRO_ACODEC_DLL __declspec(dllexport) +#if (defined A5O_MINGW32) || (defined A5O_MSVC) + #ifndef A5O_STATICLINK + #ifdef A5O_ACODEC_SRC + #define _A5O_ACODEC_DLL __declspec(dllexport) #else - #define _ALLEGRO_ACODEC_DLL __declspec(dllimport) + #define _A5O_ACODEC_DLL __declspec(dllimport) #endif #else - #define _ALLEGRO_ACODEC_DLL + #define _A5O_ACODEC_DLL #endif #endif -#if defined ALLEGRO_MSVC - #define ALLEGRO_ACODEC_FUNC(type, name, args) _ALLEGRO_ACODEC_DLL type __cdecl name args -#elif defined ALLEGRO_MINGW32 - #define ALLEGRO_ACODEC_FUNC(type, name, args) extern type name args +#if defined A5O_MSVC + #define A5O_ACODEC_FUNC(type, name, args) _A5O_ACODEC_DLL type __cdecl name args +#elif defined A5O_MINGW32 + #define A5O_ACODEC_FUNC(type, name, args) extern type name args #else - #define ALLEGRO_ACODEC_FUNC AL_FUNC + #define A5O_ACODEC_FUNC AL_FUNC #endif -ALLEGRO_ACODEC_FUNC(bool, al_init_acodec_addon, (void)); -ALLEGRO_ACODEC_FUNC(bool, al_is_acodec_addon_initialized, (void)); -ALLEGRO_ACODEC_FUNC(uint32_t, al_get_allegro_acodec_version, (void)); +A5O_ACODEC_FUNC(bool, al_init_acodec_addon, (void)); +A5O_ACODEC_FUNC(bool, al_is_acodec_addon_initialized, (void)); +A5O_ACODEC_FUNC(uint32_t, al_get_allegro_acodec_version, (void)); #ifdef __cplusplus diff --git a/addons/acodec/allegro5/internal/aintern_acodec_cfg.h.cmake b/addons/acodec/allegro5/internal/aintern_acodec_cfg.h.cmake index e96aaddf9d..33a5eff8b1 100644 --- a/addons/acodec/allegro5/internal/aintern_acodec_cfg.h.cmake +++ b/addons/acodec/allegro5/internal/aintern_acodec_cfg.h.cmake @@ -1,14 +1,14 @@ -#cmakedefine ALLEGRO_CFG_ACODEC_FLAC -#cmakedefine ALLEGRO_CFG_ACODEC_DUMB -#cmakedefine ALLEGRO_CFG_ACODEC_OPENMPT -#cmakedefine ALLEGRO_CFG_ACODEC_VORBIS -#cmakedefine ALLEGRO_CFG_ACODEC_TREMOR -#cmakedefine ALLEGRO_CFG_ACODEC_OPUS -#cmakedefine ALLEGRO_CFG_ACODEC_MP3 +#cmakedefine A5O_CFG_ACODEC_FLAC +#cmakedefine A5O_CFG_ACODEC_DUMB +#cmakedefine A5O_CFG_ACODEC_OPENMPT +#cmakedefine A5O_CFG_ACODEC_VORBIS +#cmakedefine A5O_CFG_ACODEC_TREMOR +#cmakedefine A5O_CFG_ACODEC_OPUS +#cmakedefine A5O_CFG_ACODEC_MP3 /* Define if the library should be loaded dynamically. */ -#cmakedefine ALLEGRO_CFG_ACODEC_FLAC_DLL "@ALLEGRO_CFG_ACODEC_FLAC_DLL@" -#cmakedefine ALLEGRO_CFG_ACODEC_DUMB_DLL "@ALLEGRO_CFG_ACODEC_DUMB_DLL@" -#cmakedefine ALLEGRO_CFG_ACODEC_VORBISFILE_DLL "@ALLEGRO_CFG_ACODEC_VORBISFILE_DLL@" -#cmakedefine ALLEGRO_CFG_ACODEC_OPUSFILE_DLL "@ALLEGRO_CFG_ACODEC_OPUSFILE_DLL@" +#cmakedefine A5O_CFG_ACODEC_FLAC_DLL "@A5O_CFG_ACODEC_FLAC_DLL@" +#cmakedefine A5O_CFG_ACODEC_DUMB_DLL "@A5O_CFG_ACODEC_DUMB_DLL@" +#cmakedefine A5O_CFG_ACODEC_VORBISFILE_DLL "@A5O_CFG_ACODEC_VORBISFILE_DLL@" +#cmakedefine A5O_CFG_ACODEC_OPUSFILE_DLL "@A5O_CFG_ACODEC_OPUSFILE_DLL@" diff --git a/addons/acodec/dumb.c b/addons/acodec/dumb.c index 5ea8799083..96b5630237 100644 --- a/addons/acodec/dumb.c +++ b/addons/acodec/dumb.c @@ -15,8 +15,8 @@ #include "acodec.h" #include "helper.h" -#ifndef ALLEGRO_CFG_ACODEC_DUMB - #error configuration problem, ALLEGRO_CFG_ACODEC_DUMB not set +#ifndef A5O_CFG_ACODEC_DUMB + #error configuration problem, A5O_CFG_ACODEC_DUMB not set #endif // We use the deprecated duh_render in DUMB 2. @@ -24,7 +24,7 @@ #include #include -ALLEGRO_DEBUG_CHANNEL("acodec") +A5O_DEBUG_CHANNEL("acodec") /* In addition to DUMB 0.9.3 at http://dumb.sourceforge.net/, * we support kode54's fork of DUMB at https://github.com/kode54/dumb. @@ -34,22 +34,22 @@ ALLEGRO_DEBUG_CHANNEL("acodec") /* forward declarations */ static bool init_libdumb(void); -static size_t modaudio_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, +static size_t modaudio_stream_update(A5O_AUDIO_STREAM *stream, void *data, size_t buf_size); -static bool modaudio_stream_rewind(ALLEGRO_AUDIO_STREAM *stream); -static bool modaudio_stream_seek(ALLEGRO_AUDIO_STREAM *stream, double time); -static double modaudio_stream_get_position(ALLEGRO_AUDIO_STREAM *stream); -static double modaudio_stream_get_length(ALLEGRO_AUDIO_STREAM *stream); -static bool modaudio_stream_set_loop(ALLEGRO_AUDIO_STREAM *stream, +static bool modaudio_stream_rewind(A5O_AUDIO_STREAM *stream); +static bool modaudio_stream_seek(A5O_AUDIO_STREAM *stream, double time); +static double modaudio_stream_get_position(A5O_AUDIO_STREAM *stream); +static double modaudio_stream_get_length(A5O_AUDIO_STREAM *stream); +static bool modaudio_stream_set_loop(A5O_AUDIO_STREAM *stream, double start, double end); -static void modaudio_stream_close(ALLEGRO_AUDIO_STREAM *stream); +static void modaudio_stream_close(A5O_AUDIO_STREAM *stream); typedef struct MOD_FILE { DUH *duh; DUH_SIGRENDERER *sig; - ALLEGRO_FILE *fh; + A5O_FILE *fh; double length; long loop_start, loop_end; } MOD_FILE; @@ -59,7 +59,7 @@ static bool libdumb_loaded = false; /* dynamic loading support (Windows only currently) */ -#ifdef ALLEGRO_CFG_ACODEC_DUMB_DLL +#ifdef A5O_CFG_ACODEC_DUMB_DLL static void *dumb_dll = NULL; #endif @@ -126,7 +126,7 @@ static void *dfs_open(const char *filename) static int dfs_skip(void *f, dumb_off_t n) { - return al_fseek(f, n, ALLEGRO_SEEK_CUR) ? 0 : -1; + return al_fseek(f, n, A5O_SEEK_CUR) ? 0 : -1; } static int dfs_getc(void *f) @@ -148,7 +148,7 @@ static void dfs_close(void *f) #if (DUMB_MAJOR_VERSION) >= 2 static int dfs_seek(void *f, dumb_off_t n) { - return al_fseek(f, n, ALLEGRO_SEEK_SET) ? 0 : -1; + return al_fseek(f, n, A5O_SEEK_SET) ? 0 : -1; } static dumb_off_t dfs_get_size(void *f) @@ -166,7 +166,7 @@ static int loop_callback(void *data) return 0; } -static size_t modaudio_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, +static size_t modaudio_stream_update(A5O_AUDIO_STREAM *stream, void *data, size_t buf_size) { MOD_FILE *const df = stream->extra; @@ -180,7 +180,7 @@ static size_t modaudio_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, DUMB_IT_SIGRENDERER *it_sig = lib.duh_get_it_sigrenderer(df->sig); if (it_sig) { lib.dumb_it_set_loop_callback(it_sig, - stream->spl.loop == _ALLEGRO_PLAYMODE_STREAM_ONCE + stream->spl.loop == _A5O_PLAYMODE_STREAM_ONCE ? lib.dumb_it_callback_terminate : loop_callback, &internal_loop); } @@ -191,7 +191,7 @@ static size_t modaudio_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, internal_loop = false; /* If manual looping is not enabled, then we need to implement * short-stopping manually. */ - if (stream->spl.loop != _ALLEGRO_PLAYMODE_STREAM_ONCE && df->loop_end != -1 && + if (stream->spl.loop != _A5O_PLAYMODE_STREAM_ONCE && df->loop_end != -1 && position + 65536 * size_to_read / 44100 >= df->loop_end) { size_to_read = (df->loop_end - position) * 44100 / 65536; if (size_to_read < 0) @@ -214,7 +214,7 @@ static size_t modaudio_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, return written; } -static void modaudio_stream_close(ALLEGRO_AUDIO_STREAM *stream) +static void modaudio_stream_close(A5O_AUDIO_STREAM *stream) { MOD_FILE *const df = stream->extra; _al_acodec_stop_feed_thread(stream); @@ -225,7 +225,7 @@ static void modaudio_stream_close(ALLEGRO_AUDIO_STREAM *stream) al_fclose(df->fh); } -static bool modaudio_stream_rewind(ALLEGRO_AUDIO_STREAM *stream) +static bool modaudio_stream_rewind(A5O_AUDIO_STREAM *stream) { MOD_FILE *const df = stream->extra; lib.duh_end_sigrenderer(df->sig); @@ -233,7 +233,7 @@ static bool modaudio_stream_rewind(ALLEGRO_AUDIO_STREAM *stream) return true; } -static bool modaudio_stream_seek(ALLEGRO_AUDIO_STREAM *stream, double time) +static bool modaudio_stream_seek(A5O_AUDIO_STREAM *stream, double time) { MOD_FILE *const df = stream->extra; @@ -247,19 +247,19 @@ static bool modaudio_stream_seek(ALLEGRO_AUDIO_STREAM *stream, double time) return true; } -static double modaudio_stream_get_position(ALLEGRO_AUDIO_STREAM *stream) +static double modaudio_stream_get_position(A5O_AUDIO_STREAM *stream) { MOD_FILE *const df = stream->extra; return lib.duh_sigrenderer_get_position(df->sig) / 65536.0; } -static double modaudio_stream_get_length(ALLEGRO_AUDIO_STREAM *stream) +static double modaudio_stream_get_length(A5O_AUDIO_STREAM *stream) { MOD_FILE *const df = stream->extra; return df->length; } -static bool modaudio_stream_set_loop(ALLEGRO_AUDIO_STREAM *stream, +static bool modaudio_stream_set_loop(A5O_AUDIO_STREAM *stream, double start, double end) { MOD_FILE *const df = stream->extra; @@ -270,7 +270,7 @@ static bool modaudio_stream_set_loop(ALLEGRO_AUDIO_STREAM *stream, return true; } -static ALLEGRO_AUDIO_STREAM *modaudio_stream_init(ALLEGRO_FILE* f, +static A5O_AUDIO_STREAM *modaudio_stream_init(A5O_FILE* f, size_t buffer_count, unsigned int samples #if (DUMB_MAJOR_VERSION) < 2 /* For DUMB 0.9.3, we must choose a loader function ourselves. */ @@ -278,7 +278,7 @@ static ALLEGRO_AUDIO_STREAM *modaudio_stream_init(ALLEGRO_FILE* f, #endif ) { - ALLEGRO_AUDIO_STREAM *stream; + A5O_AUDIO_STREAM *stream; DUMBFILE *df; DUH_SIGRENDERER *sig = NULL; DUH *duh = NULL; @@ -287,7 +287,7 @@ static ALLEGRO_AUDIO_STREAM *modaudio_stream_init(ALLEGRO_FILE* f, df = lib.dumbfile_open_ex(f, &dfs_f); if (!df) { - ALLEGRO_ERROR("dumbfile_open_ex failed.\n"); + A5O_ERROR("dumbfile_open_ex failed.\n"); return NULL; } @@ -309,13 +309,13 @@ static ALLEGRO_AUDIO_STREAM *modaudio_stream_init(ALLEGRO_FILE* f, duh = loader(df); #endif if (!duh) { - ALLEGRO_ERROR("Failed to create DUH.\n"); + A5O_ERROR("Failed to create DUH.\n"); goto Error; } sig = lib.duh_start_sigrenderer(duh, 0, 2, 0); if (!sig) { - ALLEGRO_ERROR("duh_start_sigrenderer failed.\n"); + A5O_ERROR("duh_start_sigrenderer failed.\n"); goto Error; } @@ -326,7 +326,7 @@ static ALLEGRO_AUDIO_STREAM *modaudio_stream_init(ALLEGRO_FILE* f, } stream = al_create_audio_stream(buffer_count, samples, 44100, - ALLEGRO_AUDIO_DEPTH_INT16, ALLEGRO_CHANNEL_CONF_2); + A5O_AUDIO_DEPTH_INT16, A5O_CHANNEL_CONF_2); if (stream) { MOD_FILE *mf = al_malloc(sizeof(MOD_FILE)); @@ -355,7 +355,7 @@ static ALLEGRO_AUDIO_STREAM *modaudio_stream_init(ALLEGRO_FILE* f, _al_acodec_start_feed_thread(stream); } else { - ALLEGRO_ERROR("Failed to create stream.\n"); + A5O_ERROR("Failed to create stream.\n"); goto Error; } @@ -373,7 +373,7 @@ static ALLEGRO_AUDIO_STREAM *modaudio_stream_init(ALLEGRO_FILE* f, /* try to return back to where we started to load */ if (start_pos != -1) - al_fseek(f, start_pos, ALLEGRO_SEEK_SET); + al_fseek(f, start_pos, A5O_SEEK_SET); return NULL; } @@ -385,7 +385,7 @@ static void shutdown_libdumb(void) libdumb_loaded = false; } -#ifdef ALLEGRO_CFG_ACODEC_DUMB_DLL +#ifdef A5O_CFG_ACODEC_DUMB_DLL if (dumb_dll) { _al_close_library(dumb_dll); dumb_dll = NULL; @@ -399,10 +399,10 @@ static bool init_libdumb(void) return true; } -#ifdef ALLEGRO_CFG_ACODEC_DUMB_DLL - dumb_dll = _al_open_library(ALLEGRO_CFG_ACODEC_DUMB_DLL); +#ifdef A5O_CFG_ACODEC_DUMB_DLL + dumb_dll = _al_open_library(A5O_CFG_ACODEC_DUMB_DLL); if (!dumb_dll) { - ALLEGRO_ERROR("Could not load " ALLEGRO_CFG_ACODEC_DUMB_DLL "\n"); + A5O_ERROR("Could not load " A5O_CFG_ACODEC_DUMB_DLL "\n"); return false; } @@ -411,7 +411,7 @@ static bool init_libdumb(void) { \ lib.x = _al_import_symbol(dumb_dll, #x); \ if (lib.x == 0) { \ - ALLEGRO_ERROR("undefined symbol in lib structure: " #x "\n"); \ + A5O_ERROR("undefined symbol in lib structure: " #x "\n"); \ return false; \ } \ } while(0) @@ -469,7 +469,7 @@ static bool init_libdumb(void) #if (DUMB_MAJOR_VERSION) >= 2 -static ALLEGRO_AUDIO_STREAM *load_dumb_audio_stream_f(ALLEGRO_FILE *f, +static A5O_AUDIO_STREAM *load_dumb_audio_stream_f(A5O_FILE *f, size_t buffer_count, unsigned int samples) { if (!init_libdumb()) @@ -481,11 +481,11 @@ static ALLEGRO_AUDIO_STREAM *load_dumb_audio_stream_f(ALLEGRO_FILE *f, * DUMB 2.0 figures out the file format for us. * Need only one loader from disk file and one loader from DUMBFILE. */ -static ALLEGRO_AUDIO_STREAM *load_dumb_audio_stream(const char *filename, +static A5O_AUDIO_STREAM *load_dumb_audio_stream(const char *filename, size_t buffer_count, unsigned int samples) { - ALLEGRO_FILE *f; - ALLEGRO_AUDIO_STREAM *stream; + A5O_FILE *f; + A5O_AUDIO_STREAM *stream; ASSERT(filename); f = al_fopen(filename, "rb"); @@ -513,7 +513,7 @@ static ALLEGRO_AUDIO_STREAM *load_dumb_audio_stream(const char *filename, * all identical, except for the function called in the middle. */ -static ALLEGRO_AUDIO_STREAM *load_mod_audio_stream_f(ALLEGRO_FILE *f, +static A5O_AUDIO_STREAM *load_mod_audio_stream_f(A5O_FILE *f, size_t buffer_count, unsigned int samples) { if (!init_libdumb()) @@ -521,7 +521,7 @@ static ALLEGRO_AUDIO_STREAM *load_mod_audio_stream_f(ALLEGRO_FILE *f, return modaudio_stream_init(f, buffer_count, samples, lib.dumb_read_mod); } -static ALLEGRO_AUDIO_STREAM *load_it_audio_stream_f(ALLEGRO_FILE *f, +static A5O_AUDIO_STREAM *load_it_audio_stream_f(A5O_FILE *f, size_t buffer_count, unsigned int samples) { if (!init_libdumb()) @@ -529,7 +529,7 @@ static ALLEGRO_AUDIO_STREAM *load_it_audio_stream_f(ALLEGRO_FILE *f, return modaudio_stream_init(f, buffer_count, samples, lib.dumb_read_it); } -static ALLEGRO_AUDIO_STREAM *load_xm_audio_stream_f(ALLEGRO_FILE *f, +static A5O_AUDIO_STREAM *load_xm_audio_stream_f(A5O_FILE *f, size_t buffer_count, unsigned int samples) { if (!init_libdumb()) @@ -537,7 +537,7 @@ static ALLEGRO_AUDIO_STREAM *load_xm_audio_stream_f(ALLEGRO_FILE *f, return modaudio_stream_init(f, buffer_count, samples, lib.dumb_read_xm); } -static ALLEGRO_AUDIO_STREAM *load_s3m_audio_stream_f(ALLEGRO_FILE *f, +static A5O_AUDIO_STREAM *load_s3m_audio_stream_f(A5O_FILE *f, size_t buffer_count, unsigned int samples) { if (!init_libdumb()) @@ -545,16 +545,16 @@ static ALLEGRO_AUDIO_STREAM *load_s3m_audio_stream_f(ALLEGRO_FILE *f, return modaudio_stream_init(f, buffer_count, samples, lib.dumb_read_s3m); } -static ALLEGRO_AUDIO_STREAM *load_mod_audio_stream(const char *filename, +static A5O_AUDIO_STREAM *load_mod_audio_stream(const char *filename, size_t buffer_count, unsigned int samples) { - ALLEGRO_FILE *f; - ALLEGRO_AUDIO_STREAM *stream; + A5O_FILE *f; + A5O_AUDIO_STREAM *stream; ASSERT(filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } @@ -570,16 +570,16 @@ static ALLEGRO_AUDIO_STREAM *load_mod_audio_stream(const char *filename, return stream; } -static ALLEGRO_AUDIO_STREAM *load_it_audio_stream(const char *filename, +static A5O_AUDIO_STREAM *load_it_audio_stream(const char *filename, size_t buffer_count, unsigned int samples) { - ALLEGRO_FILE *f; - ALLEGRO_AUDIO_STREAM *stream; + A5O_FILE *f; + A5O_AUDIO_STREAM *stream; ASSERT(filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } @@ -595,16 +595,16 @@ static ALLEGRO_AUDIO_STREAM *load_it_audio_stream(const char *filename, return stream; } -static ALLEGRO_AUDIO_STREAM *load_xm_audio_stream(const char *filename, +static A5O_AUDIO_STREAM *load_xm_audio_stream(const char *filename, size_t buffer_count, unsigned int samples) { - ALLEGRO_FILE *f; - ALLEGRO_AUDIO_STREAM *stream; + A5O_FILE *f; + A5O_AUDIO_STREAM *stream; ASSERT(filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } @@ -620,16 +620,16 @@ static ALLEGRO_AUDIO_STREAM *load_xm_audio_stream(const char *filename, return stream; } -static ALLEGRO_AUDIO_STREAM *load_s3m_audio_stream(const char *filename, +static A5O_AUDIO_STREAM *load_s3m_audio_stream(const char *filename, size_t buffer_count, unsigned int samples) { - ALLEGRO_FILE *f; - ALLEGRO_AUDIO_STREAM *stream; + A5O_FILE *f; + A5O_AUDIO_STREAM *stream; ASSERT(filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } diff --git a/addons/acodec/flac.c b/addons/acodec/flac.c index 8912b0a252..bbb5be3bdc 100644 --- a/addons/acodec/flac.c +++ b/addons/acodec/flac.c @@ -15,14 +15,14 @@ #include "acodec.h" #include "helper.h" -#ifndef ALLEGRO_CFG_ACODEC_FLAC - #error configuration problem, ALLEGRO_CFG_ACODEC_FLAC not set +#ifndef A5O_CFG_ACODEC_FLAC + #error configuration problem, A5O_CFG_ACODEC_FLAC not set #endif #include #include -ALLEGRO_DEBUG_CHANNEL("acodec") +A5O_DEBUG_CHANNEL("acodec") typedef struct FLACFILE { @@ -44,13 +44,13 @@ typedef struct FLACFILE { /* Sample position one past last streamed sample. */ uint64_t streamed_samples; - ALLEGRO_FILE *fh; + A5O_FILE *fh; uint64_t loop_start, loop_end; /* in samples */ } FLACFILE; /* dynamic loading support (Windows only currently) */ -#ifdef ALLEGRO_CFG_ACODEC_FLAC_DLL +#ifdef A5O_CFG_ACODEC_FLAC_DLL static void *flac_dll = NULL; static bool flac_virgin = true; #endif @@ -79,7 +79,7 @@ static struct } lib; -#ifdef ALLEGRO_CFG_ACODEC_FLAC_DLL +#ifdef A5O_CFG_ACODEC_FLAC_DLL static void shutdown_dynlib(void) { if (flac_dll) { @@ -93,7 +93,7 @@ static void shutdown_dynlib(void) static bool init_dynlib(void) { -#ifdef ALLEGRO_CFG_ACODEC_FLAC_DLL +#ifdef A5O_CFG_ACODEC_FLAC_DLL if (flac_dll) { return true; } @@ -104,9 +104,9 @@ static bool init_dynlib(void) flac_virgin = false; - flac_dll = _al_open_library(ALLEGRO_CFG_ACODEC_FLAC_DLL); + flac_dll = _al_open_library(A5O_CFG_ACODEC_FLAC_DLL); if (!flac_dll) { - ALLEGRO_ERROR("Could not load " ALLEGRO_CFG_ACODEC_FLAC_DLL "\n"); + A5O_ERROR("Could not load " A5O_CFG_ACODEC_FLAC_DLL "\n"); return false; } @@ -117,7 +117,7 @@ static bool init_dynlib(void) { \ lib.x = _al_import_symbol(flac_dll, #x); \ if (lib.x == 0) { \ - ALLEGRO_ERROR("undefined symbol in lib structure: " #x "\n"); \ + A5O_ERROR("undefined symbol in lib structure: " #x "\n"); \ return false; \ } \ } while(0) @@ -147,7 +147,7 @@ static FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder *de FLAC__byte buffer[], size_t *bytes, void *dptr) { FLACFILE *ff = (FLACFILE *)dptr; - ALLEGRO_FILE *fh = ff->fh; + A5O_FILE *fh = ff->fh; (void)decoder; if (*bytes > 0) { *bytes = al_fread(fh, buffer, *bytes); @@ -168,10 +168,10 @@ static FLAC__StreamDecoderSeekStatus seek_callback( FLAC__uint64 absolute_byte_offset, void *dptr) { FLACFILE *ff = (FLACFILE *)dptr; - ALLEGRO_FILE *fh = ff->fh; + A5O_FILE *fh = ff->fh; (void)decoder; - if (!al_fseek(fh, absolute_byte_offset, ALLEGRO_SEEK_SET)) + if (!al_fseek(fh, absolute_byte_offset, A5O_SEEK_SET)) return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; else return FLAC__STREAM_DECODER_SEEK_STATUS_OK; @@ -183,7 +183,7 @@ static FLAC__StreamDecoderTellStatus tell_callback( FLAC__uint64 *absolute_byte_offset, void *dptr) { FLACFILE *ff = (FLACFILE *)dptr; - ALLEGRO_FILE *fh = ff->fh; + A5O_FILE *fh = ff->fh; int64_t pos = 0; (void)decoder; @@ -201,7 +201,7 @@ static FLAC__StreamDecoderLengthStatus length_callback( FLAC__uint64 *stream_length, void *dptr) { FLACFILE *ff = (FLACFILE *)dptr; - ALLEGRO_FILE *fh = ff->fh; + A5O_FILE *fh = ff->fh; (void)decoder; /* XXX check error */ @@ -214,7 +214,7 @@ static FLAC__StreamDecoderLengthStatus length_callback( static FLAC__bool eof_callback(const FLAC__StreamDecoder *decoder, void *dptr) { FLACFILE *ff = (FLACFILE *)dptr; - ALLEGRO_FILE *fh = ff->fh; + A5O_FILE *fh = ff->fh; (void)decoder; if (al_feof(fh)) @@ -246,11 +246,11 @@ static void error_callback(const FLAC__StreamDecoder *decoder, (void)decoder; (void)client_data; -#ifdef ALLEGRO_CFG_ACODEC_FLAC_DLL +#ifdef A5O_CFG_ACODEC_FLAC_DLL (void)status; - ALLEGRO_ERROR("Got FLAC error callback\n"); /* lazy */ + A5O_ERROR("Got FLAC error callback\n"); /* lazy */ #else - ALLEGRO_ERROR("Got FLAC error callback: %s\n", + A5O_ERROR("Got FLAC error callback: %s\n", FLAC__StreamDecoderErrorStatusString[status]); #endif } @@ -353,7 +353,7 @@ static void flac_close(FLACFILE *ff) } /* In seconds. */ -static double flac_stream_get_position(ALLEGRO_AUDIO_STREAM *stream) +static double flac_stream_get_position(A5O_AUDIO_STREAM *stream) { FLACFILE *ff = (FLACFILE *)stream->extra; return ff->streamed_samples / ff->sample_rate; @@ -364,7 +364,7 @@ static double flac_stream_get_position(ALLEGRO_AUDIO_STREAM *stream) * Updates 'stream' with the next chunk of data. * Returns the actual number of bytes written. */ -static size_t flac_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, +static size_t flac_stream_update(A5O_AUDIO_STREAM *stream, void *data, size_t buf_size) { int bytes_per_sample; @@ -417,7 +417,7 @@ static size_t flac_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, } /* Called from al_destroy_audio_stream. */ -static void flac_stream_close(ALLEGRO_AUDIO_STREAM *stream) +static void flac_stream_close(A5O_AUDIO_STREAM *stream) { FLACFILE *ff = stream->extra; _al_acodec_stop_feed_thread(stream); @@ -427,7 +427,7 @@ static void flac_stream_close(ALLEGRO_AUDIO_STREAM *stream) flac_close(ff); } -static bool real_seek(ALLEGRO_AUDIO_STREAM *stream, uint64_t sample) +static bool real_seek(A5O_AUDIO_STREAM *stream, uint64_t sample) { FLACFILE *ff = stream->extra; @@ -445,26 +445,26 @@ static bool real_seek(ALLEGRO_AUDIO_STREAM *stream, uint64_t sample) return true; } -static bool flac_stream_seek(ALLEGRO_AUDIO_STREAM *stream, double time) +static bool flac_stream_seek(A5O_AUDIO_STREAM *stream, double time) { FLACFILE *ff = stream->extra; uint64_t sample = time * ff->sample_rate; return real_seek(stream, sample); } -static bool flac_stream_rewind(ALLEGRO_AUDIO_STREAM *stream) +static bool flac_stream_rewind(A5O_AUDIO_STREAM *stream) { FLACFILE *ff = stream->extra; return real_seek(stream, ff->loop_start); } -static double flac_stream_get_length(ALLEGRO_AUDIO_STREAM *stream) +static double flac_stream_get_length(A5O_AUDIO_STREAM *stream) { FLACFILE *ff = stream->extra; return ff->total_samples / ff->sample_rate; } -static bool flac_stream_set_loop(ALLEGRO_AUDIO_STREAM *stream, double start, +static bool flac_stream_set_loop(A5O_AUDIO_STREAM *stream, double start, double end) { FLACFILE *ff = stream->extra; @@ -473,7 +473,7 @@ static bool flac_stream_set_loop(ALLEGRO_AUDIO_STREAM *stream, double start, return true; } -static FLACFILE *flac_open(ALLEGRO_FILE* f) +static FLACFILE *flac_open(A5O_FILE* f) { FLACFILE *ff; FLAC__StreamDecoderInitStatus init_status; @@ -486,13 +486,13 @@ static FLACFILE *flac_open(ALLEGRO_FILE* f) ff->decoder = lib.FLAC__stream_decoder_new(); if (!ff->decoder) { - ALLEGRO_ERROR("Error allocating FLAC decoder\n"); + A5O_ERROR("Error allocating FLAC decoder\n"); goto error; } ff->fh = f; if (!ff->fh) { - ALLEGRO_ERROR("Error opening FLAC file\n"); + A5O_ERROR("Error opening FLAC file\n"); goto error; } @@ -500,10 +500,10 @@ static FLACFILE *flac_open(ALLEGRO_FILE* f) seek_callback, tell_callback, length_callback, eof_callback, write_callback, metadata_callback, error_callback, ff); if (init_status != FLAC__STREAM_DECODER_INIT_STATUS_OK) { -#ifdef ALLEGRO_CFG_ACODEC_FLAC_DLL - ALLEGRO_ERROR("Error initializing FLAC decoder\n"); /* lazy */ +#ifdef A5O_CFG_ACODEC_FLAC_DLL + A5O_ERROR("Error initializing FLAC decoder\n"); /* lazy */ #else - ALLEGRO_ERROR("Error initializing FLAC decoder: %s\n", + A5O_ERROR("Error initializing FLAC decoder: %s\n", FLAC__StreamDecoderInitStatusString[init_status]); #endif goto error; @@ -512,15 +512,15 @@ static FLACFILE *flac_open(ALLEGRO_FILE* f) lib.FLAC__stream_decoder_process_until_end_of_metadata(ff->decoder); if (ff->sample_size == 0) { - ALLEGRO_ERROR("Error: don't support sub 8-bit sizes\n"); + A5O_ERROR("Error: don't support sub 8-bit sizes\n"); goto error; } - ALLEGRO_DEBUG("Loaded FLAC sample with properties:\n"); - ALLEGRO_DEBUG(" channels %d\n", ff->channels); - ALLEGRO_DEBUG(" sample_size %d\n", ff->sample_size); - ALLEGRO_DEBUG(" rate %.f\n", ff->sample_rate); - ALLEGRO_DEBUG(" total_samples %ld\n", (long) ff->total_samples); + A5O_DEBUG("Loaded FLAC sample with properties:\n"); + A5O_DEBUG(" channels %d\n", ff->channels); + A5O_DEBUG(" sample_size %d\n", ff->sample_size); + A5O_DEBUG(" rate %.f\n", ff->sample_rate); + A5O_DEBUG(" total_samples %ld\n", (long) ff->total_samples); return ff; @@ -533,15 +533,15 @@ static FLACFILE *flac_open(ALLEGRO_FILE* f) return NULL; } -ALLEGRO_SAMPLE *_al_load_flac(const char *filename) +A5O_SAMPLE *_al_load_flac(const char *filename) { - ALLEGRO_FILE *f; - ALLEGRO_SAMPLE *spl; + A5O_FILE *f; + A5O_SAMPLE *spl; ASSERT(filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } @@ -552,9 +552,9 @@ ALLEGRO_SAMPLE *_al_load_flac(const char *filename) return spl; } -ALLEGRO_SAMPLE *_al_load_flac_f(ALLEGRO_FILE *f) +A5O_SAMPLE *_al_load_flac_f(A5O_FILE *f) { - ALLEGRO_SAMPLE *sample; + A5O_SAMPLE *sample; FLACFILE *ff; ff = flac_open(f); @@ -572,7 +572,7 @@ ALLEGRO_SAMPLE *_al_load_flac_f(ALLEGRO_FILE *f) _al_count_to_channel_conf(ff->channels), true); if (!sample) { - ALLEGRO_ERROR("Failed to create a sample.\n"); + A5O_ERROR("Failed to create a sample.\n"); al_free(ff->buffer); } @@ -581,16 +581,16 @@ ALLEGRO_SAMPLE *_al_load_flac_f(ALLEGRO_FILE *f) return sample; } -ALLEGRO_AUDIO_STREAM *_al_load_flac_audio_stream(const char *filename, +A5O_AUDIO_STREAM *_al_load_flac_audio_stream(const char *filename, size_t buffer_count, unsigned int samples) { - ALLEGRO_FILE *f; - ALLEGRO_AUDIO_STREAM *stream; + A5O_FILE *f; + A5O_AUDIO_STREAM *stream; ASSERT(filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } @@ -602,10 +602,10 @@ ALLEGRO_AUDIO_STREAM *_al_load_flac_audio_stream(const char *filename, return stream; } -ALLEGRO_AUDIO_STREAM *_al_load_flac_audio_stream_f(ALLEGRO_FILE* f, +A5O_AUDIO_STREAM *_al_load_flac_audio_stream_f(A5O_FILE* f, size_t buffer_count, unsigned int samples) { - ALLEGRO_AUDIO_STREAM *stream; + A5O_AUDIO_STREAM *stream; FLACFILE *ff; ff = flac_open(f); @@ -631,7 +631,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_flac_audio_stream_f(ALLEGRO_FILE* f, _al_acodec_start_feed_thread(stream); } else { - ALLEGRO_ERROR("Failed to create stream.\n"); + A5O_ERROR("Failed to create stream.\n"); al_fclose(ff->fh); flac_close(ff); } @@ -640,7 +640,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_flac_audio_stream_f(ALLEGRO_FILE* f, } -bool _al_identify_flac(ALLEGRO_FILE *f) +bool _al_identify_flac(A5O_FILE *f) { uint8_t x[4]; if (al_fread(f, x, 4) < 4) diff --git a/addons/acodec/helper.c b/addons/acodec/helper.c index bcf16c05cb..334ec908ad 100644 --- a/addons/acodec/helper.c +++ b/addons/acodec/helper.c @@ -5,7 +5,7 @@ #include "allegro5/internal/aintern_system.h" #include "helper.h" -void _al_acodec_start_feed_thread(ALLEGRO_AUDIO_STREAM *stream) +void _al_acodec_start_feed_thread(A5O_AUDIO_STREAM *stream) { stream->feed_thread = al_create_thread(_al_kcm_feed_stream, stream); stream->feed_thread_started_cond = al_create_cond(); @@ -25,9 +25,9 @@ void _al_acodec_start_feed_thread(ALLEGRO_AUDIO_STREAM *stream) al_unlock_mutex(stream->feed_thread_started_mutex); } -void _al_acodec_stop_feed_thread(ALLEGRO_AUDIO_STREAM *stream) +void _al_acodec_stop_feed_thread(A5O_AUDIO_STREAM *stream) { - ALLEGRO_EVENT quit_event; + A5O_EVENT quit_event; quit_event.type = _KCM_STREAM_FEEDER_QUIT_EVENT_TYPE; al_emit_user_event(al_get_audio_stream_event_source(stream), &quit_event, NULL); diff --git a/addons/acodec/helper.h b/addons/acodec/helper.h index 91a018c97b..646fe9eb45 100644 --- a/addons/acodec/helper.h +++ b/addons/acodec/helper.h @@ -1,7 +1,7 @@ #ifndef __al_included_acodec_helper_h #define __al_included_acodec_helper_h -void _al_acodec_start_feed_thread(ALLEGRO_AUDIO_STREAM *stream); -void _al_acodec_stop_feed_thread(ALLEGRO_AUDIO_STREAM *stream); +void _al_acodec_start_feed_thread(A5O_AUDIO_STREAM *stream); +void _al_acodec_stop_feed_thread(A5O_AUDIO_STREAM *stream); #endif diff --git a/addons/acodec/modaudio.c b/addons/acodec/modaudio.c index f7c9902802..606d64f202 100644 --- a/addons/acodec/modaudio.c +++ b/addons/acodec/modaudio.c @@ -12,10 +12,10 @@ #include "acodec.h" -ALLEGRO_DEBUG_CHANNEL("acodec") +A5O_DEBUG_CHANNEL("acodec") -bool _al_identify_it(ALLEGRO_FILE *f) +bool _al_identify_it(A5O_FILE *f) { uint8_t x[4]; if (al_fread(f, x, 4) < 4) @@ -25,7 +25,7 @@ bool _al_identify_it(ALLEGRO_FILE *f) return false; } -bool _al_identify_669(ALLEGRO_FILE *f) +bool _al_identify_669(A5O_FILE *f) { uint8_t x[2]; if (al_fread(f, x, 2) < 2) @@ -35,7 +35,7 @@ bool _al_identify_669(ALLEGRO_FILE *f) return false; } -bool _al_identify_amf(ALLEGRO_FILE *f) +bool _al_identify_amf(A5O_FILE *f) { uint8_t x[3]; if (al_fread(f, x, 3) < 3) @@ -45,7 +45,7 @@ bool _al_identify_amf(ALLEGRO_FILE *f) return false; } -bool _al_identify_asy(ALLEGRO_FILE *f) +bool _al_identify_asy(A5O_FILE *f) { uint8_t x[24]; if (al_fread(f, x, 24) < 24) @@ -55,7 +55,7 @@ bool _al_identify_asy(ALLEGRO_FILE *f) return false; } -bool _al_identify_mtm(ALLEGRO_FILE *f) +bool _al_identify_mtm(A5O_FILE *f) { uint8_t x[3]; if (al_fread(f, x, 3) < 3) @@ -65,7 +65,7 @@ bool _al_identify_mtm(ALLEGRO_FILE *f) return false; } -bool _al_identify_okt(ALLEGRO_FILE *f) +bool _al_identify_okt(A5O_FILE *f) { uint8_t x[8]; if (al_fread(f, x, 8) < 8) @@ -75,7 +75,7 @@ bool _al_identify_okt(ALLEGRO_FILE *f) return false; } -bool _al_identify_psm(ALLEGRO_FILE *f) +bool _al_identify_psm(A5O_FILE *f) { uint8_t x[4]; if (al_fread(f, x, 4) < 4) @@ -85,10 +85,10 @@ bool _al_identify_psm(ALLEGRO_FILE *f) return false; } -bool _al_identify_ptm(ALLEGRO_FILE *f) +bool _al_identify_ptm(A5O_FILE *f) { uint8_t x[4]; - if (!al_fseek(f, 0x2C, ALLEGRO_SEEK_CUR)) + if (!al_fseek(f, 0x2C, A5O_SEEK_CUR)) return false; if (al_fread(f, x, 4) < 4) return false; @@ -97,7 +97,7 @@ bool _al_identify_ptm(ALLEGRO_FILE *f) return false; } -bool _al_identify_riff(ALLEGRO_FILE *f) +bool _al_identify_riff(A5O_FILE *f) { const char riff_fmts[][4] = { "AM ", "AMFF", "DSMF" @@ -107,7 +107,7 @@ bool _al_identify_riff(ALLEGRO_FILE *f) return false; if (memcmp(x, "RIFF", 4) != 0) return false; - if (!al_fseek(f, 4, ALLEGRO_SEEK_CUR)) + if (!al_fseek(f, 4, A5O_SEEK_CUR)) return false; if (al_fread(f, x, 4) < 4) return false; @@ -118,13 +118,13 @@ bool _al_identify_riff(ALLEGRO_FILE *f) return false; } -bool _al_identify_stm(ALLEGRO_FILE *f) +bool _al_identify_stm(A5O_FILE *f) { const char stm_fmts[][8] = { "!Scream!", "BMOD2STM", "WUZAMOD!" }; uint8_t x[10]; - if (!al_fseek(f, 20, ALLEGRO_SEEK_CUR)) + if (!al_fseek(f, 20, A5O_SEEK_CUR)) return false; if (al_fread(f, x, 10) < 8) return false; @@ -137,7 +137,7 @@ bool _al_identify_stm(ALLEGRO_FILE *f) return false; } -bool _al_identify_mod(ALLEGRO_FILE *f) +bool _al_identify_mod(A5O_FILE *f) { const char mod_sigs[][4] = { "M.K.", "M!K!", "M&K!", "N.T.", @@ -146,7 +146,7 @@ bool _al_identify_mod(ALLEGRO_FILE *f) "OKTA", "16CN", "32CN" }; uint8_t x[4]; - if (!al_fseek(f, 0x438, ALLEGRO_SEEK_CUR)) + if (!al_fseek(f, 0x438, A5O_SEEK_CUR)) return false; if (al_fread(f, x, 4) < 4) return false; @@ -163,10 +163,10 @@ bool _al_identify_mod(ALLEGRO_FILE *f) return false; } -bool _al_identify_s3m(ALLEGRO_FILE *f) +bool _al_identify_s3m(A5O_FILE *f) { uint8_t x[4]; - if (!al_fseek(f, 0x2C, ALLEGRO_SEEK_CUR)) + if (!al_fseek(f, 0x2C, A5O_SEEK_CUR)) return false; if (al_fread(f, x, 4) < 4) return false; @@ -175,7 +175,7 @@ bool _al_identify_s3m(ALLEGRO_FILE *f) return false; } -bool _al_identify_xm(ALLEGRO_FILE *f) +bool _al_identify_xm(A5O_FILE *f) { uint8_t x[16]; if (al_fread(f, x, 16) < 16) diff --git a/addons/acodec/mp3.c b/addons/acodec/mp3.c index 160ee32ef7..23f65e04fe 100644 --- a/addons/acodec/mp3.c +++ b/addons/acodec/mp3.c @@ -19,7 +19,7 @@ #include #include -ALLEGRO_DEBUG_CHANNEL("acodec") +A5O_DEBUG_CHANNEL("acodec") typedef struct MP3FILE { @@ -42,18 +42,18 @@ typedef struct MP3FILE int frame_samples; /* in samples, same across all frames */ int freq; - ALLEGRO_CHANNEL_CONF chan_conf; + A5O_CHANNEL_CONF chan_conf; } MP3FILE; -ALLEGRO_SAMPLE *_al_load_mp3(const char *filename) +A5O_SAMPLE *_al_load_mp3(const char *filename) { - ALLEGRO_FILE *f; - ALLEGRO_SAMPLE *spl; + A5O_FILE *f; + A5O_SAMPLE *spl; ASSERT(filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_WARN("Could not open file '%s'.\n", filename); + A5O_WARN("Could not open file '%s'.\n", filename); return NULL; } @@ -64,18 +64,18 @@ ALLEGRO_SAMPLE *_al_load_mp3(const char *filename) return spl; } -ALLEGRO_SAMPLE *_al_load_mp3_f(ALLEGRO_FILE *f) +A5O_SAMPLE *_al_load_mp3_f(A5O_FILE *f) { mp3dec_t dec; mp3dec_init(&dec); mp3dec_file_info_t info; - ALLEGRO_SAMPLE *spl = NULL; + A5O_SAMPLE *spl = NULL; /* Read our file size. */ int64_t filesize = al_fsize(f); if (filesize == -1) { - ALLEGRO_WARN("Could not determine file size.\n"); + A5O_WARN("Could not determine file size.\n"); return NULL; } @@ -83,7 +83,7 @@ ALLEGRO_SAMPLE *_al_load_mp3_f(ALLEGRO_FILE *f) uint8_t* mp3data = (uint8_t*)al_malloc(filesize); size_t readbytes = al_fread(f, mp3data, filesize); if (readbytes != (size_t)filesize) { - ALLEGRO_WARN("Failed to read file into memory.\n"); + A5O_WARN("Failed to read file into memory.\n"); al_free(mp3data); return NULL; } @@ -93,7 +93,7 @@ ALLEGRO_SAMPLE *_al_load_mp3_f(ALLEGRO_FILE *f) al_free(mp3data); if (info.buffer == NULL) { - ALLEGRO_WARN("Could not decode MP3.\n"); + A5O_WARN("Could not decode MP3.\n"); return NULL; } @@ -105,15 +105,15 @@ ALLEGRO_SAMPLE *_al_load_mp3_f(ALLEGRO_FILE *f) return spl; } -ALLEGRO_AUDIO_STREAM *_al_load_mp3_audio_stream(const char *filename, size_t buffer_count, unsigned int samples) +A5O_AUDIO_STREAM *_al_load_mp3_audio_stream(const char *filename, size_t buffer_count, unsigned int samples) { - ALLEGRO_FILE *f; - ALLEGRO_AUDIO_STREAM *stream; + A5O_FILE *f; + A5O_AUDIO_STREAM *stream; ASSERT(filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_WARN("Could not open file '%s'.\n", filename); + A5O_WARN("Could not open file '%s'.\n", filename); return NULL; } @@ -125,7 +125,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_mp3_audio_stream(const char *filename, size_t buf } -static bool mp3_stream_seek(ALLEGRO_AUDIO_STREAM * stream, double time) +static bool mp3_stream_seek(A5O_AUDIO_STREAM * stream, double time) { MP3FILE *mp3file = (MP3FILE *) stream->extra; int file_pos = time * mp3file->freq; @@ -133,10 +133,10 @@ static bool mp3_stream_seek(ALLEGRO_AUDIO_STREAM * stream, double time) /* It is necessary to start decoding a little earlier than where we are * seeking to, because frames will reuse decoder state from previous frames. * minimp3 assures us that 10 frames is sufficient. */ - int sync_frame = _ALLEGRO_MAX(0, frame - 10); + int sync_frame = _A5O_MAX(0, frame - 10); int frame_pos = file_pos - frame * mp3file->frame_samples; if (frame < 0 || frame > mp3file->num_frames) { - ALLEGRO_WARN("Seeking outside the stream bounds: %f\n", time); + A5O_WARN("Seeking outside the stream bounds: %f\n", time); return false; } int frame_offset = mp3file->frame_offsets[frame]; @@ -158,28 +158,28 @@ static bool mp3_stream_seek(ALLEGRO_AUDIO_STREAM * stream, double time) return true; } -static bool mp3_stream_rewind(ALLEGRO_AUDIO_STREAM *stream) +static bool mp3_stream_rewind(A5O_AUDIO_STREAM *stream) { MP3FILE *mp3file = (MP3FILE *) stream->extra; return mp3_stream_seek(stream, mp3file->loop_start); } -static double mp3_stream_get_position(ALLEGRO_AUDIO_STREAM *stream) +static double mp3_stream_get_position(A5O_AUDIO_STREAM *stream) { MP3FILE *mp3file = (MP3FILE *) stream->extra; return (double)mp3file->file_pos / mp3file->freq; } -static double mp3_stream_get_length(ALLEGRO_AUDIO_STREAM * stream) +static double mp3_stream_get_length(A5O_AUDIO_STREAM * stream) { MP3FILE *mp3file = (MP3FILE *) stream->extra; return (double)mp3file->file_samples / mp3file->freq; } -static bool mp3_stream_set_loop(ALLEGRO_AUDIO_STREAM * stream, double start, double end) +static bool mp3_stream_set_loop(A5O_AUDIO_STREAM * stream, double start, double end) { MP3FILE *mp3file = (MP3FILE *) stream->extra; mp3file->loop_start = start; @@ -191,7 +191,7 @@ static bool mp3_stream_set_loop(ALLEGRO_AUDIO_STREAM * stream, double start, dou * Updates 'stream' with the next chunk of data. * Returns the actual number of bytes written. */ -static size_t mp3_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, +static size_t mp3_stream_update(A5O_AUDIO_STREAM *stream, void *data, size_t buf_size) { MP3FILE *mp3file = (MP3FILE *) stream->extra; @@ -200,7 +200,7 @@ static size_t mp3_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, double ctime = mp3_stream_get_position(stream); double btime = (double)samples_needed / mp3file->freq; - if (stream->spl.loop != _ALLEGRO_PLAYMODE_STREAM_ONCE && ctime + btime > mp3file->loop_end) { + if (stream->spl.loop != _A5O_PLAYMODE_STREAM_ONCE && ctime + btime > mp3file->loop_end) { samples_needed = (mp3file->loop_end - ctime) * mp3file->freq; } if (samples_needed < 0) @@ -211,7 +211,7 @@ static size_t mp3_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, int samples_read = 0; while (samples_read < samples_needed) { - int samples_from_this_frame = _ALLEGRO_MIN( + int samples_from_this_frame = _A5O_MIN( mp3file->frame_samples - mp3file->frame_pos, samples_needed - samples_read ); @@ -241,7 +241,7 @@ static size_t mp3_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, return samples_read * sample_size; } -static void mp3_stream_close(ALLEGRO_AUDIO_STREAM *stream) +static void mp3_stream_close(A5O_AUDIO_STREAM *stream) { MP3FILE *mp3file = (MP3FILE *) stream->extra; @@ -254,7 +254,7 @@ static void mp3_stream_close(ALLEGRO_AUDIO_STREAM *stream) stream->feed_thread = NULL; } -ALLEGRO_AUDIO_STREAM *_al_load_mp3_audio_stream_f(ALLEGRO_FILE* f, size_t buffer_count, unsigned int samples) +A5O_AUDIO_STREAM *_al_load_mp3_audio_stream_f(A5O_FILE* f, size_t buffer_count, unsigned int samples) { MP3FILE* mp3file = al_calloc(sizeof(MP3FILE), 1); mp3dec_init(&mp3file->dec); @@ -262,7 +262,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_mp3_audio_stream_f(ALLEGRO_FILE* f, size_t buffer /* Read our file size. */ mp3file->file_size = al_fsize(f); if (mp3file->file_size == -1) { - ALLEGRO_WARN("Could not determine file size.\n"); + A5O_WARN("Could not determine file size.\n"); goto failure; } @@ -270,7 +270,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_mp3_audio_stream_f(ALLEGRO_FILE* f, size_t buffer mp3file->file_buffer = (uint8_t*)al_malloc(mp3file->file_size); size_t readbytes = al_fread(f, mp3file->file_buffer, mp3file->file_size); if (readbytes != (size_t)mp3file->file_size) { - ALLEGRO_WARN("Failed to read file into memory.\n"); + A5O_WARN("Failed to read file into memory.\n"); goto failure; } @@ -290,7 +290,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_mp3_audio_stream_f(ALLEGRO_FILE* f, size_t buffer mp3file->file_size - offset_so_far, NULL, &frame_info); if (frame_samples == 0) { if (mp3file->num_frames == 0) { - ALLEGRO_WARN("Could not decode the first frame.\n"); + A5O_WARN("Could not decode the first frame.\n"); goto failure; } else { @@ -299,7 +299,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_mp3_audio_stream_f(ALLEGRO_FILE* f, size_t buffer } /* Grab the file information from the first frame. */ if (offset_so_far == 0) { - ALLEGRO_DEBUG("Channels %d, frequency %d\n", frame_info.channels, frame_info.hz); + A5O_DEBUG("Channels %d, frequency %d\n", frame_info.channels, frame_info.hz); mp3file->chan_conf = _al_count_to_channel_conf(frame_info.channels); mp3file->freq = frame_info.hz; mp3file->frame_samples = frame_samples; @@ -312,12 +312,12 @@ ALLEGRO_AUDIO_STREAM *_al_load_mp3_audio_stream_f(ALLEGRO_FILE* f, size_t buffer } mp3file->loop_end = (double)mp3file->file_samples * mp3file->freq; - ALLEGRO_AUDIO_STREAM *stream = al_create_audio_stream( + A5O_AUDIO_STREAM *stream = al_create_audio_stream( buffer_count, samples, mp3file->freq, _al_word_size_to_depth_conf(sizeof(mp3d_sample_t)), mp3file->chan_conf); if (!stream) { - ALLEGRO_WARN("Failed to create stream.\n"); + A5O_WARN("Failed to create stream.\n"); goto failure; } @@ -491,7 +491,7 @@ static bool identify_mp3(const uint8_t* buf, size_t len) } -bool _al_identify_mp3(ALLEGRO_FILE *f) +bool _al_identify_mp3(A5O_FILE *f) { uint8_t x[8192]; size_t len = al_fread(f, x, sizeof x); diff --git a/addons/acodec/ogg.c b/addons/acodec/ogg.c index 69f92ec431..72b27b246f 100644 --- a/addons/acodec/ogg.c +++ b/addons/acodec/ogg.c @@ -15,13 +15,13 @@ #include "acodec.h" #include "helper.h" -#ifndef ALLEGRO_CFG_ACODEC_VORBIS - #error configuration problem, ALLEGRO_CFG_ACODEC_VORBIS not set +#ifndef A5O_CFG_ACODEC_VORBIS + #error configuration problem, A5O_CFG_ACODEC_VORBIS not set #endif -ALLEGRO_DEBUG_CHANNEL("acodec") +A5O_DEBUG_CHANNEL("acodec") -#if defined(ALLEGRO_CFG_ACODEC_TREMOR) +#if defined(A5O_CFG_ACODEC_TREMOR) #include #define TREMOR 1 #else @@ -33,7 +33,7 @@ typedef struct AL_OV_DATA AL_OV_DATA; struct AL_OV_DATA { OggVorbis_File *vf; vorbis_info *vi; - ALLEGRO_FILE *file; + A5O_FILE *file; int bitstream; double loop_start; double loop_end; @@ -41,7 +41,7 @@ struct AL_OV_DATA { /* dynamic loading support (Windows only currently) */ -#ifdef ALLEGRO_CFG_ACODEC_VORBISFILE_DLL +#ifdef A5O_CFG_ACODEC_VORBISFILE_DLL static void *ov_dll = NULL; static bool ov_virgin = true; #endif @@ -67,7 +67,7 @@ static struct } lib; -#ifdef ALLEGRO_CFG_ACODEC_VORBISFILE_DLL +#ifdef A5O_CFG_ACODEC_VORBISFILE_DLL static void shutdown_dynlib(void) { if (ov_dll) { @@ -81,7 +81,7 @@ static void shutdown_dynlib(void) static bool init_dynlib(void) { -#ifdef ALLEGRO_CFG_ACODEC_VORBISFILE_DLL +#ifdef A5O_CFG_ACODEC_VORBISFILE_DLL if (ov_dll) { return true; } @@ -92,9 +92,9 @@ static bool init_dynlib(void) ov_virgin = false; - ov_dll = _al_open_library(ALLEGRO_CFG_ACODEC_VORBISFILE_DLL); + ov_dll = _al_open_library(A5O_CFG_ACODEC_VORBISFILE_DLL); if (!ov_dll) { - ALLEGRO_ERROR("Could not load " ALLEGRO_CFG_ACODEC_VORBISFILE_DLL "\n"); + A5O_ERROR("Could not load " A5O_CFG_ACODEC_VORBISFILE_DLL "\n"); return false; } @@ -105,7 +105,7 @@ static bool init_dynlib(void) { \ lib.x = _al_import_symbol(ov_dll, #x); \ if (lib.x == 0) { \ - ALLEGRO_ERROR("undefined symbol in lib structure: " #x "\n"); \ + A5O_ERROR("undefined symbol in lib structure: " #x "\n"); \ return false; \ } \ } while(0) @@ -146,9 +146,9 @@ static int seek_callback(void *dptr, ogg_int64_t offset, int whence) AL_OV_DATA *ov = (AL_OV_DATA *)dptr; switch(whence) { - case SEEK_SET: whence = ALLEGRO_SEEK_SET; break; - case SEEK_CUR: whence = ALLEGRO_SEEK_CUR; break; - case SEEK_END: whence = ALLEGRO_SEEK_END; break; + case SEEK_SET: whence = A5O_SEEK_SET; break; + case SEEK_CUR: whence = A5O_SEEK_CUR; break; + case SEEK_END: whence = A5O_SEEK_END; break; } if (!al_fseek(ov->file, offset, whence)) { @@ -188,16 +188,16 @@ static ov_callbacks callbacks = { }; -ALLEGRO_SAMPLE *_al_load_ogg_vorbis(const char *filename) +A5O_SAMPLE *_al_load_ogg_vorbis(const char *filename) { - ALLEGRO_FILE *f; - ALLEGRO_SAMPLE *spl; + A5O_FILE *f; + A5O_SAMPLE *spl; ASSERT(filename); - ALLEGRO_INFO("Loading sample %s.\n", filename); + A5O_INFO("Loading sample %s.\n", filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } @@ -209,12 +209,12 @@ ALLEGRO_SAMPLE *_al_load_ogg_vorbis(const char *filename) } -ALLEGRO_SAMPLE *_al_load_ogg_vorbis_f(ALLEGRO_FILE *file) +A5O_SAMPLE *_al_load_ogg_vorbis_f(A5O_FILE *file) { /* Note: decoding library returns floats. I always return 16-bit (most * commonly supported). */ -#ifdef ALLEGRO_LITTLE_ENDIAN +#ifdef A5O_LITTLE_ENDIAN const int endian = 0; /* 0 for Little-Endian, 1 for Big-Endian */ #else const int endian = 1; /* 0 for Little-Endian, 1 for Big-Endian */ @@ -226,7 +226,7 @@ ALLEGRO_SAMPLE *_al_load_ogg_vorbis_f(ALLEGRO_FILE *file) vorbis_info* vi; char *buffer; long pos; - ALLEGRO_SAMPLE *sample; + A5O_SAMPLE *sample; int channels; long rate; long total_samples; @@ -241,7 +241,7 @@ ALLEGRO_SAMPLE *_al_load_ogg_vorbis_f(ALLEGRO_FILE *file) ov.file = file; if (lib.ov_open_callbacks(&ov, &vf, NULL, 0, callbacks) < 0) { - ALLEGRO_ERROR("Audio file does not appear to be an Ogg bitstream.\n"); + A5O_ERROR("Audio file does not appear to be an Ogg bitstream.\n"); return NULL; } @@ -253,21 +253,21 @@ ALLEGRO_SAMPLE *_al_load_ogg_vorbis_f(ALLEGRO_FILE *file) bitstream = -1; total_size = total_samples * channels * word_size; - ALLEGRO_DEBUG("channels %d\n", channels); - ALLEGRO_DEBUG("word_size %d\n", word_size); - ALLEGRO_DEBUG("rate %ld\n", rate); - ALLEGRO_DEBUG("total_samples %ld\n", total_samples); - ALLEGRO_DEBUG("total_size %ld\n", total_size); + A5O_DEBUG("channels %d\n", channels); + A5O_DEBUG("word_size %d\n", word_size); + A5O_DEBUG("rate %ld\n", rate); + A5O_DEBUG("total_samples %ld\n", total_samples); + A5O_DEBUG("total_size %ld\n", total_size); buffer = al_malloc(total_size); if (!buffer) { - ALLEGRO_ERROR("Unable to allocate buffer (%ld).\n", total_size); + A5O_ERROR("Unable to allocate buffer (%ld).\n", total_size); return NULL; } pos = 0; while (pos < total_size) { - const int read_size = _ALLEGRO_MIN(packet_size, total_size - pos); + const int read_size = _A5O_MIN(packet_size, total_size - pos); ASSERT(pos + read_size <= total_size); /* XXX error handling */ @@ -291,7 +291,7 @@ ALLEGRO_SAMPLE *_al_load_ogg_vorbis_f(ALLEGRO_FILE *file) _al_count_to_channel_conf(channels), true); if (!sample) { - ALLEGRO_ERROR("Failed to create sample.\n"); + A5O_ERROR("Failed to create sample.\n"); al_free(buffer); } @@ -299,7 +299,7 @@ ALLEGRO_SAMPLE *_al_load_ogg_vorbis_f(ALLEGRO_FILE *file) } -static bool ogg_stream_seek(ALLEGRO_AUDIO_STREAM *stream, double time) +static bool ogg_stream_seek(A5O_AUDIO_STREAM *stream, double time) { AL_OV_DATA *extra = (AL_OV_DATA *) stream->extra; if (time >= extra->loop_end) @@ -312,14 +312,14 @@ static bool ogg_stream_seek(ALLEGRO_AUDIO_STREAM *stream, double time) } -static bool ogg_stream_rewind(ALLEGRO_AUDIO_STREAM *stream) +static bool ogg_stream_rewind(A5O_AUDIO_STREAM *stream) { AL_OV_DATA *extra = (AL_OV_DATA *) stream->extra; return ogg_stream_seek(stream, extra->loop_start); } -static double ogg_stream_get_position(ALLEGRO_AUDIO_STREAM *stream) +static double ogg_stream_get_position(A5O_AUDIO_STREAM *stream) { AL_OV_DATA *extra = (AL_OV_DATA *) stream->extra; #ifndef TREMOR @@ -330,7 +330,7 @@ static double ogg_stream_get_position(ALLEGRO_AUDIO_STREAM *stream) } -static double ogg_stream_get_length(ALLEGRO_AUDIO_STREAM *stream) +static double ogg_stream_get_length(A5O_AUDIO_STREAM *stream) { AL_OV_DATA *extra = (AL_OV_DATA *) stream->extra; #ifndef TREMOR @@ -342,7 +342,7 @@ static double ogg_stream_get_length(ALLEGRO_AUDIO_STREAM *stream) } -static bool ogg_stream_set_loop(ALLEGRO_AUDIO_STREAM *stream, double start, double end) +static bool ogg_stream_set_loop(A5O_AUDIO_STREAM *stream, double start, double end) { AL_OV_DATA *extra = (AL_OV_DATA *) stream->extra; @@ -354,7 +354,7 @@ static bool ogg_stream_set_loop(ALLEGRO_AUDIO_STREAM *stream, double start, doub /* To be called when stream is destroyed */ -static void ogg_stream_close(ALLEGRO_AUDIO_STREAM *stream) +static void ogg_stream_close(A5O_AUDIO_STREAM *stream) { AL_OV_DATA *extra = (AL_OV_DATA *) stream->extra; @@ -369,12 +369,12 @@ static void ogg_stream_close(ALLEGRO_AUDIO_STREAM *stream) } -static size_t ogg_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, +static size_t ogg_stream_update(A5O_AUDIO_STREAM *stream, void *data, size_t buf_size) { AL_OV_DATA *extra = (AL_OV_DATA *) stream->extra; -#ifdef ALLEGRO_LITTLE_ENDIAN +#ifdef A5O_LITTLE_ENDIAN const int endian = 0; /* 0 for Little-Endian, 1 for Big-Endian */ #else const int endian = 1; /* 0 for Little-Endian, 1 for Big-Endian */ @@ -393,7 +393,7 @@ static size_t ogg_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, double btime = ((double)buf_size / ((double)word_size * (double)extra->vi->channels)) / rate; unsigned long read; - if (stream->spl.loop != _ALLEGRO_PLAYMODE_STREAM_ONCE && ctime + btime > extra->loop_end) { + if (stream->spl.loop != _A5O_PLAYMODE_STREAM_ONCE && ctime + btime > extra->loop_end) { const int frame_size = word_size * extra->vi->channels; read_length = (extra->loop_end - ctime) * rate * (double)word_size * (double)extra->vi->channels; if (read_length < 0) @@ -424,17 +424,17 @@ static size_t ogg_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, } -ALLEGRO_AUDIO_STREAM *_al_load_ogg_vorbis_audio_stream(const char *filename, +A5O_AUDIO_STREAM *_al_load_ogg_vorbis_audio_stream(const char *filename, size_t buffer_count, unsigned int samples) { - ALLEGRO_FILE *f; - ALLEGRO_AUDIO_STREAM *stream; + A5O_FILE *f; + A5O_AUDIO_STREAM *stream; ASSERT(filename); - ALLEGRO_INFO("Loading stream %s.\n", filename); + A5O_INFO("Loading stream %s.\n", filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } @@ -447,7 +447,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_ogg_vorbis_audio_stream(const char *filename, } -ALLEGRO_AUDIO_STREAM *_al_load_ogg_vorbis_audio_stream_f(ALLEGRO_FILE *file, +A5O_AUDIO_STREAM *_al_load_ogg_vorbis_audio_stream_f(A5O_FILE *file, size_t buffer_count, unsigned int samples) { const int word_size = 2; /* 1 = 8bit, 2 = 16-bit. nothing else */ @@ -458,7 +458,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_ogg_vorbis_audio_stream_f(ALLEGRO_FILE *file, long total_samples; long total_size; AL_OV_DATA* extra; - ALLEGRO_AUDIO_STREAM* stream; + A5O_AUDIO_STREAM* stream; if (!init_dynlib()) { return NULL; @@ -466,7 +466,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_ogg_vorbis_audio_stream_f(ALLEGRO_FILE *file, extra = al_malloc(sizeof(AL_OV_DATA)); if (extra == NULL) { - ALLEGRO_ERROR("Failed to allocate AL_OV_DATA struct.\n"); + A5O_ERROR("Failed to allocate AL_OV_DATA struct.\n"); return NULL; } @@ -474,7 +474,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_ogg_vorbis_audio_stream_f(ALLEGRO_FILE *file, vf = al_malloc(sizeof(OggVorbis_File)); if (lib.ov_open_callbacks(extra, vf, NULL, 0, callbacks) < 0) { - ALLEGRO_ERROR("ogg: Input does not appear to be an Ogg bitstream.\n"); + A5O_ERROR("ogg: Input does not appear to be an Ogg bitstream.\n"); return NULL; } @@ -490,17 +490,17 @@ ALLEGRO_AUDIO_STREAM *_al_load_ogg_vorbis_audio_stream_f(ALLEGRO_FILE *file, extra->bitstream = -1; - ALLEGRO_DEBUG("channels %d\n", channels); - ALLEGRO_DEBUG("word_size %d\n", word_size); - ALLEGRO_DEBUG("rate %ld\n", rate); - ALLEGRO_DEBUG("total_samples %ld\n", total_samples); - ALLEGRO_DEBUG("total_size %ld\n", total_size); + A5O_DEBUG("channels %d\n", channels); + A5O_DEBUG("word_size %d\n", word_size); + A5O_DEBUG("rate %ld\n", rate); + A5O_DEBUG("total_samples %ld\n", total_samples); + A5O_DEBUG("total_size %ld\n", total_size); stream = al_create_audio_stream(buffer_count, samples, rate, _al_word_size_to_depth_conf(word_size), _al_count_to_channel_conf(channels)); if (!stream) { - ALLEGRO_ERROR("Failed to create the stream.\n"); + A5O_ERROR("Failed to create the stream.\n"); lib.ov_clear(vf); al_free(vf); return NULL; @@ -524,14 +524,14 @@ ALLEGRO_AUDIO_STREAM *_al_load_ogg_vorbis_audio_stream_f(ALLEGRO_FILE *file, } -bool _al_identify_ogg_vorbis(ALLEGRO_FILE *f) +bool _al_identify_ogg_vorbis(A5O_FILE *f) { uint8_t x[8]; if (al_fread(f, x, 4) < 4) return false; if (memcmp(x, "OggS", 4) != 0) return false; - if (!al_fseek(f, 23, ALLEGRO_SEEK_CUR)) + if (!al_fseek(f, 23, A5O_SEEK_CUR)) return false; if (al_fread(f, x, 8) < 8) return false; diff --git a/addons/acodec/openmpt.c b/addons/acodec/openmpt.c index 7224a23455..bc65cc18b6 100644 --- a/addons/acodec/openmpt.c +++ b/addons/acodec/openmpt.c @@ -15,20 +15,20 @@ #include "acodec.h" #include "helper.h" -#ifndef ALLEGRO_CFG_ACODEC_OPENMPT - #error configuration problem, ALLEGRO_CFG_ACODEC_OPENMPT not set +#ifndef A5O_CFG_ACODEC_OPENMPT + #error configuration problem, A5O_CFG_ACODEC_OPENMPT not set #endif #include #include -ALLEGRO_DEBUG_CHANNEL("acodec") +A5O_DEBUG_CHANNEL("acodec") typedef struct MOD_FILE { openmpt_module *mod; - ALLEGRO_FILE *fh; + A5O_FILE *fh; double length; double loop_start, loop_end; } MOD_FILE; @@ -36,7 +36,7 @@ typedef struct MOD_FILE static size_t stream_read_func(void *stream, void *dst, size_t bytes) { - return al_fread((ALLEGRO_FILE*)stream, dst, bytes); + return al_fread((A5O_FILE*)stream, dst, bytes); } @@ -46,32 +46,32 @@ static int stream_seek_func(void *stream, int64_t offset, int whence) switch (whence) { case OPENMPT_STREAM_SEEK_SET: - allegro_whence = ALLEGRO_SEEK_SET; + allegro_whence = A5O_SEEK_SET; break; case OPENMPT_STREAM_SEEK_CUR: - allegro_whence = ALLEGRO_SEEK_CUR; + allegro_whence = A5O_SEEK_CUR; break; case OPENMPT_STREAM_SEEK_END: - allegro_whence = ALLEGRO_SEEK_END; + allegro_whence = A5O_SEEK_END; break; default: return -1; } - return al_fseek((ALLEGRO_FILE*)stream, offset, allegro_whence) ? 0 : -1; + return al_fseek((A5O_FILE*)stream, offset, allegro_whence) ? 0 : -1; } static int64_t stream_tell_func(void *stream) { - return al_ftell((ALLEGRO_FILE*)stream); + return al_ftell((A5O_FILE*)stream); } static void log_func(const char* message, void *user) { (void)user; - ALLEGRO_DEBUG("OpenMPT: %s", message); + A5O_DEBUG("OpenMPT: %s", message); } @@ -80,16 +80,16 @@ static int error_func(int error, void *user) (void)user; const char* error_str = openmpt_error_string(error); if (error_str) { - ALLEGRO_ERROR("OpenMPT error: %s\n", error_str); + A5O_ERROR("OpenMPT error: %s\n", error_str); openmpt_free_string(error_str); } else - ALLEGRO_ERROR("OpenMPT error: %d\n", error); + A5O_ERROR("OpenMPT error: %d\n", error); return OPENMPT_ERROR_FUNC_RESULT_NONE; } // /* Stream Functions */ -static size_t openmpt_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, +static size_t openmpt_stream_update(A5O_AUDIO_STREAM *stream, void *data, size_t buf_size) { MOD_FILE *const modf = stream->extra; @@ -99,7 +99,7 @@ static size_t openmpt_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, size_t written = 0; size_t i; - if (stream->spl.loop == _ALLEGRO_PLAYMODE_STREAM_ONCE) { + if (stream->spl.loop == _A5O_PLAYMODE_STREAM_ONCE) { openmpt_module_ctl_set_text(modf->mod, "play.at_end", "stop"); openmpt_module_set_repeat_count(modf->mod, 0); } else { @@ -114,7 +114,7 @@ static size_t openmpt_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, bool manual_loop = false; /* If manual looping is not enabled, then we need to implement * short-stopping manually. */ - if (stream->spl.loop != _ALLEGRO_PLAYMODE_STREAM_ONCE && modf->loop_end != -1 && + if (stream->spl.loop != _A5O_PLAYMODE_STREAM_ONCE && modf->loop_end != -1 && position + frames_to_read / 44100 >= modf->loop_end) { frames_to_read = (long)((modf->loop_end - position) * 44100); if (frames_to_read < 0) @@ -136,7 +136,7 @@ static size_t openmpt_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, return written; } -static void openmpt_stream_close(ALLEGRO_AUDIO_STREAM *stream) +static void openmpt_stream_close(A5O_AUDIO_STREAM *stream) { MOD_FILE *const modf = stream->extra; _al_acodec_stop_feed_thread(stream); @@ -147,7 +147,7 @@ static void openmpt_stream_close(ALLEGRO_AUDIO_STREAM *stream) al_fclose(modf->fh); } -static bool openmpt_stream_rewind(ALLEGRO_AUDIO_STREAM *stream) +static bool openmpt_stream_rewind(A5O_AUDIO_STREAM *stream) { MOD_FILE *const modf = stream->extra; openmpt_module_set_position_seconds(modf->mod, modf->loop_start); @@ -155,7 +155,7 @@ static bool openmpt_stream_rewind(ALLEGRO_AUDIO_STREAM *stream) } -static bool openmpt_stream_seek(ALLEGRO_AUDIO_STREAM *stream, double time) +static bool openmpt_stream_seek(A5O_AUDIO_STREAM *stream, double time) { MOD_FILE *const modf = stream->extra; @@ -169,21 +169,21 @@ static bool openmpt_stream_seek(ALLEGRO_AUDIO_STREAM *stream, double time) } -static double openmpt_stream_get_position(ALLEGRO_AUDIO_STREAM *stream) +static double openmpt_stream_get_position(A5O_AUDIO_STREAM *stream) { MOD_FILE *const modf = stream->extra; return openmpt_module_get_position_seconds(modf->mod); } -static double openmpt_stream_get_length(ALLEGRO_AUDIO_STREAM *stream) +static double openmpt_stream_get_length(A5O_AUDIO_STREAM *stream) { MOD_FILE *const modf = stream->extra; return modf->length; } -static bool openmpt_stream_set_loop(ALLEGRO_AUDIO_STREAM *stream, +static bool openmpt_stream_set_loop(A5O_AUDIO_STREAM *stream, double start, double end) { MOD_FILE *const modf = stream->extra; @@ -195,12 +195,12 @@ static bool openmpt_stream_set_loop(ALLEGRO_AUDIO_STREAM *stream, } -static ALLEGRO_AUDIO_STREAM *openmpt_stream_init(ALLEGRO_FILE* f, +static A5O_AUDIO_STREAM *openmpt_stream_init(A5O_FILE* f, size_t buffer_count, unsigned int samples ) { int64_t start_pos = al_ftell(f); - ALLEGRO_AUDIO_STREAM *stream = NULL; + A5O_AUDIO_STREAM *stream = NULL; openmpt_stream_callbacks callbacks = { stream_read_func, @@ -229,7 +229,7 @@ static ALLEGRO_AUDIO_STREAM *openmpt_stream_init(ALLEGRO_FILE* f, // TODO: OpenMPT recommends 48000 and float // TODO: OpenMPT supports quad channels too stream = al_create_audio_stream(buffer_count, samples, 44100, - ALLEGRO_AUDIO_DEPTH_INT16, ALLEGRO_CHANNEL_CONF_2); + A5O_AUDIO_DEPTH_INT16, A5O_CHANNEL_CONF_2); if (stream) { MOD_FILE *mf = al_malloc(sizeof(MOD_FILE)); @@ -257,7 +257,7 @@ static ALLEGRO_AUDIO_STREAM *openmpt_stream_init(ALLEGRO_FILE* f, _al_acodec_start_feed_thread(stream); } else { - ALLEGRO_ERROR("Failed to create stream.\n"); + A5O_ERROR("Failed to create stream.\n"); goto Error; } @@ -269,28 +269,28 @@ static ALLEGRO_AUDIO_STREAM *openmpt_stream_init(ALLEGRO_FILE* f, /* try to return back to where we started to load */ if (start_pos != -1) - al_fseek(f, start_pos, ALLEGRO_SEEK_SET); + al_fseek(f, start_pos, A5O_SEEK_SET); return NULL; } -static ALLEGRO_AUDIO_STREAM *load_audio_stream_f(ALLEGRO_FILE *f, +static A5O_AUDIO_STREAM *load_audio_stream_f(A5O_FILE *f, size_t buffer_count, unsigned int samples) { return openmpt_stream_init(f, buffer_count, samples); } -static ALLEGRO_AUDIO_STREAM *load_audio_stream(const char *filename, +static A5O_AUDIO_STREAM *load_audio_stream(const char *filename, size_t buffer_count, unsigned int samples) { - ALLEGRO_FILE *f; - ALLEGRO_AUDIO_STREAM *stream; + A5O_FILE *f; + A5O_AUDIO_STREAM *stream; ASSERT(filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } diff --git a/addons/acodec/opus.c b/addons/acodec/opus.c index b01b26b156..f0718ed285 100644 --- a/addons/acodec/opus.c +++ b/addons/acodec/opus.c @@ -14,11 +14,11 @@ #include "acodec.h" #include "helper.h" -#ifndef ALLEGRO_CFG_ACODEC_OPUS - #error configuration problem, ALLEGRO_CFG_ACODEC_OPUS not set +#ifndef A5O_CFG_ACODEC_OPUS + #error configuration problem, A5O_CFG_ACODEC_OPUS not set #endif -ALLEGRO_DEBUG_CHANNEL("acodec") +A5O_DEBUG_CHANNEL("acodec") #include @@ -26,7 +26,7 @@ typedef struct AL_OP_DATA AL_OP_DATA; struct AL_OP_DATA { OggOpusFile *of; - ALLEGRO_FILE *file; + A5O_FILE *file; int channels; int bitstream; double loop_start; @@ -34,7 +34,7 @@ struct AL_OP_DATA { }; /* dynamic loading support (Windows only currently) */ -#ifdef ALLEGRO_CFG_ACODEC_OPUSFILE_DLL +#ifdef A5O_CFG_ACODEC_OPUSFILE_DLL static void *op_dll = NULL; static bool op_virgin = true; #endif @@ -51,7 +51,7 @@ static struct } lib; -#ifdef ALLEGRO_CFG_ACODEC_OPUSFILE_DLL +#ifdef A5O_CFG_ACODEC_OPUSFILE_DLL static void shutdown_dynlib(void) { if (op_dll) { @@ -65,7 +65,7 @@ static void shutdown_dynlib(void) static bool init_dynlib(void) { -#ifdef ALLEGRO_CFG_ACODEC_OPUSFILE_DLL +#ifdef A5O_CFG_ACODEC_OPUSFILE_DLL if (op_dll) { return true; } @@ -76,9 +76,9 @@ static bool init_dynlib(void) op_virgin = false; - op_dll = _al_open_library(ALLEGRO_CFG_ACODEC_OPUSFILE_DLL); + op_dll = _al_open_library(A5O_CFG_ACODEC_OPUSFILE_DLL); if (!op_dll) { - ALLEGRO_WARN("Could not load " ALLEGRO_CFG_ACODEC_OPUSFILE_DLL "\n"); + A5O_WARN("Could not load " A5O_CFG_ACODEC_OPUSFILE_DLL "\n"); return false; } @@ -89,7 +89,7 @@ static bool init_dynlib(void) { \ lib.x = _al_import_symbol(op_dll, #x); \ if (lib.x == 0) { \ - ALLEGRO_ERROR("undefined symbol in lib structure: " #x "\n"); \ + A5O_ERROR("undefined symbol in lib structure: " #x "\n"); \ return false; \ } \ } while(0) @@ -129,9 +129,9 @@ static int seek_callback(void *stream, opus_int64 offset, int whence) AL_OP_DATA *op = (AL_OP_DATA *)stream; switch(whence) { - case SEEK_SET: whence = ALLEGRO_SEEK_SET; break; - case SEEK_CUR: whence = ALLEGRO_SEEK_CUR; break; - case SEEK_END: whence = ALLEGRO_SEEK_END; break; + case SEEK_SET: whence = A5O_SEEK_SET; break; + case SEEK_CUR: whence = A5O_SEEK_CUR; break; + case SEEK_END: whence = A5O_SEEK_END; break; } if (!al_fseek(op->file, offset, whence)) { @@ -171,16 +171,16 @@ static OpusFileCallbacks callbacks = { }; -ALLEGRO_SAMPLE *_al_load_ogg_opus(const char *filename) +A5O_SAMPLE *_al_load_ogg_opus(const char *filename) { - ALLEGRO_FILE *f; - ALLEGRO_SAMPLE *spl; + A5O_FILE *f; + A5O_SAMPLE *spl; ASSERT(filename); - ALLEGRO_INFO("Loading sample %s.\n", filename); + A5O_INFO("Loading sample %s.\n", filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } @@ -192,7 +192,7 @@ ALLEGRO_SAMPLE *_al_load_ogg_opus(const char *filename) } -ALLEGRO_SAMPLE *_al_load_ogg_opus_f(ALLEGRO_FILE *file) +A5O_SAMPLE *_al_load_ogg_opus_f(A5O_FILE *file) { /* Note: decoding library can return 16-bit or floating-point output, * both using native endian ordering. (TODO: Implement float output, @@ -202,7 +202,7 @@ ALLEGRO_SAMPLE *_al_load_ogg_opus_f(ALLEGRO_FILE *file) const int packet_size = 5760; /* suggestion for size to read at a time */ OggOpusFile *of; opus_int16 *buffer; - ALLEGRO_SAMPLE *sample; + A5O_SAMPLE *sample; int channels; long rate; ogg_int64_t total_samples; @@ -219,7 +219,7 @@ ALLEGRO_SAMPLE *_al_load_ogg_opus_f(ALLEGRO_FILE *file) op.file = file; of = lib.op_open_callbacks(&op, &callbacks, NULL, 0, NULL); if (!of) { - ALLEGRO_ERROR("Audio file does not appear to be an Ogg bitstream.\n"); + A5O_ERROR("Audio file does not appear to be an Ogg bitstream.\n"); return NULL; } @@ -229,11 +229,11 @@ ALLEGRO_SAMPLE *_al_load_ogg_opus_f(ALLEGRO_FILE *file) total_samples = lib.op_pcm_total(of, bitstream); total_size = total_samples * channels * word_size; - ALLEGRO_DEBUG("channels %d\n", channels); - ALLEGRO_DEBUG("word_size %d\n", word_size); - ALLEGRO_DEBUG("rate %ld\n", rate); - ALLEGRO_DEBUG("total_samples %ld\n", (long)total_samples); - ALLEGRO_DEBUG("total_size %ld\n", (long)total_size); + A5O_DEBUG("channels %d\n", channels); + A5O_DEBUG("word_size %d\n", word_size); + A5O_DEBUG("rate %ld\n", rate); + A5O_DEBUG("total_samples %ld\n", (long)total_samples); + A5O_DEBUG("total_size %ld\n", (long)total_size); buffer = al_malloc(total_size); if (!buffer) { @@ -242,7 +242,7 @@ ALLEGRO_SAMPLE *_al_load_ogg_opus_f(ALLEGRO_FILE *file) pos = 0; while (pos < total_samples) { - const int read_size = _ALLEGRO_MIN(packet_size, total_samples - pos); + const int read_size = _A5O_MIN(packet_size, total_samples - pos); ASSERT(pos + read_size <= total_samples); /* XXX error handling */ @@ -267,7 +267,7 @@ ALLEGRO_SAMPLE *_al_load_ogg_opus_f(ALLEGRO_FILE *file) } -static bool ogg_stream_seek(ALLEGRO_AUDIO_STREAM *stream, double time) +static bool ogg_stream_seek(A5O_AUDIO_STREAM *stream, double time) { AL_OP_DATA *extra = (AL_OP_DATA *) stream->extra; @@ -278,7 +278,7 @@ static bool ogg_stream_seek(ALLEGRO_AUDIO_STREAM *stream, double time) } -static bool ogg_stream_rewind(ALLEGRO_AUDIO_STREAM *stream) +static bool ogg_stream_rewind(A5O_AUDIO_STREAM *stream) { AL_OP_DATA *extra = (AL_OP_DATA *) stream->extra; @@ -286,7 +286,7 @@ static bool ogg_stream_rewind(ALLEGRO_AUDIO_STREAM *stream) } -static double ogg_stream_get_position(ALLEGRO_AUDIO_STREAM *stream) +static double ogg_stream_get_position(A5O_AUDIO_STREAM *stream) { AL_OP_DATA *extra = (AL_OP_DATA *) stream->extra; @@ -294,7 +294,7 @@ static double ogg_stream_get_position(ALLEGRO_AUDIO_STREAM *stream) } -static double ogg_stream_get_length(ALLEGRO_AUDIO_STREAM *stream) +static double ogg_stream_get_length(A5O_AUDIO_STREAM *stream) { AL_OP_DATA *extra = (AL_OP_DATA *) stream->extra; @@ -302,7 +302,7 @@ static double ogg_stream_get_length(ALLEGRO_AUDIO_STREAM *stream) } -static bool ogg_stream_set_loop(ALLEGRO_AUDIO_STREAM *stream, double start, double end) +static bool ogg_stream_set_loop(A5O_AUDIO_STREAM *stream, double start, double end) { AL_OP_DATA *extra = (AL_OP_DATA *) stream->extra; @@ -314,7 +314,7 @@ static bool ogg_stream_set_loop(ALLEGRO_AUDIO_STREAM *stream, double start, doub /* To be called when stream is destroyed */ -static void ogg_stream_close(ALLEGRO_AUDIO_STREAM *stream) +static void ogg_stream_close(A5O_AUDIO_STREAM *stream) { AL_OP_DATA *extra = (AL_OP_DATA *) stream->extra; @@ -328,7 +328,7 @@ static void ogg_stream_close(ALLEGRO_AUDIO_STREAM *stream) } -static size_t ogg_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, +static size_t ogg_stream_update(A5O_AUDIO_STREAM *stream, void *data, size_t buf_size) { AL_OP_DATA *extra = (AL_OP_DATA *) stream->extra; @@ -346,7 +346,7 @@ static size_t ogg_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, double btime = ((double)buf_size / (word_size * channels)) / rate; long read; - if (stream->spl.loop != _ALLEGRO_PLAYMODE_STREAM_ONCE && ctime + btime > extra->loop_end) { + if (stream->spl.loop != _A5O_PLAYMODE_STREAM_ONCE && ctime + btime > extra->loop_end) { read_length = (extra->loop_end - ctime) * rate * word_size * channels; if (read_length < 0) return 0; @@ -369,17 +369,17 @@ static size_t ogg_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, } -ALLEGRO_AUDIO_STREAM *_al_load_ogg_opus_audio_stream(const char *filename, +A5O_AUDIO_STREAM *_al_load_ogg_opus_audio_stream(const char *filename, size_t buffer_count, unsigned int samples) { - ALLEGRO_FILE *f; - ALLEGRO_AUDIO_STREAM *stream; + A5O_FILE *f; + A5O_AUDIO_STREAM *stream; ASSERT(filename); - ALLEGRO_INFO("Loading stream %s.\n", filename); + A5O_INFO("Loading stream %s.\n", filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } @@ -392,7 +392,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_ogg_opus_audio_stream(const char *filename, } -ALLEGRO_AUDIO_STREAM *_al_load_ogg_opus_audio_stream_f(ALLEGRO_FILE *file, +A5O_AUDIO_STREAM *_al_load_ogg_opus_audio_stream_f(A5O_FILE *file, size_t buffer_count, unsigned int samples) { const int word_size = 2; /* 1 = 8bit, 2 = 16-bit. nothing else */ @@ -403,7 +403,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_ogg_opus_audio_stream_f(ALLEGRO_FILE *file, long total_size; int bitstream; AL_OP_DATA* extra; - ALLEGRO_AUDIO_STREAM* stream; + A5O_AUDIO_STREAM* stream; if (!init_dynlib()) { return NULL; @@ -411,7 +411,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_ogg_opus_audio_stream_f(ALLEGRO_FILE *file, extra = al_malloc(sizeof(AL_OP_DATA)); if (extra == NULL) { - ALLEGRO_ERROR("Failed to allocate AL_OP_DATA struct.\n"); + A5O_ERROR("Failed to allocate AL_OP_DATA struct.\n"); return NULL; } @@ -419,7 +419,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_ogg_opus_audio_stream_f(ALLEGRO_FILE *file, of = lib.op_open_callbacks(extra, &callbacks, NULL, 0, NULL); if (!of) { - ALLEGRO_ERROR("ogg: Input does not appear to be an Ogg bitstream.\n"); + A5O_ERROR("ogg: Input does not appear to be an Ogg bitstream.\n"); return NULL; } @@ -435,11 +435,11 @@ ALLEGRO_AUDIO_STREAM *_al_load_ogg_opus_audio_stream_f(ALLEGRO_FILE *file, total_size = total_samples * channels * word_size; - ALLEGRO_DEBUG("channels %d\n", channels); - ALLEGRO_DEBUG("word_size %d\n", word_size); - ALLEGRO_DEBUG("rate %ld\n", rate); - ALLEGRO_DEBUG("total_samples %ld\n", total_samples); - ALLEGRO_DEBUG("total_size %ld\n", total_size); + A5O_DEBUG("channels %d\n", channels); + A5O_DEBUG("word_size %d\n", word_size); + A5O_DEBUG("rate %ld\n", rate); + A5O_DEBUG("total_samples %ld\n", total_samples); + A5O_DEBUG("total_size %ld\n", total_size); stream = al_create_audio_stream(buffer_count, samples, rate, _al_word_size_to_depth_conf(word_size), @@ -467,14 +467,14 @@ ALLEGRO_AUDIO_STREAM *_al_load_ogg_opus_audio_stream_f(ALLEGRO_FILE *file, } -bool _al_identify_ogg_opus(ALLEGRO_FILE *f) +bool _al_identify_ogg_opus(A5O_FILE *f) { uint8_t x[10]; if (al_fread(f, x, 4) < 4) return false; if (memcmp(x, "OggS", 4) != 0) return false; - if (!al_fseek(f, 22, ALLEGRO_SEEK_CUR)) + if (!al_fseek(f, 22, A5O_SEEK_CUR)) return false; if (al_fread(f, x, 10) < 10) return false; diff --git a/addons/acodec/voc.c b/addons/acodec/voc.c index 1e66d4ac9f..4574ee954f 100644 --- a/addons/acodec/voc.c +++ b/addons/acodec/voc.c @@ -45,12 +45,12 @@ #include "acodec.h" #include "helper.h" -ALLEGRO_DEBUG_CHANNEL("voc") +A5O_DEBUG_CHANNEL("voc") typedef struct AL_VOC_DATA AL_VOC_DATA; struct AL_VOC_DATA { - ALLEGRO_FILE *file; + A5O_FILE *file; size_t datapos; int samplerate; short bits; /* 8 (unsigned char) or 16 (signed short) */ @@ -61,7 +61,7 @@ struct AL_VOC_DATA { /* * Fills in a VOC data header with information obtained by opening an - * caller-provided ALLEGRO_FILE. + * caller-provided A5O_FILE. * The datapos index will be the first data byte of the first data block which * contains ACTUAL data. */ @@ -69,13 +69,13 @@ struct AL_VOC_DATA { #define READNBYTES(f, data, n, retv) \ do { \ if (al_fread(f, &data, n) != n) { \ - ALLEGRO_WARN("voc_open: Bad Number of bytes read in last operation"); \ + A5O_WARN("voc_open: Bad Number of bytes read in last operation"); \ return retv; \ } \ } while(0) -static AL_VOC_DATA *voc_open(ALLEGRO_FILE *fp) +static AL_VOC_DATA *voc_open(A5O_FILE *fp) { AL_VOC_DATA *vocdata; char hdrbuf[0x16]; @@ -104,19 +104,19 @@ static AL_VOC_DATA *voc_open(ALLEGRO_FILE *fp) if (readcount != 0x16 /*short header*/ || memcmp(hdrbuf, "Creative Voice File\x1A", 0x14) != 0 /*wrong id */ || memcmp(hdrbuf+0x14, "\x1A\x00", 0x2) != 0) { /*wrong offset */ - ALLEGRO_ERROR("voc_open: File does not appear to be a valid VOC file"); + A5O_ERROR("voc_open: File does not appear to be a valid VOC file"); return NULL; } READNBYTES(fp, vocversion, 2, NULL); if (vocversion != 0x10A && vocversion != 0x114) { // known ver 1.10 -1.20 - ALLEGRO_ERROR("voc_open: File is of unknown version"); + A5O_ERROR("voc_open: File is of unknown version"); return NULL; } /* checksum version check */ READNBYTES(fp, checkver, 2, NULL); if (checkver != ~vocversion + 0x1234) { - ALLEGRO_ERROR("voc_open: Bad VOC Version Identification Number"); + A5O_ERROR("voc_open: Bad VOC Version Identification Number"); return NULL; } /* @@ -156,7 +156,7 @@ static AL_VOC_DATA *voc_open(ALLEGRO_FILE *fp) * required header info. */ if (blocklength != 4) { - ALLEGRO_ERROR("voc_open: Got opening Blocktype 8 of wrong length"); + A5O_ERROR("voc_open: Got opening Blocktype 8 of wrong length"); return NULL; } READNBYTES(fp, timeconstant, 2, NULL); @@ -173,7 +173,7 @@ static AL_VOC_DATA *voc_open(ALLEGRO_FILE *fp) */ READNBYTES(fp, blocktype, 1, NULL); if (blocktype != 1) { - ALLEGRO_ERROR("voc_open: Blocktype following type 8 is not 1"); + A5O_ERROR("voc_open: Blocktype following type 8 is not 1"); return NULL; } READNBYTES(fp, blocklength, 2, NULL); @@ -199,7 +199,7 @@ static AL_VOC_DATA *voc_open(ALLEGRO_FILE *fp) READNBYTES(fp, format, 2, NULL); if ((vocdata->bits != 8 && vocdata->bits != 16) || (format != 0 && format != 4)) { - ALLEGRO_ERROR("voc_open: unsupported CODEC in voc data"); + A5O_ERROR("voc_open: unsupported CODEC in voc data"); return NULL; } READNBYTES(fp, x, 4, NULL); // just skip 4 reserved bytes @@ -212,7 +212,7 @@ static AL_VOC_DATA *voc_open(ALLEGRO_FILE *fp) case 6: // valid VOC data. case 7: // default: - ALLEGRO_ERROR("voc_open: opening Block is of unsupported type"); + A5O_ERROR("voc_open: opening Block is of unsupported type"); return NULL; break; } @@ -227,16 +227,16 @@ static void voc_close(AL_VOC_DATA *vocdata) } -ALLEGRO_SAMPLE *_al_load_voc(const char *filename) +A5O_SAMPLE *_al_load_voc(const char *filename) { - ALLEGRO_FILE *f; - ALLEGRO_SAMPLE *spl; + A5O_FILE *f; + A5O_SAMPLE *spl; ASSERT(filename); - ALLEGRO_INFO("Loading VOC sample %s.\n", filename); + A5O_INFO("Loading VOC sample %s.\n", filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } @@ -248,10 +248,10 @@ ALLEGRO_SAMPLE *_al_load_voc(const char *filename) } -ALLEGRO_SAMPLE *_al_load_voc_f(ALLEGRO_FILE *file) +A5O_SAMPLE *_al_load_voc_f(A5O_FILE *file) { AL_VOC_DATA *vocdata; - ALLEGRO_SAMPLE *sample = NULL; + A5O_SAMPLE *sample = NULL; size_t pos = 0; /* where to write in the buffer */ size_t read = 0; /*bytes read during last operation */ char* buffer; @@ -268,11 +268,11 @@ ALLEGRO_SAMPLE *_al_load_voc_f(ALLEGRO_FILE *file) vocdata = voc_open(file); if (!vocdata) return NULL; - ALLEGRO_DEBUG("channels %d\n", vocdata->channels); - ALLEGRO_DEBUG("word_size %d\n", vocdata->sample_size); - ALLEGRO_DEBUG("rate %d\n", vocdata->samplerate); - ALLEGRO_DEBUG("first_block_samples %d\n", vocdata->samples); - ALLEGRO_DEBUG("first_block_size %d\n", vocdata->samples * vocdata->sample_size); + A5O_DEBUG("channels %d\n", vocdata->channels); + A5O_DEBUG("word_size %d\n", vocdata->sample_size); + A5O_DEBUG("rate %d\n", vocdata->samplerate); + A5O_DEBUG("first_block_samples %d\n", vocdata->samples); + A5O_DEBUG("first_block_size %d\n", vocdata->samples * vocdata->sample_size); /* * Let's allocate at least the first block's bytes; @@ -357,7 +357,7 @@ ALLEGRO_SAMPLE *_al_load_voc_f(ALLEGRO_FILE *file) */ -bool _al_identify_voc(ALLEGRO_FILE *f) +bool _al_identify_voc(A5O_FILE *f) { uint8_t x[22]; if (al_fread(f, x, 22) < 22) diff --git a/addons/acodec/wav.c b/addons/acodec/wav.c index 87a2688ce8..76d48561db 100644 --- a/addons/acodec/wav.c +++ b/addons/acodec/wav.c @@ -10,12 +10,12 @@ #include "acodec.h" #include "helper.h" -ALLEGRO_DEBUG_CHANNEL("wav") +A5O_DEBUG_CHANNEL("wav") typedef struct WAVFILE { - ALLEGRO_FILE *f; + A5O_FILE *f; size_t dpos; /* the starting position of the data chunk */ int freq; /* e.g., 44100 */ short bits; /* 8 (unsigned char) or 16 (signed short) */ @@ -29,10 +29,10 @@ typedef struct WAVFILE /* wav_open: * Opens f and prepares a WAVFILE struct with the WAV format info. - * On a successful return, the ALLEGRO_FILE is at the beginning of the sample data. + * On a successful return, the A5O_FILE is at the beginning of the sample data. * returns the WAVFILE on success, or NULL on failure. */ -static WAVFILE *wav_open(ALLEGRO_FILE *f) +static WAVFILE *wav_open(A5O_FILE *f) { WAVFILE *wavfile = NULL; char buffer[12]; @@ -43,7 +43,7 @@ static WAVFILE *wav_open(ALLEGRO_FILE *f) /* prepare default values */ wavfile = al_malloc(sizeof(WAVFILE)); if (!wavfile) { - ALLEGRO_ERROR("Failed to allocate WAVFILE.\n"); + A5O_ERROR("Failed to allocate WAVFILE.\n"); return NULL; } wavfile->f = f; @@ -53,12 +53,12 @@ static WAVFILE *wav_open(ALLEGRO_FILE *f) /* check the header */ if (al_fread(f, buffer, 12) != 12) { - ALLEGRO_ERROR("Unexpected EOF while reading the header.\n"); + A5O_ERROR("Unexpected EOF while reading the header.\n"); goto wav_open_error; } if (memcmp(buffer, "RIFF", 4) || memcmp(buffer+8, "WAVE", 4)) { - ALLEGRO_ERROR("Bad magic number.\n"); + A5O_ERROR("Bad magic number.\n"); goto wav_open_error; } @@ -70,7 +70,7 @@ static WAVFILE *wav_open(ALLEGRO_FILE *f) short pcm = 0; if (al_fread(f, buffer, 4) != 4) { - ALLEGRO_ERROR("Unexpected EOF while reading RIFF type.\n"); + A5O_ERROR("Unexpected EOF while reading RIFF type.\n"); goto wav_open_error; } @@ -79,14 +79,14 @@ static WAVFILE *wav_open(ALLEGRO_FILE *f) length = al_fread32le(f); if (length < 16) { - ALLEGRO_ERROR("Bad length: %d.\n", length); + A5O_ERROR("Bad length: %d.\n", length); goto wav_open_error; } /* should be 1 for PCM data */ pcm = al_fread16le(f); if (pcm != 1) { - ALLEGRO_ERROR("Bad PCM value: %d.\n", pcm); + A5O_ERROR("Bad PCM value: %d.\n", pcm); goto wav_open_error; } @@ -94,7 +94,7 @@ static WAVFILE *wav_open(ALLEGRO_FILE *f) wavfile->channels = al_fread16le(f); if ((wavfile->channels != 1) && (wavfile->channels != 2)) { - ALLEGRO_ERROR("Bad number of channels: %d.\n", wavfile->channels); + A5O_ERROR("Bad number of channels: %d.\n", wavfile->channels); goto wav_open_error; } @@ -102,29 +102,29 @@ static WAVFILE *wav_open(ALLEGRO_FILE *f) wavfile->freq = al_fread32le(f); /* skip six bytes */ - al_fseek(f, 6, ALLEGRO_SEEK_CUR); + al_fseek(f, 6, A5O_SEEK_CUR); /* 8 or 16 bit data? */ wavfile->bits = al_fread16le(f); if ((wavfile->bits != 8) && (wavfile->bits != 16)) { - ALLEGRO_ERROR("Bad number of bits: %d.\n", wavfile->bits); + A5O_ERROR("Bad number of bits: %d.\n", wavfile->bits); goto wav_open_error; } /* Skip remainder of chunk */ length -= 16; if (length > 0) - al_fseek(f, length, ALLEGRO_SEEK_CUR); + al_fseek(f, length, A5O_SEEK_CUR); } else { if (!memcmp(buffer, "data", 4)) { - ALLEGRO_ERROR("Bad RIFF type.\n"); + A5O_ERROR("Bad RIFF type.\n"); break; } - ALLEGRO_INFO("Ignoring chunk: %c%c%c%c\n", buffer[0], buffer[1], + A5O_INFO("Ignoring chunk: %c%c%c%c\n", buffer[0], buffer[1], buffer[2], buffer[3]); length = al_fread32le(f); - al_fseek(f, length, ALLEGRO_SEEK_CUR); + al_fseek(f, length, A5O_SEEK_CUR); } } @@ -154,7 +154,7 @@ static WAVFILE *wav_open(ALLEGRO_FILE *f) } /* wav_read: - * Reads up to 'samples' number of samples from the wav ALLEGRO_FILE into 'data'. + * Reads up to 'samples' number of samples from the wav A5O_FILE into 'data'. * Returns the actual number of samples written to 'data'. */ static size_t wav_read(WAVFILE *wavfile, void *data, size_t samples) @@ -173,7 +173,7 @@ static size_t wav_read(WAVFILE *wavfile, void *data, size_t samples) /* PCM data in RIFF WAV files is little endian. * PCM data in RIFX WAV files is big endian (which we don't support). */ -#ifdef ALLEGRO_BIG_ENDIAN +#ifdef A5O_BIG_ENDIAN if (wavfile->bits == 16) { uint16_t *p = data; const uint16_t *const end = p + (bytes_read >> 1); @@ -191,7 +191,7 @@ static size_t wav_read(WAVFILE *wavfile, void *data, size_t samples) /* wav_close: - * Closes the ALLEGRO_FILE and frees the WAVFILE struct. + * Closes the A5O_FILE and frees the WAVFILE struct. */ static void wav_close(WAVFILE *wavfile) { @@ -201,7 +201,7 @@ static void wav_close(WAVFILE *wavfile) } -static bool wav_stream_seek(ALLEGRO_AUDIO_STREAM * stream, double time) +static bool wav_stream_seek(A5O_AUDIO_STREAM * stream, double time) { WAVFILE *wavfile = (WAVFILE *) stream->extra; int align = (wavfile->bits / 8) * wavfile->channels; @@ -209,7 +209,7 @@ static bool wav_stream_seek(ALLEGRO_AUDIO_STREAM * stream, double time) if (time >= wavfile->loop_end) return false; cpos += cpos % align; - return al_fseek(wavfile->f, wavfile->dpos + cpos, ALLEGRO_SEEK_SET); + return al_fseek(wavfile->f, wavfile->dpos + cpos, A5O_SEEK_SET); } @@ -217,14 +217,14 @@ static bool wav_stream_seek(ALLEGRO_AUDIO_STREAM * stream, double time) * Rewinds 'stream' to the beginning of the data chunk. * Returns true on success, false on failure. */ -static bool wav_stream_rewind(ALLEGRO_AUDIO_STREAM *stream) +static bool wav_stream_rewind(A5O_AUDIO_STREAM *stream) { WAVFILE *wavfile = (WAVFILE *) stream->extra; return wav_stream_seek(stream, wavfile->loop_start); } -static double wav_stream_get_position(ALLEGRO_AUDIO_STREAM * stream) +static double wav_stream_get_position(A5O_AUDIO_STREAM * stream) { WAVFILE *wavfile = (WAVFILE *) stream->extra; double samples_per = (double)((wavfile->bits / 8) * wavfile->channels) * (double)(wavfile->freq); @@ -232,7 +232,7 @@ static double wav_stream_get_position(ALLEGRO_AUDIO_STREAM * stream) } -static double wav_stream_get_length(ALLEGRO_AUDIO_STREAM * stream) +static double wav_stream_get_length(A5O_AUDIO_STREAM * stream) { WAVFILE *wavfile = (WAVFILE *) stream->extra; double total_time = (double)(wavfile->samples) / (double)(wavfile->freq); @@ -240,7 +240,7 @@ static double wav_stream_get_length(ALLEGRO_AUDIO_STREAM * stream) } -static bool wav_stream_set_loop(ALLEGRO_AUDIO_STREAM * stream, double start, double end) +static bool wav_stream_set_loop(A5O_AUDIO_STREAM * stream, double start, double end) { WAVFILE *wavfile = (WAVFILE *) stream->extra; wavfile->loop_start = start; @@ -253,7 +253,7 @@ static bool wav_stream_set_loop(ALLEGRO_AUDIO_STREAM * stream, double start, dou * Updates 'stream' with the next chunk of data. * Returns the actual number of bytes written. */ -static size_t wav_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, +static size_t wav_stream_update(A5O_AUDIO_STREAM *stream, void *data, size_t buf_size) { int bytes_per_sample, samples, samples_read; @@ -264,7 +264,7 @@ static size_t wav_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, ctime = wav_stream_get_position(stream); btime = ((double)buf_size / (double)bytes_per_sample) / (double)(wavfile->freq); - if (stream->spl.loop != _ALLEGRO_PLAYMODE_STREAM_ONCE && ctime + btime > wavfile->loop_end) { + if (stream->spl.loop != _A5O_PLAYMODE_STREAM_ONCE && ctime + btime > wavfile->loop_end) { samples = ((wavfile->loop_end - ctime) * (double)(wavfile->freq)); } else { @@ -282,7 +282,7 @@ static size_t wav_stream_update(ALLEGRO_AUDIO_STREAM *stream, void *data, /* wav_stream_close: * Closes the 'stream'. */ -static void wav_stream_close(ALLEGRO_AUDIO_STREAM *stream) +static void wav_stream_close(A5O_AUDIO_STREAM *stream) { WAVFILE *wavfile = (WAVFILE *) stream->extra; @@ -296,18 +296,18 @@ static void wav_stream_close(ALLEGRO_AUDIO_STREAM *stream) /* _al_load_wav: - * Reads a RIFF WAV format sample ALLEGRO_FILE, returning an ALLEGRO_SAMPLE + * Reads a RIFF WAV format sample A5O_FILE, returning an A5O_SAMPLE * structure, or NULL on error. */ -ALLEGRO_SAMPLE *_al_load_wav(const char *filename) +A5O_SAMPLE *_al_load_wav(const char *filename) { - ALLEGRO_FILE *f; - ALLEGRO_SAMPLE *spl; + A5O_FILE *f; + A5O_SAMPLE *spl; ASSERT(filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } @@ -318,10 +318,10 @@ ALLEGRO_SAMPLE *_al_load_wav(const char *filename) return spl; } -ALLEGRO_SAMPLE *_al_load_wav_f(ALLEGRO_FILE *fp) +A5O_SAMPLE *_al_load_wav_f(A5O_FILE *fp) { WAVFILE *wavfile = wav_open(fp); - ALLEGRO_SAMPLE *spl = NULL; + A5O_SAMPLE *spl = NULL; if (wavfile) { size_t n = (wavfile->bits / 8) * wavfile->channels * wavfile->samples; @@ -349,22 +349,22 @@ ALLEGRO_SAMPLE *_al_load_wav_f(ALLEGRO_FILE *fp) /* _al_load_wav_audio_stream: */ -ALLEGRO_AUDIO_STREAM *_al_load_wav_audio_stream(const char *filename, +A5O_AUDIO_STREAM *_al_load_wav_audio_stream(const char *filename, size_t buffer_count, unsigned int samples) { - ALLEGRO_FILE *f; - ALLEGRO_AUDIO_STREAM *stream; + A5O_FILE *f; + A5O_AUDIO_STREAM *stream; ASSERT(filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } stream = _al_load_wav_audio_stream_f(f, buffer_count, samples); if (!stream) { - ALLEGRO_ERROR("Failed to load wav stream.\n"); + A5O_ERROR("Failed to load wav stream.\n"); al_fclose(f); } @@ -373,16 +373,16 @@ ALLEGRO_AUDIO_STREAM *_al_load_wav_audio_stream(const char *filename, /* _al_load_wav_audio_stream_f: */ -ALLEGRO_AUDIO_STREAM *_al_load_wav_audio_stream_f(ALLEGRO_FILE* f, +A5O_AUDIO_STREAM *_al_load_wav_audio_stream_f(A5O_FILE* f, size_t buffer_count, unsigned int samples) { WAVFILE* wavfile; - ALLEGRO_AUDIO_STREAM* stream; + A5O_AUDIO_STREAM* stream; wavfile = wav_open(f); if (wavfile == NULL) { - ALLEGRO_ERROR("Failed to load wav file.\n"); + A5O_ERROR("Failed to load wav file.\n"); return NULL; } @@ -404,7 +404,7 @@ ALLEGRO_AUDIO_STREAM *_al_load_wav_audio_stream_f(ALLEGRO_FILE* f, _al_acodec_start_feed_thread(stream); } else { - ALLEGRO_ERROR("Failed to load wav stream.\n"); + A5O_ERROR("Failed to load wav stream.\n"); wav_close(wavfile); } @@ -413,12 +413,12 @@ ALLEGRO_AUDIO_STREAM *_al_load_wav_audio_stream_f(ALLEGRO_FILE* f, /* _al_save_wav: - * Writes a sample into a wav ALLEGRO_FILE. + * Writes a sample into a wav A5O_FILE. * Returns true on success, false on error. */ -bool _al_save_wav(const char *filename, ALLEGRO_SAMPLE *spl) +bool _al_save_wav(const char *filename, A5O_SAMPLE *spl) { - ALLEGRO_FILE *pf = al_fopen(filename, "wb"); + A5O_FILE *pf = al_fopen(filename, "wb"); if (pf) { bool rvsave = _al_save_wav_f(pf, spl); @@ -426,7 +426,7 @@ bool _al_save_wav(const char *filename, ALLEGRO_SAMPLE *spl) return rvsave && rvclose; } else { - ALLEGRO_ERROR("Unable to open %s for writing.\n", filename); + A5O_ERROR("Unable to open %s for writing.\n", filename); } return false; @@ -437,7 +437,7 @@ bool _al_save_wav(const char *filename, ALLEGRO_SAMPLE *spl) * Writes a sample into a wav packfile. * Returns true on success, false on error. */ -bool _al_save_wav_f(ALLEGRO_FILE *pf, ALLEGRO_SAMPLE *spl) +bool _al_save_wav_f(A5O_FILE *pf, A5O_SAMPLE *spl) { size_t channels, bits; size_t data_size; @@ -447,14 +447,14 @@ bool _al_save_wav_f(ALLEGRO_FILE *pf, ALLEGRO_SAMPLE *spl) ASSERT(spl); ASSERT(pf); - /* XXX: makes use of ALLEGRO_SAMPLE internals */ + /* XXX: makes use of A5O_SAMPLE internals */ channels = (spl->chan_conf >> 4) + (spl->chan_conf & 0xF); - bits = (spl->depth == ALLEGRO_AUDIO_DEPTH_INT8 || - spl->depth == ALLEGRO_AUDIO_DEPTH_UINT8) ? 8 : 16; + bits = (spl->depth == A5O_AUDIO_DEPTH_INT8 || + spl->depth == A5O_AUDIO_DEPTH_UINT8) ? 8 : 16; if (channels < 1 || channels > 2) { - ALLEGRO_ERROR("Can only save samples with 1 or 2 channels as WAV.\n"); + A5O_ERROR("Can only save samples with 1 or 2 channels as WAV.\n"); return false; } @@ -479,39 +479,39 @@ bool _al_save_wav_f(ALLEGRO_FILE *pf, ALLEGRO_SAMPLE *spl) al_fwrite32le(pf, data_size); - if (spl->depth == ALLEGRO_AUDIO_DEPTH_UINT8) { + if (spl->depth == A5O_AUDIO_DEPTH_UINT8) { al_fwrite(pf, spl->buffer.u8, samples * channels); } - else if (spl->depth == ALLEGRO_AUDIO_DEPTH_INT16) { + else if (spl->depth == A5O_AUDIO_DEPTH_INT16) { al_fwrite(pf, spl->buffer.s16, samples * channels * 2); } - else if (spl->depth == ALLEGRO_AUDIO_DEPTH_INT8) { + else if (spl->depth == A5O_AUDIO_DEPTH_INT8) { int8_t *data = spl->buffer.s8; for (i = 0; i < samples; ++i) { al_fputc(pf, *data++ + 0x80); } } - else if (spl->depth == ALLEGRO_AUDIO_DEPTH_UINT16) { + else if (spl->depth == A5O_AUDIO_DEPTH_UINT16) { uint16_t *data = spl->buffer.u16; for (i = 0; i < n; ++i) { al_fwrite16le(pf, *data++ - 0x8000); } } - else if (spl->depth == ALLEGRO_AUDIO_DEPTH_INT24) { + else if (spl->depth == A5O_AUDIO_DEPTH_INT24) { int32_t *data = spl->buffer.s24; for (i = 0; i < n; ++i) { const int v = ((float)(*data++ + 0x800000) / 0x7FFFFF) * 0x7FFF - 0x8000; al_fwrite16le(pf, v); } } - else if (spl->depth == ALLEGRO_AUDIO_DEPTH_UINT24) { + else if (spl->depth == A5O_AUDIO_DEPTH_UINT24) { uint32_t *data = spl->buffer.u24; for (i = 0; i < n; ++i) { const int v = ((float)(*data++) / 0x7FFFFF) * 0x7FFF - 0x8000; al_fwrite16le(pf, v); } } - else if (spl->depth == ALLEGRO_AUDIO_DEPTH_FLOAT32) { + else if (spl->depth == A5O_AUDIO_DEPTH_FLOAT32) { float *data = spl->buffer.f32; for (i = 0; i < n; ++i) { al_fwrite16le(pf, *data * 0x7FFF); @@ -519,7 +519,7 @@ bool _al_save_wav_f(ALLEGRO_FILE *pf, ALLEGRO_SAMPLE *spl) } } else { - ALLEGRO_ERROR("Unknown audio depth (%d) when saving wav ALLEGRO_FILE.\n", + A5O_ERROR("Unknown audio depth (%d) when saving wav A5O_FILE.\n", spl->depth); return false; } @@ -528,14 +528,14 @@ bool _al_save_wav_f(ALLEGRO_FILE *pf, ALLEGRO_SAMPLE *spl) } -bool _al_identify_wav(ALLEGRO_FILE *f) +bool _al_identify_wav(A5O_FILE *f) { uint8_t x[4]; if (al_fread(f, x, 4) < 4) return false; if (memcmp(x, "RIFF", 4) != 0) return false; - if (!al_fseek(f, 4, ALLEGRO_SEEK_CUR)) + if (!al_fseek(f, 4, A5O_SEEK_CUR)) return false; if (al_fread(f, x, 4) < 4) return false; diff --git a/addons/audio/CMakeLists.txt b/addons/audio/CMakeLists.txt index 89e8a9f610..8651abb9b9 100644 --- a/addons/audio/CMakeLists.txt +++ b/addons/audio/CMakeLists.txt @@ -37,24 +37,24 @@ endfunction() # The platform conditions are not really necessary but prevent confusing the # user, e.g. it's pretty weird to get a warning about missing DSound on Unix. -if(WANT_OSS AND ALLEGRO_UNIX) +if(WANT_OSS AND A5O_UNIX) include(AllegroFindOSS) if(OSS_FOUND) set(SUPPORT_OSS 1) endif(OSS_FOUND) -endif(WANT_OSS AND ALLEGRO_UNIX) +endif(WANT_OSS AND A5O_UNIX) if(SUPPORT_OSS) - set(ALLEGRO_CFG_KCM_OSS 1) + set(A5O_CFG_KCM_OSS 1) list(APPEND AUDIO_SOURCES oss.c) set(SUPPORT_AUDIO 1) endif(SUPPORT_OSS) -if(ALLEGRO_UNIX) +if(A5O_UNIX) audio_summary(" - OSS" SUPPORT_OSS) endif() -if(WANT_PULSEAUDIO AND ALLEGRO_UNIX) +if(WANT_PULSEAUDIO AND A5O_UNIX) pkg_check_modules(PULSEAUDIO libpulse-simple) if(PULSEAUDIO_FOUND) set(CMAKE_REQUIRED_INCLUDES ${PULSEAUDIO_INCLUDE_DIRS}) @@ -78,10 +78,10 @@ if(WANT_PULSEAUDIO AND ALLEGRO_UNIX) message("WARNING: PulseAudio compile test failed, disabling support") endif() endif(PULSEAUDIO_FOUND) -endif(WANT_PULSEAUDIO AND ALLEGRO_UNIX) +endif(WANT_PULSEAUDIO AND A5O_UNIX) if(SUPPORT_PULSEAUDIO) - set(ALLEGRO_CFG_KCM_PULSEAUDIO 1) + set(A5O_CFG_KCM_PULSEAUDIO 1) list(APPEND AUDIO_SOURCES pulseaudio.c) list(APPEND AUDIO_LIBRARIES ${PULSEAUDIO_LIBRARIES}) list(APPEND AUDIO_INCLUDE_DIRECTORIES ${PULSEAUDIO_INCLUDE_DIRS}) @@ -89,26 +89,26 @@ if(SUPPORT_PULSEAUDIO) set(SUPPORT_AUDIO 1) endif(SUPPORT_PULSEAUDIO) -if(ALLEGRO_UNIX) +if(A5O_UNIX) audio_summary(" - PulseAudio" SUPPORT_PULSEAUDIO) endif() -if(WANT_ALSA AND ALLEGRO_UNIX) +if(WANT_ALSA AND A5O_UNIX) pkg_check_modules(ALSA alsa) if(ALSA_FOUND) set(SUPPORT_ALSA 1) endif(ALSA_FOUND) -endif(WANT_ALSA AND ALLEGRO_UNIX) +endif(WANT_ALSA AND A5O_UNIX) if(SUPPORT_ALSA) - set(ALLEGRO_CFG_KCM_ALSA 1) + set(A5O_CFG_KCM_ALSA 1) list(APPEND AUDIO_SOURCES alsa.c) list(APPEND AUDIO_LIBRARIES ${ALSA_LIBRARIES}) list(APPEND AUDIO_INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIRS}) set(SUPPORT_AUDIO 1) endif(SUPPORT_ALSA) -if(ALLEGRO_UNIX) +if(A5O_UNIX) audio_summary(" - ALSA" SUPPORT_ALSA) endif() @@ -120,7 +120,7 @@ if(WANT_DSOUND AND WIN32) endif(WANT_DSOUND AND WIN32) if(SUPPORT_DSOUND) - set(ALLEGRO_CFG_KCM_DSOUND 1) + set(A5O_CFG_KCM_DSOUND 1) list(APPEND AUDIO_SOURCES dsound.cpp) list(APPEND AUDIO_LIBRARIES ${DSOUND_LIBRARIES}) list(APPEND AUDIO_INCLUDE_DIRECTORIES ${DSOUND_INCLUDE_DIR}) @@ -147,7 +147,7 @@ if(WANT_AQUEUE AND MACOSX) endif(WANT_AQUEUE AND MACOSX) if(SUPPORT_AQUEUE) - set(ALLEGRO_CFG_KCM_AQUEUE 1) + set(A5O_CFG_KCM_AQUEUE 1) list(APPEND AUDIO_SOURCES aqueue.m) list(APPEND AUDIO_LIBRARIES ${AUDIO_TOOLBOX_LIB}) set(SUPPORT_AUDIO 1) @@ -166,7 +166,7 @@ if(WANT_OPENAL) endif(WANT_OPENAL) if(SUPPORT_OPENAL) - set(ALLEGRO_CFG_KCM_OPENAL 1) + set(A5O_CFG_KCM_OPENAL 1) list(APPEND AUDIO_SOURCES openal.c) list(APPEND AUDIO_LIBRARIES ${OPENAL_LIBRARY}) list(APPEND AUDIO_INCLUDE_DIRECTORIES ${OPENAL_INCLUDE_DIR}) @@ -183,7 +183,7 @@ if(WANT_OPENSL) endif(WANT_OPENSL) if(SUPPORT_OPENSL) - set(ALLEGRO_CFG_KCM_OPENSL 1) + set(A5O_CFG_KCM_OPENSL 1) list(APPEND AUDIO_SOURCES opensl.c) list(APPEND AUDIO_LIBRARIES ${OPENSL_LIBRARY}) list(APPEND AUDIO_INCLUDE_DIRECTORIES ${OPENSL_INCLUDE_DIR}) @@ -192,13 +192,13 @@ endif(SUPPORT_OPENSL) audio_summary(" - OpenSL" SUPPORT_OPENSL) -if(ALLEGRO_SDL) - set(ALLEGRO_CFG_KCM_SDL 1) +if(A5O_SDL) + set(A5O_CFG_KCM_SDL 1) list(APPEND AUDIO_SOURCES sdl_audio.c) list(APPEND AUDIO_LIBRARIES ${SDL2_LIBRARIES} ) list(APPEND AUDIO_INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}) set(SUPPORT_AUDIO 1) -endif(ALLEGRO_SDL) +endif(A5O_SDL) configure_file( allegro5/internal/aintern_audio_cfg.h.cmake @@ -213,10 +213,10 @@ endif(NOT SUPPORT_AUDIO) include_directories(SYSTEM ${AUDIO_INCLUDE_DIRECTORIES}) link_directories(${AUDIO_LINK_DIRECTORIES}) add_our_addon_library(allegro_audio - AllegroAudio-${ALLEGRO_SOVERSION} + AllegroAudio-${A5O_SOVERSION} "${AUDIO_SOURCES};${AUDIO_INCLUDE_FILES}" - "-DALLEGRO_KCM_AUDIO_SRC" - "${ALLEGRO_LINK_WITH};${AUDIO_LIBRARIES}" + "-DA5O_KCM_AUDIO_SRC" + "${A5O_LINK_WITH};${AUDIO_LIBRARIES}" ) install_our_headers(${AUDIO_INCLUDE_FILES}) diff --git a/addons/audio/allegro5/allegro_audio.h b/addons/audio/allegro5/allegro_audio.h index 505b6f8a38..e3678c22f2 100644 --- a/addons/audio/allegro5/allegro_audio.h +++ b/addons/audio/allegro5/allegro_audio.h @@ -16,84 +16,84 @@ extern "C" { #include "allegro5/allegro.h" -#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32) - #ifndef ALLEGRO_STATICLINK - #ifdef ALLEGRO_KCM_AUDIO_SRC - #define _ALLEGRO_KCM_AUDIO_DLL __declspec(dllexport) +#if (defined A5O_MINGW32) || (defined A5O_MSVC) || (defined A5O_BCC32) + #ifndef A5O_STATICLINK + #ifdef A5O_KCM_AUDIO_SRC + #define _A5O_KCM_AUDIO_DLL __declspec(dllexport) #else - #define _ALLEGRO_KCM_AUDIO_DLL __declspec(dllimport) + #define _A5O_KCM_AUDIO_DLL __declspec(dllimport) #endif #else - #define _ALLEGRO_KCM_AUDIO_DLL + #define _A5O_KCM_AUDIO_DLL #endif #endif -#if defined ALLEGRO_MSVC - #define ALLEGRO_KCM_AUDIO_FUNC(type, name, args) _ALLEGRO_KCM_AUDIO_DLL type __cdecl name args -#elif defined ALLEGRO_MINGW32 - #define ALLEGRO_KCM_AUDIO_FUNC(type, name, args) extern type name args -#elif defined ALLEGRO_BCC32 - #define ALLEGRO_KCM_AUDIO_FUNC(type, name, args) extern _ALLEGRO_KCM_AUDIO_DLL type name args +#if defined A5O_MSVC + #define A5O_KCM_AUDIO_FUNC(type, name, args) _A5O_KCM_AUDIO_DLL type __cdecl name args +#elif defined A5O_MINGW32 + #define A5O_KCM_AUDIO_FUNC(type, name, args) extern type name args +#elif defined A5O_BCC32 + #define A5O_KCM_AUDIO_FUNC(type, name, args) extern _A5O_KCM_AUDIO_DLL type name args #else - #define ALLEGRO_KCM_AUDIO_FUNC AL_FUNC + #define A5O_KCM_AUDIO_FUNC AL_FUNC #endif -/* Enum: ALLEGRO_AUDIO_EVENT_TYPE +/* Enum: A5O_AUDIO_EVENT_TYPE */ -enum ALLEGRO_AUDIO_EVENT_TYPE +enum A5O_AUDIO_EVENT_TYPE { /* Internal, used to communicate with acodec. */ /* Must be in 512 <= n < 1024 */ _KCM_STREAM_FEEDER_QUIT_EVENT_TYPE = 512, - ALLEGRO_EVENT_AUDIO_STREAM_FRAGMENT = 513, - ALLEGRO_EVENT_AUDIO_STREAM_FINISHED = 514, -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_KCM_AUDIO_SRC) - ALLEGRO_EVENT_AUDIO_RECORDER_FRAGMENT = 515, + A5O_EVENT_AUDIO_STREAM_FRAGMENT = 513, + A5O_EVENT_AUDIO_STREAM_FINISHED = 514, +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_KCM_AUDIO_SRC) + A5O_EVENT_AUDIO_RECORDER_FRAGMENT = 515, #endif }; -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_KCM_AUDIO_SRC) -/* Type: ALLEGRO_AUDIO_RECORDER_EVENT +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_KCM_AUDIO_SRC) +/* Type: A5O_AUDIO_RECORDER_EVENT */ -typedef struct ALLEGRO_AUDIO_RECORDER_EVENT ALLEGRO_AUDIO_RECORDER_EVENT; -struct ALLEGRO_AUDIO_RECORDER_EVENT +typedef struct A5O_AUDIO_RECORDER_EVENT A5O_AUDIO_RECORDER_EVENT; +struct A5O_AUDIO_RECORDER_EVENT { - _AL_EVENT_HEADER(struct ALLEGRO_AUDIO_RECORDER) - struct ALLEGRO_USER_EVENT_DESCRIPTOR *__internal__descr; + _AL_EVENT_HEADER(struct A5O_AUDIO_RECORDER) + struct A5O_USER_EVENT_DESCRIPTOR *__internal__descr; void *buffer; unsigned int samples; }; #endif -/* Enum: ALLEGRO_AUDIO_DEPTH +/* Enum: A5O_AUDIO_DEPTH */ -enum ALLEGRO_AUDIO_DEPTH +enum A5O_AUDIO_DEPTH { /* Sample depth and type, and signedness. Mixers only use 32-bit signed * float (-1..+1). The unsigned value is a bit-flag applied to the depth * value. */ - ALLEGRO_AUDIO_DEPTH_INT8 = 0x00, - ALLEGRO_AUDIO_DEPTH_INT16 = 0x01, - ALLEGRO_AUDIO_DEPTH_INT24 = 0x02, - ALLEGRO_AUDIO_DEPTH_FLOAT32 = 0x03, + A5O_AUDIO_DEPTH_INT8 = 0x00, + A5O_AUDIO_DEPTH_INT16 = 0x01, + A5O_AUDIO_DEPTH_INT24 = 0x02, + A5O_AUDIO_DEPTH_FLOAT32 = 0x03, - ALLEGRO_AUDIO_DEPTH_UNSIGNED = 0x08, + A5O_AUDIO_DEPTH_UNSIGNED = 0x08, /* For convenience */ - ALLEGRO_AUDIO_DEPTH_UINT8 = ALLEGRO_AUDIO_DEPTH_INT8 | - ALLEGRO_AUDIO_DEPTH_UNSIGNED, - ALLEGRO_AUDIO_DEPTH_UINT16 = ALLEGRO_AUDIO_DEPTH_INT16 | - ALLEGRO_AUDIO_DEPTH_UNSIGNED, - ALLEGRO_AUDIO_DEPTH_UINT24 = ALLEGRO_AUDIO_DEPTH_INT24 | - ALLEGRO_AUDIO_DEPTH_UNSIGNED + A5O_AUDIO_DEPTH_UINT8 = A5O_AUDIO_DEPTH_INT8 | + A5O_AUDIO_DEPTH_UNSIGNED, + A5O_AUDIO_DEPTH_UINT16 = A5O_AUDIO_DEPTH_INT16 | + A5O_AUDIO_DEPTH_UNSIGNED, + A5O_AUDIO_DEPTH_UINT24 = A5O_AUDIO_DEPTH_INT24 | + A5O_AUDIO_DEPTH_UNSIGNED }; -/* Enum: ALLEGRO_CHANNEL_CONF +/* Enum: A5O_CHANNEL_CONF */ -enum ALLEGRO_CHANNEL_CONF +enum A5O_CHANNEL_CONF { /* Speaker configuration (mono, stereo, 2.1, 3, etc). With regards to * behavior, most of this code makes no distinction between, say, 4.1 and @@ -102,337 +102,337 @@ enum ALLEGRO_CHANNEL_CONF * the differences will become more important. (v>>4)+(v&0xF) should yield * the total channel count. */ - ALLEGRO_CHANNEL_CONF_1 = 0x10, - ALLEGRO_CHANNEL_CONF_2 = 0x20, - ALLEGRO_CHANNEL_CONF_3 = 0x30, - ALLEGRO_CHANNEL_CONF_4 = 0x40, - ALLEGRO_CHANNEL_CONF_5_1 = 0x51, - ALLEGRO_CHANNEL_CONF_6_1 = 0x61, - ALLEGRO_CHANNEL_CONF_7_1 = 0x71 -#define ALLEGRO_MAX_CHANNELS 8 + A5O_CHANNEL_CONF_1 = 0x10, + A5O_CHANNEL_CONF_2 = 0x20, + A5O_CHANNEL_CONF_3 = 0x30, + A5O_CHANNEL_CONF_4 = 0x40, + A5O_CHANNEL_CONF_5_1 = 0x51, + A5O_CHANNEL_CONF_6_1 = 0x61, + A5O_CHANNEL_CONF_7_1 = 0x71 +#define A5O_MAX_CHANNELS 8 }; -/* Enum: ALLEGRO_PLAYMODE +/* Enum: A5O_PLAYMODE */ -enum ALLEGRO_PLAYMODE +enum A5O_PLAYMODE { - ALLEGRO_PLAYMODE_ONCE = 0x100, - ALLEGRO_PLAYMODE_LOOP = 0x101, - ALLEGRO_PLAYMODE_BIDIR = 0x102, - _ALLEGRO_PLAYMODE_STREAM_ONCE = 0x103, /* internal */ - _ALLEGRO_PLAYMODE_STREAM_ONEDIR = 0x104, /* internal */ - ALLEGRO_PLAYMODE_LOOP_ONCE = 0x105, - _ALLEGRO_PLAYMODE_STREAM_LOOP_ONCE = 0x106, /* internal */ + A5O_PLAYMODE_ONCE = 0x100, + A5O_PLAYMODE_LOOP = 0x101, + A5O_PLAYMODE_BIDIR = 0x102, + _A5O_PLAYMODE_STREAM_ONCE = 0x103, /* internal */ + _A5O_PLAYMODE_STREAM_ONEDIR = 0x104, /* internal */ + A5O_PLAYMODE_LOOP_ONCE = 0x105, + _A5O_PLAYMODE_STREAM_LOOP_ONCE = 0x106, /* internal */ }; -/* Enum: ALLEGRO_MIXER_QUALITY +/* Enum: A5O_MIXER_QUALITY */ -enum ALLEGRO_MIXER_QUALITY +enum A5O_MIXER_QUALITY { - ALLEGRO_MIXER_QUALITY_POINT = 0x110, - ALLEGRO_MIXER_QUALITY_LINEAR = 0x111, - ALLEGRO_MIXER_QUALITY_CUBIC = 0x112 + A5O_MIXER_QUALITY_POINT = 0x110, + A5O_MIXER_QUALITY_LINEAR = 0x111, + A5O_MIXER_QUALITY_CUBIC = 0x112 }; -/* Enum: ALLEGRO_AUDIO_PAN_NONE +/* Enum: A5O_AUDIO_PAN_NONE */ -#define ALLEGRO_AUDIO_PAN_NONE (-1000.0f) +#define A5O_AUDIO_PAN_NONE (-1000.0f) -/* Type: ALLEGRO_SAMPLE +/* Type: A5O_SAMPLE */ -typedef struct ALLEGRO_SAMPLE ALLEGRO_SAMPLE; +typedef struct A5O_SAMPLE A5O_SAMPLE; -/* Type: ALLEGRO_SAMPLE_ID +/* Type: A5O_SAMPLE_ID */ -typedef struct ALLEGRO_SAMPLE_ID ALLEGRO_SAMPLE_ID; +typedef struct A5O_SAMPLE_ID A5O_SAMPLE_ID; -struct ALLEGRO_SAMPLE_ID { +struct A5O_SAMPLE_ID { int _index; int _id; }; -/* Type: ALLEGRO_SAMPLE_INSTANCE +/* Type: A5O_SAMPLE_INSTANCE */ -typedef struct ALLEGRO_SAMPLE_INSTANCE ALLEGRO_SAMPLE_INSTANCE; +typedef struct A5O_SAMPLE_INSTANCE A5O_SAMPLE_INSTANCE; -/* Type: ALLEGRO_AUDIO_STREAM +/* Type: A5O_AUDIO_STREAM */ -typedef struct ALLEGRO_AUDIO_STREAM ALLEGRO_AUDIO_STREAM; +typedef struct A5O_AUDIO_STREAM A5O_AUDIO_STREAM; -/* Type: ALLEGRO_MIXER +/* Type: A5O_MIXER */ -typedef struct ALLEGRO_MIXER ALLEGRO_MIXER; +typedef struct A5O_MIXER A5O_MIXER; -/* Type: ALLEGRO_VOICE +/* Type: A5O_VOICE */ -typedef struct ALLEGRO_VOICE ALLEGRO_VOICE; +typedef struct A5O_VOICE A5O_VOICE; -/* Type: ALLEGRO_AUDIO_DEVICE +/* Type: A5O_AUDIO_DEVICE */ -typedef struct ALLEGRO_AUDIO_DEVICE ALLEGRO_AUDIO_DEVICE; +typedef struct A5O_AUDIO_DEVICE A5O_AUDIO_DEVICE; -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_KCM_AUDIO_SRC) -/* Type: ALLEGRO_AUDIO_RECORDER +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_KCM_AUDIO_SRC) +/* Type: A5O_AUDIO_RECORDER */ -typedef struct ALLEGRO_AUDIO_RECORDER ALLEGRO_AUDIO_RECORDER; +typedef struct A5O_AUDIO_RECORDER A5O_AUDIO_RECORDER; #endif #ifndef __cplusplus -typedef enum ALLEGRO_AUDIO_DEPTH ALLEGRO_AUDIO_DEPTH; -typedef enum ALLEGRO_CHANNEL_CONF ALLEGRO_CHANNEL_CONF; -typedef enum ALLEGRO_PLAYMODE ALLEGRO_PLAYMODE; -typedef enum ALLEGRO_MIXER_QUALITY ALLEGRO_MIXER_QUALITY; +typedef enum A5O_AUDIO_DEPTH A5O_AUDIO_DEPTH; +typedef enum A5O_CHANNEL_CONF A5O_CHANNEL_CONF; +typedef enum A5O_PLAYMODE A5O_PLAYMODE; +typedef enum A5O_MIXER_QUALITY A5O_MIXER_QUALITY; #endif /* Sample functions */ -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_SAMPLE *, al_create_sample, (void *buf, - unsigned int samples, unsigned int freq, ALLEGRO_AUDIO_DEPTH depth, - ALLEGRO_CHANNEL_CONF chan_conf, bool free_buf)); -ALLEGRO_KCM_AUDIO_FUNC(void, al_destroy_sample, (ALLEGRO_SAMPLE *spl)); +A5O_KCM_AUDIO_FUNC(A5O_SAMPLE *, al_create_sample, (void *buf, + unsigned int samples, unsigned int freq, A5O_AUDIO_DEPTH depth, + A5O_CHANNEL_CONF chan_conf, bool free_buf)); +A5O_KCM_AUDIO_FUNC(void, al_destroy_sample, (A5O_SAMPLE *spl)); /* Sample instance functions */ -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_SAMPLE_INSTANCE*, al_create_sample_instance, ( - ALLEGRO_SAMPLE *data)); -ALLEGRO_KCM_AUDIO_FUNC(void, al_destroy_sample_instance, ( - ALLEGRO_SAMPLE_INSTANCE *spl)); - -ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_sample_frequency, (const ALLEGRO_SAMPLE *spl)); -ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_sample_length, (const ALLEGRO_SAMPLE *spl)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_DEPTH, al_get_sample_depth, (const ALLEGRO_SAMPLE *spl)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_CHANNEL_CONF, al_get_sample_channels, (const ALLEGRO_SAMPLE *spl)); -ALLEGRO_KCM_AUDIO_FUNC(void *, al_get_sample_data, (const ALLEGRO_SAMPLE *spl)); - -ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_sample_instance_frequency, (const ALLEGRO_SAMPLE_INSTANCE *spl)); -ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_sample_instance_length, (const ALLEGRO_SAMPLE_INSTANCE *spl)); -ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_sample_instance_position, (const ALLEGRO_SAMPLE_INSTANCE *spl)); - -ALLEGRO_KCM_AUDIO_FUNC(float, al_get_sample_instance_speed, (const ALLEGRO_SAMPLE_INSTANCE *spl)); -ALLEGRO_KCM_AUDIO_FUNC(float, al_get_sample_instance_gain, (const ALLEGRO_SAMPLE_INSTANCE *spl)); -ALLEGRO_KCM_AUDIO_FUNC(float, al_get_sample_instance_pan, (const ALLEGRO_SAMPLE_INSTANCE *spl)); -ALLEGRO_KCM_AUDIO_FUNC(float, al_get_sample_instance_time, (const ALLEGRO_SAMPLE_INSTANCE *spl)); - -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_DEPTH, al_get_sample_instance_depth, (const ALLEGRO_SAMPLE_INSTANCE *spl)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_CHANNEL_CONF, al_get_sample_instance_channels, (const ALLEGRO_SAMPLE_INSTANCE *spl)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_PLAYMODE, al_get_sample_instance_playmode, (const ALLEGRO_SAMPLE_INSTANCE *spl)); - -ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_sample_instance_playing, (const ALLEGRO_SAMPLE_INSTANCE *spl)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_sample_instance_attached, (const ALLEGRO_SAMPLE_INSTANCE *spl)); - -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_position, (ALLEGRO_SAMPLE_INSTANCE *spl, unsigned int val)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_length, (ALLEGRO_SAMPLE_INSTANCE *spl, unsigned int val)); - -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_speed, (ALLEGRO_SAMPLE_INSTANCE *spl, float val)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_gain, (ALLEGRO_SAMPLE_INSTANCE *spl, float val)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_pan, (ALLEGRO_SAMPLE_INSTANCE *spl, float val)); - -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_playmode, (ALLEGRO_SAMPLE_INSTANCE *spl, ALLEGRO_PLAYMODE val)); - -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_playing, (ALLEGRO_SAMPLE_INSTANCE *spl, bool val)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_detach_sample_instance, (ALLEGRO_SAMPLE_INSTANCE *spl)); - -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample, (ALLEGRO_SAMPLE_INSTANCE *spl, ALLEGRO_SAMPLE *data)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_SAMPLE *, al_get_sample, (ALLEGRO_SAMPLE_INSTANCE *spl)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_play_sample_instance, (ALLEGRO_SAMPLE_INSTANCE *spl)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_stop_sample_instance, (ALLEGRO_SAMPLE_INSTANCE *spl)); -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_KCM_AUDIO_SRC) -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_channel_matrix, (ALLEGRO_SAMPLE_INSTANCE *spl, const float *matrix)); +A5O_KCM_AUDIO_FUNC(A5O_SAMPLE_INSTANCE*, al_create_sample_instance, ( + A5O_SAMPLE *data)); +A5O_KCM_AUDIO_FUNC(void, al_destroy_sample_instance, ( + A5O_SAMPLE_INSTANCE *spl)); + +A5O_KCM_AUDIO_FUNC(unsigned int, al_get_sample_frequency, (const A5O_SAMPLE *spl)); +A5O_KCM_AUDIO_FUNC(unsigned int, al_get_sample_length, (const A5O_SAMPLE *spl)); +A5O_KCM_AUDIO_FUNC(A5O_AUDIO_DEPTH, al_get_sample_depth, (const A5O_SAMPLE *spl)); +A5O_KCM_AUDIO_FUNC(A5O_CHANNEL_CONF, al_get_sample_channels, (const A5O_SAMPLE *spl)); +A5O_KCM_AUDIO_FUNC(void *, al_get_sample_data, (const A5O_SAMPLE *spl)); + +A5O_KCM_AUDIO_FUNC(unsigned int, al_get_sample_instance_frequency, (const A5O_SAMPLE_INSTANCE *spl)); +A5O_KCM_AUDIO_FUNC(unsigned int, al_get_sample_instance_length, (const A5O_SAMPLE_INSTANCE *spl)); +A5O_KCM_AUDIO_FUNC(unsigned int, al_get_sample_instance_position, (const A5O_SAMPLE_INSTANCE *spl)); + +A5O_KCM_AUDIO_FUNC(float, al_get_sample_instance_speed, (const A5O_SAMPLE_INSTANCE *spl)); +A5O_KCM_AUDIO_FUNC(float, al_get_sample_instance_gain, (const A5O_SAMPLE_INSTANCE *spl)); +A5O_KCM_AUDIO_FUNC(float, al_get_sample_instance_pan, (const A5O_SAMPLE_INSTANCE *spl)); +A5O_KCM_AUDIO_FUNC(float, al_get_sample_instance_time, (const A5O_SAMPLE_INSTANCE *spl)); + +A5O_KCM_AUDIO_FUNC(A5O_AUDIO_DEPTH, al_get_sample_instance_depth, (const A5O_SAMPLE_INSTANCE *spl)); +A5O_KCM_AUDIO_FUNC(A5O_CHANNEL_CONF, al_get_sample_instance_channels, (const A5O_SAMPLE_INSTANCE *spl)); +A5O_KCM_AUDIO_FUNC(A5O_PLAYMODE, al_get_sample_instance_playmode, (const A5O_SAMPLE_INSTANCE *spl)); + +A5O_KCM_AUDIO_FUNC(bool, al_get_sample_instance_playing, (const A5O_SAMPLE_INSTANCE *spl)); +A5O_KCM_AUDIO_FUNC(bool, al_get_sample_instance_attached, (const A5O_SAMPLE_INSTANCE *spl)); + +A5O_KCM_AUDIO_FUNC(bool, al_set_sample_instance_position, (A5O_SAMPLE_INSTANCE *spl, unsigned int val)); +A5O_KCM_AUDIO_FUNC(bool, al_set_sample_instance_length, (A5O_SAMPLE_INSTANCE *spl, unsigned int val)); + +A5O_KCM_AUDIO_FUNC(bool, al_set_sample_instance_speed, (A5O_SAMPLE_INSTANCE *spl, float val)); +A5O_KCM_AUDIO_FUNC(bool, al_set_sample_instance_gain, (A5O_SAMPLE_INSTANCE *spl, float val)); +A5O_KCM_AUDIO_FUNC(bool, al_set_sample_instance_pan, (A5O_SAMPLE_INSTANCE *spl, float val)); + +A5O_KCM_AUDIO_FUNC(bool, al_set_sample_instance_playmode, (A5O_SAMPLE_INSTANCE *spl, A5O_PLAYMODE val)); + +A5O_KCM_AUDIO_FUNC(bool, al_set_sample_instance_playing, (A5O_SAMPLE_INSTANCE *spl, bool val)); +A5O_KCM_AUDIO_FUNC(bool, al_detach_sample_instance, (A5O_SAMPLE_INSTANCE *spl)); + +A5O_KCM_AUDIO_FUNC(bool, al_set_sample, (A5O_SAMPLE_INSTANCE *spl, A5O_SAMPLE *data)); +A5O_KCM_AUDIO_FUNC(A5O_SAMPLE *, al_get_sample, (A5O_SAMPLE_INSTANCE *spl)); +A5O_KCM_AUDIO_FUNC(bool, al_play_sample_instance, (A5O_SAMPLE_INSTANCE *spl)); +A5O_KCM_AUDIO_FUNC(bool, al_stop_sample_instance, (A5O_SAMPLE_INSTANCE *spl)); +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_KCM_AUDIO_SRC) +A5O_KCM_AUDIO_FUNC(bool, al_set_sample_instance_channel_matrix, (A5O_SAMPLE_INSTANCE *spl, const float *matrix)); #endif /* Stream functions */ -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_STREAM*, al_create_audio_stream, (size_t buffer_count, +A5O_KCM_AUDIO_FUNC(A5O_AUDIO_STREAM*, al_create_audio_stream, (size_t buffer_count, unsigned int samples, unsigned int freq, - ALLEGRO_AUDIO_DEPTH depth, ALLEGRO_CHANNEL_CONF chan_conf)); -ALLEGRO_KCM_AUDIO_FUNC(void, al_destroy_audio_stream, (ALLEGRO_AUDIO_STREAM *stream)); -ALLEGRO_KCM_AUDIO_FUNC(void, al_drain_audio_stream, (ALLEGRO_AUDIO_STREAM *stream)); + A5O_AUDIO_DEPTH depth, A5O_CHANNEL_CONF chan_conf)); +A5O_KCM_AUDIO_FUNC(void, al_destroy_audio_stream, (A5O_AUDIO_STREAM *stream)); +A5O_KCM_AUDIO_FUNC(void, al_drain_audio_stream, (A5O_AUDIO_STREAM *stream)); -ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_audio_stream_frequency, (const ALLEGRO_AUDIO_STREAM *stream)); -ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_audio_stream_length, (const ALLEGRO_AUDIO_STREAM *stream)); -ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_audio_stream_fragments, (const ALLEGRO_AUDIO_STREAM *stream)); -ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_available_audio_stream_fragments, (const ALLEGRO_AUDIO_STREAM *stream)); +A5O_KCM_AUDIO_FUNC(unsigned int, al_get_audio_stream_frequency, (const A5O_AUDIO_STREAM *stream)); +A5O_KCM_AUDIO_FUNC(unsigned int, al_get_audio_stream_length, (const A5O_AUDIO_STREAM *stream)); +A5O_KCM_AUDIO_FUNC(unsigned int, al_get_audio_stream_fragments, (const A5O_AUDIO_STREAM *stream)); +A5O_KCM_AUDIO_FUNC(unsigned int, al_get_available_audio_stream_fragments, (const A5O_AUDIO_STREAM *stream)); -ALLEGRO_KCM_AUDIO_FUNC(float, al_get_audio_stream_speed, (const ALLEGRO_AUDIO_STREAM *stream)); -ALLEGRO_KCM_AUDIO_FUNC(float, al_get_audio_stream_gain, (const ALLEGRO_AUDIO_STREAM *stream)); -ALLEGRO_KCM_AUDIO_FUNC(float, al_get_audio_stream_pan, (const ALLEGRO_AUDIO_STREAM *stream)); +A5O_KCM_AUDIO_FUNC(float, al_get_audio_stream_speed, (const A5O_AUDIO_STREAM *stream)); +A5O_KCM_AUDIO_FUNC(float, al_get_audio_stream_gain, (const A5O_AUDIO_STREAM *stream)); +A5O_KCM_AUDIO_FUNC(float, al_get_audio_stream_pan, (const A5O_AUDIO_STREAM *stream)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_CHANNEL_CONF, al_get_audio_stream_channels, (const ALLEGRO_AUDIO_STREAM *stream)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_DEPTH, al_get_audio_stream_depth, (const ALLEGRO_AUDIO_STREAM *stream)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_PLAYMODE, al_get_audio_stream_playmode, (const ALLEGRO_AUDIO_STREAM *stream)); +A5O_KCM_AUDIO_FUNC(A5O_CHANNEL_CONF, al_get_audio_stream_channels, (const A5O_AUDIO_STREAM *stream)); +A5O_KCM_AUDIO_FUNC(A5O_AUDIO_DEPTH, al_get_audio_stream_depth, (const A5O_AUDIO_STREAM *stream)); +A5O_KCM_AUDIO_FUNC(A5O_PLAYMODE, al_get_audio_stream_playmode, (const A5O_AUDIO_STREAM *stream)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_audio_stream_playing, (const ALLEGRO_AUDIO_STREAM *spl)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_audio_stream_attached, (const ALLEGRO_AUDIO_STREAM *spl)); -ALLEGRO_KCM_AUDIO_FUNC(uint64_t, al_get_audio_stream_played_samples, (const ALLEGRO_AUDIO_STREAM *stream)); +A5O_KCM_AUDIO_FUNC(bool, al_get_audio_stream_playing, (const A5O_AUDIO_STREAM *spl)); +A5O_KCM_AUDIO_FUNC(bool, al_get_audio_stream_attached, (const A5O_AUDIO_STREAM *spl)); +A5O_KCM_AUDIO_FUNC(uint64_t, al_get_audio_stream_played_samples, (const A5O_AUDIO_STREAM *stream)); -ALLEGRO_KCM_AUDIO_FUNC(void *, al_get_audio_stream_fragment, (const ALLEGRO_AUDIO_STREAM *stream)); +A5O_KCM_AUDIO_FUNC(void *, al_get_audio_stream_fragment, (const A5O_AUDIO_STREAM *stream)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_speed, (ALLEGRO_AUDIO_STREAM *stream, float val)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_gain, (ALLEGRO_AUDIO_STREAM *stream, float val)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_pan, (ALLEGRO_AUDIO_STREAM *stream, float val)); +A5O_KCM_AUDIO_FUNC(bool, al_set_audio_stream_speed, (A5O_AUDIO_STREAM *stream, float val)); +A5O_KCM_AUDIO_FUNC(bool, al_set_audio_stream_gain, (A5O_AUDIO_STREAM *stream, float val)); +A5O_KCM_AUDIO_FUNC(bool, al_set_audio_stream_pan, (A5O_AUDIO_STREAM *stream, float val)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_playmode, (ALLEGRO_AUDIO_STREAM *stream, ALLEGRO_PLAYMODE val)); +A5O_KCM_AUDIO_FUNC(bool, al_set_audio_stream_playmode, (A5O_AUDIO_STREAM *stream, A5O_PLAYMODE val)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_playing, (ALLEGRO_AUDIO_STREAM *stream, bool val)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_detach_audio_stream, (ALLEGRO_AUDIO_STREAM *stream)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_fragment, (ALLEGRO_AUDIO_STREAM *stream, void *val)); +A5O_KCM_AUDIO_FUNC(bool, al_set_audio_stream_playing, (A5O_AUDIO_STREAM *stream, bool val)); +A5O_KCM_AUDIO_FUNC(bool, al_detach_audio_stream, (A5O_AUDIO_STREAM *stream)); +A5O_KCM_AUDIO_FUNC(bool, al_set_audio_stream_fragment, (A5O_AUDIO_STREAM *stream, void *val)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_rewind_audio_stream, (ALLEGRO_AUDIO_STREAM *stream)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_seek_audio_stream_secs, (ALLEGRO_AUDIO_STREAM *stream, double time)); -ALLEGRO_KCM_AUDIO_FUNC(double, al_get_audio_stream_position_secs, (ALLEGRO_AUDIO_STREAM *stream)); -ALLEGRO_KCM_AUDIO_FUNC(double, al_get_audio_stream_length_secs, (ALLEGRO_AUDIO_STREAM *stream)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_loop_secs, (ALLEGRO_AUDIO_STREAM *stream, double start, double end)); +A5O_KCM_AUDIO_FUNC(bool, al_rewind_audio_stream, (A5O_AUDIO_STREAM *stream)); +A5O_KCM_AUDIO_FUNC(bool, al_seek_audio_stream_secs, (A5O_AUDIO_STREAM *stream, double time)); +A5O_KCM_AUDIO_FUNC(double, al_get_audio_stream_position_secs, (A5O_AUDIO_STREAM *stream)); +A5O_KCM_AUDIO_FUNC(double, al_get_audio_stream_length_secs, (A5O_AUDIO_STREAM *stream)); +A5O_KCM_AUDIO_FUNC(bool, al_set_audio_stream_loop_secs, (A5O_AUDIO_STREAM *stream, double start, double end)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_audio_stream_event_source, (ALLEGRO_AUDIO_STREAM *stream)); +A5O_KCM_AUDIO_FUNC(A5O_EVENT_SOURCE *, al_get_audio_stream_event_source, (A5O_AUDIO_STREAM *stream)); -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_KCM_AUDIO_SRC) -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_channel_matrix, (ALLEGRO_AUDIO_STREAM *stream, const float *matrix)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_STREAM *, al_play_audio_stream, (const char *filename)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_STREAM *, al_play_audio_stream_f, (ALLEGRO_FILE *fp, const char *ident)); +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_KCM_AUDIO_SRC) +A5O_KCM_AUDIO_FUNC(bool, al_set_audio_stream_channel_matrix, (A5O_AUDIO_STREAM *stream, const float *matrix)); +A5O_KCM_AUDIO_FUNC(A5O_AUDIO_STREAM *, al_play_audio_stream, (const char *filename)); +A5O_KCM_AUDIO_FUNC(A5O_AUDIO_STREAM *, al_play_audio_stream_f, (A5O_FILE *fp, const char *ident)); #endif /* Mixer functions */ -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_MIXER*, al_create_mixer, (unsigned int freq, - ALLEGRO_AUDIO_DEPTH depth, ALLEGRO_CHANNEL_CONF chan_conf)); -ALLEGRO_KCM_AUDIO_FUNC(void, al_destroy_mixer, (ALLEGRO_MIXER *mixer)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_attach_sample_instance_to_mixer, ( - ALLEGRO_SAMPLE_INSTANCE *stream, ALLEGRO_MIXER *mixer)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_attach_audio_stream_to_mixer, (ALLEGRO_AUDIO_STREAM *stream, - ALLEGRO_MIXER *mixer)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_attach_mixer_to_mixer, (ALLEGRO_MIXER *stream, - ALLEGRO_MIXER *mixer)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_mixer_postprocess_callback, ( - ALLEGRO_MIXER *mixer, +A5O_KCM_AUDIO_FUNC(A5O_MIXER*, al_create_mixer, (unsigned int freq, + A5O_AUDIO_DEPTH depth, A5O_CHANNEL_CONF chan_conf)); +A5O_KCM_AUDIO_FUNC(void, al_destroy_mixer, (A5O_MIXER *mixer)); +A5O_KCM_AUDIO_FUNC(bool, al_attach_sample_instance_to_mixer, ( + A5O_SAMPLE_INSTANCE *stream, A5O_MIXER *mixer)); +A5O_KCM_AUDIO_FUNC(bool, al_attach_audio_stream_to_mixer, (A5O_AUDIO_STREAM *stream, + A5O_MIXER *mixer)); +A5O_KCM_AUDIO_FUNC(bool, al_attach_mixer_to_mixer, (A5O_MIXER *stream, + A5O_MIXER *mixer)); +A5O_KCM_AUDIO_FUNC(bool, al_set_mixer_postprocess_callback, ( + A5O_MIXER *mixer, void (*cb)(void *buf, unsigned int samples, void *data), void *data)); -ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_mixer_frequency, (const ALLEGRO_MIXER *mixer)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_CHANNEL_CONF, al_get_mixer_channels, (const ALLEGRO_MIXER *mixer)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_DEPTH, al_get_mixer_depth, (const ALLEGRO_MIXER *mixer)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_MIXER_QUALITY, al_get_mixer_quality, (const ALLEGRO_MIXER *mixer)); -ALLEGRO_KCM_AUDIO_FUNC(float, al_get_mixer_gain, (const ALLEGRO_MIXER *mixer)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_mixer_playing, (const ALLEGRO_MIXER *mixer)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_mixer_attached, (const ALLEGRO_MIXER *mixer)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_mixer_has_attachments, (const ALLEGRO_MIXER *mixer)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_mixer_frequency, (ALLEGRO_MIXER *mixer, unsigned int val)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_mixer_quality, (ALLEGRO_MIXER *mixer, ALLEGRO_MIXER_QUALITY val)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_mixer_gain, (ALLEGRO_MIXER *mixer, float gain)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_mixer_playing, (ALLEGRO_MIXER *mixer, bool val)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_detach_mixer, (ALLEGRO_MIXER *mixer)); +A5O_KCM_AUDIO_FUNC(unsigned int, al_get_mixer_frequency, (const A5O_MIXER *mixer)); +A5O_KCM_AUDIO_FUNC(A5O_CHANNEL_CONF, al_get_mixer_channels, (const A5O_MIXER *mixer)); +A5O_KCM_AUDIO_FUNC(A5O_AUDIO_DEPTH, al_get_mixer_depth, (const A5O_MIXER *mixer)); +A5O_KCM_AUDIO_FUNC(A5O_MIXER_QUALITY, al_get_mixer_quality, (const A5O_MIXER *mixer)); +A5O_KCM_AUDIO_FUNC(float, al_get_mixer_gain, (const A5O_MIXER *mixer)); +A5O_KCM_AUDIO_FUNC(bool, al_get_mixer_playing, (const A5O_MIXER *mixer)); +A5O_KCM_AUDIO_FUNC(bool, al_get_mixer_attached, (const A5O_MIXER *mixer)); +A5O_KCM_AUDIO_FUNC(bool, al_mixer_has_attachments, (const A5O_MIXER *mixer)); +A5O_KCM_AUDIO_FUNC(bool, al_set_mixer_frequency, (A5O_MIXER *mixer, unsigned int val)); +A5O_KCM_AUDIO_FUNC(bool, al_set_mixer_quality, (A5O_MIXER *mixer, A5O_MIXER_QUALITY val)); +A5O_KCM_AUDIO_FUNC(bool, al_set_mixer_gain, (A5O_MIXER *mixer, float gain)); +A5O_KCM_AUDIO_FUNC(bool, al_set_mixer_playing, (A5O_MIXER *mixer, bool val)); +A5O_KCM_AUDIO_FUNC(bool, al_detach_mixer, (A5O_MIXER *mixer)); /* Voice functions */ -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_VOICE*, al_create_voice, (unsigned int freq, - ALLEGRO_AUDIO_DEPTH depth, - ALLEGRO_CHANNEL_CONF chan_conf)); -ALLEGRO_KCM_AUDIO_FUNC(void, al_destroy_voice, (ALLEGRO_VOICE *voice)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_attach_sample_instance_to_voice, ( - ALLEGRO_SAMPLE_INSTANCE *stream, ALLEGRO_VOICE *voice)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_attach_audio_stream_to_voice, ( - ALLEGRO_AUDIO_STREAM *stream, ALLEGRO_VOICE *voice )); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_attach_mixer_to_voice, (ALLEGRO_MIXER *mixer, - ALLEGRO_VOICE *voice)); -ALLEGRO_KCM_AUDIO_FUNC(void, al_detach_voice, (ALLEGRO_VOICE *voice)); - -ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_voice_frequency, (const ALLEGRO_VOICE *voice)); -ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_voice_position, (const ALLEGRO_VOICE *voice)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_CHANNEL_CONF, al_get_voice_channels, (const ALLEGRO_VOICE *voice)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_DEPTH, al_get_voice_depth, (const ALLEGRO_VOICE *voice)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_voice_playing, (const ALLEGRO_VOICE *voice)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_voice_has_attachments, (const ALLEGRO_VOICE* voice)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_voice_position, (ALLEGRO_VOICE *voice, unsigned int val)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_voice_playing, (ALLEGRO_VOICE *voice, bool val)); +A5O_KCM_AUDIO_FUNC(A5O_VOICE*, al_create_voice, (unsigned int freq, + A5O_AUDIO_DEPTH depth, + A5O_CHANNEL_CONF chan_conf)); +A5O_KCM_AUDIO_FUNC(void, al_destroy_voice, (A5O_VOICE *voice)); +A5O_KCM_AUDIO_FUNC(bool, al_attach_sample_instance_to_voice, ( + A5O_SAMPLE_INSTANCE *stream, A5O_VOICE *voice)); +A5O_KCM_AUDIO_FUNC(bool, al_attach_audio_stream_to_voice, ( + A5O_AUDIO_STREAM *stream, A5O_VOICE *voice )); +A5O_KCM_AUDIO_FUNC(bool, al_attach_mixer_to_voice, (A5O_MIXER *mixer, + A5O_VOICE *voice)); +A5O_KCM_AUDIO_FUNC(void, al_detach_voice, (A5O_VOICE *voice)); + +A5O_KCM_AUDIO_FUNC(unsigned int, al_get_voice_frequency, (const A5O_VOICE *voice)); +A5O_KCM_AUDIO_FUNC(unsigned int, al_get_voice_position, (const A5O_VOICE *voice)); +A5O_KCM_AUDIO_FUNC(A5O_CHANNEL_CONF, al_get_voice_channels, (const A5O_VOICE *voice)); +A5O_KCM_AUDIO_FUNC(A5O_AUDIO_DEPTH, al_get_voice_depth, (const A5O_VOICE *voice)); +A5O_KCM_AUDIO_FUNC(bool, al_get_voice_playing, (const A5O_VOICE *voice)); +A5O_KCM_AUDIO_FUNC(bool, al_voice_has_attachments, (const A5O_VOICE* voice)); +A5O_KCM_AUDIO_FUNC(bool, al_set_voice_position, (A5O_VOICE *voice, unsigned int val)); +A5O_KCM_AUDIO_FUNC(bool, al_set_voice_playing, (A5O_VOICE *voice, bool val)); /* Misc. audio functions */ -ALLEGRO_KCM_AUDIO_FUNC(bool, al_install_audio, (void)); -ALLEGRO_KCM_AUDIO_FUNC(void, al_uninstall_audio, (void)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_is_audio_installed, (void)); -ALLEGRO_KCM_AUDIO_FUNC(uint32_t, al_get_allegro_audio_version, (void)); +A5O_KCM_AUDIO_FUNC(bool, al_install_audio, (void)); +A5O_KCM_AUDIO_FUNC(void, al_uninstall_audio, (void)); +A5O_KCM_AUDIO_FUNC(bool, al_is_audio_installed, (void)); +A5O_KCM_AUDIO_FUNC(uint32_t, al_get_allegro_audio_version, (void)); -ALLEGRO_KCM_AUDIO_FUNC(size_t, al_get_channel_count, (ALLEGRO_CHANNEL_CONF conf)); -ALLEGRO_KCM_AUDIO_FUNC(size_t, al_get_audio_depth_size, (ALLEGRO_AUDIO_DEPTH conf)); +A5O_KCM_AUDIO_FUNC(size_t, al_get_channel_count, (A5O_CHANNEL_CONF conf)); +A5O_KCM_AUDIO_FUNC(size_t, al_get_audio_depth_size, (A5O_AUDIO_DEPTH conf)); -ALLEGRO_KCM_AUDIO_FUNC(void, al_fill_silence, (void *buf, unsigned int samples, - ALLEGRO_AUDIO_DEPTH depth, ALLEGRO_CHANNEL_CONF chan_conf)); +A5O_KCM_AUDIO_FUNC(void, al_fill_silence, (void *buf, unsigned int samples, + A5O_AUDIO_DEPTH depth, A5O_CHANNEL_CONF chan_conf)); -ALLEGRO_KCM_AUDIO_FUNC(int, al_get_num_audio_output_devices, (void)); -ALLEGRO_KCM_AUDIO_FUNC(const ALLEGRO_AUDIO_DEVICE *, al_get_audio_output_device, (int index)); -ALLEGRO_KCM_AUDIO_FUNC(const char *, al_get_audio_device_name, (const ALLEGRO_AUDIO_DEVICE * device)); +A5O_KCM_AUDIO_FUNC(int, al_get_num_audio_output_devices, (void)); +A5O_KCM_AUDIO_FUNC(const A5O_AUDIO_DEVICE *, al_get_audio_output_device, (int index)); +A5O_KCM_AUDIO_FUNC(const char *, al_get_audio_device_name, (const A5O_AUDIO_DEVICE * device)); /* Simple audio layer */ -ALLEGRO_KCM_AUDIO_FUNC(bool, al_reserve_samples, (int reserve_samples)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_MIXER *, al_get_default_mixer, (void)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_default_mixer, (ALLEGRO_MIXER *mixer)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_restore_default_mixer, (void)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_play_sample, (ALLEGRO_SAMPLE *data, - float gain, float pan, float speed, ALLEGRO_PLAYMODE loop, ALLEGRO_SAMPLE_ID *ret_id)); -ALLEGRO_KCM_AUDIO_FUNC(void, al_stop_sample, (ALLEGRO_SAMPLE_ID *spl_id)); -ALLEGRO_KCM_AUDIO_FUNC(void, al_stop_samples, (void)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_VOICE *, al_get_default_voice, (void)); -ALLEGRO_KCM_AUDIO_FUNC(void, al_set_default_voice, (ALLEGRO_VOICE *voice)); - -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_KCM_AUDIO_SRC) -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_SAMPLE_INSTANCE*, al_lock_sample_id, (ALLEGRO_SAMPLE_ID *spl_id)); -ALLEGRO_KCM_AUDIO_FUNC(void, al_unlock_sample_id, (ALLEGRO_SAMPLE_ID *spl_id)); +A5O_KCM_AUDIO_FUNC(bool, al_reserve_samples, (int reserve_samples)); +A5O_KCM_AUDIO_FUNC(A5O_MIXER *, al_get_default_mixer, (void)); +A5O_KCM_AUDIO_FUNC(bool, al_set_default_mixer, (A5O_MIXER *mixer)); +A5O_KCM_AUDIO_FUNC(bool, al_restore_default_mixer, (void)); +A5O_KCM_AUDIO_FUNC(bool, al_play_sample, (A5O_SAMPLE *data, + float gain, float pan, float speed, A5O_PLAYMODE loop, A5O_SAMPLE_ID *ret_id)); +A5O_KCM_AUDIO_FUNC(void, al_stop_sample, (A5O_SAMPLE_ID *spl_id)); +A5O_KCM_AUDIO_FUNC(void, al_stop_samples, (void)); +A5O_KCM_AUDIO_FUNC(A5O_VOICE *, al_get_default_voice, (void)); +A5O_KCM_AUDIO_FUNC(void, al_set_default_voice, (A5O_VOICE *voice)); + +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_KCM_AUDIO_SRC) +A5O_KCM_AUDIO_FUNC(A5O_SAMPLE_INSTANCE*, al_lock_sample_id, (A5O_SAMPLE_ID *spl_id)); +A5O_KCM_AUDIO_FUNC(void, al_unlock_sample_id, (A5O_SAMPLE_ID *spl_id)); #endif /* File type handlers */ -ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_sample_loader, (const char *ext, - ALLEGRO_SAMPLE *(*loader)(const char *filename))); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_sample_saver, (const char *ext, - bool (*saver)(const char *filename, ALLEGRO_SAMPLE *spl))); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_audio_stream_loader, (const char *ext, - ALLEGRO_AUDIO_STREAM *(*stream_loader)(const char *filename, +A5O_KCM_AUDIO_FUNC(bool, al_register_sample_loader, (const char *ext, + A5O_SAMPLE *(*loader)(const char *filename))); +A5O_KCM_AUDIO_FUNC(bool, al_register_sample_saver, (const char *ext, + bool (*saver)(const char *filename, A5O_SAMPLE *spl))); +A5O_KCM_AUDIO_FUNC(bool, al_register_audio_stream_loader, (const char *ext, + A5O_AUDIO_STREAM *(*stream_loader)(const char *filename, size_t buffer_count, unsigned int samples))); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_sample_loader_f, (const char *ext, - ALLEGRO_SAMPLE *(*loader)(ALLEGRO_FILE *fp))); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_sample_saver_f, (const char *ext, - bool (*saver)(ALLEGRO_FILE *fp, ALLEGRO_SAMPLE *spl))); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_audio_stream_loader_f, (const char *ext, - ALLEGRO_AUDIO_STREAM *(*stream_loader)(ALLEGRO_FILE *fp, +A5O_KCM_AUDIO_FUNC(bool, al_register_sample_loader_f, (const char *ext, + A5O_SAMPLE *(*loader)(A5O_FILE *fp))); +A5O_KCM_AUDIO_FUNC(bool, al_register_sample_saver_f, (const char *ext, + bool (*saver)(A5O_FILE *fp, A5O_SAMPLE *spl))); +A5O_KCM_AUDIO_FUNC(bool, al_register_audio_stream_loader_f, (const char *ext, + A5O_AUDIO_STREAM *(*stream_loader)(A5O_FILE *fp, size_t buffer_count, unsigned int samples))); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_sample_identifier, (const char *ext, - bool (*identifier)(ALLEGRO_FILE *fp))); +A5O_KCM_AUDIO_FUNC(bool, al_register_sample_identifier, (const char *ext, + bool (*identifier)(A5O_FILE *fp))); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_SAMPLE *, al_load_sample, (const char *filename)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_save_sample, (const char *filename, - ALLEGRO_SAMPLE *spl)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_STREAM *, al_load_audio_stream, (const char *filename, +A5O_KCM_AUDIO_FUNC(A5O_SAMPLE *, al_load_sample, (const char *filename)); +A5O_KCM_AUDIO_FUNC(bool, al_save_sample, (const char *filename, + A5O_SAMPLE *spl)); +A5O_KCM_AUDIO_FUNC(A5O_AUDIO_STREAM *, al_load_audio_stream, (const char *filename, size_t buffer_count, unsigned int samples)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_SAMPLE *, al_load_sample_f, (ALLEGRO_FILE* fp, const char *ident)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_save_sample_f, (ALLEGRO_FILE* fp, const char *ident, - ALLEGRO_SAMPLE *spl)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_STREAM *, al_load_audio_stream_f, (ALLEGRO_FILE* fp, const char *ident, +A5O_KCM_AUDIO_FUNC(A5O_SAMPLE *, al_load_sample_f, (A5O_FILE* fp, const char *ident)); +A5O_KCM_AUDIO_FUNC(bool, al_save_sample_f, (A5O_FILE* fp, const char *ident, + A5O_SAMPLE *spl)); +A5O_KCM_AUDIO_FUNC(A5O_AUDIO_STREAM *, al_load_audio_stream_f, (A5O_FILE* fp, const char *ident, size_t buffer_count, unsigned int samples)); -ALLEGRO_KCM_AUDIO_FUNC(char const *, al_identify_sample_f, (ALLEGRO_FILE *fp)); -ALLEGRO_KCM_AUDIO_FUNC(char const *, al_identify_sample, (char const *filename)); +A5O_KCM_AUDIO_FUNC(char const *, al_identify_sample_f, (A5O_FILE *fp)); +A5O_KCM_AUDIO_FUNC(char const *, al_identify_sample, (char const *filename)); -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_KCM_AUDIO_SRC) +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_KCM_AUDIO_SRC) /* Recording functions */ -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_RECORDER *, al_create_audio_recorder, (size_t fragment_count, - unsigned int samples, unsigned int freq, ALLEGRO_AUDIO_DEPTH depth, ALLEGRO_CHANNEL_CONF chan_conf)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_start_audio_recorder, (ALLEGRO_AUDIO_RECORDER *r)); -ALLEGRO_KCM_AUDIO_FUNC(void, al_stop_audio_recorder, (ALLEGRO_AUDIO_RECORDER *r)); -ALLEGRO_KCM_AUDIO_FUNC(bool, al_is_audio_recorder_recording, (ALLEGRO_AUDIO_RECORDER *r)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_audio_recorder_event_source, - (ALLEGRO_AUDIO_RECORDER *r)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_RECORDER_EVENT *, al_get_audio_recorder_event, (ALLEGRO_EVENT *event)); -ALLEGRO_KCM_AUDIO_FUNC(void, al_destroy_audio_recorder, (ALLEGRO_AUDIO_RECORDER *r)); +A5O_KCM_AUDIO_FUNC(A5O_AUDIO_RECORDER *, al_create_audio_recorder, (size_t fragment_count, + unsigned int samples, unsigned int freq, A5O_AUDIO_DEPTH depth, A5O_CHANNEL_CONF chan_conf)); +A5O_KCM_AUDIO_FUNC(bool, al_start_audio_recorder, (A5O_AUDIO_RECORDER *r)); +A5O_KCM_AUDIO_FUNC(void, al_stop_audio_recorder, (A5O_AUDIO_RECORDER *r)); +A5O_KCM_AUDIO_FUNC(bool, al_is_audio_recorder_recording, (A5O_AUDIO_RECORDER *r)); +A5O_KCM_AUDIO_FUNC(A5O_EVENT_SOURCE *, al_get_audio_recorder_event_source, + (A5O_AUDIO_RECORDER *r)); +A5O_KCM_AUDIO_FUNC(A5O_AUDIO_RECORDER_EVENT *, al_get_audio_recorder_event, (A5O_EVENT *event)); +A5O_KCM_AUDIO_FUNC(void, al_destroy_audio_recorder, (A5O_AUDIO_RECORDER *r)); #endif diff --git a/addons/audio/allegro5/internal/aintern_audio.h b/addons/audio/allegro5/internal/aintern_audio.h index b7fe5f4617..265ef4c96e 100644 --- a/addons/audio/allegro5/internal/aintern_audio.h +++ b/addons/audio/allegro5/internal/aintern_audio.h @@ -10,17 +10,17 @@ #include "allegro5/internal/aintern_vector.h" #include "../allegro_audio.h" -struct ALLEGRO_AUDIO_RECORDER { - ALLEGRO_EVENT_SOURCE source; +struct A5O_AUDIO_RECORDER { + A5O_EVENT_SOURCE source; - ALLEGRO_THREAD *thread; - ALLEGRO_MUTEX *mutex; - ALLEGRO_COND *cond; + A5O_THREAD *thread; + A5O_MUTEX *mutex; + A5O_COND *cond; /* recording is done in its own thread as implemented by the driver */ - ALLEGRO_AUDIO_DEPTH depth; - ALLEGRO_CHANNEL_CONF chan_conf; + A5O_AUDIO_DEPTH depth; + A5O_CHANNEL_CONF chan_conf; unsigned int frequency; void **fragments; @@ -46,61 +46,61 @@ struct ALLEGRO_AUDIO_RECORDER { /* custom data for the driver to use as needed */ }; -typedef enum ALLEGRO_AUDIO_DRIVER_ENUM +typedef enum A5O_AUDIO_DRIVER_ENUM { /* Various driver modes. */ - ALLEGRO_AUDIO_DRIVER_AUTODETECT = 0x20000, - ALLEGRO_AUDIO_DRIVER_OPENAL = 0x20001, - ALLEGRO_AUDIO_DRIVER_ALSA = 0x20002, - ALLEGRO_AUDIO_DRIVER_DSOUND = 0x20003, - ALLEGRO_AUDIO_DRIVER_OSS = 0x20004, - ALLEGRO_AUDIO_DRIVER_AQUEUE = 0x20005, - ALLEGRO_AUDIO_DRIVER_PULSEAUDIO = 0x20006, - ALLEGRO_AUDIO_DRIVER_OPENSL = 0x20007, - ALLEGRO_AUDIO_DRIVER_SDL = 0x20008 -} ALLEGRO_AUDIO_DRIVER_ENUM; - -typedef struct ALLEGRO_AUDIO_DRIVER ALLEGRO_AUDIO_DRIVER; -struct ALLEGRO_AUDIO_DRIVER { + A5O_AUDIO_DRIVER_AUTODETECT = 0x20000, + A5O_AUDIO_DRIVER_OPENAL = 0x20001, + A5O_AUDIO_DRIVER_ALSA = 0x20002, + A5O_AUDIO_DRIVER_DSOUND = 0x20003, + A5O_AUDIO_DRIVER_OSS = 0x20004, + A5O_AUDIO_DRIVER_AQUEUE = 0x20005, + A5O_AUDIO_DRIVER_PULSEAUDIO = 0x20006, + A5O_AUDIO_DRIVER_OPENSL = 0x20007, + A5O_AUDIO_DRIVER_SDL = 0x20008 +} A5O_AUDIO_DRIVER_ENUM; + +typedef struct A5O_AUDIO_DRIVER A5O_AUDIO_DRIVER; +struct A5O_AUDIO_DRIVER { const char *specifier; int (*open)(void); void (*close)(void); - int (*allocate_voice)(ALLEGRO_VOICE*); - void (*deallocate_voice)(ALLEGRO_VOICE*); + int (*allocate_voice)(A5O_VOICE*); + void (*deallocate_voice)(A5O_VOICE*); - int (*load_voice)(ALLEGRO_VOICE*, const void*); - void (*unload_voice)(ALLEGRO_VOICE*); + int (*load_voice)(A5O_VOICE*, const void*); + void (*unload_voice)(A5O_VOICE*); - int (*start_voice)(ALLEGRO_VOICE*); - int (*stop_voice)(ALLEGRO_VOICE*); + int (*start_voice)(A5O_VOICE*); + int (*stop_voice)(A5O_VOICE*); - bool (*voice_is_playing)(const ALLEGRO_VOICE*); + bool (*voice_is_playing)(const A5O_VOICE*); - unsigned int (*get_voice_position)(const ALLEGRO_VOICE*); - int (*set_voice_position)(ALLEGRO_VOICE*, unsigned int); + unsigned int (*get_voice_position)(const A5O_VOICE*); + int (*set_voice_position)(A5O_VOICE*, unsigned int); - int (*allocate_recorder)(struct ALLEGRO_AUDIO_RECORDER *); - void (*deallocate_recorder)(struct ALLEGRO_AUDIO_RECORDER *); + int (*allocate_recorder)(struct A5O_AUDIO_RECORDER *); + void (*deallocate_recorder)(struct A5O_AUDIO_RECORDER *); _AL_LIST* (*get_output_devices)(void); }; -extern ALLEGRO_AUDIO_DRIVER *_al_kcm_driver; +extern A5O_AUDIO_DRIVER *_al_kcm_driver; -const void *_al_voice_update(ALLEGRO_VOICE *voice, ALLEGRO_MUTEX *mutex, +const void *_al_voice_update(A5O_VOICE *voice, A5O_MUTEX *mutex, unsigned int *samples); -bool _al_kcm_set_voice_playing(ALLEGRO_VOICE *voice, ALLEGRO_MUTEX *mutex, +bool _al_kcm_set_voice_playing(A5O_VOICE *voice, A5O_MUTEX *mutex, bool val); /* A voice structure that you'd attach a mixer or sample to. Ideally there - * would be one ALLEGRO_VOICE per system/hardware voice. + * would be one A5O_VOICE per system/hardware voice. */ -struct ALLEGRO_VOICE { - ALLEGRO_AUDIO_DEPTH depth; - ALLEGRO_CHANNEL_CONF chan_conf; +struct A5O_VOICE { + A5O_AUDIO_DEPTH depth; + A5O_CHANNEL_CONF chan_conf; unsigned int frequency; @@ -108,20 +108,20 @@ struct ALLEGRO_VOICE { size_t num_buffers; /* If non-0, they must be honored by the driver. */ - ALLEGRO_SAMPLE_INSTANCE *attached_stream; + A5O_SAMPLE_INSTANCE *attached_stream; /* The stream that is attached to the voice, or NULL. - * May be an ALLEGRO_SAMPLE_INSTANCE or ALLEGRO_MIXER object. + * May be an A5O_SAMPLE_INSTANCE or A5O_MIXER object. */ bool is_streaming; /* True for voices with an attached mixer. */ - ALLEGRO_MUTEX *mutex; - ALLEGRO_COND *cond; + A5O_MUTEX *mutex; + A5O_COND *cond; _AL_LIST_ITEM *dtor_item; - ALLEGRO_AUDIO_DRIVER *driver; + A5O_AUDIO_DRIVER *driver; /* XXX shouldn't there only be one audio driver active * at a time? */ @@ -142,9 +142,9 @@ typedef union { void *ptr; } any_buffer_t; -struct ALLEGRO_SAMPLE { - ALLEGRO_AUDIO_DEPTH depth; - ALLEGRO_CHANNEL_CONF chan_conf; +struct A5O_SAMPLE { + A5O_AUDIO_DEPTH depth; + A5O_CHANNEL_CONF chan_conf; unsigned int frequency; int len; any_buffer_t buffer; @@ -175,29 +175,29 @@ struct ALLEGRO_SAMPLE { * The number of channels in the destination. */ typedef void (*stream_reader_t)(void *source, void **vbuf, - unsigned int *samples, ALLEGRO_AUDIO_DEPTH buffer_depth, size_t dest_maxc); + unsigned int *samples, A5O_AUDIO_DEPTH buffer_depth, size_t dest_maxc); typedef struct { union { - ALLEGRO_MIXER *mixer; - ALLEGRO_VOICE *voice; + A5O_MIXER *mixer; + A5O_VOICE *voice; void *ptr; } u; bool is_voice; } sample_parent_t; -/* The sample struct also serves the base of ALLEGRO_AUDIO_STREAM, ALLEGRO_MIXER. */ -struct ALLEGRO_SAMPLE_INSTANCE { - /* ALLEGRO_SAMPLE_INSTANCE does not generate any events yet but ALLEGRO_AUDIO_STREAM - * does, which can inherit only ALLEGRO_SAMPLE_INSTANCE. */ - ALLEGRO_EVENT_SOURCE es; +/* The sample struct also serves the base of A5O_AUDIO_STREAM, A5O_MIXER. */ +struct A5O_SAMPLE_INSTANCE { + /* A5O_SAMPLE_INSTANCE does not generate any events yet but A5O_AUDIO_STREAM + * does, which can inherit only A5O_SAMPLE_INSTANCE. */ + A5O_EVENT_SOURCE es; - ALLEGRO_SAMPLE spl_data; + A5O_SAMPLE spl_data; volatile bool is_playing; /* Is this sample is playing? */ - ALLEGRO_PLAYMODE loop; + A5O_PLAYMODE loop; float speed; float gain; float pan; @@ -229,7 +229,7 @@ struct ALLEGRO_SAMPLE_INSTANCE { * the specified format, converting as necessary. */ - ALLEGRO_MUTEX *mutex; + A5O_MUTEX *mutex; /* Points to the parent object's mutex. It is NULL if * the sample is not directly or indirectly attached * to a voice. @@ -241,23 +241,23 @@ struct ALLEGRO_SAMPLE_INSTANCE { _AL_LIST_ITEM *dtor_item; }; -void _al_kcm_destroy_sample(ALLEGRO_SAMPLE_INSTANCE *sample, bool unregister); -void _al_kcm_stream_set_mutex(ALLEGRO_SAMPLE_INSTANCE *stream, ALLEGRO_MUTEX *mutex); -void _al_kcm_detach_from_parent(ALLEGRO_SAMPLE_INSTANCE *spl); +void _al_kcm_destroy_sample(A5O_SAMPLE_INSTANCE *sample, bool unregister); +void _al_kcm_stream_set_mutex(A5O_SAMPLE_INSTANCE *stream, A5O_MUTEX *mutex); +void _al_kcm_detach_from_parent(A5O_SAMPLE_INSTANCE *spl); -typedef size_t (*stream_callback_t)(ALLEGRO_AUDIO_STREAM *, void *, size_t); -typedef void (*unload_feeder_t)(ALLEGRO_AUDIO_STREAM *); -typedef bool (*rewind_feeder_t)(ALLEGRO_AUDIO_STREAM *); -typedef bool (*seek_feeder_t)(ALLEGRO_AUDIO_STREAM *, double); -typedef double (*get_feeder_position_t)(ALLEGRO_AUDIO_STREAM *); -typedef double (*get_feeder_length_t)(ALLEGRO_AUDIO_STREAM *); -typedef bool (*set_feeder_loop_t)(ALLEGRO_AUDIO_STREAM *, double, double); +typedef size_t (*stream_callback_t)(A5O_AUDIO_STREAM *, void *, size_t); +typedef void (*unload_feeder_t)(A5O_AUDIO_STREAM *); +typedef bool (*rewind_feeder_t)(A5O_AUDIO_STREAM *); +typedef bool (*seek_feeder_t)(A5O_AUDIO_STREAM *, double); +typedef double (*get_feeder_position_t)(A5O_AUDIO_STREAM *); +typedef double (*get_feeder_length_t)(A5O_AUDIO_STREAM *); +typedef bool (*set_feeder_loop_t)(A5O_AUDIO_STREAM *, double, double); -struct ALLEGRO_AUDIO_STREAM { - ALLEGRO_SAMPLE_INSTANCE spl; - /* ALLEGRO_AUDIO_STREAM is derived from - * ALLEGRO_SAMPLE_INSTANCE. +struct A5O_AUDIO_STREAM { + A5O_SAMPLE_INSTANCE spl; + /* A5O_AUDIO_STREAM is derived from + * A5O_SAMPLE_INSTANCE. */ unsigned int buf_count; @@ -297,9 +297,9 @@ struct ALLEGRO_AUDIO_STREAM { * the stream was started. */ - ALLEGRO_THREAD *feed_thread; - ALLEGRO_MUTEX *feed_thread_started_mutex; - ALLEGRO_COND *feed_thread_started_cond; + A5O_THREAD *feed_thread; + A5O_MUTEX *feed_thread_started_mutex; + A5O_COND *feed_thread_started_cond; bool feed_thread_started; volatile bool quit_feed_thread; unload_feeder_t unload_feeder; @@ -309,7 +309,7 @@ struct ALLEGRO_AUDIO_STREAM { get_feeder_length_t get_feeder_length; set_feeder_loop_t set_feeder_loop; stream_callback_t feeder; - /* If ALLEGRO_AUDIO_STREAM has been created by + /* If A5O_AUDIO_STREAM has been created by * al_load_audio_stream(), the stream will be fed * by a thread using the 'feeder' callback. Such * streams don't need to be fed by the user. @@ -321,59 +321,59 @@ struct ALLEGRO_AUDIO_STREAM { /* Extra data for use by the flac/vorbis addons. */ }; -bool _al_kcm_refill_stream(ALLEGRO_AUDIO_STREAM *stream); +bool _al_kcm_refill_stream(A5O_AUDIO_STREAM *stream); typedef void (*postprocess_callback_t)(void *buf, unsigned int samples, void *userdata); -/* ALLEGRO_MIXER is derived from ALLEGRO_SAMPLE_INSTANCE. Certain internal functions and +/* A5O_MIXER is derived from A5O_SAMPLE_INSTANCE. Certain internal functions and * pointers may take either object type, and such things are explicitly noted. * This is never exposed to the user, though. The sample object's read method * will be set to a different function that will call the read method of all * attached streams (which may be a sample, or another mixer). */ -struct ALLEGRO_MIXER { - ALLEGRO_SAMPLE_INSTANCE ss; - /* ALLEGRO_MIXER is derived from ALLEGRO_SAMPLE_INSTANCE. */ +struct A5O_MIXER { + A5O_SAMPLE_INSTANCE ss; + /* A5O_MIXER is derived from A5O_SAMPLE_INSTANCE. */ - ALLEGRO_MIXER_QUALITY quality; + A5O_MIXER_QUALITY quality; postprocess_callback_t postprocess_callback; void *pp_callback_userdata; _AL_VECTOR streams; - /* Vector of ALLEGRO_SAMPLE_INSTANCE*. Holds the list of + /* Vector of A5O_SAMPLE_INSTANCE*. Holds the list of * streams being mixed together. */ _AL_LIST_ITEM *dtor_item; }; -extern void _al_kcm_mixer_rejig_sample_matrix(ALLEGRO_MIXER *mixer, - ALLEGRO_SAMPLE_INSTANCE *spl); +extern void _al_kcm_mixer_rejig_sample_matrix(A5O_MIXER *mixer, + A5O_SAMPLE_INSTANCE *spl); extern void _al_kcm_mixer_read(void *source, void **buf, unsigned int *samples, - ALLEGRO_AUDIO_DEPTH buffer_depth, size_t dest_maxc); + A5O_AUDIO_DEPTH buffer_depth, size_t dest_maxc); typedef enum { - ALLEGRO_NO_ERROR = 0, - ALLEGRO_INVALID_PARAM = 1, - ALLEGRO_INVALID_OBJECT = 2, - ALLEGRO_GENERIC_ERROR = 255 + A5O_NO_ERROR = 0, + A5O_INVALID_PARAM = 1, + A5O_INVALID_OBJECT = 2, + A5O_GENERIC_ERROR = 255 } AL_ERROR_ENUM; extern void _al_set_error(int error, char* string); -struct ALLEGRO_AUDIO_DEVICE { +struct A5O_AUDIO_DEVICE { char* name; void* identifier; }; /* Supposedly internal */ -ALLEGRO_KCM_AUDIO_FUNC(void*, _al_kcm_feed_stream, (ALLEGRO_THREAD *self, void *vstream)); +A5O_KCM_AUDIO_FUNC(void*, _al_kcm_feed_stream, (A5O_THREAD *self, void *vstream)); /* Helper to emit an event that the stream has got a buffer ready to be refilled. */ -void _al_kcm_emit_stream_events(ALLEGRO_AUDIO_STREAM *stream); +void _al_kcm_emit_stream_events(A5O_AUDIO_STREAM *stream); void _al_kcm_init_destructors(void); void _al_kcm_shutdown_destructors(void); @@ -384,12 +384,12 @@ void _al_kcm_foreach_destructor( void (*callback)(void *object, void (*func)(void *), void *udata), void *userdata); -ALLEGRO_KCM_AUDIO_FUNC(void, _al_kcm_shutdown_default_mixer, (void)); +A5O_KCM_AUDIO_FUNC(void, _al_kcm_shutdown_default_mixer, (void)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_CHANNEL_CONF, _al_count_to_channel_conf, (int num_channels)); -ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_DEPTH, _al_word_size_to_depth_conf, (int word_size)); +A5O_KCM_AUDIO_FUNC(A5O_CHANNEL_CONF, _al_count_to_channel_conf, (int num_channels)); +A5O_KCM_AUDIO_FUNC(A5O_AUDIO_DEPTH, _al_word_size_to_depth_conf, (int word_size)); -ALLEGRO_KCM_AUDIO_FUNC(void, _al_emit_audio_event, (int event_type)); +A5O_KCM_AUDIO_FUNC(void, _al_emit_audio_event, (int event_type)); #endif diff --git a/addons/audio/allegro5/internal/aintern_audio_cfg.h.cmake b/addons/audio/allegro5/internal/aintern_audio_cfg.h.cmake index a865fd8c38..7b05e50786 100644 --- a/addons/audio/allegro5/internal/aintern_audio_cfg.h.cmake +++ b/addons/audio/allegro5/internal/aintern_audio_cfg.h.cmake @@ -1,7 +1,7 @@ -#cmakedefine ALLEGRO_CFG_KCM_ALSA -#cmakedefine ALLEGRO_CFG_KCM_OPENAL -#cmakedefine ALLEGRO_CFG_KCM_OPENSL -#cmakedefine ALLEGRO_CFG_KCM_DSOUND -#cmakedefine ALLEGRO_CFG_KCM_OSS -#cmakedefine ALLEGRO_CFG_KCM_PULSEAUDIO -#cmakedefine ALLEGRO_CFG_KCM_AQUEUE +#cmakedefine A5O_CFG_KCM_ALSA +#cmakedefine A5O_CFG_KCM_OPENAL +#cmakedefine A5O_CFG_KCM_OPENSL +#cmakedefine A5O_CFG_KCM_DSOUND +#cmakedefine A5O_CFG_KCM_OSS +#cmakedefine A5O_CFG_KCM_PULSEAUDIO +#cmakedefine A5O_CFG_KCM_AQUEUE diff --git a/addons/audio/alsa.c b/addons/audio/alsa.c index cc369717fd..d12e39620a 100644 --- a/addons/audio/alsa.c +++ b/addons/audio/alsa.c @@ -26,13 +26,13 @@ #include #include -ALLEGRO_DEBUG_CHANNEL("alsa") +A5O_DEBUG_CHANNEL("alsa") #define ALSA_CHECK(a) \ do { \ int err = (a); \ if (err < 0) { \ - ALLEGRO_ERROR("%s: %s\n", snd_strerror(err), #a); \ + A5O_ERROR("%s: %s\n", snd_strerror(err), #a); \ goto Error; \ } \ } while(0) @@ -95,7 +95,7 @@ typedef struct ALSA_VOICE { struct pollfd *ufds; int ufds_count; - ALLEGRO_THREAD *poll_thread; + A5O_THREAD *poll_thread; snd_pcm_t *pcm_handle; bool mmapped; @@ -120,7 +120,7 @@ static int alsa_open(void) int alsa_err = snd_pcm_open(&test_pcm_handle, alsa_device, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); if (alsa_err < 0) { - ALLEGRO_WARN("ALSA is not available on the system.\n"); + A5O_WARN("ALSA is not available on the system.\n"); return 1; } else { @@ -131,7 +131,7 @@ static int alsa_open(void) /* ALSA check is a macro that 'goto' error*/ Error: - ALLEGRO_ERROR("Error initializing alsa!\n"); + A5O_ERROR("Error initializing alsa!\n"); return 1; } @@ -159,25 +159,25 @@ static int xrun_recovery(snd_pcm_t *handle, int err) if (err == -EPIPE) { /* under-run */ err = snd_pcm_prepare(handle); if (err < 0) { - ALLEGRO_ERROR("Can't recover from underrun, prepare failed: %s\n", snd_strerror(err)); + A5O_ERROR("Can't recover from underrun, prepare failed: %s\n", snd_strerror(err)); } else { - ALLEGRO_DEBUG("Recovered from underrun\n"); + A5O_DEBUG("Recovered from underrun\n"); } return 0; } else if (err == -ESTRPIPE) { /* suspend */ err = snd_pcm_resume(handle); if (err < 0) { - ALLEGRO_ERROR("Can't recover from suspend, resume failed: %s\n", snd_strerror(err)); + A5O_ERROR("Can't recover from suspend, resume failed: %s\n", snd_strerror(err)); } else { - ALLEGRO_DEBUG("Resumed successfully\n"); + A5O_DEBUG("Resumed successfully\n"); } return 0; } else { - ALLEGRO_ERROR("Unknown error code: %d\n", err); + A5O_ERROR("Unknown error code: %d\n", err); ASSERT(0); } @@ -195,7 +195,7 @@ static int xrun_recovery(snd_pcm_t *handle, int err) * If the voice is played backwards, 'buf' will point to the end of the buffer * and 'bytes' is the size that can be read towards the beginning. */ -static int alsa_update_nonstream_voice(ALLEGRO_VOICE *voice, void **buf, int *bytes) +static int alsa_update_nonstream_voice(A5O_VOICE *voice, void **buf, int *bytes) { ALSA_VOICE *alsa_voice = (ALSA_VOICE*)voice->extra; int bpos = voice->attached_stream->pos * alsa_voice->frame_size; @@ -206,14 +206,14 @@ static int alsa_update_nonstream_voice(ALLEGRO_VOICE *voice, void **buf, int *by if (!alsa_voice->reversed) { if (bpos + *bytes > blen) { *bytes = blen - bpos; - if (voice->attached_stream->loop == ALLEGRO_PLAYMODE_ONCE) { + if (voice->attached_stream->loop == A5O_PLAYMODE_ONCE) { alsa_voice->stop = true; voice->attached_stream->pos = 0; } - if (voice->attached_stream->loop == ALLEGRO_PLAYMODE_LOOP) { + if (voice->attached_stream->loop == A5O_PLAYMODE_LOOP) { voice->attached_stream->pos = 0; } - else if (voice->attached_stream->loop == ALLEGRO_PLAYMODE_BIDIR) { + else if (voice->attached_stream->loop == A5O_PLAYMODE_BIDIR) { alsa_voice->reversed = true; voice->attached_stream->pos = alsa_voice->len; } @@ -225,9 +225,9 @@ static int alsa_update_nonstream_voice(ALLEGRO_VOICE *voice, void **buf, int *by else { if (bpos - *bytes < 0) { *bytes = bpos; - /* loop will be ALLEGRO_PLAYMODE_BIDIR, other playing modes that play + /* loop will be A5O_PLAYMODE_BIDIR, other playing modes that play backwards are not currently supported by the API */ - /*if (voice->attached_stream->loop != ALLEGRO_PLAYMODE_BIDIR) + /*if (voice->attached_stream->loop != A5O_PLAYMODE_BIDIR) alsa_voice->stop = true;*/ voice->attached_stream->pos = 0; @@ -262,11 +262,11 @@ static int alsa_voice_is_ready(ALSA_VOICE *alsa_voice) err = -ESTRPIPE; if (xrun_recovery(alsa_voice->pcm_handle, err) < 0) { - ALLEGRO_ERROR("Write error: %s\n", snd_strerror(err)); + A5O_ERROR("Write error: %s\n", snd_strerror(err)); return -POLLERR; } } else { - ALLEGRO_ERROR("Wait for poll failed\n"); + A5O_ERROR("Wait for poll failed\n"); return -POLLERR; } } @@ -280,9 +280,9 @@ static int alsa_voice_is_ready(ALSA_VOICE *alsa_voice) /* Custom routine which runs in another thread and fills the hardware PCM buffer from the voice buffer. */ -static void *alsa_update_mmap(ALLEGRO_THREAD *self, void *arg) +static void *alsa_update_mmap(A5O_THREAD *self, void *arg) { - ALLEGRO_VOICE *voice = (ALLEGRO_VOICE*)arg; + A5O_VOICE *voice = (A5O_VOICE*)arg; ALSA_VOICE *alsa_voice = (ALSA_VOICE*)voice->extra; snd_pcm_state_t last_state = -1; snd_pcm_state_t state; @@ -293,7 +293,7 @@ static void *alsa_update_mmap(ALLEGRO_THREAD *self, void *arg) snd_pcm_sframes_t commitres; int ret; - ALLEGRO_INFO("ALSA update_mmap thread started\n"); + A5O_INFO("ALSA update_mmap thread started\n"); while (!al_get_thread_should_stop(self)) { if (alsa_voice->stop && !alsa_voice->stopped) { @@ -321,17 +321,17 @@ static void *alsa_update_mmap(ALLEGRO_THREAD *self, void *arg) state = snd_pcm_state(alsa_voice->pcm_handle); if (state != last_state) { - ALLEGRO_DEBUG("state changed to: %s\n", snd_pcm_state_name(state)); + A5O_DEBUG("state changed to: %s\n", snd_pcm_state_name(state)); last_state = state; } if (state == SND_PCM_STATE_SETUP) { int rc = snd_pcm_prepare(alsa_voice->pcm_handle); - ALLEGRO_DEBUG("snd_pcm_prepare returned: %d\n", rc); + A5O_DEBUG("snd_pcm_prepare returned: %d\n", rc); continue; } if (state == SND_PCM_STATE_PREPARED) { int rc = snd_pcm_start(alsa_voice->pcm_handle); - ALLEGRO_DEBUG("snd_pcm_start returned: %d\n", rc); + A5O_DEBUG("snd_pcm_start returned: %d\n", rc); } ret = alsa_voice_is_ready(alsa_voice); @@ -347,7 +347,7 @@ static void *alsa_update_mmap(ALLEGRO_THREAD *self, void *arg) ret = snd_pcm_mmap_begin(alsa_voice->pcm_handle, &areas, &offset, &frames); if (ret < 0) { if ((ret = xrun_recovery(alsa_voice->pcm_handle, ret)) < 0) { - ALLEGRO_ERROR("MMAP begin avail error: %s\n", snd_strerror(ret)); + A5O_ERROR("MMAP begin avail error: %s\n", snd_strerror(ret)); } break; } @@ -400,28 +400,28 @@ static void *alsa_update_mmap(ALLEGRO_THREAD *self, void *arg) commitres = snd_pcm_mmap_commit(alsa_voice->pcm_handle, offset, frames); if (commitres < 0 || (snd_pcm_uframes_t)commitres != frames) { if ((ret = xrun_recovery(alsa_voice->pcm_handle, commitres >= 0 ? -EPIPE : commitres)) < 0) { - ALLEGRO_ERROR("MMAP commit error: %s\n", snd_strerror(ret)); + A5O_ERROR("MMAP commit error: %s\n", snd_strerror(ret)); break; } } } - ALLEGRO_INFO("ALSA update_mmap thread stopped\n"); + A5O_INFO("ALSA update_mmap thread stopped\n"); return NULL; } -static void *alsa_update_rw(ALLEGRO_THREAD *self, void *arg) +static void *alsa_update_rw(A5O_THREAD *self, void *arg) { - ALLEGRO_VOICE *voice = (ALLEGRO_VOICE*)arg; + A5O_VOICE *voice = (A5O_VOICE*)arg; ALSA_VOICE *alsa_voice = (ALSA_VOICE*)voice->extra; snd_pcm_state_t last_state = -1; snd_pcm_state_t state; snd_pcm_uframes_t frames; snd_pcm_sframes_t err; - ALLEGRO_INFO("ALSA update_rw thread started\n"); + A5O_INFO("ALSA update_rw thread started\n"); while (!al_get_thread_should_stop(self)) { if (alsa_voice->stop && !alsa_voice->stopped) { @@ -449,17 +449,17 @@ static void *alsa_update_rw(ALLEGRO_THREAD *self, void *arg) state = snd_pcm_state(alsa_voice->pcm_handle); if (state != last_state) { - ALLEGRO_DEBUG("state changed to: %s\n", snd_pcm_state_name(state)); + A5O_DEBUG("state changed to: %s\n", snd_pcm_state_name(state)); last_state = state; } if (state == SND_PCM_STATE_SETUP) { int rc = snd_pcm_prepare(alsa_voice->pcm_handle); - ALLEGRO_DEBUG("snd_pcm_prepare returned: %d\n", rc); + A5O_DEBUG("snd_pcm_prepare returned: %d\n", rc); continue; } if (state == SND_PCM_STATE_PREPARED) { int rc = snd_pcm_start(alsa_voice->pcm_handle); - ALLEGRO_DEBUG("snd_pcm_start returned: %d\n", rc); + A5O_DEBUG("snd_pcm_start returned: %d\n", rc); } snd_pcm_wait(alsa_voice->pcm_handle, 10); @@ -469,7 +469,7 @@ static void *alsa_update_rw(ALLEGRO_THREAD *self, void *arg) snd_pcm_prepare(alsa_voice->pcm_handle); } else { - ALLEGRO_WARN("Alsa r/w thread exited " + A5O_WARN("Alsa r/w thread exited " "with error code %s.\n", snd_strerror(-err)); break; } @@ -511,7 +511,7 @@ static void *alsa_update_rw(ALLEGRO_THREAD *self, void *arg) } } - ALLEGRO_INFO("ALSA update_rw thread stopped\n"); + A5O_INFO("ALSA update_rw thread stopped\n"); return NULL; } @@ -522,7 +522,7 @@ static void *alsa_update_rw(ALLEGRO_THREAD *self, void *arg) 'buffer_size' field will be the total length in bytes of the sample data. The voice's attached stream's looping mode should be honored, and loading must fail if it cannot be. */ -static int alsa_load_voice(ALLEGRO_VOICE *voice, const void *data) +static int alsa_load_voice(A5O_VOICE *voice, const void *data) { ALSA_VOICE *ex_data = voice->extra; @@ -537,7 +537,7 @@ static int alsa_load_voice(ALLEGRO_VOICE *voice, const void *data) /* The unload_voice method unloads a sample previously loaded with load_voice. This method should not be called on a streaming voice. */ -static void alsa_unload_voice(ALLEGRO_VOICE *voice) +static void alsa_unload_voice(A5O_VOICE *voice) { (void)voice; } @@ -548,7 +548,7 @@ static void alsa_unload_voice(ALLEGRO_VOICE *voice) should start polling the device and call _al_voice_update for audio data. For non-streaming voices, it should resume playing from the last set position */ -static int alsa_start_voice(ALLEGRO_VOICE *voice) +static int alsa_start_voice(A5O_VOICE *voice) { ALSA_VOICE *ex_data = voice->extra; @@ -563,7 +563,7 @@ static int alsa_start_voice(ALLEGRO_VOICE *voice) /* The stop_voice method should stop playback. For non-streaming voices, it should leave the data loaded, and reset the voice position to 0. */ -static int alsa_stop_voice(ALLEGRO_VOICE *voice) +static int alsa_stop_voice(A5O_VOICE *voice) { ALSA_VOICE *ex_data = voice->extra; @@ -586,7 +586,7 @@ static int alsa_stop_voice(ALLEGRO_VOICE *voice) /* The voice_is_playing method should only be called on non-streaming sources, and should return true if the voice is playing */ -static bool alsa_voice_is_playing(const ALLEGRO_VOICE *voice) +static bool alsa_voice_is_playing(const A5O_VOICE *voice) { ALSA_VOICE *ex_data = voice->extra; return !ex_data->stopped; @@ -595,7 +595,7 @@ static bool alsa_voice_is_playing(const ALLEGRO_VOICE *voice) /* The allocate_voice method should grab a voice from the system, and allocate any data common to streaming and non-streaming sources. */ -static int alsa_allocate_voice(ALLEGRO_VOICE *voice) +static int alsa_allocate_voice(A5O_VOICE *voice) { snd_pcm_format_t format; int chan_count; @@ -616,25 +616,25 @@ static int alsa_allocate_voice(ALLEGRO_VOICE *voice) ex_data->frag_len = get_period_size(); - if (voice->depth == ALLEGRO_AUDIO_DEPTH_INT8) + if (voice->depth == A5O_AUDIO_DEPTH_INT8) format = SND_PCM_FORMAT_S8; - else if (voice->depth == ALLEGRO_AUDIO_DEPTH_UINT8) + else if (voice->depth == A5O_AUDIO_DEPTH_UINT8) format = SND_PCM_FORMAT_U8; - else if (voice->depth == ALLEGRO_AUDIO_DEPTH_INT16) + else if (voice->depth == A5O_AUDIO_DEPTH_INT16) format = SND_PCM_FORMAT_S16; - else if (voice->depth == ALLEGRO_AUDIO_DEPTH_UINT16) + else if (voice->depth == A5O_AUDIO_DEPTH_UINT16) format = SND_PCM_FORMAT_U16; - else if (voice->depth == ALLEGRO_AUDIO_DEPTH_INT24) + else if (voice->depth == A5O_AUDIO_DEPTH_INT24) format = SND_PCM_FORMAT_S24; - else if (voice->depth == ALLEGRO_AUDIO_DEPTH_UINT24) + else if (voice->depth == A5O_AUDIO_DEPTH_UINT24) format = SND_PCM_FORMAT_U24; - else if (voice->depth == ALLEGRO_AUDIO_DEPTH_FLOAT32) + else if (voice->depth == A5O_AUDIO_DEPTH_FLOAT32) format = SND_PCM_FORMAT_FLOAT; else goto Error; /* Why is this? And what is this? */ - if (voice->chan_conf == ALLEGRO_CHANNEL_CONF_3) + if (voice->chan_conf == A5O_CHANNEL_CONF_3) goto Error; req_freq = voice->frequency; @@ -661,7 +661,7 @@ static int alsa_allocate_voice(ALLEGRO_VOICE *voice) ALSA_CHECK(snd_pcm_hw_params(ex_data->pcm_handle, hwparams)); if (voice->frequency != req_freq) { - ALLEGRO_ERROR("Unsupported rate! Requested %u, got %iu.\n", voice->frequency, req_freq); + A5O_ERROR("Unsupported rate! Requested %u, got %iu.\n", voice->frequency, req_freq); goto Error; } @@ -683,7 +683,7 @@ static int alsa_allocate_voice(ALLEGRO_VOICE *voice) ex_data->poll_thread = al_create_thread(alsa_update_mmap, (void*)voice); } else { - ALLEGRO_WARN("Falling back to non-mmapped transfer.\n"); + A5O_WARN("Falling back to non-mmapped transfer.\n"); snd_pcm_nonblock(ex_data->pcm_handle, 0); ex_data->poll_thread = al_create_thread(alsa_update_rw, (void*)voice); } @@ -704,7 +704,7 @@ static int alsa_allocate_voice(ALLEGRO_VOICE *voice) /* The deallocate_voice method should free the resources for the given voice, but still retain a hold on the device. The voice should be stopped and unloaded by the time this is called */ -static void alsa_deallocate_voice(ALLEGRO_VOICE *voice) +static void alsa_deallocate_voice(A5O_VOICE *voice) { ALSA_VOICE *alsa_voice = (ALSA_VOICE*)voice->extra; @@ -728,7 +728,7 @@ static void alsa_deallocate_voice(ALLEGRO_VOICE *voice) /* The get_voice_position method should return the current sample position of the voice (sample_pos = byte_pos / (depth/8) / channels). This should never be called on a streaming voice. */ -static unsigned int alsa_get_voice_position(const ALLEGRO_VOICE *voice) +static unsigned int alsa_get_voice_position(const A5O_VOICE *voice) { return voice->attached_stream->pos; } @@ -738,7 +738,7 @@ static unsigned int alsa_get_voice_position(const ALLEGRO_VOICE *voice) /* The set_voice_position method should set the voice's playback position, given the value in samples. This should never be called on a streaming voice. */ -static int alsa_set_voice_position(ALLEGRO_VOICE *voice, unsigned int val) +static int alsa_set_voice_position(A5O_VOICE *voice, unsigned int val) { voice->attached_stream->pos = val; return 0; @@ -750,17 +750,17 @@ typedef struct ALSA_RECORDER_DATA snd_pcm_hw_params_t *hw_params; } ALSA_RECORDER_DATA; -static void *alsa_update_recorder(ALLEGRO_THREAD *t, void *thread_data) +static void *alsa_update_recorder(A5O_THREAD *t, void *thread_data) { - ALLEGRO_AUDIO_RECORDER *r = thread_data; + A5O_AUDIO_RECORDER *r = thread_data; ALSA_RECORDER_DATA *alsa = r->extra; - ALLEGRO_EVENT user_event; + A5O_EVENT user_event; uint8_t *null_buffer; unsigned int fragment_i = 0; null_buffer = al_malloc(1024 * r->sample_size); if (!null_buffer) { - ALLEGRO_ERROR("Unable to create buffer for draining ALSA.\n"); + A5O_ERROR("Unable to create buffer for draining ALSA.\n"); return NULL; } @@ -777,11 +777,11 @@ static void *alsa_update_recorder(ALLEGRO_THREAD *t, void *thread_data) snd_pcm_readi(alsa->capture_handle, null_buffer, 1024); } else { - ALLEGRO_AUDIO_RECORDER_EVENT *e; + A5O_AUDIO_RECORDER_EVENT *e; snd_pcm_sframes_t count; al_unlock_mutex(r->mutex); if ((count = snd_pcm_readi(alsa->capture_handle, r->fragments[fragment_i], r->samples)) > 0) { - user_event.user.type = ALLEGRO_EVENT_AUDIO_RECORDER_FRAGMENT; + user_event.user.type = A5O_EVENT_AUDIO_RECORDER_FRAGMENT; e = al_get_audio_recorder_event(&user_event); e->buffer = r->fragments[fragment_i]; e->samples = count; @@ -798,7 +798,7 @@ static void *alsa_update_recorder(ALLEGRO_THREAD *t, void *thread_data) return NULL; } -static int alsa_allocate_recorder(ALLEGRO_AUDIO_RECORDER *r) +static int alsa_allocate_recorder(A5O_AUDIO_RECORDER *r) { ALSA_RECORDER_DATA *data; unsigned int frequency = r->frequency; @@ -816,19 +816,19 @@ static int alsa_allocate_recorder(ALLEGRO_AUDIO_RECORDER *r) goto Error; } - if (r->depth == ALLEGRO_AUDIO_DEPTH_INT8) + if (r->depth == A5O_AUDIO_DEPTH_INT8) format = SND_PCM_FORMAT_S8; - else if (r->depth == ALLEGRO_AUDIO_DEPTH_UINT8) + else if (r->depth == A5O_AUDIO_DEPTH_UINT8) format = SND_PCM_FORMAT_U8; - else if (r->depth == ALLEGRO_AUDIO_DEPTH_INT16) + else if (r->depth == A5O_AUDIO_DEPTH_INT16) format = SND_PCM_FORMAT_S16; - else if (r->depth == ALLEGRO_AUDIO_DEPTH_UINT16) + else if (r->depth == A5O_AUDIO_DEPTH_UINT16) format = SND_PCM_FORMAT_U16; - else if (r->depth == ALLEGRO_AUDIO_DEPTH_INT24) + else if (r->depth == A5O_AUDIO_DEPTH_INT24) format = SND_PCM_FORMAT_S24; - else if (r->depth == ALLEGRO_AUDIO_DEPTH_UINT24) + else if (r->depth == A5O_AUDIO_DEPTH_UINT24) format = SND_PCM_FORMAT_U24; - else if (r->depth == ALLEGRO_AUDIO_DEPTH_FLOAT32) + else if (r->depth == A5O_AUDIO_DEPTH_FLOAT32) format = SND_PCM_FORMAT_FLOAT; else goto Error; @@ -841,7 +841,7 @@ static int alsa_allocate_recorder(ALLEGRO_AUDIO_RECORDER *r) ALSA_CHECK(snd_pcm_hw_params_set_rate_near(data->capture_handle, data->hw_params, &frequency, 0)); if (frequency != r->frequency) { - ALLEGRO_ERROR("Unsupported rate! Requested %u, got %iu.\n", r->frequency, frequency); + A5O_ERROR("Unsupported rate! Requested %u, got %iu.\n", r->frequency, frequency); goto Error; } @@ -870,7 +870,7 @@ static int alsa_allocate_recorder(ALLEGRO_AUDIO_RECORDER *r) return 1; } -static void alsa_deallocate_recorder(ALLEGRO_AUDIO_RECORDER *r) +static void alsa_deallocate_recorder(A5O_AUDIO_RECORDER *r) { ALSA_RECORDER_DATA *data = r->extra; @@ -882,7 +882,7 @@ static void _output_device_list_dtor(void* value, void* userdata) { (void)userdata; - ALLEGRO_AUDIO_DEVICE* device = (ALLEGRO_AUDIO_DEVICE*)value; + A5O_AUDIO_DEVICE* device = (A5O_AUDIO_DEVICE*)value; al_free(device->name); al_free(device->identifier); al_free(device); @@ -897,7 +897,7 @@ static _AL_LIST* alsa_get_output_devices(void) int rcard = -1; while(snd_card_next(&rcard) == 0) { if (rcard < 0) { - ALLEGRO_WARN("snd_card_next returned a bad card %d.\n", rcard); + A5O_WARN("snd_card_next returned a bad card %d.\n", rcard); /* Something is really messed up, so bail out. */ return output_device_list; } @@ -908,7 +908,7 @@ static _AL_LIST* alsa_get_output_devices(void) snprintf(str, sizeof str, "hw:%i", rcard); res = snd_ctl_open(&handle, str, 0); if (res < 0) { - ALLEGRO_WARN("snd_ctl_open on '%s' failed with code %d.\n", str, res); + A5O_WARN("snd_ctl_open on '%s' failed with code %d.\n", str, res); continue; } @@ -916,7 +916,7 @@ static _AL_LIST* alsa_get_output_devices(void) snd_ctl_card_info_alloca(&card_info); res = snd_ctl_card_info(handle, card_info); if (res < 0) { - ALLEGRO_WARN("snd_ctl_card_info on '%s' failed with code %d.\n", str, res); + A5O_WARN("snd_ctl_card_info on '%s' failed with code %d.\n", str, res); continue; } @@ -930,14 +930,14 @@ static _AL_LIST* alsa_get_output_devices(void) } if (dev_num < 0) { - ALLEGRO_WARN("Invalid device number for card %d.\n", rcard); + A5O_WARN("Invalid device number for card %d.\n", rcard); break; } void **hints; res = snd_device_name_hint(dev_num, "pcm", &hints); if (res < 0) { - ALLEGRO_WARN("snd_device_name_hint for card %d, device %d failed with error code %d\n", + A5O_WARN("snd_device_name_hint for card %d, device %d failed with error code %d\n", rcard, dev_num, res); continue; } @@ -964,7 +964,7 @@ static _AL_LIST* alsa_get_output_devices(void) snd_device_name_free_hint(hints); free(identifier); free(name); - ALLEGRO_WARN("Could not find identifier/name for card %d, device %d\n", + A5O_WARN("Could not find identifier/name for card %d, device %d\n", rcard, dev_num); continue; } @@ -976,7 +976,7 @@ static _AL_LIST* alsa_get_output_devices(void) int len = strlen(actual_name) + strlen(card_name) + 1 + 1; int identifier_len = strlen(identifier) + 1; - ALLEGRO_AUDIO_DEVICE* device = (ALLEGRO_AUDIO_DEVICE*)al_malloc(sizeof(ALLEGRO_AUDIO_DEVICE)); + A5O_AUDIO_DEVICE* device = (A5O_AUDIO_DEVICE*)al_malloc(sizeof(A5O_AUDIO_DEVICE)); device->identifier = (char*)al_malloc(identifier_len); device->name = (char*)al_malloc(len); @@ -997,7 +997,7 @@ static _AL_LIST* alsa_get_output_devices(void) return output_device_list; } -ALLEGRO_AUDIO_DRIVER _al_kcm_alsa_driver = +A5O_AUDIO_DRIVER _al_kcm_alsa_driver = { "ALSA", diff --git a/addons/audio/aqueue.m b/addons/audio/aqueue.m index e3e87727eb..54611ad646 100644 --- a/addons/audio/aqueue.m +++ b/addons/audio/aqueue.m @@ -27,7 +27,7 @@ #import #import -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE #import #endif @@ -41,20 +41,20 @@ #define BUFFER_SIZE 1024*2 // in samples #define NUM_BUFFERS 4 -ALLEGRO_DEBUG_CHANNEL("AudioQueue") +A5O_DEBUG_CHANNEL("AudioQueue") -typedef struct ALLEGRO_AQ_DATA { +typedef struct A5O_AQ_DATA { int bits_per_sample; int channels; bool playing; unsigned int buffer_size; unsigned char *silence; - ALLEGRO_VOICE *voice; + A5O_VOICE *voice; AudioQueueRef queue; AudioQueueBufferRef buffers[NUM_BUFFERS]; -} ALLEGRO_AQ_DATA; +} A5O_AQ_DATA; -static _AL_VECTOR saved_voices = _AL_VECTOR_INITIALIZER(ALLEGRO_VOICE*); +static _AL_VECTOR saved_voices = _AL_VECTOR_INITIALIZER(A5O_VOICE*); static _AL_LIST* output_device_list; /* Audio queue callback */ @@ -63,7 +63,7 @@ static void handle_buffer( AudioQueueRef inAQ, AudioQueueBufferRef inBuffer) { - ALLEGRO_AQ_DATA *ex_data = in_data; + A5O_AQ_DATA *ex_data = in_data; const void *data; (void)inAQ; // unsused @@ -77,7 +77,7 @@ static void handle_buffer( unsigned int copy_bytes = samples * ex_data->channels * (ex_data->bits_per_sample / 8); - copy_bytes = _ALLEGRO_MIN(copy_bytes, inBuffer->mAudioDataBytesCapacity); + copy_bytes = _A5O_MIN(copy_bytes, inBuffer->mAudioDataBytesCapacity); memcpy(inBuffer->mAudioData, data, copy_bytes); inBuffer->mAudioDataByteSize = copy_bytes; @@ -90,16 +90,16 @@ static void handle_buffer( ); } -#ifdef ALLEGRO_IPHONE -static int _aqueue_start_voice(ALLEGRO_VOICE *voice); -static int _aqueue_stop_voice(ALLEGRO_VOICE* voice); +#ifdef A5O_IPHONE +static int _aqueue_start_voice(A5O_VOICE *voice); +static int _aqueue_stop_voice(A5O_VOICE* voice); static void interruption_callback(void *inClientData, UInt32 inInterruptionState) { unsigned i; (void)inClientData; for (i = 0; i < _al_vector_size(&saved_voices); i++) { - ALLEGRO_VOICE **voice = _al_vector_ref(&saved_voices, i); + A5O_VOICE **voice = _al_vector_ref(&saved_voices, i); if (inInterruptionState == kAudioSessionBeginInterruption) { _aqueue_stop_voice(*voice); } @@ -118,7 +118,7 @@ static void property_listener(void *inClientData, AudioSessionPropertyID inID, U if (inID == kAudioSessionProperty_AudioRouteChange) { for (i = 0; i < _al_vector_size(&saved_voices); i++) { - ALLEGRO_VOICE **voice = _al_vector_ref(&saved_voices, i); + A5O_VOICE **voice = _al_vector_ref(&saved_voices, i); UInt32 reason = (UInt32)inData; if (reason == kAudioSessionRouteChangeReason_NewDeviceAvailable) { _aqueue_stop_voice(*voice); @@ -166,7 +166,7 @@ static void _output_device_list_dtor(void* value, void* userdata) { (void)userdata; - ALLEGRO_AUDIO_DEVICE* device = (ALLEGRO_AUDIO_DEVICE*)value; + A5O_AUDIO_DEVICE* device = (A5O_AUDIO_DEVICE*)value; al_free(device->name); al_free(device->identifier); al_free(device); @@ -217,7 +217,7 @@ static void _aqueue_list_audio_output_devices(void) } if (_aqueue_device_has_scope(deviceIDs[idx], kAudioObjectPropertyScopeOutput)) { - ALLEGRO_AUDIO_DEVICE* device = (ALLEGRO_AUDIO_DEVICE*)al_malloc(sizeof(ALLEGRO_AUDIO_DEVICE)); + A5O_AUDIO_DEVICE* device = (A5O_AUDIO_DEVICE*)al_malloc(sizeof(A5O_AUDIO_DEVICE)); device->identifier = (void*)al_malloc(sizeof(AudioDeviceID)); device->name = (char*)al_malloc(sizeof(deviceName)); @@ -236,7 +236,7 @@ static void _aqueue_list_audio_output_devices(void) audio data to the device yet, however. */ static int _aqueue_open(void) { -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE /* These settings allow ipod music playback simultaneously with * our Allegro music/sfx, and also do not stop the streams when * a phone call comes in (it's muted for the duration of the call). @@ -271,16 +271,16 @@ static void _aqueue_close(void) /* The allocate_voice method should grab a voice from the system, and allocate any data common to streaming and non-streaming sources. */ -static int _aqueue_allocate_voice(ALLEGRO_VOICE *voice) +static int _aqueue_allocate_voice(A5O_VOICE *voice) { - ALLEGRO_AQ_DATA *ex_data; + A5O_AQ_DATA *ex_data; int bits_per_sample; int channels; switch (voice->depth) { - case ALLEGRO_AUDIO_DEPTH_UINT16: - case ALLEGRO_AUDIO_DEPTH_INT16: + case A5O_AUDIO_DEPTH_UINT16: + case A5O_AUDIO_DEPTH_INT16: bits_per_sample = 16; break; default: @@ -288,10 +288,10 @@ static int _aqueue_allocate_voice(ALLEGRO_VOICE *voice) } switch (voice->chan_conf) { - case ALLEGRO_CHANNEL_CONF_1: + case A5O_CHANNEL_CONF_1: channels = 1; break; - case ALLEGRO_CHANNEL_CONF_2: + case A5O_CHANNEL_CONF_2: channels = 2; break; default: @@ -299,7 +299,7 @@ static int _aqueue_allocate_voice(ALLEGRO_VOICE *voice) return 1; } - ex_data = (ALLEGRO_AQ_DATA *)al_calloc(1, sizeof(*ex_data)); + ex_data = (A5O_AQ_DATA *)al_calloc(1, sizeof(*ex_data)); if (!ex_data) { fprintf(stderr, "Could not allocate voice data memory\n"); return 1; @@ -321,9 +321,9 @@ static int _aqueue_allocate_voice(ALLEGRO_VOICE *voice) /* The deallocate_voice method should free the resources for the given voice, but still retain a hold on the device. The voice should be stopped and unloaded by the time this is called */ -static void _aqueue_deallocate_voice(ALLEGRO_VOICE *voice) +static void _aqueue_deallocate_voice(A5O_VOICE *voice) { - ALLEGRO_AQ_DATA *ex_data = voice->extra; + A5O_AQ_DATA *ex_data = voice->extra; al_free(ex_data->silence); al_free(ex_data); voice->extra = NULL; @@ -334,7 +334,7 @@ static void _aqueue_deallocate_voice(ALLEGRO_VOICE *voice) 'buffer_size' field will be the total length in bytes of the sample data. The voice's attached sample's looping mode should be honored, and loading must fail if it cannot be. */ -static int _aqueue_load_voice(ALLEGRO_VOICE *voice, const void *data) +static int _aqueue_load_voice(A5O_VOICE *voice, const void *data) { /* FIXME */ (void)voice; @@ -344,7 +344,7 @@ static int _aqueue_load_voice(ALLEGRO_VOICE *voice, const void *data) /* The unload_voice method unloads a sample previously loaded with load_voice. This method should not be called on a streaming voice. */ -static void _aqueue_unload_voice(ALLEGRO_VOICE *voice) +static void _aqueue_unload_voice(A5O_VOICE *voice) { /* FIXME */ (void)voice; @@ -355,20 +355,20 @@ static void _aqueue_unload_voice(ALLEGRO_VOICE *voice) { THREAD_BEGIN - ALLEGRO_VOICE *voice = in_data; - ALLEGRO_AQ_DATA *ex_data = voice->extra; + A5O_VOICE *voice = in_data; + A5O_AQ_DATA *ex_data = voice->extra; AudioStreamBasicDescription desc; desc.mSampleRate = voice->frequency; desc.mFormatID = kAudioFormatLinearPCM; - if (voice->depth == ALLEGRO_AUDIO_DEPTH_INT16) + if (voice->depth == A5O_AUDIO_DEPTH_INT16) desc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked; else desc.mFormatFlags = kLinearPCMFormatFlagIsFloat | kLinearPCMFormatFlagIsPacked; -#ifdef ALLEGRO_BIG_ENDIAN +#ifdef A5O_BIG_ENDIAN desc.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian; #endif desc.mBytesPerPacket = ex_data->channels * (ex_data->bits_per_sample/8); @@ -440,12 +440,12 @@ static void _aqueue_unload_voice(ALLEGRO_VOICE *voice) should start polling the device and call _al_voice_update for audio data. For non-streaming voices, it should resume playing from the last set position */ -static int _aqueue_start_voice(ALLEGRO_VOICE *voice) +static int _aqueue_start_voice(A5O_VOICE *voice) { - ALLEGRO_AQ_DATA *ex_data = voice->extra; + A5O_AQ_DATA *ex_data = voice->extra; if (voice->is_streaming && !ex_data->playing) { - *(ALLEGRO_VOICE**)_al_vector_alloc_back(&saved_voices) = voice; + *(A5O_VOICE**)_al_vector_alloc_back(&saved_voices) = voice; ex_data->playing = true; al_run_detached_thread(stream_proc, voice); return 0; @@ -458,9 +458,9 @@ static int _aqueue_start_voice(ALLEGRO_VOICE *voice) /* The stop_voice method should stop playback. For non-streaming voices, it should leave the data loaded, and reset the voice position to 0. */ -static int _aqueue_stop_voice(ALLEGRO_VOICE* voice) +static int _aqueue_stop_voice(A5O_VOICE* voice) { - ALLEGRO_AQ_DATA *ex_data = voice->extra; + A5O_AQ_DATA *ex_data = voice->extra; if (ex_data->playing) { _al_vector_find_and_delete(&saved_voices, &voice); @@ -477,9 +477,9 @@ static int _aqueue_stop_voice(ALLEGRO_VOICE* voice) /* The voice_is_playing method should only be called on non-streaming sources, and should return true if the voice is playing */ -static bool _aqueue_voice_is_playing(const ALLEGRO_VOICE *voice) +static bool _aqueue_voice_is_playing(const A5O_VOICE *voice) { - ALLEGRO_AQ_DATA *ex_data = (ALLEGRO_AQ_DATA *)voice->extra; + A5O_AQ_DATA *ex_data = (A5O_AQ_DATA *)voice->extra; return ex_data->playing; } @@ -487,7 +487,7 @@ static bool _aqueue_voice_is_playing(const ALLEGRO_VOICE *voice) /* The get_voice_position method should return the current sample position of the voice (sample_pos = byte_pos / (depth/8) / channels). This should never be called on a streaming voice. */ -static unsigned int _aqueue_get_voice_position(const ALLEGRO_VOICE *voice) +static unsigned int _aqueue_get_voice_position(const A5O_VOICE *voice) { /* FIXME */ (void)voice; @@ -497,7 +497,7 @@ static unsigned int _aqueue_get_voice_position(const ALLEGRO_VOICE *voice) /* The set_voice_position method should set the voice's playback position, given the value in samples. This should never be called on a streaming voice. */ -static int _aqueue_set_voice_position(ALLEGRO_VOICE *voice, unsigned int val) +static int _aqueue_set_voice_position(A5O_VOICE *voice, unsigned int val) { /* FIXME */ (void)voice; @@ -528,7 +528,7 @@ static void _aqueue_recording_callback(void *user_data, AudioQueueRef aq, AudioQueueBufferRef aq_buffer, const AudioTimeStamp *start_time, UInt32 sample_count, const AudioStreamPacketDescription *descs) { - ALLEGRO_AUDIO_RECORDER *recorder = (ALLEGRO_AUDIO_RECORDER *) user_data; + A5O_AUDIO_RECORDER *recorder = (A5O_AUDIO_RECORDER *) user_data; RECORDER_DATA *data = (RECORDER_DATA *) recorder->extra; char *input = aq_buffer->mAudioData; @@ -559,12 +559,12 @@ static void _aqueue_recording_callback(void *user_data, AudioQueueRef aq, sample_count -= samples_to_write; /* We should have never written more samples than the user asked for */ - ALLEGRO_ASSERT(recorder->samples >= data->samples_written); + A5O_ASSERT(recorder->samples >= data->samples_written); if (data->samples_written == recorder->samples) { - ALLEGRO_EVENT user_event; - ALLEGRO_AUDIO_RECORDER_EVENT *e; - user_event.user.type = ALLEGRO_EVENT_AUDIO_RECORDER_FRAGMENT; + A5O_EVENT user_event; + A5O_AUDIO_RECORDER_EVENT *e; + user_event.user.type = A5O_EVENT_AUDIO_RECORDER_FRAGMENT; e = al_get_audio_recorder_event(&user_event); e->buffer = recorder->fragments[data->fragment_i]; e->samples = recorder->samples; @@ -585,7 +585,7 @@ static void _aqueue_recording_callback(void *user_data, AudioQueueRef aq, AudioQueueEnqueueBuffer(data->queue, aq_buffer, 0, NULL); } -static int _aqueue_allocate_recorder(ALLEGRO_AUDIO_RECORDER *recorder) +static int _aqueue_allocate_recorder(A5O_AUDIO_RECORDER *recorder) { RECORDER_DATA *data; int i; @@ -610,12 +610,12 @@ static int _aqueue_allocate_recorder(ALLEGRO_AUDIO_RECORDER *recorder) data->data_format.mBytesPerPacket = data->data_format.mChannelsPerFrame * al_get_audio_depth_size(recorder->depth); data->data_format.mFormatFlags = kLinearPCMFormatFlagIsPacked; -#ifdef ALLEGRO_BIG_ENDIAN +#ifdef A5O_BIG_ENDIAN data->data_format.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian; #endif - if (recorder->depth == ALLEGRO_AUDIO_DEPTH_FLOAT32) + if (recorder->depth == A5O_AUDIO_DEPTH_FLOAT32) data->data_format.mFormatFlags |= kLinearPCMFormatFlagIsFloat; - else if (!(recorder->depth & ALLEGRO_AUDIO_DEPTH_UNSIGNED)) + else if (!(recorder->depth & A5O_AUDIO_DEPTH_UNSIGNED)) data->data_format.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger; data->buffer_size = 2048; // in bytes @@ -631,7 +631,7 @@ static int _aqueue_allocate_recorder(ALLEGRO_AUDIO_RECORDER *recorder) ); if (ret) { - ALLEGRO_ERROR("AudioQueueNewInput failed (%d)\n", ret); + A5O_ERROR("AudioQueueNewInput failed (%d)\n", ret); al_free(data->buffers); al_free(data); return 1; @@ -652,7 +652,7 @@ static int _aqueue_allocate_recorder(ALLEGRO_AUDIO_RECORDER *recorder) return 0; } -static void _aqueue_deallocate_recorder(ALLEGRO_AUDIO_RECORDER *recorder) +static void _aqueue_deallocate_recorder(A5O_AUDIO_RECORDER *recorder) { RECORDER_DATA *data = (RECORDER_DATA *) recorder->extra; @@ -663,7 +663,7 @@ static void _aqueue_deallocate_recorder(ALLEGRO_AUDIO_RECORDER *recorder) al_free(data); } -ALLEGRO_AUDIO_DRIVER _al_kcm_aqueue_driver = { +A5O_AUDIO_DRIVER _al_kcm_aqueue_driver = { "Apple Audio Queues", _aqueue_open, diff --git a/addons/audio/audio.c b/addons/audio/audio.c index 6a2a94a6a4..e53c64ed80 100644 --- a/addons/audio/audio.c +++ b/addons/audio/audio.c @@ -16,45 +16,45 @@ #include "allegro5/internal/aintern_audio.h" #include "allegro5/internal/aintern_audio_cfg.h" -ALLEGRO_DEBUG_CHANNEL("audio") +A5O_DEBUG_CHANNEL("audio") void _al_set_error(int error, char* string) { - ALLEGRO_ERROR("%s (error code: %d)\n", string, error); + A5O_ERROR("%s (error code: %d)\n", string, error); } -ALLEGRO_AUDIO_DRIVER *_al_kcm_driver = NULL; +A5O_AUDIO_DRIVER *_al_kcm_driver = NULL; -#if defined(ALLEGRO_CFG_KCM_OPENAL) - extern struct ALLEGRO_AUDIO_DRIVER _al_kcm_openal_driver; +#if defined(A5O_CFG_KCM_OPENAL) + extern struct A5O_AUDIO_DRIVER _al_kcm_openal_driver; #endif -#if defined(ALLEGRO_CFG_KCM_OPENSL) - extern struct ALLEGRO_AUDIO_DRIVER _al_kcm_opensl_driver; +#if defined(A5O_CFG_KCM_OPENSL) + extern struct A5O_AUDIO_DRIVER _al_kcm_opensl_driver; #endif -#if defined(ALLEGRO_CFG_KCM_ALSA) - extern struct ALLEGRO_AUDIO_DRIVER _al_kcm_alsa_driver; +#if defined(A5O_CFG_KCM_ALSA) + extern struct A5O_AUDIO_DRIVER _al_kcm_alsa_driver; #endif -#if defined(ALLEGRO_CFG_KCM_OSS) - extern struct ALLEGRO_AUDIO_DRIVER _al_kcm_oss_driver; +#if defined(A5O_CFG_KCM_OSS) + extern struct A5O_AUDIO_DRIVER _al_kcm_oss_driver; #endif -#if defined(ALLEGRO_CFG_KCM_DSOUND) - extern struct ALLEGRO_AUDIO_DRIVER _al_kcm_dsound_driver; +#if defined(A5O_CFG_KCM_DSOUND) + extern struct A5O_AUDIO_DRIVER _al_kcm_dsound_driver; #endif -#if defined(ALLEGRO_CFG_KCM_AQUEUE) - extern struct ALLEGRO_AUDIO_DRIVER _al_kcm_aqueue_driver; +#if defined(A5O_CFG_KCM_AQUEUE) + extern struct A5O_AUDIO_DRIVER _al_kcm_aqueue_driver; #endif -#if defined(ALLEGRO_CFG_KCM_PULSEAUDIO) - extern struct ALLEGRO_AUDIO_DRIVER _al_kcm_pulseaudio_driver; +#if defined(A5O_CFG_KCM_PULSEAUDIO) + extern struct A5O_AUDIO_DRIVER _al_kcm_pulseaudio_driver; #endif -#if defined(ALLEGRO_SDL) - extern struct ALLEGRO_AUDIO_DRIVER _al_kcm_sdl_driver; +#if defined(A5O_SDL) + extern struct A5O_AUDIO_DRIVER _al_kcm_sdl_driver; #endif /* Channel configuration helpers */ /* Function: al_get_channel_count */ -size_t al_get_channel_count(ALLEGRO_CHANNEL_CONF conf) +size_t al_get_channel_count(A5O_CHANNEL_CONF conf) { return (conf>>4)+(conf&0xF); } @@ -62,19 +62,19 @@ size_t al_get_channel_count(ALLEGRO_CHANNEL_CONF conf) /* Depth configuration helpers */ /* Function: al_get_audio_depth_size */ -size_t al_get_audio_depth_size(ALLEGRO_AUDIO_DEPTH depth) +size_t al_get_audio_depth_size(A5O_AUDIO_DEPTH depth) { switch (depth) { - case ALLEGRO_AUDIO_DEPTH_INT8: - case ALLEGRO_AUDIO_DEPTH_UINT8: + case A5O_AUDIO_DEPTH_INT8: + case A5O_AUDIO_DEPTH_UINT8: return sizeof(int8_t); - case ALLEGRO_AUDIO_DEPTH_INT16: - case ALLEGRO_AUDIO_DEPTH_UINT16: + case A5O_AUDIO_DEPTH_INT16: + case A5O_AUDIO_DEPTH_UINT16: return sizeof(int16_t); - case ALLEGRO_AUDIO_DEPTH_INT24: - case ALLEGRO_AUDIO_DEPTH_UINT24: + case A5O_AUDIO_DEPTH_INT24: + case A5O_AUDIO_DEPTH_UINT24: return sizeof(int32_t); - case ALLEGRO_AUDIO_DEPTH_FLOAT32: + case A5O_AUDIO_DEPTH_FLOAT32: return sizeof(float); default: ASSERT(false); @@ -83,40 +83,40 @@ size_t al_get_audio_depth_size(ALLEGRO_AUDIO_DEPTH depth) } /* FIXME: use the allegro provided helpers */ -ALLEGRO_CHANNEL_CONF _al_count_to_channel_conf(int num_channels) +A5O_CHANNEL_CONF _al_count_to_channel_conf(int num_channels) { switch (num_channels) { case 1: - return ALLEGRO_CHANNEL_CONF_1; + return A5O_CHANNEL_CONF_1; case 2: - return ALLEGRO_CHANNEL_CONF_2; + return A5O_CHANNEL_CONF_2; case 3: - return ALLEGRO_CHANNEL_CONF_3; + return A5O_CHANNEL_CONF_3; case 4: - return ALLEGRO_CHANNEL_CONF_4; + return A5O_CHANNEL_CONF_4; case 6: - return ALLEGRO_CHANNEL_CONF_5_1; + return A5O_CHANNEL_CONF_5_1; case 7: - return ALLEGRO_CHANNEL_CONF_6_1; + return A5O_CHANNEL_CONF_6_1; case 8: - return ALLEGRO_CHANNEL_CONF_7_1; + return A5O_CHANNEL_CONF_7_1; default: return 0; } } /* FIXME: assumes 8-bit is unsigned, and all others are signed. */ -ALLEGRO_AUDIO_DEPTH _al_word_size_to_depth_conf(int word_size) +A5O_AUDIO_DEPTH _al_word_size_to_depth_conf(int word_size) { switch (word_size) { case 1: - return ALLEGRO_AUDIO_DEPTH_UINT8; + return A5O_AUDIO_DEPTH_UINT8; case 2: - return ALLEGRO_AUDIO_DEPTH_INT16; + return A5O_AUDIO_DEPTH_INT16; case 3: - return ALLEGRO_AUDIO_DEPTH_INT24; + return A5O_AUDIO_DEPTH_INT24; case 4: - return ALLEGRO_AUDIO_DEPTH_FLOAT32; + return A5O_AUDIO_DEPTH_FLOAT32; default: return 0; } @@ -125,22 +125,22 @@ ALLEGRO_AUDIO_DEPTH _al_word_size_to_depth_conf(int word_size) /* Function: al_fill_silence */ void al_fill_silence(void *buf, unsigned int samples, - ALLEGRO_AUDIO_DEPTH depth, ALLEGRO_CHANNEL_CONF chan_conf) + A5O_AUDIO_DEPTH depth, A5O_CHANNEL_CONF chan_conf) { size_t bytes = samples * al_get_audio_depth_size(depth) * al_get_channel_count(chan_conf); switch (depth) { - case ALLEGRO_AUDIO_DEPTH_INT8: - case ALLEGRO_AUDIO_DEPTH_INT16: - case ALLEGRO_AUDIO_DEPTH_INT24: - case ALLEGRO_AUDIO_DEPTH_FLOAT32: + case A5O_AUDIO_DEPTH_INT8: + case A5O_AUDIO_DEPTH_INT16: + case A5O_AUDIO_DEPTH_INT24: + case A5O_AUDIO_DEPTH_FLOAT32: memset(buf, 0, bytes); break; - case ALLEGRO_AUDIO_DEPTH_UINT8: + case A5O_AUDIO_DEPTH_UINT8: memset(buf, 0x80, bytes); break; - case ALLEGRO_AUDIO_DEPTH_UINT16: + case A5O_AUDIO_DEPTH_UINT16: { uint16_t *buffer = buf; size_t n = bytes / sizeof(uint16_t); @@ -150,7 +150,7 @@ void al_fill_silence(void *buf, unsigned int samples, buffer[i] = 0x8000; } break; - case ALLEGRO_AUDIO_DEPTH_UINT24: + case A5O_AUDIO_DEPTH_UINT24: { uint32_t *buffer = buf; size_t n = bytes / sizeof(uint32_t); @@ -166,34 +166,34 @@ void al_fill_silence(void *buf, unsigned int samples, } } -static ALLEGRO_AUDIO_DRIVER_ENUM get_config_audio_driver(void) +static A5O_AUDIO_DRIVER_ENUM get_config_audio_driver(void) { - ALLEGRO_CONFIG *config = al_get_system_config(); + A5O_CONFIG *config = al_get_system_config(); const char *value; value = al_get_config_value(config, "audio", "driver"); if (!value || value[0] == '\0') - return ALLEGRO_AUDIO_DRIVER_AUTODETECT; + return A5O_AUDIO_DRIVER_AUTODETECT; if (0 == _al_stricmp(value, "ALSA")) - return ALLEGRO_AUDIO_DRIVER_ALSA; + return A5O_AUDIO_DRIVER_ALSA; if (0 == _al_stricmp(value, "OPENAL")) - return ALLEGRO_AUDIO_DRIVER_OPENAL; + return A5O_AUDIO_DRIVER_OPENAL; if (0 == _al_stricmp(value, "OPENSL")) - return ALLEGRO_AUDIO_DRIVER_OPENSL; + return A5O_AUDIO_DRIVER_OPENSL; if (0 == _al_stricmp(value, "OSS")) - return ALLEGRO_AUDIO_DRIVER_OSS; + return A5O_AUDIO_DRIVER_OSS; if (0 == _al_stricmp(value, "PULSEAUDIO")) - return ALLEGRO_AUDIO_DRIVER_PULSEAUDIO; + return A5O_AUDIO_DRIVER_PULSEAUDIO; if (0 == _al_stricmp(value, "DSOUND") || 0 == _al_stricmp(value, "DIRECTSOUND")) - return ALLEGRO_AUDIO_DRIVER_DSOUND; + return A5O_AUDIO_DRIVER_DSOUND; - return ALLEGRO_AUDIO_DRIVER_AUTODETECT; + return A5O_AUDIO_DRIVER_AUTODETECT; } /* Function: al_get_num_audio_output_devices @@ -215,7 +215,7 @@ int al_get_num_audio_output_devices() /* Function: al_get_audio_output_device */ -const ALLEGRO_AUDIO_DEVICE* al_get_audio_output_device(int index) +const A5O_AUDIO_DEVICE* al_get_audio_output_device(int index) { if (_al_kcm_driver) { if (_al_kcm_driver->get_output_devices) { @@ -235,34 +235,34 @@ const ALLEGRO_AUDIO_DEVICE* al_get_audio_output_device(int index) /* Function: al_get_audio_device_name */ -const char* al_get_audio_device_name(const ALLEGRO_AUDIO_DEVICE * device) +const char* al_get_audio_device_name(const A5O_AUDIO_DEVICE * device) { return device ? device->name : NULL; } -static bool do_install_audio(ALLEGRO_AUDIO_DRIVER_ENUM mode) +static bool do_install_audio(A5O_AUDIO_DRIVER_ENUM mode) { bool retVal; /* check to see if a driver is already installed and running */ if (_al_kcm_driver) { - _al_set_error(ALLEGRO_GENERIC_ERROR, "A driver already running"); + _al_set_error(A5O_GENERIC_ERROR, "A driver already running"); return false; } - if (mode == ALLEGRO_AUDIO_DRIVER_AUTODETECT) { + if (mode == A5O_AUDIO_DRIVER_AUTODETECT) { mode = get_config_audio_driver(); } switch (mode) { - case ALLEGRO_AUDIO_DRIVER_AUTODETECT: -#if defined(ALLEGRO_SDL) - retVal = do_install_audio(ALLEGRO_AUDIO_DRIVER_SDL); + case A5O_AUDIO_DRIVER_AUTODETECT: +#if defined(A5O_SDL) + retVal = do_install_audio(A5O_AUDIO_DRIVER_SDL); if (retVal) return retVal; #endif -#if defined(ALLEGRO_CFG_KCM_AQUEUE) - retVal = do_install_audio(ALLEGRO_AUDIO_DRIVER_AQUEUE); +#if defined(A5O_CFG_KCM_AQUEUE) + retVal = do_install_audio(A5O_AUDIO_DRIVER_AQUEUE); if (retVal) return retVal; #endif @@ -272,147 +272,147 @@ static bool do_install_audio(ALLEGRO_AUDIO_DRIVER_ENUM mode) * FIXME: Detect if no PA server is running and in that case prefer * ALSA and OSS first. */ -#if defined(ALLEGRO_CFG_KCM_PULSEAUDIO) - retVal = do_install_audio(ALLEGRO_AUDIO_DRIVER_PULSEAUDIO); +#if defined(A5O_CFG_KCM_PULSEAUDIO) + retVal = do_install_audio(A5O_AUDIO_DRIVER_PULSEAUDIO); if (retVal) return retVal; #endif -#if defined(ALLEGRO_CFG_KCM_ALSA) - retVal = do_install_audio(ALLEGRO_AUDIO_DRIVER_ALSA); +#if defined(A5O_CFG_KCM_ALSA) + retVal = do_install_audio(A5O_AUDIO_DRIVER_ALSA); if (retVal) return retVal; #endif -#if defined(ALLEGRO_CFG_KCM_DSOUND) - retVal = do_install_audio(ALLEGRO_AUDIO_DRIVER_DSOUND); +#if defined(A5O_CFG_KCM_DSOUND) + retVal = do_install_audio(A5O_AUDIO_DRIVER_DSOUND); if (retVal) return retVal; #endif -#if defined(ALLEGRO_CFG_KCM_OSS) - retVal = do_install_audio(ALLEGRO_AUDIO_DRIVER_OSS); +#if defined(A5O_CFG_KCM_OSS) + retVal = do_install_audio(A5O_AUDIO_DRIVER_OSS); if (retVal) return retVal; #endif -#if defined(ALLEGRO_CFG_KCM_OPENAL) - retVal = do_install_audio(ALLEGRO_AUDIO_DRIVER_OPENAL); +#if defined(A5O_CFG_KCM_OPENAL) + retVal = do_install_audio(A5O_AUDIO_DRIVER_OPENAL); if (retVal) return retVal; #endif -#if defined(ALLEGRO_CFG_KCM_OPENSL) - retVal = do_install_audio(ALLEGRO_AUDIO_DRIVER_OPENSL); +#if defined(A5O_CFG_KCM_OPENSL) + retVal = do_install_audio(A5O_AUDIO_DRIVER_OPENSL); if (retVal) return retVal; #endif - _al_set_error(ALLEGRO_INVALID_PARAM, "No audio driver can be used."); + _al_set_error(A5O_INVALID_PARAM, "No audio driver can be used."); _al_kcm_driver = NULL; return false; - case ALLEGRO_AUDIO_DRIVER_AQUEUE: - #if defined(ALLEGRO_CFG_KCM_AQUEUE) + case A5O_AUDIO_DRIVER_AQUEUE: + #if defined(A5O_CFG_KCM_AQUEUE) if (_al_kcm_aqueue_driver.open() == 0) { - ALLEGRO_INFO("Using Apple Audio Queue driver\n"); + A5O_INFO("Using Apple Audio Queue driver\n"); _al_kcm_driver = &_al_kcm_aqueue_driver; return true; } return false; #else - _al_set_error(ALLEGRO_INVALID_PARAM, "Audio Queue driver not available on this platform"); + _al_set_error(A5O_INVALID_PARAM, "Audio Queue driver not available on this platform"); return false; #endif - case ALLEGRO_AUDIO_DRIVER_OPENAL: - #if defined(ALLEGRO_CFG_KCM_OPENAL) + case A5O_AUDIO_DRIVER_OPENAL: + #if defined(A5O_CFG_KCM_OPENAL) if (_al_kcm_openal_driver.open() == 0) { - ALLEGRO_INFO("Using OpenAL driver\n"); + A5O_INFO("Using OpenAL driver\n"); _al_kcm_driver = &_al_kcm_openal_driver; return true; } return false; #else - _al_set_error(ALLEGRO_INVALID_PARAM, "OpenAL not available on this platform"); + _al_set_error(A5O_INVALID_PARAM, "OpenAL not available on this platform"); return false; #endif - case ALLEGRO_AUDIO_DRIVER_OPENSL: - #if defined(ALLEGRO_CFG_KCM_OPENSL) + case A5O_AUDIO_DRIVER_OPENSL: + #if defined(A5O_CFG_KCM_OPENSL) if (_al_kcm_opensl_driver.open() == 0) { - ALLEGRO_INFO("Using OpenSL driver\n"); + A5O_INFO("Using OpenSL driver\n"); _al_kcm_driver = &_al_kcm_opensl_driver; return true; } return false; #else - _al_set_error(ALLEGRO_INVALID_PARAM, "OpenSL not available on this platform"); + _al_set_error(A5O_INVALID_PARAM, "OpenSL not available on this platform"); return false; #endif - case ALLEGRO_AUDIO_DRIVER_ALSA: - #if defined(ALLEGRO_CFG_KCM_ALSA) + case A5O_AUDIO_DRIVER_ALSA: + #if defined(A5O_CFG_KCM_ALSA) if (_al_kcm_alsa_driver.open() == 0) { - ALLEGRO_INFO("Using ALSA driver\n"); + A5O_INFO("Using ALSA driver\n"); _al_kcm_driver = &_al_kcm_alsa_driver; return true; } return false; #else - _al_set_error(ALLEGRO_INVALID_PARAM, "ALSA not available on this platform"); + _al_set_error(A5O_INVALID_PARAM, "ALSA not available on this platform"); return false; #endif - case ALLEGRO_AUDIO_DRIVER_OSS: - #if defined(ALLEGRO_CFG_KCM_OSS) + case A5O_AUDIO_DRIVER_OSS: + #if defined(A5O_CFG_KCM_OSS) if (_al_kcm_oss_driver.open() == 0) { - ALLEGRO_INFO("Using OSS driver\n"); + A5O_INFO("Using OSS driver\n"); _al_kcm_driver = &_al_kcm_oss_driver; return true; } return false; #else - _al_set_error(ALLEGRO_INVALID_PARAM, "OSS not available on this platform"); + _al_set_error(A5O_INVALID_PARAM, "OSS not available on this platform"); return false; #endif - case ALLEGRO_AUDIO_DRIVER_PULSEAUDIO: - #if defined(ALLEGRO_CFG_KCM_PULSEAUDIO) + case A5O_AUDIO_DRIVER_PULSEAUDIO: + #if defined(A5O_CFG_KCM_PULSEAUDIO) if (_al_kcm_pulseaudio_driver.open() == 0) { - ALLEGRO_INFO("Using PulseAudio driver\n"); + A5O_INFO("Using PulseAudio driver\n"); _al_kcm_driver = &_al_kcm_pulseaudio_driver; return true; } return false; #else - _al_set_error(ALLEGRO_INVALID_PARAM, "PulseAudio not available on this platform"); + _al_set_error(A5O_INVALID_PARAM, "PulseAudio not available on this platform"); return false; #endif - case ALLEGRO_AUDIO_DRIVER_DSOUND: - #if defined(ALLEGRO_CFG_KCM_DSOUND) + case A5O_AUDIO_DRIVER_DSOUND: + #if defined(A5O_CFG_KCM_DSOUND) if (_al_kcm_dsound_driver.open() == 0) { - ALLEGRO_INFO("Using DirectSound driver\n"); + A5O_INFO("Using DirectSound driver\n"); _al_kcm_driver = &_al_kcm_dsound_driver; return true; } return false; #else - _al_set_error(ALLEGRO_INVALID_PARAM, "DirectSound not available on this platform"); + _al_set_error(A5O_INVALID_PARAM, "DirectSound not available on this platform"); return false; #endif - case ALLEGRO_AUDIO_DRIVER_SDL: - #if defined(ALLEGRO_SDL) + case A5O_AUDIO_DRIVER_SDL: + #if defined(A5O_SDL) if (_al_kcm_sdl_driver.open() == 0) { - ALLEGRO_INFO("Using SDL driver\n"); + A5O_INFO("Using SDL driver\n"); _al_kcm_driver = &_al_kcm_sdl_driver; return true; } return false; #else - _al_set_error(ALLEGRO_INVALID_PARAM, "SDL not available on this platform"); + _al_set_error(A5O_INVALID_PARAM, "SDL not available on this platform"); return false; #endif default: - _al_set_error(ALLEGRO_INVALID_PARAM, "Invalid audio driver"); + _al_set_error(A5O_INVALID_PARAM, "Invalid audio driver"); return false; } } @@ -432,7 +432,7 @@ bool al_install_audio(void) _al_kcm_init_destructors(); _al_add_exit_func(al_uninstall_audio, "al_uninstall_audio"); - ret = do_install_audio(ALLEGRO_AUDIO_DRIVER_AUTODETECT); + ret = do_install_audio(A5O_AUDIO_DRIVER_AUTODETECT); return ret; } @@ -462,7 +462,7 @@ bool al_is_audio_installed(void) */ uint32_t al_get_allegro_audio_version(void) { - return ALLEGRO_VERSION_INT; + return A5O_VERSION_INT; } /* vim: set sts=3 sw=3 et: */ diff --git a/addons/audio/audio_io.c b/addons/audio/audio_io.c index 676ce3010b..651ba14dba 100644 --- a/addons/audio/audio_io.c +++ b/addons/audio/audio_io.c @@ -9,7 +9,7 @@ #include "allegro5/internal/aintern_exitfunc.h" #include "allegro5/internal/aintern_vector.h" -ALLEGRO_DEBUG_CHANNEL("audio") +A5O_DEBUG_CHANNEL("audio") #define MAX_EXTENSION_LENGTH (32) @@ -18,24 +18,24 @@ typedef struct ACODEC_TABLE ACODEC_TABLE; struct ACODEC_TABLE { char ext[MAX_EXTENSION_LENGTH]; - ALLEGRO_SAMPLE * (*loader)(const char *filename); - bool (*saver)(const char *filename, ALLEGRO_SAMPLE *spl); - ALLEGRO_AUDIO_STREAM *(*stream_loader)(const char *filename, + A5O_SAMPLE * (*loader)(const char *filename); + bool (*saver)(const char *filename, A5O_SAMPLE *spl); + A5O_AUDIO_STREAM *(*stream_loader)(const char *filename, size_t buffer_count, unsigned int samples); - ALLEGRO_SAMPLE * (*fs_loader)(ALLEGRO_FILE *fp); - bool (*fs_saver)(ALLEGRO_FILE *fp, ALLEGRO_SAMPLE *spl); - ALLEGRO_AUDIO_STREAM *(*fs_stream_loader)(ALLEGRO_FILE *fp, + A5O_SAMPLE * (*fs_loader)(A5O_FILE *fp); + bool (*fs_saver)(A5O_FILE *fp, A5O_SAMPLE *spl); + A5O_AUDIO_STREAM *(*fs_stream_loader)(A5O_FILE *fp, size_t buffer_count, unsigned int samples); - bool (*identifier)(ALLEGRO_FILE *fp); + bool (*identifier)(A5O_FILE *fp); }; /* globals */ static bool acodec_inited = false; static _AL_VECTOR acodec_table = _AL_VECTOR_INITIALIZER(ACODEC_TABLE); -static ALLEGRO_AUDIO_STREAM *global_stream; +static A5O_AUDIO_STREAM *global_stream; static void acodec_shutdown(void) @@ -64,7 +64,7 @@ static ACODEC_TABLE *find_acodec_table_entry(const char *ext) } -static ACODEC_TABLE *find_acodec_table_entry_for_file(ALLEGRO_FILE *f) +static ACODEC_TABLE *find_acodec_table_entry_for_file(A5O_FILE *f) { ACODEC_TABLE *ent; unsigned i; @@ -74,7 +74,7 @@ static ACODEC_TABLE *find_acodec_table_entry_for_file(ALLEGRO_FILE *f) if (ent->identifier) { int64_t pos = al_ftell(f); bool identified = ent->identifier(f); - al_fseek(f, pos, ALLEGRO_SEEK_SET); + al_fseek(f, pos, A5O_SEEK_SET); if (identified) return ent; } @@ -113,7 +113,7 @@ static ACODEC_TABLE *add_acodec_table_entry(const char *ext) /* Function: al_register_sample_loader */ bool al_register_sample_loader(const char *ext, - ALLEGRO_SAMPLE *(*loader)(const char *filename)) + A5O_SAMPLE *(*loader)(const char *filename)) { ACODEC_TABLE *ent; @@ -140,7 +140,7 @@ bool al_register_sample_loader(const char *ext, /* Function: al_register_sample_loader_f */ bool al_register_sample_loader_f(const char *ext, - ALLEGRO_SAMPLE *(*loader)(ALLEGRO_FILE* fp)) + A5O_SAMPLE *(*loader)(A5O_FILE* fp)) { ACODEC_TABLE *ent; @@ -167,7 +167,7 @@ bool al_register_sample_loader_f(const char *ext, /* Function: al_register_sample_saver */ bool al_register_sample_saver(const char *ext, - bool (*saver)(const char *filename, ALLEGRO_SAMPLE *spl)) + bool (*saver)(const char *filename, A5O_SAMPLE *spl)) { ACODEC_TABLE *ent; @@ -194,7 +194,7 @@ bool al_register_sample_saver(const char *ext, /* Function: al_register_sample_saver_f */ bool al_register_sample_saver_f(const char *ext, - bool (*saver)(ALLEGRO_FILE* fp, ALLEGRO_SAMPLE *spl)) + bool (*saver)(A5O_FILE* fp, A5O_SAMPLE *spl)) { ACODEC_TABLE *ent; @@ -221,7 +221,7 @@ bool al_register_sample_saver_f(const char *ext, /* Function: al_register_audio_stream_loader */ bool al_register_audio_stream_loader(const char *ext, - ALLEGRO_AUDIO_STREAM *(*stream_loader)(const char *filename, + A5O_AUDIO_STREAM *(*stream_loader)(const char *filename, size_t buffer_count, unsigned int samples)) { ACODEC_TABLE *ent; @@ -249,7 +249,7 @@ bool al_register_audio_stream_loader(const char *ext, /* Function: al_register_audio_stream_loader_f */ bool al_register_audio_stream_loader_f(const char *ext, - ALLEGRO_AUDIO_STREAM *(*stream_loader)(ALLEGRO_FILE* fp, + A5O_AUDIO_STREAM *(*stream_loader)(A5O_FILE* fp, size_t buffer_count, unsigned int samples)) { ACODEC_TABLE *ent; @@ -277,7 +277,7 @@ bool al_register_audio_stream_loader_f(const char *ext, /* Function: al_register_sample_identifier */ bool al_register_sample_identifier(const char *ext, - bool (*identifier)(ALLEGRO_FILE* fp)) + bool (*identifier)(A5O_FILE* fp)) { ACODEC_TABLE *ent; @@ -303,7 +303,7 @@ bool al_register_sample_identifier(const char *ext, /* Function: al_load_sample */ -ALLEGRO_SAMPLE *al_load_sample(const char *filename) +A5O_SAMPLE *al_load_sample(const char *filename) { const char *ext; ACODEC_TABLE *ent; @@ -313,7 +313,7 @@ ALLEGRO_SAMPLE *al_load_sample(const char *filename) if (!ext) { ext = strrchr(filename, '.'); if (ext == NULL) { - ALLEGRO_ERROR("Unable to determine extension for %s.\n", filename); + A5O_ERROR("Unable to determine extension for %s.\n", filename); return NULL; } } @@ -323,7 +323,7 @@ ALLEGRO_SAMPLE *al_load_sample(const char *filename) return (ent->loader)(filename); } else { - ALLEGRO_ERROR("No handler for audio file extension %s - " + A5O_ERROR("No handler for audio file extension %s - " "therefore not trying to load %s.\n", ext, filename); } @@ -333,7 +333,7 @@ ALLEGRO_SAMPLE *al_load_sample(const char *filename) /* Function: al_load_sample_f */ -ALLEGRO_SAMPLE *al_load_sample_f(ALLEGRO_FILE* fp, const char *ident) +A5O_SAMPLE *al_load_sample_f(A5O_FILE* fp, const char *ident) { ACODEC_TABLE *ent; @@ -345,7 +345,7 @@ ALLEGRO_SAMPLE *al_load_sample_f(ALLEGRO_FILE* fp, const char *ident) return (ent->fs_loader)(fp); } else { - ALLEGRO_ERROR("No handler for audio file extension %s.\n", ident); + A5O_ERROR("No handler for audio file extension %s.\n", ident); } return NULL; @@ -354,7 +354,7 @@ ALLEGRO_SAMPLE *al_load_sample_f(ALLEGRO_FILE* fp, const char *ident) /* Function: al_load_audio_stream */ -ALLEGRO_AUDIO_STREAM *al_load_audio_stream(const char *filename, +A5O_AUDIO_STREAM *al_load_audio_stream(const char *filename, size_t buffer_count, unsigned int samples) { const char *ext; @@ -365,7 +365,7 @@ ALLEGRO_AUDIO_STREAM *al_load_audio_stream(const char *filename, if (!ext) { ext = strrchr(filename, '.'); if (ext == NULL) { - ALLEGRO_ERROR("Unable to determine extension for %s.\n", filename); + A5O_ERROR("Unable to determine extension for %s.\n", filename); return NULL; } } @@ -375,7 +375,7 @@ ALLEGRO_AUDIO_STREAM *al_load_audio_stream(const char *filename, return (ent->stream_loader)(filename, buffer_count, samples); } else { - ALLEGRO_ERROR("No handler for audio file extension %s - " + A5O_ERROR("No handler for audio file extension %s - " "therefore not trying to load %s.\n", ext, filename); } @@ -385,7 +385,7 @@ ALLEGRO_AUDIO_STREAM *al_load_audio_stream(const char *filename, /* Function: al_load_audio_stream_f */ -ALLEGRO_AUDIO_STREAM *al_load_audio_stream_f(ALLEGRO_FILE* fp, const char *ident, +A5O_AUDIO_STREAM *al_load_audio_stream_f(A5O_FILE* fp, const char *ident, size_t buffer_count, unsigned int samples) { ACODEC_TABLE *ent; @@ -398,7 +398,7 @@ ALLEGRO_AUDIO_STREAM *al_load_audio_stream_f(ALLEGRO_FILE* fp, const char *ident return (ent->fs_stream_loader)(fp, buffer_count, samples); } else { - ALLEGRO_ERROR("No handler for audio file extension %s.\n", ident); + A5O_ERROR("No handler for audio file extension %s.\n", ident); } return NULL; @@ -407,21 +407,21 @@ ALLEGRO_AUDIO_STREAM *al_load_audio_stream_f(ALLEGRO_FILE* fp, const char *ident /* Function: al_play_audio_stream */ -ALLEGRO_AUDIO_STREAM *al_play_audio_stream(const char *filename) +A5O_AUDIO_STREAM *al_play_audio_stream(const char *filename) { ASSERT(filename); if (!al_get_default_mixer()) { - ALLEGRO_ERROR("No default mixer\n!"); + A5O_ERROR("No default mixer\n!"); return NULL; } al_destroy_audio_stream(global_stream); global_stream = al_load_audio_stream(filename, 4, 2048); if (!global_stream) { - ALLEGRO_ERROR("Could not play audio stream: %s.\n", filename); + A5O_ERROR("Could not play audio stream: %s.\n", filename); return NULL; } if (!al_attach_audio_stream_to_mixer(global_stream, al_get_default_mixer())) { - ALLEGRO_ERROR("Could not attach stream to mixer\n"); + A5O_ERROR("Could not attach stream to mixer\n"); return NULL; } return global_stream; @@ -430,22 +430,22 @@ ALLEGRO_AUDIO_STREAM *al_play_audio_stream(const char *filename) /* Function: al_play_audio_stream_f */ -ALLEGRO_AUDIO_STREAM *al_play_audio_stream_f(ALLEGRO_FILE *fp, const char *ident) +A5O_AUDIO_STREAM *al_play_audio_stream_f(A5O_FILE *fp, const char *ident) { ASSERT(fp); ASSERT(ident); if (!al_get_default_mixer()) { - ALLEGRO_ERROR("No default mixer\n!"); + A5O_ERROR("No default mixer\n!"); return NULL; } al_destroy_audio_stream(global_stream); global_stream = al_load_audio_stream_f(fp, ident, 4, 2048); if (!global_stream) { - ALLEGRO_ERROR("Could not play audio stream.\n"); + A5O_ERROR("Could not play audio stream.\n"); return NULL; } if (!al_attach_audio_stream_to_mixer(global_stream, al_get_default_mixer())) { - ALLEGRO_ERROR("Could not attach stream to mixer\n"); + A5O_ERROR("Could not attach stream to mixer\n"); return NULL; } return global_stream; @@ -454,7 +454,7 @@ ALLEGRO_AUDIO_STREAM *al_play_audio_stream_f(ALLEGRO_FILE *fp, const char *ident /* Function: al_save_sample */ -bool al_save_sample(const char *filename, ALLEGRO_SAMPLE *spl) +bool al_save_sample(const char *filename, A5O_SAMPLE *spl) { const char *ext; ACODEC_TABLE *ent; @@ -462,7 +462,7 @@ bool al_save_sample(const char *filename, ALLEGRO_SAMPLE *spl) ASSERT(filename); ext = strrchr(filename, '.'); if (ext == NULL) { - ALLEGRO_ERROR("Unable to determine extension for %s.\n", filename); + A5O_ERROR("Unable to determine extension for %s.\n", filename); return false; } @@ -471,7 +471,7 @@ bool al_save_sample(const char *filename, ALLEGRO_SAMPLE *spl) return (ent->saver)(filename, spl); } else { - ALLEGRO_ERROR("No handler for audio file extension %s - " + A5O_ERROR("No handler for audio file extension %s - " "therefore not trying to load %s.\n", ext, filename); } @@ -481,7 +481,7 @@ bool al_save_sample(const char *filename, ALLEGRO_SAMPLE *spl) /* Function: al_save_sample_f */ -bool al_save_sample_f(ALLEGRO_FILE *fp, const char *ident, ALLEGRO_SAMPLE *spl) +bool al_save_sample_f(A5O_FILE *fp, const char *ident, A5O_SAMPLE *spl) { ACODEC_TABLE *ent; @@ -493,7 +493,7 @@ bool al_save_sample_f(ALLEGRO_FILE *fp, const char *ident, ALLEGRO_SAMPLE *spl) return (ent->fs_saver)(fp, spl); } else { - ALLEGRO_ERROR("No handler for audio file extension %s.\n", ident); + A5O_ERROR("No handler for audio file extension %s.\n", ident); } return false; @@ -502,7 +502,7 @@ bool al_save_sample_f(ALLEGRO_FILE *fp, const char *ident, ALLEGRO_SAMPLE *spl) /* Function: al_identify_sample_f */ -char const *al_identify_sample_f(ALLEGRO_FILE *fp) +char const *al_identify_sample_f(A5O_FILE *fp) { ACODEC_TABLE *h = find_acodec_table_entry_for_file(fp); if (!h) @@ -516,7 +516,7 @@ char const *al_identify_sample_f(ALLEGRO_FILE *fp) char const *al_identify_sample(char const *filename) { char const *ext; - ALLEGRO_FILE *fp = al_fopen(filename, "rb"); + A5O_FILE *fp = al_fopen(filename, "rb"); if (!fp) return NULL; ext = al_identify_sample_f(fp); diff --git a/addons/audio/dsound.cpp b/addons/audio/dsound.cpp index e0e88c6d3c..be0719a3ed 100644 --- a/addons/audio/dsound.cpp +++ b/addons/audio/dsound.cpp @@ -36,7 +36,7 @@ static const IID _al_IID_IDirectSoundCaptureBuffer8 = { 0x00990df4, 0x0dbb, 0x48 extern "C" { -ALLEGRO_DEBUG_CHANNEL("audio-dsound") +A5O_DEBUG_CHANNEL("audio-dsound") #include "allegro5/internal/aintern_audio.h" #include "allegro5/internal/aintern_system.h" @@ -70,11 +70,11 @@ static HWND get_window() HWND ret; if (val && strncmp(val, "foreground", 10) == 0) { ret = GetForegroundWindow(); - ALLEGRO_INFO("Using foreground window: %p\n", ret); + A5O_INFO("Using foreground window: %p\n", ret); } else { ret = GetDesktopWindow(); - ALLEGRO_INFO("Using desktop window: %p\n", ret); + A5O_INFO("Using desktop window: %p\n", ret); } return ret; } @@ -138,7 +138,7 @@ static char *ds_get_error(HRESULT hr) /* Custom struct to hold voice information DirectSound needs */ /* TODO: review */ -struct ALLEGRO_DS_DATA { +struct A5O_DS_DATA { int bits_per_sample; int channels; DSBUFFERDESC desc; @@ -146,19 +146,19 @@ struct ALLEGRO_DS_DATA { LPDIRECTSOUNDBUFFER ds_buffer; LPDIRECTSOUNDBUFFER8 ds8_buffer; int stop_voice; - ALLEGRO_THREAD *thread; + A5O_THREAD *thread; }; -static bool _dsound_voice_is_playing(const ALLEGRO_VOICE *voice); +static bool _dsound_voice_is_playing(const A5O_VOICE *voice); /* Custom routine which runs in another thread to periodically check if DirectSound wants more data for a stream */ -static void* _dsound_update(ALLEGRO_THREAD *self, void *arg) +static void* _dsound_update(A5O_THREAD *self, void *arg) { - ALLEGRO_VOICE *voice = (ALLEGRO_VOICE *)arg; - ALLEGRO_DS_DATA *ex_data = (ALLEGRO_DS_DATA*)voice->extra; + A5O_VOICE *voice = (A5O_VOICE *)arg; + A5O_DS_DATA *ex_data = (A5O_DS_DATA*)voice->extra; const int bytes_per_sample = ex_data->bits_per_sample / 8; DWORD play_cursor = 0; DWORD write_cursor; @@ -195,7 +195,7 @@ static void* _dsound_update(ALLEGRO_THREAD *self, void *arg) ex_data->ds8_buffer->Unlock(ptr1, block1_bytes, ptr2, block2_bytes); } else { - ALLEGRO_ERROR("Lock failed: %s\n", ds_get_error(hr)); + A5O_ERROR("Lock failed: %s\n", ds_get_error(hr)); } ex_data->ds8_buffer->Play(0, 0, DSBPLAY_LOOPING); @@ -245,11 +245,11 @@ static void* _dsound_update(ALLEGRO_THREAD *self, void *arg) hr = ex_data->ds8_buffer->Unlock(ptr1, block1_bytes, ptr2, block2_bytes); if (FAILED(hr)) { - ALLEGRO_ERROR("Unlock failed: %s\n", ds_get_error(hr)); + A5O_ERROR("Unlock failed: %s\n", ds_get_error(hr)); } } else { - ALLEGRO_ERROR("Lock failed: %s\n", ds_get_error(hr)); + A5O_ERROR("Lock failed: %s\n", ds_get_error(hr)); } saved_play_cursor += block1_bytes + block2_bytes; saved_play_cursor %= buffer_size; @@ -272,7 +272,7 @@ static void* _dsound_update(ALLEGRO_THREAD *self, void *arg) static int _dsound_open() { HRESULT hr; - ALLEGRO_INFO("Starting DirectSound...\n"); + A5O_INFO("Starting DirectSound...\n"); output_device_list = _al_list_create(); DirectSoundEnumerate((LPDSENUMCALLBACK)_ds_enum_callback, NULL); @@ -281,15 +281,15 @@ static int _dsound_open() hr = DirectSoundCreate8(NULL, &device, NULL); if (FAILED(hr)) { - ALLEGRO_ERROR("DirectSoundCreate8 failed: %s\n", ds_get_error(hr)); + A5O_ERROR("DirectSoundCreate8 failed: %s\n", ds_get_error(hr)); return 1; } - ALLEGRO_DEBUG("DirectSoundCreate8 succeeded\n"); + A5O_DEBUG("DirectSoundCreate8 succeeded\n"); hr = device->SetCooperativeLevel(get_window(), DSSCL_PRIORITY); if (FAILED(hr)) { - ALLEGRO_ERROR("SetCooperativeLevel failed: %s\n", ds_get_error(hr)); + A5O_ERROR("SetCooperativeLevel failed: %s\n", ds_get_error(hr)); return 1; } @@ -301,72 +301,72 @@ static int _dsound_open() other processes to use the device */ static void _dsound_close() { - ALLEGRO_DEBUG("Releasing device\n"); + A5O_DEBUG("Releasing device\n"); _al_list_destroy(output_device_list); device->Release(); - ALLEGRO_DEBUG("Released device\n"); - ALLEGRO_INFO("DirectSound closed\n"); + A5O_DEBUG("Released device\n"); + A5O_INFO("DirectSound closed\n"); } /* The allocate_voice method should grab a voice from the system, and allocate any data common to streaming and non-streaming sources. */ -static int _dsound_allocate_voice(ALLEGRO_VOICE *voice) +static int _dsound_allocate_voice(A5O_VOICE *voice) { - ALLEGRO_DS_DATA *ex_data; + A5O_DS_DATA *ex_data; int bits_per_sample; int channels; - ALLEGRO_DEBUG("Allocating voice\n"); + A5O_DEBUG("Allocating voice\n"); /* openal doesn't support very much! */ switch (voice->depth) { - case ALLEGRO_AUDIO_DEPTH_UINT8: + case A5O_AUDIO_DEPTH_UINT8: /* format supported */ bits_per_sample = 8; break; - case ALLEGRO_AUDIO_DEPTH_INT8: - ALLEGRO_ERROR("DirectSound requires 8-bit data to be unsigned\n"); + case A5O_AUDIO_DEPTH_INT8: + A5O_ERROR("DirectSound requires 8-bit data to be unsigned\n"); return 1; - case ALLEGRO_AUDIO_DEPTH_UINT16: - ALLEGRO_ERROR("DirectSound requires 16-bit data to be signed\n"); + case A5O_AUDIO_DEPTH_UINT16: + A5O_ERROR("DirectSound requires 16-bit data to be signed\n"); return 1; - case ALLEGRO_AUDIO_DEPTH_INT16: + case A5O_AUDIO_DEPTH_INT16: /* format supported */ bits_per_sample = 16; break; - case ALLEGRO_AUDIO_DEPTH_UINT24: - ALLEGRO_ERROR("DirectSound does not support 24-bit data\n"); + case A5O_AUDIO_DEPTH_UINT24: + A5O_ERROR("DirectSound does not support 24-bit data\n"); return 1; - case ALLEGRO_AUDIO_DEPTH_INT24: - ALLEGRO_ERROR("DirectSound does not support 24-bit data\n"); + case A5O_AUDIO_DEPTH_INT24: + A5O_ERROR("DirectSound does not support 24-bit data\n"); return 1; - case ALLEGRO_AUDIO_DEPTH_FLOAT32: - ALLEGRO_ERROR("DirectSound does not support 32-bit floating data\n"); + case A5O_AUDIO_DEPTH_FLOAT32: + A5O_ERROR("DirectSound does not support 32-bit floating data\n"); return 1; default: - ALLEGRO_ERROR("Cannot allocate unknown voice depth\n"); + A5O_ERROR("Cannot allocate unknown voice depth\n"); return 1; } switch (voice->chan_conf) { - case ALLEGRO_CHANNEL_CONF_1: + case A5O_CHANNEL_CONF_1: channels = 1; break; - case ALLEGRO_CHANNEL_CONF_2: + case A5O_CHANNEL_CONF_2: channels = 2; break; default: - ALLEGRO_ERROR("Unsupported number of channels\n"); + A5O_ERROR("Unsupported number of channels\n"); return 1; } - ex_data = (ALLEGRO_DS_DATA *)al_calloc(1, sizeof(*ex_data)); + ex_data = (A5O_DS_DATA *)al_calloc(1, sizeof(*ex_data)); if (!ex_data) { - ALLEGRO_ERROR("Could not allocate voice data memory\n"); + A5O_ERROR("Could not allocate voice data memory\n"); return 1; } @@ -378,7 +378,7 @@ static int _dsound_allocate_voice(ALLEGRO_VOICE *voice) voice->extra = ex_data; - ALLEGRO_DEBUG("Allocated voice\n"); + A5O_DEBUG("Allocated voice\n"); return 0; } @@ -386,14 +386,14 @@ static int _dsound_allocate_voice(ALLEGRO_VOICE *voice) /* The deallocate_voice method should free the resources for the given voice, but still retain a hold on the device. The voice should be stopped and unloaded by the time this is called */ -static void _dsound_deallocate_voice(ALLEGRO_VOICE *voice) +static void _dsound_deallocate_voice(A5O_VOICE *voice) { - ALLEGRO_DEBUG("Deallocating voice\n"); + A5O_DEBUG("Deallocating voice\n"); al_free(voice->extra); voice->extra = NULL; - ALLEGRO_DEBUG("Deallocated voice\n"); + A5O_DEBUG("Deallocated voice\n"); } /* The load_voice method loads a sample into the driver's memory. The voice's @@ -401,15 +401,15 @@ static void _dsound_deallocate_voice(ALLEGRO_VOICE *voice) 'buffer_size' field will be the total length in bytes of the sample data. The voice's attached sample's looping mode should be honored, and loading must fail if it cannot be. */ -static int _dsound_load_voice(ALLEGRO_VOICE *voice, const void *_data) +static int _dsound_load_voice(A5O_VOICE *voice, const void *_data) { - ALLEGRO_DS_DATA *ex_data = (ALLEGRO_DS_DATA *)voice->extra; + A5O_DS_DATA *ex_data = (A5O_DS_DATA *)voice->extra; HRESULT hr; LPVOID ptr1, ptr2; DWORD block1_bytes, block2_bytes; MAKE_UNION(&ex_data->ds8_buffer, LPDIRECTSOUNDBUFFER8 *); - ALLEGRO_DEBUG("Loading voice\n"); + A5O_DEBUG("Loading voice\n"); ex_data->wave_fmt.wFormatTag = WAVE_FORMAT_PCM; ex_data->wave_fmt.nChannels = ex_data->channels; @@ -428,7 +428,7 @@ static int _dsound_load_voice(ALLEGRO_VOICE *voice, const void *_data) hr = device->CreateSoundBuffer(&ex_data->desc, &ex_data->ds_buffer, NULL); if (FAILED(hr)) { - ALLEGRO_ERROR("CreateSoundBuffer failed: %s\n", ds_get_error(hr)); + A5O_ERROR("CreateSoundBuffer failed: %s\n", ds_get_error(hr)); return 1; } @@ -437,7 +437,7 @@ static int _dsound_load_voice(ALLEGRO_VOICE *voice, const void *_data) hr = ex_data->ds8_buffer->Lock(0, voice->buffer_size, &ptr1, &block1_bytes, &ptr2, &block2_bytes, 0); if (FAILED(hr)) { - ALLEGRO_ERROR("Locking buffer failed: %s\n", ds_get_error(hr)); + A5O_ERROR("Locking buffer failed: %s\n", ds_get_error(hr)); return 1; } @@ -452,15 +452,15 @@ static int _dsound_load_voice(ALLEGRO_VOICE *voice, const void *_data) /* The unload_voice method unloads a sample previously loaded with load_voice. This method should not be called on a streaming voice. */ -static void _dsound_unload_voice(ALLEGRO_VOICE *voice) +static void _dsound_unload_voice(A5O_VOICE *voice) { - ALLEGRO_DS_DATA *ex_data = (ALLEGRO_DS_DATA *)voice->extra; + A5O_DS_DATA *ex_data = (A5O_DS_DATA *)voice->extra; - ALLEGRO_DEBUG("Unloading voice\n"); + A5O_DEBUG("Unloading voice\n"); ex_data->ds8_buffer->Release(); - ALLEGRO_DEBUG("Unloaded voice\n"); + A5O_DEBUG("Unloaded voice\n"); } @@ -468,21 +468,21 @@ static void _dsound_unload_voice(ALLEGRO_VOICE *voice) should start polling the device and call _al_voice_update for audio data. For non-streaming voices, it should resume playing from the last set position */ -static int _dsound_start_voice(ALLEGRO_VOICE *voice) +static int _dsound_start_voice(A5O_VOICE *voice) { - ALLEGRO_DS_DATA *ex_data = (ALLEGRO_DS_DATA *)voice->extra; + A5O_DS_DATA *ex_data = (A5O_DS_DATA *)voice->extra; HRESULT hr; MAKE_UNION(&ex_data->ds8_buffer, LPDIRECTSOUNDBUFFER8 *); - ALLEGRO_DEBUG("Starting voice\n"); + A5O_DEBUG("Starting voice\n"); if (!voice->is_streaming) { hr = ex_data->ds8_buffer->Play(0, 0, 0); if (FAILED(hr)) { - ALLEGRO_ERROR("Streaming voice failed to start: %s\n", ds_get_error(hr)); + A5O_ERROR("Streaming voice failed to start: %s\n", ds_get_error(hr)); return 1; } - ALLEGRO_INFO("Streaming voice started\n"); + A5O_INFO("Streaming voice started\n"); return 0; } @@ -502,91 +502,91 @@ static int _dsound_start_voice(ALLEGRO_VOICE *voice) ex_data->desc.lpwfxFormat = &ex_data->wave_fmt; ex_data->desc.guid3DAlgorithm = DS3DALG_DEFAULT; - ALLEGRO_DEBUG("CreateSoundBuffer\n"); + A5O_DEBUG("CreateSoundBuffer\n"); hr = device->CreateSoundBuffer(&ex_data->desc, &ex_data->ds_buffer, NULL); if (FAILED(hr)) { - ALLEGRO_ERROR("CreateSoundBuffer failed: %s\n", ds_get_error(hr)); + A5O_ERROR("CreateSoundBuffer failed: %s\n", ds_get_error(hr)); return 1; } - ALLEGRO_DEBUG("CreateSoundBuffer succeeded\n"); + A5O_DEBUG("CreateSoundBuffer succeeded\n"); ex_data->ds_buffer->QueryInterface(_al_IID_IDirectSoundBuffer8, u.v); ex_data->ds8_buffer->SetVolume(DSBVOLUME_MAX); - ALLEGRO_DEBUG("Starting _dsound_update thread\n"); + A5O_DEBUG("Starting _dsound_update thread\n"); ex_data->stop_voice = 0; ex_data->thread = al_create_thread(_dsound_update, (void*) voice); al_start_thread(ex_data->thread); } else { - ALLEGRO_WARN("stop_voice == 0\n"); + A5O_WARN("stop_voice == 0\n"); } - ALLEGRO_INFO("Voice started\n"); + A5O_INFO("Voice started\n"); return 0; } /* The stop_voice method should stop playback. For non-streaming voices, it should leave the data loaded, and reset the voice position to 0. */ -static int _dsound_stop_voice(ALLEGRO_VOICE* voice) +static int _dsound_stop_voice(A5O_VOICE* voice) { - ALLEGRO_DS_DATA *ex_data = (ALLEGRO_DS_DATA *)voice->extra; + A5O_DS_DATA *ex_data = (A5O_DS_DATA *)voice->extra; - ALLEGRO_DEBUG("Stopping voice\n"); + A5O_DEBUG("Stopping voice\n"); if (!ex_data->ds8_buffer) { - ALLEGRO_ERROR("Trying to stop empty voice buffer\n"); + A5O_ERROR("Trying to stop empty voice buffer\n"); return 1; } /* if playing a sample */ if (!voice->is_streaming) { - ALLEGRO_DEBUG("Stopping non-streaming voice\n"); + A5O_DEBUG("Stopping non-streaming voice\n"); ex_data->ds8_buffer->Stop(); ex_data->ds8_buffer->SetCurrentPosition(0); - ALLEGRO_INFO("Non-streaming voice stopped\n"); + A5O_INFO("Non-streaming voice stopped\n"); return 0; } if (ex_data->stop_voice == 0) { - ALLEGRO_DEBUG("Joining thread\n"); + A5O_DEBUG("Joining thread\n"); ex_data->stop_voice = 1; while (ex_data->stop_voice == 1) { al_wait_cond(voice->cond, voice->mutex); } al_join_thread(ex_data->thread, NULL); - ALLEGRO_DEBUG("Joined thread\n"); + A5O_DEBUG("Joined thread\n"); - ALLEGRO_DEBUG("Destroying thread\n"); + A5O_DEBUG("Destroying thread\n"); al_destroy_thread(ex_data->thread); - ALLEGRO_DEBUG("Thread destroyed\n"); + A5O_DEBUG("Thread destroyed\n"); /* This is required to restart the background thread when the voice * restarts. */ ex_data->stop_voice = 1; } - ALLEGRO_DEBUG("Releasing buffer\n"); + A5O_DEBUG("Releasing buffer\n"); ex_data->ds8_buffer->Release(); ex_data->ds8_buffer = NULL; - ALLEGRO_INFO("Voice stopped\n"); + A5O_INFO("Voice stopped\n"); return 0; } /* The voice_is_playing method should only be called on non-streaming sources, and should return true if the voice is playing */ -static bool _dsound_voice_is_playing(const ALLEGRO_VOICE *voice) +static bool _dsound_voice_is_playing(const A5O_VOICE *voice) { - ALLEGRO_DS_DATA *ex_data = (ALLEGRO_DS_DATA *)voice->extra; + A5O_DS_DATA *ex_data = (A5O_DS_DATA *)voice->extra; DWORD status; if (!ex_data) { - ALLEGRO_WARN("ex_data is null\n"); + A5O_WARN("ex_data is null\n"); return false; } @@ -598,15 +598,15 @@ static bool _dsound_voice_is_playing(const ALLEGRO_VOICE *voice) /* The get_voice_position method should return the current sample position of the voice (sample_pos = byte_pos / (depth/8) / channels). This should never be called on a streaming voice. */ -static unsigned int _dsound_get_voice_position(const ALLEGRO_VOICE *voice) +static unsigned int _dsound_get_voice_position(const A5O_VOICE *voice) { - ALLEGRO_DS_DATA *ex_data = (ALLEGRO_DS_DATA *)voice->extra; + A5O_DS_DATA *ex_data = (A5O_DS_DATA *)voice->extra; DWORD play_pos; HRESULT hr; hr = ex_data->ds8_buffer->GetCurrentPosition(&play_pos, NULL); if (FAILED(hr)) { - ALLEGRO_ERROR("GetCurrentPosition failed: %s\n", ds_get_error(hr)); + A5O_ERROR("GetCurrentPosition failed: %s\n", ds_get_error(hr)); return 0; } @@ -616,16 +616,16 @@ static unsigned int _dsound_get_voice_position(const ALLEGRO_VOICE *voice) /* The set_voice_position method should set the voice's playback position, given the value in samples. This should never be called on a streaming voice. */ -static int _dsound_set_voice_position(ALLEGRO_VOICE *voice, unsigned int val) +static int _dsound_set_voice_position(A5O_VOICE *voice, unsigned int val) { - ALLEGRO_DS_DATA *ex_data = (ALLEGRO_DS_DATA *)voice->extra; + A5O_DS_DATA *ex_data = (A5O_DS_DATA *)voice->extra; HRESULT hr; val *= ex_data->channels * (ex_data->bits_per_sample/8); hr = ex_data->ds8_buffer->SetCurrentPosition(val); if (FAILED(hr)) { - ALLEGRO_ERROR("SetCurrentPosition failed: %s\n", ds_get_error(hr)); + A5O_ERROR("SetCurrentPosition failed: %s\n", ds_get_error(hr)); return 1; } @@ -639,18 +639,18 @@ struct DSOUND_RECORD_DATA { WAVEFORMATEX wave_fmt; }; -static void *_dsound_update_recorder(ALLEGRO_THREAD *t, void *data) +static void *_dsound_update_recorder(A5O_THREAD *t, void *data) { - ALLEGRO_AUDIO_RECORDER *r = (ALLEGRO_AUDIO_RECORDER *) data; + A5O_AUDIO_RECORDER *r = (A5O_AUDIO_RECORDER *) data; DSOUND_RECORD_DATA *extra = (DSOUND_RECORD_DATA *) r->extra; DWORD last_read_pos = 0; - ALLEGRO_EVENT user_event; + A5O_EVENT user_event; bool is_dsound_recording = false; size_t fragment_i = 0; size_t bytes_written = 0; - ALLEGRO_INFO("Starting recorder thread\n"); + A5O_INFO("Starting recorder thread\n"); while (!al_get_thread_should_stop(t)) { al_lock_mutex(r->mutex); @@ -688,7 +688,7 @@ static void *_dsound_update_recorder(ALLEGRO_THREAD *t, void *data) extra->buffer8->Lock(last_read_pos, bytes_to_read, &buffer1, &buffer1_size, &buffer2, &buffer2_size, 0); - ALLEGRO_ASSERT(buffer2 == NULL); + A5O_ASSERT(buffer2 == NULL); buffer = (uint8_t *)buffer1; buffer_size = buffer1_size; @@ -700,14 +700,14 @@ static void *_dsound_update_recorder(ALLEGRO_THREAD *t, void *data) buffer_size = 0; } else { - ALLEGRO_AUDIO_RECORDER_EVENT *e; + A5O_AUDIO_RECORDER_EVENT *e; size_t bytes_to_write = r->fragment_size - bytes_written; memcpy((uint8_t*) r->fragments[fragment_i] + bytes_written, buffer, bytes_to_write); buffer_size -= bytes_to_write; buffer += bytes_to_write; - user_event.user.type = ALLEGRO_EVENT_AUDIO_RECORDER_FRAGMENT; + user_event.user.type = A5O_EVENT_AUDIO_RECORDER_FRAGMENT; e = al_get_audio_recorder_event(&user_event); e->buffer = r->fragments[fragment_i]; e->samples = r->samples; @@ -739,34 +739,34 @@ static void *_dsound_update_recorder(ALLEGRO_THREAD *t, void *data) extra->buffer8->Stop(); } - ALLEGRO_INFO("Leaving recorder thread\n"); + A5O_INFO("Leaving recorder thread\n"); return NULL; } -static int _dsound_open_recorder(ALLEGRO_AUDIO_RECORDER *r) +static int _dsound_open_recorder(A5O_AUDIO_RECORDER *r) { HRESULT hr; if (capture_device != NULL) { /* FIXME: It's wrong to assume only a single recording device, but since there is no enumeration of devices, it doesn't matter for now. */ - ALLEGRO_ERROR("Already recording.\n"); + A5O_ERROR("Already recording.\n"); return 1; } - ALLEGRO_INFO("Creating default capture device.\n"); + A5O_INFO("Creating default capture device.\n"); /* FIXME: Use default device until we have device enumeration */ hr = DirectSoundCaptureCreate8(NULL, &capture_device, NULL); if (FAILED(hr)) { - ALLEGRO_ERROR("DirectSoundCaptureCreate8 failed: %s\n", ds_get_error(hr)); + A5O_ERROR("DirectSoundCaptureCreate8 failed: %s\n", ds_get_error(hr)); return 1; } hr = device->SetCooperativeLevel(get_window(), DSSCL_PRIORITY); if (FAILED(hr)) { - ALLEGRO_ERROR("SetCooperativeLevel failed: %s\n", ds_get_error(hr)); + A5O_ERROR("SetCooperativeLevel failed: %s\n", ds_get_error(hr)); return 1; } @@ -776,10 +776,10 @@ static int _dsound_open_recorder(ALLEGRO_AUDIO_RECORDER *r) dsccaps.dwSize = sizeof(DSCCAPS); hr = capture_device->GetCaps(&dsccaps); if (FAILED(hr)) { - ALLEGRO_ERROR("DirectSoundCaptureCreate8::GetCaps failed: %s\n", ds_get_error(hr)); + A5O_ERROR("DirectSoundCaptureCreate8::GetCaps failed: %s\n", ds_get_error(hr)); } else { - ALLEGRO_INFO("caps: %lu %lu\n", dsccaps.dwFormats, dsccaps.dwFormats & WAVE_FORMAT_2M16); + A5O_INFO("caps: %lu %lu\n", dsccaps.dwFormats, dsccaps.dwFormats & WAVE_FORMAT_2M16); } memset(&extra->wave_fmt, 0, sizeof(extra->wave_fmt)); @@ -798,7 +798,7 @@ static int _dsound_open_recorder(ALLEGRO_AUDIO_RECORDER *r) hr = capture_device->CreateCaptureBuffer(&extra->desc, &extra->buffer, NULL); if (FAILED(hr)) { al_free(extra); - ALLEGRO_ERROR("Unable to create Capture Buffer\n"); + A5O_ERROR("Unable to create Capture Buffer\n"); return 1; } @@ -810,8 +810,8 @@ static int _dsound_open_recorder(ALLEGRO_AUDIO_RECORDER *r) return 0; } -void _dsound_close_recorder(ALLEGRO_AUDIO_RECORDER *r) { - ALLEGRO_ASSERT(capture_device); +void _dsound_close_recorder(A5O_AUDIO_RECORDER *r) { + A5O_ASSERT(capture_device); (void) r; capture_device->Release(); @@ -822,7 +822,7 @@ static void _output_device_list_dtor(void* value, void* userdata) { (void)userdata; - ALLEGRO_AUDIO_DEVICE* device = (ALLEGRO_AUDIO_DEVICE*)value; + A5O_AUDIO_DEVICE* device = (A5O_AUDIO_DEVICE*)value; al_free(device->name); al_free(device->identifier); al_free(device); @@ -838,7 +838,7 @@ static BOOL CALLBACK _ds_enum_callback( (void)lpContext; if (lpGuid != NULL) { - ALLEGRO_AUDIO_DEVICE* device = (ALLEGRO_AUDIO_DEVICE*)al_malloc(sizeof(ALLEGRO_AUDIO_DEVICE)); + A5O_AUDIO_DEVICE* device = (A5O_AUDIO_DEVICE*)al_malloc(sizeof(A5O_AUDIO_DEVICE)); device->identifier = (void*)al_malloc(sizeof(GUID)); device->name = _twin_tchar_to_utf8(lpcstrDescription); @@ -855,7 +855,7 @@ static _AL_LIST* _dsound_get_output_devices(void) return output_device_list; } -ALLEGRO_AUDIO_DRIVER _al_kcm_dsound_driver = { +A5O_AUDIO_DRIVER _al_kcm_dsound_driver = { "DirectSound", _dsound_open, diff --git a/addons/audio/kcm_instance.c b/addons/audio/kcm_instance.c index 92a0c87916..60d2e1925e 100644 --- a/addons/audio/kcm_instance.c +++ b/addons/audio/kcm_instance.c @@ -16,7 +16,7 @@ #include "allegro5/internal/aintern_audio_cfg.h" -static void maybe_lock_mutex(ALLEGRO_MUTEX *mutex) +static void maybe_lock_mutex(A5O_MUTEX *mutex) { if (mutex) { al_lock_mutex(mutex); @@ -24,7 +24,7 @@ static void maybe_lock_mutex(ALLEGRO_MUTEX *mutex) } -static void maybe_unlock_mutex(ALLEGRO_MUTEX *mutex) +static void maybe_unlock_mutex(A5O_MUTEX *mutex) { if (mutex) { al_unlock_mutex(mutex); @@ -34,10 +34,10 @@ static void maybe_unlock_mutex(ALLEGRO_MUTEX *mutex) /* _al_kcm_stream_set_mutex: * This function sets a sample's mutex pointer to the specified value. It is - * ALLEGRO_MIXER aware, and will recursively set any attached streams' mutex + * A5O_MIXER aware, and will recursively set any attached streams' mutex * to the same value. */ -void _al_kcm_stream_set_mutex(ALLEGRO_SAMPLE_INSTANCE *stream, ALLEGRO_MUTEX *mutex) +void _al_kcm_stream_set_mutex(A5O_SAMPLE_INSTANCE *stream, A5O_MUTEX *mutex) { ASSERT(stream); @@ -49,12 +49,12 @@ void _al_kcm_stream_set_mutex(ALLEGRO_SAMPLE_INSTANCE *stream, ALLEGRO_MUTEX *mu * set the same mutex. */ if (stream->is_mixer) { - ALLEGRO_MIXER *mixer = (ALLEGRO_MIXER *)stream; + A5O_MIXER *mixer = (A5O_MIXER *)stream; int i; for (i = _al_vector_size(&mixer->streams) - 1; i >= 0; i--) { - ALLEGRO_SAMPLE_INSTANCE **slot = _al_vector_ref(&mixer->streams, i); - ALLEGRO_SAMPLE_INSTANCE *spl = *slot; + A5O_SAMPLE_INSTANCE **slot = _al_vector_ref(&mixer->streams, i); + A5O_SAMPLE_INSTANCE *spl = *slot; _al_kcm_stream_set_mutex(spl, mutex); } } @@ -62,24 +62,24 @@ void _al_kcm_stream_set_mutex(ALLEGRO_SAMPLE_INSTANCE *stream, ALLEGRO_MUTEX *mu /* stream_free: - * This function is ALLEGRO_MIXER aware and frees the memory associated with + * This function is A5O_MIXER aware and frees the memory associated with * the sample or mixer, and detaches any attached streams or mixers. */ -static void stream_free(ALLEGRO_SAMPLE_INSTANCE *spl) +static void stream_free(A5O_SAMPLE_INSTANCE *spl) { if (spl) { /* Make sure we free the mixer buffer and de-reference the attached * streams if this is a mixer stream. */ if (spl->is_mixer) { - ALLEGRO_MIXER *mixer = (ALLEGRO_MIXER *)spl; + A5O_MIXER *mixer = (A5O_MIXER *)spl; int i; _al_kcm_stream_set_mutex(&mixer->ss, NULL); for (i = _al_vector_size(&mixer->streams) - 1; i >= 0; i--) { - ALLEGRO_SAMPLE_INSTANCE **slot = _al_vector_ref(&mixer->streams, i); - ALLEGRO_SAMPLE_INSTANCE *spl = *slot; + A5O_SAMPLE_INSTANCE **slot = _al_vector_ref(&mixer->streams, i); + A5O_SAMPLE_INSTANCE *spl = *slot; spl->parent.u.ptr = NULL; spl->spl_read = NULL; @@ -108,9 +108,9 @@ static void stream_free(ALLEGRO_SAMPLE_INSTANCE *spl) * This detaches the sample, stream, or mixer from anything it may be attached * to. */ -void _al_kcm_detach_from_parent(ALLEGRO_SAMPLE_INSTANCE *spl) +void _al_kcm_detach_from_parent(A5O_SAMPLE_INSTANCE *spl) { - ALLEGRO_MIXER *mixer; + A5O_MIXER *mixer; int i; if (!spl || !spl->parent.u.ptr) @@ -125,7 +125,7 @@ void _al_kcm_detach_from_parent(ALLEGRO_SAMPLE_INSTANCE *spl) /* Search through the streams and check for this one */ for (i = _al_vector_size(&mixer->streams) - 1; i >= 0; i--) { - ALLEGRO_SAMPLE_INSTANCE **slot = _al_vector_ref(&mixer->streams, i); + A5O_SAMPLE_INSTANCE **slot = _al_vector_ref(&mixer->streams, i); if (*slot == spl) { maybe_lock_mutex(mixer->ss.mutex); @@ -149,13 +149,13 @@ void _al_kcm_detach_from_parent(ALLEGRO_SAMPLE_INSTANCE *spl) /* Function: al_create_sample_instance */ -ALLEGRO_SAMPLE_INSTANCE *al_create_sample_instance(ALLEGRO_SAMPLE *sample_data) +A5O_SAMPLE_INSTANCE *al_create_sample_instance(A5O_SAMPLE *sample_data) { - ALLEGRO_SAMPLE_INSTANCE *spl; + A5O_SAMPLE_INSTANCE *spl; spl = al_calloc(1, sizeof(*spl)); if (!spl) { - _al_set_error(ALLEGRO_GENERIC_ERROR, + _al_set_error(A5O_GENERIC_ERROR, "Out of memory allocating sample object"); return NULL; } @@ -165,7 +165,7 @@ ALLEGRO_SAMPLE_INSTANCE *al_create_sample_instance(ALLEGRO_SAMPLE *sample_data) } spl->spl_data.free_buf = false; - spl->loop = ALLEGRO_PLAYMODE_ONCE; + spl->loop = A5O_PLAYMODE_ONCE; spl->speed = 1.0f; spl->gain = 1.0f; spl->pan = 0.0f; @@ -189,10 +189,10 @@ ALLEGRO_SAMPLE_INSTANCE *al_create_sample_instance(ALLEGRO_SAMPLE *sample_data) } -/* This function is ALLEGRO_MIXER aware */ +/* This function is A5O_MIXER aware */ /* Function: al_destroy_sample_instance */ -void al_destroy_sample_instance(ALLEGRO_SAMPLE_INSTANCE *spl) +void al_destroy_sample_instance(A5O_SAMPLE_INSTANCE *spl) { _al_kcm_destroy_sample(spl, true); } @@ -200,7 +200,7 @@ void al_destroy_sample_instance(ALLEGRO_SAMPLE_INSTANCE *spl) /* Internal function: _al_kcm_destroy_sample */ -void _al_kcm_destroy_sample(ALLEGRO_SAMPLE_INSTANCE *spl, bool unregister) +void _al_kcm_destroy_sample(A5O_SAMPLE_INSTANCE *spl, bool unregister) { if (spl) { if (unregister) { @@ -215,7 +215,7 @@ void _al_kcm_destroy_sample(ALLEGRO_SAMPLE_INSTANCE *spl, bool unregister) /* Function: al_play_sample_instance */ -bool al_play_sample_instance(ALLEGRO_SAMPLE_INSTANCE *spl) +bool al_play_sample_instance(A5O_SAMPLE_INSTANCE *spl) { ASSERT(spl); @@ -225,7 +225,7 @@ bool al_play_sample_instance(ALLEGRO_SAMPLE_INSTANCE *spl) /* Function: al_stop_sample_instance */ -bool al_stop_sample_instance(ALLEGRO_SAMPLE_INSTANCE *spl) +bool al_stop_sample_instance(A5O_SAMPLE_INSTANCE *spl) { ASSERT(spl); @@ -235,7 +235,7 @@ bool al_stop_sample_instance(ALLEGRO_SAMPLE_INSTANCE *spl) /* Function: al_get_sample_instance_frequency */ -unsigned int al_get_sample_instance_frequency(const ALLEGRO_SAMPLE_INSTANCE *spl) +unsigned int al_get_sample_instance_frequency(const A5O_SAMPLE_INSTANCE *spl) { ASSERT(spl); @@ -245,7 +245,7 @@ unsigned int al_get_sample_instance_frequency(const ALLEGRO_SAMPLE_INSTANCE *spl /* Function: al_get_sample_instance_length */ -unsigned int al_get_sample_instance_length(const ALLEGRO_SAMPLE_INSTANCE *spl) +unsigned int al_get_sample_instance_length(const A5O_SAMPLE_INSTANCE *spl) { ASSERT(spl); @@ -255,12 +255,12 @@ unsigned int al_get_sample_instance_length(const ALLEGRO_SAMPLE_INSTANCE *spl) /* Function: al_get_sample_instance_position */ -unsigned int al_get_sample_instance_position(const ALLEGRO_SAMPLE_INSTANCE *spl) +unsigned int al_get_sample_instance_position(const A5O_SAMPLE_INSTANCE *spl) { ASSERT(spl); if (spl->parent.u.ptr && spl->parent.is_voice) { - ALLEGRO_VOICE *voice = spl->parent.u.voice; + A5O_VOICE *voice = spl->parent.u.voice; return al_get_voice_position(voice); } @@ -270,7 +270,7 @@ unsigned int al_get_sample_instance_position(const ALLEGRO_SAMPLE_INSTANCE *spl) /* Function: al_get_sample_instance_speed */ -float al_get_sample_instance_speed(const ALLEGRO_SAMPLE_INSTANCE *spl) +float al_get_sample_instance_speed(const A5O_SAMPLE_INSTANCE *spl) { ASSERT(spl); @@ -280,7 +280,7 @@ float al_get_sample_instance_speed(const ALLEGRO_SAMPLE_INSTANCE *spl) /* Function: al_get_sample_instance_gain */ -float al_get_sample_instance_gain(const ALLEGRO_SAMPLE_INSTANCE *spl) +float al_get_sample_instance_gain(const A5O_SAMPLE_INSTANCE *spl) { ASSERT(spl); @@ -290,7 +290,7 @@ float al_get_sample_instance_gain(const ALLEGRO_SAMPLE_INSTANCE *spl) /* Function: al_get_sample_instance_pan */ -float al_get_sample_instance_pan(const ALLEGRO_SAMPLE_INSTANCE *spl) +float al_get_sample_instance_pan(const A5O_SAMPLE_INSTANCE *spl) { ASSERT(spl); @@ -300,7 +300,7 @@ float al_get_sample_instance_pan(const ALLEGRO_SAMPLE_INSTANCE *spl) /* Function: al_get_sample_instance_time */ -float al_get_sample_instance_time(const ALLEGRO_SAMPLE_INSTANCE *spl) +float al_get_sample_instance_time(const A5O_SAMPLE_INSTANCE *spl) { ASSERT(spl); @@ -311,7 +311,7 @@ float al_get_sample_instance_time(const ALLEGRO_SAMPLE_INSTANCE *spl) /* Function: al_get_sample_instance_depth */ -ALLEGRO_AUDIO_DEPTH al_get_sample_instance_depth(const ALLEGRO_SAMPLE_INSTANCE *spl) +A5O_AUDIO_DEPTH al_get_sample_instance_depth(const A5O_SAMPLE_INSTANCE *spl) { ASSERT(spl); @@ -321,8 +321,8 @@ ALLEGRO_AUDIO_DEPTH al_get_sample_instance_depth(const ALLEGRO_SAMPLE_INSTANCE * /* Function: al_get_sample_instance_channels */ -ALLEGRO_CHANNEL_CONF al_get_sample_instance_channels( - const ALLEGRO_SAMPLE_INSTANCE *spl) +A5O_CHANNEL_CONF al_get_sample_instance_channels( + const A5O_SAMPLE_INSTANCE *spl) { ASSERT(spl); @@ -332,7 +332,7 @@ ALLEGRO_CHANNEL_CONF al_get_sample_instance_channels( /* Function: al_get_sample_instance_playmode */ -ALLEGRO_PLAYMODE al_get_sample_instance_playmode(const ALLEGRO_SAMPLE_INSTANCE *spl) +A5O_PLAYMODE al_get_sample_instance_playmode(const A5O_SAMPLE_INSTANCE *spl) { ASSERT(spl); @@ -342,12 +342,12 @@ ALLEGRO_PLAYMODE al_get_sample_instance_playmode(const ALLEGRO_SAMPLE_INSTANCE * /* Function: al_get_sample_instance_playing */ -bool al_get_sample_instance_playing(const ALLEGRO_SAMPLE_INSTANCE *spl) +bool al_get_sample_instance_playing(const A5O_SAMPLE_INSTANCE *spl) { ASSERT(spl); if (spl->parent.u.ptr && spl->parent.is_voice) { - ALLEGRO_VOICE *voice = spl->parent.u.voice; + A5O_VOICE *voice = spl->parent.u.voice; return al_get_voice_playing(voice); } @@ -357,7 +357,7 @@ bool al_get_sample_instance_playing(const ALLEGRO_SAMPLE_INSTANCE *spl) /* Function: al_get_sample_instance_attached */ -bool al_get_sample_instance_attached(const ALLEGRO_SAMPLE_INSTANCE *spl) +bool al_get_sample_instance_attached(const A5O_SAMPLE_INSTANCE *spl) { ASSERT(spl); @@ -367,13 +367,13 @@ bool al_get_sample_instance_attached(const ALLEGRO_SAMPLE_INSTANCE *spl) /* Function: al_set_sample_instance_position */ -bool al_set_sample_instance_position(ALLEGRO_SAMPLE_INSTANCE *spl, +bool al_set_sample_instance_position(A5O_SAMPLE_INSTANCE *spl, unsigned int val) { ASSERT(spl); if (spl->parent.u.ptr && spl->parent.is_voice) { - ALLEGRO_VOICE *voice = spl->parent.u.voice; + A5O_VOICE *voice = spl->parent.u.voice; if (!al_set_voice_position(voice, val)) return false; } @@ -389,13 +389,13 @@ bool al_set_sample_instance_position(ALLEGRO_SAMPLE_INSTANCE *spl, /* Function: al_set_sample_instance_length */ -bool al_set_sample_instance_length(ALLEGRO_SAMPLE_INSTANCE *spl, +bool al_set_sample_instance_length(A5O_SAMPLE_INSTANCE *spl, unsigned int val) { ASSERT(spl); if (spl->is_playing) { - _al_set_error(ALLEGRO_INVALID_OBJECT, + _al_set_error(A5O_INVALID_OBJECT, "Attempted to change the length of a playing sample"); return false; } @@ -408,25 +408,25 @@ bool al_set_sample_instance_length(ALLEGRO_SAMPLE_INSTANCE *spl, /* Function: al_set_sample_instance_speed */ -bool al_set_sample_instance_speed(ALLEGRO_SAMPLE_INSTANCE *spl, float val) +bool al_set_sample_instance_speed(A5O_SAMPLE_INSTANCE *spl, float val) { ASSERT(spl); if (fabsf(val) < (1.0f/64.0f)) { - _al_set_error(ALLEGRO_INVALID_PARAM, + _al_set_error(A5O_INVALID_PARAM, "Attempted to set zero speed"); return false; } if (spl->parent.u.ptr && spl->parent.is_voice) { - _al_set_error(ALLEGRO_GENERIC_ERROR, + _al_set_error(A5O_GENERIC_ERROR, "Could not set voice playback speed"); return false; } spl->speed = val; if (spl->parent.u.mixer) { - ALLEGRO_MIXER *mixer = spl->parent.u.mixer; + A5O_MIXER *mixer = spl->parent.u.mixer; maybe_lock_mutex(spl->mutex); @@ -449,12 +449,12 @@ bool al_set_sample_instance_speed(ALLEGRO_SAMPLE_INSTANCE *spl, float val) /* Function: al_set_sample_instance_gain */ -bool al_set_sample_instance_gain(ALLEGRO_SAMPLE_INSTANCE *spl, float val) +bool al_set_sample_instance_gain(A5O_SAMPLE_INSTANCE *spl, float val) { ASSERT(spl); if (spl->parent.u.ptr && spl->parent.is_voice) { - _al_set_error(ALLEGRO_GENERIC_ERROR, + _al_set_error(A5O_GENERIC_ERROR, "Could not set gain of sample attached to voice"); return false; } @@ -466,7 +466,7 @@ bool al_set_sample_instance_gain(ALLEGRO_SAMPLE_INSTANCE *spl, float val) * matrix to take into account the gain. */ if (spl->parent.u.mixer) { - ALLEGRO_MIXER *mixer = spl->parent.u.mixer; + A5O_MIXER *mixer = spl->parent.u.mixer; maybe_lock_mutex(spl->mutex); _al_kcm_mixer_rejig_sample_matrix(mixer, spl); @@ -480,17 +480,17 @@ bool al_set_sample_instance_gain(ALLEGRO_SAMPLE_INSTANCE *spl, float val) /* Function: al_set_sample_instance_pan */ -bool al_set_sample_instance_pan(ALLEGRO_SAMPLE_INSTANCE *spl, float val) +bool al_set_sample_instance_pan(A5O_SAMPLE_INSTANCE *spl, float val) { ASSERT(spl); if (spl->parent.u.ptr && spl->parent.is_voice) { - _al_set_error(ALLEGRO_GENERIC_ERROR, + _al_set_error(A5O_GENERIC_ERROR, "Could not set panning of sample attached to voice"); return false; } - if (val != ALLEGRO_AUDIO_PAN_NONE && (val < -1.0 || val > 1.0)) { - _al_set_error(ALLEGRO_GENERIC_ERROR, "Invalid pan value"); + if (val != A5O_AUDIO_PAN_NONE && (val < -1.0 || val > 1.0)) { + _al_set_error(A5O_GENERIC_ERROR, "Invalid pan value"); return false; } @@ -501,7 +501,7 @@ bool al_set_sample_instance_pan(ALLEGRO_SAMPLE_INSTANCE *spl, float val) * matrix to take into account the panning. */ if (spl->parent.u.mixer) { - ALLEGRO_MIXER *mixer = spl->parent.u.mixer; + A5O_MIXER *mixer = spl->parent.u.mixer; maybe_lock_mutex(spl->mutex); _al_kcm_mixer_rejig_sample_matrix(mixer, spl); @@ -515,13 +515,13 @@ bool al_set_sample_instance_pan(ALLEGRO_SAMPLE_INSTANCE *spl, float val) /* Function: al_set_sample_instance_playmode */ -bool al_set_sample_instance_playmode(ALLEGRO_SAMPLE_INSTANCE *spl, - ALLEGRO_PLAYMODE val) +bool al_set_sample_instance_playmode(A5O_SAMPLE_INSTANCE *spl, + A5O_PLAYMODE val) { ASSERT(spl); - if (val < ALLEGRO_PLAYMODE_ONCE || val > ALLEGRO_PLAYMODE_BIDIR) { - _al_set_error(ALLEGRO_INVALID_PARAM, + if (val < A5O_PLAYMODE_ONCE || val > A5O_PLAYMODE_BIDIR) { + _al_set_error(A5O_INVALID_PARAM, "Invalid loop mode"); return false; } @@ -529,7 +529,7 @@ bool al_set_sample_instance_playmode(ALLEGRO_SAMPLE_INSTANCE *spl, maybe_lock_mutex(spl->mutex); spl->loop = val; - if (spl->loop != ALLEGRO_PLAYMODE_ONCE) { + if (spl->loop != A5O_PLAYMODE_ONCE) { if (spl->pos < spl->loop_start) spl->pos = spl->loop_start; else if (spl->pos > spl->loop_end-1) @@ -544,7 +544,7 @@ bool al_set_sample_instance_playmode(ALLEGRO_SAMPLE_INSTANCE *spl, /* Function: al_set_sample_instance_playing */ -bool al_set_sample_instance_playing(ALLEGRO_SAMPLE_INSTANCE *spl, bool val) +bool al_set_sample_instance_playing(A5O_SAMPLE_INSTANCE *spl, bool val) { ASSERT(spl); @@ -555,7 +555,7 @@ bool al_set_sample_instance_playing(ALLEGRO_SAMPLE_INSTANCE *spl, bool val) if (spl->parent.is_voice) { /* parent is voice */ - ALLEGRO_VOICE *voice = spl->parent.u.voice; + A5O_VOICE *voice = spl->parent.u.voice; return al_set_voice_playing(voice, val); } @@ -572,7 +572,7 @@ bool al_set_sample_instance_playing(ALLEGRO_SAMPLE_INSTANCE *spl, bool val) /* Function: al_detach_sample_instance */ -bool al_detach_sample_instance(ALLEGRO_SAMPLE_INSTANCE *spl) +bool al_detach_sample_instance(A5O_SAMPLE_INSTANCE *spl) { ASSERT(spl); @@ -584,7 +584,7 @@ bool al_detach_sample_instance(ALLEGRO_SAMPLE_INSTANCE *spl) /* Function: al_set_sample */ -bool al_set_sample(ALLEGRO_SAMPLE_INSTANCE *spl, ALLEGRO_SAMPLE *data) +bool al_set_sample(A5O_SAMPLE_INSTANCE *spl, A5O_SAMPLE *data) { sample_parent_t old_parent; bool need_reattach; @@ -649,7 +649,7 @@ bool al_set_sample(ALLEGRO_SAMPLE_INSTANCE *spl, ALLEGRO_SAMPLE *data) /* Function: al_get_sample */ -ALLEGRO_SAMPLE *al_get_sample(ALLEGRO_SAMPLE_INSTANCE *spl) +A5O_SAMPLE *al_get_sample(A5O_SAMPLE_INSTANCE *spl) { ASSERT(spl); @@ -659,19 +659,19 @@ ALLEGRO_SAMPLE *al_get_sample(ALLEGRO_SAMPLE_INSTANCE *spl) /* Function: al_set_sample_instance_channel_matrix */ -bool al_set_sample_instance_channel_matrix(ALLEGRO_SAMPLE_INSTANCE *spl, const float *matrix) +bool al_set_sample_instance_channel_matrix(A5O_SAMPLE_INSTANCE *spl, const float *matrix) { ASSERT(spl); ASSERT(matrix); if (spl->parent.u.ptr && spl->parent.is_voice) { - _al_set_error(ALLEGRO_GENERIC_ERROR, + _al_set_error(A5O_GENERIC_ERROR, "Could not set channel matrix of sample attached to voice"); return false; } if (spl->parent.u.mixer) { - ALLEGRO_MIXER *mixer = spl->parent.u.mixer; + A5O_MIXER *mixer = spl->parent.u.mixer; size_t dst_chans = al_get_channel_count(mixer->ss.spl_data.chan_conf); size_t src_chans = al_get_channel_count(spl->spl_data.chan_conf); ASSERT(spl->matrix); diff --git a/addons/audio/kcm_mixer.c b/addons/audio/kcm_mixer.c index 70facbd63d..74be835a89 100644 --- a/addons/audio/kcm_mixer.c +++ b/addons/audio/kcm_mixer.c @@ -16,18 +16,18 @@ #include "allegro5/internal/aintern_audio.h" #include "allegro5/internal/aintern_audio_cfg.h" -ALLEGRO_DEBUG_CHANNEL("audio") +A5O_DEBUG_CHANNEL("audio") typedef union { - float f32[ALLEGRO_MAX_CHANNELS]; /* max: 7.1 */ - int16_t s16[ALLEGRO_MAX_CHANNELS]; + float f32[A5O_MAX_CHANNELS]; /* max: 7.1 */ + int16_t s16[A5O_MAX_CHANNELS]; void *ptr; } SAMP_BUF; -static void maybe_lock_mutex(ALLEGRO_MUTEX *mutex) +static void maybe_lock_mutex(A5O_MUTEX *mutex) { if (mutex) { al_lock_mutex(mutex); @@ -35,7 +35,7 @@ static void maybe_lock_mutex(ALLEGRO_MUTEX *mutex) } -static void maybe_unlock_mutex(ALLEGRO_MUTEX *mutex) +static void maybe_unlock_mutex(A5O_MUTEX *mutex) { if (mutex) { al_unlock_mutex(mutex); @@ -49,11 +49,11 @@ static void maybe_unlock_mutex(ALLEGRO_MUTEX *mutex) * * Returns a pointer to a statically allocated array. */ -static float *_al_rechannel_matrix(ALLEGRO_CHANNEL_CONF orig, - ALLEGRO_CHANNEL_CONF target, float gain, float pan) +static float *_al_rechannel_matrix(A5O_CHANNEL_CONF orig, + A5O_CHANNEL_CONF target, float gain, float pan) { /* Max 7.1 (8 channels) for input and output */ - static float mat[ALLEGRO_MAX_CHANNELS][ALLEGRO_MAX_CHANNELS]; + static float mat[A5O_MAX_CHANNELS][A5O_MAX_CHANNELS]; size_t dst_chans = al_get_channel_count(target); size_t src_chans = al_get_channel_count(orig); @@ -95,7 +95,7 @@ static float *_al_rechannel_matrix(ALLEGRO_CHANNEL_CONF orig, * I took that to mean we want: * sqrt(rgain^2 + lgain^2) = 1.0 */ - if (pan != ALLEGRO_AUDIO_PAN_NONE) { + if (pan != A5O_AUDIO_PAN_NONE) { float rgain = sqrt(( pan + 1.0f) / 2.0f); float lgain = sqrt((-pan + 1.0f) / 2.0f); @@ -118,13 +118,13 @@ static float *_al_rechannel_matrix(ALLEGRO_CHANNEL_CONF orig, #ifdef DEBUGMODE { char debug[1024]; - ALLEGRO_DEBUG("sample matrix:\n"); + A5O_DEBUG("sample matrix:\n"); for (i = 0; i < dst_chans; i++) { strcpy(debug, ""); for (j = 0; j < src_chans; j++) { sprintf(debug + strlen(debug), " %f", mat[i][j]); } - ALLEGRO_DEBUG("%s\n", debug); + A5O_DEBUG("%s\n", debug); } } #endif @@ -137,8 +137,8 @@ static float *_al_rechannel_matrix(ALLEGRO_CHANNEL_CONF orig, * Recompute the mixing matrix for a sample attached to a mixer. * The caller must be holding the mixer mutex. */ -void _al_kcm_mixer_rejig_sample_matrix(ALLEGRO_MIXER *mixer, - ALLEGRO_SAMPLE_INSTANCE *spl) +void _al_kcm_mixer_rejig_sample_matrix(A5O_MIXER *mixer, + A5O_SAMPLE_INSTANCE *spl) { float *mat; size_t dst_chans; @@ -156,7 +156,7 @@ void _al_kcm_mixer_rejig_sample_matrix(ALLEGRO_MIXER *mixer, for (i = 0; i < dst_chans; i++) { for (j = 0; j < src_chans; j++) { - spl->matrix[i*src_chans + j] = mat[i*ALLEGRO_MAX_CHANNELS + j]; + spl->matrix[i*src_chans + j] = mat[i*A5O_MAX_CHANNELS + j]; } } } @@ -167,14 +167,14 @@ void _al_kcm_mixer_rejig_sample_matrix(ALLEGRO_MIXER *mixer, * allow it to safely continue playing as expected. Returns false if it * should stop being mixed. */ -static bool fix_looped_position(ALLEGRO_SAMPLE_INSTANCE *spl) +static bool fix_looped_position(A5O_SAMPLE_INSTANCE *spl) { bool is_empty; - ALLEGRO_AUDIO_STREAM *stream; + A5O_AUDIO_STREAM *stream; /* Looping! Should be mostly self-explanatory */ switch (spl->loop) { - case ALLEGRO_PLAYMODE_LOOP: + case A5O_PLAYMODE_LOOP: if (spl->loop_end - spl->loop_start != 0) { if (spl->step > 0) { while (spl->pos >= spl->loop_end) { @@ -189,7 +189,7 @@ static bool fix_looped_position(ALLEGRO_SAMPLE_INSTANCE *spl) } return true; - case ALLEGRO_PLAYMODE_BIDIR: + case A5O_PLAYMODE_BIDIR: /* When doing bi-directional looping, you need to do a follow-up * check for the opposite direction if a loop occurred, otherwise * you could end up misplaced on small, high-step loops. @@ -214,7 +214,7 @@ static bool fix_looped_position(ALLEGRO_SAMPLE_INSTANCE *spl) } return true; - case ALLEGRO_PLAYMODE_LOOP_ONCE: + case A5O_PLAYMODE_LOOP_ONCE: if (spl->pos < spl->loop_end && spl->pos >= 0) { return true; } @@ -225,7 +225,7 @@ static bool fix_looped_position(ALLEGRO_SAMPLE_INSTANCE *spl) spl->is_playing = false; return false; - case ALLEGRO_PLAYMODE_ONCE: + case A5O_PLAYMODE_ONCE: if (spl->pos < spl->spl_data.len && spl->pos >= 0) { return true; } @@ -236,10 +236,10 @@ static bool fix_looped_position(ALLEGRO_SAMPLE_INSTANCE *spl) spl->is_playing = false; return false; - case _ALLEGRO_PLAYMODE_STREAM_ONCE: - case _ALLEGRO_PLAYMODE_STREAM_LOOP_ONCE: - case _ALLEGRO_PLAYMODE_STREAM_ONEDIR: - stream = (ALLEGRO_AUDIO_STREAM *)spl; + case _A5O_PLAYMODE_STREAM_ONCE: + case _A5O_PLAYMODE_STREAM_LOOP_ONCE: + case _A5O_PLAYMODE_STREAM_ONEDIR: + stream = (A5O_AUDIO_STREAM *)spl; is_empty = false; while (spl->pos >= spl->spl_data.len && stream->spl.is_playing && !is_empty) { is_empty = !_al_kcm_refill_stream(stream); @@ -293,9 +293,9 @@ static INLINE int32_t clamp(int32_t val, int32_t min, int32_t max) #define MAKE_MIXER(NAME, NEXT_SAMPLE_VALUE, TYPE) \ static void NAME(void *source, void **vbuf, unsigned int *samples, \ - ALLEGRO_AUDIO_DEPTH buffer_depth, size_t dest_maxc) \ + A5O_AUDIO_DEPTH buffer_depth, size_t dest_maxc) \ { \ - ALLEGRO_SAMPLE_INSTANCE *spl = (ALLEGRO_SAMPLE_INSTANCE *)source; \ + A5O_SAMPLE_INSTANCE *spl = (A5O_SAMPLE_INSTANCE *)source; \ TYPE *buf = *vbuf; \ size_t maxc = al_get_channel_count(spl->spl_data.chan_conf); \ size_t samples_l = *samples; \ @@ -322,7 +322,7 @@ static void NAME(void *source, void **vbuf, unsigned int *samples, \ s = (TYPE *) NEXT_SAMPLE_VALUE(&samp_buf, spl, maxc); \ \ for (c = 0; c < dest_maxc; c++) { \ - ALLEGRO_STATIC_ASSERT(kcm_mixer, ALLEGRO_MAX_CHANNELS == 8); \ + A5O_STATIC_ASSERT(kcm_mixer, A5O_MAX_CHANNELS == 8); \ switch (maxc) { \ case 8: *buf += s[7] * spl->matrix[c*maxc + 7]; \ /* fall through */ \ @@ -372,10 +372,10 @@ MAKE_MIXER(read_to_mixer_linear_int16_t_16, linear_spl16, int16_t) * set it to the buffer pointer). */ void _al_kcm_mixer_read(void *source, void **buf, unsigned int *samples, - ALLEGRO_AUDIO_DEPTH buffer_depth, size_t dest_maxc) + A5O_AUDIO_DEPTH buffer_depth, size_t dest_maxc) { - const ALLEGRO_MIXER *mixer; - ALLEGRO_MIXER *m = (ALLEGRO_MIXER *)source; + const A5O_MIXER *mixer; + A5O_MIXER *m = (A5O_MIXER *)source; int maxc = al_get_channel_count(m->ss.spl_data.chan_conf); int samples_l = *samples; int i; @@ -388,7 +388,7 @@ void _al_kcm_mixer_read(void *source, void **buf, unsigned int *samples, al_free(m->ss.spl_data.buffer.ptr); m->ss.spl_data.buffer.ptr = al_malloc(samples_l*maxc*al_get_audio_depth_size(m->ss.spl_data.depth)); if (!m->ss.spl_data.buffer.ptr) { - _al_set_error(ALLEGRO_GENERIC_ERROR, + _al_set_error(A5O_GENERIC_ERROR, "Out of memory allocating mixer buffer"); m->ss.spl_data.len = 0; return; @@ -403,8 +403,8 @@ void _al_kcm_mixer_read(void *source, void **buf, unsigned int *samples, /* Mix the streams into the mixer buffer. */ for (i = _al_vector_size(&mixer->streams) - 1; i >= 0; i--) { - ALLEGRO_SAMPLE_INSTANCE **slot = _al_vector_ref(&mixer->streams, i); - ALLEGRO_SAMPLE_INSTANCE *spl = *slot; + A5O_SAMPLE_INSTANCE **slot = _al_vector_ref(&mixer->streams, i); + A5O_SAMPLE_INSTANCE *spl = *slot; ASSERT(spl->spl_read); spl->spl_read(spl, (void **) &mixer->ss.spl_data.buffer.ptr, samples, m->ss.spl_data.depth, maxc); @@ -424,7 +424,7 @@ void _al_kcm_mixer_read(void *source, void **buf, unsigned int *samples, unsigned long i = samples_l; switch (m->ss.spl_data.depth) { - case ALLEGRO_AUDIO_DEPTH_FLOAT32: { + case A5O_AUDIO_DEPTH_FLOAT32: { float *p = mixer->ss.spl_data.buffer.f32; while (i-- > 0) { *p++ *= mixer_gain; @@ -432,7 +432,7 @@ void _al_kcm_mixer_read(void *source, void **buf, unsigned int *samples, break; } - case ALLEGRO_AUDIO_DEPTH_INT16: { + case A5O_AUDIO_DEPTH_INT16: { int16_t *p = mixer->ss.spl_data.buffer.s16; while (i-- > 0) { *p++ *= mixer_gain; @@ -440,11 +440,11 @@ void _al_kcm_mixer_read(void *source, void **buf, unsigned int *samples, break; } - case ALLEGRO_AUDIO_DEPTH_INT8: - case ALLEGRO_AUDIO_DEPTH_INT24: - case ALLEGRO_AUDIO_DEPTH_UINT8: - case ALLEGRO_AUDIO_DEPTH_UINT16: - case ALLEGRO_AUDIO_DEPTH_UINT24: + case A5O_AUDIO_DEPTH_INT8: + case A5O_AUDIO_DEPTH_INT24: + case A5O_AUDIO_DEPTH_UINT8: + case A5O_AUDIO_DEPTH_UINT16: + case A5O_AUDIO_DEPTH_UINT24: /* Unsupported mixer depths. */ ASSERT(false); break; @@ -456,7 +456,7 @@ void _al_kcm_mixer_read(void *source, void **buf, unsigned int *samples, */ if (*buf) { switch (m->ss.spl_data.depth) { - case ALLEGRO_AUDIO_DEPTH_FLOAT32: { + case A5O_AUDIO_DEPTH_FLOAT32: { /* We don't need to clamp in the mixer yet. */ float *lbuf = *buf; float *src = mixer->ss.spl_data.buffer.f32; @@ -467,7 +467,7 @@ void _al_kcm_mixer_read(void *source, void **buf, unsigned int *samples, } break; - case ALLEGRO_AUDIO_DEPTH_INT16: { + case A5O_AUDIO_DEPTH_INT16: { int16_t *lbuf = *buf; int16_t *src = mixer->ss.spl_data.buffer.s16; while (samples_l-- > 0) { @@ -483,11 +483,11 @@ void _al_kcm_mixer_read(void *source, void **buf, unsigned int *samples, break; } - case ALLEGRO_AUDIO_DEPTH_INT8: - case ALLEGRO_AUDIO_DEPTH_INT24: - case ALLEGRO_AUDIO_DEPTH_UINT8: - case ALLEGRO_AUDIO_DEPTH_UINT16: - case ALLEGRO_AUDIO_DEPTH_UINT24: + case A5O_AUDIO_DEPTH_INT8: + case A5O_AUDIO_DEPTH_INT24: + case A5O_AUDIO_DEPTH_UINT8: + case A5O_AUDIO_DEPTH_UINT16: + case A5O_AUDIO_DEPTH_UINT24: /* Unsupported mixer depths. */ ASSERT(false); break; @@ -500,16 +500,16 @@ void _al_kcm_mixer_read(void *source, void **buf, unsigned int *samples, * Clamp and convert the mixed data for the voice. */ *buf = mixer->ss.spl_data.buffer.ptr; - switch (buffer_depth & ~ALLEGRO_AUDIO_DEPTH_UNSIGNED) { + switch (buffer_depth & ~A5O_AUDIO_DEPTH_UNSIGNED) { - case ALLEGRO_AUDIO_DEPTH_FLOAT32: + case A5O_AUDIO_DEPTH_FLOAT32: /* Do we need to clamp? */ break; - case ALLEGRO_AUDIO_DEPTH_INT24: + case A5O_AUDIO_DEPTH_INT24: switch (mixer->ss.spl_data.depth) { - case ALLEGRO_AUDIO_DEPTH_FLOAT32: { - int32_t off = ((buffer_depth & ALLEGRO_AUDIO_DEPTH_UNSIGNED) + case A5O_AUDIO_DEPTH_FLOAT32: { + int32_t off = ((buffer_depth & A5O_AUDIO_DEPTH_UNSIGNED) ? 0x800000 : 0); int32_t *lbuf = mixer->ss.spl_data.buffer.s24; float *src = mixer->ss.spl_data.buffer.f32; @@ -524,26 +524,26 @@ void _al_kcm_mixer_read(void *source, void **buf, unsigned int *samples, break; } - case ALLEGRO_AUDIO_DEPTH_INT16: + case A5O_AUDIO_DEPTH_INT16: /* XXX not yet implemented */ ASSERT(false); break; - case ALLEGRO_AUDIO_DEPTH_INT8: - case ALLEGRO_AUDIO_DEPTH_INT24: - case ALLEGRO_AUDIO_DEPTH_UINT8: - case ALLEGRO_AUDIO_DEPTH_UINT16: - case ALLEGRO_AUDIO_DEPTH_UINT24: + case A5O_AUDIO_DEPTH_INT8: + case A5O_AUDIO_DEPTH_INT24: + case A5O_AUDIO_DEPTH_UINT8: + case A5O_AUDIO_DEPTH_UINT16: + case A5O_AUDIO_DEPTH_UINT24: /* Unsupported mixer depths. */ ASSERT(false); break; } break; - case ALLEGRO_AUDIO_DEPTH_INT16: + case A5O_AUDIO_DEPTH_INT16: switch (mixer->ss.spl_data.depth) { - case ALLEGRO_AUDIO_DEPTH_FLOAT32: { - int16_t off = ((buffer_depth & ALLEGRO_AUDIO_DEPTH_UNSIGNED) + case A5O_AUDIO_DEPTH_FLOAT32: { + int16_t off = ((buffer_depth & A5O_AUDIO_DEPTH_UNSIGNED) ? 0x8000 : 0); int16_t *lbuf = mixer->ss.spl_data.buffer.s16; float *src = mixer->ss.spl_data.buffer.f32; @@ -557,9 +557,9 @@ void _al_kcm_mixer_read(void *source, void **buf, unsigned int *samples, break; } - case ALLEGRO_AUDIO_DEPTH_INT16: + case A5O_AUDIO_DEPTH_INT16: /* Handle signedness differences. */ - if (buffer_depth != ALLEGRO_AUDIO_DEPTH_INT16) { + if (buffer_depth != A5O_AUDIO_DEPTH_INT16) { int16_t *lbuf = mixer->ss.spl_data.buffer.s16; while (samples_l > 0) { *lbuf++ ^= 0x8000; @@ -568,11 +568,11 @@ void _al_kcm_mixer_read(void *source, void **buf, unsigned int *samples, } break; - case ALLEGRO_AUDIO_DEPTH_INT8: - case ALLEGRO_AUDIO_DEPTH_INT24: - case ALLEGRO_AUDIO_DEPTH_UINT8: - case ALLEGRO_AUDIO_DEPTH_UINT16: - case ALLEGRO_AUDIO_DEPTH_UINT24: + case A5O_AUDIO_DEPTH_INT8: + case A5O_AUDIO_DEPTH_INT24: + case A5O_AUDIO_DEPTH_UINT8: + case A5O_AUDIO_DEPTH_UINT16: + case A5O_AUDIO_DEPTH_UINT24: /* Unsupported mixer depths. */ ASSERT(false); break; @@ -580,10 +580,10 @@ void _al_kcm_mixer_read(void *source, void **buf, unsigned int *samples, break; /* Ugh, do we really want to support 8-bit output? */ - case ALLEGRO_AUDIO_DEPTH_INT8: + case A5O_AUDIO_DEPTH_INT8: switch (mixer->ss.spl_data.depth) { - case ALLEGRO_AUDIO_DEPTH_FLOAT32: { - int8_t off = ((buffer_depth & ALLEGRO_AUDIO_DEPTH_UNSIGNED) + case A5O_AUDIO_DEPTH_FLOAT32: { + int8_t off = ((buffer_depth & A5O_AUDIO_DEPTH_UNSIGNED) ? 0x80 : 0); int8_t *lbuf = mixer->ss.spl_data.buffer.s8; float *src = mixer->ss.spl_data.buffer.f32; @@ -597,25 +597,25 @@ void _al_kcm_mixer_read(void *source, void **buf, unsigned int *samples, break; } - case ALLEGRO_AUDIO_DEPTH_INT16: + case A5O_AUDIO_DEPTH_INT16: /* XXX not yet implemented */ ASSERT(false); break; - case ALLEGRO_AUDIO_DEPTH_INT8: - case ALLEGRO_AUDIO_DEPTH_INT24: - case ALLEGRO_AUDIO_DEPTH_UINT8: - case ALLEGRO_AUDIO_DEPTH_UINT16: - case ALLEGRO_AUDIO_DEPTH_UINT24: + case A5O_AUDIO_DEPTH_INT8: + case A5O_AUDIO_DEPTH_INT24: + case A5O_AUDIO_DEPTH_UINT8: + case A5O_AUDIO_DEPTH_UINT16: + case A5O_AUDIO_DEPTH_UINT24: /* Unsupported mixer depths. */ ASSERT(false); break; } break; - case ALLEGRO_AUDIO_DEPTH_UINT8: - case ALLEGRO_AUDIO_DEPTH_UINT16: - case ALLEGRO_AUDIO_DEPTH_UINT24: + case A5O_AUDIO_DEPTH_UINT8: + case A5O_AUDIO_DEPTH_UINT16: + case A5O_AUDIO_DEPTH_UINT24: /* Impossible. */ ASSERT(false); break; @@ -627,11 +627,11 @@ void _al_kcm_mixer_read(void *source, void **buf, unsigned int *samples, /* Function: al_create_mixer */ -ALLEGRO_MIXER *al_create_mixer(unsigned int freq, - ALLEGRO_AUDIO_DEPTH depth, ALLEGRO_CHANNEL_CONF chan_conf) +A5O_MIXER *al_create_mixer(unsigned int freq, + A5O_AUDIO_DEPTH depth, A5O_CHANNEL_CONF chan_conf) { - ALLEGRO_MIXER *mixer; - int default_mixer_quality = ALLEGRO_MIXER_QUALITY_LINEAR; + A5O_MIXER *mixer; + int default_mixer_quality = A5O_MIXER_QUALITY_LINEAR; const char *p; /* XXX this is in the wrong place */ @@ -639,34 +639,34 @@ ALLEGRO_MIXER *al_create_mixer(unsigned int freq, "default_mixer_quality"); if (p && p[0] != '\0') { if (!_al_stricmp(p, "point")) { - ALLEGRO_INFO("Point sampling\n"); - default_mixer_quality = ALLEGRO_MIXER_QUALITY_POINT; + A5O_INFO("Point sampling\n"); + default_mixer_quality = A5O_MIXER_QUALITY_POINT; } else if (!_al_stricmp(p, "linear")) { - ALLEGRO_INFO("Linear interpolation\n"); - default_mixer_quality = ALLEGRO_MIXER_QUALITY_LINEAR; + A5O_INFO("Linear interpolation\n"); + default_mixer_quality = A5O_MIXER_QUALITY_LINEAR; } else if (!_al_stricmp(p, "cubic")) { - ALLEGRO_INFO("Cubic interpolation\n"); - default_mixer_quality = ALLEGRO_MIXER_QUALITY_CUBIC; + A5O_INFO("Cubic interpolation\n"); + default_mixer_quality = A5O_MIXER_QUALITY_CUBIC; } } if (!freq) { - _al_set_error(ALLEGRO_INVALID_PARAM, + _al_set_error(A5O_INVALID_PARAM, "Attempted to create mixer with no frequency"); return NULL; } - if (depth != ALLEGRO_AUDIO_DEPTH_FLOAT32 && - depth != ALLEGRO_AUDIO_DEPTH_INT16) { - _al_set_error(ALLEGRO_INVALID_PARAM, "Unsupported mixer depth"); + if (depth != A5O_AUDIO_DEPTH_FLOAT32 && + depth != A5O_AUDIO_DEPTH_INT16) { + _al_set_error(A5O_INVALID_PARAM, "Unsupported mixer depth"); return NULL; } - mixer = al_calloc(1, sizeof(ALLEGRO_MIXER)); + mixer = al_calloc(1, sizeof(A5O_MIXER)); if (!mixer) { - _al_set_error(ALLEGRO_GENERIC_ERROR, + _al_set_error(A5O_GENERIC_ERROR, "Out of memory allocating mixer object"); return NULL; } @@ -674,7 +674,7 @@ ALLEGRO_MIXER *al_create_mixer(unsigned int freq, mixer->ss.is_playing = true; mixer->ss.spl_data.free_buf = true; - mixer->ss.loop = ALLEGRO_PLAYMODE_ONCE; + mixer->ss.loop = A5O_PLAYMODE_ONCE; /* XXX should we have a specific loop mode? */ mixer->ss.gain = 1.0f; mixer->ss.spl_data.depth = depth; @@ -686,7 +686,7 @@ ALLEGRO_MIXER *al_create_mixer(unsigned int freq, mixer->quality = default_mixer_quality; - _al_vector_init(&mixer->streams, sizeof(ALLEGRO_SAMPLE_INSTANCE *)); + _al_vector_init(&mixer->streams, sizeof(A5O_SAMPLE_INSTANCE *)); mixer->dtor_item = _al_kcm_register_destructor("mixer", mixer, (void (*)(void *)) al_destroy_mixer); @@ -696,7 +696,7 @@ ALLEGRO_MIXER *al_create_mixer(unsigned int freq, /* Function: al_destroy_mixer */ -void al_destroy_mixer(ALLEGRO_MIXER *mixer) +void al_destroy_mixer(A5O_MIXER *mixer) { if (mixer) { _al_kcm_unregister_destructor(mixer->dtor_item); @@ -705,20 +705,20 @@ void al_destroy_mixer(ALLEGRO_MIXER *mixer) } -/* This function is ALLEGRO_MIXER aware */ +/* This function is A5O_MIXER aware */ /* Function: al_attach_sample_instance_to_mixer */ -bool al_attach_sample_instance_to_mixer(ALLEGRO_SAMPLE_INSTANCE *spl, - ALLEGRO_MIXER *mixer) +bool al_attach_sample_instance_to_mixer(A5O_SAMPLE_INSTANCE *spl, + A5O_MIXER *mixer) { - ALLEGRO_SAMPLE_INSTANCE **slot; + A5O_SAMPLE_INSTANCE **slot; ASSERT(mixer); ASSERT(spl); /* Already referenced, do not attach. */ if (spl->parent.u.ptr) { - _al_set_error(ALLEGRO_INVALID_OBJECT, + _al_set_error(A5O_INVALID_OBJECT, "Attempted to attach a sample that's already attached"); return false; } @@ -732,7 +732,7 @@ bool al_attach_sample_instance_to_mixer(ALLEGRO_SAMPLE_INSTANCE *spl, if (mixer->ss.mutex) { al_unlock_mutex(mixer->ss.mutex); } - _al_set_error(ALLEGRO_GENERIC_ERROR, + _al_set_error(A5O_GENERIC_ERROR, "Out of memory allocating attachment pointers"); return false; } @@ -755,39 +755,39 @@ bool al_attach_sample_instance_to_mixer(ALLEGRO_SAMPLE_INSTANCE *spl, } else { switch (mixer->ss.spl_data.depth) { - case ALLEGRO_AUDIO_DEPTH_FLOAT32: + case A5O_AUDIO_DEPTH_FLOAT32: switch (mixer->quality) { - case ALLEGRO_MIXER_QUALITY_POINT: + case A5O_MIXER_QUALITY_POINT: spl->spl_read = read_to_mixer_point_float_32; break; - case ALLEGRO_MIXER_QUALITY_LINEAR: + case A5O_MIXER_QUALITY_LINEAR: spl->spl_read = read_to_mixer_linear_float_32; break; - case ALLEGRO_MIXER_QUALITY_CUBIC: + case A5O_MIXER_QUALITY_CUBIC: spl->spl_read = read_to_mixer_cubic_float_32; break; } break; - case ALLEGRO_AUDIO_DEPTH_INT16: + case A5O_AUDIO_DEPTH_INT16: switch (mixer->quality) { - case ALLEGRO_MIXER_QUALITY_POINT: + case A5O_MIXER_QUALITY_POINT: spl->spl_read = read_to_mixer_point_int16_t_16; break; - case ALLEGRO_MIXER_QUALITY_CUBIC: - ALLEGRO_WARN("Falling back to linear interpolation\n"); + case A5O_MIXER_QUALITY_CUBIC: + A5O_WARN("Falling back to linear interpolation\n"); /* fallthrough */ - case ALLEGRO_MIXER_QUALITY_LINEAR: + case A5O_MIXER_QUALITY_LINEAR: spl->spl_read = read_to_mixer_linear_int16_t_16; break; } break; - case ALLEGRO_AUDIO_DEPTH_INT8: - case ALLEGRO_AUDIO_DEPTH_INT24: - case ALLEGRO_AUDIO_DEPTH_UINT8: - case ALLEGRO_AUDIO_DEPTH_UINT16: - case ALLEGRO_AUDIO_DEPTH_UINT24: + case A5O_AUDIO_DEPTH_INT8: + case A5O_AUDIO_DEPTH_INT24: + case A5O_AUDIO_DEPTH_UINT8: + case A5O_AUDIO_DEPTH_UINT16: + case A5O_AUDIO_DEPTH_UINT24: /* Unsupported mixer depths. */ ASSERT(false); break; @@ -807,7 +807,7 @@ bool al_attach_sample_instance_to_mixer(ALLEGRO_SAMPLE_INSTANCE *spl, /* Function: al_attach_audio_stream_to_mixer */ -bool al_attach_audio_stream_to_mixer(ALLEGRO_AUDIO_STREAM *stream, ALLEGRO_MIXER *mixer) +bool al_attach_audio_stream_to_mixer(A5O_AUDIO_STREAM *stream, A5O_MIXER *mixer) { ASSERT(mixer); ASSERT(stream); @@ -818,26 +818,26 @@ bool al_attach_audio_stream_to_mixer(ALLEGRO_AUDIO_STREAM *stream, ALLEGRO_MIXER /* Function: al_attach_mixer_to_mixer */ -bool al_attach_mixer_to_mixer(ALLEGRO_MIXER *stream, ALLEGRO_MIXER *mixer) +bool al_attach_mixer_to_mixer(A5O_MIXER *stream, A5O_MIXER *mixer) { ASSERT(mixer); ASSERT(stream); ASSERT(mixer != stream); if (mixer->ss.spl_data.frequency != stream->ss.spl_data.frequency) { - _al_set_error(ALLEGRO_INVALID_OBJECT, + _al_set_error(A5O_INVALID_OBJECT, "Attempted to attach a mixer with different frequencies"); return false; } if (mixer->ss.spl_data.depth != stream->ss.spl_data.depth) { - _al_set_error(ALLEGRO_INVALID_OBJECT, + _al_set_error(A5O_INVALID_OBJECT, "Mixers of different audio depths cannot be attached to one another"); return false; } if (mixer->ss.spl_data.chan_conf != stream->ss.spl_data.chan_conf) { - _al_set_error(ALLEGRO_INVALID_OBJECT, + _al_set_error(A5O_INVALID_OBJECT, "Mixers of different channel configurations cannot be attached to one another"); return false; } @@ -848,7 +848,7 @@ bool al_attach_mixer_to_mixer(ALLEGRO_MIXER *stream, ALLEGRO_MIXER *mixer) /* Function: al_set_mixer_postprocess_callback */ -bool al_set_mixer_postprocess_callback(ALLEGRO_MIXER *mixer, +bool al_set_mixer_postprocess_callback(A5O_MIXER *mixer, void (*pp_callback)(void *buf, unsigned int samples, void *data), void *pp_callback_userdata) { @@ -867,7 +867,7 @@ bool al_set_mixer_postprocess_callback(ALLEGRO_MIXER *mixer, /* Function: al_get_mixer_frequency */ -unsigned int al_get_mixer_frequency(const ALLEGRO_MIXER *mixer) +unsigned int al_get_mixer_frequency(const A5O_MIXER *mixer) { ASSERT(mixer); @@ -877,7 +877,7 @@ unsigned int al_get_mixer_frequency(const ALLEGRO_MIXER *mixer) /* Function: al_get_mixer_channels */ -ALLEGRO_CHANNEL_CONF al_get_mixer_channels(const ALLEGRO_MIXER *mixer) +A5O_CHANNEL_CONF al_get_mixer_channels(const A5O_MIXER *mixer) { ASSERT(mixer); @@ -887,7 +887,7 @@ ALLEGRO_CHANNEL_CONF al_get_mixer_channels(const ALLEGRO_MIXER *mixer) /* Function: al_get_mixer_depth */ -ALLEGRO_AUDIO_DEPTH al_get_mixer_depth(const ALLEGRO_MIXER *mixer) +A5O_AUDIO_DEPTH al_get_mixer_depth(const A5O_MIXER *mixer) { ASSERT(mixer); @@ -897,7 +897,7 @@ ALLEGRO_AUDIO_DEPTH al_get_mixer_depth(const ALLEGRO_MIXER *mixer) /* Function: al_get_mixer_quality */ -ALLEGRO_MIXER_QUALITY al_get_mixer_quality(const ALLEGRO_MIXER *mixer) +A5O_MIXER_QUALITY al_get_mixer_quality(const A5O_MIXER *mixer) { ASSERT(mixer); @@ -907,7 +907,7 @@ ALLEGRO_MIXER_QUALITY al_get_mixer_quality(const ALLEGRO_MIXER *mixer) /* Function: al_get_mixer_gain */ -float al_get_mixer_gain(const ALLEGRO_MIXER *mixer) +float al_get_mixer_gain(const A5O_MIXER *mixer) { ASSERT(mixer); @@ -917,7 +917,7 @@ float al_get_mixer_gain(const ALLEGRO_MIXER *mixer) /* Function: al_get_mixer_playing */ -bool al_get_mixer_playing(const ALLEGRO_MIXER *mixer) +bool al_get_mixer_playing(const A5O_MIXER *mixer) { ASSERT(mixer); @@ -927,7 +927,7 @@ bool al_get_mixer_playing(const ALLEGRO_MIXER *mixer) /* Function: al_get_mixer_attached */ -bool al_get_mixer_attached(const ALLEGRO_MIXER *mixer) +bool al_get_mixer_attached(const A5O_MIXER *mixer) { ASSERT(mixer); @@ -936,7 +936,7 @@ bool al_get_mixer_attached(const ALLEGRO_MIXER *mixer) /* Function: al_mixer_has_attachments */ -bool al_mixer_has_attachments(const ALLEGRO_MIXER* mixer) +bool al_mixer_has_attachments(const A5O_MIXER* mixer) { ASSERT(mixer); @@ -946,7 +946,7 @@ bool al_mixer_has_attachments(const ALLEGRO_MIXER* mixer) /* Function: al_set_mixer_frequency */ -bool al_set_mixer_frequency(ALLEGRO_MIXER *mixer, unsigned int val) +bool al_set_mixer_frequency(A5O_MIXER *mixer, unsigned int val) { ASSERT(mixer); @@ -954,7 +954,7 @@ bool al_set_mixer_frequency(ALLEGRO_MIXER *mixer, unsigned int val) * to anything. */ if (mixer->ss.parent.u.ptr) { - _al_set_error(ALLEGRO_INVALID_OBJECT, + _al_set_error(A5O_INVALID_OBJECT, "Attempted to change the frequency of an attached mixer"); return false; } @@ -966,7 +966,7 @@ bool al_set_mixer_frequency(ALLEGRO_MIXER *mixer, unsigned int val) /* Function: al_set_mixer_quality */ -bool al_set_mixer_quality(ALLEGRO_MIXER *mixer, ALLEGRO_MIXER_QUALITY new_quality) +bool al_set_mixer_quality(A5O_MIXER *mixer, A5O_MIXER_QUALITY new_quality) { bool ret; ASSERT(mixer); @@ -981,7 +981,7 @@ bool al_set_mixer_quality(ALLEGRO_MIXER *mixer, ALLEGRO_MIXER_QUALITY new_qualit ret = true; } else { - _al_set_error(ALLEGRO_INVALID_OBJECT, + _al_set_error(A5O_INVALID_OBJECT, "Attempted to change the quality of a mixer with attachments"); ret = false; } @@ -994,7 +994,7 @@ bool al_set_mixer_quality(ALLEGRO_MIXER *mixer, ALLEGRO_MIXER_QUALITY new_qualit /* Function: al_set_mixer_gain */ -bool al_set_mixer_gain(ALLEGRO_MIXER *mixer, float new_gain) +bool al_set_mixer_gain(A5O_MIXER *mixer, float new_gain) { int i; ASSERT(mixer); @@ -1005,7 +1005,7 @@ bool al_set_mixer_gain(ALLEGRO_MIXER *mixer, float new_gain) mixer->ss.gain = new_gain; for (i = _al_vector_size(&mixer->streams) - 1; i >= 0; i--) { - ALLEGRO_SAMPLE_INSTANCE **slot = _al_vector_ref(&mixer->streams, i); + A5O_SAMPLE_INSTANCE **slot = _al_vector_ref(&mixer->streams, i); _al_kcm_mixer_rejig_sample_matrix(mixer, *slot); } } @@ -1018,7 +1018,7 @@ bool al_set_mixer_gain(ALLEGRO_MIXER *mixer, float new_gain) /* Function: al_set_mixer_playing */ -bool al_set_mixer_playing(ALLEGRO_MIXER *mixer, bool val) +bool al_set_mixer_playing(A5O_MIXER *mixer, bool val) { ASSERT(mixer); @@ -1029,7 +1029,7 @@ bool al_set_mixer_playing(ALLEGRO_MIXER *mixer, bool val) /* Function: al_detach_mixer */ -bool al_detach_mixer(ALLEGRO_MIXER *mixer) +bool al_detach_mixer(A5O_MIXER *mixer) { ASSERT(mixer); diff --git a/addons/audio/kcm_mixer_helpers.inc b/addons/audio/kcm_mixer_helpers.inc index 94fc857ac1..91b569ba73 100644 --- a/addons/audio/kcm_mixer_helpers.inc +++ b/addons/audio/kcm_mixer_helpers.inc @@ -1,48 +1,48 @@ // Warning: This file was created by make_resamplers.py - do not edit. // vim: set ft=c: -static INLINE const void *point_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE_INSTANCE * spl, unsigned int maxc) { +static INLINE const void *point_spl32(SAMP_BUF * samp_buf, const A5O_SAMPLE_INSTANCE * spl, unsigned int maxc) { unsigned int i0 = spl->pos * maxc; unsigned int i; switch (spl->spl_data.depth) { - case ALLEGRO_AUDIO_DEPTH_FLOAT32: + case A5O_AUDIO_DEPTH_FLOAT32: for (i = 0; i < maxc; i++) { samp_buf->f32[i] = spl->spl_data.buffer.f32[i0 + i]; } break; - case ALLEGRO_AUDIO_DEPTH_INT24: + case A5O_AUDIO_DEPTH_INT24: for (i = 0; i < maxc; i++) { samp_buf->f32[i] = (float) spl->spl_data.buffer.s24[i0 + i] / ((float) 0x7FFFFF + 0.5f); } break; - case ALLEGRO_AUDIO_DEPTH_UINT24: + case A5O_AUDIO_DEPTH_UINT24: for (i = 0; i < maxc; i++) { samp_buf->f32[i] = (float) spl->spl_data.buffer.u24[i0 + i] / ((float) 0x7FFFFF + 0.5f) - 1.0f; } break; - case ALLEGRO_AUDIO_DEPTH_INT16: + case A5O_AUDIO_DEPTH_INT16: for (i = 0; i < maxc; i++) { samp_buf->f32[i] = (float) spl->spl_data.buffer.s16[i0 + i] / ((float) 0x7FFF + 0.5f); } break; - case ALLEGRO_AUDIO_DEPTH_UINT16: + case A5O_AUDIO_DEPTH_UINT16: for (i = 0; i < maxc; i++) { samp_buf->f32[i] = (float) spl->spl_data.buffer.u16[i0 + i] / ((float) 0x7FFF + 0.5f) - 1.0f; } break; - case ALLEGRO_AUDIO_DEPTH_INT8: + case A5O_AUDIO_DEPTH_INT8: for (i = 0; i < maxc; i++) { samp_buf->f32[i] = (float) spl->spl_data.buffer.s8[i0 + i] / ((float) 0x7F + 0.5f); } break; - case ALLEGRO_AUDIO_DEPTH_UINT8: + case A5O_AUDIO_DEPTH_UINT8: for (i = 0; i < maxc; i++) { samp_buf->f32[i] = (float) spl->spl_data.buffer.u8[i0 + i] / ((float) 0x7F + 0.5f) - 1.0f; } @@ -52,49 +52,49 @@ static INLINE const void *point_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE_ return samp_buf->f32; } -static INLINE const void *point_spl16(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE_INSTANCE * spl, unsigned int maxc) { +static INLINE const void *point_spl16(SAMP_BUF * samp_buf, const A5O_SAMPLE_INSTANCE * spl, unsigned int maxc) { unsigned int i0 = spl->pos * maxc; unsigned int i; switch (spl->spl_data.depth) { - case ALLEGRO_AUDIO_DEPTH_FLOAT32: + case A5O_AUDIO_DEPTH_FLOAT32: for (i = 0; i < maxc; i++) { samp_buf->s16[i] = (int16_t) (spl->spl_data.buffer.f32[i0 + i] * 0x7FFF); } break; - case ALLEGRO_AUDIO_DEPTH_INT24: + case A5O_AUDIO_DEPTH_INT24: for (i = 0; i < maxc; i++) { samp_buf->s16[i] = (int16_t) (spl->spl_data.buffer.s24[i0 + i] >> 9); } break; - case ALLEGRO_AUDIO_DEPTH_UINT24: + case A5O_AUDIO_DEPTH_UINT24: for (i = 0; i < maxc; i++) { samp_buf->s16[i] = (int16_t) ((spl->spl_data.buffer.u24[i0 + i] - 0x800000) >> 9); } break; - case ALLEGRO_AUDIO_DEPTH_INT16: + case A5O_AUDIO_DEPTH_INT16: for (i = 0; i < maxc; i++) { samp_buf->s16[i] = spl->spl_data.buffer.s16[i0 + i]; } break; - case ALLEGRO_AUDIO_DEPTH_UINT16: + case A5O_AUDIO_DEPTH_UINT16: for (i = 0; i < maxc; i++) { samp_buf->s16[i] = (int16_t) (spl->spl_data.buffer.u16[i0 + i] - 0x8000); } break; - case ALLEGRO_AUDIO_DEPTH_INT8: + case A5O_AUDIO_DEPTH_INT8: for (i = 0; i < maxc; i++) { samp_buf->s16[i] = (int16_t) spl->spl_data.buffer.s8[i0 + i] << 7; } break; - case ALLEGRO_AUDIO_DEPTH_UINT8: + case A5O_AUDIO_DEPTH_UINT8: for (i = 0; i < maxc; i++) { samp_buf->s16[i] = (int16_t) (spl->spl_data.buffer.u8[i0 + i] - 0x80) << 7; } @@ -104,30 +104,30 @@ static INLINE const void *point_spl16(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE_ return samp_buf->s16; } -static INLINE const void *linear_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE_INSTANCE * spl, unsigned int maxc) { +static INLINE const void *linear_spl32(SAMP_BUF * samp_buf, const A5O_SAMPLE_INSTANCE * spl, unsigned int maxc) { int p0 = spl->pos; int p1 = spl->pos + 1; switch (spl->loop) { - case ALLEGRO_PLAYMODE_ONCE: + case A5O_PLAYMODE_ONCE: if (p1 >= spl->spl_data.len) p1 = p0; break; - case ALLEGRO_PLAYMODE_LOOP_ONCE: - case ALLEGRO_PLAYMODE_LOOP: + case A5O_PLAYMODE_LOOP_ONCE: + case A5O_PLAYMODE_LOOP: if (p1 >= spl->loop_end) p1 = spl->loop_start; break; - case ALLEGRO_PLAYMODE_BIDIR: + case A5O_PLAYMODE_BIDIR: if (p1 >= spl->loop_end) { p1 = spl->loop_end - 1; if (p1 < spl->loop_start) p1 = spl->loop_start; } break; - case _ALLEGRO_PLAYMODE_STREAM_ONCE: - case _ALLEGRO_PLAYMODE_STREAM_LOOP_ONCE: - case _ALLEGRO_PLAYMODE_STREAM_ONEDIR: + case _A5O_PLAYMODE_STREAM_ONCE: + case _A5O_PLAYMODE_STREAM_LOOP_ONCE: + case _A5O_PLAYMODE_STREAM_ONEDIR: p0--; p1--; break; @@ -138,7 +138,7 @@ static INLINE const void *linear_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE switch (spl->spl_data.depth) { - case ALLEGRO_AUDIO_DEPTH_FLOAT32: + case A5O_AUDIO_DEPTH_FLOAT32: { const float t = (float) spl->pos_bresenham_error / spl->step_denom; int i; @@ -151,7 +151,7 @@ static INLINE const void *linear_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE } break; - case ALLEGRO_AUDIO_DEPTH_INT24: + case A5O_AUDIO_DEPTH_INT24: { const float t = (float) spl->pos_bresenham_error / spl->step_denom; int i; @@ -164,7 +164,7 @@ static INLINE const void *linear_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE } break; - case ALLEGRO_AUDIO_DEPTH_UINT24: + case A5O_AUDIO_DEPTH_UINT24: { const float t = (float) spl->pos_bresenham_error / spl->step_denom; int i; @@ -177,7 +177,7 @@ static INLINE const void *linear_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE } break; - case ALLEGRO_AUDIO_DEPTH_INT16: + case A5O_AUDIO_DEPTH_INT16: { const float t = (float) spl->pos_bresenham_error / spl->step_denom; int i; @@ -190,7 +190,7 @@ static INLINE const void *linear_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE } break; - case ALLEGRO_AUDIO_DEPTH_UINT16: + case A5O_AUDIO_DEPTH_UINT16: { const float t = (float) spl->pos_bresenham_error / spl->step_denom; int i; @@ -203,7 +203,7 @@ static INLINE const void *linear_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE } break; - case ALLEGRO_AUDIO_DEPTH_INT8: + case A5O_AUDIO_DEPTH_INT8: { const float t = (float) spl->pos_bresenham_error / spl->step_denom; int i; @@ -216,7 +216,7 @@ static INLINE const void *linear_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE } break; - case ALLEGRO_AUDIO_DEPTH_UINT8: + case A5O_AUDIO_DEPTH_UINT8: { const float t = (float) spl->pos_bresenham_error / spl->step_denom; int i; @@ -233,30 +233,30 @@ static INLINE const void *linear_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE return samp_buf->f32; } -static INLINE const void *linear_spl16(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE_INSTANCE * spl, unsigned int maxc) { +static INLINE const void *linear_spl16(SAMP_BUF * samp_buf, const A5O_SAMPLE_INSTANCE * spl, unsigned int maxc) { int p0 = spl->pos; int p1 = spl->pos + 1; switch (spl->loop) { - case ALLEGRO_PLAYMODE_ONCE: + case A5O_PLAYMODE_ONCE: if (p1 >= spl->spl_data.len) p1 = p0; break; - case ALLEGRO_PLAYMODE_LOOP_ONCE: - case ALLEGRO_PLAYMODE_LOOP: + case A5O_PLAYMODE_LOOP_ONCE: + case A5O_PLAYMODE_LOOP: if (p1 >= spl->loop_end) p1 = spl->loop_start; break; - case ALLEGRO_PLAYMODE_BIDIR: + case A5O_PLAYMODE_BIDIR: if (p1 >= spl->loop_end) { p1 = spl->loop_end - 1; if (p1 < spl->loop_start) p1 = spl->loop_start; } break; - case _ALLEGRO_PLAYMODE_STREAM_ONCE: - case _ALLEGRO_PLAYMODE_STREAM_LOOP_ONCE: - case _ALLEGRO_PLAYMODE_STREAM_ONEDIR: + case _A5O_PLAYMODE_STREAM_ONCE: + case _A5O_PLAYMODE_STREAM_LOOP_ONCE: + case _A5O_PLAYMODE_STREAM_ONEDIR: p0--; p1--; break; @@ -267,7 +267,7 @@ static INLINE const void *linear_spl16(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE switch (spl->spl_data.depth) { - case ALLEGRO_AUDIO_DEPTH_FLOAT32: + case A5O_AUDIO_DEPTH_FLOAT32: { const int32_t t = 256 * spl->pos_bresenham_error / spl->step_denom; int i; @@ -280,7 +280,7 @@ static INLINE const void *linear_spl16(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE } break; - case ALLEGRO_AUDIO_DEPTH_INT24: + case A5O_AUDIO_DEPTH_INT24: { const int32_t t = 256 * spl->pos_bresenham_error / spl->step_denom; int i; @@ -293,7 +293,7 @@ static INLINE const void *linear_spl16(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE } break; - case ALLEGRO_AUDIO_DEPTH_UINT24: + case A5O_AUDIO_DEPTH_UINT24: { const int32_t t = 256 * spl->pos_bresenham_error / spl->step_denom; int i; @@ -306,7 +306,7 @@ static INLINE const void *linear_spl16(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE } break; - case ALLEGRO_AUDIO_DEPTH_INT16: + case A5O_AUDIO_DEPTH_INT16: { const int32_t t = 256 * spl->pos_bresenham_error / spl->step_denom; int i; @@ -319,7 +319,7 @@ static INLINE const void *linear_spl16(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE } break; - case ALLEGRO_AUDIO_DEPTH_UINT16: + case A5O_AUDIO_DEPTH_UINT16: { const int32_t t = 256 * spl->pos_bresenham_error / spl->step_denom; int i; @@ -332,7 +332,7 @@ static INLINE const void *linear_spl16(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE } break; - case ALLEGRO_AUDIO_DEPTH_INT8: + case A5O_AUDIO_DEPTH_INT8: { const int32_t t = 256 * spl->pos_bresenham_error / spl->step_denom; int i; @@ -345,7 +345,7 @@ static INLINE const void *linear_spl16(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE } break; - case ALLEGRO_AUDIO_DEPTH_UINT8: + case A5O_AUDIO_DEPTH_UINT8: { const int32_t t = 256 * spl->pos_bresenham_error / spl->step_denom; int i; @@ -362,14 +362,14 @@ static INLINE const void *linear_spl16(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE return samp_buf->s16; } -static INLINE const void *cubic_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE_INSTANCE * spl, unsigned int maxc) { +static INLINE const void *cubic_spl32(SAMP_BUF * samp_buf, const A5O_SAMPLE_INSTANCE * spl, unsigned int maxc) { int p0 = spl->pos - 1; int p1 = spl->pos; int p2 = spl->pos + 1; int p3 = spl->pos + 2; switch (spl->loop) { - case ALLEGRO_PLAYMODE_ONCE: + case A5O_PLAYMODE_ONCE: if (p0 < 0) p0 = 0; if (p2 >= spl->spl_data.len) @@ -377,9 +377,9 @@ static INLINE const void *cubic_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE_ if (p3 >= spl->spl_data.len) p3 = spl->spl_data.len - 1; break; - case ALLEGRO_PLAYMODE_LOOP_ONCE: - case ALLEGRO_PLAYMODE_LOOP: - case ALLEGRO_PLAYMODE_BIDIR: + case A5O_PLAYMODE_LOOP_ONCE: + case A5O_PLAYMODE_LOOP: + case A5O_PLAYMODE_BIDIR: /* These positions should really wrap/bounce instead of clamping * but it's probably unnoticeable. */ @@ -390,9 +390,9 @@ static INLINE const void *cubic_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE_ if (p3 >= spl->loop_end) p3 = spl->loop_start; break; - case _ALLEGRO_PLAYMODE_STREAM_ONCE: - case _ALLEGRO_PLAYMODE_STREAM_LOOP_ONCE: - case _ALLEGRO_PLAYMODE_STREAM_ONEDIR: + case _A5O_PLAYMODE_STREAM_ONCE: + case _A5O_PLAYMODE_STREAM_LOOP_ONCE: + case _A5O_PLAYMODE_STREAM_ONEDIR: /* Lag by three samples in total. */ p0 -= 2; p1 -= 2; @@ -408,7 +408,7 @@ static INLINE const void *cubic_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE_ switch (spl->spl_data.depth) { - case ALLEGRO_AUDIO_DEPTH_FLOAT32: + case A5O_AUDIO_DEPTH_FLOAT32: { const float t = (float) spl->pos_bresenham_error / spl->step_denom; signed int i; @@ -427,7 +427,7 @@ static INLINE const void *cubic_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE_ } break; - case ALLEGRO_AUDIO_DEPTH_INT24: + case A5O_AUDIO_DEPTH_INT24: { const float t = (float) spl->pos_bresenham_error / spl->step_denom; signed int i; @@ -446,7 +446,7 @@ static INLINE const void *cubic_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE_ } break; - case ALLEGRO_AUDIO_DEPTH_UINT24: + case A5O_AUDIO_DEPTH_UINT24: { const float t = (float) spl->pos_bresenham_error / spl->step_denom; signed int i; @@ -465,7 +465,7 @@ static INLINE const void *cubic_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE_ } break; - case ALLEGRO_AUDIO_DEPTH_INT16: + case A5O_AUDIO_DEPTH_INT16: { const float t = (float) spl->pos_bresenham_error / spl->step_denom; signed int i; @@ -484,7 +484,7 @@ static INLINE const void *cubic_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE_ } break; - case ALLEGRO_AUDIO_DEPTH_UINT16: + case A5O_AUDIO_DEPTH_UINT16: { const float t = (float) spl->pos_bresenham_error / spl->step_denom; signed int i; @@ -503,7 +503,7 @@ static INLINE const void *cubic_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE_ } break; - case ALLEGRO_AUDIO_DEPTH_INT8: + case A5O_AUDIO_DEPTH_INT8: { const float t = (float) spl->pos_bresenham_error / spl->step_denom; signed int i; @@ -522,7 +522,7 @@ static INLINE const void *cubic_spl32(SAMP_BUF * samp_buf, const ALLEGRO_SAMPLE_ } break; - case ALLEGRO_AUDIO_DEPTH_UINT8: + case A5O_AUDIO_DEPTH_UINT8: { const float t = (float) spl->pos_bresenham_error / spl->step_denom; signed int i; diff --git a/addons/audio/kcm_sample.c b/addons/audio/kcm_sample.c index 96576fd4b1..862293678d 100644 --- a/addons/audio/kcm_sample.c +++ b/addons/audio/kcm_sample.c @@ -24,16 +24,16 @@ #include "allegro5/internal/aintern_audio.h" #include "allegro5/internal/aintern_vector.h" -ALLEGRO_DEBUG_CHANNEL("audio") +A5O_DEBUG_CHANNEL("audio") -static ALLEGRO_VOICE *allegro_voice = NULL; -static ALLEGRO_MIXER *allegro_mixer = NULL; -static ALLEGRO_MIXER *default_mixer = NULL; +static A5O_VOICE *allegro_voice = NULL; +static A5O_MIXER *allegro_mixer = NULL; +static A5O_MIXER *default_mixer = NULL; typedef struct AUTO_SAMPLE { - ALLEGRO_SAMPLE_INSTANCE *instance; + A5O_SAMPLE_INSTANCE *instance; int id; bool locked; } AUTO_SAMPLE; @@ -42,8 +42,8 @@ static _AL_VECTOR auto_samples = _AL_VECTOR_INITIALIZER(AUTO_SAMPLE); static bool create_default_mixer(void); -static bool do_play_sample(ALLEGRO_SAMPLE_INSTANCE *spl, ALLEGRO_SAMPLE *data, - float gain, float pan, float speed, ALLEGRO_PLAYMODE loop); +static bool do_play_sample(A5O_SAMPLE_INSTANCE *spl, A5O_SAMPLE *data, + float gain, float pan, float speed, A5O_PLAYMODE loop); static void free_sample_vector(void); @@ -51,10 +51,10 @@ static int string_to_depth(const char *s) { // FIXME: fill in the rest if (!_al_stricmp(s, "int16")) { - return ALLEGRO_AUDIO_DEPTH_INT16; + return A5O_AUDIO_DEPTH_INT16; } else { - return ALLEGRO_AUDIO_DEPTH_FLOAT32; + return A5O_AUDIO_DEPTH_FLOAT32; } } @@ -63,11 +63,11 @@ static int string_to_depth(const char *s) static bool create_default_mixer(void) { int voice_frequency = 44100; - int voice_depth = ALLEGRO_AUDIO_DEPTH_INT16; + int voice_depth = A5O_AUDIO_DEPTH_INT16; int mixer_frequency = 44100; - int mixer_depth = ALLEGRO_AUDIO_DEPTH_FLOAT32; + int mixer_depth = A5O_AUDIO_DEPTH_FLOAT32; - ALLEGRO_CONFIG *config = al_get_system_config(); + A5O_CONFIG *config = al_get_system_config(); const char *p; p = al_get_config_value(config, "audio", "primary_voice_frequency"); if (p && p[0] != '\0') { @@ -88,18 +88,18 @@ static bool create_default_mixer(void) if (!allegro_voice) { allegro_voice = al_create_voice(voice_frequency, voice_depth, - ALLEGRO_CHANNEL_CONF_2); + A5O_CHANNEL_CONF_2); if (!allegro_voice) { - ALLEGRO_ERROR("al_create_voice failed\n"); + A5O_ERROR("al_create_voice failed\n"); goto Error; } } if (!allegro_mixer) { allegro_mixer = al_create_mixer(mixer_frequency, mixer_depth, - ALLEGRO_CHANNEL_CONF_2); + A5O_CHANNEL_CONF_2); if (!allegro_mixer) { - ALLEGRO_ERROR("al_create_voice failed\n"); + A5O_ERROR("al_create_voice failed\n"); goto Error; } } @@ -108,7 +108,7 @@ static bool create_default_mixer(void) al_detach_mixer(allegro_mixer); if (!al_attach_mixer_to_voice(allegro_mixer, allegro_voice)) { - ALLEGRO_ERROR("al_attach_mixer_to_voice failed\n"); + A5O_ERROR("al_attach_mixer_to_voice failed\n"); goto Error; } @@ -132,22 +132,22 @@ static bool create_default_mixer(void) /* Function: al_create_sample */ -ALLEGRO_SAMPLE *al_create_sample(void *buf, unsigned int samples, - unsigned int freq, ALLEGRO_AUDIO_DEPTH depth, - ALLEGRO_CHANNEL_CONF chan_conf, bool free_buf) +A5O_SAMPLE *al_create_sample(void *buf, unsigned int samples, + unsigned int freq, A5O_AUDIO_DEPTH depth, + A5O_CHANNEL_CONF chan_conf, bool free_buf) { - ALLEGRO_SAMPLE *spl; + A5O_SAMPLE *spl; ASSERT(buf); if (!freq) { - _al_set_error(ALLEGRO_INVALID_PARAM, "Invalid sample frequency"); + _al_set_error(A5O_INVALID_PARAM, "Invalid sample frequency"); return NULL; } spl = al_calloc(1, sizeof(*spl)); if (!spl) { - _al_set_error(ALLEGRO_GENERIC_ERROR, + _al_set_error(A5O_GENERIC_ERROR, "Out of memory allocating sample data object"); return NULL; } @@ -171,7 +171,7 @@ ALLEGRO_SAMPLE *al_create_sample(void *buf, unsigned int samples, static void stop_sample_instances_helper(void *object, void (*func)(void *), void *userdata) { - ALLEGRO_SAMPLE_INSTANCE *splinst = object; + A5O_SAMPLE_INSTANCE *splinst = object; /* This is ugly. */ if (func == (void (*)(void *)) al_destroy_sample_instance @@ -185,7 +185,7 @@ static void stop_sample_instances_helper(void *object, void (*func)(void *), /* Function: al_destroy_sample */ -void al_destroy_sample(ALLEGRO_SAMPLE *spl) +void al_destroy_sample(A5O_SAMPLE *spl) { if (spl) { _al_kcm_foreach_destructor(stop_sample_instances_helper, @@ -228,11 +228,11 @@ bool al_reserve_samples(int reserve_samples) slot->instance = al_create_sample_instance(NULL); slot->locked = false; if (!slot->instance) { - ALLEGRO_ERROR("al_create_sample failed\n"); + A5O_ERROR("al_create_sample failed\n"); goto Error; } if (!al_attach_sample_instance_to_mixer(slot->instance, default_mixer)) { - ALLEGRO_ERROR("al_attach_mixer_to_sample failed\n"); + A5O_ERROR("al_attach_mixer_to_sample failed\n"); goto Error; } } @@ -257,7 +257,7 @@ bool al_reserve_samples(int reserve_samples) /* Function: al_get_default_mixer */ -ALLEGRO_MIXER *al_get_default_mixer(void) +A5O_MIXER *al_get_default_mixer(void) { return default_mixer; } @@ -265,7 +265,7 @@ ALLEGRO_MIXER *al_get_default_mixer(void) /* Function: al_set_default_mixer */ -bool al_set_default_mixer(ALLEGRO_MIXER *mixer) +bool al_set_default_mixer(A5O_MIXER *mixer) { ASSERT(mixer != NULL); @@ -285,11 +285,11 @@ bool al_set_default_mixer(ALLEGRO_MIXER *mixer) slot->instance = al_create_sample_instance(NULL); if (!slot->instance) { - ALLEGRO_ERROR("al_create_sample failed\n"); + A5O_ERROR("al_create_sample failed\n"); goto Error; } if (!al_attach_sample_instance_to_mixer(slot->instance, default_mixer)) { - ALLEGRO_ERROR("al_attach_mixer_to_sample failed\n"); + A5O_ERROR("al_attach_mixer_to_sample failed\n"); goto Error; } } @@ -320,7 +320,7 @@ bool al_restore_default_mixer(void) /* Function: al_get_default_voice */ -ALLEGRO_VOICE *al_get_default_voice(void) +A5O_VOICE *al_get_default_voice(void) { return allegro_voice; } @@ -328,7 +328,7 @@ ALLEGRO_VOICE *al_get_default_voice(void) /* Function: al_set_default_voice */ -void al_set_default_voice(ALLEGRO_VOICE *voice) +void al_set_default_voice(A5O_VOICE *voice) { if (allegro_voice) { al_destroy_voice(allegro_voice); @@ -339,8 +339,8 @@ void al_set_default_voice(ALLEGRO_VOICE *voice) /* Function: al_play_sample */ -bool al_play_sample(ALLEGRO_SAMPLE *spl, float gain, float pan, float speed, - ALLEGRO_PLAYMODE loop, ALLEGRO_SAMPLE_ID *ret_id) +bool al_play_sample(A5O_SAMPLE *spl, float gain, float pan, float speed, + A5O_PLAYMODE loop, A5O_SAMPLE_ID *ret_id) { static int next_id = 0; unsigned int i; @@ -372,11 +372,11 @@ bool al_play_sample(ALLEGRO_SAMPLE *spl, float gain, float pan, float speed, } -static bool do_play_sample(ALLEGRO_SAMPLE_INSTANCE *splinst, - ALLEGRO_SAMPLE *spl, float gain, float pan, float speed, ALLEGRO_PLAYMODE loop) +static bool do_play_sample(A5O_SAMPLE_INSTANCE *splinst, + A5O_SAMPLE *spl, float gain, float pan, float speed, A5O_PLAYMODE loop) { if (!al_set_sample(splinst, spl)) { - ALLEGRO_ERROR("al_set_sample failed\n"); + A5O_ERROR("al_set_sample failed\n"); return false; } @@ -388,7 +388,7 @@ static bool do_play_sample(ALLEGRO_SAMPLE_INSTANCE *splinst, } if (!al_play_sample_instance(splinst)) { - ALLEGRO_ERROR("al_play_sample_instance failed\n"); + A5O_ERROR("al_play_sample_instance failed\n"); return false; } @@ -398,7 +398,7 @@ static bool do_play_sample(ALLEGRO_SAMPLE_INSTANCE *splinst, /* Function: al_stop_sample */ -void al_stop_sample(ALLEGRO_SAMPLE_ID *spl_id) +void al_stop_sample(A5O_SAMPLE_ID *spl_id) { AUTO_SAMPLE *slot; @@ -414,7 +414,7 @@ void al_stop_sample(ALLEGRO_SAMPLE_ID *spl_id) /* Function: al_lock_sample_id */ -ALLEGRO_SAMPLE_INSTANCE* al_lock_sample_id(ALLEGRO_SAMPLE_ID *spl_id) +A5O_SAMPLE_INSTANCE* al_lock_sample_id(A5O_SAMPLE_ID *spl_id) { AUTO_SAMPLE *slot; @@ -432,7 +432,7 @@ ALLEGRO_SAMPLE_INSTANCE* al_lock_sample_id(ALLEGRO_SAMPLE_ID *spl_id) /* Function: al_unlock_sample_id */ -void al_unlock_sample_id(ALLEGRO_SAMPLE_ID *spl_id) +void al_unlock_sample_id(A5O_SAMPLE_ID *spl_id) { AUTO_SAMPLE *slot; @@ -461,7 +461,7 @@ void al_stop_samples(void) /* Function: al_get_sample_frequency */ -unsigned int al_get_sample_frequency(const ALLEGRO_SAMPLE *spl) +unsigned int al_get_sample_frequency(const A5O_SAMPLE *spl) { ASSERT(spl); @@ -471,7 +471,7 @@ unsigned int al_get_sample_frequency(const ALLEGRO_SAMPLE *spl) /* Function: al_get_sample_length */ -unsigned int al_get_sample_length(const ALLEGRO_SAMPLE *spl) +unsigned int al_get_sample_length(const A5O_SAMPLE *spl) { ASSERT(spl); @@ -481,7 +481,7 @@ unsigned int al_get_sample_length(const ALLEGRO_SAMPLE *spl) /* Function: al_get_sample_depth */ -ALLEGRO_AUDIO_DEPTH al_get_sample_depth(const ALLEGRO_SAMPLE *spl) +A5O_AUDIO_DEPTH al_get_sample_depth(const A5O_SAMPLE *spl) { ASSERT(spl); @@ -491,7 +491,7 @@ ALLEGRO_AUDIO_DEPTH al_get_sample_depth(const ALLEGRO_SAMPLE *spl) /* Function: al_get_sample_channels */ -ALLEGRO_CHANNEL_CONF al_get_sample_channels(const ALLEGRO_SAMPLE *spl) +A5O_CHANNEL_CONF al_get_sample_channels(const A5O_SAMPLE *spl) { ASSERT(spl); @@ -501,7 +501,7 @@ ALLEGRO_CHANNEL_CONF al_get_sample_channels(const ALLEGRO_SAMPLE *spl) /* Function: al_get_sample_data */ -void *al_get_sample_data(const ALLEGRO_SAMPLE *spl) +void *al_get_sample_data(const A5O_SAMPLE *spl) { ASSERT(spl); diff --git a/addons/audio/kcm_stream.c b/addons/audio/kcm_stream.c index 2b8487c27d..6ffb59019a 100644 --- a/addons/audio/kcm_stream.c +++ b/addons/audio/kcm_stream.c @@ -14,7 +14,7 @@ #include "allegro5/internal/aintern_audio.h" #include "allegro5/internal/aintern_audio_cfg.h" -ALLEGRO_DEBUG_CHANNEL("audio") +A5O_DEBUG_CHANNEL("audio") /* * The highest quality interpolator is a cubic interpolator requiring @@ -28,7 +28,7 @@ ALLEGRO_DEBUG_CHANNEL("audio") * To avoid deadlocks, unlock the mutex returned by this function, rather than * whatever you passed as the argument. */ -static ALLEGRO_MUTEX *maybe_lock_mutex(ALLEGRO_MUTEX *mutex) +static A5O_MUTEX *maybe_lock_mutex(A5O_MUTEX *mutex) { if (mutex) { al_lock_mutex(mutex); @@ -37,7 +37,7 @@ static ALLEGRO_MUTEX *maybe_lock_mutex(ALLEGRO_MUTEX *mutex) } -static void maybe_unlock_mutex(ALLEGRO_MUTEX *mutex) +static void maybe_unlock_mutex(A5O_MUTEX *mutex) { if (mutex) { al_unlock_mutex(mutex); @@ -46,27 +46,27 @@ static void maybe_unlock_mutex(ALLEGRO_MUTEX *mutex) /* Function: al_create_audio_stream */ -ALLEGRO_AUDIO_STREAM *al_create_audio_stream(size_t fragment_count, - unsigned int frag_samples, unsigned int freq, ALLEGRO_AUDIO_DEPTH depth, - ALLEGRO_CHANNEL_CONF chan_conf) +A5O_AUDIO_STREAM *al_create_audio_stream(size_t fragment_count, + unsigned int frag_samples, unsigned int freq, A5O_AUDIO_DEPTH depth, + A5O_CHANNEL_CONF chan_conf) { - ALLEGRO_AUDIO_STREAM *stream; + A5O_AUDIO_STREAM *stream; unsigned long bytes_per_sample; unsigned long bytes_per_frag_buf; size_t i; if (!fragment_count) { - _al_set_error(ALLEGRO_INVALID_PARAM, + _al_set_error(A5O_INVALID_PARAM, "Attempted to create stream with no buffers"); return NULL; } if (!frag_samples) { - _al_set_error(ALLEGRO_INVALID_PARAM, + _al_set_error(A5O_INVALID_PARAM, "Attempted to create stream with no buffer size"); return NULL; } if (!freq) { - _al_set_error(ALLEGRO_INVALID_PARAM, + _al_set_error(A5O_INVALID_PARAM, "Attempted to create stream with no frequency"); return NULL; } @@ -77,7 +77,7 @@ ALLEGRO_AUDIO_STREAM *al_create_audio_stream(size_t fragment_count, stream = al_calloc(1, sizeof(*stream)); if (!stream) { - _al_set_error(ALLEGRO_GENERIC_ERROR, + _al_set_error(A5O_GENERIC_ERROR, "Out of memory allocating stream object"); return NULL; } @@ -85,7 +85,7 @@ ALLEGRO_AUDIO_STREAM *al_create_audio_stream(size_t fragment_count, stream->spl.is_playing = true; stream->is_draining = false; - stream->spl.loop = _ALLEGRO_PLAYMODE_STREAM_ONCE; + stream->spl.loop = _A5O_PLAYMODE_STREAM_ONCE; stream->spl.spl_data.depth = depth; stream->spl.spl_data.chan_conf = chan_conf; stream->spl.spl_data.frequency = freq; @@ -103,7 +103,7 @@ ALLEGRO_AUDIO_STREAM *al_create_audio_stream(size_t fragment_count, if (!stream->used_bufs) { al_free(stream->used_bufs); al_free(stream); - _al_set_error(ALLEGRO_GENERIC_ERROR, + _al_set_error(A5O_GENERIC_ERROR, "Out of memory allocating stream buffer pointers"); return NULL; } @@ -119,7 +119,7 @@ ALLEGRO_AUDIO_STREAM *al_create_audio_stream(size_t fragment_count, if (!stream->main_buffer) { al_free(stream->used_bufs); al_free(stream); - _al_set_error(ALLEGRO_GENERIC_ERROR, + _al_set_error(A5O_GENERIC_ERROR, "Out of memory allocating stream buffer"); return NULL; } @@ -142,7 +142,7 @@ ALLEGRO_AUDIO_STREAM *al_create_audio_stream(size_t fragment_count, /* Function: al_destroy_audio_stream */ -void al_destroy_audio_stream(ALLEGRO_AUDIO_STREAM *stream) +void al_destroy_audio_stream(A5O_AUDIO_STREAM *stream) { if (stream) { if (stream->feed_thread) { @@ -162,7 +162,7 @@ void al_destroy_audio_stream(ALLEGRO_AUDIO_STREAM *stream) /* Function: al_drain_audio_stream */ -void al_drain_audio_stream(ALLEGRO_AUDIO_STREAM *stream) +void al_drain_audio_stream(A5O_AUDIO_STREAM *stream) { bool playing; @@ -181,7 +181,7 @@ void al_drain_audio_stream(ALLEGRO_AUDIO_STREAM *stream) /* Function: al_get_audio_stream_frequency */ -unsigned int al_get_audio_stream_frequency(const ALLEGRO_AUDIO_STREAM *stream) +unsigned int al_get_audio_stream_frequency(const A5O_AUDIO_STREAM *stream) { ASSERT(stream); @@ -191,7 +191,7 @@ unsigned int al_get_audio_stream_frequency(const ALLEGRO_AUDIO_STREAM *stream) /* Function: al_get_audio_stream_length */ -unsigned int al_get_audio_stream_length(const ALLEGRO_AUDIO_STREAM *stream) +unsigned int al_get_audio_stream_length(const A5O_AUDIO_STREAM *stream) { ASSERT(stream); @@ -201,7 +201,7 @@ unsigned int al_get_audio_stream_length(const ALLEGRO_AUDIO_STREAM *stream) /* Function: al_get_audio_stream_fragments */ -unsigned int al_get_audio_stream_fragments(const ALLEGRO_AUDIO_STREAM *stream) +unsigned int al_get_audio_stream_fragments(const A5O_AUDIO_STREAM *stream) { ASSERT(stream); @@ -212,7 +212,7 @@ unsigned int al_get_audio_stream_fragments(const ALLEGRO_AUDIO_STREAM *stream) /* Function: al_get_available_audio_stream_fragments */ unsigned int al_get_available_audio_stream_fragments( - const ALLEGRO_AUDIO_STREAM *stream) + const A5O_AUDIO_STREAM *stream) { unsigned int i; ASSERT(stream); @@ -225,7 +225,7 @@ unsigned int al_get_available_audio_stream_fragments( /* Function: al_get_audio_stream_speed */ -float al_get_audio_stream_speed(const ALLEGRO_AUDIO_STREAM *stream) +float al_get_audio_stream_speed(const A5O_AUDIO_STREAM *stream) { ASSERT(stream); @@ -235,7 +235,7 @@ float al_get_audio_stream_speed(const ALLEGRO_AUDIO_STREAM *stream) /* Function: al_get_audio_stream_gain */ -float al_get_audio_stream_gain(const ALLEGRO_AUDIO_STREAM *stream) +float al_get_audio_stream_gain(const A5O_AUDIO_STREAM *stream) { ASSERT(stream); @@ -245,7 +245,7 @@ float al_get_audio_stream_gain(const ALLEGRO_AUDIO_STREAM *stream) /* Function: al_get_audio_stream_pan */ -float al_get_audio_stream_pan(const ALLEGRO_AUDIO_STREAM *stream) +float al_get_audio_stream_pan(const A5O_AUDIO_STREAM *stream) { ASSERT(stream); @@ -255,8 +255,8 @@ float al_get_audio_stream_pan(const ALLEGRO_AUDIO_STREAM *stream) /* Function: al_get_audio_stream_channels */ -ALLEGRO_CHANNEL_CONF al_get_audio_stream_channels( - const ALLEGRO_AUDIO_STREAM *stream) +A5O_CHANNEL_CONF al_get_audio_stream_channels( + const A5O_AUDIO_STREAM *stream) { ASSERT(stream); @@ -266,8 +266,8 @@ ALLEGRO_CHANNEL_CONF al_get_audio_stream_channels( /* Function: al_get_audio_stream_depth */ -ALLEGRO_AUDIO_DEPTH al_get_audio_stream_depth( - const ALLEGRO_AUDIO_STREAM *stream) +A5O_AUDIO_DEPTH al_get_audio_stream_depth( + const A5O_AUDIO_STREAM *stream) { ASSERT(stream); @@ -277,8 +277,8 @@ ALLEGRO_AUDIO_DEPTH al_get_audio_stream_depth( /* Function: al_get_audio_stream_playmode */ -ALLEGRO_PLAYMODE al_get_audio_stream_playmode( - const ALLEGRO_AUDIO_STREAM *stream) +A5O_PLAYMODE al_get_audio_stream_playmode( + const A5O_AUDIO_STREAM *stream) { ASSERT(stream); @@ -288,7 +288,7 @@ ALLEGRO_PLAYMODE al_get_audio_stream_playmode( /* Function: al_get_audio_stream_playing */ -bool al_get_audio_stream_playing(const ALLEGRO_AUDIO_STREAM *stream) +bool al_get_audio_stream_playing(const A5O_AUDIO_STREAM *stream) { ASSERT(stream); @@ -298,7 +298,7 @@ bool al_get_audio_stream_playing(const ALLEGRO_AUDIO_STREAM *stream) /* Function: al_get_audio_stream_attached */ -bool al_get_audio_stream_attached(const ALLEGRO_AUDIO_STREAM *stream) +bool al_get_audio_stream_attached(const A5O_AUDIO_STREAM *stream) { ASSERT(stream); @@ -307,10 +307,10 @@ bool al_get_audio_stream_attached(const ALLEGRO_AUDIO_STREAM *stream) /* Function: al_get_audio_stream_played_samples */ -uint64_t al_get_audio_stream_played_samples(const ALLEGRO_AUDIO_STREAM *stream) +uint64_t al_get_audio_stream_played_samples(const A5O_AUDIO_STREAM *stream) { uint64_t result; - ALLEGRO_MUTEX *stream_mutex; + A5O_MUTEX *stream_mutex; ASSERT(stream); stream_mutex = maybe_lock_mutex(stream->spl.mutex); @@ -328,11 +328,11 @@ uint64_t al_get_audio_stream_played_samples(const ALLEGRO_AUDIO_STREAM *stream) /* Function: al_get_audio_stream_fragment */ -void *al_get_audio_stream_fragment(const ALLEGRO_AUDIO_STREAM *stream) +void *al_get_audio_stream_fragment(const A5O_AUDIO_STREAM *stream) { size_t i; void *fragment; - ALLEGRO_MUTEX *stream_mutex; + A5O_MUTEX *stream_mutex; ASSERT(stream); stream_mutex = maybe_lock_mutex(stream->spl.mutex); @@ -357,26 +357,26 @@ void *al_get_audio_stream_fragment(const ALLEGRO_AUDIO_STREAM *stream) /* Function: al_set_audio_stream_speed */ -bool al_set_audio_stream_speed(ALLEGRO_AUDIO_STREAM *stream, float val) +bool al_set_audio_stream_speed(A5O_AUDIO_STREAM *stream, float val) { ASSERT(stream); if (val <= 0.0f) { - _al_set_error(ALLEGRO_INVALID_PARAM, + _al_set_error(A5O_INVALID_PARAM, "Attempted to set stream speed to a zero or negative value"); return false; } if (stream->spl.parent.u.ptr && stream->spl.parent.is_voice) { - _al_set_error(ALLEGRO_GENERIC_ERROR, + _al_set_error(A5O_GENERIC_ERROR, "Could not set voice playback speed"); return false; } stream->spl.speed = val; if (stream->spl.parent.u.mixer) { - ALLEGRO_MIXER *mixer = stream->spl.parent.u.mixer; - ALLEGRO_MUTEX *stream_mutex = maybe_lock_mutex(stream->spl.mutex); + A5O_MIXER *mixer = stream->spl.parent.u.mixer; + A5O_MUTEX *stream_mutex = maybe_lock_mutex(stream->spl.mutex); stream->spl.step = (stream->spl.spl_data.frequency) * stream->spl.speed; stream->spl.step_denom = mixer->ss.spl_data.frequency; @@ -394,12 +394,12 @@ bool al_set_audio_stream_speed(ALLEGRO_AUDIO_STREAM *stream, float val) /* Function: al_set_audio_stream_gain */ -bool al_set_audio_stream_gain(ALLEGRO_AUDIO_STREAM *stream, float val) +bool al_set_audio_stream_gain(A5O_AUDIO_STREAM *stream, float val) { ASSERT(stream); if (stream->spl.parent.u.ptr && stream->spl.parent.is_voice) { - _al_set_error(ALLEGRO_GENERIC_ERROR, + _al_set_error(A5O_GENERIC_ERROR, "Could not set gain of stream attached to voice"); return false; } @@ -411,8 +411,8 @@ bool al_set_audio_stream_gain(ALLEGRO_AUDIO_STREAM *stream, float val) * matrix to take into account the gain. */ if (stream->spl.parent.u.mixer) { - ALLEGRO_MIXER *mixer = stream->spl.parent.u.mixer; - ALLEGRO_MUTEX *stream_mutex = maybe_lock_mutex(stream->spl.mutex); + A5O_MIXER *mixer = stream->spl.parent.u.mixer; + A5O_MUTEX *stream_mutex = maybe_lock_mutex(stream->spl.mutex); _al_kcm_mixer_rejig_sample_matrix(mixer, &stream->spl); maybe_unlock_mutex(stream_mutex); } @@ -424,17 +424,17 @@ bool al_set_audio_stream_gain(ALLEGRO_AUDIO_STREAM *stream, float val) /* Function: al_set_audio_stream_pan */ -bool al_set_audio_stream_pan(ALLEGRO_AUDIO_STREAM *stream, float val) +bool al_set_audio_stream_pan(A5O_AUDIO_STREAM *stream, float val) { ASSERT(stream); if (stream->spl.parent.u.ptr && stream->spl.parent.is_voice) { - _al_set_error(ALLEGRO_GENERIC_ERROR, + _al_set_error(A5O_GENERIC_ERROR, "Could not set gain of stream attached to voice"); return false; } - if (val != ALLEGRO_AUDIO_PAN_NONE && (val < -1.0 || val > 1.0)) { - _al_set_error(ALLEGRO_GENERIC_ERROR, "Invalid pan value"); + if (val != A5O_AUDIO_PAN_NONE && (val < -1.0 || val > 1.0)) { + _al_set_error(A5O_GENERIC_ERROR, "Invalid pan value"); return false; } @@ -445,8 +445,8 @@ bool al_set_audio_stream_pan(ALLEGRO_AUDIO_STREAM *stream, float val) * matrix to take into account the panning. */ if (stream->spl.parent.u.mixer) { - ALLEGRO_MIXER *mixer = stream->spl.parent.u.mixer; - ALLEGRO_MUTEX *stream_mutex = maybe_lock_mutex(stream->spl.mutex); + A5O_MIXER *mixer = stream->spl.parent.u.mixer; + A5O_MUTEX *stream_mutex = maybe_lock_mutex(stream->spl.mutex); _al_kcm_mixer_rejig_sample_matrix(mixer, &stream->spl); maybe_unlock_mutex(stream_mutex); } @@ -458,27 +458,27 @@ bool al_set_audio_stream_pan(ALLEGRO_AUDIO_STREAM *stream, float val) /* Function: al_set_audio_stream_playmode */ -bool al_set_audio_stream_playmode(ALLEGRO_AUDIO_STREAM *stream, - ALLEGRO_PLAYMODE val) +bool al_set_audio_stream_playmode(A5O_AUDIO_STREAM *stream, + A5O_PLAYMODE val) { ASSERT(stream); bool ret = false; - if (val == ALLEGRO_PLAYMODE_ONCE) { - stream->spl.loop = _ALLEGRO_PLAYMODE_STREAM_ONCE; + if (val == A5O_PLAYMODE_ONCE) { + stream->spl.loop = _A5O_PLAYMODE_STREAM_ONCE; ret = true; } - if (val == ALLEGRO_PLAYMODE_LOOP_ONCE) { - stream->spl.loop = _ALLEGRO_PLAYMODE_STREAM_LOOP_ONCE; + if (val == A5O_PLAYMODE_LOOP_ONCE) { + stream->spl.loop = _A5O_PLAYMODE_STREAM_LOOP_ONCE; ret = true; } - else if (val == ALLEGRO_PLAYMODE_LOOP) { + else if (val == A5O_PLAYMODE_LOOP) { /* Only streams creating by al_load_audio_stream() support * looping. */ if (!stream->feeder) { ret = false; } else { - stream->spl.loop = _ALLEGRO_PLAYMODE_STREAM_ONEDIR; + stream->spl.loop = _A5O_PLAYMODE_STREAM_ONEDIR; ret = true; } } @@ -491,7 +491,7 @@ bool al_set_audio_stream_playmode(ALLEGRO_AUDIO_STREAM *stream, } -static void reset_stopped_stream(ALLEGRO_AUDIO_STREAM *stream) +static void reset_stopped_stream(A5O_AUDIO_STREAM *stream) { const int bytes_per_sample = al_get_channel_count(stream->spl.spl_data.chan_conf) * @@ -538,14 +538,14 @@ static void reset_stopped_stream(ALLEGRO_AUDIO_STREAM *stream) /* Function: al_set_audio_stream_playing */ -bool al_set_audio_stream_playing(ALLEGRO_AUDIO_STREAM *stream, bool val) +bool al_set_audio_stream_playing(A5O_AUDIO_STREAM *stream, bool val) { bool rc = true; - ALLEGRO_MUTEX *stream_mutex; + A5O_MUTEX *stream_mutex; ASSERT(stream); if (stream->spl.parent.u.ptr && stream->spl.parent.is_voice) { - ALLEGRO_VOICE *voice = stream->spl.parent.u.voice; + A5O_VOICE *voice = stream->spl.parent.u.voice; if (val != stream->spl.is_playing) { rc = _al_kcm_set_voice_playing(voice, voice->mutex, val); } @@ -574,7 +574,7 @@ bool al_set_audio_stream_playing(ALLEGRO_AUDIO_STREAM *stream, bool val) /* Function: al_detach_audio_stream */ -bool al_detach_audio_stream(ALLEGRO_AUDIO_STREAM *stream) +bool al_detach_audio_stream(A5O_AUDIO_STREAM *stream) { ASSERT(stream); @@ -586,11 +586,11 @@ bool al_detach_audio_stream(ALLEGRO_AUDIO_STREAM *stream) /* Function: al_set_audio_stream_fragment */ -bool al_set_audio_stream_fragment(ALLEGRO_AUDIO_STREAM *stream, void *val) +bool al_set_audio_stream_fragment(A5O_AUDIO_STREAM *stream, void *val) { size_t i; bool ret; - ALLEGRO_MUTEX *stream_mutex; + A5O_MUTEX *stream_mutex; ASSERT(stream); stream_mutex = maybe_lock_mutex(stream->spl.mutex); @@ -602,7 +602,7 @@ bool al_set_audio_stream_fragment(ALLEGRO_AUDIO_STREAM *stream, void *val) ret = true; } else { - _al_set_error(ALLEGRO_INVALID_OBJECT, + _al_set_error(A5O_INVALID_OBJECT, "Attempted to set a stream buffer with a full pending list"); ret = false; } @@ -622,9 +622,9 @@ bool al_set_audio_stream_fragment(ALLEGRO_AUDIO_STREAM *stream, void *val) * Returns true if the next buffer is available and set up. * Otherwise returns false. */ -bool _al_kcm_refill_stream(ALLEGRO_AUDIO_STREAM *stream) +bool _al_kcm_refill_stream(A5O_AUDIO_STREAM *stream) { - ALLEGRO_SAMPLE_INSTANCE *spl = &stream->spl; + A5O_SAMPLE_INSTANCE *spl = &stream->spl; void *old_buf = spl->spl_data.buffer.ptr; void *new_buf; size_t i; @@ -649,7 +649,7 @@ bool _al_kcm_refill_stream(ALLEGRO_AUDIO_STREAM *stream) new_buf = stream->pending_bufs[0]; stream->spl.spl_data.buffer.ptr = new_buf; if (!new_buf) { - ALLEGRO_WARN("Out of buffers\n"); + A5O_WARN("Out of buffers\n"); return false; } @@ -679,15 +679,15 @@ bool _al_kcm_refill_stream(ALLEGRO_AUDIO_STREAM *stream) * A routine running in another thread that feeds the stream buffers as * necessary, usually getting data from some file reader backend. */ -void *_al_kcm_feed_stream(ALLEGRO_THREAD *self, void *vstream) +void *_al_kcm_feed_stream(A5O_THREAD *self, void *vstream) { - ALLEGRO_AUDIO_STREAM *stream = vstream; - ALLEGRO_EVENT_QUEUE *queue; + A5O_AUDIO_STREAM *stream = vstream; + A5O_EVENT_QUEUE *queue; bool finished_event_sent = false; bool prefill = true; (void)self; - ALLEGRO_DEBUG("Stream feeder thread started.\n"); + A5O_DEBUG("Stream feeder thread started.\n"); queue = al_create_event_queue(); al_register_event_source(queue, &stream->spl.es); @@ -696,16 +696,16 @@ void *_al_kcm_feed_stream(ALLEGRO_THREAD *self, void *vstream) while (!stream->quit_feed_thread) { char *fragment; - ALLEGRO_EVENT event; + A5O_EVENT event; if (!prefill) al_wait_for_event(queue, &event); - if ((prefill || event.type == ALLEGRO_EVENT_AUDIO_STREAM_FRAGMENT) + if ((prefill || event.type == A5O_EVENT_AUDIO_STREAM_FRAGMENT) && !stream->is_draining) { unsigned long bytes; unsigned long bytes_written; - ALLEGRO_MUTEX *stream_mutex; + A5O_MUTEX *stream_mutex; fragment = al_get_audio_stream_fragment(stream); if (!fragment) { @@ -721,10 +721,10 @@ void *_al_kcm_feed_stream(ALLEGRO_THREAD *self, void *vstream) bytes_written = stream->feeder(stream, fragment, bytes); maybe_unlock_mutex(stream_mutex); - if (stream->spl.loop == _ALLEGRO_PLAYMODE_STREAM_ONEDIR) { + if (stream->spl.loop == _A5O_PLAYMODE_STREAM_ONEDIR) { /* Keep rewinding until the fragment is filled. */ while (bytes_written < bytes && - stream->spl.loop == _ALLEGRO_PLAYMODE_STREAM_ONEDIR) { + stream->spl.loop == _A5O_PLAYMODE_STREAM_ONEDIR) { size_t bw; al_rewind_audio_stream(stream); stream_mutex = maybe_lock_mutex(stream->spl.mutex); @@ -744,7 +744,7 @@ void *_al_kcm_feed_stream(ALLEGRO_THREAD *self, void *vstream) } if (!al_set_audio_stream_fragment(stream, fragment)) { - ALLEGRO_ERROR("Error setting stream buffer.\n"); + A5O_ERROR("Error setting stream buffer.\n"); continue; } @@ -752,16 +752,16 @@ void *_al_kcm_feed_stream(ALLEGRO_THREAD *self, void *vstream) * Don't quit in case the user decides to seek and then restart the * stream. */ if (bytes_written != bytes && - (stream->spl.loop == _ALLEGRO_PLAYMODE_STREAM_ONCE || - stream->spl.loop == _ALLEGRO_PLAYMODE_STREAM_LOOP_ONCE)) { + (stream->spl.loop == _A5O_PLAYMODE_STREAM_ONCE || + stream->spl.loop == _A5O_PLAYMODE_STREAM_LOOP_ONCE)) { /* Why not al_drain_audio_stream? We don't want to block on draining * because the user might adjust the stream loop points and restart * the stream. */ stream->is_draining = true; if (!finished_event_sent) { - ALLEGRO_EVENT fin_event; - fin_event.user.type = ALLEGRO_EVENT_AUDIO_STREAM_FINISHED; + A5O_EVENT fin_event; + fin_event.user.type = A5O_EVENT_AUDIO_STREAM_FINISHED; fin_event.user.timestamp = al_get_time(); al_emit_user_event(&stream->spl.es, &fin_event, NULL); finished_event_sent = true; @@ -771,10 +771,10 @@ void *_al_kcm_feed_stream(ALLEGRO_THREAD *self, void *vstream) } } else if (event.type == _KCM_STREAM_FEEDER_QUIT_EVENT_TYPE) { - ALLEGRO_EVENT fin_event; + A5O_EVENT fin_event; stream->quit_feed_thread = true; - fin_event.user.type = ALLEGRO_EVENT_AUDIO_STREAM_FINISHED; + fin_event.user.type = A5O_EVENT_AUDIO_STREAM_FINISHED; fin_event.user.timestamp = al_get_time(); al_emit_user_event(&stream->spl.es, &fin_event, NULL); } @@ -789,13 +789,13 @@ void *_al_kcm_feed_stream(ALLEGRO_THREAD *self, void *vstream) al_destroy_event_queue(queue); - ALLEGRO_DEBUG("Stream feeder thread finished.\n"); + A5O_DEBUG("Stream feeder thread finished.\n"); return NULL; } -void _al_kcm_emit_stream_events(ALLEGRO_AUDIO_STREAM *stream) +void _al_kcm_emit_stream_events(A5O_AUDIO_STREAM *stream) { /* Emit one event for each stream fragment available right now. * @@ -811,8 +811,8 @@ void _al_kcm_emit_stream_events(ALLEGRO_AUDIO_STREAM *stream) int count = al_get_available_audio_stream_fragments(stream); while (count--) { - ALLEGRO_EVENT event; - event.user.type = ALLEGRO_EVENT_AUDIO_STREAM_FRAGMENT; + A5O_EVENT event; + event.user.type = A5O_EVENT_AUDIO_STREAM_FRAGMENT; event.user.timestamp = al_get_time(); al_emit_user_event(&stream->spl.es, &event, NULL); } @@ -821,12 +821,12 @@ void _al_kcm_emit_stream_events(ALLEGRO_AUDIO_STREAM *stream) /* Function: al_rewind_audio_stream */ -bool al_rewind_audio_stream(ALLEGRO_AUDIO_STREAM *stream) +bool al_rewind_audio_stream(A5O_AUDIO_STREAM *stream) { bool ret; if (stream->rewind_feeder) { - ALLEGRO_MUTEX *stream_mutex = maybe_lock_mutex(stream->spl.mutex); + A5O_MUTEX *stream_mutex = maybe_lock_mutex(stream->spl.mutex); ret = stream->rewind_feeder(stream); stream->is_draining = false; maybe_unlock_mutex(stream_mutex); @@ -839,12 +839,12 @@ bool al_rewind_audio_stream(ALLEGRO_AUDIO_STREAM *stream) /* Function: al_seek_audio_stream_secs */ -bool al_seek_audio_stream_secs(ALLEGRO_AUDIO_STREAM *stream, double time) +bool al_seek_audio_stream_secs(A5O_AUDIO_STREAM *stream, double time) { bool ret; if (stream->seek_feeder) { - ALLEGRO_MUTEX *stream_mutex = maybe_lock_mutex(stream->spl.mutex); + A5O_MUTEX *stream_mutex = maybe_lock_mutex(stream->spl.mutex); ret = stream->seek_feeder(stream, time); stream->is_draining = false; maybe_unlock_mutex(stream_mutex); @@ -857,12 +857,12 @@ bool al_seek_audio_stream_secs(ALLEGRO_AUDIO_STREAM *stream, double time) /* Function: al_get_audio_stream_position_secs */ -double al_get_audio_stream_position_secs(ALLEGRO_AUDIO_STREAM *stream) +double al_get_audio_stream_position_secs(A5O_AUDIO_STREAM *stream) { double ret; if (stream->get_feeder_position) { - ALLEGRO_MUTEX *stream_mutex = maybe_lock_mutex(stream->spl.mutex); + A5O_MUTEX *stream_mutex = maybe_lock_mutex(stream->spl.mutex); ret = stream->get_feeder_position(stream); maybe_unlock_mutex(stream_mutex); return ret; @@ -874,12 +874,12 @@ double al_get_audio_stream_position_secs(ALLEGRO_AUDIO_STREAM *stream) /* Function: al_get_audio_stream_length_secs */ -double al_get_audio_stream_length_secs(ALLEGRO_AUDIO_STREAM *stream) +double al_get_audio_stream_length_secs(A5O_AUDIO_STREAM *stream) { double ret; if (stream->get_feeder_length) { - ALLEGRO_MUTEX *stream_mutex = maybe_lock_mutex(stream->spl.mutex); + A5O_MUTEX *stream_mutex = maybe_lock_mutex(stream->spl.mutex); ret = stream->get_feeder_length(stream); maybe_unlock_mutex(stream_mutex); return ret; @@ -891,7 +891,7 @@ double al_get_audio_stream_length_secs(ALLEGRO_AUDIO_STREAM *stream) /* Function: al_set_audio_stream_loop_secs */ -bool al_set_audio_stream_loop_secs(ALLEGRO_AUDIO_STREAM *stream, +bool al_set_audio_stream_loop_secs(A5O_AUDIO_STREAM *stream, double start, double end) { bool ret; @@ -900,7 +900,7 @@ bool al_set_audio_stream_loop_secs(ALLEGRO_AUDIO_STREAM *stream, return false; if (stream->set_feeder_loop) { - ALLEGRO_MUTEX *stream_mutex = maybe_lock_mutex(stream->spl.mutex); + A5O_MUTEX *stream_mutex = maybe_lock_mutex(stream->spl.mutex); ret = stream->set_feeder_loop(stream, start, end); stream->is_draining = false; maybe_unlock_mutex(stream_mutex); @@ -913,18 +913,18 @@ bool al_set_audio_stream_loop_secs(ALLEGRO_AUDIO_STREAM *stream, /* Function: al_get_audio_stream_event_source */ -ALLEGRO_EVENT_SOURCE *al_get_audio_stream_event_source( - ALLEGRO_AUDIO_STREAM *stream) +A5O_EVENT_SOURCE *al_get_audio_stream_event_source( + A5O_AUDIO_STREAM *stream) { return &stream->spl.es; } -bool al_set_audio_stream_channel_matrix(ALLEGRO_AUDIO_STREAM *stream, const float *matrix) +bool al_set_audio_stream_channel_matrix(A5O_AUDIO_STREAM *stream, const float *matrix) { ASSERT(stream); if (stream->spl.parent.u.ptr && stream->spl.parent.is_voice) { - _al_set_error(ALLEGRO_GENERIC_ERROR, + _al_set_error(A5O_GENERIC_ERROR, "Could not set channel matrix of stream attached to voice"); return false; } diff --git a/addons/audio/kcm_voice.c b/addons/audio/kcm_voice.c index 32b3d869ed..f299f1c07f 100644 --- a/addons/audio/kcm_voice.c +++ b/addons/audio/kcm_voice.c @@ -14,12 +14,12 @@ #include "allegro5/internal/aintern_audio.h" #include "allegro5/internal/aintern_audio_cfg.h" -ALLEGRO_DEBUG_CHANNEL("audio") +A5O_DEBUG_CHANNEL("audio") /* forward declarations */ static void stream_read(void *source, void **vbuf, unsigned int *samples, - ALLEGRO_AUDIO_DEPTH buffer_depth, size_t dest_maxc); + A5O_AUDIO_DEPTH buffer_depth, size_t dest_maxc); @@ -36,7 +36,7 @@ static void stream_read(void *source, void **vbuf, unsigned int *samples, * in the returned audio data and it may be less or equal to the requested * samples count. */ -const void *_al_voice_update(ALLEGRO_VOICE *voice, ALLEGRO_MUTEX *mutex, +const void *_al_voice_update(A5O_VOICE *voice, A5O_MUTEX *mutex, unsigned int *samples) { void *buf = NULL; @@ -62,13 +62,13 @@ const void *_al_voice_update(ALLEGRO_VOICE *voice, ALLEGRO_MUTEX *mutex, /* Function: al_create_voice */ -ALLEGRO_VOICE *al_create_voice(unsigned int freq, - ALLEGRO_AUDIO_DEPTH depth, ALLEGRO_CHANNEL_CONF chan_conf) +A5O_VOICE *al_create_voice(unsigned int freq, + A5O_AUDIO_DEPTH depth, A5O_CHANNEL_CONF chan_conf) { - ALLEGRO_VOICE *voice = NULL; + A5O_VOICE *voice = NULL; if (!freq) { - _al_set_error(ALLEGRO_INVALID_PARAM, "Invalid Voice Frequency"); + _al_set_error(A5O_INVALID_PARAM, "Invalid Voice Frequency"); return NULL; } @@ -103,7 +103,7 @@ ALLEGRO_VOICE *al_create_voice(unsigned int freq, /* Function: al_destroy_voice */ -void al_destroy_voice(ALLEGRO_VOICE *voice) +void al_destroy_voice(A5O_VOICE *voice) { if (voice) { _al_kcm_unregister_destructor(voice->dtor_item); @@ -123,8 +123,8 @@ void al_destroy_voice(ALLEGRO_VOICE *voice) /* Function: al_attach_sample_instance_to_voice */ -bool al_attach_sample_instance_to_voice(ALLEGRO_SAMPLE_INSTANCE *spl, - ALLEGRO_VOICE *voice) +bool al_attach_sample_instance_to_voice(A5O_SAMPLE_INSTANCE *spl, + A5O_VOICE *voice) { bool ret; @@ -132,16 +132,16 @@ bool al_attach_sample_instance_to_voice(ALLEGRO_SAMPLE_INSTANCE *spl, ASSERT(spl); if (voice->attached_stream) { - ALLEGRO_WARN( + A5O_WARN( "Attempted to attach to a voice that already has an attachment\n"); - _al_set_error(ALLEGRO_INVALID_OBJECT, + _al_set_error(A5O_INVALID_OBJECT, "Attempted to attach to a voice that already has an attachment"); return false; } if (spl->parent.u.ptr) { - ALLEGRO_WARN("Attempted to attach a sample that is already attached\n"); - _al_set_error(ALLEGRO_INVALID_OBJECT, + A5O_WARN("Attempted to attach a sample that is already attached\n"); + _al_set_error(A5O_INVALID_OBJECT, "Attempted to attach a sample that is already attached"); return false; } @@ -150,8 +150,8 @@ bool al_attach_sample_instance_to_voice(ALLEGRO_SAMPLE_INSTANCE *spl, voice->frequency != spl->spl_data.frequency || voice->depth != spl->spl_data.depth) { - ALLEGRO_WARN("Sample settings do not match voice settings\n"); - _al_set_error(ALLEGRO_INVALID_OBJECT, + A5O_WARN("Sample settings do not match voice settings\n"); + _al_set_error(A5O_INVALID_OBJECT, "Sample settings do not match voice settings"); return false; } @@ -180,7 +180,7 @@ bool al_attach_sample_instance_to_voice(ALLEGRO_SAMPLE_INSTANCE *spl, _al_kcm_stream_set_mutex(spl, NULL); spl->parent.u.voice = NULL; - ALLEGRO_ERROR("Unable to load sample into voice\n"); + A5O_ERROR("Unable to load sample into voice\n"); ret = false; } else { @@ -197,9 +197,9 @@ bool al_attach_sample_instance_to_voice(ALLEGRO_SAMPLE_INSTANCE *spl, * This passes the next waiting stream buffer to the voice via vbuf. */ static void stream_read(void *source, void **vbuf, unsigned int *samples, - ALLEGRO_AUDIO_DEPTH buffer_depth, size_t dest_maxc) + A5O_AUDIO_DEPTH buffer_depth, size_t dest_maxc) { - ALLEGRO_AUDIO_STREAM *stream = (ALLEGRO_AUDIO_STREAM*)source; + A5O_AUDIO_STREAM *stream = (A5O_AUDIO_STREAM*)source; unsigned int len = stream->spl.spl_data.len; unsigned int pos = stream->spl.pos; @@ -248,8 +248,8 @@ static void stream_read(void *source, void **vbuf, unsigned int *samples, /* Function: al_attach_audio_stream_to_voice */ -bool al_attach_audio_stream_to_voice(ALLEGRO_AUDIO_STREAM *stream, - ALLEGRO_VOICE *voice) +bool al_attach_audio_stream_to_voice(A5O_AUDIO_STREAM *stream, + A5O_VOICE *voice) { bool ret; @@ -257,13 +257,13 @@ bool al_attach_audio_stream_to_voice(ALLEGRO_AUDIO_STREAM *stream, ASSERT(stream); if (voice->attached_stream) { - _al_set_error(ALLEGRO_INVALID_OBJECT, + _al_set_error(A5O_INVALID_OBJECT, "Attempted to attach to a voice that already has an attachment"); return false; } if (stream->spl.parent.u.ptr) { - _al_set_error(ALLEGRO_INVALID_OBJECT, + _al_set_error(A5O_INVALID_OBJECT, "Attempted to attach a stream that is already attached"); return false; } @@ -272,7 +272,7 @@ bool al_attach_audio_stream_to_voice(ALLEGRO_AUDIO_STREAM *stream, voice->frequency != stream->spl.spl_data.frequency || voice->depth != stream->spl.spl_data.depth) { - _al_set_error(ALLEGRO_INVALID_OBJECT, + _al_set_error(A5O_INVALID_OBJECT, "Stream settings do not match voice settings"); return false; } @@ -301,7 +301,7 @@ bool al_attach_audio_stream_to_voice(ALLEGRO_AUDIO_STREAM *stream, stream->spl.parent.u.voice = NULL; stream->spl.spl_read = NULL; - _al_set_error(ALLEGRO_GENERIC_ERROR, "Unable to start stream"); + _al_set_error(A5O_GENERIC_ERROR, "Unable to start stream"); ret = false; } else { @@ -316,7 +316,7 @@ bool al_attach_audio_stream_to_voice(ALLEGRO_AUDIO_STREAM *stream, /* Function: al_attach_mixer_to_voice */ -bool al_attach_mixer_to_voice(ALLEGRO_MIXER *mixer, ALLEGRO_VOICE *voice) +bool al_attach_mixer_to_voice(A5O_MIXER *mixer, A5O_VOICE *voice) { bool ret; @@ -367,7 +367,7 @@ bool al_attach_mixer_to_voice(ALLEGRO_MIXER *mixer, ALLEGRO_VOICE *voice) /* Function: al_detach_voice */ -void al_detach_voice(ALLEGRO_VOICE *voice) +void al_detach_voice(A5O_VOICE *voice) { ASSERT(voice); @@ -378,7 +378,7 @@ void al_detach_voice(ALLEGRO_VOICE *voice) al_lock_mutex(voice->mutex); if (!voice->is_streaming) { - ALLEGRO_SAMPLE_INSTANCE *spl = voice->attached_stream; + A5O_SAMPLE_INSTANCE *spl = voice->attached_stream; spl->pos = voice->driver->get_voice_position(voice); spl->is_playing = voice->driver->voice_is_playing(voice); @@ -401,7 +401,7 @@ void al_detach_voice(ALLEGRO_VOICE *voice) /* Function: al_get_voice_frequency */ -unsigned int al_get_voice_frequency(const ALLEGRO_VOICE *voice) +unsigned int al_get_voice_frequency(const A5O_VOICE *voice) { ASSERT(voice); @@ -411,7 +411,7 @@ unsigned int al_get_voice_frequency(const ALLEGRO_VOICE *voice) /* Function: al_get_voice_position */ -unsigned int al_get_voice_position(const ALLEGRO_VOICE *voice) +unsigned int al_get_voice_position(const A5O_VOICE *voice) { ASSERT(voice); @@ -429,7 +429,7 @@ unsigned int al_get_voice_position(const ALLEGRO_VOICE *voice) /* Function: al_get_voice_channels */ -ALLEGRO_CHANNEL_CONF al_get_voice_channels(const ALLEGRO_VOICE *voice) +A5O_CHANNEL_CONF al_get_voice_channels(const A5O_VOICE *voice) { ASSERT(voice); @@ -439,7 +439,7 @@ ALLEGRO_CHANNEL_CONF al_get_voice_channels(const ALLEGRO_VOICE *voice) /* Function: al_get_voice_depth */ -ALLEGRO_AUDIO_DEPTH al_get_voice_depth(const ALLEGRO_VOICE *voice) +A5O_AUDIO_DEPTH al_get_voice_depth(const A5O_VOICE *voice) { ASSERT(voice); @@ -449,7 +449,7 @@ ALLEGRO_AUDIO_DEPTH al_get_voice_depth(const ALLEGRO_VOICE *voice) /* Function: al_get_voice_playing */ -bool al_get_voice_playing(const ALLEGRO_VOICE *voice) +bool al_get_voice_playing(const A5O_VOICE *voice) { ASSERT(voice); @@ -466,7 +466,7 @@ bool al_get_voice_playing(const ALLEGRO_VOICE *voice) /* Function: al_voice_has_attachments */ -bool al_voice_has_attachments(const ALLEGRO_VOICE* voice) +bool al_voice_has_attachments(const A5O_VOICE* voice) { ASSERT(voice); @@ -475,7 +475,7 @@ bool al_voice_has_attachments(const ALLEGRO_VOICE* voice) /* Function: al_set_voice_position */ -bool al_set_voice_position(ALLEGRO_VOICE *voice, unsigned int val) +bool al_set_voice_position(A5O_VOICE *voice, unsigned int val) { ASSERT(voice); @@ -494,17 +494,17 @@ bool al_set_voice_position(ALLEGRO_VOICE *voice, unsigned int val) /* Function: al_set_voice_playing */ -bool al_set_voice_playing(ALLEGRO_VOICE *voice, bool val) +bool al_set_voice_playing(A5O_VOICE *voice, bool val) { ASSERT(voice); if (!voice->attached_stream) { - ALLEGRO_DEBUG("Voice has no attachment\n"); + A5O_DEBUG("Voice has no attachment\n"); return false; } if (voice->is_streaming) { - ALLEGRO_WARN("Attempted to change the playing state of a voice " + A5O_WARN("Attempted to change the playing state of a voice " "with a streaming attachment (mixer or audiostreams)\n"); return false; } @@ -512,10 +512,10 @@ bool al_set_voice_playing(ALLEGRO_VOICE *voice, bool val) bool playing = al_get_voice_playing(voice); if (playing == val) { if (playing) { - ALLEGRO_DEBUG("Voice is already playing\n"); + A5O_DEBUG("Voice is already playing\n"); } else { - ALLEGRO_DEBUG("Voice is already stopped\n"); + A5O_DEBUG("Voice is already stopped\n"); } return true; } @@ -525,7 +525,7 @@ bool al_set_voice_playing(ALLEGRO_VOICE *voice, bool val) } -bool _al_kcm_set_voice_playing(ALLEGRO_VOICE *voice, ALLEGRO_MUTEX *mutex, +bool _al_kcm_set_voice_playing(A5O_VOICE *voice, A5O_MUTEX *mutex, bool val) { bool ret; diff --git a/addons/audio/openal.c b/addons/audio/openal.c index 7635ebefd9..51d51dc754 100644 --- a/addons/audio/openal.c +++ b/addons/audio/openal.c @@ -8,17 +8,17 @@ #include "allegro5/allegro.h" -#if defined(ALLEGRO_MACOSX) || defined(ALLEGRO_IPHONE) +#if defined(A5O_MACOSX) || defined(A5O_IPHONE) #include #include -#else /* ALLEGRO_MACOSX */ +#else /* A5O_MACOSX */ #include #include -#endif /* ALLEGRO_MACOSX */ +#endif /* A5O_MACOSX */ #include "allegro5/internal/aintern_audio.h" -ALLEGRO_DEBUG_CHANNEL("openal") +A5O_DEBUG_CHANNEL("openal") /* OpenAL vars */ static ALCdevice *openal_dev; @@ -76,7 +76,7 @@ static int _openal_open(void) ALenum openal_err; ALCenum alc_err; - ALLEGRO_INFO("Starting OpenAL\n"); + A5O_INFO("Starting OpenAL\n"); /* clear the error state */ openal_err = alGetError(); @@ -86,7 +86,7 @@ static int _openal_open(void) alc_err = ALC_NO_ERROR; if (!openal_dev || (alc_err = alcGetError(openal_dev)) != ALC_NO_ERROR) { - ALLEGRO_ERROR("Could not open audio device: %s\n", + A5O_ERROR("Could not open audio device: %s\n", alc_get_err_str(alc_err)); return 1; } @@ -94,31 +94,31 @@ static int _openal_open(void) openal_context = alcCreateContext(openal_dev, NULL); alc_err = ALC_NO_ERROR; if (!openal_context || (alc_err = alcGetError(openal_dev)) != ALC_NO_ERROR) { - ALLEGRO_ERROR("Could not create current device context: %s\n", + A5O_ERROR("Could not create current device context: %s\n", alc_get_err_str(alc_err)); return 1; } alcMakeContextCurrent(openal_context); -#if !defined ALLEGRO_IPHONE +#if !defined A5O_IPHONE if ((alc_err = alcGetError(openal_dev)) != ALC_NO_ERROR) { - ALLEGRO_ERROR("Could not make context current: %s\n", + A5O_ERROR("Could not make context current: %s\n", alc_get_err_str(alc_err)); return 1; } alDistanceModel(AL_NONE); if ((openal_err = alGetError()) != AL_NO_ERROR) { - ALLEGRO_ERROR("Could not set distance model: %s\n", + A5O_ERROR("Could not set distance model: %s\n", openal_get_err_str(openal_err)); return 1; } #endif - ALLEGRO_DEBUG("Vendor: %s\n", alGetString(AL_VENDOR)); - ALLEGRO_DEBUG("Version: %s\n", alGetString(AL_VERSION)); - ALLEGRO_DEBUG("Renderer: %s\n", alGetString(AL_RENDERER)); - ALLEGRO_DEBUG("Extensions: %s\n", alGetString(AL_EXTENSIONS)); + A5O_DEBUG("Vendor: %s\n", alGetString(AL_VENDOR)); + A5O_DEBUG("Version: %s\n", alGetString(AL_VERSION)); + A5O_DEBUG("Renderer: %s\n", alGetString(AL_RENDERER)); + A5O_DEBUG("Extensions: %s\n", alGetString(AL_EXTENSIONS)); return 0; } @@ -143,7 +143,7 @@ static void _openal_close(void) /* Custom struct to hold voice information OpenAL needs */ /* TODO: review */ -typedef struct ALLEGRO_AL_DATA { +typedef struct A5O_AL_DATA { ALuint *buffers; size_t num_buffers; @@ -152,17 +152,17 @@ typedef struct ALLEGRO_AL_DATA { ALuint source; ALuint format; - ALLEGRO_THREAD *thread; + A5O_THREAD *thread; bool stopped; -} ALLEGRO_AL_DATA; +} A5O_AL_DATA; /* Custom routine which runs in another thread to periodically check if OpenAL wants more data for a stream */ /* TODO: review */ -static void *_openal_update(ALLEGRO_THREAD *self, void *arg) +static void *_openal_update(A5O_THREAD *self, void *arg) { - ALLEGRO_VOICE *voice = (ALLEGRO_VOICE*) arg; - ALLEGRO_AL_DATA *ex_data = (ALLEGRO_AL_DATA*)voice->extra; + A5O_VOICE *voice = (A5O_VOICE*) arg; + A5O_AL_DATA *ex_data = (A5O_AL_DATA*)voice->extra; unsigned int i, samples_per_update; unsigned int bytes_per_sample; const void *data; @@ -247,26 +247,26 @@ static void *_openal_update(ALLEGRO_THREAD *self, void *arg) 'buffer_size' field will be the total length in bytes of the sample data. The voice's attached sample's looping mode should be honored, and loading must fail if it cannot be. */ -static int _openal_load_voice(ALLEGRO_VOICE *voice, const void *data) +static int _openal_load_voice(A5O_VOICE *voice, const void *data) { - ALLEGRO_AL_DATA *ex_data = voice->extra; + A5O_AL_DATA *ex_data = voice->extra; ALenum openal_err; - if (voice->attached_stream->loop != ALLEGRO_PLAYMODE_ONCE && - voice->attached_stream->loop != ALLEGRO_PLAYMODE_LOOP) { + if (voice->attached_stream->loop != A5O_PLAYMODE_ONCE && + voice->attached_stream->loop != A5O_PLAYMODE_LOOP) { return 1; } ex_data->buffer_size = voice->buffer_size; if (!ex_data->buffer_size) { - ALLEGRO_ERROR("Voice buffer and data buffer size mismatch\n"); + A5O_ERROR("Voice buffer and data buffer size mismatch\n"); return 1; } ex_data->num_buffers = 1; alGenSources(1, &ex_data->source); if ((openal_err = alGetError()) != AL_NO_ERROR) { - ALLEGRO_ERROR("Could not generate (voice) source: %s\n", + A5O_ERROR("Could not generate (voice) source: %s\n", openal_get_err_str(openal_err)); return 1; } @@ -275,7 +275,7 @@ static int _openal_load_voice(ALLEGRO_VOICE *voice, const void *data) if (!ex_data->buffers) { alSourcei(ex_data->source, AL_BUFFER, 0); alDeleteSources(1, &ex_data->source); - ALLEGRO_ERROR("Could not allocate voice buffer memory\n"); + A5O_ERROR("Could not allocate voice buffer memory\n"); return 1; } @@ -285,7 +285,7 @@ static int _openal_load_voice(ALLEGRO_VOICE *voice, const void *data) alDeleteSources(1, &ex_data->source); al_free(ex_data->buffers); ex_data->buffers = NULL; - ALLEGRO_ERROR("Could not generate (voice) buffer: %s\n", + A5O_ERROR("Could not generate (voice) buffer: %s\n", openal_get_err_str(openal_err)); return 1; } @@ -299,7 +299,7 @@ static int _openal_load_voice(ALLEGRO_VOICE *voice, const void *data) /* Loop / no loop? */ alSourcei(ex_data->source, AL_LOOPING, - (voice->attached_stream->loop != ALLEGRO_PLAYMODE_ONCE)); + (voice->attached_stream->loop != A5O_PLAYMODE_ONCE)); /* make sure the volume is on */ alSourcef(ex_data->source, AL_GAIN, 1.0f); @@ -310,7 +310,7 @@ static int _openal_load_voice(ALLEGRO_VOICE *voice, const void *data) alDeleteBuffers(ex_data->num_buffers, ex_data->buffers); al_free(ex_data->buffers); ex_data->buffers = NULL; - ALLEGRO_ERROR("Could not attach voice source: %s\n", + A5O_ERROR("Could not attach voice source: %s\n", openal_get_err_str(openal_err)); return 1; } @@ -320,9 +320,9 @@ static int _openal_load_voice(ALLEGRO_VOICE *voice, const void *data) /* The unload_voice method unloads a sample previously loaded with load_voice. This method should not be called on a streaming voice. */ -static void _openal_unload_voice(ALLEGRO_VOICE *voice) +static void _openal_unload_voice(A5O_VOICE *voice) { - ALLEGRO_AL_DATA *ex_data = voice->extra; + A5O_AL_DATA *ex_data = voice->extra; alSourcei(ex_data->source, AL_BUFFER, 0); alDeleteSources(1, &ex_data->source); @@ -337,21 +337,21 @@ static void _openal_unload_voice(ALLEGRO_VOICE *voice) should start polling the device and call _al_voice_update for audio data. For non-streaming voices, it should resume playing from the last set position */ -static int _openal_start_voice(ALLEGRO_VOICE *voice) +static int _openal_start_voice(A5O_VOICE *voice) { - ALLEGRO_AL_DATA *ex_data = voice->extra; + A5O_AL_DATA *ex_data = voice->extra; ALenum openal_err; /* playing a sample instead of a stream */ if (!voice->is_streaming) { alSourcePlay(ex_data->source); if ((openal_err = alGetError()) != AL_NO_ERROR) { - ALLEGRO_ERROR("Could not start voice: %s\n", + A5O_ERROR("Could not start voice: %s\n", openal_get_err_str(openal_err)); return 1; } - ALLEGRO_INFO("Starting voice\n"); + A5O_INFO("Starting voice\n"); return 0; } @@ -411,19 +411,19 @@ static int _openal_start_voice(ALLEGRO_VOICE *voice) al_start_thread(ex_data->thread); } - ALLEGRO_INFO("Starting voice\n"); + A5O_INFO("Starting voice\n"); return 0; } /* The stop_voice method should stop playback. For non-streaming voices, it should leave the data loaded, and reset the voice position to 0. */ -static int _openal_stop_voice(ALLEGRO_VOICE* voice) +static int _openal_stop_voice(A5O_VOICE* voice) { - ALLEGRO_AL_DATA *ex_data = voice->extra; + A5O_AL_DATA *ex_data = voice->extra; ALenum openal_err; if (!ex_data->buffers) { - ALLEGRO_WARN("Trying to stop empty voice buffer\n"); + A5O_WARN("Trying to stop empty voice buffer\n"); return 1; } @@ -431,7 +431,7 @@ static int _openal_stop_voice(ALLEGRO_VOICE* voice) if (!voice->is_streaming) { alSourceStop(ex_data->source); if ((openal_err = alGetError()) != AL_NO_ERROR) { - ALLEGRO_ERROR("Could not stop voice: %s\n", + A5O_ERROR("Could not stop voice: %s\n", openal_get_err_str(openal_err)); return 1; } @@ -460,9 +460,9 @@ static int _openal_stop_voice(ALLEGRO_VOICE* voice) /* The voice_is_playing method should only be called on non-streaming sources, and should return true if the voice is playing */ -static bool _openal_voice_is_playing(const ALLEGRO_VOICE *voice) +static bool _openal_voice_is_playing(const A5O_VOICE *voice) { - ALLEGRO_AL_DATA *ex_data = voice->extra; + A5O_AL_DATA *ex_data = voice->extra; ALint status; if (!ex_data) @@ -474,121 +474,121 @@ static bool _openal_voice_is_playing(const ALLEGRO_VOICE *voice) /* The allocate_voice method should grab a voice from the system, and allocate any data common to streaming and non-streaming sources. */ -static int _openal_allocate_voice(ALLEGRO_VOICE *voice) +static int _openal_allocate_voice(A5O_VOICE *voice) { - ALLEGRO_AL_DATA *ex_data; + A5O_AL_DATA *ex_data; /* OpenAL doesn't support very much! */ switch (voice->depth) { - case ALLEGRO_AUDIO_DEPTH_UINT8: + case A5O_AUDIO_DEPTH_UINT8: /* format supported */ break; - case ALLEGRO_AUDIO_DEPTH_INT8: - ALLEGRO_WARN("OpenAL requires 8-bit data to be unsigned\n"); + case A5O_AUDIO_DEPTH_INT8: + A5O_WARN("OpenAL requires 8-bit data to be unsigned\n"); return 1; - case ALLEGRO_AUDIO_DEPTH_UINT16: - ALLEGRO_WARN("OpenAL requires 16-bit data to be signed\n"); + case A5O_AUDIO_DEPTH_UINT16: + A5O_WARN("OpenAL requires 16-bit data to be signed\n"); return 1; - case ALLEGRO_AUDIO_DEPTH_INT16: + case A5O_AUDIO_DEPTH_INT16: /* format supported */ break; - case ALLEGRO_AUDIO_DEPTH_UINT24: - ALLEGRO_WARN("OpenAL does not support 24-bit data\n"); + case A5O_AUDIO_DEPTH_UINT24: + A5O_WARN("OpenAL does not support 24-bit data\n"); return 1; - case ALLEGRO_AUDIO_DEPTH_INT24: - ALLEGRO_WARN("OpenAL does not support 24-bit data\n"); + case A5O_AUDIO_DEPTH_INT24: + A5O_WARN("OpenAL does not support 24-bit data\n"); return 1; - case ALLEGRO_AUDIO_DEPTH_FLOAT32: - ALLEGRO_WARN("OpenAL does not support 32-bit floating data\n"); + case A5O_AUDIO_DEPTH_FLOAT32: + A5O_WARN("OpenAL does not support 32-bit floating data\n"); return 1; default: - ALLEGRO_WARN("Cannot allocate unknown voice depth\n"); + A5O_WARN("Cannot allocate unknown voice depth\n"); return 1; } ex_data = al_calloc(1, sizeof(*ex_data)); if (!ex_data) { - ALLEGRO_ERROR("Could not allocate voice data memory\n"); + A5O_ERROR("Could not allocate voice data memory\n"); return 1; } switch (voice->chan_conf) { - case ALLEGRO_CHANNEL_CONF_1: + case A5O_CHANNEL_CONF_1: /* format supported */ - if (voice->depth == ALLEGRO_AUDIO_DEPTH_UINT8) + if (voice->depth == A5O_AUDIO_DEPTH_UINT8) ex_data->format = AL_FORMAT_MONO8; else ex_data->format = AL_FORMAT_MONO16; break; - case ALLEGRO_CHANNEL_CONF_2: + case A5O_CHANNEL_CONF_2: /* format supported */ - if (voice->depth == ALLEGRO_AUDIO_DEPTH_UINT8) + if (voice->depth == A5O_AUDIO_DEPTH_UINT8) ex_data->format = AL_FORMAT_STEREO8; else ex_data->format = AL_FORMAT_STEREO16; break; - case ALLEGRO_CHANNEL_CONF_3: - ALLEGRO_ERROR("OpenAL does not support voice with 3 channel configuration\n"); + case A5O_CHANNEL_CONF_3: + A5O_ERROR("OpenAL does not support voice with 3 channel configuration\n"); al_free(ex_data); return 1; - case ALLEGRO_CHANNEL_CONF_4: + case A5O_CHANNEL_CONF_4: ex_data->format = alGetEnumValue("AL_FORMAT_QUAD16"); if (ex_data->format) { - ALLEGRO_ERROR("OpenAL cannot allocate voice with 4.0 channel configuration\n"); + A5O_ERROR("OpenAL cannot allocate voice with 4.0 channel configuration\n"); al_free(ex_data); return 1; } - if (voice->depth == ALLEGRO_AUDIO_DEPTH_INT16) { - ALLEGRO_ERROR("OpenAL requires 16-bit signed data for 4 channel configuration\n"); + if (voice->depth == A5O_AUDIO_DEPTH_INT16) { + A5O_ERROR("OpenAL requires 16-bit signed data for 4 channel configuration\n"); al_free(ex_data); return 1; } /* else it is supported */ break; - case ALLEGRO_CHANNEL_CONF_5_1: + case A5O_CHANNEL_CONF_5_1: ex_data->format = alGetEnumValue("AL_FORMAT_51CHN_16"); if (!ex_data->format) { - ALLEGRO_ERROR("Cannot allocate voice with 5.1 channel configuration\n"); + A5O_ERROR("Cannot allocate voice with 5.1 channel configuration\n"); al_free(ex_data); return 1; } - if (voice->depth == ALLEGRO_AUDIO_DEPTH_UINT16) { - ALLEGRO_ERROR("5.1 channel requires 16-bit signed data\n"); + if (voice->depth == A5O_AUDIO_DEPTH_UINT16) { + A5O_ERROR("5.1 channel requires 16-bit signed data\n"); al_free(ex_data); return 1; } /* else it is supported */ break; - case ALLEGRO_CHANNEL_CONF_6_1: + case A5O_CHANNEL_CONF_6_1: ex_data->format = alGetEnumValue("AL_FORMAT_61CHN_16"); if (!ex_data->format) { - ALLEGRO_ERROR("Cannot allocate voice with 6.1 channel configuration\n"); + A5O_ERROR("Cannot allocate voice with 6.1 channel configuration\n"); al_free(ex_data); return 1; } - if (voice->depth == ALLEGRO_AUDIO_DEPTH_UINT16) { - ALLEGRO_ERROR("6.1 channel requires 16-bit signed data\n"); + if (voice->depth == A5O_AUDIO_DEPTH_UINT16) { + A5O_ERROR("6.1 channel requires 16-bit signed data\n"); al_free(ex_data); return 1; } /* else it is supported */ break; - case ALLEGRO_CHANNEL_CONF_7_1: + case A5O_CHANNEL_CONF_7_1: ex_data->format = alGetEnumValue("AL_FORMAT_71CHN_16"); if (!ex_data->format) { - ALLEGRO_ERROR("Cannot allocate voice with 7.1 channel configuration\n"); + A5O_ERROR("Cannot allocate voice with 7.1 channel configuration\n"); al_free(ex_data); return 1; } - if (voice->depth == ALLEGRO_AUDIO_DEPTH_UINT16) { - ALLEGRO_ERROR("7.1 channel requires 16-bit signed data\n"); + if (voice->depth == A5O_AUDIO_DEPTH_UINT16) { + A5O_ERROR("7.1 channel requires 16-bit signed data\n"); al_free(ex_data); return 1; } /* else it is supported */ break; default: - ALLEGRO_ERROR("Cannot allocate voice with unknown channel configuration\n"); + A5O_ERROR("Cannot allocate voice with unknown channel configuration\n"); al_free(ex_data); return 1; } @@ -603,9 +603,9 @@ static int _openal_allocate_voice(ALLEGRO_VOICE *voice) /* The deallocate_voice method should free the resources for the given voice, but still retain a hold on the device. The voice should be stopped and unloaded by the time this is called */ -static void _openal_deallocate_voice(ALLEGRO_VOICE *voice) +static void _openal_deallocate_voice(A5O_VOICE *voice) { - ALLEGRO_AL_DATA *ex_data = voice->extra; + A5O_AL_DATA *ex_data = voice->extra; ASSERT(ex_data->thread == NULL); (void)ex_data; @@ -616,9 +616,9 @@ static void _openal_deallocate_voice(ALLEGRO_VOICE *voice) /* The get_voice_position method should return the current sample position of the voice (sample_pos = byte_pos / (depth/8) / channels). This should never be called on a streaming voice. */ -static unsigned int _openal_get_voice_position(const ALLEGRO_VOICE *voice) +static unsigned int _openal_get_voice_position(const A5O_VOICE *voice) { - ALLEGRO_AL_DATA *ex_data = voice->extra; + A5O_AL_DATA *ex_data = voice->extra; ALint pos; alGetSourcei(ex_data->source, AL_SAMPLE_OFFSET, &pos); @@ -630,9 +630,9 @@ static unsigned int _openal_get_voice_position(const ALLEGRO_VOICE *voice) /* The set_voice_position method should set the voice's playback position, given the value in samples. This should never be called on a streaming voice. */ -static int _openal_set_voice_position(ALLEGRO_VOICE *voice, unsigned int val) +static int _openal_set_voice_position(A5O_VOICE *voice, unsigned int val) { - ALLEGRO_AL_DATA *ex_data = voice->extra; + A5O_AL_DATA *ex_data = voice->extra; alSourcei(ex_data->source, AL_SAMPLE_OFFSET, val); if (alGetError() != AL_NO_ERROR) @@ -640,7 +640,7 @@ static int _openal_set_voice_position(ALLEGRO_VOICE *voice, unsigned int val) return 0; } -ALLEGRO_AUDIO_DRIVER _al_kcm_openal_driver = { +A5O_AUDIO_DRIVER _al_kcm_openal_driver = { "OpenAL", _openal_open, diff --git a/addons/audio/opensl.c b/addons/audio/opensl.c index b04fc76d48..551c4185f3 100644 --- a/addons/audio/opensl.c +++ b/addons/audio/opensl.c @@ -27,7 +27,7 @@ static const int MAX_FRAMES = 2048; /* Number of opensl buffers to use */ #define MAX_BUFFERS 2 -ALLEGRO_DEBUG_CHANNEL("opensl") +A5O_DEBUG_CHANNEL("opensl") static SLObjectItf engine; @@ -62,7 +62,7 @@ static SLEngineItf getEngine(SLObjectItf engine){ if (result == SL_RESULT_SUCCESS){ return interface; } else { - ALLEGRO_ERROR("Could not get opensl engine: %s\n", opensl_get_error_string(result)); + A5O_ERROR("Could not get opensl engine: %s\n", opensl_get_error_string(result)); return NULL; } } @@ -82,13 +82,13 @@ static SLObjectItf createOutputMixer(SLEngineItf engine){ result = (*engine)->CreateOutputMix(engine, &output, 0, ids, required); if (result != SL_RESULT_SUCCESS){ - ALLEGRO_ERROR("Could not create output mix: %s\n", opensl_get_error_string(result)); + A5O_ERROR("Could not create output mix: %s\n", opensl_get_error_string(result)); return NULL; } result = (*output)->Realize(output, SL_BOOLEAN_FALSE); if (result != SL_RESULT_SUCCESS){ - ALLEGRO_ERROR("Could not realize the output mix: %s\n", opensl_get_error_string(result)); + A5O_ERROR("Could not realize the output mix: %s\n", opensl_get_error_string(result)); (*output)->Destroy(output); return NULL; } @@ -110,7 +110,7 @@ static int _opensl_open(void) result = slCreateEngine(&engine, 1, options, 0, NULL, NULL); if (result != SL_RESULT_SUCCESS){ - ALLEGRO_ERROR("Could not open audio device: %s\n", + A5O_ERROR("Could not open audio device: %s\n", opensl_get_error_string(result)); return 1; } @@ -172,7 +172,7 @@ typedef struct OpenSLData{ /* Size of a single sample: depth * channels */ int frame_size; - ALLEGRO_THREAD * poll_thread; + A5O_THREAD * poll_thread; /* local buffers to keep opensl fed since it doesn't copy * data by default. @@ -180,7 +180,7 @@ typedef struct OpenSLData{ char * buffers[MAX_BUFFERS]; } OpenSLData; -static SLDataFormat_PCM setupFormat(ALLEGRO_VOICE * voice){ +static SLDataFormat_PCM setupFormat(A5O_VOICE * voice){ SLDataFormat_PCM format; format.formatType = SL_DATAFORMAT_PCM; @@ -188,29 +188,29 @@ static SLDataFormat_PCM setupFormat(ALLEGRO_VOICE * voice){ /* TODO: review the channelMasks */ switch (voice->chan_conf){ - case ALLEGRO_CHANNEL_CONF_1: { + case A5O_CHANNEL_CONF_1: { /* Not sure if center is right.. */ format.channelMask = SL_SPEAKER_FRONT_CENTER; break; } - case ALLEGRO_CHANNEL_CONF_2: { + case A5O_CHANNEL_CONF_2: { format.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT; break; } - case ALLEGRO_CHANNEL_CONF_3: { + case A5O_CHANNEL_CONF_3: { format.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT | SL_SPEAKER_FRONT_CENTER; break; } - case ALLEGRO_CHANNEL_CONF_4: { + case A5O_CHANNEL_CONF_4: { format.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_BACK_LEFT | SL_SPEAKER_FRONT_RIGHT | SL_SPEAKER_BACK_RIGHT; break; } - case ALLEGRO_CHANNEL_CONF_5_1: { + case A5O_CHANNEL_CONF_5_1: { format.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_BACK_LEFT | SL_SPEAKER_FRONT_RIGHT | @@ -219,7 +219,7 @@ static SLDataFormat_PCM setupFormat(ALLEGRO_VOICE * voice){ SL_SPEAKER_LOW_FREQUENCY; break; } - case ALLEGRO_CHANNEL_CONF_6_1: { + case A5O_CHANNEL_CONF_6_1: { format.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_BACK_LEFT | SL_SPEAKER_FRONT_RIGHT | @@ -231,7 +231,7 @@ static SLDataFormat_PCM setupFormat(ALLEGRO_VOICE * voice){ break; } - case ALLEGRO_CHANNEL_CONF_7_1: { + case A5O_CHANNEL_CONF_7_1: { format.channelMask = SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_BACK_LEFT | SL_SPEAKER_FRONT_RIGHT | @@ -244,7 +244,7 @@ static SLDataFormat_PCM setupFormat(ALLEGRO_VOICE * voice){ break; } default: { - ALLEGRO_ERROR("Cannot allocate voice with unknown channel configuration\n"); + A5O_ERROR("Cannot allocate voice with unknown channel configuration\n"); } } @@ -263,42 +263,42 @@ static SLDataFormat_PCM setupFormat(ALLEGRO_VOICE * voice){ case 96000: format.samplesPerSec = SL_SAMPLINGRATE_96; break; case 192000: format.samplesPerSec = SL_SAMPLINGRATE_192; break; default: { - ALLEGRO_ERROR("Unsupported frequency %d. Using 44100 instead.\n", voice->frequency); + A5O_ERROR("Unsupported frequency %d. Using 44100 instead.\n", voice->frequency); format.samplesPerSec = SL_SAMPLINGRATE_44_1; voice->frequency = 44100; } } switch (voice->depth) { - case ALLEGRO_AUDIO_DEPTH_UINT8: - case ALLEGRO_AUDIO_DEPTH_INT8: { + case A5O_AUDIO_DEPTH_UINT8: + case A5O_AUDIO_DEPTH_INT8: { format.bitsPerSample = 8; format.containerSize = 8; break; } - case ALLEGRO_AUDIO_DEPTH_UINT16: - case ALLEGRO_AUDIO_DEPTH_INT16: { + case A5O_AUDIO_DEPTH_UINT16: + case A5O_AUDIO_DEPTH_INT16: { format.bitsPerSample = 16; format.containerSize = 16; break; } - case ALLEGRO_AUDIO_DEPTH_UINT24: - case ALLEGRO_AUDIO_DEPTH_INT24: { + case A5O_AUDIO_DEPTH_UINT24: + case A5O_AUDIO_DEPTH_INT24: { format.bitsPerSample = 24; format.containerSize = 32; break; } - case ALLEGRO_AUDIO_DEPTH_FLOAT32: { + case A5O_AUDIO_DEPTH_FLOAT32: { format.bitsPerSample = 32; format.containerSize = 32; break; } default: { - ALLEGRO_WARN("Cannot allocate unknown voice depth\n"); + A5O_WARN("Cannot allocate unknown voice depth\n"); } } -#ifdef ALLEGRO_BIG_ENDIAN +#ifdef A5O_BIG_ENDIAN format.endianness = SL_BYTEORDER_BIGENDIAN; #else format.endianness = SL_BYTEORDER_LITTLEENDIAN; @@ -311,18 +311,18 @@ static SLDataFormat_PCM setupFormat(ALLEGRO_VOICE * voice){ /* switch (voice->depth){ - case ALLEGRO_AUDIO_DEPTH_UINT8: - case ALLEGRO_AUDIO_DEPTH_UINT16: - case ALLEGRO_AUDIO_DEPTH_UINT24: { + case A5O_AUDIO_DEPTH_UINT8: + case A5O_AUDIO_DEPTH_UINT16: + case A5O_AUDIO_DEPTH_UINT24: { format.representation = SL_PCM_REPRESENTATION_UNSIGNED_INT; } - case ALLEGRO_AUDIO_DEPTH_INT8: - case ALLEGRO_AUDIO_DEPTH_INT16: - case ALLEGRO_AUDIO_DEPTH_INT24: { + case A5O_AUDIO_DEPTH_INT8: + case A5O_AUDIO_DEPTH_INT16: + case A5O_AUDIO_DEPTH_INT24: { format.representation = SL_PCM_REPRESENTATION_SIGNED_INT; break; } - case ALLEGRO_AUDIO_DEPTH_FLOAT32: { + case A5O_AUDIO_DEPTH_FLOAT32: { format.representation = SL_PCM_REPRESENTATION_FLOAT; break; } @@ -344,21 +344,21 @@ static SLObjectItf createAudioPlayer(SLEngineItf engine, SLDataSource * source, result = (*engine)->CreateAudioPlayer(engine, &player, source, sink, 1, ids, required); if (result != SL_RESULT_SUCCESS){ - ALLEGRO_ERROR("Could not create audio player: %s\n", opensl_get_error_string(result)); + A5O_ERROR("Could not create audio player: %s\n", opensl_get_error_string(result)); return NULL; } result = (*player)->Realize(player, SL_BOOLEAN_FALSE); if (result != SL_RESULT_SUCCESS){ - ALLEGRO_ERROR("Could not realize audio player: %s\n", opensl_get_error_string(result)); + A5O_ERROR("Could not realize audio player: %s\n", opensl_get_error_string(result)); return NULL; } return player; } -static SLObjectItf makeStreamingPlayer(ALLEGRO_VOICE * voice, SLObjectItf mixer){ +static SLObjectItf makeStreamingPlayer(A5O_VOICE * voice, SLObjectItf mixer){ SLDataFormat_PCM format = setupFormat(voice); SLDataLocator_BufferQueue bufferQueue; SLDataSource audioSource; @@ -384,7 +384,7 @@ static SLObjectItf makeStreamingPlayer(ALLEGRO_VOICE * voice, SLObjectItf mixer) SLVolumeItf volume; result = (*extra->output)->GetInterface(extra->output, SL_IID_VOLUME, &volume); if (result != SL_RESULT_SUCCESS){ - ALLEGRO_ERROR("Could not get volume interface: %s\n", opensl_get_error_string(result)); + A5O_ERROR("Could not get volume interface: %s\n", opensl_get_error_string(result)); return 1; } */ @@ -409,15 +409,15 @@ static void enqueue(SLObjectItf player, const void * data, int bytes){ result = (*player)->GetInterface(player, SL_IID_BUFFERQUEUE, &queue); if (result != SL_RESULT_SUCCESS){ - ALLEGRO_ERROR("Could not get bufferqueue interface: %s\n", opensl_get_error_string(result)); + A5O_ERROR("Could not get bufferqueue interface: %s\n", opensl_get_error_string(result)); return; } - // ALLEGRO_DEBUG("Play voice data %p\n", data); + // A5O_DEBUG("Play voice data %p\n", data); result = (*queue)->Enqueue(queue, data, bytes); if (result != SL_RESULT_SUCCESS){ - ALLEGRO_ERROR("Could not enqueue data: %s\n", opensl_get_error_string(result)); + A5O_ERROR("Could not enqueue data: %s\n", opensl_get_error_string(result)); return; } @@ -429,20 +429,20 @@ static void enqueue(SLObjectItf player, const void * data, int bytes){ result = (*play)->SetPlayState(play, SL_PLAYSTATE_PLAYING); if (result != SL_RESULT_SUCCESS){ - ALLEGRO_ERROR("Could not set play state on OpenSL stream\n"); + A5O_ERROR("Could not set play state on OpenSL stream\n"); } /* SLBufferQueueState state; result = (*queue)->GetState(queue, &state); if (result == SL_RESULT_SUCCESS){ - ALLEGRO_DEBUG("Buffer queue state count %d index %d\n", state.count, state.playIndex); + A5O_DEBUG("Buffer queue state count %d index %d\n", state.count, state.playIndex); } */ } -static void * opensl_update(ALLEGRO_THREAD * self, void * data){ - ALLEGRO_VOICE *voice = data; +static void * opensl_update(A5O_THREAD * self, void * data){ + A5O_VOICE *voice = data; OpenSLData * opensl = voice->extra; int bufferIndex = 0; @@ -471,7 +471,7 @@ static void * opensl_update(ALLEGRO_THREAD * self, void * data){ al_rest(0.001); } } else { - ALLEGRO_ERROR("Unimplemented direct audio\n"); + A5O_ERROR("Unimplemented direct audio\n"); /* // direct buffer audio al_lock_mutex(pv->buffer_mutex); @@ -482,7 +482,7 @@ static void * opensl_update(ALLEGRO_THREAD * self, void * data){ len = pv->buffer_end - data; pv->buffer = voice->attached_stream->spl_data.buffer.ptr; voice->attached_stream->pos = 0; - if (voice->attached_stream->loop == ALLEGRO_PLAYMODE_ONCE) { + if (voice->attached_stream->loop == A5O_PLAYMODE_ONCE) { pv->status = PV_STOPPING; } } else { @@ -508,7 +508,7 @@ static void * opensl_update(ALLEGRO_THREAD * self, void * data){ return NULL; } -static int _opensl_allocate_voice(ALLEGRO_VOICE *voice) +static int _opensl_allocate_voice(A5O_VOICE *voice) { OpenSLData * data; int i; @@ -545,7 +545,7 @@ static int _opensl_allocate_voice(ALLEGRO_VOICE *voice) return 0; } -static void _opensl_deallocate_voice(ALLEGRO_VOICE *voice) +static void _opensl_deallocate_voice(A5O_VOICE *voice) { OpenSLData * data = (OpenSLData*) voice->extra; int i; @@ -576,13 +576,13 @@ static void _opensl_deallocate_voice(ALLEGRO_VOICE *voice) /* load_voice is only called by attach_sample_instance_to_voice which * isn't really used, so we leave it unimplemented for now. */ -static int _opensl_load_voice(ALLEGRO_VOICE *voice, const void *data) +static int _opensl_load_voice(A5O_VOICE *voice, const void *data) { (void) voice; (void) data; /* OpenSLData * extra = (OpenSLData*) voice->extra; - ALLEGRO_DEBUG("Load voice data %p\n", data); + A5O_DEBUG("Load voice data %p\n", data); extra->data = data; extra->position = 0; */ @@ -590,7 +590,7 @@ static int _opensl_load_voice(ALLEGRO_VOICE *voice, const void *data) return 1; } -static void _opensl_unload_voice(ALLEGRO_VOICE *voice) +static void _opensl_unload_voice(A5O_VOICE *voice) { (void) voice; /* @@ -610,14 +610,14 @@ static void updateQueue(SLBufferQueueItf queue, void * context){ } SLresult result; - ALLEGRO_DEBUG("Enqueue %d bytes\n", bytes); + A5O_DEBUG("Enqueue %d bytes\n", bytes); result = (*queue)->Enqueue(queue, (char*) data->data + data->position, bytes); data->position += bytes; } } */ -static int _opensl_start_voice(ALLEGRO_VOICE *voice) +static int _opensl_start_voice(A5O_VOICE *voice) { OpenSLData * extra = (OpenSLData*) voice->extra; @@ -626,22 +626,22 @@ static int _opensl_start_voice(ALLEGRO_VOICE *voice) /* result = (*extra->player)->GetInterface(extra->player, SL_IID_BUFFERQUEUE, &queue); if (result != SL_RESULT_SUCCESS){ - ALLEGRO_ERROR("Could not get bufferqueue interface: %s\n", opensl_get_error_string(result)); + A5O_ERROR("Could not get bufferqueue interface: %s\n", opensl_get_error_string(result)); return 1; } - ALLEGRO_DEBUG("Start playing voice data %p\n", extra->data); + A5O_DEBUG("Start playing voice data %p\n", extra->data); result = (*queue)->Enqueue(queue, (char*) extra->data + extra->position, extra->frame_size * 32); if (result != SL_RESULT_SUCCESS){ - ALLEGRO_ERROR("Could not enqueue data: %s\n", opensl_get_error_string(result)); + A5O_ERROR("Could not enqueue data: %s\n", opensl_get_error_string(result)); } extra->position += extra->frame_size * 32; result = (*queue)->RegisterCallback(queue, updateQueue, extra); if (result != SL_RESULT_SUCCESS){ - ALLEGRO_ERROR("Could not register callback: %s\n", opensl_get_error_string(result)); + A5O_ERROR("Could not register callback: %s\n", opensl_get_error_string(result)); } // result = (*volume)->SetVolumeLevel(volume, -300); @@ -650,19 +650,19 @@ static int _opensl_start_voice(ALLEGRO_VOICE *voice) result = (*play)->SetPlayState(play, SL_PLAYSTATE_PLAYING); if (result == SL_RESULT_SUCCESS){ - ALLEGRO_DEBUG("Started new OpenSL stream\n"); + A5O_DEBUG("Started new OpenSL stream\n"); } result = (*queue)->GetState(queue, &state); if (result == SL_RESULT_SUCCESS){ - ALLEGRO_DEBUG("Buffer queue state count %d index %d\n", state.count, state.playIndex); + A5O_DEBUG("Buffer queue state count %d index %d\n", state.count, state.playIndex); } */ return 0; } -static int _opensl_stop_voice(ALLEGRO_VOICE* voice) +static int _opensl_stop_voice(A5O_VOICE* voice) { OpenSLData * data = (OpenSLData*) voice->extra; if (data->status == PLAYING){ @@ -676,30 +676,30 @@ static int _opensl_stop_voice(ALLEGRO_VOICE* voice) return 0; } -static bool _opensl_voice_is_playing(const ALLEGRO_VOICE *voice) +static bool _opensl_voice_is_playing(const A5O_VOICE *voice) { OpenSLData * extra = (OpenSLData*) voice->extra; return extra->status == PLAYING; } -static unsigned int _opensl_get_voice_position(const ALLEGRO_VOICE *voice) +static unsigned int _opensl_get_voice_position(const A5O_VOICE *voice) { /* TODO */ (void) voice; - ALLEGRO_ERROR("Unimplemented: _opensl_get_voice_position\n"); + A5O_ERROR("Unimplemented: _opensl_get_voice_position\n"); return 0; } -static int _opensl_set_voice_position(ALLEGRO_VOICE *voice, unsigned int val) +static int _opensl_set_voice_position(A5O_VOICE *voice, unsigned int val) { /* TODO */ (void) voice; (void) val; - ALLEGRO_ERROR("Unimplemented: _opensl_set_voice_position\n"); + A5O_ERROR("Unimplemented: _opensl_set_voice_position\n"); return 1; } -ALLEGRO_AUDIO_DRIVER _al_kcm_opensl_driver = { +A5O_AUDIO_DRIVER _al_kcm_opensl_driver = { "OpenSL", _opensl_open, diff --git a/addons/audio/oss.c b/addons/audio/oss.c index dad698aa10..eaa9c53804 100644 --- a/addons/audio/oss.c +++ b/addons/audio/oss.c @@ -25,15 +25,15 @@ #include #include -ALLEGRO_DEBUG_CHANNEL("oss") +A5O_DEBUG_CHANNEL("oss") -#if defined ALLEGRO_HAVE_SOUNDCARD_H +#if defined A5O_HAVE_SOUNDCARD_H #include -#elif defined ALLEGRO_HAVE_SYS_SOUNDCARD_H +#elif defined A5O_HAVE_SYS_SOUNDCARD_H #include -#elif defined ALLEGRO_HAVE_LINUX_SOUNDCARD_H +#elif defined A5O_HAVE_LINUX_SOUNDCARD_H #include -#elif defined ALLEGRO_HAVE_MACHINE_SOUNDCARD_H +#elif defined A5O_HAVE_MACHINE_SOUNDCARD_H #include #endif @@ -44,14 +44,14 @@ ALLEGRO_DEBUG_CHANNEL("oss") #endif #ifndef AFMT_S16_NE - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN #define AFMT_S16_NE AFMT_S16_BE #else #define AFMT_S16_NE AFMT_S16_LE #endif #endif #ifndef AFMT_U16_NE - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN #define AFMT_U16_NE AFMT_U16_BE #else #define AFMT_U16_NE AFMT_U16_LE @@ -86,14 +86,14 @@ typedef struct OSS_VOICE { int fd; int volume; - /* Copied from the parent ALLEGRO_VOICE. Used for convenince. */ + /* Copied from the parent A5O_VOICE. Used for convenince. */ unsigned int len; /* in frames */ unsigned int frame_size; /* in bytes */ volatile bool stopped; volatile bool stop; - ALLEGRO_THREAD *poll_thread; + A5O_THREAD *poll_thread; } OSS_VOICE; @@ -107,17 +107,17 @@ static int oss_open_ver4() switch (errno) { case ENXIO: case ENODEV: - ALLEGRO_ERROR("Open Sound System is not running in your system.\n"); + A5O_ERROR("Open Sound System is not running in your system.\n"); break; case ENOENT: - ALLEGRO_ERROR("No /dev/mixer device available in your system.\n"); - ALLEGRO_ERROR("Perhaps Open Sound System is not installed or " + A5O_ERROR("No /dev/mixer device available in your system.\n"); + A5O_ERROR("Perhaps Open Sound System is not installed or " "running.\n"); break; default: - ALLEGRO_ERROR("errno: %i -- %s\n", errno, strerror(errno)); + A5O_ERROR("errno: %i -- %s\n", errno, strerror(errno)); } return 1; @@ -125,15 +125,15 @@ static int oss_open_ver4() if (ioctl(mixer_fd, SNDCTL_SYSINFO, &sysinfo) == -1) { if (errno == ENXIO) { - ALLEGRO_ERROR("OSS has not detected any supported sound hardware in " + A5O_ERROR("OSS has not detected any supported sound hardware in " "your system.\n"); } else if (errno == EINVAL) { - ALLEGRO_INFO("The version of OSS installed on the system is not " + A5O_INFO("The version of OSS installed on the system is not " "compatible with OSS4.\n"); } else - ALLEGRO_ERROR("errno: %i -- %s\n", errno, strerror(errno)); + A5O_ERROR("errno: %i -- %s\n", errno, strerror(errno)); close(mixer_fd); return 1; @@ -142,20 +142,20 @@ static int oss_open_ver4() /* Some OSS implementations (ALSA emulation) don't fail on SNDCTL_SYSINFO even * though they don't support OSS4. They *seem* to set numcards to 0. */ if (sysinfo.numcards < 1) { - ALLEGRO_WARN("The version of OSS installed on the system is not " + A5O_WARN("The version of OSS installed on the system is not " "compatible with OSS4.\n"); return 1; } - ALLEGRO_INFO("OSS Version: %s\n", sysinfo.version); - ALLEGRO_INFO("Found %i sound cards.\n", sysinfo.numcards); + A5O_INFO("OSS Version: %s\n", sysinfo.version); + A5O_INFO("Found %i sound cards.\n", sysinfo.numcards); for (i = 0; i < sysinfo.numcards; i++) { oss_audioinfo audioinfo; memset(&audioinfo, 0, sizeof(oss_audioinfo)); audioinfo.dev = i; - ALLEGRO_INFO("Trying sound card no. %i ...\n", audioinfo.dev); + A5O_INFO("Trying sound card no. %i ...\n", audioinfo.dev); ioctl(mixer_fd, SNDCTL_AUDIOINFO, &audioinfo); @@ -167,20 +167,20 @@ static int oss_open_ver4() sprintf(oss_audio_device, "/dev/dsp%i", audioinfo.legacy_device); } else { - ALLEGRO_ERROR("Cannot find device name.\n"); + A5O_ERROR("Cannot find device name.\n"); } - ALLEGRO_INFO("Using device: %s\n", oss_audio_device); + A5O_INFO("Using device: %s\n", oss_audio_device); break; } else { - ALLEGRO_INFO("Device disabled.\n"); + A5O_INFO("Device disabled.\n"); } } if (i == sysinfo.numcards) { - ALLEGRO_ERROR("Couldn't find a suitable device.\n"); + A5O_ERROR("Couldn't find a suitable device.\n"); close(mixer_fd); return 1; } @@ -206,19 +206,19 @@ static int oss_open_ver3(void) switch (errno) { case ENXIO: case ENODEV: - ALLEGRO_ERROR("Open Sound System is not running in your " + A5O_ERROR("Open Sound System is not running in your " "system.\n"); break; case ENOENT: - ALLEGRO_ERROR("No '%s' device available in your system.\n", + A5O_ERROR("No '%s' device available in your system.\n", oss_audio_device_ver3); - ALLEGRO_ERROR("Perhaps Open Sound System is not installed " + A5O_ERROR("Perhaps Open Sound System is not installed " "or running.\n"); break; default: - ALLEGRO_ERROR("errno: %i -- %s\n", errno, strerror(errno)); + A5O_ERROR("errno: %i -- %s\n", errno, strerror(errno)); } return 1; @@ -226,7 +226,7 @@ static int oss_open_ver3(void) close(fd); strncpy(oss_audio_device, oss_audio_device_ver3, 511); - ALLEGRO_INFO("Using device: %s\n", oss_audio_device); + A5O_INFO("Using device: %s\n", oss_audio_device); using_ver_4 = false; @@ -244,25 +244,25 @@ static int oss_open(void) force_oss3 = strcmp(force_oss3_cfg, "yes") ? false : true; if (force_oss3) { - ALLEGRO_WARN("Skipping OSS4 probe.\n"); + A5O_WARN("Skipping OSS4 probe.\n"); } #ifdef OSS_VER_4 bool inited = false; if (!force_oss3) { if (oss_open_ver4()) - ALLEGRO_WARN("OSS ver. 4 init failed, trying ver. 3...\n"); + A5O_WARN("OSS ver. 4 init failed, trying ver. 3...\n"); else inited = true; } if (!inited && oss_open_ver3()) { - ALLEGRO_ERROR("Failed to init OSS.\n"); + A5O_ERROR("Failed to init OSS.\n"); return 1; } #else - ALLEGRO_INFO("OSS4 support not compiled in. Skipping OSS4 probe.\n"); + A5O_INFO("OSS4 support not compiled in. Skipping OSS4 probe.\n"); if (oss_open_ver3()) { - ALLEGRO_ERROR("Failed to init OSS.\n"); + A5O_ERROR("Failed to init OSS.\n"); return 1; } #endif @@ -276,7 +276,7 @@ static void oss_close(void) } -static void oss_deallocate_voice(ALLEGRO_VOICE *voice) +static void oss_deallocate_voice(A5O_VOICE *voice) { OSS_VOICE *oss_voice = voice->extra; @@ -293,7 +293,7 @@ static void oss_deallocate_voice(ALLEGRO_VOICE *voice) } -static int oss_start_voice(ALLEGRO_VOICE *voice) +static int oss_start_voice(A5O_VOICE *voice) { OSS_VOICE *ex_data = voice->extra; ex_data->stop = false; @@ -301,7 +301,7 @@ static int oss_start_voice(ALLEGRO_VOICE *voice) } -static int oss_stop_voice(ALLEGRO_VOICE *voice) +static int oss_stop_voice(A5O_VOICE *voice) { OSS_VOICE *ex_data = voice->extra; @@ -317,7 +317,7 @@ static int oss_stop_voice(ALLEGRO_VOICE *voice) } -static int oss_load_voice(ALLEGRO_VOICE *voice, const void *data) +static int oss_load_voice(A5O_VOICE *voice, const void *data) { OSS_VOICE *ex_data = voice->extra; @@ -326,8 +326,8 @@ static int oss_load_voice(ALLEGRO_VOICE *voice, const void *data) * mmap(2) the FD and write reversed samples into that. To much trouble for * an optional feature IMO. -- milan */ - if (voice->attached_stream->loop == ALLEGRO_PLAYMODE_BIDIR) { - ALLEGRO_INFO("Backwards playing not supported by the driver.\n"); + if (voice->attached_stream->loop == A5O_PLAYMODE_BIDIR) { + A5O_INFO("Backwards playing not supported by the driver.\n"); return -1; } @@ -339,26 +339,26 @@ static int oss_load_voice(ALLEGRO_VOICE *voice, const void *data) } -static void oss_unload_voice(ALLEGRO_VOICE *voice) +static void oss_unload_voice(A5O_VOICE *voice) { (void)voice; } -static bool oss_voice_is_playing(const ALLEGRO_VOICE *voice) +static bool oss_voice_is_playing(const A5O_VOICE *voice) { OSS_VOICE *ex_data = voice->extra; return !ex_data->stopped; } -static unsigned int oss_get_voice_position(const ALLEGRO_VOICE *voice) +static unsigned int oss_get_voice_position(const A5O_VOICE *voice) { return voice->attached_stream->pos; } -static int oss_set_voice_position(ALLEGRO_VOICE *voice, unsigned int val) +static int oss_set_voice_position(A5O_VOICE *voice, unsigned int val) { voice->attached_stream->pos = val; return 0; @@ -374,7 +374,7 @@ static int oss_set_voice_position(ALLEGRO_VOICE *voice, unsigned int val) * Updates 'stop', 'pos' and 'reversed' fields of the supplied voice to the * future position. */ -static int oss_update_nonstream_voice(ALLEGRO_VOICE *voice, void **buf, int *bytes) +static int oss_update_nonstream_voice(A5O_VOICE *voice, void **buf, int *bytes) { OSS_VOICE *oss_voice = voice->extra; int bpos = voice->attached_stream->pos * oss_voice->frame_size; @@ -384,14 +384,14 @@ static int oss_update_nonstream_voice(ALLEGRO_VOICE *voice, void **buf, int *byt if (bpos + *bytes > blen) { *bytes = blen - bpos; - if (voice->attached_stream->loop == ALLEGRO_PLAYMODE_ONCE) { + if (voice->attached_stream->loop == A5O_PLAYMODE_ONCE) { oss_voice->stop = true; voice->attached_stream->pos = 0; } - if (voice->attached_stream->loop == ALLEGRO_PLAYMODE_LOOP) { + if (voice->attached_stream->loop == A5O_PLAYMODE_LOOP) { voice->attached_stream->pos = 0; } - /*else if (voice->attached_stream->loop == ALLEGRO_PLAYMODE_BIDIR) { + /*else if (voice->attached_stream->loop == A5O_PLAYMODE_BIDIR) { oss_voice->reversed = true; voice->attached_stream->pos = oss_voice->len; }*/ @@ -404,7 +404,7 @@ static int oss_update_nonstream_voice(ALLEGRO_VOICE *voice, void **buf, int *byt } -static void oss_update_silence(ALLEGRO_VOICE *voice, OSS_VOICE *oss_voice) +static void oss_update_silence(A5O_VOICE *voice, OSS_VOICE *oss_voice) { char sil_buf[SIL_BUF_SIZE]; unsigned int silent_samples; @@ -414,14 +414,14 @@ static void oss_update_silence(ALLEGRO_VOICE *voice, OSS_VOICE *oss_voice) al_get_channel_count(voice->chan_conf)); al_fill_silence(sil_buf, silent_samples, voice->depth, voice->chan_conf); if (write(oss_voice->fd, sil_buf, SIL_BUF_SIZE) == -1) { - ALLEGRO_ERROR("errno: %i -- %s\n", errno, strerror(errno)); + A5O_ERROR("errno: %i -- %s\n", errno, strerror(errno)); } } -static void* oss_update(ALLEGRO_THREAD *self, void *arg) +static void* oss_update(A5O_THREAD *self, void *arg) { - ALLEGRO_VOICE *voice = arg; + A5O_VOICE *voice = arg; OSS_VOICE *oss_voice = voice->extra; (void)self; @@ -432,7 +432,7 @@ static void* oss_update(ALLEGRO_THREAD *self, void *arg) audio_buf_info bi; if (ioctl(oss_voice->fd, SNDCTL_DSP_GETOSPACE, &bi) == -1) { - ALLEGRO_ERROR("Error SNDCTL_DSP_GETOSPACE, errno=%i (%s)\n", + A5O_ERROR("Error SNDCTL_DSP_GETOSPACE, errno=%i (%s)\n", errno, strerror(errno)); return NULL; } @@ -458,7 +458,7 @@ static void* oss_update(ALLEGRO_THREAD *self, void *arg) oss_update_nonstream_voice(voice, &buf, &bytes); frames = bytes / oss_voice->frame_size; if (write(oss_voice->fd, buf, bytes) == -1) { - ALLEGRO_ERROR("errno: %i -- %s\n", errno, strerror(errno)); + A5O_ERROR("errno: %i -- %s\n", errno, strerror(errno)); if (errno != EINTR) return NULL; } @@ -470,7 +470,7 @@ static void* oss_update(ALLEGRO_THREAD *self, void *arg) continue; } if (write(oss_voice->fd, data, frames * oss_voice->frame_size) == -1) { - ALLEGRO_ERROR("errno: %i -- %s\n", errno, strerror(errno)); + A5O_ERROR("errno: %i -- %s\n", errno, strerror(errno)); if (errno != EINTR) return NULL; } @@ -485,7 +485,7 @@ static void* oss_update(ALLEGRO_THREAD *self, void *arg) } -static int oss_allocate_voice(ALLEGRO_VOICE *voice) +static int oss_allocate_voice(A5O_VOICE *voice) { int format; int chan_count; @@ -496,9 +496,9 @@ static int oss_allocate_voice(ALLEGRO_VOICE *voice) ex_data->fd = open(oss_audio_device, O_WRONLY/*, O_NONBLOCK*/); if (ex_data->fd == -1) { - ALLEGRO_ERROR("Failed to open audio device '%s'.\n", + A5O_ERROR("Failed to open audio device '%s'.\n", oss_audio_device); - ALLEGRO_ERROR("errno: %i -- %s\n", errno, strerror(errno)); + A5O_ERROR("errno: %i -- %s\n", errno, strerror(errno)); al_free(ex_data); return 1; } @@ -512,22 +512,22 @@ static int oss_allocate_voice(ALLEGRO_VOICE *voice) ex_data->stop = true; ex_data->stopped = true; - if (voice->depth == ALLEGRO_AUDIO_DEPTH_INT8) + if (voice->depth == A5O_AUDIO_DEPTH_INT8) format = AFMT_S8; - else if (voice->depth == ALLEGRO_AUDIO_DEPTH_UINT8) + else if (voice->depth == A5O_AUDIO_DEPTH_UINT8) format = AFMT_U8; - else if (voice->depth == ALLEGRO_AUDIO_DEPTH_INT16) + else if (voice->depth == A5O_AUDIO_DEPTH_INT16) format = AFMT_S16_NE; - else if (voice->depth == ALLEGRO_AUDIO_DEPTH_UINT16) + else if (voice->depth == A5O_AUDIO_DEPTH_UINT16) format = AFMT_U16_NE; #ifdef OSS_VER_4 - else if (voice->depth == ALLEGRO_AUDIO_DEPTH_INT24) + else if (voice->depth == A5O_AUDIO_DEPTH_INT24) format = AFMT_S24_NE; - else if (voice->depth == ALLEGRO_AUDIO_DEPTH_FLOAT32) + else if (voice->depth == A5O_AUDIO_DEPTH_FLOAT32) format = AFMT_FLOAT; #endif else { - ALLEGRO_ERROR("Unsupported OSS sound format.\n"); + A5O_ERROR("Unsupported OSS sound format.\n"); goto Error; } @@ -540,49 +540,49 @@ static int oss_allocate_voice(ALLEGRO_VOICE *voice) #ifdef OSS_VER_4 int tmp_oss_timing_policy = oss_timing_policy; if (ioctl(ex_data->fd, SNDCTL_DSP_POLICY, &tmp_oss_timing_policy) == -1) { - ALLEGRO_ERROR("Failed to set_timig policity to '%i'.\n", + A5O_ERROR("Failed to set_timig policity to '%i'.\n", tmp_oss_timing_policy); - ALLEGRO_ERROR("errno: %i -- %s\n", errno, strerror(errno)); + A5O_ERROR("errno: %i -- %s\n", errno, strerror(errno)); goto Error; } - ALLEGRO_INFO("Accepted timing policy value: %i\n", tmp_oss_timing_policy); + A5O_INFO("Accepted timing policy value: %i\n", tmp_oss_timing_policy); #endif } else { if (ioctl(ex_data->fd, SNDCTL_DSP_SETFRAGMENT, &tmp_oss_fragsize) == -1) { - ALLEGRO_ERROR("Failed to set fragment size.\n"); - ALLEGRO_ERROR("errno: %i -- %s\n", errno, strerror(errno)); + A5O_ERROR("Failed to set fragment size.\n"); + A5O_ERROR("errno: %i -- %s\n", errno, strerror(errno)); goto Error; } } if (ioctl(ex_data->fd, SNDCTL_DSP_SETFMT, &tmp_format) == -1) { - ALLEGRO_ERROR("Failed to set sample format.\n"); - ALLEGRO_ERROR("errno: %i -- %s\n", errno, strerror(errno)); + A5O_ERROR("Failed to set sample format.\n"); + A5O_ERROR("errno: %i -- %s\n", errno, strerror(errno)); goto Error; } if (tmp_format != format) { - ALLEGRO_ERROR("Sample format not supported by the driver.\n"); + A5O_ERROR("Sample format not supported by the driver.\n"); goto Error; } if (ioctl(ex_data->fd, SNDCTL_DSP_CHANNELS, &tmp_chan_count)) { - ALLEGRO_ERROR("Failed to set channel count.\n"); - ALLEGRO_ERROR("errno: %i -- %s\n", errno, strerror(errno)); + A5O_ERROR("Failed to set channel count.\n"); + A5O_ERROR("errno: %i -- %s\n", errno, strerror(errno)); goto Error; } if (tmp_chan_count != chan_count) { - ALLEGRO_ERROR("Requested sample channe count %i, got %i.\n", + A5O_ERROR("Requested sample channe count %i, got %i.\n", tmp_chan_count, chan_count); } if (ioctl(ex_data->fd, SNDCTL_DSP_SPEED, &tmp_freq) == -1) { - ALLEGRO_ERROR("Failed to set sample rate.\n"); - ALLEGRO_ERROR("errno: %i -- %s\n", errno, strerror(errno)); + A5O_ERROR("Failed to set sample rate.\n"); + A5O_ERROR("errno: %i -- %s\n", errno, strerror(errno)); goto Error; } if (voice->frequency != tmp_freq) { - ALLEGRO_ERROR("Requested sample rate %u, got %iu.\n", voice->frequency, + A5O_ERROR("Requested sample rate %u, got %iu.\n", voice->frequency, tmp_freq); } @@ -599,7 +599,7 @@ static int oss_allocate_voice(ALLEGRO_VOICE *voice) } -ALLEGRO_AUDIO_DRIVER _al_kcm_oss_driver = +A5O_AUDIO_DRIVER _al_kcm_oss_driver = { "OSS", diff --git a/addons/audio/pulseaudio.c b/addons/audio/pulseaudio.c index 1b9b55de7f..0272a019b3 100644 --- a/addons/audio/pulseaudio.c +++ b/addons/audio/pulseaudio.c @@ -24,7 +24,7 @@ #include #include -ALLEGRO_DEBUG_CHANNEL("PulseAudio") +A5O_DEBUG_CHANNEL("PulseAudio") enum PULSEAUDIO_VOICE_STATUS { PV_IDLE, @@ -39,17 +39,17 @@ typedef struct PULSEAUDIO_VOICE unsigned int buffer_size_in_frames; unsigned int frame_size_in_bytes; - ALLEGRO_THREAD *poll_thread; + A5O_THREAD *poll_thread; /* status_cond and status are protected by voice->mutex. * Using another mutex introduces a deadlock if waiting for a change in * status (while holding voice->mutex, acquired by a higher layer) * and the background thread tries to acquire voice->mutex as well. */ - ALLEGRO_COND *status_cond; + A5O_COND *status_cond; enum PULSEAUDIO_VOICE_STATUS status; // direct buffer (non-streaming): - ALLEGRO_MUTEX *buffer_mutex; + A5O_MUTEX *buffer_mutex; char *buffer; char *buffer_end; } PULSEAUDIO_VOICE; @@ -59,7 +59,7 @@ static _AL_LIST* output_device_list; #define DEFAULT_BUFFER_SIZE 1024 #define MIN_BUFFER_SIZE 128 -static unsigned int get_buffer_size(const ALLEGRO_CONFIG *config) +static unsigned int get_buffer_size(const A5O_CONFIG *config) { if (config) { const char *val = al_get_config_value(config, @@ -79,7 +79,7 @@ static void _output_device_list_dtor(void* value, void* userdata) { (void)userdata; - ALLEGRO_AUDIO_DEVICE* device = (ALLEGRO_AUDIO_DEVICE*)value; + A5O_AUDIO_DEVICE* device = (A5O_AUDIO_DEVICE*)value; al_free(device->name); al_free(device->identifier); al_free(device); @@ -102,7 +102,7 @@ static void sink_info_cb(pa_context *c, const pa_sink_info *i, int eol, int iden_len = strlen(i->name) + 1; int name_len = strlen(i->description) + 1; - ALLEGRO_AUDIO_DEVICE* device = (ALLEGRO_AUDIO_DEVICE*)al_malloc(sizeof(ALLEGRO_AUDIO_DEVICE)); + A5O_AUDIO_DEVICE* device = (A5O_AUDIO_DEVICE*)al_malloc(sizeof(A5O_AUDIO_DEVICE)); device->identifier = (void*)al_malloc(iden_len); device->name = (char*)al_malloc(name_len); @@ -140,7 +140,7 @@ static int pulseaudio_open(void) /* Don't block or it will hang if there is no server to connect to. */ const int blocking = 0; if (pa_mainloop_iterate(mainloop, blocking, NULL) < 0) { - ALLEGRO_ERROR("pa_mainloop_iterate failed\n"); + A5O_ERROR("pa_mainloop_iterate failed\n"); pa_context_disconnect(c); pa_context_unref(c); pa_mainloop_free(mainloop); @@ -148,11 +148,11 @@ static int pulseaudio_open(void) } pa_context_state_t s = pa_context_get_state(c); if (s == PA_CONTEXT_READY) { - ALLEGRO_DEBUG("PA_CONTEXT_READY\n"); + A5O_DEBUG("PA_CONTEXT_READY\n"); break; } if (s == PA_CONTEXT_FAILED) { - ALLEGRO_ERROR("PA_CONTEXT_FAILED\n"); + A5O_ERROR("PA_CONTEXT_FAILED\n"); pa_context_disconnect(c); pa_context_unref(c); pa_mainloop_free(mainloop); @@ -184,9 +184,9 @@ static void pulseaudio_close(void) _al_list_destroy(output_device_list); } -static void *pulseaudio_update(ALLEGRO_THREAD *self, void *data) +static void *pulseaudio_update(A5O_THREAD *self, void *data) { - ALLEGRO_VOICE *voice = data; + A5O_VOICE *voice = data; PULSEAUDIO_VOICE *pv = voice->extra; (void)self; @@ -228,7 +228,7 @@ static void *pulseaudio_update(ALLEGRO_THREAD *self, void *data) len = pv->buffer_end - data; pv->buffer = voice->attached_stream->spl_data.buffer.ptr; voice->attached_stream->pos = 0; - if (voice->attached_stream->loop == ALLEGRO_PLAYMODE_ONCE) { + if (voice->attached_stream->loop == A5O_PLAYMODE_ONCE) { al_lock_mutex(voice->mutex); pv->status = PV_STOPPING; al_broadcast_cond(pv->status_cond); @@ -256,7 +256,7 @@ static void *pulseaudio_update(ALLEGRO_THREAD *self, void *data) return NULL; } -static int pulseaudio_allocate_voice(ALLEGRO_VOICE *voice) +static int pulseaudio_allocate_voice(A5O_VOICE *voice) { PULSEAUDIO_VOICE *pv = al_malloc(sizeof(PULSEAUDIO_VOICE)); pa_sample_spec ss; @@ -265,18 +265,18 @@ static int pulseaudio_allocate_voice(ALLEGRO_VOICE *voice) ss.channels = al_get_channel_count(voice->chan_conf); ss.rate = voice->frequency; - if (voice->depth == ALLEGRO_AUDIO_DEPTH_UINT8) + if (voice->depth == A5O_AUDIO_DEPTH_UINT8) ss.format = PA_SAMPLE_U8; - else if (voice->depth == ALLEGRO_AUDIO_DEPTH_INT16) + else if (voice->depth == A5O_AUDIO_DEPTH_INT16) ss.format = PA_SAMPLE_S16NE; #if PA_API_VERSION > 11 - else if (voice->depth == ALLEGRO_AUDIO_DEPTH_INT24) + else if (voice->depth == A5O_AUDIO_DEPTH_INT24) ss.format = PA_SAMPLE_S24NE; #endif - else if (voice->depth == ALLEGRO_AUDIO_DEPTH_FLOAT32) + else if (voice->depth == A5O_AUDIO_DEPTH_FLOAT32) ss.format = PA_SAMPLE_FLOAT32NE; else { - ALLEGRO_ERROR("Unsupported PulseAudio sound format.\n"); + A5O_ERROR("Unsupported PulseAudio sound format.\n"); al_free(pv); return 1; } @@ -322,7 +322,7 @@ static int pulseaudio_allocate_voice(ALLEGRO_VOICE *voice) return 0; } -static void pulseaudio_deallocate_voice(ALLEGRO_VOICE *voice) +static void pulseaudio_deallocate_voice(A5O_VOICE *voice) { PULSEAUDIO_VOICE *pv = voice->extra; @@ -344,13 +344,13 @@ static void pulseaudio_deallocate_voice(ALLEGRO_VOICE *voice) al_free(pv); } -static int pulseaudio_load_voice(ALLEGRO_VOICE *voice, const void *data) +static int pulseaudio_load_voice(A5O_VOICE *voice, const void *data) { PULSEAUDIO_VOICE *pv = voice->extra; (void)data; - if (voice->attached_stream->loop == ALLEGRO_PLAYMODE_BIDIR) { - ALLEGRO_INFO("Backwards playing not supported by the driver.\n"); + if (voice->attached_stream->loop == A5O_PLAYMODE_BIDIR) { + A5O_INFO("Backwards playing not supported by the driver.\n"); return 1; } @@ -363,12 +363,12 @@ static int pulseaudio_load_voice(ALLEGRO_VOICE *voice, const void *data) return 0; } -static void pulseaudio_unload_voice(ALLEGRO_VOICE *voice) +static void pulseaudio_unload_voice(A5O_VOICE *voice) { (void) voice; } -static int pulseaudio_start_voice(ALLEGRO_VOICE *voice) +static int pulseaudio_start_voice(A5O_VOICE *voice) { PULSEAUDIO_VOICE *pv = voice->extra; int ret; @@ -387,7 +387,7 @@ static int pulseaudio_start_voice(ALLEGRO_VOICE *voice) return ret; } -static int pulseaudio_stop_voice(ALLEGRO_VOICE *voice) +static int pulseaudio_stop_voice(A5O_VOICE *voice) { PULSEAUDIO_VOICE *pv = voice->extra; @@ -405,18 +405,18 @@ static int pulseaudio_stop_voice(ALLEGRO_VOICE *voice) return 0; } -static bool pulseaudio_voice_is_playing(const ALLEGRO_VOICE *voice) +static bool pulseaudio_voice_is_playing(const A5O_VOICE *voice) { PULSEAUDIO_VOICE *pv = voice->extra; return (pv->status == PV_PLAYING); } -static unsigned int pulseaudio_get_voice_position(const ALLEGRO_VOICE *voice) +static unsigned int pulseaudio_get_voice_position(const A5O_VOICE *voice) { return voice->attached_stream->pos; } -static int pulseaudio_set_voice_position(ALLEGRO_VOICE *voice, unsigned int pos) +static int pulseaudio_set_voice_position(A5O_VOICE *voice, unsigned int pos) { PULSEAUDIO_VOICE *pv = voice->extra; @@ -439,17 +439,17 @@ typedef struct PULSEAUDIO_RECORDER { pa_buffer_attr ba; } PULSEAUDIO_RECORDER; -static void *pulse_audio_update_recorder(ALLEGRO_THREAD *t, void *data) +static void *pulse_audio_update_recorder(A5O_THREAD *t, void *data) { - ALLEGRO_AUDIO_RECORDER *r = (ALLEGRO_AUDIO_RECORDER *) data; + A5O_AUDIO_RECORDER *r = (A5O_AUDIO_RECORDER *) data; PULSEAUDIO_RECORDER *pa = (PULSEAUDIO_RECORDER *) r->extra; - ALLEGRO_EVENT user_event; + A5O_EVENT user_event; uint8_t *null_buffer; unsigned int fragment_i = 0; null_buffer = al_malloc(1024); if (!null_buffer) { - ALLEGRO_ERROR("Unable to create buffer for draining PulseAudio.\n"); + A5O_ERROR("Unable to create buffer for draining PulseAudio.\n"); return NULL; } @@ -464,10 +464,10 @@ static void *pulse_audio_update_recorder(ALLEGRO_THREAD *t, void *data) pa_simple_read(pa->s, null_buffer, 1024, NULL); } else { - ALLEGRO_AUDIO_RECORDER_EVENT *e; + A5O_AUDIO_RECORDER_EVENT *e; al_unlock_mutex(r->mutex); if (pa_simple_read(pa->s, r->fragments[fragment_i], r->fragment_size, NULL) >= 0) { - user_event.user.type = ALLEGRO_EVENT_AUDIO_RECORDER_FRAGMENT; + user_event.user.type = A5O_EVENT_AUDIO_RECORDER_FRAGMENT; e = al_get_audio_recorder_event(&user_event); e->buffer = r->fragments[fragment_i]; e->samples = r->samples; @@ -484,31 +484,31 @@ static void *pulse_audio_update_recorder(ALLEGRO_THREAD *t, void *data) return NULL; }; -static int pulseaudio_allocate_recorder(ALLEGRO_AUDIO_RECORDER *r) +static int pulseaudio_allocate_recorder(A5O_AUDIO_RECORDER *r) { PULSEAUDIO_RECORDER *pa; pa = al_calloc(1, sizeof(*pa)); if (!pa) { - ALLEGRO_ERROR("Unable to allocate memory for PULSEAUDIO_RECORDER.\n"); + A5O_ERROR("Unable to allocate memory for PULSEAUDIO_RECORDER.\n"); return 1; } pa->ss.channels = al_get_channel_count(r->chan_conf); pa->ss.rate = r->frequency; - if (r->depth == ALLEGRO_AUDIO_DEPTH_UINT8) + if (r->depth == A5O_AUDIO_DEPTH_UINT8) pa->ss.format = PA_SAMPLE_U8; - else if (r->depth == ALLEGRO_AUDIO_DEPTH_INT16) + else if (r->depth == A5O_AUDIO_DEPTH_INT16) pa->ss.format = PA_SAMPLE_S16NE; #if PA_API_VERSION > 11 - else if (r->depth == ALLEGRO_AUDIO_DEPTH_INT24) + else if (r->depth == A5O_AUDIO_DEPTH_INT24) pa->ss.format = PA_SAMPLE_S24NE; #endif - else if (r->depth == ALLEGRO_AUDIO_DEPTH_FLOAT32) + else if (r->depth == A5O_AUDIO_DEPTH_FLOAT32) pa->ss.format = PA_SAMPLE_FLOAT32NE; else { - ALLEGRO_ERROR("Unsupported PulseAudio sound format (depth).\n"); + A5O_ERROR("Unsupported PulseAudio sound format (depth).\n"); al_free(pa); return 1; } @@ -527,7 +527,7 @@ static int pulseaudio_allocate_recorder(ALLEGRO_AUDIO_RECORDER *r) pa->s = pa_simple_new(NULL, al_get_app_name(), PA_STREAM_RECORD, NULL, "Allegro Audio Recorder", &pa->ss, NULL, &pa->ba, NULL); if (!pa->s) { - ALLEGRO_ERROR("pa_simple_new() failed.\n"); + A5O_ERROR("pa_simple_new() failed.\n"); al_free(pa); return 1; } @@ -538,7 +538,7 @@ static int pulseaudio_allocate_recorder(ALLEGRO_AUDIO_RECORDER *r) return 0; }; -static void pulseaudio_deallocate_recorder(ALLEGRO_AUDIO_RECORDER *r) +static void pulseaudio_deallocate_recorder(A5O_AUDIO_RECORDER *r) { PULSEAUDIO_RECORDER *pa = (PULSEAUDIO_RECORDER *) r->extra; @@ -551,7 +551,7 @@ static _AL_LIST* pulseaudio_get_output_devices(void) return output_device_list; } -ALLEGRO_AUDIO_DRIVER _al_kcm_pulseaudio_driver = +A5O_AUDIO_DRIVER _al_kcm_pulseaudio_driver = { "PulseAudio", diff --git a/addons/audio/recorder.c b/addons/audio/recorder.c index c5a2b191fb..5e055a0187 100644 --- a/addons/audio/recorder.c +++ b/addons/audio/recorder.c @@ -7,31 +7,31 @@ #include "allegro5/internal/aintern_audio_cfg.h" #include "allegro5/internal/aintern.h" -ALLEGRO_DEBUG_CHANNEL("audio") +A5O_DEBUG_CHANNEL("audio") -ALLEGRO_STATIC_ASSERT(recorder, - sizeof(ALLEGRO_AUDIO_RECORDER_EVENT) <= sizeof(ALLEGRO_EVENT)); +A5O_STATIC_ASSERT(recorder, + sizeof(A5O_AUDIO_RECORDER_EVENT) <= sizeof(A5O_EVENT)); /* Function: al_create_audio_recorder */ -ALLEGRO_AUDIO_RECORDER *al_create_audio_recorder(size_t fragment_count, +A5O_AUDIO_RECORDER *al_create_audio_recorder(size_t fragment_count, unsigned int samples, unsigned int frequency, - ALLEGRO_AUDIO_DEPTH depth, ALLEGRO_CHANNEL_CONF chan_conf) + A5O_AUDIO_DEPTH depth, A5O_CHANNEL_CONF chan_conf) { size_t i; - ALLEGRO_AUDIO_RECORDER *r; + A5O_AUDIO_RECORDER *r; ASSERT(_al_kcm_driver); if (!_al_kcm_driver->allocate_recorder) { - ALLEGRO_ERROR("Audio driver does not support recording.\n"); + A5O_ERROR("Audio driver does not support recording.\n"); return false; } r = al_calloc(1, sizeof(*r)); if (!r) { - ALLEGRO_ERROR("Unable to allocate memory for ALLEGRO_AUDIO_RECORDER\n"); + A5O_ERROR("Unable to allocate memory for A5O_AUDIO_RECORDER\n"); return false; } @@ -46,7 +46,7 @@ ALLEGRO_AUDIO_RECORDER *al_create_audio_recorder(size_t fragment_count, r->fragments = al_malloc(r->fragment_count * sizeof(uint8_t *)); if (!r->fragments) { al_free(r); - ALLEGRO_ERROR("Unable to allocate memory for ALLEGRO_AUDIO_RECORDER fragments\n"); + A5O_ERROR("Unable to allocate memory for A5O_AUDIO_RECORDER fragments\n"); return false; } @@ -60,13 +60,13 @@ ALLEGRO_AUDIO_RECORDER *al_create_audio_recorder(size_t fragment_count, } al_free(r->fragments); - ALLEGRO_ERROR("Unable to allocate memory for ALLEGRO_AUDIO_RECORDER fragments\n"); + A5O_ERROR("Unable to allocate memory for A5O_AUDIO_RECORDER fragments\n"); return false; } } if (_al_kcm_driver->allocate_recorder(r)) { - ALLEGRO_ERROR("Failed to allocate recorder from driver\n"); + A5O_ERROR("Failed to allocate recorder from driver\n"); return false; } @@ -86,9 +86,9 @@ ALLEGRO_AUDIO_RECORDER *al_create_audio_recorder(size_t fragment_count, /* Function: al_start_audio_recorder */ -bool al_start_audio_recorder(ALLEGRO_AUDIO_RECORDER *r) +bool al_start_audio_recorder(A5O_AUDIO_RECORDER *r) { - ALLEGRO_ASSERT(r); + A5O_ASSERT(r); al_lock_mutex(r->mutex); r->is_recording = true; @@ -100,7 +100,7 @@ bool al_start_audio_recorder(ALLEGRO_AUDIO_RECORDER *r) /* Function: al_stop_audio_recorder */ -void al_stop_audio_recorder(ALLEGRO_AUDIO_RECORDER *r) +void al_stop_audio_recorder(A5O_AUDIO_RECORDER *r) { al_lock_mutex(r->mutex); if (r->is_recording) { @@ -112,7 +112,7 @@ void al_stop_audio_recorder(ALLEGRO_AUDIO_RECORDER *r) /* Function: al_is_audio_recorder_recording */ -bool al_is_audio_recorder_recording(ALLEGRO_AUDIO_RECORDER *r) +bool al_is_audio_recorder_recording(A5O_AUDIO_RECORDER *r) { bool is_recording; @@ -125,22 +125,22 @@ bool al_is_audio_recorder_recording(ALLEGRO_AUDIO_RECORDER *r) /* Function: al_get_audio_recorder_event */ -ALLEGRO_AUDIO_RECORDER_EVENT *al_get_audio_recorder_event(ALLEGRO_EVENT *event) +A5O_AUDIO_RECORDER_EVENT *al_get_audio_recorder_event(A5O_EVENT *event) { - ASSERT(event->any.type == ALLEGRO_EVENT_AUDIO_RECORDER_FRAGMENT); - return (ALLEGRO_AUDIO_RECORDER_EVENT *) event; + ASSERT(event->any.type == A5O_EVENT_AUDIO_RECORDER_FRAGMENT); + return (A5O_AUDIO_RECORDER_EVENT *) event; } /* Function: al_get_audio_recorder_event_source */ -ALLEGRO_EVENT_SOURCE *al_get_audio_recorder_event_source(ALLEGRO_AUDIO_RECORDER *r) +A5O_EVENT_SOURCE *al_get_audio_recorder_event_source(A5O_AUDIO_RECORDER *r) { return &r->source; } /* Function: al_destroy_audio_recorder */ -void al_destroy_audio_recorder(ALLEGRO_AUDIO_RECORDER *r) +void al_destroy_audio_recorder(A5O_AUDIO_RECORDER *r) { size_t i; diff --git a/addons/audio/sdl_audio.c b/addons/audio/sdl_audio.c index 777324259c..1ada4964bf 100644 --- a/addons/audio/sdl_audio.c +++ b/addons/audio/sdl_audio.c @@ -1,16 +1,16 @@ -#define ALLEGRO_INTERNAL_UNSTABLE +#define A5O_INTERNAL_UNSTABLE #include "allegro5/allegro.h" #include "allegro5/internal/aintern_audio.h" #include "allegro5/platform/allegro_internal_sdl.h" -ALLEGRO_DEBUG_CHANNEL("SDL") +A5O_DEBUG_CHANNEL("SDL") typedef struct SDL_VOICE { SDL_AudioDeviceID device; SDL_AudioSpec spec; - ALLEGRO_VOICE *voice; + A5O_VOICE *voice; bool is_playing; } SDL_VOICE; @@ -29,8 +29,8 @@ static void audio_callback(void *userdata, Uint8 *stream, int len) // can't figure out what their purpose is and how would I play them... SDL_VOICE *sv = userdata; - ALLEGRO_SAMPLE_INSTANCE *instance = sv->voice->attached_stream; - ALLEGRO_SAMPLE *sample = &instance->spl_data; + A5O_SAMPLE_INSTANCE *instance = sv->voice->attached_stream; + A5O_SAMPLE *sample = &instance->spl_data; unsigned int frames = sv->spec.samples; const void *data = _al_voice_update(sv->voice, sv->voice->mutex, &frames); @@ -49,25 +49,25 @@ static void sdl_close(void) { } -static SDL_AudioFormat allegro_format_to_sdl(ALLEGRO_AUDIO_DEPTH d) +static SDL_AudioFormat allegro_format_to_sdl(A5O_AUDIO_DEPTH d) { - if (d == ALLEGRO_AUDIO_DEPTH_INT8) return AUDIO_S8; - if (d == ALLEGRO_AUDIO_DEPTH_UINT8) return AUDIO_U8; - if (d == ALLEGRO_AUDIO_DEPTH_INT16) return AUDIO_S16; - if (d == ALLEGRO_AUDIO_DEPTH_UINT16) return AUDIO_U16; + if (d == A5O_AUDIO_DEPTH_INT8) return AUDIO_S8; + if (d == A5O_AUDIO_DEPTH_UINT8) return AUDIO_U8; + if (d == A5O_AUDIO_DEPTH_INT16) return AUDIO_S16; + if (d == A5O_AUDIO_DEPTH_UINT16) return AUDIO_U16; return AUDIO_F32; } -static ALLEGRO_AUDIO_DEPTH sdl_format_to_allegro(SDL_AudioFormat d) +static A5O_AUDIO_DEPTH sdl_format_to_allegro(SDL_AudioFormat d) { - if (d == AUDIO_S8) return ALLEGRO_AUDIO_DEPTH_INT8; - if (d == AUDIO_U8) return ALLEGRO_AUDIO_DEPTH_UINT8; - if (d == AUDIO_S16) return ALLEGRO_AUDIO_DEPTH_INT16; - if (d == AUDIO_U16) return ALLEGRO_AUDIO_DEPTH_UINT16; - return ALLEGRO_AUDIO_DEPTH_FLOAT32; + if (d == AUDIO_S8) return A5O_AUDIO_DEPTH_INT8; + if (d == AUDIO_U8) return A5O_AUDIO_DEPTH_UINT8; + if (d == AUDIO_S16) return A5O_AUDIO_DEPTH_INT16; + if (d == AUDIO_U16) return A5O_AUDIO_DEPTH_UINT16; + return A5O_AUDIO_DEPTH_FLOAT32; } -static int sdl_allocate_voice(ALLEGRO_VOICE *voice) +static int sdl_allocate_voice(A5O_VOICE *voice) { SDL_VOICE *sv = al_malloc(sizeof *sv); SDL_AudioSpec want; @@ -92,7 +92,7 @@ static int sdl_allocate_voice(ALLEGRO_VOICE *voice) return 0; } -static void sdl_deallocate_voice(ALLEGRO_VOICE *voice) +static void sdl_deallocate_voice(A5O_VOICE *voice) { SDL_VOICE *sv = voice->extra; _al_list_destroy(output_device_list); @@ -100,19 +100,19 @@ static void sdl_deallocate_voice(ALLEGRO_VOICE *voice) al_free(sv); } -static int sdl_load_voice(ALLEGRO_VOICE *voice, const void *data) +static int sdl_load_voice(A5O_VOICE *voice, const void *data) { (void)data; voice->attached_stream->pos = 0; return 0; } -static void sdl_unload_voice(ALLEGRO_VOICE *voice) +static void sdl_unload_voice(A5O_VOICE *voice) { (void) voice; } -static int sdl_start_voice(ALLEGRO_VOICE *voice) +static int sdl_start_voice(A5O_VOICE *voice) { SDL_VOICE *sv = voice->extra; sv->is_playing = true; @@ -120,7 +120,7 @@ static int sdl_start_voice(ALLEGRO_VOICE *voice) return 0; } -static int sdl_stop_voice(ALLEGRO_VOICE *voice) +static int sdl_stop_voice(A5O_VOICE *voice) { SDL_VOICE *sv = voice->extra; sv->is_playing = false; @@ -128,18 +128,18 @@ static int sdl_stop_voice(ALLEGRO_VOICE *voice) return 0; } -static bool sdl_voice_is_playing(const ALLEGRO_VOICE *voice) +static bool sdl_voice_is_playing(const A5O_VOICE *voice) { SDL_VOICE *sv = voice->extra; return sv->is_playing; } -static unsigned int sdl_get_voice_position(const ALLEGRO_VOICE *voice) +static unsigned int sdl_get_voice_position(const A5O_VOICE *voice) { return voice->attached_stream->pos; } -static int sdl_set_voice_position(ALLEGRO_VOICE *voice, unsigned int pos) +static int sdl_set_voice_position(A5O_VOICE *voice, unsigned int pos) { voice->attached_stream->pos = pos; return 0; @@ -147,7 +147,7 @@ static int sdl_set_voice_position(ALLEGRO_VOICE *voice, unsigned int pos) static void recorder_callback(void *userdata, Uint8 *stream, int len) { - ALLEGRO_AUDIO_RECORDER *r = (ALLEGRO_AUDIO_RECORDER *) userdata; + A5O_AUDIO_RECORDER *r = (A5O_AUDIO_RECORDER *) userdata; SDL_RECORDER *sdl = (SDL_RECORDER *) r->extra; al_lock_mutex(r->mutex); @@ -160,9 +160,9 @@ static void recorder_callback(void *userdata, Uint8 *stream, int len) int count = SDL_min(len, r->samples * r->sample_size); memcpy(r->fragments[sdl->fragment], stream, count); - ALLEGRO_EVENT user_event; - ALLEGRO_AUDIO_RECORDER_EVENT *e; - user_event.user.type = ALLEGRO_EVENT_AUDIO_RECORDER_FRAGMENT; + A5O_EVENT user_event; + A5O_AUDIO_RECORDER_EVENT *e; + user_event.user.type = A5O_EVENT_AUDIO_RECORDER_FRAGMENT; e = al_get_audio_recorder_event(&user_event); e->buffer = r->fragments[sdl->fragment]; e->samples = count / r->sample_size; @@ -178,13 +178,13 @@ static void recorder_callback(void *userdata, Uint8 *stream, int len) al_unlock_mutex(r->mutex); } -static int sdl_allocate_recorder(ALLEGRO_AUDIO_RECORDER *r) +static int sdl_allocate_recorder(A5O_AUDIO_RECORDER *r) { SDL_RECORDER *sdl; sdl = al_calloc(1, sizeof(*sdl)); if (!sdl) { - ALLEGRO_ERROR("Unable to allocate memory for SDL_RECORDER.\n"); + A5O_ERROR("Unable to allocate memory for SDL_RECORDER.\n"); return 1; } @@ -207,7 +207,7 @@ static int sdl_allocate_recorder(ALLEGRO_AUDIO_RECORDER *r) return 0; } -static void sdl_deallocate_recorder(ALLEGRO_AUDIO_RECORDER *r) +static void sdl_deallocate_recorder(A5O_AUDIO_RECORDER *r) { SDL_RECORDER *sdl = (SDL_RECORDER *) r->extra; SDL_CloseAudioDevice(sdl->device); @@ -218,7 +218,7 @@ static void _output_device_list_dtor(void* value, void* userdata) { (void)userdata; - ALLEGRO_AUDIO_DEVICE* device = (ALLEGRO_AUDIO_DEVICE*)value; + A5O_AUDIO_DEVICE* device = (A5O_AUDIO_DEVICE*)value; al_free(device->name); al_free(device); } @@ -232,7 +232,7 @@ static _AL_LIST* sdl_get_output_devices(void) for (i = 0; i < count; ++i) { int len = strlen(SDL_GetAudioDeviceName(i, 0)) + 1; - ALLEGRO_AUDIO_DEVICE* device = (ALLEGRO_AUDIO_DEVICE*)al_malloc(sizeof(ALLEGRO_AUDIO_DEVICE)); + A5O_AUDIO_DEVICE* device = (A5O_AUDIO_DEVICE*)al_malloc(sizeof(A5O_AUDIO_DEVICE)); device->name = (char*)al_malloc(len); device->identifier = device->name; // Name returned by SDL2 is used to identify devices. strcpy(device->name, SDL_GetAudioDeviceName(i, 0)); @@ -244,7 +244,7 @@ static _AL_LIST* sdl_get_output_devices(void) return output_device_list; } -ALLEGRO_AUDIO_DRIVER _al_kcm_sdl_driver = +A5O_AUDIO_DRIVER _al_kcm_sdl_driver = { "SDL", diff --git a/addons/color/CMakeLists.txt b/addons/color/CMakeLists.txt index 4aa2ec7816..598398a50f 100644 --- a/addons/color/CMakeLists.txt +++ b/addons/color/CMakeLists.txt @@ -7,10 +7,10 @@ set(COLOR_INCLUDE_FILES set_our_header_properties(${COLOR_INCLUDE_FILES}) add_our_addon_library(allegro_color - AllegroColor-${ALLEGRO_SOVERSION} + AllegroColor-${A5O_SOVERSION} "${COLOR_SOURCES};${COLOR_INCLUDE_FILES}" - "-DALLEGRO_COLOR_SRC" - "${ALLEGRO_LINK_WITH}" + "-DA5O_COLOR_SRC" + "${A5O_LINK_WITH}" ) install_our_headers(${COLOR_INCLUDE_FILES}) diff --git a/addons/color/allegro5/allegro_color.h b/addons/color/allegro5/allegro_color.h index 3dc430ff6d..21bdf54ef4 100644 --- a/addons/color/allegro5/allegro_color.h +++ b/addons/color/allegro5/allegro_color.h @@ -3,95 +3,95 @@ #include "allegro5/allegro.h" -#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32) - #ifndef ALLEGRO_STATICLINK - #ifdef ALLEGRO_COLOR_SRC - #define _ALLEGRO_COLOR_DLL __declspec(dllexport) +#if (defined A5O_MINGW32) || (defined A5O_MSVC) || (defined A5O_BCC32) + #ifndef A5O_STATICLINK + #ifdef A5O_COLOR_SRC + #define _A5O_COLOR_DLL __declspec(dllexport) #else - #define _ALLEGRO_COLOR_DLL __declspec(dllimport) + #define _A5O_COLOR_DLL __declspec(dllimport) #endif #else - #define _ALLEGRO_COLOR_DLL + #define _A5O_COLOR_DLL #endif #endif -#if defined ALLEGRO_MSVC - #define ALLEGRO_COLOR_FUNC(type, name, args) _ALLEGRO_COLOR_DLL type __cdecl name args -#elif defined ALLEGRO_MINGW32 - #define ALLEGRO_COLOR_FUNC(type, name, args) extern type name args -#elif defined ALLEGRO_BCC32 - #define ALLEGRO_COLOR_FUNC(type, name, args) extern _ALLEGRO_COLOR_DLL type name args +#if defined A5O_MSVC + #define A5O_COLOR_FUNC(type, name, args) _A5O_COLOR_DLL type __cdecl name args +#elif defined A5O_MINGW32 + #define A5O_COLOR_FUNC(type, name, args) extern type name args +#elif defined A5O_BCC32 + #define A5O_COLOR_FUNC(type, name, args) extern _A5O_COLOR_DLL type name args #else - #define ALLEGRO_COLOR_FUNC AL_FUNC + #define A5O_COLOR_FUNC AL_FUNC #endif #ifdef __cplusplus extern "C" { #endif -ALLEGRO_COLOR_FUNC(uint32_t, al_get_allegro_color_version, (void)); +A5O_COLOR_FUNC(uint32_t, al_get_allegro_color_version, (void)); -ALLEGRO_COLOR_FUNC(void, al_color_hsv_to_rgb, (float hue, float saturation, +A5O_COLOR_FUNC(void, al_color_hsv_to_rgb, (float hue, float saturation, float value, float *red, float *green, float *blue)); -ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_hsl, (float red, float green, float blue, +A5O_COLOR_FUNC(void, al_color_rgb_to_hsl, (float red, float green, float blue, float *hue, float *saturation, float *lightness)); -ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_hsv, (float red, float green, float blue, +A5O_COLOR_FUNC(void, al_color_rgb_to_hsv, (float red, float green, float blue, float *hue, float *saturation, float *value)); -ALLEGRO_COLOR_FUNC(void, al_color_hsl_to_rgb, (float hue, float saturation, float lightness, +A5O_COLOR_FUNC(void, al_color_hsl_to_rgb, (float hue, float saturation, float lightness, float *red, float *green, float *blue)); -ALLEGRO_COLOR_FUNC(bool, al_color_name_to_rgb, (char const *name, float *r, float *g, +A5O_COLOR_FUNC(bool, al_color_name_to_rgb, (char const *name, float *r, float *g, float *b)); -ALLEGRO_COLOR_FUNC(const char*, al_color_rgb_to_name, (float r, float g, float b)); -ALLEGRO_COLOR_FUNC(void, al_color_cmyk_to_rgb, (float cyan, float magenta, float yellow, +A5O_COLOR_FUNC(const char*, al_color_rgb_to_name, (float r, float g, float b)); +A5O_COLOR_FUNC(void, al_color_cmyk_to_rgb, (float cyan, float magenta, float yellow, float key, float *red, float *green, float *blue)); -ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_cmyk, (float red, float green, float blue, +A5O_COLOR_FUNC(void, al_color_rgb_to_cmyk, (float red, float green, float blue, float *cyan, float *magenta, float *yellow, float *key)); -ALLEGRO_COLOR_FUNC(void, al_color_yuv_to_rgb, (float y, float u, float v, +A5O_COLOR_FUNC(void, al_color_yuv_to_rgb, (float y, float u, float v, float *red, float *green, float *blue)); -ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_yuv, (float red, float green, float blue, +A5O_COLOR_FUNC(void, al_color_rgb_to_yuv, (float red, float green, float blue, float *y, float *u, float *v)); -ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_html, (float red, float green, float blue, +A5O_COLOR_FUNC(void, al_color_rgb_to_html, (float red, float green, float blue, char *string)); -ALLEGRO_COLOR_FUNC(bool, al_color_html_to_rgb, (char const *string, +A5O_COLOR_FUNC(bool, al_color_html_to_rgb, (char const *string, float *red, float *green, float *blue)); -ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_yuv, (float y, float u, float v)); -ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_cmyk, (float c, float m, float y, float k)); -ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_hsl, (float h, float s, float l)); -ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_hsv, (float h, float s, float v)); -ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_name, (char const *name)); -ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_html, (char const *string)); -ALLEGRO_COLOR_FUNC(void, al_color_xyz_to_rgb, (float x, float y, float z, +A5O_COLOR_FUNC(A5O_COLOR, al_color_yuv, (float y, float u, float v)); +A5O_COLOR_FUNC(A5O_COLOR, al_color_cmyk, (float c, float m, float y, float k)); +A5O_COLOR_FUNC(A5O_COLOR, al_color_hsl, (float h, float s, float l)); +A5O_COLOR_FUNC(A5O_COLOR, al_color_hsv, (float h, float s, float v)); +A5O_COLOR_FUNC(A5O_COLOR, al_color_name, (char const *name)); +A5O_COLOR_FUNC(A5O_COLOR, al_color_html, (char const *string)); +A5O_COLOR_FUNC(void, al_color_xyz_to_rgb, (float x, float y, float z, float *red, float *green, float *blue)); -ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_xyz, (float red, float green, float blue, +A5O_COLOR_FUNC(void, al_color_rgb_to_xyz, (float red, float green, float blue, float *x, float *y, float *z)); -ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_xyz, (float x, float y, float z)); -ALLEGRO_COLOR_FUNC(void, al_color_lab_to_rgb, (float l, float a, float b, +A5O_COLOR_FUNC(A5O_COLOR, al_color_xyz, (float x, float y, float z)); +A5O_COLOR_FUNC(void, al_color_lab_to_rgb, (float l, float a, float b, float *red, float *green, float *blue)); -ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_lab, (float red, float green, float blue, +A5O_COLOR_FUNC(void, al_color_rgb_to_lab, (float red, float green, float blue, float *l, float *a, float *b)); -ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_lab, (float l, float a, float b)); -ALLEGRO_COLOR_FUNC(void, al_color_xyy_to_rgb, (float x, float y, float y2, +A5O_COLOR_FUNC(A5O_COLOR, al_color_lab, (float l, float a, float b)); +A5O_COLOR_FUNC(void, al_color_xyy_to_rgb, (float x, float y, float y2, float *red, float *green, float *blue)); -ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_xyy, (float red, float green, float blue, +A5O_COLOR_FUNC(void, al_color_rgb_to_xyy, (float red, float green, float blue, float *x, float *y, float *y2)); -ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_xyy, (float x, float y, float y2)); -ALLEGRO_COLOR_FUNC(double, al_color_distance_ciede2000, (ALLEGRO_COLOR c1, ALLEGRO_COLOR c2)); -ALLEGRO_COLOR_FUNC(void, al_color_lch_to_rgb, (float l, float c, float h, +A5O_COLOR_FUNC(A5O_COLOR, al_color_xyy, (float x, float y, float y2)); +A5O_COLOR_FUNC(double, al_color_distance_ciede2000, (A5O_COLOR c1, A5O_COLOR c2)); +A5O_COLOR_FUNC(void, al_color_lch_to_rgb, (float l, float c, float h, float *red, float *green, float *blue)); -ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_lch, (float red, float green, float blue, +A5O_COLOR_FUNC(void, al_color_rgb_to_lch, (float red, float green, float blue, float *l, float *c, float *h)); -ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_lch, (float l, float c, float h)); -ALLEGRO_COLOR_FUNC(bool, al_is_color_valid, (ALLEGRO_COLOR color)); -ALLEGRO_COLOR_FUNC(void, al_color_oklab_to_rgb, (float l, float a, float b, +A5O_COLOR_FUNC(A5O_COLOR, al_color_lch, (float l, float c, float h)); +A5O_COLOR_FUNC(bool, al_is_color_valid, (A5O_COLOR color)); +A5O_COLOR_FUNC(void, al_color_oklab_to_rgb, (float l, float a, float b, float *red, float *green, float *blue)); -ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_oklab, (float red, float green, float blue, +A5O_COLOR_FUNC(void, al_color_rgb_to_oklab, (float red, float green, float blue, float *l, float *a, float *b)); -ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_oklab, (float l, float a, float b)); -ALLEGRO_COLOR_FUNC(void, al_color_linear_to_rgb, (float x, float y, float z, +A5O_COLOR_FUNC(A5O_COLOR, al_color_oklab, (float l, float a, float b)); +A5O_COLOR_FUNC(void, al_color_linear_to_rgb, (float x, float y, float z, float *red, float *green, float *blue)); -ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_linear, (float red, float green, float blue, +A5O_COLOR_FUNC(void, al_color_rgb_to_linear, (float red, float green, float blue, float *x, float *y, float *z)); -ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_linear, (float r, float g, float b)); +A5O_COLOR_FUNC(A5O_COLOR, al_color_linear, (float r, float g, float b)); #ifdef __cplusplus } diff --git a/addons/color/color.c b/addons/color/color.c index fd30c65364..3a5c70a93a 100644 --- a/addons/color/color.c +++ b/addons/color/color.c @@ -251,7 +251,7 @@ char const *al_color_rgb_to_name(float r, float g, float b) /* Function: al_color_name */ -ALLEGRO_COLOR al_color_name(char const *name) +A5O_COLOR al_color_name(char const *name) { float r, g, b; if (al_color_name_to_rgb(name, &r, &g, &b)) @@ -336,7 +336,7 @@ void al_color_rgb_to_hsv(float red, float green, float blue, /* Function: al_color_hsv */ -ALLEGRO_COLOR al_color_hsv(float h, float s, float v) +A5O_COLOR al_color_hsv(float h, float s, float v) { float r, g, b; @@ -433,7 +433,7 @@ void al_color_rgb_to_hsl(float red, float green, float blue, /* Function: al_color_hsl */ -ALLEGRO_COLOR al_color_hsl(float h, float s, float l) +A5O_COLOR al_color_hsl(float h, float s, float l) { float r, g, b; al_color_hsl_to_rgb(h, s, l, &r, &g, &b); @@ -477,7 +477,7 @@ void al_color_rgb_to_cmyk(float red, float green, float blue, /* Function: al_color_cmyk */ -ALLEGRO_COLOR al_color_cmyk(float c, float m, float y, float k) +A5O_COLOR al_color_cmyk(float c, float m, float y, float k) { float r, g, b; al_color_cmyk_to_rgb(c, m, y, k, &r, &g, &b); @@ -493,9 +493,9 @@ void al_color_yuv_to_rgb(float y, float u, float v, /* Translate range 0..1 to actual range. */ u = 0.436 * (u * 2 - 1); v = 0.615 * (v * 2 - 1); - *red = _ALLEGRO_CLAMP(0, 1, y + v * 1.13983); - *green = _ALLEGRO_CLAMP(0, 1, y + u * -0.39465 + v * -0.58060); - *blue = _ALLEGRO_CLAMP(0, 1, y + u * 2.03211); + *red = _A5O_CLAMP(0, 1, y + v * 1.13983); + *green = _A5O_CLAMP(0, 1, y + u * -0.39465 + v * -0.58060); + *blue = _A5O_CLAMP(0, 1, y + u * 2.03211); } @@ -515,7 +515,7 @@ void al_color_rgb_to_yuv(float red, float green, float blue, /* Function: al_color_yuv */ -ALLEGRO_COLOR al_color_yuv(float y, float u, float v) +A5O_COLOR al_color_yuv(float y, float u, float v) { float r, g, b; al_color_yuv_to_rgb(y, u, v, &r, &g, &b); @@ -565,7 +565,7 @@ bool al_color_html_to_rgb(char const *string, /* Function: al_color_html */ -ALLEGRO_COLOR al_color_html(char const *string) +A5O_COLOR al_color_html(char const *string) { float r, g, b; @@ -580,7 +580,7 @@ ALLEGRO_COLOR al_color_html(char const *string) */ uint32_t al_get_allegro_color_version(void) { - return ALLEGRO_VERSION_INT; + return A5O_VERSION_INT; } @@ -626,7 +626,7 @@ void al_color_rgb_to_linear(float red, float green, float blue, /* Function: al_color_linear */ -ALLEGRO_COLOR al_color_linear(float r, float g, float b) +A5O_COLOR al_color_linear(float r, float g, float b) { float r2, g2, b2; al_color_linear_to_rgb(r, g, b, &r2, &g2, &b2); @@ -664,7 +664,7 @@ void al_color_rgb_to_xyz(float red, float green, float blue, /* Function: al_color_xyz */ -ALLEGRO_COLOR al_color_xyz(float x, float y, float z) +A5O_COLOR al_color_xyz(float x, float y, float z) { float r, g, b; al_color_xyz_to_rgb(x, y, z, &r, &g, &b); @@ -714,7 +714,7 @@ void al_color_rgb_to_lab(float red, float green, float blue, /* Function: al_color_lab */ -ALLEGRO_COLOR al_color_lab(float l, float a, float b) +A5O_COLOR al_color_lab(float l, float a, float b) { float r2, g2, b2; al_color_lab_to_rgb(l, a, b, &r2, &g2, &b2); @@ -741,13 +741,13 @@ void al_color_rgb_to_lch(float red, float green, float blue, float a, b; al_color_rgb_to_lab(red, green, blue, l, &a, &b); *c = sqrt(a * a + b * b); - *h = fmod(ALLEGRO_PI * 2 + atan2(b, a), ALLEGRO_PI * 2); + *h = fmod(A5O_PI * 2 + atan2(b, a), A5O_PI * 2); } /* Function: al_color_lch */ -ALLEGRO_COLOR al_color_lch(float l, float c, float h) +A5O_COLOR al_color_lch(float l, float c, float h) { float r, g, b; al_color_lch_to_rgb(l, c, h, &r, &g, &b); @@ -780,7 +780,7 @@ void al_color_rgb_to_xyy(float red, float green, float blue, /* Function: al_color_xyy */ -ALLEGRO_COLOR al_color_xyy(float x, float y, float y2) +A5O_COLOR al_color_xyy(float x, float y, float y2) { float r, g, b; al_color_xyy_to_rgb(x, y, y2, &r, &g, &b); @@ -790,15 +790,15 @@ ALLEGRO_COLOR al_color_xyy(float x, float y, float y2) /* Function: al_color_distance_ciede2000 */ -double al_color_distance_ciede2000(ALLEGRO_COLOR color1, - ALLEGRO_COLOR color2) { +double al_color_distance_ciede2000(A5O_COLOR color1, + A5O_COLOR color2) { /* For implementation details refer to e.g. * http://www.ece.rochester.edu/~gsharma/ciede2000/ciede2000noteCRNA.pdf */ float l1, a1, b1, l2, a2, b2; al_color_rgb_to_lab(color1.r, color1.g, color1.b, &l1, &a1, &b1); al_color_rgb_to_lab(color2.r, color2.g, color2.b, &l2, &a2, &b2); - double pi = ALLEGRO_PI; + double pi = A5O_PI; double dl = l1 - l2; double ml = (l1 + l2) / 2; double c1 = sqrt(a1 * a1 + b1 * b1); @@ -840,7 +840,7 @@ double al_color_distance_ciede2000(ALLEGRO_COLOR color1, /* Function al_color_is_valid */ -bool al_is_color_valid(ALLEGRO_COLOR color) +bool al_is_color_valid(A5O_COLOR color) { return color.r >= 0 && color.g >= 0 && color.b >= 0 && color.r <= 1 && color.g <= 1 && color.b <= 1; @@ -891,7 +891,7 @@ void al_color_rgb_to_oklab(float red, float green, float blue, /* Function: al_color_oklab */ -ALLEGRO_COLOR al_color_oklab(float l, float a, float b) +A5O_COLOR al_color_oklab(float l, float a, float b) { float r2, g2, b2; al_color_oklab_to_rgb(l, a, b, &r2, &g2, &b2); diff --git a/addons/font/CMakeLists.txt b/addons/font/CMakeLists.txt index b924bd7fad..9572c2be32 100644 --- a/addons/font/CMakeLists.txt +++ b/addons/font/CMakeLists.txt @@ -5,10 +5,10 @@ set(FONT_INCLUDE_FILES allegro5/allegro_font.h) set_our_header_properties(${FONT_INCLUDE_FILES}) add_our_addon_library(allegro_font - AllegroFont-${ALLEGRO_SOVERSION} + AllegroFont-${A5O_SOVERSION} "${FONT_SOURCES};${FONT_INCLUDE_FILES}" - "-DALLEGRO_FONT_SRC" - "${ALLEGRO_LINK_WITH}" + "-DA5O_FONT_SRC" + "${A5O_LINK_WITH}" ) install_our_headers(${FONT_INCLUDE_FILES}) diff --git a/addons/font/allegro5/allegro_font.h b/addons/font/allegro5/allegro_font.h index 13827c6592..6a7450e119 100644 --- a/addons/font/allegro5/allegro_font.h +++ b/addons/font/allegro5/allegro_font.h @@ -3,38 +3,38 @@ #include "allegro5/allegro.h" -#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32) - #ifndef ALLEGRO_STATICLINK - #ifdef ALLEGRO_FONT_SRC - #define _ALLEGRO_FONT_DLL __declspec(dllexport) +#if (defined A5O_MINGW32) || (defined A5O_MSVC) || (defined A5O_BCC32) + #ifndef A5O_STATICLINK + #ifdef A5O_FONT_SRC + #define _A5O_FONT_DLL __declspec(dllexport) #else - #define _ALLEGRO_FONT_DLL __declspec(dllimport) + #define _A5O_FONT_DLL __declspec(dllimport) #endif #else - #define _ALLEGRO_FONT_DLL + #define _A5O_FONT_DLL #endif #endif -#if defined ALLEGRO_MSVC - #define ALLEGRO_FONT_FUNC(type, name, args) _ALLEGRO_FONT_DLL type __cdecl name args - #define ALLEGRO_FONT_METHOD(type, name, args) type (__cdecl *name) args - #define ALLEGRO_FONT_FUNCPTR(type, name, args) extern _ALLEGRO_FONT_DLL type (__cdecl *name) args - #define ALLEGRO_FONT_PRINTFUNC(type, name, args, a, b) ALLEGRO_FONT_FUNC(type, name, args) -#elif defined ALLEGRO_MINGW32 - #define ALLEGRO_FONT_FUNC(type, name, args) extern type name args - #define ALLEGRO_FONT_METHOD(type, name, args) type (*name) args - #define ALLEGRO_FONT_FUNCPTR(type, name, args) extern _ALLEGRO_FONT_DLL type (*name) args - #define ALLEGRO_FONT_PRINTFUNC(type, name, args, a, b) ALLEGRO_FONT_FUNC(type, name, args) __attribute__ ((format (printf, a, b))) -#elif defined ALLEGRO_BCC32 - #define ALLEGRO_FONT_FUNC(type, name, args) extern _ALLEGRO_FONT_DLL type name args - #define ALLEGRO_FONT_METHOD(type, name, args) type (*name) args - #define ALLEGRO_FONT_FUNCPTR(type, name, args) extern _ALLEGRO_FONT_DLL type (*name) args - #define ALLEGRO_FONT_PRINTFUNC(type, name, args, a, b) ALLEGRO_FONT_FUNC(type, name, args) +#if defined A5O_MSVC + #define A5O_FONT_FUNC(type, name, args) _A5O_FONT_DLL type __cdecl name args + #define A5O_FONT_METHOD(type, name, args) type (__cdecl *name) args + #define A5O_FONT_FUNCPTR(type, name, args) extern _A5O_FONT_DLL type (__cdecl *name) args + #define A5O_FONT_PRINTFUNC(type, name, args, a, b) A5O_FONT_FUNC(type, name, args) +#elif defined A5O_MINGW32 + #define A5O_FONT_FUNC(type, name, args) extern type name args + #define A5O_FONT_METHOD(type, name, args) type (*name) args + #define A5O_FONT_FUNCPTR(type, name, args) extern _A5O_FONT_DLL type (*name) args + #define A5O_FONT_PRINTFUNC(type, name, args, a, b) A5O_FONT_FUNC(type, name, args) __attribute__ ((format (printf, a, b))) +#elif defined A5O_BCC32 + #define A5O_FONT_FUNC(type, name, args) extern _A5O_FONT_DLL type name args + #define A5O_FONT_METHOD(type, name, args) type (*name) args + #define A5O_FONT_FUNCPTR(type, name, args) extern _A5O_FONT_DLL type (*name) args + #define A5O_FONT_PRINTFUNC(type, name, args, a, b) A5O_FONT_FUNC(type, name, args) #else - #define ALLEGRO_FONT_FUNC AL_FUNC - #define ALLEGRO_FONT_METHOD AL_METHOD - #define ALLEGRO_FONT_FUNCPTR AL_FUNCPTR - #define ALLEGRO_FONT_PRINTFUNC AL_PRINTFUNC + #define A5O_FONT_FUNC AL_FUNC + #define A5O_FONT_METHOD AL_METHOD + #define A5O_FONT_FUNCPTR AL_FUNCPTR + #define A5O_FONT_PRINTFUNC AL_PRINTFUNC #endif @@ -43,18 +43,18 @@ #endif -/* Type: ALLEGRO_FONT +/* Type: A5O_FONT */ -typedef struct ALLEGRO_FONT ALLEGRO_FONT; -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_FONT_SRC) +typedef struct A5O_FONT A5O_FONT; +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_FONT_SRC) -/* Type: ALLEGRO_GLYPH +/* Type: A5O_GLYPH */ -typedef struct ALLEGRO_GLYPH ALLEGRO_GLYPH; +typedef struct A5O_GLYPH A5O_GLYPH; -struct ALLEGRO_GLYPH +struct A5O_GLYPH { - ALLEGRO_BITMAP *bitmap; + A5O_BITMAP *bitmap; int x; int y; int w; @@ -67,77 +67,77 @@ struct ALLEGRO_GLYPH #endif enum { - ALLEGRO_NO_KERNING = -1, - ALLEGRO_ALIGN_LEFT = 0, - ALLEGRO_ALIGN_CENTRE = 1, - ALLEGRO_ALIGN_CENTER = 1, - ALLEGRO_ALIGN_RIGHT = 2, - ALLEGRO_ALIGN_INTEGER = 4, + A5O_NO_KERNING = -1, + A5O_ALIGN_LEFT = 0, + A5O_ALIGN_CENTRE = 1, + A5O_ALIGN_CENTER = 1, + A5O_ALIGN_RIGHT = 2, + A5O_ALIGN_INTEGER = 4, }; -ALLEGRO_FONT_FUNC(bool, al_register_font_loader, (const char *ext, ALLEGRO_FONT *(*load)(const char *filename, int size, int flags))); -ALLEGRO_FONT_FUNC(ALLEGRO_FONT *, al_load_bitmap_font, (const char *filename)); -ALLEGRO_FONT_FUNC(ALLEGRO_FONT *, al_load_bitmap_font_flags, (const char *filename, int flags)); -ALLEGRO_FONT_FUNC(ALLEGRO_FONT *, al_load_font, (const char *filename, int size, int flags)); - -ALLEGRO_FONT_FUNC(ALLEGRO_FONT *, al_grab_font_from_bitmap, (ALLEGRO_BITMAP *bmp, int n, const int ranges[])); -ALLEGRO_FONT_FUNC(ALLEGRO_FONT *, al_create_builtin_font, (void)); - -ALLEGRO_FONT_FUNC(void, al_draw_ustr, (const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x, float y, int flags, ALLEGRO_USTR const *ustr)); -ALLEGRO_FONT_FUNC(void, al_draw_text, (const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x, float y, int flags, char const *text)); -ALLEGRO_FONT_FUNC(void, al_draw_justified_text, (const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x1, float x2, float y, float diff, int flags, char const *text)); -ALLEGRO_FONT_FUNC(void, al_draw_justified_ustr, (const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x1, float x2, float y, float diff, int flags, ALLEGRO_USTR const *text)); -ALLEGRO_FONT_PRINTFUNC(void, al_draw_textf, (const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x, float y, int flags, char const *format, ...), 6, 7); -ALLEGRO_FONT_PRINTFUNC(void, al_draw_justified_textf, (const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x1, float x2, float y, float diff, int flags, char const *format, ...), 8, 9); -ALLEGRO_FONT_FUNC(int, al_get_text_width, (const ALLEGRO_FONT *f, const char *str)); -ALLEGRO_FONT_FUNC(int, al_get_ustr_width, (const ALLEGRO_FONT *f, const ALLEGRO_USTR *ustr)); -ALLEGRO_FONT_FUNC(int, al_get_font_line_height, (const ALLEGRO_FONT *f)); -ALLEGRO_FONT_FUNC(int, al_get_font_ascent, (const ALLEGRO_FONT *f)); -ALLEGRO_FONT_FUNC(int, al_get_font_descent, (const ALLEGRO_FONT *f)); -ALLEGRO_FONT_FUNC(void, al_destroy_font, (ALLEGRO_FONT *f)); -ALLEGRO_FONT_FUNC(void, al_get_ustr_dimensions, (const ALLEGRO_FONT *f, - ALLEGRO_USTR const *text, +A5O_FONT_FUNC(bool, al_register_font_loader, (const char *ext, A5O_FONT *(*load)(const char *filename, int size, int flags))); +A5O_FONT_FUNC(A5O_FONT *, al_load_bitmap_font, (const char *filename)); +A5O_FONT_FUNC(A5O_FONT *, al_load_bitmap_font_flags, (const char *filename, int flags)); +A5O_FONT_FUNC(A5O_FONT *, al_load_font, (const char *filename, int size, int flags)); + +A5O_FONT_FUNC(A5O_FONT *, al_grab_font_from_bitmap, (A5O_BITMAP *bmp, int n, const int ranges[])); +A5O_FONT_FUNC(A5O_FONT *, al_create_builtin_font, (void)); + +A5O_FONT_FUNC(void, al_draw_ustr, (const A5O_FONT *font, A5O_COLOR color, float x, float y, int flags, A5O_USTR const *ustr)); +A5O_FONT_FUNC(void, al_draw_text, (const A5O_FONT *font, A5O_COLOR color, float x, float y, int flags, char const *text)); +A5O_FONT_FUNC(void, al_draw_justified_text, (const A5O_FONT *font, A5O_COLOR color, float x1, float x2, float y, float diff, int flags, char const *text)); +A5O_FONT_FUNC(void, al_draw_justified_ustr, (const A5O_FONT *font, A5O_COLOR color, float x1, float x2, float y, float diff, int flags, A5O_USTR const *text)); +A5O_FONT_PRINTFUNC(void, al_draw_textf, (const A5O_FONT *font, A5O_COLOR color, float x, float y, int flags, char const *format, ...), 6, 7); +A5O_FONT_PRINTFUNC(void, al_draw_justified_textf, (const A5O_FONT *font, A5O_COLOR color, float x1, float x2, float y, float diff, int flags, char const *format, ...), 8, 9); +A5O_FONT_FUNC(int, al_get_text_width, (const A5O_FONT *f, const char *str)); +A5O_FONT_FUNC(int, al_get_ustr_width, (const A5O_FONT *f, const A5O_USTR *ustr)); +A5O_FONT_FUNC(int, al_get_font_line_height, (const A5O_FONT *f)); +A5O_FONT_FUNC(int, al_get_font_ascent, (const A5O_FONT *f)); +A5O_FONT_FUNC(int, al_get_font_descent, (const A5O_FONT *f)); +A5O_FONT_FUNC(void, al_destroy_font, (A5O_FONT *f)); +A5O_FONT_FUNC(void, al_get_ustr_dimensions, (const A5O_FONT *f, + A5O_USTR const *text, int *bbx, int *bby, int *bbw, int *bbh)); -ALLEGRO_FONT_FUNC(void, al_get_text_dimensions, (const ALLEGRO_FONT *f, +A5O_FONT_FUNC(void, al_get_text_dimensions, (const A5O_FONT *f, char const *text, int *bbx, int *bby, int *bbw, int *bbh)); -ALLEGRO_FONT_FUNC(bool, al_init_font_addon, (void)); -ALLEGRO_FONT_FUNC(bool, al_is_font_addon_initialized, (void)); -ALLEGRO_FONT_FUNC(void, al_shutdown_font_addon, (void)); -ALLEGRO_FONT_FUNC(uint32_t, al_get_allegro_font_version, (void)); -ALLEGRO_FONT_FUNC(int, al_get_font_ranges, (ALLEGRO_FONT *font, +A5O_FONT_FUNC(bool, al_init_font_addon, (void)); +A5O_FONT_FUNC(bool, al_is_font_addon_initialized, (void)); +A5O_FONT_FUNC(void, al_shutdown_font_addon, (void)); +A5O_FONT_FUNC(uint32_t, al_get_allegro_font_version, (void)); +A5O_FONT_FUNC(int, al_get_font_ranges, (A5O_FONT *font, int ranges_count, int *ranges)); -ALLEGRO_FONT_FUNC(void, al_draw_glyph, (const ALLEGRO_FONT *font, - ALLEGRO_COLOR color, float x, float y, int codepoint)); -ALLEGRO_FONT_FUNC(int, al_get_glyph_width, (const ALLEGRO_FONT *f, +A5O_FONT_FUNC(void, al_draw_glyph, (const A5O_FONT *font, + A5O_COLOR color, float x, float y, int codepoint)); +A5O_FONT_FUNC(int, al_get_glyph_width, (const A5O_FONT *f, int codepoint)); -ALLEGRO_FONT_FUNC(bool, al_get_glyph_dimensions, (const ALLEGRO_FONT *f, +A5O_FONT_FUNC(bool, al_get_glyph_dimensions, (const A5O_FONT *f, int codepoint, int *bbx, int *bby, int *bbw, int *bbh)); -ALLEGRO_FONT_FUNC(int, al_get_glyph_advance, (const ALLEGRO_FONT *f, +A5O_FONT_FUNC(int, al_get_glyph_advance, (const A5O_FONT *f, int codepoint1, int codepoint2)); -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_FONT_SRC) -ALLEGRO_FONT_FUNC(bool, al_get_glyph, (const ALLEGRO_FONT *f, int prev_codepoint, int codepoint, ALLEGRO_GLYPH *glyph)); +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_FONT_SRC) +A5O_FONT_FUNC(bool, al_get_glyph, (const A5O_FONT *f, int prev_codepoint, int codepoint, A5O_GLYPH *glyph)); #endif -ALLEGRO_FONT_FUNC(void, al_draw_multiline_text, (const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x, float y, float max_width, float line_height, int flags, const char *text)); -ALLEGRO_FONT_PRINTFUNC(void, al_draw_multiline_textf, (const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x, float y, float max_width, float line_height, int flags, const char *format, ...), 8, 9); -ALLEGRO_FONT_FUNC(void, al_draw_multiline_ustr, (const ALLEGRO_FONT *font, ALLEGRO_COLOR color, float x, float y, float max_width, float line_height, int flags, const ALLEGRO_USTR *text)); +A5O_FONT_FUNC(void, al_draw_multiline_text, (const A5O_FONT *font, A5O_COLOR color, float x, float y, float max_width, float line_height, int flags, const char *text)); +A5O_FONT_PRINTFUNC(void, al_draw_multiline_textf, (const A5O_FONT *font, A5O_COLOR color, float x, float y, float max_width, float line_height, int flags, const char *format, ...), 8, 9); +A5O_FONT_FUNC(void, al_draw_multiline_ustr, (const A5O_FONT *font, A5O_COLOR color, float x, float y, float max_width, float line_height, int flags, const A5O_USTR *text)); -ALLEGRO_FONT_FUNC(void, al_do_multiline_text, (const ALLEGRO_FONT *font, +A5O_FONT_FUNC(void, al_do_multiline_text, (const A5O_FONT *font, float max_width, const char *text, bool (*cb)(int line_num, const char *line, int size, void *extra), void *extra)); -ALLEGRO_FONT_FUNC(void, al_do_multiline_ustr, (const ALLEGRO_FONT *font, - float max_width, const ALLEGRO_USTR *ustr, - bool (*cb)(int line_num, const ALLEGRO_USTR *line, void *extra), +A5O_FONT_FUNC(void, al_do_multiline_ustr, (const A5O_FONT *font, + float max_width, const A5O_USTR *ustr, + bool (*cb)(int line_num, const A5O_USTR *line, void *extra), void *extra)); -ALLEGRO_FONT_FUNC(void, al_set_fallback_font, (ALLEGRO_FONT *font, - ALLEGRO_FONT *fallback)); -ALLEGRO_FONT_FUNC(ALLEGRO_FONT *, al_get_fallback_font, ( - ALLEGRO_FONT *font)); +A5O_FONT_FUNC(void, al_set_fallback_font, (A5O_FONT *font, + A5O_FONT *fallback)); +A5O_FONT_FUNC(A5O_FONT *, al_get_fallback_font, ( + A5O_FONT *font)); #ifdef __cplusplus } diff --git a/addons/font/allegro5/internal/aintern_font.h b/addons/font/allegro5/internal/aintern_font.h index 133645072d..42a257057b 100644 --- a/addons/font/allegro5/internal/aintern_font.h +++ b/addons/font/allegro5/internal/aintern_font.h @@ -3,39 +3,39 @@ #include "allegro5/internal/aintern_list.h" -typedef struct ALLEGRO_FONT_VTABLE ALLEGRO_FONT_VTABLE; +typedef struct A5O_FONT_VTABLE A5O_FONT_VTABLE; -struct ALLEGRO_FONT +struct A5O_FONT { void *data; int height; - ALLEGRO_FONT *fallback; - ALLEGRO_FONT_VTABLE *vtable; + A5O_FONT *fallback; + A5O_FONT_VTABLE *vtable; _AL_LIST_ITEM *dtor_item; }; /* text- and font-related stuff */ -struct ALLEGRO_FONT_VTABLE +struct A5O_FONT_VTABLE { - ALLEGRO_FONT_METHOD(int, font_height, (const ALLEGRO_FONT *f)); - ALLEGRO_FONT_METHOD(int, font_ascent, (const ALLEGRO_FONT *f)); - ALLEGRO_FONT_METHOD(int, font_descent, (const ALLEGRO_FONT *f)); - ALLEGRO_FONT_METHOD(int, char_length, (const ALLEGRO_FONT *f, int ch)); - ALLEGRO_FONT_METHOD(int, text_length, (const ALLEGRO_FONT *f, const ALLEGRO_USTR *text)); - ALLEGRO_FONT_METHOD(int, render_char, (const ALLEGRO_FONT *f, ALLEGRO_COLOR color, int ch, float x, float y)); - ALLEGRO_FONT_METHOD(int, render, (const ALLEGRO_FONT *f, ALLEGRO_COLOR color, const ALLEGRO_USTR *text, float x, float y)); - ALLEGRO_FONT_METHOD(void, destroy, (ALLEGRO_FONT *f)); - ALLEGRO_FONT_METHOD(void, get_text_dimensions, (const ALLEGRO_FONT *f, - const ALLEGRO_USTR *text, int *bbx, int *bby, int *bbw, int *bbh)); - ALLEGRO_FONT_METHOD(int, get_font_ranges, (ALLEGRO_FONT *font, + A5O_FONT_METHOD(int, font_height, (const A5O_FONT *f)); + A5O_FONT_METHOD(int, font_ascent, (const A5O_FONT *f)); + A5O_FONT_METHOD(int, font_descent, (const A5O_FONT *f)); + A5O_FONT_METHOD(int, char_length, (const A5O_FONT *f, int ch)); + A5O_FONT_METHOD(int, text_length, (const A5O_FONT *f, const A5O_USTR *text)); + A5O_FONT_METHOD(int, render_char, (const A5O_FONT *f, A5O_COLOR color, int ch, float x, float y)); + A5O_FONT_METHOD(int, render, (const A5O_FONT *f, A5O_COLOR color, const A5O_USTR *text, float x, float y)); + A5O_FONT_METHOD(void, destroy, (A5O_FONT *f)); + A5O_FONT_METHOD(void, get_text_dimensions, (const A5O_FONT *f, + const A5O_USTR *text, int *bbx, int *bby, int *bbw, int *bbh)); + A5O_FONT_METHOD(int, get_font_ranges, (A5O_FONT *font, int ranges_count, int *ranges)); - ALLEGRO_FONT_METHOD(bool, get_glyph_dimensions, (const ALLEGRO_FONT *f, + A5O_FONT_METHOD(bool, get_glyph_dimensions, (const A5O_FONT *f, int codepoint, int *bbx, int *bby, int *bbw, int *bbh)); - ALLEGRO_FONT_METHOD(int, get_glyph_advance, (const ALLEGRO_FONT *font, + A5O_FONT_METHOD(int, get_glyph_advance, (const A5O_FONT *font, int codepoint1, int codepoint2)); - ALLEGRO_FONT_METHOD(bool, get_glyph, (const ALLEGRO_FONT *f, int prev_codepoint, int codepoint, ALLEGRO_GLYPH *glyph)); + A5O_FONT_METHOD(bool, get_glyph, (const A5O_FONT *f, int prev_codepoint, int codepoint, A5O_GLYPH *glyph)); }; #endif diff --git a/addons/font/bmfont.c b/addons/font/bmfont.c index e0f7f95939..a85c69df39 100644 --- a/addons/font/bmfont.c +++ b/addons/font/bmfont.c @@ -7,7 +7,7 @@ #include "font.h" #include "xml.h" -ALLEGRO_DEBUG_CHANNEL("font") +A5O_DEBUG_CHANNEL("font") typedef struct { int first; @@ -37,7 +37,7 @@ struct BMFONT_RANGE { typedef struct { int pages_count; - ALLEGRO_BITMAP **pages; + A5O_BITMAP **pages; BMFONT_RANGE *range_first; int base; int line_height; @@ -48,11 +48,11 @@ typedef struct { } BMFONT_DATA; typedef struct { - ALLEGRO_FONT *font; - ALLEGRO_USTR *tag; - ALLEGRO_USTR *attribute; + A5O_FONT *font; + A5O_USTR *tag; + A5O_USTR *attribute; BMFONT_CHAR *c; - ALLEGRO_PATH *path; + A5O_PATH *path; } BMFONT_PARSER; static void reallocate(BMFONT_RANGE *range) { @@ -100,7 +100,7 @@ static void insert_new_range(BMFONT_PARSER *parser, BMFONT_RANGE *prev, prev->next = range; } else { - ALLEGRO_FONT *font = parser->font; + A5O_FONT *font = parser->font; BMFONT_DATA *data = font->data; range->next = data->range_first; data->range_first = range; @@ -112,7 +112,7 @@ static void insert_new_range(BMFONT_PARSER *parser, BMFONT_RANGE *prev, * prepends it to the beginning of a range, or merges two ranges. */ static void add_codepoint(BMFONT_PARSER *parser, int codepoint) { - ALLEGRO_FONT *font = parser->font; + A5O_FONT *font = parser->font; BMFONT_DATA *data = font->data; BMFONT_RANGE *prev = NULL; BMFONT_RANGE *range = data->range_first; @@ -152,13 +152,13 @@ static BMFONT_CHAR *find_codepoint(BMFONT_DATA *data, int codepoint) { } static void add_page(BMFONT_PARSER *parser, char const *filename) { - ALLEGRO_FONT *font = parser->font; + A5O_FONT *font = parser->font; BMFONT_DATA *data = font->data; data->pages_count++; data->pages = al_realloc(data->pages, data->pages_count * sizeof *data->pages); al_set_path_filename(parser->path, filename); - ALLEGRO_BITMAP *page = al_load_bitmap_flags( + A5O_BITMAP *page = al_load_bitmap_flags( al_path_cstr(parser->path, '/'), data->flags); data->pages[data->pages_count - 1] = page; } @@ -178,7 +178,7 @@ static int get_int(char const *value) { static int xml_callback(XmlState state, char const *value, void *u) { BMFONT_PARSER *parser = u; - ALLEGRO_FONT *font = parser->font; + A5O_FONT *font = parser->font; BMFONT_DATA *data = font->data; if (state == ElementName) { al_ustr_assign_cstr(parser->tag, value); @@ -228,17 +228,17 @@ static int xml_callback(XmlState state, char const *value, void *u) return 0; } -static int font_height(const ALLEGRO_FONT *f) { +static int font_height(const A5O_FONT *f) { BMFONT_DATA *data = f->data; return data->line_height; } -static int font_ascent(const ALLEGRO_FONT *f) { +static int font_ascent(const A5O_FONT *f) { BMFONT_DATA *data = f->data; return data->base; } -static int font_descent(const ALLEGRO_FONT *f) { +static int font_descent(const A5O_FONT *f) { BMFONT_DATA *data = f->data; return data->line_height - data->base; } @@ -255,10 +255,10 @@ static int get_kerning(BMFONT_CHAR *prev, int c) { return 0; } -static int each_character(const ALLEGRO_FONT *f, ALLEGRO_COLOR color, - const ALLEGRO_USTR *text, float x, float y, ALLEGRO_GLYPH *glyph, - int (*cb)(const ALLEGRO_FONT *f, ALLEGRO_COLOR color, int ch, - float x, float y, ALLEGRO_GLYPH *glyph)) { +static int each_character(const A5O_FONT *f, A5O_COLOR color, + const A5O_USTR *text, float x, float y, A5O_GLYPH *glyph, + int (*cb)(const A5O_FONT *f, A5O_COLOR color, int ch, + float x, float y, A5O_GLYPH *glyph)) { BMFONT_DATA *data = f->data; int pos = 0; int advance = 0; @@ -276,8 +276,8 @@ static int each_character(const ALLEGRO_FONT *f, ALLEGRO_COLOR color, return advance; } -static int measure_char(const ALLEGRO_FONT *f, ALLEGRO_COLOR color, - int ch, float x, float y, ALLEGRO_GLYPH *glyph) { +static int measure_char(const A5O_FONT *f, A5O_COLOR color, + int ch, float x, float y, A5O_GLYPH *glyph) { (void)color; (void)y; BMFONT_DATA *data = f->data; @@ -305,7 +305,7 @@ static int measure_char(const ALLEGRO_FONT *f, ALLEGRO_COLOR color, return advance; } -static bool get_glyph_dimensions(const ALLEGRO_FONT *f, +static bool get_glyph_dimensions(const A5O_FONT *f, int codepoint, int *bbx, int *bby, int *bbw, int *bbh) { BMFONT_DATA *data = f->data; BMFONT_CHAR *c = find_codepoint(data, codepoint); @@ -321,12 +321,12 @@ static bool get_glyph_dimensions(const ALLEGRO_FONT *f, return true; } -static int get_glyph_advance(const ALLEGRO_FONT *f, +static int get_glyph_advance(const A5O_FONT *f, int codepoint1, int codepoint2) { BMFONT_DATA *data = f->data; BMFONT_CHAR *c = find_codepoint(data, codepoint1); int kerning = 0; - if (codepoint1 == ALLEGRO_NO_KERNING) { + if (codepoint1 == A5O_NO_KERNING) { return 0; } @@ -335,14 +335,14 @@ static int get_glyph_advance(const ALLEGRO_FONT *f, return al_get_glyph_advance(f->fallback, codepoint1, codepoint2); } - if (codepoint2 != ALLEGRO_NO_KERNING) + if (codepoint2 != A5O_NO_KERNING) kerning = get_kerning(c, codepoint2); return c->xadvance + kerning; } -static bool get_glyph(const ALLEGRO_FONT *f, int prev_codepoint, - int codepoint, ALLEGRO_GLYPH *glyph) { +static bool get_glyph(const A5O_FONT *f, int prev_codepoint, + int codepoint, A5O_GLYPH *glyph) { BMFONT_DATA *data = f->data; BMFONT_CHAR *prev = find_codepoint(data, prev_codepoint); BMFONT_CHAR *c = find_codepoint(data, codepoint); @@ -365,17 +365,17 @@ static bool get_glyph(const ALLEGRO_FONT *f, int prev_codepoint, return false; } -static int char_length(const ALLEGRO_FONT *f, int ch) { - ALLEGRO_COLOR color = {0, 0, 0, 0}; +static int char_length(const A5O_FONT *f, int ch) { + A5O_COLOR color = {0, 0, 0, 0}; return measure_char(f, color, ch, 0, 0, NULL); } -static int text_length(const ALLEGRO_FONT *f, const ALLEGRO_USTR *text) { - ALLEGRO_COLOR color = {0, 0, 0, 0}; +static int text_length(const A5O_FONT *f, const A5O_USTR *text) { + A5O_COLOR color = {0, 0, 0, 0}; return each_character(f, color, text, 0, 0, NULL, measure_char); } -static int render_char(const ALLEGRO_FONT *f, ALLEGRO_COLOR color, int ch, float x, float y) { +static int render_char(const A5O_FONT *f, A5O_COLOR color, int ch, float x, float y) { BMFONT_DATA *data = f->data; BMFONT_CHAR *c = find_codepoint(data, ch); if (!c) { @@ -383,20 +383,20 @@ static int render_char(const ALLEGRO_FONT *f, ALLEGRO_COLOR color, int ch, float f->fallback, color, ch, x, y); return 0; } - ALLEGRO_BITMAP *page = data->pages[c->page]; + A5O_BITMAP *page = data->pages[c->page]; al_draw_tinted_bitmap_region(page, color, c->x, c->y, c->width, c->height, x + c->xoffset, y + c->yoffset, 0); return c->xadvance; } -static int render_char_cb(const ALLEGRO_FONT *f, ALLEGRO_COLOR color, - int ch, float x, float y, ALLEGRO_GLYPH *glyph) { +static int render_char_cb(const A5O_FONT *f, A5O_COLOR color, + int ch, float x, float y, A5O_GLYPH *glyph) { (void)glyph; return render_char(f, color, ch, x, y); } -static int render(const ALLEGRO_FONT *f, ALLEGRO_COLOR color, - const ALLEGRO_USTR *text, float x, float y) { +static int render(const A5O_FONT *f, A5O_COLOR color, + const A5O_USTR *text, float x, float y) { return each_character(f, color, text, x, y, NULL, render_char_cb); } @@ -410,7 +410,7 @@ static void destroy_range(BMFONT_RANGE *range) { al_free(range); } -static void destroy(ALLEGRO_FONT *f) { +static void destroy(A5O_FONT *f) { BMFONT_DATA *data = f->data; BMFONT_RANGE *range = data->range_first; while (range) { @@ -429,10 +429,10 @@ static void destroy(ALLEGRO_FONT *f) { al_free(f); } -static void get_text_dimensions(const ALLEGRO_FONT *f, - const ALLEGRO_USTR *text, int *bbx, int *bby, int *bbw, int *bbh) { - ALLEGRO_COLOR color = {0, 0, 0, 0}; - ALLEGRO_GLYPH glyph; +static void get_text_dimensions(const A5O_FONT *f, + const A5O_USTR *text, int *bbx, int *bby, int *bbw, int *bbh) { + A5O_COLOR color = {0, 0, 0, 0}; + A5O_GLYPH glyph; glyph.x = INT_MAX; glyph.y = INT_MAX; glyph.w = INT_MIN; @@ -444,7 +444,7 @@ static void get_text_dimensions(const ALLEGRO_FONT *f, *bbh = glyph.h - glyph.y; } -static int get_font_ranges(ALLEGRO_FONT *f, +static int get_font_ranges(A5O_FONT *f, int ranges_count, int *ranges) { BMFONT_DATA *data = f->data; BMFONT_RANGE *range = data->range_first; @@ -460,7 +460,7 @@ static int get_font_ranges(ALLEGRO_FONT *f, return i; } -static ALLEGRO_FONT_VTABLE _al_font_vtable_xml = { +static A5O_FONT_VTABLE _al_font_vtable_xml = { font_height, font_ascent, font_descent, @@ -476,13 +476,13 @@ static ALLEGRO_FONT_VTABLE _al_font_vtable_xml = { get_glyph }; -ALLEGRO_FONT *_al_load_bmfont_xml(const char *filename, int size, +A5O_FONT *_al_load_bmfont_xml(const char *filename, int size, int font_flags) { (void)size; - ALLEGRO_FILE *f = al_fopen(filename, "r"); + A5O_FILE *f = al_fopen(filename, "r"); if (!f) { - ALLEGRO_DEBUG("Could not open %s.\n", filename); + A5O_DEBUG("Could not open %s.\n", filename); return NULL; } @@ -494,7 +494,7 @@ ALLEGRO_FONT *_al_load_bmfont_xml(const char *filename, int size, parser->path = al_create_path(filename); data->flags = font_flags; - ALLEGRO_FONT *font = al_calloc(1, sizeof *font); + A5O_FONT *font = al_calloc(1, sizeof *font); font->vtable = &_al_font_vtable_xml; font->data = data; parser->font = font; diff --git a/addons/font/font.c b/addons/font/font.c index 9f8719f4b3..38ef2a8fe9 100644 --- a/addons/font/font.c +++ b/addons/font/font.c @@ -12,7 +12,7 @@ * See readme.txt for copyright information. */ -#define ALLEGRO_INTERNAL_UNSTABLE +#define A5O_INTERNAL_UNSTABLE #include #include "allegro5/allegro.h" @@ -26,13 +26,13 @@ #include "font.h" #include -ALLEGRO_DEBUG_CHANNEL("font") +A5O_DEBUG_CHANNEL("font") typedef struct { - ALLEGRO_USTR *extension; - ALLEGRO_FONT *(*load_font)(char const *filename, int size, int flags); + A5O_USTR *extension; + A5O_FONT *(*load_font)(char const *filename, int size, int flags); } FONT_HANDLER; @@ -52,7 +52,7 @@ static int al_font_404_character = '^'; * (mono and color vtable entry) * Returns the height, in pixels of the font. */ -static int font_height(const ALLEGRO_FONT *f) +static int font_height(const A5O_FONT *f) { ASSERT(f); return f->height; @@ -60,14 +60,14 @@ static int font_height(const ALLEGRO_FONT *f) -static int font_ascent(const ALLEGRO_FONT *f) +static int font_ascent(const A5O_FONT *f) { return font_height(f); } -static int font_descent(const ALLEGRO_FONT *f) +static int font_descent(const A5O_FONT *f) { (void)f; return 0; @@ -79,7 +79,7 @@ static int font_descent(const ALLEGRO_FONT *f) * (mono and color vtable entry) * Returns the length, in pixels, of a string as rendered in a font. */ -static int length(const ALLEGRO_FONT* f, const ALLEGRO_USTR *text) +static int length(const A5O_FONT* f, const A5O_USTR *text) { int ch = 0, w = 0; int pos = 0; @@ -94,8 +94,8 @@ static int length(const ALLEGRO_FONT* f, const ALLEGRO_USTR *text) -static void color_get_text_dimensions(ALLEGRO_FONT const *f, - const ALLEGRO_USTR *text, +static void color_get_text_dimensions(A5O_FONT const *f, + const A5O_USTR *text, int *bbx, int *bby, int *bbw, int *bbh) { /* Dummy implementation - for A4-style bitmap fonts the bounding @@ -110,8 +110,8 @@ static void color_get_text_dimensions(ALLEGRO_FONT const *f, -static ALLEGRO_FONT_COLOR_DATA *_al_font_find_page( - ALLEGRO_FONT_COLOR_DATA *cf, int ch) +static A5O_FONT_COLOR_DATA *_al_font_find_page( + A5O_FONT_COLOR_DATA *cf, int ch) { while (cf) { if (ch >= cf->begin && ch < cf->end) @@ -125,9 +125,9 @@ static ALLEGRO_FONT_COLOR_DATA *_al_font_find_page( /* _color_find_glyph: * Helper for color vtable entries, below. */ -static ALLEGRO_BITMAP* _al_font_color_find_glyph(const ALLEGRO_FONT* f, int ch) +static A5O_BITMAP* _al_font_color_find_glyph(const A5O_FONT* f, int ch) { - ALLEGRO_FONT_COLOR_DATA* cf = (ALLEGRO_FONT_COLOR_DATA*)(f->data); + A5O_FONT_COLOR_DATA* cf = (A5O_FONT_COLOR_DATA*)(f->data); cf = _al_font_find_page(cf, ch); if (cf) { @@ -148,9 +148,9 @@ static ALLEGRO_BITMAP* _al_font_color_find_glyph(const ALLEGRO_FONT* f, int ch) * Returns the length of a character, in pixels, as it would be rendered * in this font. */ -static int color_char_length(const ALLEGRO_FONT* f, int ch) +static int color_char_length(const A5O_FONT* f, int ch) { - ALLEGRO_BITMAP* g = _al_font_color_find_glyph(f, ch); + A5O_BITMAP* g = _al_font_color_find_glyph(f, ch); if (g) return al_get_bitmap_width(g); if (f->fallback) @@ -166,13 +166,13 @@ static int color_char_length(const ALLEGRO_FONT* f, int ch) * using the specified color. * Returns the character width, in pixels. */ -static int color_render_char(const ALLEGRO_FONT* f, - ALLEGRO_COLOR color, int ch, float x, +static int color_render_char(const A5O_FONT* f, + A5O_COLOR color, int ch, float x, float y) { int w = 0; int h = f->vtable->font_height(f); - ALLEGRO_BITMAP *g; + A5O_BITMAP *g; g = _al_font_color_find_glyph(f, ch); if (g) { @@ -194,8 +194,8 @@ static int color_render_char(const ALLEGRO_FONT* f, * Renders a color font onto a bitmap, at the specified location, using * the specified color. */ -static int color_render(const ALLEGRO_FONT* f, ALLEGRO_COLOR color, - const ALLEGRO_USTR *text, +static int color_render(const A5O_FONT* f, A5O_COLOR color, + const A5O_USTR *text, float x, float y) { int pos = 0; @@ -212,9 +212,9 @@ static int color_render(const ALLEGRO_FONT* f, ALLEGRO_COLOR color, } -static bool color_get_glyph(const ALLEGRO_FONT *f, int prev_codepoint, int codepoint, ALLEGRO_GLYPH *glyph) +static bool color_get_glyph(const A5O_FONT *f, int prev_codepoint, int codepoint, A5O_GLYPH *glyph) { - ALLEGRO_BITMAP *g = _al_font_color_find_glyph(f, codepoint); + A5O_BITMAP *g = _al_font_color_find_glyph(f, codepoint); if (g) { glyph->bitmap = g; glyph->x = 0; @@ -238,21 +238,21 @@ static bool color_get_glyph(const ALLEGRO_FONT *f, int prev_codepoint, int codep * (color vtable entry) * Destroys a color font. */ -static void color_destroy(ALLEGRO_FONT* f) +static void color_destroy(A5O_FONT* f) { - ALLEGRO_FONT_COLOR_DATA* cf; - ALLEGRO_BITMAP *glyphs = NULL; + A5O_FONT_COLOR_DATA* cf; + A5O_BITMAP *glyphs = NULL; if (!f) return; - cf = (ALLEGRO_FONT_COLOR_DATA*)(f->data); + cf = (A5O_FONT_COLOR_DATA*)(f->data); if (cf) glyphs = cf->glyphs; while (cf) { - ALLEGRO_FONT_COLOR_DATA* next = cf->next; + A5O_FONT_COLOR_DATA* next = cf->next; int i = 0; for (i = cf->begin; i < cf->end; i++) al_destroy_bitmap(cf->bitmaps[i - cf->begin]); @@ -275,10 +275,10 @@ static void color_destroy(ALLEGRO_FONT* f) } -static int color_get_font_ranges(ALLEGRO_FONT *font, int ranges_count, +static int color_get_font_ranges(A5O_FONT *font, int ranges_count, int *ranges) { - ALLEGRO_FONT_COLOR_DATA *cf = font->data; + A5O_FONT_COLOR_DATA *cf = font->data; int i = 0; while (cf) { if (i < ranges_count) { @@ -291,10 +291,10 @@ static int color_get_font_ranges(ALLEGRO_FONT *font, int ranges_count, return i; } -static bool color_get_glyph_dimensions(ALLEGRO_FONT const *f, +static bool color_get_glyph_dimensions(A5O_FONT const *f, int codepoint, int *bbx, int *bby, int *bbw, int *bbh) { - ALLEGRO_BITMAP *glyph = _al_font_color_find_glyph(f, codepoint); + A5O_BITMAP *glyph = _al_font_color_find_glyph(f, codepoint); if(!glyph) { if (f->fallback) { return al_get_glyph_dimensions(f->fallback, codepoint, @@ -309,13 +309,13 @@ static bool color_get_glyph_dimensions(ALLEGRO_FONT const *f, return true; } -static int color_get_glyph_advance(ALLEGRO_FONT const *f, +static int color_get_glyph_advance(A5O_FONT const *f, int codepoint1, int codepoint2) { (void) codepoint2; /* Handle special case to simplify use in a loop. */ - if (codepoint1 == ALLEGRO_NO_KERNING) { + if (codepoint1 == A5O_NO_KERNING) { return 0; } @@ -329,7 +329,7 @@ static int color_get_glyph_advance(ALLEGRO_FONT const *f, * vtable declarations ********/ -ALLEGRO_FONT_VTABLE _al_font_vtable_color = { +A5O_FONT_VTABLE _al_font_vtable_color = { font_height, font_ascent, font_descent, @@ -367,7 +367,7 @@ static void font_shutdown(void) bool al_init_font_addon(void) { if (font_inited) { - ALLEGRO_WARN("Font addon already initialised.\n"); + A5O_WARN("Font addon already initialised.\n"); return true; } @@ -424,7 +424,7 @@ static FONT_HANDLER *find_extension(char const *extension) /* Function: al_register_font_loader */ bool al_register_font_loader(char const *extension, - ALLEGRO_FONT *(*load_font)(char const *filename, int size, int flags)) + A5O_FONT *(*load_font)(char const *filename, int size, int flags)) { FONT_HANDLER *handler = find_extension(extension); if (!handler) { @@ -447,7 +447,7 @@ bool al_register_font_loader(char const *extension, /* Function: al_load_font */ -ALLEGRO_FONT *al_load_font(char const *filename, int size, int flags) +A5O_FONT *al_load_font(char const *filename, int size, int flags) { int i; const char *ext; @@ -456,13 +456,13 @@ ALLEGRO_FONT *al_load_font(char const *filename, int size, int flags) ASSERT(filename); if (!font_inited) { - ALLEGRO_ERROR("Font addon not initialised.\n"); + A5O_ERROR("Font addon not initialised.\n"); return NULL; } ext = strrchr(filename, '.'); if (!ext) { - ALLEGRO_ERROR("Unable to determine filetype: '%s'\n", filename); + A5O_ERROR("Unable to determine filetype: '%s'\n", filename); return NULL; } handler = find_extension(ext); @@ -482,7 +482,7 @@ ALLEGRO_FONT *al_load_font(char const *filename, int size, int flags) */ for (i = _al_vector_size(&font_handlers) - 1; i >= 0 ; i--) { FONT_HANDLER *handler = _al_vector_ref(&font_handlers, i); - ALLEGRO_FONT *try = handler->load_font(filename, size, flags); + A5O_FONT *try = handler->load_font(filename, size, flags); if (try) return try; } @@ -496,7 +496,7 @@ ALLEGRO_FONT *al_load_font(char const *filename, int size, int flags) */ uint32_t al_get_allegro_font_version(void) { - return ALLEGRO_VERSION_INT; + return A5O_VERSION_INT; } /* vim: set sts=4 sw=4 et: */ diff --git a/addons/font/font.h b/addons/font/font.h index 662f14b603..ff7d7cfde0 100644 --- a/addons/font/font.h +++ b/addons/font/font.h @@ -3,19 +3,19 @@ #include "allegro5/internal/aintern_font.h" -extern ALLEGRO_FONT_VTABLE _al_font_vtable_color; +extern A5O_FONT_VTABLE _al_font_vtable_color; -typedef struct ALLEGRO_FONT_COLOR_DATA +typedef struct A5O_FONT_COLOR_DATA { int begin, end; /* first char and one-past-the-end char */ - ALLEGRO_BITMAP *glyphs; /* our glyphs */ - ALLEGRO_BITMAP **bitmaps; /* sub bitmaps pointing to our glyphs */ - struct ALLEGRO_FONT_COLOR_DATA *next; /* linked list structure */ -} ALLEGRO_FONT_COLOR_DATA; + A5O_BITMAP *glyphs; /* our glyphs */ + A5O_BITMAP **bitmaps; /* sub bitmaps pointing to our glyphs */ + struct A5O_FONT_COLOR_DATA *next; /* linked list structure */ +} A5O_FONT_COLOR_DATA; -ALLEGRO_FONT *_al_load_bitmap_font(const char *filename, +A5O_FONT *_al_load_bitmap_font(const char *filename, int size, int flags); -ALLEGRO_FONT *_al_load_bmfont_xml(const char *filename, +A5O_FONT *_al_load_bmfont_xml(const char *filename, int size, int flags); diff --git a/addons/font/fontbmp.c b/addons/font/fontbmp.c index 4712d2a274..f4b7af2269 100644 --- a/addons/font/fontbmp.c +++ b/addons/font/fontbmp.c @@ -26,7 +26,7 @@ #include "font.h" -ALLEGRO_DEBUG_CHANNEL("font") +A5O_DEBUG_CHANNEL("font") static void font_find_character(uint32_t *data, int pitch, @@ -81,7 +81,7 @@ static void font_find_character(uint32_t *data, int pitch, */ static int import_bitmap_font_color(uint32_t *data, int pitch, int bmp_w, int bmp_h, - ALLEGRO_BITMAP **bits, ALLEGRO_BITMAP *glyphs, int num, + A5O_BITMAP **bits, A5O_BITMAP *glyphs, int num, int *import_x, int *import_y) { int w, h, i; @@ -90,7 +90,7 @@ static int import_bitmap_font_color(uint32_t *data, int pitch, font_find_character(data, pitch, bmp_w, bmp_h, import_x, import_y, &w, &h); if (w <= 0 || h <= 0) { - ALLEGRO_ERROR("Unable to find character %d\n", i); + A5O_ERROR("Unable to find character %d\n", i); return -1; } else { @@ -108,14 +108,14 @@ static int import_bitmap_font_color(uint32_t *data, int pitch, /* bitmap_font_count: * Helper for `import_bitmap_font', below. */ -static int bitmap_font_count(ALLEGRO_BITMAP* bmp) +static int bitmap_font_count(A5O_BITMAP* bmp) { int x = 0, y = 0, w = 0, h = 0; int num = 0; - ALLEGRO_LOCKED_REGION *lock; + A5O_LOCKED_REGION *lock; - lock = al_lock_bitmap(bmp, ALLEGRO_PIXEL_FORMAT_RGBA_8888, - ALLEGRO_LOCK_READONLY); + lock = al_lock_bitmap(bmp, A5O_PIXEL_FORMAT_RGBA_8888, + A5O_LOCK_READONLY); while (1) { font_find_character(lock->data, lock->pitch, @@ -134,11 +134,11 @@ static int bitmap_font_count(ALLEGRO_BITMAP* bmp) -ALLEGRO_FONT *_al_load_bitmap_font(const char *fname, int size, int font_flags) +A5O_FONT *_al_load_bitmap_font(const char *fname, int size, int font_flags) { - ALLEGRO_BITMAP *import_bmp; - ALLEGRO_FONT *f; - ALLEGRO_STATE backup; + A5O_BITMAP *import_bmp; + A5O_FONT *f; + A5O_STATE backup; int range[2]; int bmp_flags; ASSERT(fname); @@ -146,18 +146,18 @@ ALLEGRO_FONT *_al_load_bitmap_font(const char *fname, int size, int font_flags) (void)size; bmp_flags = 0; - if (font_flags & ALLEGRO_NO_PREMULTIPLIED_ALPHA) { - bmp_flags |= ALLEGRO_NO_PREMULTIPLIED_ALPHA; + if (font_flags & A5O_NO_PREMULTIPLIED_ALPHA) { + bmp_flags |= A5O_NO_PREMULTIPLIED_ALPHA; } - al_store_state(&backup, ALLEGRO_STATE_NEW_BITMAP_PARAMETERS); - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); - al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA); + al_store_state(&backup, A5O_STATE_NEW_BITMAP_PARAMETERS); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); + al_set_new_bitmap_format(A5O_PIXEL_FORMAT_ANY_WITH_ALPHA); import_bmp = al_load_bitmap_flags(fname, bmp_flags); al_restore_state(&backup); if (!import_bmp) { - ALLEGRO_ERROR("Couldn't load bitmap from '%s'\n", fname); + A5O_ERROR("Couldn't load bitmap from '%s'\n", fname); return NULL; } @@ -178,13 +178,13 @@ ALLEGRO_FONT *_al_load_bitmap_font(const char *fname, int size, int font_flags) /* Function: al_load_bitmap_font */ -ALLEGRO_FONT *al_load_bitmap_font(const char *fname) +A5O_FONT *al_load_bitmap_font(const char *fname) { int flags = 0; /* For backwards compatibility with the 5.0 branch. */ - if (al_get_new_bitmap_flags() & ALLEGRO_NO_PREMULTIPLIED_ALPHA) { - flags |= ALLEGRO_NO_PREMULTIPLIED_ALPHA; + if (al_get_new_bitmap_flags() & A5O_NO_PREMULTIPLIED_ALPHA) { + flags |= A5O_NO_PREMULTIPLIED_ALPHA; } return _al_load_bitmap_font(fname, 0, flags); @@ -194,7 +194,7 @@ ALLEGRO_FONT *al_load_bitmap_font(const char *fname) /* Function: al_load_bitmap_font_flags */ -ALLEGRO_FONT *al_load_bitmap_font_flags(const char *fname, int flags) +A5O_FONT *al_load_bitmap_font_flags(const char *fname, int flags) { return _al_load_bitmap_font(fname, 0, flags); } @@ -203,17 +203,17 @@ ALLEGRO_FONT *al_load_bitmap_font_flags(const char *fname, int flags) /* Function: al_grab_font_from_bitmap */ -ALLEGRO_FONT *al_grab_font_from_bitmap(ALLEGRO_BITMAP *bmp, +A5O_FONT *al_grab_font_from_bitmap(A5O_BITMAP *bmp, int ranges_n, const int ranges[]) { - ALLEGRO_FONT *f; - ALLEGRO_FONT_COLOR_DATA *cf, *prev = NULL; - ALLEGRO_STATE backup; + A5O_FONT *f; + A5O_FONT_COLOR_DATA *cf, *prev = NULL; + A5O_STATE backup; int i; - ALLEGRO_COLOR mask = al_get_pixel(bmp, 0, 0); - ALLEGRO_BITMAP *glyphs = NULL, *unmasked = NULL; + A5O_COLOR mask = al_get_pixel(bmp, 0, 0); + A5O_BITMAP *glyphs = NULL, *unmasked = NULL; int import_x = 0, import_y = 0; - ALLEGRO_LOCKED_REGION *lock = NULL; + A5O_LOCKED_REGION *lock = NULL; int w, h; ASSERT(bmp); @@ -224,9 +224,9 @@ ALLEGRO_FONT *al_grab_font_from_bitmap(ALLEGRO_BITMAP *bmp, f = al_calloc(1, sizeof *f); f->vtable = &_al_font_vtable_color; - al_store_state(&backup, ALLEGRO_STATE_NEW_BITMAP_PARAMETERS); - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); - al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA); + al_store_state(&backup, A5O_STATE_NEW_BITMAP_PARAMETERS); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); + al_set_new_bitmap_format(A5O_PIXEL_FORMAT_ANY_WITH_ALPHA); unmasked = al_clone_bitmap(bmp); /* At least with OpenGL, texture pixels at the very border of * the glyph are sometimes partly sampled from the yellow mask @@ -237,33 +237,33 @@ ALLEGRO_FONT *al_grab_font_from_bitmap(ALLEGRO_BITMAP *bmp, al_convert_mask_to_alpha(unmasked, mask); al_restore_state(&backup); - al_store_state(&backup, ALLEGRO_STATE_BITMAP | ALLEGRO_STATE_BLENDER); + al_store_state(&backup, A5O_STATE_BITMAP | A5O_STATE_BLENDER); // Use the users preferred format, so don't set this below! - //al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA); + //al_set_new_bitmap_format(A5O_PIXEL_FORMAT_ANY_WITH_ALPHA); for (i = 0; i < ranges_n; i++) { int first = ranges[i * 2]; int last = ranges[i * 2 + 1]; int n = 1 + last - first; - cf = al_calloc(1, sizeof(ALLEGRO_FONT_COLOR_DATA)); + cf = al_calloc(1, sizeof(A5O_FONT_COLOR_DATA)); if (prev) prev->next = cf; else f->data = cf; - cf->bitmaps = al_malloc(sizeof(ALLEGRO_BITMAP*) * n); + cf->bitmaps = al_malloc(sizeof(A5O_BITMAP*) * n); cf->bitmaps[0] = NULL; if (!glyphs) { glyphs = al_clone_bitmap(unmasked); if (!glyphs) { - ALLEGRO_ERROR("Unable clone bitmap.\n"); + A5O_ERROR("Unable clone bitmap.\n"); goto cleanup_and_fail_on_error; } lock = al_lock_bitmap(bmp, - ALLEGRO_PIXEL_FORMAT_RGBA_8888, ALLEGRO_LOCK_READONLY); + A5O_PIXEL_FORMAT_RGBA_8888, A5O_LOCK_READONLY); } cf->glyphs = glyphs; diff --git a/addons/font/stdfont.c b/addons/font/stdfont.c index 98416d0aa7..4314236270 100644 --- a/addons/font/stdfont.c +++ b/addons/font/stdfont.c @@ -19,7 +19,7 @@ #include "allegro5/allegro_font.h" -ALLEGRO_DEBUG_CHANNEL("font") +A5O_DEBUG_CHANNEL("font") /* Adapted from Allegro4 "font.c" (removed unnecessary height and width @@ -373,7 +373,7 @@ static const int builtin_rom_font_8x8_ranges_count = -static void put_pixel_abgr8888_le(ALLEGRO_LOCKED_REGION *region, +static void put_pixel_abgr8888_le(A5O_LOCKED_REGION *region, int x, int y, uint32_t pixel) { uint32_t *target = (uint32_t *) ((uint8_t *)region->data @@ -385,24 +385,24 @@ static void put_pixel_abgr8888_le(ALLEGRO_LOCKED_REGION *region, /* decodes the binary data and creates a bitmap containing the glyps from it */ -static ALLEGRO_BITMAP *create_builtin_font_sheet(void) +static A5O_BITMAP *create_builtin_font_sheet(void) { const int glyph_count = sizeof(builtin_rom_font_8x8) / 8; const int glyphs_per_row = 32; const int alloc_rows = (glyph_count + glyphs_per_row - 1) / glyphs_per_row; - ALLEGRO_STATE state; - ALLEGRO_BITMAP *bmp; - ALLEGRO_LOCKED_REGION *lr; + A5O_STATE state; + A5O_BITMAP *bmp; + A5O_LOCKED_REGION *lr; int i, j, k; al_store_state(&state, - ALLEGRO_STATE_NEW_BITMAP_PARAMETERS | - ALLEGRO_STATE_TARGET_BITMAP); + A5O_STATE_NEW_BITMAP_PARAMETERS | + A5O_STATE_TARGET_BITMAP); /* putting pixels is much faster on a memory bitmap */ - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); - al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); + al_set_new_bitmap_format(A5O_PIXEL_FORMAT_ANY_WITH_ALPHA); /* create bitmap onto which to render the glyphs */ bmp = al_create_bitmap(glyphs_per_row * 8 + glyphs_per_row + 1, @@ -411,7 +411,7 @@ static ALLEGRO_BITMAP *create_builtin_font_sheet(void) al_set_target_bitmap(bmp); al_clear_to_color(al_map_rgba(255, 255, 0, 255)); lr = al_lock_bitmap(bmp, - ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, ALLEGRO_LOCK_READWRITE); + A5O_PIXEL_FORMAT_ABGR_8888_LE, A5O_LOCK_READWRITE); /* decode and render glyph pixels */ for (i = 0; i < glyph_count; i++) { @@ -432,7 +432,7 @@ static ALLEGRO_BITMAP *create_builtin_font_sheet(void) al_unlock_bitmap(bmp); } else { - ALLEGRO_ERROR("Unable to create bitmap.\n"); + A5O_ERROR("Unable to create bitmap.\n"); } al_restore_state(&state); @@ -444,10 +444,10 @@ static ALLEGRO_BITMAP *create_builtin_font_sheet(void) /* Function: al_create_builtin_font */ -ALLEGRO_FONT *al_create_builtin_font(void) +A5O_FONT *al_create_builtin_font(void) { - ALLEGRO_BITMAP *bmp; - ALLEGRO_FONT *font; + A5O_BITMAP *bmp; + A5O_FONT *font; bmp = create_builtin_font_sheet(); if (!bmp) diff --git a/addons/font/text.c b/addons/font/text.c index 8df4af3fe7..fdc11927e7 100644 --- a/addons/font/text.c +++ b/addons/font/text.c @@ -47,8 +47,8 @@ * round to nearest integer, and backtransform that. */ static void align_to_integer_pixel_inner( - ALLEGRO_TRANSFORM const *fwd, - ALLEGRO_TRANSFORM const *inv, + A5O_TRANSFORM const *fwd, + A5O_TRANSFORM const *inv, float *x, float *y) { al_transform_coordinates(fwd, x, y); @@ -59,8 +59,8 @@ static void align_to_integer_pixel_inner( static void align_to_integer_pixel(float *x, float *y) { - ALLEGRO_TRANSFORM const *fwd; - ALLEGRO_TRANSFORM inv; + A5O_TRANSFORM const *fwd; + A5O_TRANSFORM inv; fwd = al_get_current_transform(); al_copy_transform(&inv, fwd); @@ -72,24 +72,24 @@ static void align_to_integer_pixel(float *x, float *y) /* Function: al_draw_ustr */ -void al_draw_ustr(const ALLEGRO_FONT *font, - ALLEGRO_COLOR color, float x, float y, int flags, - const ALLEGRO_USTR *ustr) +void al_draw_ustr(const A5O_FONT *font, + A5O_COLOR color, float x, float y, int flags, + const A5O_USTR *ustr) { ASSERT(font); ASSERT(ustr); - if (flags & ALLEGRO_ALIGN_CENTRE) { + if (flags & A5O_ALIGN_CENTRE) { /* Use integer division to avoid introducing a fractional * component to an integer x value. */ x -= font->vtable->text_length(font, ustr) / 2; } - else if (flags & ALLEGRO_ALIGN_RIGHT) { + else if (flags & A5O_ALIGN_RIGHT) { x -= font->vtable->text_length(font, ustr); } - if (flags & ALLEGRO_ALIGN_INTEGER) + if (flags & A5O_ALIGN_INTEGER) align_to_integer_pixel(&x, &y); font->vtable->render(font, color, ustr, x, y); @@ -99,11 +99,11 @@ void al_draw_ustr(const ALLEGRO_FONT *font, /* Function: al_draw_text */ -void al_draw_text(const ALLEGRO_FONT *font, - ALLEGRO_COLOR color, float x, float y, int flags, +void al_draw_text(const A5O_FONT *font, + A5O_COLOR color, float x, float y, int flags, char const *text) { - ALLEGRO_USTR_INFO info; + A5O_USTR_INFO info; ASSERT(text); al_draw_ustr(font, color, x, y, flags, al_ref_cstr(&info, text)); } @@ -112,21 +112,21 @@ void al_draw_text(const ALLEGRO_FONT *font, /* Function: al_draw_justified_ustr */ -void al_draw_justified_ustr(const ALLEGRO_FONT *font, - ALLEGRO_COLOR color, float x1, float x2, - float y, float diff, int flags, const ALLEGRO_USTR *ustr) +void al_draw_justified_ustr(const A5O_FONT *font, + A5O_COLOR color, float x1, float x2, + float y, float diff, int flags, const A5O_USTR *ustr) { const char *whitespace = " \t\n\r"; - ALLEGRO_USTR_INFO word_info; - const ALLEGRO_USTR *word; + A5O_USTR_INFO word_info; + const A5O_USTR *word; int pos1, pos2; int minlen; int num_words; int space; float fleft, finc; int advance; - ALLEGRO_TRANSFORM const *fwd = NULL; - ALLEGRO_TRANSFORM inv; + A5O_TRANSFORM const *fwd = NULL; + A5O_TRANSFORM inv; ASSERT(font); @@ -154,7 +154,7 @@ void al_draw_justified_ustr(const ALLEGRO_FONT *font, if ((space <= 0) || (space > diff) || (num_words < 2)) { /* can't justify */ - if (flags & ALLEGRO_ALIGN_INTEGER) + if (flags & A5O_ALIGN_INTEGER) align_to_integer_pixel(&x1, &y); font->vtable->render(font, color, ustr, x1, y); return; @@ -165,7 +165,7 @@ void al_draw_justified_ustr(const ALLEGRO_FONT *font, finc = (float)space / (float)(num_words-1); pos1 = 0; - if (flags & ALLEGRO_ALIGN_INTEGER) { + if (flags & A5O_ALIGN_INTEGER) { fwd = al_get_current_transform(); al_copy_transform(&inv, fwd); al_invert_transform(&inv); @@ -180,7 +180,7 @@ void al_draw_justified_ustr(const ALLEGRO_FONT *font, pos2 = al_ustr_size(ustr); word = al_ref_ustr(&word_info, ustr, pos1, pos2); - if (flags & ALLEGRO_ALIGN_INTEGER) { + if (flags & A5O_ALIGN_INTEGER) { float drawx = fleft; float drawy = y; align_to_integer_pixel_inner(fwd, &inv, &drawx, &drawy); @@ -197,11 +197,11 @@ void al_draw_justified_ustr(const ALLEGRO_FONT *font, /* Function: al_draw_justified_text */ -void al_draw_justified_text(const ALLEGRO_FONT *font, - ALLEGRO_COLOR color, float x1, float x2, +void al_draw_justified_text(const A5O_FONT *font, + A5O_COLOR color, float x1, float x2, float y, float diff, int flags, const char *text) { - ALLEGRO_USTR_INFO info; + A5O_USTR_INFO info; ASSERT(text); al_draw_justified_ustr(font, color, x1, x2, y, diff, flags, al_ref_cstr(&info, text)); @@ -210,11 +210,11 @@ void al_draw_justified_text(const ALLEGRO_FONT *font, /* Function: al_draw_textf */ -void al_draw_textf(const ALLEGRO_FONT *font, ALLEGRO_COLOR color, +void al_draw_textf(const A5O_FONT *font, A5O_COLOR color, float x, float y, int flags, const char *format, ...) { - ALLEGRO_USTR *buf; + A5O_USTR *buf; va_list ap; const char *s; ASSERT(font); @@ -243,11 +243,11 @@ void al_draw_textf(const ALLEGRO_FONT *font, ALLEGRO_COLOR color, /* Function: al_draw_justified_textf */ -void al_draw_justified_textf(const ALLEGRO_FONT *f, - ALLEGRO_COLOR color, float x1, float x2, float y, +void al_draw_justified_textf(const A5O_FONT *f, + A5O_COLOR color, float x1, float x2, float y, float diff, int flags, const char *format, ...) { - ALLEGRO_USTR *buf; + A5O_USTR *buf; va_list ap; ASSERT(f); ASSERT(format); @@ -266,7 +266,7 @@ void al_draw_justified_textf(const ALLEGRO_FONT *f, /* Function: al_get_ustr_width */ -int al_get_ustr_width(const ALLEGRO_FONT *f, ALLEGRO_USTR const *ustr) +int al_get_ustr_width(const A5O_FONT *f, A5O_USTR const *ustr) { ASSERT(f); ASSERT(ustr); @@ -278,10 +278,10 @@ int al_get_ustr_width(const ALLEGRO_FONT *f, ALLEGRO_USTR const *ustr) /* Function: al_get_text_width */ -int al_get_text_width(const ALLEGRO_FONT *f, const char *str) +int al_get_text_width(const A5O_FONT *f, const char *str) { - ALLEGRO_USTR_INFO str_info; - const ALLEGRO_USTR *ustr; + A5O_USTR_INFO str_info; + const A5O_USTR *ustr; ASSERT(f); ASSERT(str); @@ -294,7 +294,7 @@ int al_get_text_width(const ALLEGRO_FONT *f, const char *str) /* Function: al_get_font_line_height */ -int al_get_font_line_height(const ALLEGRO_FONT *f) +int al_get_font_line_height(const A5O_FONT *f) { ASSERT(f); return f->vtable->font_height(f); @@ -304,7 +304,7 @@ int al_get_font_line_height(const ALLEGRO_FONT *f) /* Function: al_get_font_ascent */ -int al_get_font_ascent(const ALLEGRO_FONT *f) +int al_get_font_ascent(const A5O_FONT *f) { ASSERT(f); return f->vtable->font_ascent(f); @@ -314,7 +314,7 @@ int al_get_font_ascent(const ALLEGRO_FONT *f) /* Function: al_get_font_descent */ -int al_get_font_descent(const ALLEGRO_FONT *f) +int al_get_font_descent(const A5O_FONT *f) { ASSERT(f); return f->vtable->font_descent(f); @@ -324,8 +324,8 @@ int al_get_font_descent(const ALLEGRO_FONT *f) /* Function: al_get_ustr_dimensions */ -void al_get_ustr_dimensions(const ALLEGRO_FONT *f, - ALLEGRO_USTR const *ustr, +void al_get_ustr_dimensions(const A5O_FONT *f, + A5O_USTR const *ustr, int *bbx, int *bby, int *bbw, int *bbh) { ASSERT(f); @@ -338,11 +338,11 @@ void al_get_ustr_dimensions(const ALLEGRO_FONT *f, /* Function: al_get_text_dimensions */ -void al_get_text_dimensions(const ALLEGRO_FONT *f, +void al_get_text_dimensions(const A5O_FONT *f, char const *text, int *bbx, int *bby, int *bbw, int *bbh) { - ALLEGRO_USTR_INFO info; + A5O_USTR_INFO info; ASSERT(f); ASSERT(text); @@ -354,7 +354,7 @@ void al_get_text_dimensions(const ALLEGRO_FONT *f, /* Function: al_destroy_font */ -void al_destroy_font(ALLEGRO_FONT *f) +void al_destroy_font(A5O_FONT *f) { if (!f) return; @@ -367,14 +367,14 @@ void al_destroy_font(ALLEGRO_FONT *f) /* Function: al_get_font_ranges */ -int al_get_font_ranges(ALLEGRO_FONT *f, int ranges_count, int *ranges) +int al_get_font_ranges(A5O_FONT *f, int ranges_count, int *ranges) { return f->vtable->get_font_ranges(f, ranges_count, ranges); } /* Function: al_draw_glyph */ -void al_draw_glyph(const ALLEGRO_FONT *f, ALLEGRO_COLOR color, float x, float y, +void al_draw_glyph(const A5O_FONT *f, A5O_COLOR color, float x, float y, int codepoint) { f->vtable->render_char(f, color, codepoint, x, y); @@ -382,14 +382,14 @@ void al_draw_glyph(const ALLEGRO_FONT *f, ALLEGRO_COLOR color, float x, float y, /* Function: al_get_glyph_width */ -int al_get_glyph_width(const ALLEGRO_FONT *f, int codepoint) +int al_get_glyph_width(const A5O_FONT *f, int codepoint) { return f->vtable->char_length(f, codepoint); } /* Function: al_get_glyph_dimensions */ -bool al_get_glyph_dimensions(const ALLEGRO_FONT *f, +bool al_get_glyph_dimensions(const A5O_FONT *f, int codepoint, int *bbx, int *bby, int *bbw, int *bbh) { return f->vtable->get_glyph_dimensions(f, codepoint, bbx, bby, bbw, bbh); @@ -397,14 +397,14 @@ bool al_get_glyph_dimensions(const ALLEGRO_FONT *f, /* Function: al_get_glyph_advance */ -int al_get_glyph_advance(const ALLEGRO_FONT *f, int codepoint1, int codepoint2) +int al_get_glyph_advance(const A5O_FONT *f, int codepoint1, int codepoint2) { return f->vtable->get_glyph_advance(f, codepoint1, codepoint2); } /* Function: al_get_glyph */ -bool al_get_glyph(const ALLEGRO_FONT *f, int prev_codepoint, int codepoint, ALLEGRO_GLYPH *glyph) +bool al_get_glyph(const A5O_FONT *f, int prev_codepoint, int codepoint, A5O_GLYPH *glyph) { return f->vtable->get_glyph(f, prev_codepoint, codepoint, glyph); }; @@ -417,10 +417,10 @@ bool al_get_glyph(const ALLEGRO_FONT *f, int prev_codepoint, int codepoint, ALLE * Pos is updated to byte index of character after the delimiter or * to the end of the string. */ -static const ALLEGRO_USTR *ustr_split_next(const ALLEGRO_USTR *ustr, - ALLEGRO_USTR_INFO *info, int *pos, const char *delimiter) +static const A5O_USTR *ustr_split_next(const A5O_USTR *ustr, + A5O_USTR_INFO *info, int *pos, const char *delimiter) { - const ALLEGRO_USTR *result; + const A5O_USTR *result; int end, size; size = al_ustr_size(ustr); @@ -451,11 +451,11 @@ static const ALLEGRO_USTR *ustr_split_next(const ALLEGRO_USTR *ustr, * line was split, but pos will be set to point to after that trailing * space so iteration can continue easily. */ -static const ALLEGRO_USTR *get_next_soft_line(const ALLEGRO_USTR *ustr, - ALLEGRO_USTR_INFO *info, int *pos, - const ALLEGRO_FONT *font, float max_width) +static const A5O_USTR *get_next_soft_line(const A5O_USTR *ustr, + A5O_USTR_INFO *info, int *pos, + const A5O_FONT *font, float max_width) { - const ALLEGRO_USTR *result = NULL; + const A5O_USTR *result = NULL; const char *whitespace = " \t"; int old_end = 0; int end = 0; @@ -513,14 +513,14 @@ static const ALLEGRO_USTR *get_next_soft_line(const ALLEGRO_USTR *ustr, /* Function: al_do_multiline_ustr */ -void al_do_multiline_ustr(const ALLEGRO_FONT *font, float max_width, - const ALLEGRO_USTR *ustr, - bool (*cb)(int line_num, const ALLEGRO_USTR * line, void *extra), +void al_do_multiline_ustr(const A5O_FONT *font, float max_width, + const A5O_USTR *ustr, + bool (*cb)(int line_num, const A5O_USTR * line, void *extra), void *extra) { const char *linebreak = "\n"; - const ALLEGRO_USTR *hard_line, *soft_line; - ALLEGRO_USTR_INFO hard_line_info, soft_line_info; + const A5O_USTR *hard_line, *soft_line; + A5O_USTR_INFO hard_line_info, soft_line_info; int hard_line_pos = 0, soft_line_pos = 0; int line_num = 0; bool proceed; @@ -568,7 +568,7 @@ typedef struct DO_MULTILINE_TEXT_EXTRA { /* The functions do_multiline_text_cb is the helper callback * that "adapts" al_do_multiline_ustr to al_do_multiline_text. */ -static bool do_multiline_text_cb(int line_num, const ALLEGRO_USTR *line, +static bool do_multiline_text_cb(int line_num, const A5O_USTR *line, void *extra) { DO_MULTILINE_TEXT_EXTRA *s = extra; @@ -579,12 +579,12 @@ static bool do_multiline_text_cb(int line_num, const ALLEGRO_USTR *line, /* Function: al_do_multiline_text */ -void al_do_multiline_text(const ALLEGRO_FONT *font, +void al_do_multiline_text(const A5O_FONT *font, float max_width, const char *text, bool (*cb)(int line_num, const char *line, int size, void *extra), void *extra) { - ALLEGRO_USTR_INFO info; + A5O_USTR_INFO info; DO_MULTILINE_TEXT_EXTRA extra2; ASSERT(font); ASSERT(text); @@ -599,8 +599,8 @@ void al_do_multiline_text(const ALLEGRO_FONT *font, /* Helper struct for al_draw_multiline_ustr. */ typedef struct DRAW_MULTILINE_USTR_EXTRA { - const ALLEGRO_FONT *font; - ALLEGRO_COLOR color; + const A5O_FONT *font; + A5O_COLOR color; float x; float y; float line_height; @@ -612,7 +612,7 @@ typedef struct DRAW_MULTILINE_USTR_EXTRA { /* The function draw_multiline_ustr_cb is the helper callback * that implements the actual drawing for al_draw_multiline_ustr. */ -static bool draw_multiline_ustr_cb(int line_num, const ALLEGRO_USTR *line, +static bool draw_multiline_ustr_cb(int line_num, const A5O_USTR *line, void *extra) { DRAW_MULTILINE_USTR_EXTRA *s = extra; float y; @@ -626,9 +626,9 @@ static bool draw_multiline_ustr_cb(int line_num, const ALLEGRO_USTR *line, /* Function: al_draw_multiline_ustr */ -void al_draw_multiline_ustr(const ALLEGRO_FONT *font, - ALLEGRO_COLOR color, float x, float y, float max_width, float line_height, - int flags, const ALLEGRO_USTR *ustr) +void al_draw_multiline_ustr(const A5O_FONT *font, + A5O_COLOR color, float x, float y, float max_width, float line_height, + int flags, const A5O_USTR *ustr) { DRAW_MULTILINE_USTR_EXTRA extra; ASSERT(font); @@ -653,11 +653,11 @@ void al_draw_multiline_ustr(const ALLEGRO_FONT *font, /* Function: al_draw_multiline_text */ -void al_draw_multiline_text(const ALLEGRO_FONT *font, - ALLEGRO_COLOR color, float x, float y, float max_width, float line_height, +void al_draw_multiline_text(const A5O_FONT *font, + A5O_COLOR color, float x, float y, float max_width, float line_height, int flags, const char *text) { - ALLEGRO_USTR_INFO info; + A5O_USTR_INFO info; ASSERT(font); ASSERT(text); @@ -669,11 +669,11 @@ void al_draw_multiline_text(const ALLEGRO_FONT *font, /* Function: al_draw_multiline_textf */ -void al_draw_multiline_textf(const ALLEGRO_FONT *font, - ALLEGRO_COLOR color, float x, float y, float max_width, float line_height, +void al_draw_multiline_textf(const A5O_FONT *font, + A5O_COLOR color, float x, float y, float max_width, float line_height, int flags, const char *format, ...) { - ALLEGRO_USTR *buf; + A5O_USTR *buf; va_list ap; ASSERT(font); ASSERT(format); @@ -692,14 +692,14 @@ void al_draw_multiline_textf(const ALLEGRO_FONT *font, /* Function: al_set_fallback_font */ -void al_set_fallback_font(ALLEGRO_FONT *font, ALLEGRO_FONT *fallback) +void al_set_fallback_font(A5O_FONT *font, A5O_FONT *fallback) { font->fallback = fallback; } /* Function: al_get_fallback_font */ -ALLEGRO_FONT *al_get_fallback_font(ALLEGRO_FONT *font) +A5O_FONT *al_get_fallback_font(A5O_FONT *font) { return font->fallback; } diff --git a/addons/font/xml.c b/addons/font/xml.c index 1b0e4da9f4..b4e3f085a7 100644 --- a/addons/font/xml.c +++ b/addons/font/xml.c @@ -6,7 +6,7 @@ typedef struct { XmlState state; bool closing; - ALLEGRO_USTR *value; + A5O_USTR *value; int (*callback)(XmlState state, char const *value, void *u); void *u; } XmlParser; @@ -44,7 +44,7 @@ static void open_tag(XmlParser *x) { x->state = Outside; } -void _al_xml_parse(ALLEGRO_FILE *f, +void _al_xml_parse(A5O_FILE *f, int (*callback)(XmlState state, char const *value, void *u), void *u) { diff --git a/addons/font/xml.h b/addons/font/xml.h index 07fb6cbd0f..227e2548d0 100644 --- a/addons/font/xml.h +++ b/addons/font/xml.h @@ -6,6 +6,6 @@ typedef enum { AttributeValue } XmlState; -void _al_xml_parse(ALLEGRO_FILE *f, +void _al_xml_parse(A5O_FILE *f, int (*callback)(XmlState state, char const *value, void *u), void *u); diff --git a/addons/image/CMakeLists.txt b/addons/image/CMakeLists.txt index ccfd54f07c..aceee2d9b9 100644 --- a/addons/image/CMakeLists.txt +++ b/addons/image/CMakeLists.txt @@ -21,15 +21,15 @@ function(image_summary msg yesno) set(IMAGE_CONFIGURATION_SUMMARY "${IMAGE_CONFIGURATION_SUMMARY}${msg}: ${yesno}\n" PARENT_SCOPE) endfunction() -# ALLEGRO_CFG_IIO_HAVE_* are the available libraries. -# ALLEGRO_CFG_IIO_SUPPORT_* are the supported formats. +# A5O_CFG_IIO_HAVE_* are the available libraries. +# A5O_CFG_IIO_SUPPORT_* are the supported formats. # First look for native libraries and mark any supported image # type as found, so that the associated third party libraries # don't need to be used. if(WANT_NATIVE_IMAGE_LOADER) - set(ALLEGRO_CFG_WANT_NATIVE_IMAGE_LOADER 1) + set(A5O_CFG_WANT_NATIVE_IMAGE_LOADER 1) if(WIN32) find_package(GDIPLUS) @@ -55,10 +55,10 @@ if(WANT_NATIVE_IMAGE_LOADER) SUPPORT_GDIPLUS) endif(GDIPLUS_FOUND) if(SUPPORT_GDIPLUS) - set(ALLEGRO_CFG_IIO_HAVE_GDIPLUS 1) - set(ALLEGRO_CFG_IIO_HAVE_GDIPLUS_LOWERCASE_H ${GDIPLUS_LOWERCASE}) - set(ALLEGRO_CFG_IIO_SUPPORT_PNG 1) - set(ALLEGRO_CFG_IIO_SUPPORT_JPG 1) + set(A5O_CFG_IIO_HAVE_GDIPLUS 1) + set(A5O_CFG_IIO_HAVE_GDIPLUS_LOWERCASE_H ${GDIPLUS_LOWERCASE}) + set(A5O_CFG_IIO_SUPPORT_PNG 1) + set(A5O_CFG_IIO_SUPPORT_JPG 1) list(APPEND IMAGE_SOURCES gdiplus.cpp) list(APPEND IMAGE_LIBRARIES ${GDIPLUS_LIBRARIES}) if(MINGW) @@ -72,17 +72,17 @@ if(WANT_NATIVE_IMAGE_LOADER) endif(SUPPORT_GDIPLUS) endif(WIN32) - if (ALLEGRO_MACOSX) - set(ALLEGRO_CFG_IIO_SUPPORT_PNG 1) - set(ALLEGRO_CFG_IIO_SUPPORT_JPG 1) + if (A5O_MACOSX) + set(A5O_CFG_IIO_SUPPORT_PNG 1) + set(A5O_CFG_IIO_SUPPORT_JPG 1) list(APPEND IMAGE_SOURCES macosx.m) - endif(ALLEGRO_MACOSX) + endif(A5O_MACOSX) if(ANDROID) - set(ALLEGRO_CFG_IIO_HAVE_ANDROID 1) - set(ALLEGRO_CFG_IIO_SUPPORT_JPG 1) - set(ALLEGRO_CFG_IIO_SUPPORT_PNG 1) - set(ALLEGRO_CFG_IIO_SUPPORT_WEBP 1) + set(A5O_CFG_IIO_HAVE_ANDROID 1) + set(A5O_CFG_IIO_SUPPORT_JPG 1) + set(A5O_CFG_IIO_SUPPORT_PNG 1) + set(A5O_CFG_IIO_SUPPORT_WEBP 1) list(APPEND IMAGE_SOURCES android.c) endif(ANDROID) @@ -102,8 +102,8 @@ if(WANT_IMAGE_FREEIMAGE) find_package(FreeImage) if(FREEIMAGE_FOUND) # HAVE_FREEIMAGE means libfreeimage is available (and should be used) - set(ALLEGRO_CFG_IIO_HAVE_FREEIMAGE 1) - set(ALLEGRO_CFG_IIO_SUPPORT_FREEIMAGE 1) + set(A5O_CFG_IIO_HAVE_FREEIMAGE 1) + set(A5O_CFG_IIO_SUPPORT_FREEIMAGE 1) list(APPEND IMAGE_SOURCES freeimage.c) list(APPEND IMAGE_LIBRARIES ${FREEIMAGE_LIBRARIES}) list(APPEND IMAGE_DEFINES ${FREEIMAGE_DEFINITIONS}) @@ -114,14 +114,14 @@ if(WANT_IMAGE_FREEIMAGE) endif(FREEIMAGE_FOUND) endif(WANT_IMAGE_FREEIMAGE) -image_summary(" - FreeImage" ALLEGRO_CFG_IIO_SUPPORT_FREEIMAGE) +image_summary(" - FreeImage" A5O_CFG_IIO_SUPPORT_FREEIMAGE) -if(WANT_IMAGE_PNG AND NOT ALLEGRO_CFG_IIO_SUPPORT_PNG) +if(WANT_IMAGE_PNG AND NOT A5O_CFG_IIO_SUPPORT_PNG) find_package(PNG) if(PNG_FOUND) # HAVE_PNG means libpng is available (and should be used) - set(ALLEGRO_CFG_IIO_HAVE_PNG 1) - set(ALLEGRO_CFG_IIO_SUPPORT_PNG 1) + set(A5O_CFG_IIO_HAVE_PNG 1) + set(A5O_CFG_IIO_SUPPORT_PNG 1) list(APPEND IMAGE_SOURCES png.c) list(APPEND IMAGE_LIBRARIES ${PNG_LIBRARIES}) list(APPEND IMAGE_DEFINES ${PNG_DEFINITIONS}) @@ -130,11 +130,11 @@ if(WANT_IMAGE_PNG AND NOT ALLEGRO_CFG_IIO_SUPPORT_PNG) else(PNG_FOUND) message("WARNING: libpng not found, disabling support") endif(PNG_FOUND) -endif(WANT_IMAGE_PNG AND NOT ALLEGRO_CFG_IIO_SUPPORT_PNG) +endif(WANT_IMAGE_PNG AND NOT A5O_CFG_IIO_SUPPORT_PNG) image_summary(" - libpng" PNG_FOUND) -if(WANT_IMAGE_JPG AND NOT ALLEGRO_CFG_IIO_SUPPORT_JPG) +if(WANT_IMAGE_JPG AND NOT A5O_CFG_IIO_SUPPORT_JPG) find_package(JPEG) if(JPEG_FOUND AND MINGW) set(CMAKE_REQUIRED_INCLUDES ${JPEG_INCLUDE_DIR}) @@ -154,8 +154,8 @@ if(WANT_IMAGE_JPG AND NOT ALLEGRO_CFG_IIO_SUPPORT_JPG) endif() if(SUPPORT_JPEG) # HAVE_JPG means libjpeg is available (and should be used) - set(ALLEGRO_CFG_IIO_HAVE_JPG 1) - set(ALLEGRO_CFG_IIO_SUPPORT_JPG 1) + set(A5O_CFG_IIO_HAVE_JPG 1) + set(A5O_CFG_IIO_SUPPORT_JPG 1) list(APPEND IMAGE_SOURCES jpg.c) list(APPEND IMAGE_LIBRARIES ${JPEG_LIBRARIES}) list(APPEND IMAGE_DEFINES ${JPEG_DEFINITIONS}) @@ -170,15 +170,15 @@ if(WANT_IMAGE_JPG AND NOT ALLEGRO_CFG_IIO_SUPPORT_JPG) message("WARNING: libjpeg not found, disabling support") endif() endif() -endif(WANT_IMAGE_JPG AND NOT ALLEGRO_CFG_IIO_SUPPORT_JPG) +endif(WANT_IMAGE_JPG AND NOT A5O_CFG_IIO_SUPPORT_JPG) image_summary(" - libjpeg" SUPPORT_JPEG) -if(WANT_IMAGE_WEBP AND NOT ALLEGRO_CFG_IIO_SUPPORT_WEBP) +if(WANT_IMAGE_WEBP AND NOT A5O_CFG_IIO_SUPPORT_WEBP) find_package(WebP) if(WEBP_FOUND) - set(ALLEGRO_CFG_IIO_HAVE_WEBP 1) - set(ALLEGRO_CFG_IIO_SUPPORT_WEBP 1) + set(A5O_CFG_IIO_HAVE_WEBP 1) + set(A5O_CFG_IIO_SUPPORT_WEBP 1) list(APPEND IMAGE_SOURCES webp.c) list(APPEND IMAGE_LIBRARIES ${WEBP_LIBRARIES}) list(APPEND IMAGE_INCLUDE_DIRECTORIES ${WEBP_INCLUDE_DIRS}) @@ -186,7 +186,7 @@ if(WANT_IMAGE_WEBP AND NOT ALLEGRO_CFG_IIO_SUPPORT_WEBP) else(WEBP_FOUND) message("WARNING: libwebp not found, disabling support") endif(WEBP_FOUND) -endif(WANT_IMAGE_WEBP AND NOT ALLEGRO_CFG_IIO_SUPPORT_WEBP) +endif(WANT_IMAGE_WEBP AND NOT A5O_CFG_IIO_SUPPORT_WEBP) image_summary(" - libwebp" WEBP_FOUND) @@ -196,10 +196,10 @@ configure_file( ) add_our_addon_library(allegro_image - AllegroImage-${ALLEGRO_SOVERSION} + AllegroImage-${A5O_SOVERSION} "${IMAGE_SOURCES};${IMAGE_INCLUDE_FILES}" - "-DALLEGRO_IIO_SRC" - "${ALLEGRO_LINK_WITH};${IMAGE_LIBRARIES}" + "-DA5O_IIO_SRC" + "${A5O_LINK_WITH};${IMAGE_LIBRARIES}" ) install_our_headers(${IMAGE_INCLUDE_FILES}) diff --git a/addons/image/allegro5/allegro_image.h b/addons/image/allegro5/allegro_image.h index 3a853277de..111ea72fec 100644 --- a/addons/image/allegro5/allegro_image.h +++ b/addons/image/allegro5/allegro_image.h @@ -3,26 +3,26 @@ #include "allegro5/base.h" -#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32) - #ifndef ALLEGRO_STATICLINK - #ifdef ALLEGRO_IIO_SRC - #define _ALLEGRO_IIO_DLL __declspec(dllexport) +#if (defined A5O_MINGW32) || (defined A5O_MSVC) || (defined A5O_BCC32) + #ifndef A5O_STATICLINK + #ifdef A5O_IIO_SRC + #define _A5O_IIO_DLL __declspec(dllexport) #else - #define _ALLEGRO_IIO_DLL __declspec(dllimport) + #define _A5O_IIO_DLL __declspec(dllimport) #endif #else - #define _ALLEGRO_IIO_DLL + #define _A5O_IIO_DLL #endif #endif -#if defined ALLEGRO_MSVC - #define ALLEGRO_IIO_FUNC(type, name, args) _ALLEGRO_IIO_DLL type __cdecl name args -#elif defined ALLEGRO_MINGW32 - #define ALLEGRO_IIO_FUNC(type, name, args) extern type name args -#elif defined ALLEGRO_BCC32 - #define ALLEGRO_IIO_FUNC(type, name, args) extern _ALLEGRO_IIO_DLL type name args +#if defined A5O_MSVC + #define A5O_IIO_FUNC(type, name, args) _A5O_IIO_DLL type __cdecl name args +#elif defined A5O_MINGW32 + #define A5O_IIO_FUNC(type, name, args) extern type name args +#elif defined A5O_BCC32 + #define A5O_IIO_FUNC(type, name, args) extern _A5O_IIO_DLL type name args #else - #define ALLEGRO_IIO_FUNC AL_FUNC + #define A5O_IIO_FUNC AL_FUNC #endif @@ -31,10 +31,10 @@ extern "C" { #endif -ALLEGRO_IIO_FUNC(bool, al_init_image_addon, (void)); -ALLEGRO_IIO_FUNC(bool, al_is_image_addon_initialized, (void)); -ALLEGRO_IIO_FUNC(void, al_shutdown_image_addon, (void)); -ALLEGRO_IIO_FUNC(uint32_t, al_get_allegro_image_version, (void)); +A5O_IIO_FUNC(bool, al_init_image_addon, (void)); +A5O_IIO_FUNC(bool, al_is_image_addon_initialized, (void)); +A5O_IIO_FUNC(void, al_shutdown_image_addon, (void)); +A5O_IIO_FUNC(uint32_t, al_get_allegro_image_version, (void)); #ifdef __cplusplus diff --git a/addons/image/allegro5/internal/aintern_image.h b/addons/image/allegro5/internal/aintern_image.h index e635494115..271ccb86fa 100644 --- a/addons/image/allegro5/internal/aintern_image.h +++ b/addons/image/allegro5/internal/aintern_image.h @@ -9,92 +9,92 @@ extern "C" { #endif -#ifdef ALLEGRO_CFG_WANT_NATIVE_IMAGE_LOADER +#ifdef A5O_CFG_WANT_NATIVE_IMAGE_LOADER -#ifdef ALLEGRO_IPHONE -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_iphone_load_image, (const char *filename, int flags)); -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_iphone_load_image_f, (ALLEGRO_FILE *f, int flags)); +#ifdef A5O_IPHONE +A5O_IIO_FUNC(A5O_BITMAP *, _al_iphone_load_image, (const char *filename, int flags)); +A5O_IIO_FUNC(A5O_BITMAP *, _al_iphone_load_image_f, (A5O_FILE *f, int flags)); #endif -#ifdef ALLEGRO_MACOSX -ALLEGRO_IIO_FUNC(bool, _al_osx_register_image_loader, (void)); +#ifdef A5O_MACOSX +A5O_IIO_FUNC(bool, _al_osx_register_image_loader, (void)); #endif #endif -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_pcx, (const char *filename, int flags)); -ALLEGRO_IIO_FUNC(bool, _al_save_pcx, (const char *filename, ALLEGRO_BITMAP *bmp)); -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_pcx_f, (ALLEGRO_FILE *f, int flags)); -ALLEGRO_IIO_FUNC(bool, _al_save_pcx_f, (ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp)); -ALLEGRO_IIO_FUNC(bool, _al_identify_pcx, (ALLEGRO_FILE *f)); - -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_bmp, (const char *filename, int flags)); -ALLEGRO_IIO_FUNC(bool, _al_save_bmp, (const char *filename, ALLEGRO_BITMAP *bmp)); -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_bmp_f, (ALLEGRO_FILE *f, int flags)); -ALLEGRO_IIO_FUNC(bool, _al_save_bmp_f, (ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp)); -ALLEGRO_IIO_FUNC(bool, _al_identify_bmp, (ALLEGRO_FILE *f)); - - -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_tga, (const char *filename, int flags)); -ALLEGRO_IIO_FUNC(bool, _al_save_tga, (const char *filename, ALLEGRO_BITMAP *bmp)); -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_tga_f, (ALLEGRO_FILE *f, int flags)); -ALLEGRO_IIO_FUNC(bool, _al_save_tga_f, (ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp)); -ALLEGRO_IIO_FUNC(bool, _al_identify_tga, (ALLEGRO_FILE *f)); - -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_dds, (const char *filename, int flags)); -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_dds_f, (ALLEGRO_FILE *f, int flags)); -ALLEGRO_IIO_FUNC(bool, _al_identify_dds, (ALLEGRO_FILE *f)); - -ALLEGRO_IIO_FUNC(bool, _al_identify_png, (ALLEGRO_FILE *f)); -ALLEGRO_IIO_FUNC(bool, _al_identify_jpg, (ALLEGRO_FILE *f)); -ALLEGRO_IIO_FUNC(bool, _al_identify_webp, (ALLEGRO_FILE *f)); - -#ifdef ALLEGRO_CFG_IIO_HAVE_FREEIMAGE -ALLEGRO_IIO_FUNC(bool, _al_init_fi, (void)); -ALLEGRO_IIO_FUNC(void, _al_shutdown_fi, (void)); -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_fi_bitmap, (const char *filename, int flags)); -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_fi_bitmap_f, (ALLEGRO_FILE *f, int flags)); -ALLEGRO_IIO_FUNC(bool, _al_identify_fi, (ALLEGRO_FILE *f)); +A5O_IIO_FUNC(A5O_BITMAP *, _al_load_pcx, (const char *filename, int flags)); +A5O_IIO_FUNC(bool, _al_save_pcx, (const char *filename, A5O_BITMAP *bmp)); +A5O_IIO_FUNC(A5O_BITMAP *, _al_load_pcx_f, (A5O_FILE *f, int flags)); +A5O_IIO_FUNC(bool, _al_save_pcx_f, (A5O_FILE *f, A5O_BITMAP *bmp)); +A5O_IIO_FUNC(bool, _al_identify_pcx, (A5O_FILE *f)); + +A5O_IIO_FUNC(A5O_BITMAP *, _al_load_bmp, (const char *filename, int flags)); +A5O_IIO_FUNC(bool, _al_save_bmp, (const char *filename, A5O_BITMAP *bmp)); +A5O_IIO_FUNC(A5O_BITMAP *, _al_load_bmp_f, (A5O_FILE *f, int flags)); +A5O_IIO_FUNC(bool, _al_save_bmp_f, (A5O_FILE *f, A5O_BITMAP *bmp)); +A5O_IIO_FUNC(bool, _al_identify_bmp, (A5O_FILE *f)); + + +A5O_IIO_FUNC(A5O_BITMAP *, _al_load_tga, (const char *filename, int flags)); +A5O_IIO_FUNC(bool, _al_save_tga, (const char *filename, A5O_BITMAP *bmp)); +A5O_IIO_FUNC(A5O_BITMAP *, _al_load_tga_f, (A5O_FILE *f, int flags)); +A5O_IIO_FUNC(bool, _al_save_tga_f, (A5O_FILE *f, A5O_BITMAP *bmp)); +A5O_IIO_FUNC(bool, _al_identify_tga, (A5O_FILE *f)); + +A5O_IIO_FUNC(A5O_BITMAP *, _al_load_dds, (const char *filename, int flags)); +A5O_IIO_FUNC(A5O_BITMAP *, _al_load_dds_f, (A5O_FILE *f, int flags)); +A5O_IIO_FUNC(bool, _al_identify_dds, (A5O_FILE *f)); + +A5O_IIO_FUNC(bool, _al_identify_png, (A5O_FILE *f)); +A5O_IIO_FUNC(bool, _al_identify_jpg, (A5O_FILE *f)); +A5O_IIO_FUNC(bool, _al_identify_webp, (A5O_FILE *f)); + +#ifdef A5O_CFG_IIO_HAVE_FREEIMAGE +A5O_IIO_FUNC(bool, _al_init_fi, (void)); +A5O_IIO_FUNC(void, _al_shutdown_fi, (void)); +A5O_IIO_FUNC(A5O_BITMAP *, _al_load_fi_bitmap, (const char *filename, int flags)); +A5O_IIO_FUNC(A5O_BITMAP *, _al_load_fi_bitmap_f, (A5O_FILE *f, int flags)); +A5O_IIO_FUNC(bool, _al_identify_fi, (A5O_FILE *f)); #endif -#ifdef ALLEGRO_CFG_IIO_HAVE_GDIPLUS -ALLEGRO_IIO_FUNC(bool, _al_init_gdiplus, (void)); -ALLEGRO_IIO_FUNC(void, _al_shutdown_gdiplus, (void)); -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_gdiplus_bitmap, (const char *filename, int flags)); -ALLEGRO_IIO_FUNC(bool, _al_save_gdiplus_bitmap, (const char *filename, ALLEGRO_BITMAP *bmp)); -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_gdiplus_bitmap_f, (ALLEGRO_FILE *f, int flags)); -ALLEGRO_IIO_FUNC(bool, _al_save_gdiplus_png_f, (ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp)); -ALLEGRO_IIO_FUNC(bool, _al_save_gdiplus_jpg_f, (ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp)); -ALLEGRO_IIO_FUNC(bool, _al_save_gdiplus_tif_f, (ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp)); -ALLEGRO_IIO_FUNC(bool, _al_save_gdiplus_gif_f, (ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp)); +#ifdef A5O_CFG_IIO_HAVE_GDIPLUS +A5O_IIO_FUNC(bool, _al_init_gdiplus, (void)); +A5O_IIO_FUNC(void, _al_shutdown_gdiplus, (void)); +A5O_IIO_FUNC(A5O_BITMAP *, _al_load_gdiplus_bitmap, (const char *filename, int flags)); +A5O_IIO_FUNC(bool, _al_save_gdiplus_bitmap, (const char *filename, A5O_BITMAP *bmp)); +A5O_IIO_FUNC(A5O_BITMAP *, _al_load_gdiplus_bitmap_f, (A5O_FILE *f, int flags)); +A5O_IIO_FUNC(bool, _al_save_gdiplus_png_f, (A5O_FILE *f, A5O_BITMAP *bmp)); +A5O_IIO_FUNC(bool, _al_save_gdiplus_jpg_f, (A5O_FILE *f, A5O_BITMAP *bmp)); +A5O_IIO_FUNC(bool, _al_save_gdiplus_tif_f, (A5O_FILE *f, A5O_BITMAP *bmp)); +A5O_IIO_FUNC(bool, _al_save_gdiplus_gif_f, (A5O_FILE *f, A5O_BITMAP *bmp)); #endif -#ifdef ALLEGRO_CFG_IIO_HAVE_ANDROID -ALLEGRO_BITMAP *_al_load_android_bitmap_f(ALLEGRO_FILE *fp, int flags); -ALLEGRO_BITMAP *_al_load_android_bitmap(const char *filename, int flags); +#ifdef A5O_CFG_IIO_HAVE_ANDROID +A5O_BITMAP *_al_load_android_bitmap_f(A5O_FILE *fp, int flags); +A5O_BITMAP *_al_load_android_bitmap(const char *filename, int flags); #endif -/* ALLEGRO_CFG_IIO_HAVE_PNG/JPG implies that "native" loaders aren't available. */ +/* A5O_CFG_IIO_HAVE_PNG/JPG implies that "native" loaders aren't available. */ -#ifdef ALLEGRO_CFG_IIO_HAVE_PNG -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_png, (const char *filename, int flags)); -ALLEGRO_IIO_FUNC(bool, _al_save_png, (const char *filename, ALLEGRO_BITMAP *bmp)); -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_png_f, (ALLEGRO_FILE *f, int flags)); -ALLEGRO_IIO_FUNC(bool, _al_save_png_f, (ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp)); +#ifdef A5O_CFG_IIO_HAVE_PNG +A5O_IIO_FUNC(A5O_BITMAP *, _al_load_png, (const char *filename, int flags)); +A5O_IIO_FUNC(bool, _al_save_png, (const char *filename, A5O_BITMAP *bmp)); +A5O_IIO_FUNC(A5O_BITMAP *, _al_load_png_f, (A5O_FILE *f, int flags)); +A5O_IIO_FUNC(bool, _al_save_png_f, (A5O_FILE *f, A5O_BITMAP *bmp)); #endif -#ifdef ALLEGRO_CFG_IIO_HAVE_JPG -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_jpg, (const char *filename, int flags)); -ALLEGRO_IIO_FUNC(bool, _al_save_jpg, (const char *filename, ALLEGRO_BITMAP *bmp)); -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_jpg_f, (ALLEGRO_FILE *f, int flags)); -ALLEGRO_IIO_FUNC(bool, _al_save_jpg_f, (ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp)); +#ifdef A5O_CFG_IIO_HAVE_JPG +A5O_IIO_FUNC(A5O_BITMAP *, _al_load_jpg, (const char *filename, int flags)); +A5O_IIO_FUNC(bool, _al_save_jpg, (const char *filename, A5O_BITMAP *bmp)); +A5O_IIO_FUNC(A5O_BITMAP *, _al_load_jpg_f, (A5O_FILE *f, int flags)); +A5O_IIO_FUNC(bool, _al_save_jpg_f, (A5O_FILE *f, A5O_BITMAP *bmp)); #endif -#ifdef ALLEGRO_CFG_IIO_HAVE_WEBP -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_webp, (const char *filename, int flags)); -ALLEGRO_IIO_FUNC(bool, _al_save_webp, (const char *filename, ALLEGRO_BITMAP *bmp)); -ALLEGRO_IIO_FUNC(ALLEGRO_BITMAP *, _al_load_webp_f, (ALLEGRO_FILE *f, int flags)); -ALLEGRO_IIO_FUNC(bool, _al_save_webp_f, (ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp)); +#ifdef A5O_CFG_IIO_HAVE_WEBP +A5O_IIO_FUNC(A5O_BITMAP *, _al_load_webp, (const char *filename, int flags)); +A5O_IIO_FUNC(bool, _al_save_webp, (const char *filename, A5O_BITMAP *bmp)); +A5O_IIO_FUNC(A5O_BITMAP *, _al_load_webp_f, (A5O_FILE *f, int flags)); +A5O_IIO_FUNC(bool, _al_save_webp_f, (A5O_FILE *f, A5O_BITMAP *bmp)); #endif #ifdef __cplusplus diff --git a/addons/image/allegro5/internal/aintern_image_cfg.h.cmake b/addons/image/allegro5/internal/aintern_image_cfg.h.cmake index 0e95ff5b95..9aa6b0dd89 100644 --- a/addons/image/allegro5/internal/aintern_image_cfg.h.cmake +++ b/addons/image/allegro5/internal/aintern_image_cfg.h.cmake @@ -1,15 +1,15 @@ -#cmakedefine ALLEGRO_CFG_WANT_NATIVE_IMAGE_LOADER +#cmakedefine A5O_CFG_WANT_NATIVE_IMAGE_LOADER /* which libraries are present and needed? */ -#cmakedefine ALLEGRO_CFG_IIO_HAVE_FREEIMAGE -#cmakedefine ALLEGRO_CFG_IIO_HAVE_GDIPLUS -#cmakedefine ALLEGRO_CFG_IIO_HAVE_GDIPLUS_LOWERCASE_H -#cmakedefine ALLEGRO_CFG_IIO_HAVE_ANDROID -#cmakedefine ALLEGRO_CFG_IIO_HAVE_PNG -#cmakedefine ALLEGRO_CFG_IIO_HAVE_JPG -#cmakedefine ALLEGRO_CFG_IIO_HAVE_WEBP +#cmakedefine A5O_CFG_IIO_HAVE_FREEIMAGE +#cmakedefine A5O_CFG_IIO_HAVE_GDIPLUS +#cmakedefine A5O_CFG_IIO_HAVE_GDIPLUS_LOWERCASE_H +#cmakedefine A5O_CFG_IIO_HAVE_ANDROID +#cmakedefine A5O_CFG_IIO_HAVE_PNG +#cmakedefine A5O_CFG_IIO_HAVE_JPG +#cmakedefine A5O_CFG_IIO_HAVE_WEBP /* which formats are supported and wanted? */ -#cmakedefine ALLEGRO_CFG_IIO_SUPPORT_PNG -#cmakedefine ALLEGRO_CFG_IIO_SUPPORT_JPG -#cmakedefine ALLEGRO_CFG_IIO_SUPPORT_WEBP +#cmakedefine A5O_CFG_IIO_SUPPORT_PNG +#cmakedefine A5O_CFG_IIO_SUPPORT_JPG +#cmakedefine A5O_CFG_IIO_SUPPORT_WEBP diff --git a/addons/image/android.c b/addons/image/android.c index bf057535e2..dfa0448e48 100644 --- a/addons/image/android.c +++ b/addons/image/android.c @@ -3,12 +3,12 @@ #include "allegro5/internal/aintern_android.h" #include "allegro5/internal/aintern_image.h" -ALLEGRO_BITMAP *_al_load_android_bitmap_f(ALLEGRO_FILE *fp, int flags) +A5O_BITMAP *_al_load_android_bitmap_f(A5O_FILE *fp, int flags) { return _al_android_load_image_f(fp, flags); } -ALLEGRO_BITMAP *_al_load_android_bitmap(const char *filename, int flags) +A5O_BITMAP *_al_load_android_bitmap(const char *filename, int flags) { return _al_android_load_image(filename, flags); } diff --git a/addons/image/bmp.c b/addons/image/bmp.c index 03f21820c1..319c77aaaa 100644 --- a/addons/image/bmp.c +++ b/addons/image/bmp.c @@ -27,7 +27,7 @@ #include "iio.h" -ALLEGRO_DEBUG_CHANNEL("image") +A5O_DEBUG_CHANNEL("image") /* Do NOT simplify this to just (x), it doesn't work in MSVC. */ #define INT_TO_BOOL(x) ((x) != 0) @@ -97,7 +97,7 @@ typedef struct OS2BMPINFOHEADER } OS2BMPINFOHEADER; -typedef void(*bmp_line_fn)(ALLEGRO_FILE *f, char *buf, char *data, +typedef void(*bmp_line_fn)(A5O_FILE *f, char *buf, char *data, int length, bool premul); @@ -105,7 +105,7 @@ typedef void(*bmp_line_fn)(ALLEGRO_FILE *f, char *buf, char *data, /* read_bmfileheader: * Reads a BMP file header and check that it has the BMP magic number. */ -static int read_bmfileheader(ALLEGRO_FILE *f, BMPFILEHEADER *fileheader) +static int read_bmfileheader(A5O_FILE *f, BMPFILEHEADER *fileheader) { fileheader->bfType = (uint16_t)al_fread16le(f); fileheader->bfSize = (uint32_t)al_fread32le(f); @@ -114,12 +114,12 @@ static int read_bmfileheader(ALLEGRO_FILE *f, BMPFILEHEADER *fileheader) fileheader->bfOffBits = (uint32_t)al_fread32le(f); if (fileheader->bfType != 0x4D42) { - ALLEGRO_WARN("Not BMP format\n"); + A5O_WARN("Not BMP format\n"); return -1; } if (al_feof(f) || al_ferror(f)) { - ALLEGRO_ERROR("Failed to read file header\n"); + A5O_ERROR("Failed to read file header\n"); return -1; } @@ -131,7 +131,7 @@ static int read_bmfileheader(ALLEGRO_FILE *f, BMPFILEHEADER *fileheader) /* read_win_bminfoheader: * Reads information from a BMP file header. */ -static int read_win_bminfoheader(ALLEGRO_FILE *f, BMPINFOHEADER *infoheader) +static int read_win_bminfoheader(A5O_FILE *f, BMPINFOHEADER *infoheader) { WINBMPINFOHEADER win_infoheader; @@ -153,7 +153,7 @@ static int read_win_bminfoheader(ALLEGRO_FILE *f, BMPINFOHEADER *infoheader) infoheader->biClrUsed = win_infoheader.biClrUsed; if (al_feof(f) || al_ferror(f)) { - ALLEGRO_ERROR("Failed to read file header\n"); + A5O_ERROR("Failed to read file header\n"); return -1; } @@ -165,7 +165,7 @@ static int read_win_bminfoheader(ALLEGRO_FILE *f, BMPINFOHEADER *infoheader) /* read_os2_bminfoheader: * Reads information from an OS/2 format BMP file header. */ -static int read_os2_bminfoheader(ALLEGRO_FILE *f, BMPINFOHEADER *infoheader) +static int read_os2_bminfoheader(A5O_FILE *f, BMPINFOHEADER *infoheader) { OS2BMPINFOHEADER os2_infoheader; @@ -181,7 +181,7 @@ static int read_os2_bminfoheader(ALLEGRO_FILE *f, BMPINFOHEADER *infoheader) infoheader->biClrUsed = 0; /* default */ if (al_feof(f) || al_ferror(f)) { - ALLEGRO_ERROR("Failed to read file header\n"); + A5O_ERROR("Failed to read file header\n"); return -1; } @@ -224,13 +224,13 @@ static void decode_bitfield(uint32_t m, int *shift_out, uint32_t *mask_out) * OS/2 bitmaps take 3 bytes per color. * Windows bitmaps take 4 bytes per color. */ -static void read_palette(int ncolors, PalEntry *pal, ALLEGRO_FILE *f, +static void read_palette(int ncolors, PalEntry *pal, A5O_FILE *f, int flags, const BMPINFOHEADER *infoheader, int win_flag) { int i; unsigned char c[3]; uint32_t r, g, b, a; - bool premul = !(flags & ALLEGRO_NO_PREMULTIPLIED_ALPHA); + bool premul = !(flags & A5O_NO_PREMULTIPLIED_ALPHA); int as; uint32_t am; @@ -311,7 +311,7 @@ static uint32_t read_32le(void *buf) /* read_1bit_line: * Support function for reading the 1 bit bitmap file format. */ -static void read_1bit_line(ALLEGRO_FILE *f, char *buf, char *data, +static void read_1bit_line(A5O_FILE *f, char *buf, char *data, int length, bool premul) { int i, j; @@ -337,7 +337,7 @@ static void read_1bit_line(ALLEGRO_FILE *f, char *buf, char *data, /* read_2bit_line: * Support function for reading the 2 bit bitmap file format. */ -static void read_2bit_line(ALLEGRO_FILE *f, char *buf, char *data, +static void read_2bit_line(A5O_FILE *f, char *buf, char *data, int length, bool premul) { int i; @@ -364,7 +364,7 @@ static void read_2bit_line(ALLEGRO_FILE *f, char *buf, char *data, /* read_4bit_line: * Support function for reading the 4 bit bitmap file format. */ -static void read_4bit_line(ALLEGRO_FILE *f, char *buf, char *data, +static void read_4bit_line(A5O_FILE *f, char *buf, char *data, int length, bool premul) { int i; @@ -389,7 +389,7 @@ static void read_4bit_line(ALLEGRO_FILE *f, char *buf, char *data, /* read_8bit_line: * Support function for reading the 8 bit bitmap file format. */ -static void read_8bit_line(ALLEGRO_FILE *f, char *buf, char *data, +static void read_8bit_line(A5O_FILE *f, char *buf, char *data, int length, bool premul) { size_t bytes_wanted = (length + 3) & ~3; @@ -406,7 +406,7 @@ static void read_8bit_line(ALLEGRO_FILE *f, char *buf, char *data, /* read_16_rgb_555_line: * Support function for reading the 16 bit / RGB555 bitmap file format. */ -static void read_16_rgb_555_line(ALLEGRO_FILE *f, char *buf, char *data, +static void read_16_rgb_555_line(A5O_FILE *f, char *buf, char *data, int length, bool premul) { int i; @@ -420,7 +420,7 @@ static void read_16_rgb_555_line(ALLEGRO_FILE *f, char *buf, char *data, for (i = 0; i < length; ++i) { uint16_t pixel = read_16le(buf + i*2); - data32[i] = ALLEGRO_CONVERT_RGB_555_TO_ABGR_8888_LE(pixel); + data32[i] = A5O_CONVERT_RGB_555_TO_ABGR_8888_LE(pixel); } } @@ -429,7 +429,7 @@ static void read_16_rgb_555_line(ALLEGRO_FILE *f, char *buf, char *data, /* read_16_argb_1555_line: * Support function for reading the 16 bit / ARGB1555 bitmap file format. */ -static void read_16_argb_1555_line(ALLEGRO_FILE *f, char *buf, char *data, +static void read_16_argb_1555_line(A5O_FILE *f, char *buf, char *data, int length, bool premul) { int i; @@ -441,7 +441,7 @@ static void read_16_argb_1555_line(ALLEGRO_FILE *f, char *buf, char *data, for (i = 0; i < length; ++i) { uint16_t pixel = read_16le(buf + i*2); - data32[i] = ALLEGRO_CONVERT_ARGB_1555_TO_ABGR_8888_LE(pixel); + data32[i] = A5O_CONVERT_ARGB_1555_TO_ABGR_8888_LE(pixel); if (premul && (pixel & 0x8000)) data32[i] = 0; @@ -453,7 +453,7 @@ static void read_16_argb_1555_line(ALLEGRO_FILE *f, char *buf, char *data, /* read_16_rgb_565_line: * Support function for reading the 16 bit / RGB565 bitmap file format. */ -static void read_16_rgb_565_line(ALLEGRO_FILE *f, char *buf, char *data, +static void read_16_rgb_565_line(A5O_FILE *f, char *buf, char *data, int length, bool premul) { int i; @@ -467,7 +467,7 @@ static void read_16_rgb_565_line(ALLEGRO_FILE *f, char *buf, char *data, for (i = 0; i < length; i++) { uint16_t pixel = read_16le(buf + i*2); - data32[i] = ALLEGRO_CONVERT_RGB_565_TO_ABGR_8888_LE(pixel); + data32[i] = A5O_CONVERT_RGB_565_TO_ABGR_8888_LE(pixel); } } @@ -476,7 +476,7 @@ static void read_16_rgb_565_line(ALLEGRO_FILE *f, char *buf, char *data, /* read_24_rgb_888_line: * Support function for reading the 24 bit / RGB888 bitmap file format. */ -static void read_24_rgb_888_line(ALLEGRO_FILE *f, char *buf, char *data, +static void read_24_rgb_888_line(A5O_FILE *f, char *buf, char *data, int length, bool premul) { int bi, i; @@ -499,17 +499,17 @@ static void read_24_rgb_888_line(ALLEGRO_FILE *f, char *buf, char *data, uint32_t y = (b >> 16) | (c << 16); uint32_t z = (c >> 8); - data32[i] = ALLEGRO_CONVERT_RGB_888_TO_ABGR_8888_LE(w); - data32[i+1] = ALLEGRO_CONVERT_RGB_888_TO_ABGR_8888_LE(x); - data32[i+2] = ALLEGRO_CONVERT_RGB_888_TO_ABGR_8888_LE(y); - data32[i+3] = ALLEGRO_CONVERT_RGB_888_TO_ABGR_8888_LE(z); + data32[i] = A5O_CONVERT_RGB_888_TO_ABGR_8888_LE(w); + data32[i+1] = A5O_CONVERT_RGB_888_TO_ABGR_8888_LE(x); + data32[i+2] = A5O_CONVERT_RGB_888_TO_ABGR_8888_LE(y); + data32[i+3] = A5O_CONVERT_RGB_888_TO_ABGR_8888_LE(z); } bi *= 4; for (; i < length; i++, bi += 3) { uint32_t pixel = ucbuf[bi] | (ucbuf[bi+1] << 8) | (ucbuf[bi+2] << 16); - data32[i] = ALLEGRO_CONVERT_RGB_888_TO_ABGR_8888_LE(pixel); + data32[i] = A5O_CONVERT_RGB_888_TO_ABGR_8888_LE(pixel); } } @@ -518,7 +518,7 @@ static void read_24_rgb_888_line(ALLEGRO_FILE *f, char *buf, char *data, /* read_32_xrgb_8888_line: * Support function for reading the 32 bit / XRGB8888 bitmap file format. */ -static void read_32_xrgb_8888_line(ALLEGRO_FILE *f, char *buf, char *data, +static void read_32_xrgb_8888_line(A5O_FILE *f, char *buf, char *data, int length, bool premul) { int i; @@ -532,7 +532,7 @@ static void read_32_xrgb_8888_line(ALLEGRO_FILE *f, char *buf, char *data, for (i = 0; i < length; i++) { uint32_t pixel = read_32le(buf + i*4); - data32[i] = ALLEGRO_CONVERT_XRGB_8888_TO_ABGR_8888_LE(pixel); + data32[i] = A5O_CONVERT_XRGB_8888_TO_ABGR_8888_LE(pixel); } } @@ -541,7 +541,7 @@ static void read_32_xrgb_8888_line(ALLEGRO_FILE *f, char *buf, char *data, /* read_32_rgbx_8888_line: * Support function for reading the 32 bit / RGBX8888 bitmap file format. */ -static void read_32_rgbx_8888_line(ALLEGRO_FILE *f, char *buf, char *data, +static void read_32_rgbx_8888_line(A5O_FILE *f, char *buf, char *data, int length, bool premul) { int i; @@ -555,7 +555,7 @@ static void read_32_rgbx_8888_line(ALLEGRO_FILE *f, char *buf, char *data, for (i = 0; i < length; i++) { uint32_t pixel = read_32le(buf + i*4); - data32[i] = ALLEGRO_CONVERT_RGBX_8888_TO_ABGR_8888_LE(pixel); + data32[i] = A5O_CONVERT_RGBX_8888_TO_ABGR_8888_LE(pixel); } } @@ -564,7 +564,7 @@ static void read_32_rgbx_8888_line(ALLEGRO_FILE *f, char *buf, char *data, /* read_32_argb_8888_line: * Support function for reading the 32 bit / ARGB8888 bitmap file format. */ -static void read_32_argb_8888_line(ALLEGRO_FILE *f, char *buf, char *data, +static void read_32_argb_8888_line(A5O_FILE *f, char *buf, char *data, int length, bool premul) { int i; @@ -577,7 +577,7 @@ static void read_32_argb_8888_line(ALLEGRO_FILE *f, char *buf, char *data, for (i = 0; i < length; i++) { uint32_t pixel = read_32le(buf + i*4); uint32_t a = (pixel & 0xFF000000U) >> 24; - data32[i] = ALLEGRO_CONVERT_ARGB_8888_TO_ABGR_8888_LE(pixel); + data32[i] = A5O_CONVERT_ARGB_8888_TO_ABGR_8888_LE(pixel); if (premul && a != 255) { data[i*4+1] = data[i*4+1] * a / 255; @@ -592,7 +592,7 @@ static void read_32_argb_8888_line(ALLEGRO_FILE *f, char *buf, char *data, /* read_32_rgba_8888_line: * Support function for reading the 32 bit / RGBA8888 bitmap file format. */ -static void read_32_rgba_8888_line(ALLEGRO_FILE *f, char *buf, char *data, +static void read_32_rgba_8888_line(A5O_FILE *f, char *buf, char *data, int length, bool premul) { int i; @@ -605,7 +605,7 @@ static void read_32_rgba_8888_line(ALLEGRO_FILE *f, char *buf, char *data, for (i = 0; i < length; i++) { uint32_t pixel = read_32le(buf + i*4); uint32_t a = (pixel & 0x000000FFU); - data32[i] = ALLEGRO_CONVERT_RGBA_8888_TO_ABGR_8888_LE(pixel); + data32[i] = A5O_CONVERT_RGBA_8888_TO_ABGR_8888_LE(pixel); if (premul && a != 255) { data[i*4] = data[i*4] * a / 255; @@ -620,14 +620,14 @@ static void read_32_rgba_8888_line(ALLEGRO_FILE *f, char *buf, char *data, /* read_RGB_image: * For reading the standard BMP image format */ -static bool read_RGB_image(ALLEGRO_FILE *f, int flags, - const BMPINFOHEADER *infoheader, ALLEGRO_LOCKED_REGION *lr, +static bool read_RGB_image(A5O_FILE *f, int flags, + const BMPINFOHEADER *infoheader, A5O_LOCKED_REGION *lr, bmp_line_fn fn) { int i, line, height, width, dir; size_t linesize; char *linebuf; - bool premul = !(flags & ALLEGRO_NO_PREMULTIPLIED_ALPHA); + bool premul = !(flags & A5O_NO_PREMULTIPLIED_ALPHA); height = infoheader->biHeight; width = infoheader->biWidth; @@ -643,7 +643,7 @@ static bool read_RGB_image(ALLEGRO_FILE *f, int flags, linebuf = al_malloc(linesize); if (!linebuf) { - ALLEGRO_WARN("Failed to allocate pixel row buffer\n"); + A5O_WARN("Failed to allocate pixel row buffer\n"); return false; } @@ -664,8 +664,8 @@ static bool read_RGB_image(ALLEGRO_FILE *f, int flags, /* read_RGB_image_indices: * For reading the palette indices from BMP image format */ -static bool read_RGB_image_indices(ALLEGRO_FILE *f, int flags, - const BMPINFOHEADER *infoheader, ALLEGRO_LOCKED_REGION *lr, +static bool read_RGB_image_indices(A5O_FILE *f, int flags, + const BMPINFOHEADER *infoheader, A5O_LOCKED_REGION *lr, bmp_line_fn fn) { int i, line, height, width, dir; @@ -685,7 +685,7 @@ static bool read_RGB_image_indices(ALLEGRO_FILE *f, int flags, linebuf = al_malloc(linesize); if (!linebuf) { - ALLEGRO_WARN("Failed to allocate pixel row buffer\n"); + A5O_WARN("Failed to allocate pixel row buffer\n"); return false; } @@ -712,9 +712,9 @@ static bool read_RGB_image_indices(ALLEGRO_FILE *f, int flags, /* read_RGB_paletted_image: * For reading the standard palette mapped BMP image format */ -static bool read_RGB_paletted_image(ALLEGRO_FILE *f, int flags, +static bool read_RGB_paletted_image(A5O_FILE *f, int flags, const BMPINFOHEADER *infoheader, PalEntry* pal, - ALLEGRO_LOCKED_REGION *lr, bmp_line_fn fn) + A5O_LOCKED_REGION *lr, bmp_line_fn fn) { int i, j, line, height, width, dir; size_t linesize; @@ -736,7 +736,7 @@ static bool read_RGB_paletted_image(ALLEGRO_FILE *f, int flags, linebuf = al_malloc(linesize); if (!linebuf) { - ALLEGRO_WARN("Failed to allocate pixel row buffer\n"); + A5O_WARN("Failed to allocate pixel row buffer\n"); return false; } @@ -780,14 +780,14 @@ static void generate_scale_table(int* table, int entries) /* read_bitfields_image: * For reading the generic bitfield compressed BMP image format */ -static bool read_bitfields_image(ALLEGRO_FILE *f, int flags, - const BMPINFOHEADER *infoheader, ALLEGRO_LOCKED_REGION *lr) +static bool read_bitfields_image(A5O_FILE *f, int flags, + const BMPINFOHEADER *infoheader, A5O_LOCKED_REGION *lr) { int i, k, line, height, width, dir; size_t linesize, bytes_read; unsigned char *linebuf; int bytes_per_pixel = infoheader->biBitCount / 8; - bool premul = !(flags & ALLEGRO_NO_PREMULTIPLIED_ALPHA); + bool premul = !(flags & A5O_NO_PREMULTIPLIED_ALPHA); int rs, gs, bs, as; uint32_t rm, gm, bm, am; @@ -809,7 +809,7 @@ static bool read_bitfields_image(ALLEGRO_FILE *f, int flags, linebuf = al_malloc((width + 1) * bytes_per_pixel); if (!linebuf) { - ALLEGRO_WARN("Failed to allocate pixel row buffer\n"); + A5O_WARN("Failed to allocate pixel row buffer\n"); return false; } @@ -923,14 +923,14 @@ static bool read_bitfields_image(ALLEGRO_FILE *f, int flags, * the presence or absence of an alpha channel. * This hack is not required then. */ -static bool read_RGB_image_32bit_alpha_hack(ALLEGRO_FILE *f, int flags, - const BMPINFOHEADER *infoheader, ALLEGRO_LOCKED_REGION *lr) +static bool read_RGB_image_32bit_alpha_hack(A5O_FILE *f, int flags, + const BMPINFOHEADER *infoheader, A5O_LOCKED_REGION *lr) { int i, j, line, startline, height, width, dir; int have_alpha = 0; size_t linesize; char *linebuf; - const bool premul = !(flags & ALLEGRO_NO_PREMULTIPLIED_ALPHA); + const bool premul = !(flags & A5O_NO_PREMULTIPLIED_ALPHA); height = infoheader->biHeight; width = infoheader->biWidth; @@ -946,7 +946,7 @@ static bool read_RGB_image_32bit_alpha_hack(ALLEGRO_FILE *f, int flags, linebuf = al_malloc(linesize); if (!linebuf) { - ALLEGRO_WARN("Failed to allocate pixel row buffer\n"); + A5O_WARN("Failed to allocate pixel row buffer\n"); return false; } @@ -1000,7 +1000,7 @@ static bool read_RGB_image_32bit_alpha_hack(ALLEGRO_FILE *f, int flags, /* read_RLE8_compressed_image: * For reading the 8 bit RLE compressed BMP image format. */ -static bool read_RLE8_compressed_image(ALLEGRO_FILE *f, unsigned char *buf, +static bool read_RLE8_compressed_image(A5O_FILE *f, unsigned char *buf, const BMPINFOHEADER *infoheader) { int count; @@ -1097,7 +1097,7 @@ static bool read_RLE8_compressed_image(ALLEGRO_FILE *f, unsigned char *buf, /* read_RLE4_compressed_image: * For reading the 4 bit RLE compressed BMP image format. */ -static bool read_RLE4_compressed_image(ALLEGRO_FILE *f, unsigned char *buf, +static bool read_RLE4_compressed_image(A5O_FILE *f, unsigned char *buf, const BMPINFOHEADER *infoheader) { unsigned char b[8]; @@ -1195,24 +1195,24 @@ static bool read_RLE4_compressed_image(ALLEGRO_FILE *f, unsigned char *buf, -/* Like load_bmp, but starts loading from the current place in the ALLEGRO_FILE +/* Like load_bmp, but starts loading from the current place in the A5O_FILE * 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. */ -ALLEGRO_BITMAP *_al_load_bmp_f(ALLEGRO_FILE *f, int flags) +A5O_BITMAP *_al_load_bmp_f(A5O_FILE *f, int flags) { BMPFILEHEADER fileheader; BMPINFOHEADER infoheader; - ALLEGRO_BITMAP *bmp; + A5O_BITMAP *bmp; PalEntry pal[256]; int64_t file_start; int64_t header_start; unsigned long biSize; unsigned char *buf = NULL; - ALLEGRO_LOCKED_REGION *lr; - bool keep_index = INT_TO_BOOL(flags & ALLEGRO_KEEP_INDEX); + A5O_LOCKED_REGION *lr; + bool keep_index = INT_TO_BOOL(flags & A5O_KEEP_INDEX); bool loaded_ok; ASSERT(f); @@ -1227,7 +1227,7 @@ ALLEGRO_BITMAP *_al_load_bmp_f(ALLEGRO_FILE *f, int flags) biSize = (uint32_t)al_fread32le(f); if (al_feof(f) || al_ferror(f)) { - ALLEGRO_ERROR("EOF or file error while reading bitmap header.\n"); + A5O_ERROR("EOF or file error while reading bitmap header.\n"); return NULL; } @@ -1250,7 +1250,7 @@ ALLEGRO_BITMAP *_al_load_bmp_f(ALLEGRO_FILE *f, int flags) break; default: - ALLEGRO_WARN("Unsupported header size: %ld\n", biSize); + A5O_WARN("Unsupported header size: %ld\n", biSize); return NULL; } @@ -1260,36 +1260,36 @@ ALLEGRO_BITMAP *_al_load_bmp_f(ALLEGRO_FILE *f, int flags) } if ((int)infoheader.biWidth < 0) { - ALLEGRO_WARN("negative width: %ld\n", infoheader.biWidth); + A5O_WARN("negative width: %ld\n", infoheader.biWidth); return NULL; } if (infoheader.biCompression != BIT_RGB && infoheader.biCompression != BIT_RLE8 && infoheader.biCompression != BIT_RLE4 && infoheader.biCompression != BIT_BITFIELDS) { - ALLEGRO_ERROR("Unsupported compression: 0x%x\n", (int) infoheader.biCompression); + A5O_ERROR("Unsupported compression: 0x%x\n", (int) infoheader.biCompression); return NULL; } if (infoheader.biBitCount != 1 && infoheader.biBitCount != 2 && infoheader.biBitCount != 4 && infoheader.biBitCount != 8 && infoheader.biBitCount != 16 && infoheader.biBitCount != 24 && infoheader.biBitCount != 32) { - ALLEGRO_WARN("unsupported bit depth: %d\n", infoheader.biBitCount); + A5O_WARN("unsupported bit depth: %d\n", infoheader.biBitCount); return NULL; } if (infoheader.biCompression == BIT_RLE4 && infoheader.biBitCount != 4) { - ALLEGRO_WARN("unsupported bit depth for RLE4 compression: %d\n", infoheader.biBitCount); + A5O_WARN("unsupported bit depth for RLE4 compression: %d\n", infoheader.biBitCount); return NULL; } if (infoheader.biCompression == BIT_RLE8 && infoheader.biBitCount != 8) { - ALLEGRO_WARN("unsupported bit depth for RLE8 compression: %d\n", infoheader.biBitCount); + A5O_WARN("unsupported bit depth for RLE8 compression: %d\n", infoheader.biBitCount); return NULL; } if (infoheader.biCompression == BIT_BITFIELDS && infoheader.biBitCount != 16 && infoheader.biBitCount != 24 && infoheader.biBitCount != 32) { - ALLEGRO_WARN("unsupported bit depth for bitfields compression: %d\n", infoheader.biBitCount); + A5O_WARN("unsupported bit depth for bitfields compression: %d\n", infoheader.biBitCount); return NULL; } @@ -1319,14 +1319,14 @@ ALLEGRO_BITMAP *_al_load_bmp_f(ALLEGRO_FILE *f, int flags) if ((infoheader.biAlphaMask & pixel_mask) == 0) { infoheader.biAlphaMask = 0; - ALLEGRO_WARN("Ignoring invalid alpha mask\n"); + A5O_WARN("Ignoring invalid alpha mask\n"); } } /* Seek past the end of the header to reach the palette / image data */ if (biSize > WININFOHEADERSIZEV3) { - if (!al_fseek(f, file_start + 14 + biSize, ALLEGRO_SEEK_SET)) { - ALLEGRO_ERROR("Seek error\n"); + if (!al_fseek(f, file_start + 14 + biSize, A5O_SEEK_SET)) { + A5O_ERROR("Seek error\n"); return NULL; } } @@ -1352,7 +1352,7 @@ ALLEGRO_BITMAP *_al_load_bmp_f(ALLEGRO_FILE *f, int flags) int bytes_per_color = win_flag ? 4 : 3; if (infoheader.biClrUsed >= INT_MAX) { - ALLEGRO_ERROR("Illegal palette size: %lu\n", infoheader.biClrUsed); + A5O_ERROR("Illegal palette size: %lu\n", infoheader.biClrUsed); return NULL; } @@ -1368,24 +1368,24 @@ ALLEGRO_BITMAP *_al_load_bmp_f(ALLEGRO_FILE *f, int flags) } if (ncolors == 0) { - ALLEGRO_WARN("No palette in OS2v1 BMP file!\n"); + A5O_WARN("No palette in OS2v1 BMP file!\n"); } } if (ncolors > 256) { - ALLEGRO_WARN("Too many colors: %d\n", ncolors); + A5O_WARN("Too many colors: %d\n", ncolors); ncolors = 256; extracolors = ncolors - 256; } read_palette(ncolors, pal, f, flags, &infoheader, win_flag); if (al_feof(f) || al_ferror(f)) { - ALLEGRO_ERROR("EOF or I/O error\n"); + A5O_ERROR("EOF or I/O error\n"); return NULL; } - if (!al_fseek(f, extracolors * bytes_per_color, ALLEGRO_SEEK_SET)) { - ALLEGRO_ERROR("Seek error\n"); + if (!al_fseek(f, extracolors * bytes_per_color, A5O_SEEK_SET)) { + A5O_ERROR("Seek error\n"); return NULL; } } @@ -1393,42 +1393,42 @@ ALLEGRO_BITMAP *_al_load_bmp_f(ALLEGRO_FILE *f, int flags) int win_flag = (biSize != OS2INFOHEADERSIZE); int bytes_per_color = win_flag ? 4 : 3; - if (!al_fseek(f, infoheader.biClrUsed * bytes_per_color, ALLEGRO_SEEK_CUR)) { - ALLEGRO_ERROR("Seek error\n"); + if (!al_fseek(f, infoheader.biClrUsed * bytes_per_color, A5O_SEEK_CUR)) { + A5O_ERROR("Seek error\n"); return NULL; } } /* Skip to the pixel data only if it's outside of the image metadata */ if (file_start + (int64_t)fileheader.bfOffBits > al_ftell(f)) { - if (!al_fseek(f, file_start + fileheader.bfOffBits, ALLEGRO_SEEK_SET)) { - ALLEGRO_ERROR("Seek error\n"); + if (!al_fseek(f, file_start + fileheader.bfOffBits, A5O_SEEK_SET)) { + A5O_ERROR("Seek error\n"); return NULL; } } bmp = al_create_bitmap(infoheader.biWidth, abs((int)infoheader.biHeight)); if (!bmp) { - ALLEGRO_ERROR("Failed to create bitmap\n"); + A5O_ERROR("Failed to create bitmap\n"); return NULL; } if (infoheader.biWidth == 0 || infoheader.biHeight == 0) { - ALLEGRO_WARN("Creating zero-sized bitmap\n"); + A5O_WARN("Creating zero-sized bitmap\n"); return bmp; } if (infoheader.biBitCount <= 8 && keep_index) { - lr = al_lock_bitmap(bmp, ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8, - ALLEGRO_LOCK_WRITEONLY); + lr = al_lock_bitmap(bmp, A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8, + A5O_LOCK_WRITEONLY); } else { - lr = al_lock_bitmap(bmp, ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, - ALLEGRO_LOCK_WRITEONLY); + lr = al_lock_bitmap(bmp, A5O_PIXEL_FORMAT_ABGR_8888_LE, + A5O_LOCK_WRITEONLY); } if (!lr) { - ALLEGRO_ERROR("Failed to lock region\n"); + A5O_ERROR("Failed to lock region\n"); al_destroy_bitmap(bmp); return NULL; } @@ -1437,7 +1437,7 @@ ALLEGRO_BITMAP *_al_load_bmp_f(ALLEGRO_FILE *f, int flags) || infoheader.biCompression == BIT_RLE4) { /* Questionable but most loaders handle this, so we should. */ if (infoheader.biHeight < 0) { - ALLEGRO_WARN("compressed bitmap with negative height\n"); + A5O_WARN("compressed bitmap with negative height\n"); } /* RLE decoding may skip pixels so clear the buffer first. */ @@ -1462,7 +1462,7 @@ ALLEGRO_BITMAP *_al_load_bmp_f(ALLEGRO_FILE *f, int flags) case 24: fn = read_24_rgb_888_line; break; case 32: fn = read_32_xrgb_8888_line; break; default: - ALLEGRO_ERROR("No decoding function for bit depth %d\n", infoheader.biBitCount); + A5O_ERROR("No decoding function for bit depth %d\n", infoheader.biBitCount); return NULL; } @@ -1488,13 +1488,13 @@ ALLEGRO_BITMAP *_al_load_bmp_f(ALLEGRO_FILE *f, int flags) case BIT_RLE8: loaded_ok = read_RLE8_compressed_image(f, buf, &infoheader); if (!loaded_ok) - ALLEGRO_ERROR("Error reading RLE8 data\n"); + A5O_ERROR("Error reading RLE8 data\n"); break; case BIT_RLE4: loaded_ok = read_RLE4_compressed_image(f, buf, &infoheader); if (!loaded_ok) - ALLEGRO_ERROR("Error reading RLE4 data\n"); + A5O_ERROR("Error reading RLE4 data\n"); break; case BIT_BITFIELDS: @@ -1548,7 +1548,7 @@ ALLEGRO_BITMAP *_al_load_bmp_f(ALLEGRO_FILE *f, int flags) break; default: - ALLEGRO_WARN("Unknown compression: %ld\n", infoheader.biCompression); + A5O_WARN("Unknown compression: %ld\n", infoheader.biCompression); loaded_ok = false; break; } @@ -1591,12 +1591,12 @@ ALLEGRO_BITMAP *_al_load_bmp_f(ALLEGRO_FILE *f, int flags) -/* Like save_bmp but writes into the ALLEGRO_FILE given instead of a new file. +/* Like save_bmp but writes into the A5O_FILE 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. */ -bool _al_save_bmp_f(ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp) +bool _al_save_bmp_f(A5O_FILE *f, A5O_BITMAP *bmp) { int bfSize; int biSizeImage; @@ -1604,7 +1604,7 @@ bool _al_save_bmp_f(ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp) int filler; int i, j; int w, h; - ALLEGRO_LOCKED_REGION *lr; + A5O_LOCKED_REGION *lr; ASSERT(f); ASSERT(bmp); @@ -1642,8 +1642,8 @@ bool _al_save_bmp_f(ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp) /* Don't really need the alpha channel, just the _LE. * Note that there exist 32-bit BMPs now so we could try to save those. */ - lr = al_lock_bitmap(bmp, ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, - ALLEGRO_LOCK_READONLY); + lr = al_lock_bitmap(bmp, A5O_PIXEL_FORMAT_ABGR_8888_LE, + A5O_LOCK_READONLY); /* image data */ for (i = h - 1; i >= 0; i--) { @@ -1671,15 +1671,15 @@ bool _al_save_bmp_f(ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp) -ALLEGRO_BITMAP *_al_load_bmp(const char *filename, int flags) +A5O_BITMAP *_al_load_bmp(const char *filename, int flags) { - ALLEGRO_FILE *f; - ALLEGRO_BITMAP *bmp; + A5O_FILE *f; + A5O_BITMAP *bmp; ASSERT(filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } @@ -1691,16 +1691,16 @@ ALLEGRO_BITMAP *_al_load_bmp(const char *filename, int flags) } -bool _al_save_bmp(const char *filename, ALLEGRO_BITMAP *bmp) +bool _al_save_bmp(const char *filename, A5O_BITMAP *bmp) { - ALLEGRO_FILE *f; + A5O_FILE *f; bool retsave; bool retclose; ASSERT(filename); f = al_fopen(filename, "wb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for writing.\n", filename); + A5O_ERROR("Unable to open %s for writing.\n", filename); return false; } @@ -1711,7 +1711,7 @@ bool _al_save_bmp(const char *filename, ALLEGRO_BITMAP *bmp) } -bool _al_identify_bmp(ALLEGRO_FILE *f) +bool _al_identify_bmp(A5O_FILE *f) { uint16_t x; uint16_t y; @@ -1721,7 +1721,7 @@ bool _al_identify_bmp(ALLEGRO_FILE *f) if (y != 0x4D42) return false; - if (!al_fseek(f, 14 - 2, ALLEGRO_SEEK_CUR)) + if (!al_fseek(f, 14 - 2, A5O_SEEK_CUR)) return false; x = al_fread16le(f); diff --git a/addons/image/dds.c b/addons/image/dds.c index 00e1b38164..58883a9b47 100644 --- a/addons/image/dds.c +++ b/addons/image/dds.c @@ -19,7 +19,7 @@ #include "iio.h" -ALLEGRO_DEBUG_CHANNEL("image") +A5O_DEBUG_CHANNEL("image") typedef int DWORD; @@ -58,34 +58,34 @@ typedef struct { #define DDPF_FOURCC 0x4 -ALLEGRO_BITMAP *_al_load_dds_f(ALLEGRO_FILE *f, int flags) +A5O_BITMAP *_al_load_dds_f(A5O_FILE *f, int flags) { - ALLEGRO_BITMAP *bmp; + A5O_BITMAP *bmp; DDS_HEADER header; DWORD magic; size_t num_read; int w, h, fourcc, format, block_width, block_height, block_size; - ALLEGRO_STATE state; - ALLEGRO_LOCKED_REGION *lr = NULL; + A5O_STATE state; + A5O_LOCKED_REGION *lr = NULL; int ii; char* bitmap_data; (void)flags; magic = al_fread32le(f); if (magic != 0x20534444) { - ALLEGRO_ERROR("Invalid DDS magic number.\n"); + A5O_ERROR("Invalid DDS magic number.\n"); return NULL; } num_read = al_fread(f, &header, sizeof(DDS_HEADER)); if (num_read != DDS_HEADER_SIZE) { - ALLEGRO_ERROR("Wrong DDS header size. Got %d, expected %d.\n", + A5O_ERROR("Wrong DDS header size. Got %d, expected %d.\n", (int)num_read, DDS_HEADER_SIZE); return NULL; } if (!(header.ddspf.dwFlags & DDPF_FOURCC)) { - ALLEGRO_ERROR("Only compressed DDS formats supported.\n"); + A5O_ERROR("Only compressed DDS formats supported.\n"); return NULL; } @@ -95,16 +95,16 @@ ALLEGRO_BITMAP *_al_load_dds_f(ALLEGRO_FILE *f, int flags) switch (fourcc) { case FOURCC('D', 'X', 'T', '1'): - format = ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1; + format = A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1; break; case FOURCC('D', 'X', 'T', '3'): - format = ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3; + format = A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3; break; case FOURCC('D', 'X', 'T', '5'): - format = ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5; + format = A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5; break; default: - ALLEGRO_ERROR("Invalid pixel format.\n"); + A5O_ERROR("Invalid pixel format.\n"); return NULL; } @@ -112,31 +112,31 @@ ALLEGRO_BITMAP *_al_load_dds_f(ALLEGRO_FILE *f, int flags) block_height = al_get_pixel_block_height(format); block_size = al_get_pixel_block_size(format); - al_store_state(&state, ALLEGRO_STATE_NEW_BITMAP_PARAMETERS); - al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP); + al_store_state(&state, A5O_STATE_NEW_BITMAP_PARAMETERS); + al_set_new_bitmap_flags(A5O_VIDEO_BITMAP); al_set_new_bitmap_format(format); bmp = al_create_bitmap(w, h); if (!bmp) { - ALLEGRO_ERROR("Failed to create bitmap.\n"); + A5O_ERROR("Failed to create bitmap.\n"); goto FAIL; } if (al_get_bitmap_format(bmp) != format) { - ALLEGRO_ERROR("Created a bad bitmap.\n"); + A5O_ERROR("Created a bad bitmap.\n"); goto FAIL; } - lr = al_lock_bitmap_blocked(bmp, ALLEGRO_LOCK_WRITEONLY); + lr = al_lock_bitmap_blocked(bmp, A5O_LOCK_WRITEONLY); if (!lr) { switch (format) { - case ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1: - case ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3: - case ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5: - ALLEGRO_ERROR("Could not lock the bitmap (probably the support for locking this format has not been enabled).\n"); + case A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1: + case A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3: + case A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5: + A5O_ERROR("Could not lock the bitmap (probably the support for locking this format has not been enabled).\n"); break; default: - ALLEGRO_ERROR("Could not lock the bitmap.\n"); + A5O_ERROR("Could not lock the bitmap.\n"); } return NULL; } @@ -147,7 +147,7 @@ ALLEGRO_BITMAP *_al_load_dds_f(ALLEGRO_FILE *f, int flags) size_t pitch = (size_t)((w + block_width - 1) / block_width * block_size); num_read = al_fread(f, bitmap_data, pitch); if (num_read != pitch) { - ALLEGRO_ERROR("DDS file too short.\n"); + A5O_ERROR("DDS file too short.\n"); goto FAIL; } bitmap_data += lr->pitch; @@ -165,15 +165,15 @@ ALLEGRO_BITMAP *_al_load_dds_f(ALLEGRO_FILE *f, int flags) return bmp; } -ALLEGRO_BITMAP *_al_load_dds(const char *filename, int flags) +A5O_BITMAP *_al_load_dds(const char *filename, int flags) { - ALLEGRO_FILE *f; - ALLEGRO_BITMAP *bmp; + A5O_FILE *f; + A5O_BITMAP *bmp; ASSERT(filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_ERROR("Unable open %s for reading.\n", filename); + A5O_ERROR("Unable open %s for reading.\n", filename); return NULL; } @@ -184,7 +184,7 @@ ALLEGRO_BITMAP *_al_load_dds(const char *filename, int flags) return bmp; } -bool _al_identify_dds(ALLEGRO_FILE *f) +bool _al_identify_dds(A5O_FILE *f) { uint8_t x[4]; uint32_t y; diff --git a/addons/image/freeimage.c b/addons/image/freeimage.c index 66f16fba6c..3883ab034d 100644 --- a/addons/image/freeimage.c +++ b/addons/image/freeimage.c @@ -11,12 +11,12 @@ #include "iio.h" -ALLEGRO_DEBUG_CHANNEL("image") +A5O_DEBUG_CHANNEL("image") static bool freeimage_initialized = false; static void _fiio_al_error_handler(FREE_IMAGE_FORMAT fif, const char *message) { - ALLEGRO_ERROR("FreeImage %s : %s\n", (fif == FIF_UNKNOWN)? "UNKNOWN" : FreeImage_GetFormatFromFIF(fif), message); + A5O_ERROR("FreeImage %s : %s\n", (fif == FIF_UNKNOWN)? "UNKNOWN" : FreeImage_GetFormatFromFIF(fif), message); } bool _al_init_fi(void) @@ -38,15 +38,15 @@ void _al_shutdown_fi(void) freeimage_initialized = false; } -static ALLEGRO_BITMAP *_al_fi_to_al_bitmap(FIBITMAP *fib) { +static A5O_BITMAP *_al_fi_to_al_bitmap(FIBITMAP *fib) { int width = 0, height = 0; - ALLEGRO_BITMAP *bitmap = NULL; + A5O_BITMAP *bitmap = NULL; width = FreeImage_GetWidth(fib); height = FreeImage_GetHeight(fib); bitmap = al_create_bitmap(width, height); if (bitmap) { - ALLEGRO_LOCKED_REGION *a_lock = al_lock_bitmap(bitmap, - ALLEGRO_PIXEL_FORMAT_ARGB_8888, ALLEGRO_LOCK_WRITEONLY); + A5O_LOCKED_REGION *a_lock = al_lock_bitmap(bitmap, + A5O_PIXEL_FORMAT_ARGB_8888, A5O_LOCK_WRITEONLY); if (a_lock) { unsigned char *out = (unsigned char *)a_lock->data; int out_inc = a_lock->pitch - (width*4); @@ -54,7 +54,7 @@ static ALLEGRO_BITMAP *_al_fi_to_al_bitmap(FIBITMAP *fib) { for (int i=0; i < width; ++i) { RGBQUAD color = { 0.0, 0.0, 0.0, 0.0 } ; if (FreeImage_GetPixelColor(fib, i, j, &color) == FALSE) { - ALLEGRO_ERROR("Unable to get pixel data at %d,%d\n", i , j); + A5O_ERROR("Unable to get pixel data at %d,%d\n", i , j); } *out++ = (unsigned char) color.rgbBlue; *out++ = (unsigned char) color.rgbGreen; @@ -69,10 +69,10 @@ static ALLEGRO_BITMAP *_al_fi_to_al_bitmap(FIBITMAP *fib) { return bitmap; } -ALLEGRO_BITMAP *_al_load_fi_bitmap(const char *filename, int flags) +A5O_BITMAP *_al_load_fi_bitmap(const char *filename, int flags) { FIBITMAP *fib = NULL; - ALLEGRO_BITMAP *bitmap = NULL; + A5O_BITMAP *bitmap = NULL; FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; ASSERT(filename); @@ -82,7 +82,7 @@ ALLEGRO_BITMAP *_al_load_fi_bitmap(const char *filename, int flags) if (fif == FIF_UNKNOWN) fif = FreeImage_GetFileType(filename, 0); if (fif == FIF_UNKNOWN) { - ALLEGRO_WARN("Could not determine the file type for '%s'\n", filename); + A5O_WARN("Could not determine the file type for '%s'\n", filename); return NULL; } @@ -102,30 +102,30 @@ ALLEGRO_BITMAP *_al_load_fi_bitmap(const char *filename, int flags) } static unsigned int _fiio_al_read(void *buffer, unsigned size, unsigned count, fi_handle handle) { - return (unsigned int) al_fread((ALLEGRO_FILE *)handle, buffer, (count * size)); + return (unsigned int) al_fread((A5O_FILE *)handle, buffer, (count * size)); } static unsigned int _fiio_al_write(void *buffer, unsigned size, unsigned count, fi_handle handle) { - return (unsigned int) al_fwrite((ALLEGRO_FILE *)handle, buffer, (count * size)); + return (unsigned int) al_fwrite((A5O_FILE *)handle, buffer, (count * size)); } static int _fiio_al_fseek(fi_handle handle, long offset, int origin) { - return al_fseek((ALLEGRO_FILE *)handle, offset, origin); + return al_fseek((A5O_FILE *)handle, offset, origin); } static long _fiio_al_ftell(fi_handle handle) { - return (long) al_ftell((ALLEGRO_FILE *)handle); + return (long) al_ftell((A5O_FILE *)handle); } -ALLEGRO_BITMAP *_al_load_fi_bitmap_f(ALLEGRO_FILE *f, int flags) +A5O_BITMAP *_al_load_fi_bitmap_f(A5O_FILE *f, int flags) { FreeImageIO fio; - ALLEGRO_BITMAP *bitmap = NULL; + A5O_BITMAP *bitmap = NULL; FIBITMAP *fib = NULL; FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; if (flags != 0) { - ALLEGRO_WARN("Ignoring bitmap loading flags.\n"); + A5O_WARN("Ignoring bitmap loading flags.\n"); } ASSERT(f); @@ -138,7 +138,7 @@ ALLEGRO_BITMAP *_al_load_fi_bitmap_f(ALLEGRO_FILE *f, int flags) fif = FreeImage_GetFileTypeFromHandle(&fio, (fi_handle)f, 0); if (fif == FIF_UNKNOWN) { - ALLEGRO_WARN("Could not determine the file type for Allegro file.\n"); + A5O_WARN("Could not determine the file type for Allegro file.\n"); return NULL; } @@ -157,7 +157,7 @@ ALLEGRO_BITMAP *_al_load_fi_bitmap_f(ALLEGRO_FILE *f, int flags) return bitmap; } -bool _al_identify_fi(ALLEGRO_FILE *f) +bool _al_identify_fi(A5O_FILE *f) { FreeImageIO fio; FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; @@ -172,7 +172,7 @@ bool _al_identify_fi(ALLEGRO_FILE *f) fif = FreeImage_GetFileTypeFromHandle(&fio, (fi_handle)f, 0); if (fif == FIF_UNKNOWN) { - ALLEGRO_WARN("Could not determine the file type for Allegro file.\n"); + A5O_WARN("Could not determine the file type for Allegro file.\n"); return false; } diff --git a/addons/image/gdiplus.cpp b/addons/image/gdiplus.cpp index 5d33d7b793..da68e56597 100644 --- a/addons/image/gdiplus.cpp +++ b/addons/image/gdiplus.cpp @@ -10,13 +10,13 @@ #include "iio.h" -#ifdef ALLEGRO_CFG_IIO_HAVE_GDIPLUS_LOWERCASE_H +#ifdef A5O_CFG_IIO_HAVE_GDIPLUS_LOWERCASE_H #include #else #include #endif -ALLEGRO_DEBUG_CHANNEL("image") +A5O_DEBUG_CHANNEL("image") /* Needed with the MinGW w32api-3.15 headers. */ using namespace Gdiplus; @@ -62,16 +62,16 @@ static int GetEncoderClsid(const WCHAR* format, CLSID* pClsid) return -1; } -/* A wrapper around an already opened ALLEGRO_FILE* pointer +/* A wrapper around an already opened A5O_FILE* pointer */ class AllegroWindowsStream : public IStream { long refCount; - ALLEGRO_FILE *fp; + A5O_FILE *fp; public: /* Create a stream from an open file handle */ - AllegroWindowsStream(ALLEGRO_FILE *fp) : + AllegroWindowsStream(A5O_FILE *fp) : refCount(1), fp(fp) { @@ -135,15 +135,15 @@ class AllegroWindowsStream : public IStream virtual HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) { - ALLEGRO_SEEK o; + A5O_SEEK o; if (dwOrigin == STREAM_SEEK_SET) { - o = ALLEGRO_SEEK_SET; + o = A5O_SEEK_SET; } else if (dwOrigin == STREAM_SEEK_CUR) { - o = ALLEGRO_SEEK_CUR; + o = A5O_SEEK_CUR; } else { - o = ALLEGRO_SEEK_END; + o = A5O_SEEK_END; } bool ret = al_fseek(fp, dlibMove.QuadPart, o); @@ -224,7 +224,7 @@ class AllegroWindowsStream : public IStream }; static void load_indexed_data(Gdiplus::Bitmap *gdi_bmp, - ALLEGRO_BITMAP *a_bmp, uint32_t w, uint32_t h) + A5O_BITMAP *a_bmp, uint32_t w, uint32_t h) { Gdiplus::BitmapData *gdi_lock = new Gdiplus::BitmapData(); Gdiplus::Rect rect(0, 0, w, h); @@ -232,8 +232,8 @@ static void load_indexed_data(Gdiplus::Bitmap *gdi_bmp, if (!gdi_bmp->LockBits(&rect, Gdiplus::ImageLockModeRead, PixelFormat8bppIndexed, gdi_lock)) { - ALLEGRO_LOCKED_REGION *a_lock = al_lock_bitmap(a_bmp, - ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8, ALLEGRO_LOCK_WRITEONLY); + A5O_LOCKED_REGION *a_lock = al_lock_bitmap(a_bmp, + A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8, A5O_LOCK_WRITEONLY); if (a_lock) { unsigned char *in = (unsigned char *)gdi_lock->Scan0; @@ -260,7 +260,7 @@ static void load_indexed_data(Gdiplus::Bitmap *gdi_bmp, } static void load_non_indexed_data(Gdiplus::Bitmap *gdi_bmp, - ALLEGRO_BITMAP *a_bmp, uint32_t w, uint32_t h, bool premul) + A5O_BITMAP *a_bmp, uint32_t w, uint32_t h, bool premul) { Gdiplus::BitmapData *gdi_lock = new Gdiplus::BitmapData(); Gdiplus::Rect rect(0, 0, w, h); @@ -268,8 +268,8 @@ static void load_non_indexed_data(Gdiplus::Bitmap *gdi_bmp, if (!gdi_bmp->LockBits(&rect, Gdiplus::ImageLockModeRead, PixelFormat32bppARGB, gdi_lock)) { - ALLEGRO_LOCKED_REGION *a_lock = al_lock_bitmap(a_bmp, - ALLEGRO_PIXEL_FORMAT_ARGB_8888, ALLEGRO_LOCK_WRITEONLY); + A5O_LOCKED_REGION *a_lock = al_lock_bitmap(a_bmp, + A5O_PIXEL_FORMAT_ARGB_8888, A5O_LOCK_WRITEONLY); if (a_lock) { unsigned char *in = (unsigned char *)gdi_lock->Scan0; @@ -319,23 +319,23 @@ static void load_non_indexed_data(Gdiplus::Bitmap *gdi_bmp, delete gdi_lock; } -ALLEGRO_BITMAP *_al_load_gdiplus_bitmap_f(ALLEGRO_FILE *fp, int flags) +A5O_BITMAP *_al_load_gdiplus_bitmap_f(A5O_FILE *fp, int flags) { AllegroWindowsStream *s = new AllegroWindowsStream(fp); if (!s) { - ALLEGRO_ERROR("Unable to create AllegroWindowsStream.\n"); + A5O_ERROR("Unable to create AllegroWindowsStream.\n"); return NULL; } - ALLEGRO_BITMAP *a_bmp = NULL; + A5O_BITMAP *a_bmp = NULL; Gdiplus::Bitmap *gdi_bmp = Gdiplus::Bitmap::FromStream(s, false); if (gdi_bmp) { const uint32_t w = gdi_bmp->GetWidth(); const uint32_t h = gdi_bmp->GetHeight(); const PixelFormat pf = gdi_bmp->GetPixelFormat(); - bool premul = !(flags & ALLEGRO_NO_PREMULTIPLIED_ALPHA); - bool keep_index = (flags & ALLEGRO_KEEP_INDEX); + bool premul = !(flags & A5O_NO_PREMULTIPLIED_ALPHA); + bool keep_index = (flags & A5O_KEEP_INDEX); a_bmp = al_create_bitmap(w, h); if (a_bmp) { @@ -354,10 +354,10 @@ ALLEGRO_BITMAP *_al_load_gdiplus_bitmap_f(ALLEGRO_FILE *fp, int flags) return a_bmp; } -ALLEGRO_BITMAP *_al_load_gdiplus_bitmap(const char *filename, int flags) +A5O_BITMAP *_al_load_gdiplus_bitmap(const char *filename, int flags) { - ALLEGRO_BITMAP *bmp = NULL; - ALLEGRO_FILE *fp; + A5O_BITMAP *bmp = NULL; + A5O_FILE *fp; fp = al_fopen(filename, "rb"); if (fp) { @@ -368,8 +368,8 @@ ALLEGRO_BITMAP *_al_load_gdiplus_bitmap(const char *filename, int flags) return bmp; } -bool _al_save_gdiplus_bitmap_f(ALLEGRO_FILE *fp, const char *ident, - ALLEGRO_BITMAP *a_bmp) +bool _al_save_gdiplus_bitmap_f(A5O_FILE *fp, const char *ident, + A5O_BITMAP *a_bmp) { CLSID encoder; int encoder_status = -1; @@ -391,13 +391,13 @@ bool _al_save_gdiplus_bitmap_f(ALLEGRO_FILE *fp, const char *ident, } if (encoder_status == -1) { - ALLEGRO_ERROR("Invalid encoder status.\n"); + A5O_ERROR("Invalid encoder status.\n"); return false; } AllegroWindowsStream *s = new AllegroWindowsStream(fp); if (!s) { - ALLEGRO_ERROR("Couldn't create AllegroWindowsStream.\n"); + A5O_ERROR("Couldn't create AllegroWindowsStream.\n"); return false; } @@ -413,8 +413,8 @@ bool _al_save_gdiplus_bitmap_f(ALLEGRO_FILE *fp, const char *ident, if (!gdi_bmp->LockBits(&rect, Gdiplus::ImageLockModeWrite, PixelFormat32bppARGB, gdi_lock)) { - ALLEGRO_LOCKED_REGION *a_lock = al_lock_bitmap( - a_bmp, ALLEGRO_PIXEL_FORMAT_ARGB_8888, ALLEGRO_LOCK_READONLY); + A5O_LOCKED_REGION *a_lock = al_lock_bitmap( + a_bmp, A5O_PIXEL_FORMAT_ARGB_8888, A5O_LOCK_READONLY); if (a_lock) { unsigned char *in = (unsigned char *)a_lock->data; @@ -448,14 +448,14 @@ bool _al_save_gdiplus_bitmap_f(ALLEGRO_FILE *fp, const char *ident, return ret; } -bool _al_save_gdiplus_bitmap(const char *filename, ALLEGRO_BITMAP *bmp) +bool _al_save_gdiplus_bitmap(const char *filename, A5O_BITMAP *bmp) { - ALLEGRO_FILE *fp; + A5O_FILE *fp; bool ret = false; fp = al_fopen(filename, "wb"); if (fp) { - ALLEGRO_PATH *path = al_create_path(filename); + A5O_PATH *path = al_create_path(filename); if (path) { ret = _al_save_gdiplus_bitmap_f(fp, al_get_path_extension(path), bmp); al_destroy_path(path); @@ -466,22 +466,22 @@ bool _al_save_gdiplus_bitmap(const char *filename, ALLEGRO_BITMAP *bmp) return ret; } -bool _al_save_gdiplus_png_f(ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp) +bool _al_save_gdiplus_png_f(A5O_FILE *f, A5O_BITMAP *bmp) { return _al_save_gdiplus_bitmap_f(f, ".png", bmp); } -bool _al_save_gdiplus_jpg_f(ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp) +bool _al_save_gdiplus_jpg_f(A5O_FILE *f, A5O_BITMAP *bmp) { return _al_save_gdiplus_bitmap_f(f, ".jpg", bmp); } -bool _al_save_gdiplus_tif_f(ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp) +bool _al_save_gdiplus_tif_f(A5O_FILE *f, A5O_BITMAP *bmp) { return _al_save_gdiplus_bitmap_f(f, ".tif", bmp); } -bool _al_save_gdiplus_gif_f(ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp) +bool _al_save_gdiplus_gif_f(A5O_FILE *f, A5O_BITMAP *bmp) { return _al_save_gdiplus_bitmap_f(f, ".gif", bmp); } diff --git a/addons/image/identify.c b/addons/image/identify.c index 996135a0bd..d65c76b29f 100644 --- a/addons/image/identify.c +++ b/addons/image/identify.c @@ -2,7 +2,7 @@ #include "allegro5/allegro_image.h" #include "allegro5/internal/aintern_image.h" -bool _al_identify_png(ALLEGRO_FILE *f) +bool _al_identify_png(A5O_FILE *f) { uint8_t x[8]; al_fread(f, x, 8); @@ -11,27 +11,27 @@ bool _al_identify_png(ALLEGRO_FILE *f) return true; } -bool _al_identify_jpg(ALLEGRO_FILE *f) +bool _al_identify_jpg(A5O_FILE *f) { uint8_t x[4]; uint16_t y; y = al_fread16be(f); if (y != 0xffd8) return false; - al_fseek(f, 6 - 2, ALLEGRO_SEEK_CUR); + al_fseek(f, 6 - 2, A5O_SEEK_CUR); al_fread(f, x, 4); if (memcmp(x, "JFIF", 4) != 0) return false; return true; } -bool _al_identify_webp(ALLEGRO_FILE *f) +bool _al_identify_webp(A5O_FILE *f) { uint8_t x[4]; al_fread(f, x, 4); if (memcmp(x, "RIFF", 4) != 0) return false; - al_fseek(f, 4, ALLEGRO_SEEK_CUR); + al_fseek(f, 4, A5O_SEEK_CUR); al_fread(f, x, 4); if (memcmp(x, "WEBP", 4) != 0) return false; diff --git a/addons/image/iio.c b/addons/image/iio.c index c593438d7f..d7055b39bf 100644 --- a/addons/image/iio.c +++ b/addons/image/iio.c @@ -48,11 +48,11 @@ bool al_init_image_addon(void) success |= al_register_bitmap_identifier(".png", _al_identify_png); success |= al_register_bitmap_identifier(".jpg", _al_identify_jpg); -/* ALLEGRO_CFG_IIO_HAVE_* is sufficient to know that the library - should be used. i.e., ALLEGRO_CFG_IIO_HAVE_GDIPLUS and - ALLEGRO_CFG_IIO_HAVE_PNG will never both be set. */ +/* A5O_CFG_IIO_HAVE_* is sufficient to know that the library + should be used. i.e., A5O_CFG_IIO_HAVE_GDIPLUS and + A5O_CFG_IIO_HAVE_PNG will never both be set. */ -#ifdef ALLEGRO_CFG_IIO_HAVE_GDIPLUS +#ifdef A5O_CFG_IIO_HAVE_GDIPLUS { char const *extensions[] = {".tif", ".tiff", ".jpg", ".jpeg", ".gif", ".png", NULL}; @@ -75,14 +75,14 @@ bool al_init_image_addon(void) } #endif -#ifdef ALLEGRO_CFG_IIO_HAVE_PNG +#ifdef A5O_CFG_IIO_HAVE_PNG success |= al_register_bitmap_loader(".png", _al_load_png); success |= al_register_bitmap_saver(".png", _al_save_png); success |= al_register_bitmap_loader_f(".png", _al_load_png_f); success |= al_register_bitmap_saver_f(".png", _al_save_png_f); #endif -#ifdef ALLEGRO_CFG_IIO_HAVE_JPG +#ifdef A5O_CFG_IIO_HAVE_JPG success |= al_register_bitmap_loader(".jpg", _al_load_jpg); success |= al_register_bitmap_saver(".jpg", _al_save_jpg); success |= al_register_bitmap_loader_f(".jpg", _al_load_jpg_f); @@ -94,7 +94,7 @@ bool al_init_image_addon(void) success |= al_register_bitmap_saver_f(".jpeg", _al_save_jpg_f); #endif -#ifdef ALLEGRO_CFG_IIO_HAVE_WEBP +#ifdef A5O_CFG_IIO_HAVE_WEBP success |= al_register_bitmap_loader(".webp", _al_load_webp); success |= al_register_bitmap_saver(".webp", _al_save_webp); success |= al_register_bitmap_loader_f(".webp", _al_load_webp_f); @@ -102,7 +102,7 @@ bool al_init_image_addon(void) success |= al_register_bitmap_identifier(".webp", _al_identify_webp); #endif -#ifdef ALLEGRO_CFG_IIO_HAVE_FREEIMAGE +#ifdef A5O_CFG_IIO_HAVE_FREEIMAGE { char const *extensions[] = {".ico", ".jng", ".koala", ".lbm", ".iff", ".mng", ".pbm", ".pcd", ".pgm", ".ppm", ".ras", ".wbmp", @@ -121,7 +121,7 @@ bool al_init_image_addon(void) } #endif -#ifdef ALLEGRO_CFG_IIO_HAVE_ANDROID +#ifdef A5O_CFG_IIO_HAVE_ANDROID { char const *extensions[] = {".webp", ".jpg", ".jpeg", ".ico", ".gif", ".wbmp", ".png", NULL}; @@ -137,8 +137,8 @@ bool al_init_image_addon(void) } #endif -#ifdef ALLEGRO_CFG_WANT_NATIVE_IMAGE_LOADER -#ifdef ALLEGRO_IPHONE +#ifdef A5O_CFG_WANT_NATIVE_IMAGE_LOADER +#ifdef A5O_IPHONE { char const *extensions[] = {".tif", ".tiff", ".jpg", ".jpeg", ".gif", ".png", ".BMPf", ".ico", ".cur", ".xbm", NULL}; @@ -150,7 +150,7 @@ bool al_init_image_addon(void) } #endif -#ifdef ALLEGRO_MACOSX +#ifdef A5O_MACOSX success |= _al_osx_register_image_loader(); #endif #endif @@ -184,7 +184,7 @@ void al_shutdown_image_addon(void) */ uint32_t al_get_allegro_image_version(void) { - return ALLEGRO_VERSION_INT; + return A5O_VERSION_INT; } diff --git a/addons/image/iphone.m b/addons/image/iphone.m index 757da16967..2703c513b3 100644 --- a/addons/image/iphone.m +++ b/addons/image/iphone.m @@ -7,20 +7,20 @@ #include "iio.h" -ALLEGRO_DEBUG_CHANNEL("image") +A5O_DEBUG_CHANNEL("image") -static ALLEGRO_BITMAP *really_load_image(char *buffer, int size, int flags) +static A5O_BITMAP *really_load_image(char *buffer, int size, int flags) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - ALLEGRO_BITMAP *bmp = NULL; + A5O_BITMAP *bmp = NULL; void *pixels = NULL; /* Note: buffer is now owned (and later freed) by the data object. */ NSData *nsdata = [NSData dataWithBytesNoCopy:buffer length:size]; UIImage *uiimage = [UIImage imageWithData:nsdata]; int w = uiimage.size.width; int h = uiimage.size.height; - bool premul = !(flags & ALLEGRO_NO_PREMULTIPLIED_ALPHA); + bool premul = !(flags & A5O_NO_PREMULTIPLIED_ALPHA); /* Now we need to draw the image into a memory buffer. */ pixels = al_malloc(w * h * 4); @@ -57,8 +57,8 @@ /* Then create a bitmap out of the memory buffer. */ bmp = al_create_bitmap(w, h); if (!bmp) goto done; - ALLEGRO_LOCKED_REGION *lock = al_lock_bitmap(bmp, - ALLEGRO_PIXEL_FORMAT_ABGR_8888, ALLEGRO_LOCK_WRITEONLY); + A5O_LOCKED_REGION *lock = al_lock_bitmap(bmp, + A5O_PIXEL_FORMAT_ABGR_8888, A5O_LOCK_WRITEONLY); if (!premul) { for (int i = 0; i < h; i++) { @@ -98,15 +98,15 @@ } -ALLEGRO_BITMAP *_al_iphone_load_image_f(ALLEGRO_FILE *f, int flags) +A5O_BITMAP *_al_iphone_load_image_f(A5O_FILE *f, int flags) { - ALLEGRO_BITMAP *bmp; - ALLEGRO_ASSERT(f); + A5O_BITMAP *bmp; + A5O_ASSERT(f); int64_t size = al_fsize(f); if (size <= 0) { // TODO: Read from stream until we have the whole image - ALLEGRO_ERROR("Unable to determine file size.\n"); + A5O_ERROR("Unable to determine file size.\n"); return NULL; } /* Note: This *MUST* be the Apple malloc and not any wrapper, as the @@ -121,16 +121,16 @@ } -ALLEGRO_BITMAP *_al_iphone_load_image(const char *filename, int flags) +A5O_BITMAP *_al_iphone_load_image(const char *filename, int flags) { - ALLEGRO_FILE *fp; - ALLEGRO_BITMAP *bmp; + A5O_FILE *fp; + A5O_BITMAP *bmp; - ALLEGRO_ASSERT(filename); + A5O_ASSERT(filename); fp = al_fopen(filename, "rb"); if (!fp) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } diff --git a/addons/image/jpg.c b/addons/image/jpg.c index 7eca9719dd..c14b1174e1 100644 --- a/addons/image/jpg.c +++ b/addons/image/jpg.c @@ -5,7 +5,7 @@ #include #include #include -#ifdef ALLEGRO_HAVE_STDINT_H +#ifdef A5O_HAVE_STDINT_H #include #endif @@ -20,21 +20,21 @@ #include #include -ALLEGRO_DEBUG_CHANNEL("image") +A5O_DEBUG_CHANNEL("image") struct my_src_mgr { struct jpeg_source_mgr pub; JOCTET *buffer; - ALLEGRO_FILE *fp; + A5O_FILE *fp; }; struct my_dest_mgr { struct jpeg_destination_mgr pub; JOCTET *buffer; - ALLEGRO_FILE *fp; + A5O_FILE *fp; }; struct my_err_mgr @@ -81,7 +81,7 @@ static void skip_input_data(j_decompress_ptr cinfo, long num_bytes) } else { long skip = num_bytes - src->pub.bytes_in_buffer; - al_fseek(src->fp, skip, ALLEGRO_SEEK_CUR); + al_fseek(src->fp, skip, A5O_SEEK_CUR); src->pub.bytes_in_buffer = 0; } } @@ -98,7 +98,7 @@ static void term_destination(j_compress_ptr cinfo) } -static void jpeg_packfile_src(j_decompress_ptr cinfo, ALLEGRO_FILE *fp, +static void jpeg_packfile_src(j_decompress_ptr cinfo, A5O_FILE *fp, JOCTET *buffer) { struct my_src_mgr *src; @@ -119,7 +119,7 @@ static void jpeg_packfile_src(j_decompress_ptr cinfo, ALLEGRO_FILE *fp, src->fp = fp; } -static void jpeg_packfile_dest(j_compress_ptr cinfo, ALLEGRO_FILE *fp, +static void jpeg_packfile_dest(j_compress_ptr cinfo, A5O_FILE *fp, JOCTET *buffer) { struct my_dest_mgr *dest; @@ -143,7 +143,7 @@ static void my_error_exit(j_common_ptr cinfo) char buffer[JMSG_LENGTH_MAX]; struct my_err_mgr *jerr = (void *)cinfo->err; jerr->pub.format_message(cinfo, buffer); - ALLEGRO_ERROR("jpeg error: %s\n", buffer); + A5O_ERROR("jpeg error: %s\n", buffer); longjmp(jerr->jmpenv, 1); } @@ -153,21 +153,21 @@ static void my_error_exit(j_common_ptr cinfo) */ struct load_jpg_entry_helper_data { bool error; - ALLEGRO_BITMAP *bmp; + A5O_BITMAP *bmp; JOCTET *buffer; unsigned char *row; }; -static void load_jpg_entry_helper(ALLEGRO_FILE *fp, +static void load_jpg_entry_helper(A5O_FILE *fp, struct load_jpg_entry_helper_data *data, int flags) { struct jpeg_decompress_struct cinfo; struct my_err_mgr jerr; - ALLEGRO_LOCKED_REGION *lock; + A5O_LOCKED_REGION *lock; int w, h, s; - /* ALLEGRO_NO_PREMULTIPLIED_ALPHA does not apply. - * ALLEGRO_KEEP_INDEX does not apply. + /* A5O_NO_PREMULTIPLIED_ALPHA does not apply. + * A5O_KEEP_INDEX does not apply. */ (void)flags; @@ -199,32 +199,32 @@ static void load_jpg_entry_helper(ALLEGRO_FILE *fp, /* Only one and three components make sense in a JPG file. */ if (s != 1 && s != 3) { data->error = true; - ALLEGRO_ERROR("%d components makes no sense\n", s); + A5O_ERROR("%d components makes no sense\n", s); goto error; } data->bmp = al_create_bitmap(w, h); if (!data->bmp) { data->error = true; - ALLEGRO_ERROR("%dx%d bitmap creation failed\n", w, h); + A5O_ERROR("%dx%d bitmap creation failed\n", w, h); goto error; } /* Allegro's pixel format is endian independent, so that in - * ALLEGRO_PIXEL_FORMAT_RGB_888 the lower 8 bits always hold the Blue + * A5O_PIXEL_FORMAT_RGB_888 the lower 8 bits always hold the Blue * component. On a little endian system this is in byte 0. On a big * endian system this is in byte 2. * * libjpeg expects byte 0 to hold the Red component, byte 1 to hold the * Green component, byte 2 to hold the Blue component. Hence on little - * endian systems we need the opposite format, ALLEGRO_PIXEL_FORMAT_BGR_888. + * endian systems we need the opposite format, A5O_PIXEL_FORMAT_BGR_888. */ -#ifdef ALLEGRO_BIG_ENDIAN - lock = al_lock_bitmap(data->bmp, ALLEGRO_PIXEL_FORMAT_RGB_888, - ALLEGRO_LOCK_WRITEONLY); +#ifdef A5O_BIG_ENDIAN + lock = al_lock_bitmap(data->bmp, A5O_PIXEL_FORMAT_RGB_888, + A5O_LOCK_WRITEONLY); #else - lock = al_lock_bitmap(data->bmp, ALLEGRO_PIXEL_FORMAT_BGR_888, - ALLEGRO_LOCK_WRITEONLY); + lock = al_lock_bitmap(data->bmp, A5O_PIXEL_FORMAT_BGR_888, + A5O_LOCK_WRITEONLY); #endif if (s == 3) { @@ -277,7 +277,7 @@ static void load_jpg_entry_helper(ALLEGRO_FILE *fp, al_free(data->row); } -ALLEGRO_BITMAP *_al_load_jpg_f(ALLEGRO_FILE *fp, int flags) +A5O_BITMAP *_al_load_jpg_f(A5O_FILE *fp, int flags) { struct load_jpg_entry_helper_data data; @@ -293,12 +293,12 @@ struct save_jpg_entry_helper_data { JOCTET *buffer; }; -static void save_jpg_entry_helper(ALLEGRO_FILE *fp, ALLEGRO_BITMAP *bmp, +static void save_jpg_entry_helper(A5O_FILE *fp, A5O_BITMAP *bmp, struct save_jpg_entry_helper_data *data) { struct jpeg_compress_struct cinfo; struct my_err_mgr jerr; - ALLEGRO_LOCKED_REGION *lock; + A5O_LOCKED_REGION *lock; data->error = false; @@ -331,12 +331,12 @@ static void save_jpg_entry_helper(ALLEGRO_FILE *fp, ALLEGRO_BITMAP *bmp, jpeg_start_compress(&cinfo, 1); /* See comment in load_jpg_entry_helper. */ -#ifdef ALLEGRO_BIG_ENDIAN - lock = al_lock_bitmap(bmp, ALLEGRO_PIXEL_FORMAT_RGB_888, - ALLEGRO_LOCK_READONLY); +#ifdef A5O_BIG_ENDIAN + lock = al_lock_bitmap(bmp, A5O_PIXEL_FORMAT_RGB_888, + A5O_LOCK_READONLY); #else - lock = al_lock_bitmap(bmp, ALLEGRO_PIXEL_FORMAT_BGR_888, - ALLEGRO_LOCK_READONLY); + lock = al_lock_bitmap(bmp, A5O_PIXEL_FORMAT_BGR_888, + A5O_LOCK_READONLY); #endif while (cinfo.next_scanline < cinfo.image_height) { @@ -359,7 +359,7 @@ static void save_jpg_entry_helper(ALLEGRO_FILE *fp, ALLEGRO_BITMAP *bmp, al_free(data->buffer); } -bool _al_save_jpg_f(ALLEGRO_FILE *fp, ALLEGRO_BITMAP *bmp) +bool _al_save_jpg_f(A5O_FILE *fp, A5O_BITMAP *bmp) { struct save_jpg_entry_helper_data data; @@ -369,16 +369,16 @@ bool _al_save_jpg_f(ALLEGRO_FILE *fp, ALLEGRO_BITMAP *bmp) return !data.error; } -ALLEGRO_BITMAP *_al_load_jpg(char const *filename, int flags) +A5O_BITMAP *_al_load_jpg(char const *filename, int flags) { - ALLEGRO_FILE *fp; - ALLEGRO_BITMAP *bmp; + A5O_FILE *fp; + A5O_BITMAP *bmp; - ALLEGRO_ASSERT(filename); + A5O_ASSERT(filename); fp = al_fopen(filename, "rb"); if (!fp) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } @@ -389,18 +389,18 @@ ALLEGRO_BITMAP *_al_load_jpg(char const *filename, int flags) return bmp; } -bool _al_save_jpg(char const *filename, ALLEGRO_BITMAP *bmp) +bool _al_save_jpg(char const *filename, A5O_BITMAP *bmp) { - ALLEGRO_FILE *fp; + A5O_FILE *fp; bool retsave; bool retclose; - ALLEGRO_ASSERT(filename); - ALLEGRO_ASSERT(bmp); + A5O_ASSERT(filename); + A5O_ASSERT(bmp); fp = al_fopen(filename, "wb"); if (!fp) { - ALLEGRO_ERROR("Unable to open file %s for writing\n", filename); + A5O_ERROR("Unable to open file %s for writing\n", filename); return false; } diff --git a/addons/image/macosx.m b/addons/image/macosx.m index 4a83408b07..00c26e43ce 100644 --- a/addons/image/macosx.m +++ b/addons/image/macosx.m @@ -14,21 +14,21 @@ typedef float CGFloat; #endif -ALLEGRO_DEBUG_CHANNEL("OSXIIO") +A5O_DEBUG_CHANNEL("OSXIIO") // Just to make sure it's never al_malloc. #define apple_malloc malloc -static ALLEGRO_BITMAP *really_load_image(char *buffer, int size, int flags) +static A5O_BITMAP *really_load_image(char *buffer, int size, int flags) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; - ALLEGRO_BITMAP *bmp = NULL; + A5O_BITMAP *bmp = NULL; void *pixels = NULL; /* Note: buffer is now owned (and later freed) by the data object. */ NSData *nsdata = [[NSData alloc] initWithBytesNoCopy:buffer length:size]; NSImage *image = [[NSImage alloc] initWithData:nsdata]; [nsdata release]; - bool premul = !(flags & ALLEGRO_NO_PREMULTIPLIED_ALPHA); + bool premul = !(flags & A5O_NO_PREMULTIPLIED_ALPHA); if (!image) goto done; @@ -52,13 +52,13 @@ int h = [image_rep pixelsHigh]; int bits = [bitmap_rep bitsPerPixel]; int samples = bits / 8; - ALLEGRO_DEBUG("Read image of size %dx%dx%d\n", w, h, bits); + A5O_DEBUG("Read image of size %dx%dx%d\n", w, h, bits); /* Then create a bitmap out of the memory buffer. */ bmp = al_create_bitmap(w, h); if (bmp) { - ALLEGRO_LOCKED_REGION *lock = al_lock_bitmap(bmp, - ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, ALLEGRO_LOCK_WRITEONLY); + A5O_LOCKED_REGION *lock = al_lock_bitmap(bmp, + A5O_PIXEL_FORMAT_ABGR_8888_LE, A5O_LOCK_WRITEONLY); int i, j; { for (i = 0; i < h; i++) { @@ -120,15 +120,15 @@ } -static ALLEGRO_BITMAP *_al_osx_load_image_f(ALLEGRO_FILE *f, int flags) +static A5O_BITMAP *_al_osx_load_image_f(A5O_FILE *f, int flags) { - ALLEGRO_BITMAP *bmp; + A5O_BITMAP *bmp; ASSERT(f); int64_t size = al_fsize(f); if (size <= 0) { // TODO: Read from stream until we have the whole image - ALLEGRO_ERROR("Couldn't determine file size.\n"); + A5O_ERROR("Couldn't determine file size.\n"); return NULL; } /* Note: This *MUST* be the Apple malloc and not any wrapper, as the @@ -143,17 +143,17 @@ } -static ALLEGRO_BITMAP *_al_osx_load_image(const char *filename, int flags) +static A5O_BITMAP *_al_osx_load_image(const char *filename, int flags) { - ALLEGRO_FILE *fp; - ALLEGRO_BITMAP *bmp; + A5O_FILE *fp; + A5O_BITMAP *bmp; ASSERT(filename); - ALLEGRO_DEBUG("Using native loader to read %s\n", filename); + A5O_DEBUG("Using native loader to read %s\n", filename); fp = al_fopen(filename, "rb"); if (!fp) { - ALLEGRO_ERROR("Unable open %s for reading.\n", filename); + A5O_ERROR("Unable open %s for reading.\n", filename); return NULL; } @@ -165,9 +165,9 @@ } -extern NSImage* NSImageFromAllegroBitmap(ALLEGRO_BITMAP* bmp); +extern NSImage* NSImageFromAllegroBitmap(A5O_BITMAP* bmp); -bool _al_osx_save_image_f(ALLEGRO_FILE *f, const char *ident, ALLEGRO_BITMAP *bmp) +bool _al_osx_save_image_f(A5O_FILE *f, const char *ident, A5O_BITMAP *bmp) { NSBitmapImageFileType type; @@ -187,7 +187,7 @@ bool _al_osx_save_image_f(ALLEGRO_FILE *f, const char *ident, ALLEGRO_BITMAP *bm type = NSPNGFileType; } else { - ALLEGRO_ERROR("Unsupported image format: %s.\n", ident); + A5O_ERROR("Unsupported image format: %s.\n", ident); return false; } @@ -208,15 +208,15 @@ bool _al_osx_save_image_f(ALLEGRO_FILE *f, const char *ident, ALLEGRO_BITMAP *bm } -bool _al_osx_save_image(const char *filename, ALLEGRO_BITMAP *bmp) +bool _al_osx_save_image(const char *filename, A5O_BITMAP *bmp) { - ALLEGRO_FILE *fp; + A5O_FILE *fp; bool retsave = false; bool retclose = false; fp = al_fopen(filename, "wb"); if (fp) { - ALLEGRO_PATH *path = al_create_path(filename); + A5O_PATH *path = al_create_path(filename); if (path) { retsave = _al_osx_save_image_f(fp, al_get_path_extension(path), bmp); al_destroy_path(path); @@ -224,29 +224,29 @@ bool _al_osx_save_image(const char *filename, ALLEGRO_BITMAP *bmp) retclose = al_fclose(fp); } else { - ALLEGRO_ERROR("Unable open %s for writing.\n", filename); + A5O_ERROR("Unable open %s for writing.\n", filename); } return retsave && retclose; } -bool _al_osx_save_png_f(ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp) +bool _al_osx_save_png_f(A5O_FILE *f, A5O_BITMAP *bmp) { return _al_osx_save_image_f(f, ".png", bmp); } -bool _al_osx_save_jpg_f(ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp) +bool _al_osx_save_jpg_f(A5O_FILE *f, A5O_BITMAP *bmp) { return _al_osx_save_image_f(f, ".jpg", bmp); } -bool _al_osx_save_tif_f(ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp) +bool _al_osx_save_tif_f(A5O_FILE *f, A5O_BITMAP *bmp) { return _al_osx_save_image_f(f, ".tif", bmp); } -bool _al_osx_save_gif_f(ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp) +bool _al_osx_save_gif_f(A5O_FILE *f, A5O_BITMAP *bmp) { return _al_osx_save_image_f(f, ".gif", bmp); } @@ -276,7 +276,7 @@ bool _al_osx_register_image_loader(void) al_register_bitmap_loader(s, NULL); al_register_bitmap_loader_f(s, NULL); - ALLEGRO_DEBUG("Registering native loader for bitmap type %s\n", s); + A5O_DEBUG("Registering native loader for bitmap type %s\n", s); success |= al_register_bitmap_loader(s, _al_osx_load_image); success |= al_register_bitmap_loader_f(s, _al_osx_load_image_f); } @@ -284,7 +284,7 @@ bool _al_osx_register_image_loader(void) char const *extensions[] = { ".tif", ".tiff", ".gif", ".png", ".jpg", ".jpeg", NULL }; for (i = 0; extensions[i]; i++) { - ALLEGRO_DEBUG("Registering native saver for bitmap type %s\n", extensions[i]); + A5O_DEBUG("Registering native saver for bitmap type %s\n", extensions[i]); success |= al_register_bitmap_saver(extensions[i], _al_osx_save_image); } diff --git a/addons/image/pcx.c b/addons/image/pcx.c index 08016e449b..4cc8f51c7d 100644 --- a/addons/image/pcx.c +++ b/addons/image/pcx.c @@ -4,20 +4,20 @@ #include "iio.h" -ALLEGRO_DEBUG_CHANNEL("image") +A5O_DEBUG_CHANNEL("image") /* Do NOT simplify this to just (x), it doesn't work in MSVC. */ #define INT_TO_BOOL(x) ((x) != 0) -ALLEGRO_BITMAP *_al_load_pcx_f(ALLEGRO_FILE *f, int flags) +A5O_BITMAP *_al_load_pcx_f(A5O_FILE *f, int flags) { - ALLEGRO_BITMAP *b; + A5O_BITMAP *b; int c; int width, height; int bpp, bytes_per_line; int x, xx, y; char ch; - ALLEGRO_LOCKED_REGION *lr; + A5O_LOCKED_REGION *lr; unsigned char *buf; PalEntry pal[256]; bool keep_index; @@ -29,7 +29,7 @@ ALLEGRO_BITMAP *_al_load_pcx_f(ALLEGRO_FILE *f, int flags) char color_plane = al_fgetc(f); if (color_plane != 8) { /* we like 8 bit color planes */ - ALLEGRO_ERROR("Invalid color plane %d.\n", color_plane); + A5O_ERROR("Invalid color plane %d.\n", color_plane); return NULL; } @@ -49,14 +49,14 @@ ALLEGRO_BITMAP *_al_load_pcx_f(ALLEGRO_FILE *f, int flags) bpp = al_fgetc(f) * 8; /* how many color planes? */ if ((bpp != 8) && (bpp != 24)) { - ALLEGRO_ERROR("Invalid bpp %d.\n", color_plane); + A5O_ERROR("Invalid bpp %d.\n", color_plane); return NULL; } bytes_per_line = al_fread16le(f); /* It can only be this because we only support 8 bit planes */ if (bytes_per_line != width) { - ALLEGRO_ERROR("Invalid bytes per line %d\n", bytes_per_line); + A5O_ERROR("Invalid bytes per line %d\n", bytes_per_line); return NULL; } @@ -64,17 +64,17 @@ ALLEGRO_BITMAP *_al_load_pcx_f(ALLEGRO_FILE *f, int flags) al_fgetc(f); if (al_feof(f) || al_ferror(f)) { - ALLEGRO_ERROR("Unexpected EOF/error.\n"); + A5O_ERROR("Unexpected EOF/error.\n"); return NULL; } b = al_create_bitmap(width, height); if (!b) { - ALLEGRO_ERROR("Failed to create bitmap.\n"); + A5O_ERROR("Failed to create bitmap.\n"); return NULL; } - keep_index = INT_TO_BOOL(flags & ALLEGRO_KEEP_INDEX); + keep_index = INT_TO_BOOL(flags & A5O_KEEP_INDEX); al_set_errno(0); @@ -90,13 +90,13 @@ ALLEGRO_BITMAP *_al_load_pcx_f(ALLEGRO_FILE *f, int flags) } if (bpp == 8 && keep_index) { - lr = al_lock_bitmap(b, ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8, ALLEGRO_LOCK_WRITEONLY); + lr = al_lock_bitmap(b, A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8, A5O_LOCK_WRITEONLY); } else { - lr = al_lock_bitmap(b, ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, ALLEGRO_LOCK_WRITEONLY); + lr = al_lock_bitmap(b, A5O_PIXEL_FORMAT_ABGR_8888_LE, A5O_LOCK_WRITEONLY); } if (!lr) { - ALLEGRO_ERROR("Failed to lock bitmap.\n"); + A5O_ERROR("Failed to lock bitmap.\n"); al_free(buf); return NULL; } @@ -176,7 +176,7 @@ ALLEGRO_BITMAP *_al_load_pcx_f(ALLEGRO_FILE *f, int flags) al_free(buf); if (al_get_errno()) { - ALLEGRO_ERROR("Error detected: %d.\n", al_get_errno()); + A5O_ERROR("Error detected: %d.\n", al_get_errno()); al_destroy_bitmap(b); return NULL; } @@ -184,7 +184,7 @@ ALLEGRO_BITMAP *_al_load_pcx_f(ALLEGRO_FILE *f, int flags) return b; } -bool _al_save_pcx_f(ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp) +bool _al_save_pcx_f(A5O_FILE *f, A5O_BITMAP *bmp) { int c; int x, y; @@ -225,11 +225,11 @@ bool _al_save_pcx_f(ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp) buf = al_malloc(w * 3); - al_lock_bitmap(bmp, ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_READONLY); + al_lock_bitmap(bmp, A5O_PIXEL_FORMAT_ANY, A5O_LOCK_READONLY); for (y = 0; y < h; y++) { /* for each scanline... */ for (x = 0; x < w; x++) { - ALLEGRO_COLOR c = al_get_pixel(bmp, x, y); + A5O_COLOR c = al_get_pixel(bmp, x, y); unsigned char r, g, b; al_unmap_rgb(c, &r, &g, &b); buf[x] = r; @@ -261,22 +261,22 @@ bool _al_save_pcx_f(ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp) al_unlock_bitmap(bmp); if (al_get_errno()) { - ALLEGRO_ERROR("Error detected: %d.\n", al_get_errno()); + A5O_ERROR("Error detected: %d.\n", al_get_errno()); return false; } else return true; } -ALLEGRO_BITMAP *_al_load_pcx(const char *filename, int flags) +A5O_BITMAP *_al_load_pcx(const char *filename, int flags) { - ALLEGRO_FILE *f; - ALLEGRO_BITMAP *bmp; + A5O_FILE *f; + A5O_BITMAP *bmp; ASSERT(filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } @@ -287,16 +287,16 @@ ALLEGRO_BITMAP *_al_load_pcx(const char *filename, int flags) return bmp; } -bool _al_save_pcx(const char *filename, ALLEGRO_BITMAP *bmp) +bool _al_save_pcx(const char *filename, A5O_BITMAP *bmp) { - ALLEGRO_FILE *f; + A5O_FILE *f; bool retsave; bool retclose; ASSERT(filename); f = al_fopen(filename, "wb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for writing.\n", filename); + A5O_ERROR("Unable to open %s for writing.\n", filename); return false; } @@ -307,7 +307,7 @@ bool _al_save_pcx(const char *filename, ALLEGRO_BITMAP *bmp) return retsave && retclose; } -bool _al_identify_pcx(ALLEGRO_FILE *f) +bool _al_identify_pcx(A5O_FILE *f) { uint8_t x[4]; al_fread(f, x, 4); diff --git a/addons/image/png.c b/addons/image/png.c index 136847394e..724a170c54 100644 --- a/addons/image/png.c +++ b/addons/image/png.c @@ -12,7 +12,7 @@ #include "iio.h" -ALLEGRO_DEBUG_CHANNEL("image") +A5O_DEBUG_CHANNEL("image") /* get_gamma: @@ -42,7 +42,7 @@ static double get_gamma(void) static void user_error_fn(png_structp png_ptr, png_const_charp message) { jmp_buf *jmpbuf = (jmp_buf *)png_get_error_ptr(png_ptr); - ALLEGRO_DEBUG("PNG error: %s\n", message); + A5O_DEBUG("PNG error: %s\n", message); longjmp(*jmpbuf, 1); } @@ -60,7 +60,7 @@ static void user_error_fn(png_structp png_ptr, png_const_charp message) */ static void read_data(png_structp png_ptr, png_bytep data, size_t length) { - ALLEGRO_FILE *f = (ALLEGRO_FILE *)png_get_io_ptr(png_ptr); + A5O_FILE *f = (A5O_FILE *)png_get_io_ptr(png_ptr); if ((png_uint_32) al_fread(f, data, length) != length) png_error(png_ptr, "read error (loadpng calling al_fs_entry_read)"); } @@ -72,11 +72,11 @@ static void read_data(png_structp png_ptr, png_bytep data, size_t length) */ #define PNG_BYTES_TO_CHECK 4 -static int check_if_png(ALLEGRO_FILE *fp) +static int check_if_png(A5O_FILE *fp) { unsigned char buf[PNG_BYTES_TO_CHECK]; - ALLEGRO_ASSERT(fp); + A5O_ASSERT(fp); if (al_fread(fp, buf, PNG_BYTES_TO_CHECK) != PNG_BYTES_TO_CHECK) return 0; @@ -89,10 +89,10 @@ static int check_if_png(ALLEGRO_FILE *fp) /* really_load_png: * Worker routine, used by load_png and load_memory_png. */ -static ALLEGRO_BITMAP *really_load_png(png_structp png_ptr, png_infop info_ptr, +static A5O_BITMAP *really_load_png(png_structp png_ptr, png_infop info_ptr, int flags) { - ALLEGRO_BITMAP *bmp; + A5O_BITMAP *bmp; png_uint_32 width, height, rowbytes, real_rowbytes; int bit_depth, color_type, interlace_type; double image_gamma, screen_gamma; @@ -102,13 +102,13 @@ static ALLEGRO_BITMAP *really_load_png(png_structp png_ptr, png_infop info_ptr, int num_trans = 0; PalEntry pal[256]; png_bytep trans; - ALLEGRO_LOCKED_REGION *lock; + A5O_LOCKED_REGION *lock; unsigned char *buf; unsigned char *dest; - bool premul = !(flags & ALLEGRO_NO_PREMULTIPLIED_ALPHA); + bool premul = !(flags & A5O_NO_PREMULTIPLIED_ALPHA); bool index_only; - ALLEGRO_ASSERT(png_ptr && info_ptr); + A5O_ASSERT(png_ptr && info_ptr); /* The call to png_read_info() gives us all of the information from the * PNG file before the first IDAT (image data chunk). @@ -195,7 +195,7 @@ static ALLEGRO_BITMAP *really_load_png(png_structp png_ptr, png_infop info_ptr, if ((bpp == 24) || (bpp == 32)) { -#ifdef ALLEGRO_BIG_ENDIAN +#ifdef A5O_BIG_ENDIAN png_set_bgr(png_ptr); png_set_swap_alpha(png_ptr); #endif @@ -203,7 +203,7 @@ static ALLEGRO_BITMAP *really_load_png(png_structp png_ptr, png_infop info_ptr, bmp = al_create_bitmap(width, height); if (!bmp) { - ALLEGRO_ERROR("al_create_bitmap failed while loading PNG.\n"); + A5O_ERROR("al_create_bitmap failed while loading PNG.\n"); return NULL; } @@ -215,15 +215,15 @@ static ALLEGRO_BITMAP *really_load_png(png_structp png_ptr, png_infop info_ptr, buf = al_malloc(real_rowbytes); if (bpp == 8 && (color_type & PNG_COLOR_MASK_PALETTE) && - (flags & ALLEGRO_KEEP_INDEX)) + (flags & A5O_KEEP_INDEX)) { - lock = al_lock_bitmap(bmp, ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8, - ALLEGRO_LOCK_WRITEONLY); + lock = al_lock_bitmap(bmp, A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8, + A5O_LOCK_WRITEONLY); index_only = true; } else { - lock = al_lock_bitmap(bmp, ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, - ALLEGRO_LOCK_WRITEONLY); + lock = al_lock_bitmap(bmp, A5O_PIXEL_FORMAT_ABGR_8888_LE, + A5O_LOCK_WRITEONLY); index_only = false; } @@ -319,7 +319,7 @@ static ALLEGRO_BITMAP *really_load_png(png_structp png_ptr, png_infop info_ptr, break; default: - ALLEGRO_ASSERT(bpp == 8 || bpp == 24 || bpp == 32); + A5O_ASSERT(bpp == 8 || bpp == 24 || bpp == 32); break; } dest = dest_row_start + lock->pitch; @@ -339,17 +339,17 @@ static ALLEGRO_BITMAP *really_load_png(png_structp png_ptr, png_infop info_ptr, /* Load a PNG file from disk, doing colour coversion if required. */ -ALLEGRO_BITMAP *_al_load_png_f(ALLEGRO_FILE *fp, int flags) +A5O_BITMAP *_al_load_png_f(A5O_FILE *fp, int flags) { jmp_buf jmpbuf; - ALLEGRO_BITMAP *bmp; + A5O_BITMAP *bmp; png_structp png_ptr; png_infop info_ptr; - ALLEGRO_ASSERT(fp); + A5O_ASSERT(fp); if (!check_if_png(fp)) { - ALLEGRO_ERROR("Not a png.\n"); + A5O_ERROR("Not a png.\n"); return NULL; } @@ -362,7 +362,7 @@ ALLEGRO_BITMAP *_al_load_png_f(ALLEGRO_FILE *fp, int flags) png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, (void *)NULL, NULL, NULL); if (!png_ptr) { - ALLEGRO_ERROR("png_ptr == NULL\n"); + A5O_ERROR("png_ptr == NULL\n"); return NULL; } @@ -370,7 +370,7 @@ ALLEGRO_BITMAP *_al_load_png_f(ALLEGRO_FILE *fp, int flags) info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { png_destroy_read_struct(&png_ptr, (png_infopp) NULL, (png_infopp) NULL); - ALLEGRO_ERROR("png_create_info_struct failed\n"); + A5O_ERROR("png_create_info_struct failed\n"); return NULL; } @@ -379,7 +379,7 @@ ALLEGRO_BITMAP *_al_load_png_f(ALLEGRO_FILE *fp, int flags) /* Free all of the memory associated with the png_ptr and info_ptr */ png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL); /* If we get here, we had a problem reading the file */ - ALLEGRO_ERROR("Error reading PNG file\n"); + A5O_ERROR("Error reading PNG file\n"); return NULL; } png_set_error_fn(png_ptr, jmpbuf, user_error_fn, NULL); @@ -403,16 +403,16 @@ ALLEGRO_BITMAP *_al_load_png_f(ALLEGRO_FILE *fp, int flags) -ALLEGRO_BITMAP *_al_load_png(const char *filename, int flags) +A5O_BITMAP *_al_load_png(const char *filename, int flags) { - ALLEGRO_FILE *fp; - ALLEGRO_BITMAP *bmp; + A5O_FILE *fp; + A5O_BITMAP *bmp; - ALLEGRO_ASSERT(filename); + A5O_ASSERT(filename); fp = al_fopen(filename, "rb"); if (!fp) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } @@ -438,7 +438,7 @@ ALLEGRO_BITMAP *_al_load_png(const char *filename, int flags) */ static void write_data(png_structp png_ptr, png_bytep data, size_t length) { - ALLEGRO_FILE *f = (ALLEGRO_FILE *)png_get_io_ptr(png_ptr); + A5O_FILE *f = (A5O_FILE *)png_get_io_ptr(png_ptr); if ((png_uint_32) al_fwrite(f, data, length) != length) png_error(png_ptr, "write error (loadpng calling al_fs_entry_write)"); } @@ -474,14 +474,14 @@ static int translate_compression_level(const char* value) { /* save_rgba: * Core save routine for 32 bpp images. */ -static int save_rgba(png_structp png_ptr, ALLEGRO_BITMAP *bmp) +static int save_rgba(png_structp png_ptr, A5O_BITMAP *bmp) { const int bmp_h = al_get_bitmap_height(bmp); - ALLEGRO_LOCKED_REGION *lock; + A5O_LOCKED_REGION *lock; int y; - lock = al_lock_bitmap(bmp, ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, - ALLEGRO_LOCK_READONLY); + lock = al_lock_bitmap(bmp, A5O_PIXEL_FORMAT_ABGR_8888_LE, + A5O_LOCK_READONLY); if (!lock) return 0; @@ -500,7 +500,7 @@ static int save_rgba(png_structp png_ptr, ALLEGRO_BITMAP *bmp) /* Writes a non-interlaced, no-frills PNG, taking the usual save_xyz * parameters. Returns non-zero on error. */ -bool _al_save_png_f(ALLEGRO_FILE *fp, ALLEGRO_BITMAP *bmp) +bool _al_save_png_f(A5O_FILE *fp, A5O_BITMAP *bmp) { jmp_buf jmpbuf; png_structp png_ptr = NULL; @@ -513,20 +513,20 @@ bool _al_save_png_f(ALLEGRO_FILE *fp, ALLEGRO_BITMAP *bmp) png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, (void *)NULL, NULL, NULL); if (!png_ptr) { - ALLEGRO_ERROR("Unable to create PNG write struct.\n"); + A5O_ERROR("Unable to create PNG write struct.\n"); goto Error; } /* Allocate/initialize the image information data. */ info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { - ALLEGRO_ERROR("Unable to create PNG info struct.\n"); + A5O_ERROR("Unable to create PNG info struct.\n"); goto Error; } /* Set error handling. */ if (setjmp(jmpbuf)) { - ALLEGRO_ERROR("Failed to call setjmp.\n"); + A5O_ERROR("Failed to call setjmp.\n"); goto Error; } png_set_error_fn(png_ptr, jmpbuf, user_error_fn, NULL); @@ -567,7 +567,7 @@ bool _al_save_png_f(ALLEGRO_FILE *fp, ALLEGRO_BITMAP *bmp) * at the end. */ if (!save_rgba(png_ptr, bmp)) { - ALLEGRO_ERROR("save_rgba failed.\n"); + A5O_ERROR("save_rgba failed.\n"); goto Error; } @@ -590,18 +590,18 @@ bool _al_save_png_f(ALLEGRO_FILE *fp, ALLEGRO_BITMAP *bmp) } -bool _al_save_png(const char *filename, ALLEGRO_BITMAP *bmp) +bool _al_save_png(const char *filename, A5O_BITMAP *bmp) { - ALLEGRO_FILE *fp; + A5O_FILE *fp; bool retsave; bool retclose; - ALLEGRO_ASSERT(filename); - ALLEGRO_ASSERT(bmp); + A5O_ASSERT(filename); + A5O_ASSERT(bmp); fp = al_fopen(filename, "wb"); if (!fp) { - ALLEGRO_ERROR("Unable to open file %s for writing\n", filename); + A5O_ERROR("Unable to open file %s for writing\n", filename); return false; } diff --git a/addons/image/tga.c b/addons/image/tga.c index 17b56f440b..961367fbfc 100644 --- a/addons/image/tga.c +++ b/addons/image/tga.c @@ -29,14 +29,14 @@ #include "iio.h" -ALLEGRO_DEBUG_CHANNEL("image") +A5O_DEBUG_CHANNEL("image") /* raw_tga_read8: * Helper for reading 256-color raw data from TGA files. * Returns pointer past the end. */ -static INLINE unsigned char *raw_tga_read8(unsigned char *b, int w, ALLEGRO_FILE *f) +static INLINE unsigned char *raw_tga_read8(unsigned char *b, int w, A5O_FILE *f) { return b + al_fread(f, b, w); } @@ -47,7 +47,7 @@ static INLINE unsigned char *raw_tga_read8(unsigned char *b, int w, ALLEGRO_FILE * Helper for reading 256-color RLE data from TGA files. * Returns pointer past the end or NULL for error. */ -static unsigned char *rle_tga_read8(unsigned char *b, int w, ALLEGRO_FILE *f) +static unsigned char *rle_tga_read8(unsigned char *b, int w, A5O_FILE *f) { int value, count, c = 0; @@ -84,7 +84,7 @@ static unsigned char *rle_tga_read8(unsigned char *b, int w, ALLEGRO_FILE *f) /* single_tga_read32: * Helper for reading a single 32-bit data from TGA files. */ -static INLINE int32_t single_tga_read32(ALLEGRO_FILE *f) +static INLINE int32_t single_tga_read32(A5O_FILE *f) { return al_fread32le(f); } @@ -95,7 +95,7 @@ static INLINE int32_t single_tga_read32(ALLEGRO_FILE *f) * Helper for reading 32-bit raw data from TGA files. * Returns pointer past the end. */ -static unsigned int *raw_tga_read32(unsigned int *b, int w, ALLEGRO_FILE *f) +static unsigned int *raw_tga_read32(unsigned int *b, int w, A5O_FILE *f) { while (w--) *b++ = single_tga_read32(f); @@ -109,7 +109,7 @@ static unsigned int *raw_tga_read32(unsigned int *b, int w, ALLEGRO_FILE *f) * Helper for reading 32-bit RLE data from TGA files. * Returns pointer past the end or NULL for error. */ -static unsigned int *rle_tga_read32(unsigned int *b, int w, ALLEGRO_FILE *f) +static unsigned int *rle_tga_read32(unsigned int *b, int w, A5O_FILE *f) { int color, count, c = 0; @@ -145,7 +145,7 @@ static unsigned int *rle_tga_read32(unsigned int *b, int w, ALLEGRO_FILE *f) /* single_tga_read24: * Helper for reading a single 24-bit data from TGA files. */ -static INLINE void single_tga_read24(ALLEGRO_FILE *f, unsigned char color[3]) +static INLINE void single_tga_read24(A5O_FILE *f, unsigned char color[3]) { al_fread(f, color, 3); } @@ -156,7 +156,7 @@ static INLINE void single_tga_read24(ALLEGRO_FILE *f, unsigned char color[3]) * Helper for reading 24-bit raw data from TGA files. * Returns pointer past the end. */ -static unsigned char *raw_tga_read24(unsigned char *b, int w, ALLEGRO_FILE *f) +static unsigned char *raw_tga_read24(unsigned char *b, int w, A5O_FILE *f) { while (w--) { single_tga_read24(f, b); @@ -172,7 +172,7 @@ static unsigned char *raw_tga_read24(unsigned char *b, int w, ALLEGRO_FILE *f) * Helper for reading 24-bit RLE data from TGA files. * Returns pointer past the end or NULL for error. */ -static unsigned char *rle_tga_read24(unsigned char *b, int w, ALLEGRO_FILE *f) +static unsigned char *rle_tga_read24(unsigned char *b, int w, A5O_FILE *f) { int count, c = 0; unsigned char color[3]; @@ -214,7 +214,7 @@ static unsigned char *rle_tga_read24(unsigned char *b, int w, ALLEGRO_FILE *f) /* single_tga_read16: * Helper for reading a single 16-bit data from TGA files. */ -static INLINE int single_tga_read16(ALLEGRO_FILE *f) +static INLINE int single_tga_read16(A5O_FILE *f) { return al_fread16le(f); } @@ -225,7 +225,7 @@ static INLINE int single_tga_read16(ALLEGRO_FILE *f) * Helper for reading 16-bit raw data from TGA files. * Returns pointer past the end. */ -static unsigned short *raw_tga_read16(unsigned short *b, int w, ALLEGRO_FILE *f) +static unsigned short *raw_tga_read16(unsigned short *b, int w, A5O_FILE *f) { while (w--) *b++ = single_tga_read16(f); @@ -239,7 +239,7 @@ static unsigned short *raw_tga_read16(unsigned short *b, int w, ALLEGRO_FILE *f) * Helper for reading 16-bit RLE data from TGA files. * Returns pointer past the end or NULL for error. */ -static unsigned short *rle_tga_read16(unsigned short *b, int w, ALLEGRO_FILE *f) +static unsigned short *rle_tga_read16(unsigned short *b, int w, A5O_FILE *f) { int color, count, c = 0; @@ -273,13 +273,13 @@ static unsigned short *rle_tga_read16(unsigned short *b, int w, ALLEGRO_FILE *f) typedef unsigned char palette_entry[3]; -/* Like load_tga, but starts loading from the current place in the ALLEGRO_FILE +/* Like load_tga, but starts loading from the current place in the A5O_FILE * 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. */ -ALLEGRO_BITMAP *_al_load_tga_f(ALLEGRO_FILE *f, int flags) +A5O_BITMAP *_al_load_tga_f(A5O_FILE *f, int flags) { unsigned char image_id[256]; palette_entry image_palette[256]; @@ -293,10 +293,10 @@ ALLEGRO_BITMAP *_al_load_tga_f(ALLEGRO_FILE *f, int flags) unsigned int c, i; int y; int compressed; - ALLEGRO_BITMAP *bmp; - ALLEGRO_LOCKED_REGION *lr; + A5O_BITMAP *bmp; + A5O_LOCKED_REGION *lr; unsigned char *buf; - bool premul = !(flags & ALLEGRO_NO_PREMULTIPLIED_ALPHA); + bool premul = !(flags & A5O_NO_PREMULTIPLIED_ALPHA); ASSERT(f); id_length = al_fgetc(f); @@ -330,7 +330,7 @@ ALLEGRO_BITMAP *_al_load_tga_f(ALLEGRO_FILE *f, int flags) image_type &= 7; if ((image_type < 1) || (image_type > 3)) { - ALLEGRO_ERROR("Invalid image type %d.\n", image_type); + A5O_ERROR("Invalid image type %d.\n", image_type); return NULL; } @@ -340,7 +340,7 @@ ALLEGRO_BITMAP *_al_load_tga_f(ALLEGRO_FILE *f, int flags) /* paletted image */ /* Only support 8 bit palettes (up to 256 entries) though in principle the file format could have more(?)*/ if ((palette_type != 1) || (bpp != 8) || (palette_start + palette_colors) > 256) { - ALLEGRO_ERROR("Invalid image/palette/bpp combination %d/%d/%d.\n", image_type, palette_type, bpp); + A5O_ERROR("Invalid image/palette/bpp combination %d/%d/%d.\n", image_type, palette_type, bpp); return NULL; } @@ -354,7 +354,7 @@ ALLEGRO_BITMAP *_al_load_tga_f(ALLEGRO_FILE *f, int flags) else if ((palette_type == 0) && ((bpp == 24) || (bpp == 32))) { } else { - ALLEGRO_ERROR("Invalid image/palette/bpp combination %d/%d/%d.\n", image_type, palette_type, bpp); + A5O_ERROR("Invalid image/palette/bpp combination %d/%d/%d.\n", image_type, palette_type, bpp); return NULL; } break; @@ -362,7 +362,7 @@ ALLEGRO_BITMAP *_al_load_tga_f(ALLEGRO_FILE *f, int flags) case 3: /* grayscale image */ if ((palette_type != 0) || (bpp != 8)) { - ALLEGRO_ERROR("Invalid image/palette/bpp combination %d/%d/%d.\n", image_type, palette_type, bpp); + A5O_ERROR("Invalid image/palette/bpp combination %d/%d/%d.\n", image_type, palette_type, bpp); return NULL; } @@ -374,7 +374,7 @@ ALLEGRO_BITMAP *_al_load_tga_f(ALLEGRO_FILE *f, int flags) break; default: - ALLEGRO_ERROR("Invalid image type %d.\n", image_type); + A5O_ERROR("Invalid image type %d.\n", image_type); return NULL; } @@ -405,22 +405,22 @@ ALLEGRO_BITMAP *_al_load_tga_f(ALLEGRO_FILE *f, int flags) } } else { - ALLEGRO_ERROR("Invalid palette type %d.\n", palette_type); + A5O_ERROR("Invalid palette type %d.\n", palette_type); return NULL; } bmp = al_create_bitmap(image_width, image_height); if (!bmp) { - ALLEGRO_ERROR("Failed to create bitmap.\n"); + A5O_ERROR("Failed to create bitmap.\n"); return NULL; } al_set_errno(0); - lr = al_lock_bitmap(bmp, ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, ALLEGRO_LOCK_WRITEONLY); + lr = al_lock_bitmap(bmp, A5O_PIXEL_FORMAT_ABGR_8888_LE, A5O_LOCK_WRITEONLY); if (!lr) { - ALLEGRO_ERROR("Failed to lock bitmap.\n"); + A5O_ERROR("Failed to lock bitmap.\n"); al_destroy_bitmap(bmp); return NULL; } @@ -430,7 +430,7 @@ ALLEGRO_BITMAP *_al_load_tga_f(ALLEGRO_FILE *f, int flags) if (!buf) { al_unlock_bitmap(bmp); al_destroy_bitmap(bmp); - ALLEGRO_ERROR("Failed to allocate enough memory.\n"); + A5O_ERROR("Failed to allocate enough memory.\n"); return NULL; } @@ -450,7 +450,7 @@ ALLEGRO_BITMAP *_al_load_tga_f(ALLEGRO_FILE *f, int flags) al_free(buf); al_unlock_bitmap(bmp); al_destroy_bitmap(bmp); - ALLEGRO_ERROR("Invalid image data.\n"); + A5O_ERROR("Invalid image data.\n"); return NULL; } } @@ -464,7 +464,7 @@ ALLEGRO_BITMAP *_al_load_tga_f(ALLEGRO_FILE *f, int flags) al_free(buf); al_unlock_bitmap(bmp); al_destroy_bitmap(bmp); - ALLEGRO_ERROR("Invalid image data.\n"); + A5O_ERROR("Invalid image data.\n"); return NULL; } palette_entry* entry = image_palette + pix; @@ -487,7 +487,7 @@ ALLEGRO_BITMAP *_al_load_tga_f(ALLEGRO_FILE *f, int flags) al_free(buf); al_unlock_bitmap(bmp); al_destroy_bitmap(bmp); - ALLEGRO_ERROR("Invalid image data.\n"); + A5O_ERROR("Invalid image data.\n"); return NULL; } for (i = 0; i < image_width; i++) { @@ -495,7 +495,7 @@ ALLEGRO_BITMAP *_al_load_tga_f(ALLEGRO_FILE *f, int flags) unsigned char *dest = (unsigned char *)lr->data + lr->pitch*true_y + true_x*4; -#ifdef ALLEGRO_BIG_ENDIAN +#ifdef A5O_BIG_ENDIAN int a = buf[i * 4 + 0]; int r = buf[i * 4 + 1]; int g = buf[i * 4 + 2]; @@ -528,7 +528,7 @@ ALLEGRO_BITMAP *_al_load_tga_f(ALLEGRO_FILE *f, int flags) al_free(buf); al_unlock_bitmap(bmp); al_destroy_bitmap(bmp); - ALLEGRO_ERROR("Invalid image data.\n"); + A5O_ERROR("Invalid image data.\n"); return NULL; } for (i = 0; i < image_width; i++) { @@ -555,7 +555,7 @@ ALLEGRO_BITMAP *_al_load_tga_f(ALLEGRO_FILE *f, int flags) al_free(buf); al_unlock_bitmap(bmp); al_destroy_bitmap(bmp); - ALLEGRO_ERROR("Invalid image data.\n"); + A5O_ERROR("Invalid image data.\n"); return NULL; } for (i = 0; i < image_width; i++) { @@ -582,7 +582,7 @@ ALLEGRO_BITMAP *_al_load_tga_f(ALLEGRO_FILE *f, int flags) al_unlock_bitmap(bmp); if (al_get_errno()) { - ALLEGRO_ERROR("Error detected: %d.\n", al_get_errno()); + A5O_ERROR("Error detected: %d.\n", al_get_errno()); al_destroy_bitmap(bmp); return NULL; } @@ -592,12 +592,12 @@ ALLEGRO_BITMAP *_al_load_tga_f(ALLEGRO_FILE *f, int flags) -/* Like save_tga but writes into the ALLEGRO_FILE given instead of a new file. +/* Like save_tga but writes into the A5O_FILE 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. */ -bool _al_save_tga_f(ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp) +bool _al_save_tga_f(A5O_FILE *f, A5O_BITMAP *bmp) { int x, y; int w, h; @@ -622,11 +622,11 @@ bool _al_save_tga_f(ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp) al_fputc(f, 32); /* bits per pixel */ al_fputc(f, 8); /* descriptor (bottom to top, 8-bit alpha) */ - al_lock_bitmap(bmp, ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_READONLY); + al_lock_bitmap(bmp, A5O_PIXEL_FORMAT_ANY, A5O_LOCK_READONLY); for (y = h - 1; y >= 0; y--) { for (x = 0; x < w; x++) { - ALLEGRO_COLOR c = al_get_pixel(bmp, x, y); + A5O_COLOR c = al_get_pixel(bmp, x, y); unsigned char r, g, b, a; al_unmap_rgba(c, &r, &g, &b, &a); al_fputc(f, b); @@ -642,15 +642,15 @@ bool _al_save_tga_f(ALLEGRO_FILE *f, ALLEGRO_BITMAP *bmp) } -ALLEGRO_BITMAP *_al_load_tga(const char *filename, int flags) +A5O_BITMAP *_al_load_tga(const char *filename, int flags) { - ALLEGRO_FILE *f; - ALLEGRO_BITMAP *bmp; + A5O_FILE *f; + A5O_BITMAP *bmp; ASSERT(filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } @@ -663,16 +663,16 @@ ALLEGRO_BITMAP *_al_load_tga(const char *filename, int flags) -bool _al_save_tga(const char *filename, ALLEGRO_BITMAP *bmp) +bool _al_save_tga(const char *filename, A5O_BITMAP *bmp) { - ALLEGRO_FILE *f; + A5O_FILE *f; bool retsave; bool retclose; ASSERT(filename); f = al_fopen(filename, "wb"); if (!f) { - ALLEGRO_ERROR("Unable to open %s for writing.\n", filename); + A5O_ERROR("Unable to open %s for writing.\n", filename); return false; } @@ -684,7 +684,7 @@ bool _al_save_tga(const char *filename, ALLEGRO_BITMAP *bmp) } -bool _al_identify_tga(ALLEGRO_FILE *f) +bool _al_identify_tga(A5O_FILE *f) { uint8_t x[4]; al_fgetc(f); // skip id length diff --git a/addons/image/webp.c b/addons/image/webp.c index bb005fe812..f88c794dc7 100644 --- a/addons/image/webp.c +++ b/addons/image/webp.c @@ -12,7 +12,7 @@ #include "iio.h" -ALLEGRO_DEBUG_CHANNEL("image") +A5O_DEBUG_CHANNEL("image") /***************************************************************************** @@ -20,29 +20,29 @@ ALLEGRO_DEBUG_CHANNEL("image") ****************************************************************************/ -static ALLEGRO_BITMAP *load_from_buffer(const uint8_t* data, size_t data_size, +static A5O_BITMAP *load_from_buffer(const uint8_t* data, size_t data_size, int flags) { - ALLEGRO_BITMAP *bmp; - ALLEGRO_LOCKED_REGION *lock; - bool premul = !(flags & ALLEGRO_NO_PREMULTIPLIED_ALPHA); + A5O_BITMAP *bmp; + A5O_LOCKED_REGION *lock; + bool premul = !(flags & A5O_NO_PREMULTIPLIED_ALPHA); WebPDecoderConfig config; WebPInitDecoderConfig(&config); if (WebPGetFeatures(data, data_size, &config.input) != VP8_STATUS_OK) { - ALLEGRO_ERROR("Could not read WebP stream info\n"); + A5O_ERROR("Could not read WebP stream info\n"); return NULL; } bmp = al_create_bitmap(config.input.width, config.input.height); if (!bmp) { - ALLEGRO_ERROR("al_create_bitmap failed while loading WebP.\n"); + A5O_ERROR("al_create_bitmap failed while loading WebP.\n"); return NULL; } - lock = al_lock_bitmap(bmp, ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, - ALLEGRO_LOCK_WRITEONLY); + lock = al_lock_bitmap(bmp, A5O_PIXEL_FORMAT_ABGR_8888_LE, + A5O_LOCK_WRITEONLY); config.output.colorspace = premul ? MODE_rgbA : MODE_RGBA; config.output.u.RGBA.rgba = (uint8_t*)lock->data; @@ -51,7 +51,7 @@ static ALLEGRO_BITMAP *load_from_buffer(const uint8_t* data, size_t data_size, config.output.is_external_memory = 1; if (WebPDecode(data, data_size, &config) != VP8_STATUS_OK) { - ALLEGRO_ERROR("Could not decode WebP stream\n"); + A5O_ERROR("Could not decode WebP stream\n"); al_destroy_bitmap(bmp); return NULL; } @@ -62,16 +62,16 @@ static ALLEGRO_BITMAP *load_from_buffer(const uint8_t* data, size_t data_size, } -ALLEGRO_BITMAP *_al_load_webp_f(ALLEGRO_FILE *fp, int flags) +A5O_BITMAP *_al_load_webp_f(A5O_FILE *fp, int flags) { - ALLEGRO_ASSERT(fp); - ALLEGRO_BITMAP *bmp; + A5O_ASSERT(fp); + A5O_BITMAP *bmp; size_t data_size = al_fsize(fp); uint8_t *data = al_malloc(data_size * sizeof(uint8_t)); if (al_fread(fp, data, data_size) != data_size) { - ALLEGRO_ERROR("Could not read WebP file\n"); + A5O_ERROR("Could not read WebP file\n"); free(data); return NULL; } @@ -87,16 +87,16 @@ ALLEGRO_BITMAP *_al_load_webp_f(ALLEGRO_FILE *fp, int flags) -ALLEGRO_BITMAP *_al_load_webp(const char *filename, int flags) +A5O_BITMAP *_al_load_webp(const char *filename, int flags) { - ALLEGRO_FILE *fp; - ALLEGRO_BITMAP *bmp; + A5O_FILE *fp; + A5O_BITMAP *bmp; - ALLEGRO_ASSERT(filename); + A5O_ASSERT(filename); fp = al_fopen(filename, "rb"); if (!fp) { - ALLEGRO_ERROR("Unable to open %s for reading.\n", filename); + A5O_ERROR("Unable to open %s for reading.\n", filename); return NULL; } @@ -115,16 +115,16 @@ ALLEGRO_BITMAP *_al_load_webp(const char *filename, int flags) ****************************************************************************/ -bool _al_save_webp_f(ALLEGRO_FILE *fp, ALLEGRO_BITMAP *bmp) +bool _al_save_webp_f(A5O_FILE *fp, A5O_BITMAP *bmp) { - ALLEGRO_LOCKED_REGION *lock; + A5O_LOCKED_REGION *lock; bool ret = false; - lock = al_lock_bitmap(bmp, ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, - ALLEGRO_LOCK_READONLY); + lock = al_lock_bitmap(bmp, A5O_PIXEL_FORMAT_ABGR_8888_LE, + A5O_LOCK_READONLY); if (!lock) { - ALLEGRO_ERROR("Failed to lock bitmap.\n"); + A5O_ERROR("Failed to lock bitmap.\n"); return false; } @@ -158,28 +158,28 @@ bool _al_save_webp_f(ALLEGRO_FILE *fp, ALLEGRO_BITMAP *bmp) } -bool _al_save_webp(const char *filename, ALLEGRO_BITMAP *bmp) +bool _al_save_webp(const char *filename, A5O_BITMAP *bmp) { - ALLEGRO_FILE *fp; + A5O_FILE *fp; bool retsave; bool retclose; - ALLEGRO_ASSERT(filename); - ALLEGRO_ASSERT(bmp); + A5O_ASSERT(filename); + A5O_ASSERT(bmp); fp = al_fopen(filename, "wb"); if (!fp) { - ALLEGRO_ERROR("Unable to open file %s for writing\n", filename); + A5O_ERROR("Unable to open file %s for writing\n", filename); return false; } retsave = _al_save_webp_f(fp, bmp); if (!retsave) { - ALLEGRO_ERROR("Unable to store WebP bitmap in file %s\n", filename); + A5O_ERROR("Unable to store WebP bitmap in file %s\n", filename); } retclose = al_fclose(fp); if (!retclose) { - ALLEGRO_ERROR("Unable to close file %s\n", filename); + A5O_ERROR("Unable to close file %s\n", filename); } return retsave && retclose; diff --git a/addons/main/CMakeLists.txt b/addons/main/CMakeLists.txt index 45808cfb99..63a6b2b949 100644 --- a/addons/main/CMakeLists.txt +++ b/addons/main/CMakeLists.txt @@ -1,18 +1,18 @@ -if(ALLEGRO_MACOSX) +if(A5O_MACOSX) set(MAIN_SOURCES osx_main.m) - set(SUPPORT_ALLEGRO_MAIN 1) -endif(ALLEGRO_MACOSX) + set(SUPPORT_A5O_MAIN 1) +endif(A5O_MACOSX) -if(NOT SUPPORT_ALLEGRO_MAIN) +if(NOT SUPPORT_A5O_MAIN) set(MAIN_SOURCES generic_main.c) - set(SUPPORT_ALLEGRO_MAIN 1) -endif(NOT SUPPORT_ALLEGRO_MAIN) + set(SUPPORT_A5O_MAIN 1) +endif(NOT SUPPORT_A5O_MAIN) add_our_addon_library(allegro_main - AllegroMain-${ALLEGRO_SOVERSION} + AllegroMain-${A5O_SOVERSION} "${MAIN_SOURCES}" - "-DALLEGRO_SRC" - "${ALLEGRO_LINK_WITH}" + "-DA5O_SRC" + "${A5O_LINK_WITH}" ) add_addon(main) diff --git a/addons/main/osx_main.m b/addons/main/osx_main.m index d6df1997bc..1cfb1c22af 100644 --- a/addons/main/osx_main.m +++ b/addons/main/osx_main.m @@ -19,7 +19,7 @@ #include "allegro5/internal/aintern.h" #include "allegro5/platform/aintosx.h" -#ifndef ALLEGRO_MACOSX +#ifndef A5O_MACOSX #error something is wrong with the makefile #endif #undef main diff --git a/addons/memfile/CMakeLists.txt b/addons/memfile/CMakeLists.txt index ca293e33fe..9e373a33ee 100644 --- a/addons/memfile/CMakeLists.txt +++ b/addons/memfile/CMakeLists.txt @@ -6,10 +6,10 @@ set(MEMFILE_INCLUDE_FILES allegro5/allegro_memfile.h) set_our_header_properties(${MEMFILE_INCLUDE_FILES}) add_our_addon_library(allegro_memfile - AllegroMemfile-${ALLEGRO_SOVERSION} + AllegroMemfile-${A5O_SOVERSION} "${MEMFILE_SOURCES};${MEMFILE_INCLUDE_FILES}" - "-DALLEGRO_MEMFILE_SRC" - "${ALLEGRO_LINK_WITH}" + "-DA5O_MEMFILE_SRC" + "${A5O_LINK_WITH}" ) install_our_headers(${MEMFILE_INCLUDE_FILES}) diff --git a/addons/memfile/allegro5/allegro_memfile.h b/addons/memfile/allegro5/allegro_memfile.h index 5d8f6c4844..689b86c3f5 100644 --- a/addons/memfile/allegro5/allegro_memfile.h +++ b/addons/memfile/allegro5/allegro_memfile.h @@ -7,31 +7,31 @@ extern "C" { #endif -#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32) - #ifndef ALLEGRO_STATICLINK - #ifdef ALLEGRO_MEMFILE_SRC - #define _ALLEGRO_MEMFILE_DLL __declspec(dllexport) +#if (defined A5O_MINGW32) || (defined A5O_MSVC) || (defined A5O_BCC32) + #ifndef A5O_STATICLINK + #ifdef A5O_MEMFILE_SRC + #define _A5O_MEMFILE_DLL __declspec(dllexport) #else - #define _ALLEGRO_MEMFILE_DLL __declspec(dllimport) + #define _A5O_MEMFILE_DLL __declspec(dllimport) #endif #else - #define _ALLEGRO_MEMFILE_DLL + #define _A5O_MEMFILE_DLL #endif #endif -#if defined ALLEGRO_MSVC - #define ALLEGRO_MEMFILE_FUNC(type, name, args) _ALLEGRO_MEMFILE_DLL type __cdecl name args -#elif defined ALLEGRO_MINGW32 - #define ALLEGRO_MEMFILE_FUNC(type, name, args) extern type name args -#elif defined ALLEGRO_BCC32 - #define ALLEGRO_MEMFILE_FUNC(type, name, args) extern _ALLEGRO_MEMFILE_DLL type name args +#if defined A5O_MSVC + #define A5O_MEMFILE_FUNC(type, name, args) _A5O_MEMFILE_DLL type __cdecl name args +#elif defined A5O_MINGW32 + #define A5O_MEMFILE_FUNC(type, name, args) extern type name args +#elif defined A5O_BCC32 + #define A5O_MEMFILE_FUNC(type, name, args) extern _A5O_MEMFILE_DLL type name args #else - #define ALLEGRO_MEMFILE_FUNC AL_FUNC + #define A5O_MEMFILE_FUNC AL_FUNC #endif -ALLEGRO_MEMFILE_FUNC(ALLEGRO_FILE *, al_open_memfile, (void *mem, int64_t size, const char *mode)); -ALLEGRO_MEMFILE_FUNC(uint32_t, al_get_allegro_memfile_version, (void)); +A5O_MEMFILE_FUNC(A5O_FILE *, al_open_memfile, (void *mem, int64_t size, const char *mode)); +A5O_MEMFILE_FUNC(uint32_t, al_get_allegro_memfile_version, (void)); #ifdef __cplusplus } diff --git a/addons/memfile/memfile.c b/addons/memfile/memfile.c index 411c0413ad..2e4c840577 100644 --- a/addons/memfile/memfile.c +++ b/addons/memfile/memfile.c @@ -1,9 +1,9 @@ #include #include "allegro5/allegro_memfile.h" -typedef struct ALLEGRO_FILE_MEMFILE ALLEGRO_FILE_MEMFILE; +typedef struct A5O_FILE_MEMFILE A5O_FILE_MEMFILE; -struct ALLEGRO_FILE_MEMFILE { +struct A5O_FILE_MEMFILE { bool readable; bool writable; @@ -13,15 +13,15 @@ struct ALLEGRO_FILE_MEMFILE { char *mem; }; -static bool memfile_fclose(ALLEGRO_FILE *fp) +static bool memfile_fclose(A5O_FILE *fp) { al_free(al_get_file_userdata(fp)); return true; } -static size_t memfile_fread(ALLEGRO_FILE *fp, void *ptr, size_t size) +static size_t memfile_fread(A5O_FILE *fp, void *ptr, size_t size) { - ALLEGRO_FILE_MEMFILE *mf = al_get_file_userdata(fp); + A5O_FILE_MEMFILE *mf = al_get_file_userdata(fp); size_t n = 0; if (!mf->readable) { @@ -44,9 +44,9 @@ static size_t memfile_fread(ALLEGRO_FILE *fp, void *ptr, size_t size) return n; } -static size_t memfile_fwrite(ALLEGRO_FILE *fp, const void *ptr, size_t size) +static size_t memfile_fwrite(A5O_FILE *fp, const void *ptr, size_t size) { - ALLEGRO_FILE_MEMFILE *mf = al_get_file_userdata(fp); + A5O_FILE_MEMFILE *mf = al_get_file_userdata(fp); size_t n; if (!mf->writable) { @@ -69,35 +69,35 @@ static size_t memfile_fwrite(ALLEGRO_FILE *fp, const void *ptr, size_t size) return n; } -static bool memfile_fflush(ALLEGRO_FILE *fp) +static bool memfile_fflush(A5O_FILE *fp) { (void)fp; return true; } -static int64_t memfile_ftell(ALLEGRO_FILE *fp) +static int64_t memfile_ftell(A5O_FILE *fp) { - ALLEGRO_FILE_MEMFILE *mf = al_get_file_userdata(fp); + A5O_FILE_MEMFILE *mf = al_get_file_userdata(fp); return mf->pos; } -static bool memfile_fseek(ALLEGRO_FILE *fp, int64_t offset, +static bool memfile_fseek(A5O_FILE *fp, int64_t offset, int whence) { - ALLEGRO_FILE_MEMFILE *mf = al_get_file_userdata(fp); + A5O_FILE_MEMFILE *mf = al_get_file_userdata(fp); int64_t pos = mf->pos; switch (whence) { - case ALLEGRO_SEEK_SET: + case A5O_SEEK_SET: pos = offset; break; - case ALLEGRO_SEEK_CUR: + case A5O_SEEK_CUR: pos = mf->pos + offset; break; - case ALLEGRO_SEEK_END: + case A5O_SEEK_END: pos = mf->size + offset; break; } @@ -117,38 +117,38 @@ static bool memfile_fseek(ALLEGRO_FILE *fp, int64_t offset, /* doesn't quite match up to stdio here, an feof after a seek will return false, even if it seeks past the end of the file */ -static bool memfile_feof(ALLEGRO_FILE *fp) +static bool memfile_feof(A5O_FILE *fp) { - ALLEGRO_FILE_MEMFILE *mf = al_get_file_userdata(fp); + A5O_FILE_MEMFILE *mf = al_get_file_userdata(fp); return mf->eof; } -static int memfile_ferror(ALLEGRO_FILE *fp) +static int memfile_ferror(A5O_FILE *fp) { (void)fp; return 0; } -static const char *memfile_ferrmsg(ALLEGRO_FILE *fp) +static const char *memfile_ferrmsg(A5O_FILE *fp) { (void)fp; return ""; } -static void memfile_fclearerr(ALLEGRO_FILE *fp) +static void memfile_fclearerr(A5O_FILE *fp) { - ALLEGRO_FILE_MEMFILE *mf = al_get_file_userdata(fp); + A5O_FILE_MEMFILE *mf = al_get_file_userdata(fp); mf->eof = false; } -static off_t memfile_fsize(ALLEGRO_FILE *fp) +static off_t memfile_fsize(A5O_FILE *fp) { - ALLEGRO_FILE_MEMFILE *mf = al_get_file_userdata(fp); + A5O_FILE_MEMFILE *mf = al_get_file_userdata(fp); return mf->size; } -static struct ALLEGRO_FILE_INTERFACE memfile_vtable = { +static struct A5O_FILE_INTERFACE memfile_vtable = { NULL, /* open */ memfile_fclose, memfile_fread, @@ -166,15 +166,15 @@ static struct ALLEGRO_FILE_INTERFACE memfile_vtable = { /* Function: al_open_memfile */ -ALLEGRO_FILE *al_open_memfile(void *mem, int64_t size, const char *mode) +A5O_FILE *al_open_memfile(void *mem, int64_t size, const char *mode) { - ALLEGRO_FILE *memfile; - ALLEGRO_FILE_MEMFILE *userdata = NULL; + A5O_FILE *memfile; + A5O_FILE_MEMFILE *userdata = NULL; ASSERT(mem); ASSERT(size > 0); - userdata = al_malloc(sizeof(ALLEGRO_FILE_MEMFILE)); + userdata = al_malloc(sizeof(A5O_FILE_MEMFILE)); if (!userdata) { al_set_errno(ENOMEM); return NULL; @@ -200,7 +200,7 @@ ALLEGRO_FILE *al_open_memfile(void *mem, int64_t size, const char *mode) */ uint32_t al_get_allegro_memfile_version(void) { - return ALLEGRO_VERSION_INT; + return A5O_VERSION_INT; } /* vim: set sts=3 sw=3 et: */ diff --git a/addons/native_dialog/CMakeLists.txt b/addons/native_dialog/CMakeLists.txt index 5726ae70bd..31c1db1f3a 100644 --- a/addons/native_dialog/CMakeLists.txt +++ b/addons/native_dialog/CMakeLists.txt @@ -20,29 +20,29 @@ set(GTK_NATIVE_DIALOG_SOURCES if(APPLE AND NOT IPHONE) list(APPEND NATIVE_DIALOG_SOURCES osx_dialog.m) - set(ALLEGRO_CFG_NATIVE_DIALOG_OSX 1) + set(A5O_CFG_NATIVE_DIALOG_OSX 1) set(SUPPORT_NATIVE_DIALOG 1) endif(APPLE AND NOT IPHONE) if(APPLE AND IPHONE) list(APPEND NATIVE_DIALOG_SOURCES iphone_dialog.m) - set(ALLEGRO_CFG_NATIVE_DIALOG_IPHONE 1) + set(A5O_CFG_NATIVE_DIALOG_IPHONE 1) set(SUPPORT_NATIVE_DIALOG 1) endif(APPLE AND IPHONE) if(ANDROID) list(APPEND NATIVE_DIALOG_SOURCES android_dialog.c) - set(ALLEGRO_CFG_NATIVE_DIALOG_ANDROID 1) + set(A5O_CFG_NATIVE_DIALOG_ANDROID 1) set(SUPPORT_NATIVE_DIALOG 1) endif(ANDROID) if(WIN32) list(APPEND NATIVE_DIALOG_SOURCES win_dialog.c) - set(ALLEGRO_CFG_NATIVE_DIALOG_WINDOWS 1) + set(A5O_CFG_NATIVE_DIALOG_WINDOWS 1) set(SUPPORT_NATIVE_DIALOG 1) endif(WIN32) -if(NOT SUPPORT_NATIVE_DIALOG AND SUPPORT_X11 AND NOT ALLEGRO_RASPBERRYPI) +if(NOT SUPPORT_NATIVE_DIALOG AND SUPPORT_X11 AND NOT A5O_RASPBERRYPI) pkg_check_modules(GTK gtk+-3.0) pkg_check_modules(GT gthread-2.0) if(GTK_FOUND AND GT_FOUND) @@ -55,7 +55,7 @@ if(NOT SUPPORT_NATIVE_DIALOG AND SUPPORT_X11 AND NOT ALLEGRO_RASPBERRYPI) PROPERTIES COMPILE_FLAGS "${GTK_CFLAGS_STRING}" ) - set(ALLEGRO_CFG_NATIVE_DIALOG_GTK 1) + set(A5O_CFG_NATIVE_DIALOG_GTK 1) set(SUPPORT_NATIVE_DIALOG 1) endif() endif() @@ -70,10 +70,10 @@ if(SUPPORT_NATIVE_DIALOG) # Note: allegro_dialog NOT allegro_native_dialog. add_our_addon_library(allegro_dialog - AllegroDialog-${ALLEGRO_SOVERSION} + AllegroDialog-${A5O_SOVERSION} "${NATIVE_DIALOG_SOURCES};${NATIVE_DIALOG_INCLUDE_FILES}" - "-DALLEGRO_NATIVE_DIALOG_SRC" - "${NATIVE_DIALOG_LIBRARIES};${ALLEGRO_LINK_WITH}" + "-DA5O_NATIVE_DIALOG_SRC" + "${NATIVE_DIALOG_LIBRARIES};${A5O_LINK_WITH}" ) install_our_headers(${NATIVE_DIALOG_INCLUDE_FILES}) diff --git a/addons/native_dialog/allegro5/allegro_native_dialog.h b/addons/native_dialog/allegro5/allegro_native_dialog.h index 2d48f517cc..62119f927f 100644 --- a/addons/native_dialog/allegro5/allegro_native_dialog.h +++ b/addons/native_dialog/allegro5/allegro_native_dialog.h @@ -7,151 +7,151 @@ extern "C" { #endif -#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32) - #ifndef ALLEGRO_STATICLINK - #ifdef ALLEGRO_NATIVE_DIALOG_SRC - #define _ALLEGRO_DIALOG_DLL __declspec(dllexport) +#if (defined A5O_MINGW32) || (defined A5O_MSVC) || (defined A5O_BCC32) + #ifndef A5O_STATICLINK + #ifdef A5O_NATIVE_DIALOG_SRC + #define _A5O_DIALOG_DLL __declspec(dllexport) #else - #define _ALLEGRO_DIALOG_DLL __declspec(dllimport) + #define _A5O_DIALOG_DLL __declspec(dllimport) #endif #else - #define _ALLEGRO_DIALOG_DLL + #define _A5O_DIALOG_DLL #endif #endif -#if defined ALLEGRO_MSVC - #define ALLEGRO_DIALOG_FUNC(type, name, args) _ALLEGRO_DIALOG_DLL type __cdecl name args -#elif defined ALLEGRO_MINGW32 - #define ALLEGRO_DIALOG_FUNC(type, name, args) extern type name args -#elif defined ALLEGRO_BCC32 - #define ALLEGRO_DIALOG_FUNC(type, name, args) extern _ALLEGRO_DIALOG_DLL type name args +#if defined A5O_MSVC + #define A5O_DIALOG_FUNC(type, name, args) _A5O_DIALOG_DLL type __cdecl name args +#elif defined A5O_MINGW32 + #define A5O_DIALOG_FUNC(type, name, args) extern type name args +#elif defined A5O_BCC32 + #define A5O_DIALOG_FUNC(type, name, args) extern _A5O_DIALOG_DLL type name args #else - #define ALLEGRO_DIALOG_FUNC AL_FUNC + #define A5O_DIALOG_FUNC AL_FUNC #endif -#ifdef ALLEGRO_WITH_XWINDOWS - #define ALLEGRO_GTK_TOPLEVEL ALLEGRO_GTK_TOPLEVEL_INTERNAL +#ifdef A5O_WITH_XWINDOWS + #define A5O_GTK_TOPLEVEL A5O_GTK_TOPLEVEL_INTERNAL #endif -/* Type: ALLEGRO_FILECHOOSER +/* Type: A5O_FILECHOOSER */ -typedef struct ALLEGRO_FILECHOOSER ALLEGRO_FILECHOOSER; +typedef struct A5O_FILECHOOSER A5O_FILECHOOSER; -/* Type: ALLEGRO_TEXTLOG +/* Type: A5O_TEXTLOG */ -typedef struct ALLEGRO_TEXTLOG ALLEGRO_TEXTLOG; +typedef struct A5O_TEXTLOG A5O_TEXTLOG; -/* Type: ALLEGRO_MENU +/* Type: A5O_MENU */ -typedef struct ALLEGRO_MENU ALLEGRO_MENU; +typedef struct A5O_MENU A5O_MENU; -/* Type: ALLEGRO_MENU_INFO +/* Type: A5O_MENU_INFO */ -typedef struct ALLEGRO_MENU_INFO { +typedef struct A5O_MENU_INFO { const char *caption; uint16_t id; int flags; - ALLEGRO_BITMAP *icon; -} ALLEGRO_MENU_INFO; + A5O_BITMAP *icon; +} A5O_MENU_INFO; -#define ALLEGRO_MENU_SEPARATOR { NULL, -1, 0, NULL } -#define ALLEGRO_START_OF_MENU(caption, id) { caption "->", id, 0, NULL } -#define ALLEGRO_END_OF_MENU { NULL, 0, 0, NULL } +#define A5O_MENU_SEPARATOR { NULL, -1, 0, NULL } +#define A5O_START_OF_MENU(caption, id) { caption "->", id, 0, NULL } +#define A5O_END_OF_MENU { NULL, 0, 0, NULL } -ALLEGRO_DIALOG_FUNC(bool, al_init_native_dialog_addon, (void)); -ALLEGRO_DIALOG_FUNC(bool, al_is_native_dialog_addon_initialized, (void)); -ALLEGRO_DIALOG_FUNC(void, al_shutdown_native_dialog_addon, (void)); +A5O_DIALOG_FUNC(bool, al_init_native_dialog_addon, (void)); +A5O_DIALOG_FUNC(bool, al_is_native_dialog_addon_initialized, (void)); +A5O_DIALOG_FUNC(void, al_shutdown_native_dialog_addon, (void)); -ALLEGRO_DIALOG_FUNC(ALLEGRO_FILECHOOSER *, al_create_native_file_dialog, (char const *initial_path, +A5O_DIALOG_FUNC(A5O_FILECHOOSER *, al_create_native_file_dialog, (char const *initial_path, char const *title, char const *patterns, int mode)); -ALLEGRO_DIALOG_FUNC(bool, al_show_native_file_dialog, (ALLEGRO_DISPLAY *display, ALLEGRO_FILECHOOSER *dialog)); -ALLEGRO_DIALOG_FUNC(int, al_get_native_file_dialog_count, (const ALLEGRO_FILECHOOSER *dialog)); -ALLEGRO_DIALOG_FUNC(const char *, al_get_native_file_dialog_path, (const ALLEGRO_FILECHOOSER *dialog, +A5O_DIALOG_FUNC(bool, al_show_native_file_dialog, (A5O_DISPLAY *display, A5O_FILECHOOSER *dialog)); +A5O_DIALOG_FUNC(int, al_get_native_file_dialog_count, (const A5O_FILECHOOSER *dialog)); +A5O_DIALOG_FUNC(const char *, al_get_native_file_dialog_path, (const A5O_FILECHOOSER *dialog, size_t index)); -ALLEGRO_DIALOG_FUNC(void, al_destroy_native_file_dialog, (ALLEGRO_FILECHOOSER *dialog)); +A5O_DIALOG_FUNC(void, al_destroy_native_file_dialog, (A5O_FILECHOOSER *dialog)); -ALLEGRO_DIALOG_FUNC(int, al_show_native_message_box, (ALLEGRO_DISPLAY *display, char const *title, +A5O_DIALOG_FUNC(int, al_show_native_message_box, (A5O_DISPLAY *display, char const *title, char const *heading, char const *text, char const *buttons, int flags)); -ALLEGRO_DIALOG_FUNC(ALLEGRO_TEXTLOG *, al_open_native_text_log, (char const *title, int flags)); -ALLEGRO_DIALOG_FUNC(void, al_close_native_text_log, (ALLEGRO_TEXTLOG *textlog)); -ALLEGRO_DIALOG_FUNC(void, al_append_native_text_log, (ALLEGRO_TEXTLOG *textlog, char const *format, ...)); -ALLEGRO_DIALOG_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_native_text_log_event_source, (ALLEGRO_TEXTLOG *textlog)); +A5O_DIALOG_FUNC(A5O_TEXTLOG *, al_open_native_text_log, (char const *title, int flags)); +A5O_DIALOG_FUNC(void, al_close_native_text_log, (A5O_TEXTLOG *textlog)); +A5O_DIALOG_FUNC(void, al_append_native_text_log, (A5O_TEXTLOG *textlog, char const *format, ...)); +A5O_DIALOG_FUNC(A5O_EVENT_SOURCE *, al_get_native_text_log_event_source, (A5O_TEXTLOG *textlog)); /* creating/modifying menus */ -ALLEGRO_DIALOG_FUNC(ALLEGRO_MENU *, al_create_menu, (void)); -ALLEGRO_DIALOG_FUNC(ALLEGRO_MENU *, al_create_popup_menu, (void)); -ALLEGRO_DIALOG_FUNC(ALLEGRO_MENU *, al_build_menu, (ALLEGRO_MENU_INFO *info)); -ALLEGRO_DIALOG_FUNC(int, al_append_menu_item, (ALLEGRO_MENU *parent, char const *title, uint16_t id, int flags, - ALLEGRO_BITMAP *icon, ALLEGRO_MENU *submenu)); -ALLEGRO_DIALOG_FUNC(int, al_insert_menu_item, (ALLEGRO_MENU *parent, int pos, char const *title, uint16_t id, - int flags, ALLEGRO_BITMAP *icon, ALLEGRO_MENU *submenu)); -ALLEGRO_DIALOG_FUNC(bool, al_remove_menu_item, (ALLEGRO_MENU *menu, int pos)); -ALLEGRO_DIALOG_FUNC(ALLEGRO_MENU *, al_clone_menu, (ALLEGRO_MENU *menu)); -ALLEGRO_DIALOG_FUNC(ALLEGRO_MENU *, al_clone_menu_for_popup, (ALLEGRO_MENU *menu)); -ALLEGRO_DIALOG_FUNC(void, al_destroy_menu, (ALLEGRO_MENU *menu)); +A5O_DIALOG_FUNC(A5O_MENU *, al_create_menu, (void)); +A5O_DIALOG_FUNC(A5O_MENU *, al_create_popup_menu, (void)); +A5O_DIALOG_FUNC(A5O_MENU *, al_build_menu, (A5O_MENU_INFO *info)); +A5O_DIALOG_FUNC(int, al_append_menu_item, (A5O_MENU *parent, char const *title, uint16_t id, int flags, + A5O_BITMAP *icon, A5O_MENU *submenu)); +A5O_DIALOG_FUNC(int, al_insert_menu_item, (A5O_MENU *parent, int pos, char const *title, uint16_t id, + int flags, A5O_BITMAP *icon, A5O_MENU *submenu)); +A5O_DIALOG_FUNC(bool, al_remove_menu_item, (A5O_MENU *menu, int pos)); +A5O_DIALOG_FUNC(A5O_MENU *, al_clone_menu, (A5O_MENU *menu)); +A5O_DIALOG_FUNC(A5O_MENU *, al_clone_menu_for_popup, (A5O_MENU *menu)); +A5O_DIALOG_FUNC(void, al_destroy_menu, (A5O_MENU *menu)); /* properties */ -ALLEGRO_DIALOG_FUNC(const char *, al_get_menu_item_caption, (ALLEGRO_MENU *menu, int pos)); -ALLEGRO_DIALOG_FUNC(void, al_set_menu_item_caption, (ALLEGRO_MENU *menu, int pos, const char *caption)); -ALLEGRO_DIALOG_FUNC(int, al_get_menu_item_flags, (ALLEGRO_MENU *menu, int pos)); -ALLEGRO_DIALOG_FUNC(void, al_set_menu_item_flags, (ALLEGRO_MENU *menu, int pos, int flags)); -ALLEGRO_DIALOG_FUNC(ALLEGRO_BITMAP *, al_get_menu_item_icon, (ALLEGRO_MENU *menu, int pos)); -ALLEGRO_DIALOG_FUNC(void, al_set_menu_item_icon, (ALLEGRO_MENU *menu, int pos, ALLEGRO_BITMAP *icon)); - -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_NATIVE_DIALOG_SRC) -ALLEGRO_DIALOG_FUNC(int, al_toggle_menu_item_flags, (ALLEGRO_MENU *menu, int pos, int flags)); +A5O_DIALOG_FUNC(const char *, al_get_menu_item_caption, (A5O_MENU *menu, int pos)); +A5O_DIALOG_FUNC(void, al_set_menu_item_caption, (A5O_MENU *menu, int pos, const char *caption)); +A5O_DIALOG_FUNC(int, al_get_menu_item_flags, (A5O_MENU *menu, int pos)); +A5O_DIALOG_FUNC(void, al_set_menu_item_flags, (A5O_MENU *menu, int pos, int flags)); +A5O_DIALOG_FUNC(A5O_BITMAP *, al_get_menu_item_icon, (A5O_MENU *menu, int pos)); +A5O_DIALOG_FUNC(void, al_set_menu_item_icon, (A5O_MENU *menu, int pos, A5O_BITMAP *icon)); + +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_NATIVE_DIALOG_SRC) +A5O_DIALOG_FUNC(int, al_toggle_menu_item_flags, (A5O_MENU *menu, int pos, int flags)); #endif /* querying menus */ -ALLEGRO_DIALOG_FUNC(ALLEGRO_MENU *, al_find_menu, (ALLEGRO_MENU *haystack, uint16_t id)); -ALLEGRO_DIALOG_FUNC(bool, al_find_menu_item, (ALLEGRO_MENU *haystack, uint16_t id, ALLEGRO_MENU **menu, int *index)); +A5O_DIALOG_FUNC(A5O_MENU *, al_find_menu, (A5O_MENU *haystack, uint16_t id)); +A5O_DIALOG_FUNC(bool, al_find_menu_item, (A5O_MENU *haystack, uint16_t id, A5O_MENU **menu, int *index)); /* menu events */ -ALLEGRO_DIALOG_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_default_menu_event_source, (void)); -ALLEGRO_DIALOG_FUNC(ALLEGRO_EVENT_SOURCE *, al_enable_menu_event_source, (ALLEGRO_MENU *menu)); -ALLEGRO_DIALOG_FUNC(void, al_disable_menu_event_source, (ALLEGRO_MENU *menu)); +A5O_DIALOG_FUNC(A5O_EVENT_SOURCE *, al_get_default_menu_event_source, (void)); +A5O_DIALOG_FUNC(A5O_EVENT_SOURCE *, al_enable_menu_event_source, (A5O_MENU *menu)); +A5O_DIALOG_FUNC(void, al_disable_menu_event_source, (A5O_MENU *menu)); /* displaying menus */ -ALLEGRO_DIALOG_FUNC(ALLEGRO_MENU *, al_get_display_menu, (ALLEGRO_DISPLAY *display)); -ALLEGRO_DIALOG_FUNC(bool, al_set_display_menu, (ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu)); -ALLEGRO_DIALOG_FUNC(bool, al_popup_menu, (ALLEGRO_MENU *popup, ALLEGRO_DISPLAY *display)); -ALLEGRO_DIALOG_FUNC(ALLEGRO_MENU *, al_remove_display_menu, (ALLEGRO_DISPLAY *display)); +A5O_DIALOG_FUNC(A5O_MENU *, al_get_display_menu, (A5O_DISPLAY *display)); +A5O_DIALOG_FUNC(bool, al_set_display_menu, (A5O_DISPLAY *display, A5O_MENU *menu)); +A5O_DIALOG_FUNC(bool, al_popup_menu, (A5O_MENU *popup, A5O_DISPLAY *display)); +A5O_DIALOG_FUNC(A5O_MENU *, al_remove_display_menu, (A5O_DISPLAY *display)); -ALLEGRO_DIALOG_FUNC(uint32_t, al_get_allegro_native_dialog_version, (void)); +A5O_DIALOG_FUNC(uint32_t, al_get_allegro_native_dialog_version, (void)); enum { - ALLEGRO_FILECHOOSER_FILE_MUST_EXIST = 1, - ALLEGRO_FILECHOOSER_SAVE = 2, - ALLEGRO_FILECHOOSER_FOLDER = 4, - ALLEGRO_FILECHOOSER_PICTURES = 8, - ALLEGRO_FILECHOOSER_SHOW_HIDDEN = 16, - ALLEGRO_FILECHOOSER_MULTIPLE = 32 + A5O_FILECHOOSER_FILE_MUST_EXIST = 1, + A5O_FILECHOOSER_SAVE = 2, + A5O_FILECHOOSER_FOLDER = 4, + A5O_FILECHOOSER_PICTURES = 8, + A5O_FILECHOOSER_SHOW_HIDDEN = 16, + A5O_FILECHOOSER_MULTIPLE = 32 }; enum { - ALLEGRO_MESSAGEBOX_WARN = 1<<0, - ALLEGRO_MESSAGEBOX_ERROR = 1<<1, - ALLEGRO_MESSAGEBOX_OK_CANCEL = 1<<2, - ALLEGRO_MESSAGEBOX_YES_NO = 1<<3, - ALLEGRO_MESSAGEBOX_QUESTION = 1<<4 + A5O_MESSAGEBOX_WARN = 1<<0, + A5O_MESSAGEBOX_ERROR = 1<<1, + A5O_MESSAGEBOX_OK_CANCEL = 1<<2, + A5O_MESSAGEBOX_YES_NO = 1<<3, + A5O_MESSAGEBOX_QUESTION = 1<<4 }; enum { - ALLEGRO_TEXTLOG_NO_CLOSE = 1<<0, - ALLEGRO_TEXTLOG_MONOSPACE = 1<<1 + A5O_TEXTLOG_NO_CLOSE = 1<<0, + A5O_TEXTLOG_MONOSPACE = 1<<1 }; enum { - ALLEGRO_EVENT_NATIVE_DIALOG_CLOSE = 600, - ALLEGRO_EVENT_MENU_CLICK = 601 + A5O_EVENT_NATIVE_DIALOG_CLOSE = 600, + A5O_EVENT_MENU_CLICK = 601 }; enum { - ALLEGRO_MENU_ITEM_ENABLED = 0, - ALLEGRO_MENU_ITEM_CHECKBOX = 1, - ALLEGRO_MENU_ITEM_CHECKED = 2, - ALLEGRO_MENU_ITEM_DISABLED = 4 + A5O_MENU_ITEM_ENABLED = 0, + A5O_MENU_ITEM_CHECKBOX = 1, + A5O_MENU_ITEM_CHECKED = 2, + A5O_MENU_ITEM_DISABLED = 4 }; diff --git a/addons/native_dialog/allegro5/internal/aintern_native_dialog.h b/addons/native_dialog/allegro5/internal/aintern_native_dialog.h index 2dd7c1bc2b..935ac7a8c1 100644 --- a/addons/native_dialog/allegro5/internal/aintern_native_dialog.h +++ b/addons/native_dialog/allegro5/internal/aintern_native_dialog.h @@ -7,51 +7,51 @@ typedef struct { - ALLEGRO_USTR_INFO info; + A5O_USTR_INFO info; bool is_mime; bool is_catchall; } _AL_PATTERN; typedef struct { - ALLEGRO_USTR_INFO desc; + A5O_USTR_INFO desc; _AL_VECTOR patterns_vec; } _AL_PATTERNS_AND_DESC; -typedef struct ALLEGRO_NATIVE_DIALOG ALLEGRO_NATIVE_DIALOG; +typedef struct A5O_NATIVE_DIALOG A5O_NATIVE_DIALOG; /* We could use different structs for the different dialogs. But why * bother. */ -struct ALLEGRO_NATIVE_DIALOG +struct A5O_NATIVE_DIALOG { - ALLEGRO_USTR *title; + A5O_USTR *title; int flags; /* Only used by file chooser. */ - ALLEGRO_PATH *fc_initial_path; + A5O_PATH *fc_initial_path; size_t fc_path_count; - ALLEGRO_PATH **fc_paths; + A5O_PATH **fc_paths; /* Vector of _AL_PATTERNS_AND_DESC, substrings index into fc_patterns_ustr. */ _AL_VECTOR fc_patterns; - ALLEGRO_USTR *fc_patterns_ustr; + A5O_USTR *fc_patterns_ustr; /* Only used by message box. */ - ALLEGRO_USTR *mb_heading; - ALLEGRO_USTR *mb_text; - ALLEGRO_USTR *mb_buttons; + A5O_USTR *mb_heading; + A5O_USTR *mb_text; + A5O_USTR *mb_buttons; int mb_pressed_button; /* Only used by text log. */ - ALLEGRO_THREAD *tl_thread; - ALLEGRO_COND *tl_text_cond; - ALLEGRO_MUTEX *tl_text_mutex; - ALLEGRO_USTR *tl_pending_text; + A5O_THREAD *tl_thread; + A5O_COND *tl_text_cond; + A5O_MUTEX *tl_text_mutex; + A5O_USTR *tl_pending_text; bool tl_init_error; bool tl_done; bool tl_have_pending; - ALLEGRO_EVENT_SOURCE tl_events; + A5O_EVENT_SOURCE tl_events; void *tl_textview; /* Only used by platform implementations. */ @@ -64,22 +64,22 @@ struct ALLEGRO_NATIVE_DIALOG extern bool _al_init_native_dialog_addon(void); extern void _al_shutdown_native_dialog_addon(void); -extern bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display, - ALLEGRO_NATIVE_DIALOG *fd); -extern int _al_show_native_message_box(ALLEGRO_DISPLAY *display, - ALLEGRO_NATIVE_DIALOG *fd); -extern bool _al_open_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog); -extern void _al_close_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog); -extern void _al_append_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog); +extern bool _al_show_native_file_dialog(A5O_DISPLAY *display, + A5O_NATIVE_DIALOG *fd); +extern int _al_show_native_message_box(A5O_DISPLAY *display, + A5O_NATIVE_DIALOG *fd); +extern bool _al_open_native_text_log(A5O_NATIVE_DIALOG *textlog); +extern void _al_close_native_text_log(A5O_NATIVE_DIALOG *textlog); +extern void _al_append_native_text_log(A5O_NATIVE_DIALOG *textlog); -typedef struct ALLEGRO_MENU_ITEM ALLEGRO_MENU_ITEM; +typedef struct A5O_MENU_ITEM A5O_MENU_ITEM; -struct ALLEGRO_MENU_ITEM +struct A5O_MENU_ITEM { - ALLEGRO_MENU *parent; - ALLEGRO_MENU *popup; - ALLEGRO_USTR *caption; - ALLEGRO_BITMAP *icon; + A5O_MENU *parent; + A5O_MENU *popup; + A5O_USTR *caption; + A5O_BITMAP *icon; /* This id is unique. */ uint16_t unique_id; @@ -97,16 +97,16 @@ typedef struct _AL_MENU_ID _AL_MENU_ID; struct _AL_MENU_ID { - ALLEGRO_MENU *menu; + A5O_MENU *menu; uint16_t unique_id; uint16_t id; }; -struct ALLEGRO_MENU +struct A5O_MENU { - ALLEGRO_EVENT_SOURCE es; - ALLEGRO_DISPLAY *display; - ALLEGRO_MENU_ITEM *parent; + A5O_EVENT_SOURCE es; + A5O_DISPLAY *display; + A5O_MENU_ITEM *parent; _AL_VECTOR items; bool is_event_source; @@ -119,15 +119,15 @@ struct ALLEGRO_MENU * display: the display associated with the menu * unique_id: the unique id associated with the menu item * - * The function will find the appropriate ALLEGRO_MENU and emit the event. + * The function will find the appropriate A5O_MENU and emit the event. */ -extern bool _al_emit_menu_event(ALLEGRO_DISPLAY *display, uint16_t unique_id); +extern bool _al_emit_menu_event(A5O_DISPLAY *display, uint16_t unique_id); -extern bool _al_walk_over_menu(ALLEGRO_MENU *menu, bool (*proc) - (ALLEGRO_MENU *menu, ALLEGRO_MENU_ITEM *item, int index, void *extra), +extern bool _al_walk_over_menu(A5O_MENU *menu, bool (*proc) + (A5O_MENU *menu, A5O_MENU_ITEM *item, int index, void *extra), void *extra); -_AL_MENU_ID *_al_find_parent_menu_by_id(ALLEGRO_DISPLAY *display, uint16_t unique_id); -bool _al_find_menu_item_unique(ALLEGRO_MENU *haystack, uint16_t unique_id, ALLEGRO_MENU **menu, +_AL_MENU_ID *_al_find_parent_menu_by_id(A5O_DISPLAY *display, uint16_t unique_id); +bool _al_find_menu_item_unique(A5O_MENU *haystack, uint16_t unique_id, A5O_MENU **menu, int *index); /* Platform Specific Functions @@ -137,9 +137,9 @@ bool _al_find_menu_item_unique(ALLEGRO_MENU *haystack, uint16_t unique_id, ALLEG * at all). All of the parameters will be valid. */ -extern bool _al_init_menu(ALLEGRO_MENU *menu); -extern bool _al_init_popup_menu(ALLEGRO_MENU *menu); -extern bool _al_destroy_menu(ALLEGRO_MENU *menu); +extern bool _al_init_menu(A5O_MENU *menu); +extern bool _al_init_popup_menu(A5O_MENU *menu); +extern bool _al_destroy_menu(A5O_MENU *menu); /* The "int i" parameter represents the indexed location of the item in the * item->parent->items vector. This should map up identically to what is displayed @@ -147,13 +147,13 @@ extern bool _al_destroy_menu(ALLEGRO_MENU *menu); * the index may not represent what is seen on screen. If such discrepencies exist, * then the platform imlpementation must compensate accordingly. */ -extern bool _al_insert_menu_item_at(ALLEGRO_MENU_ITEM *item, int i); -extern bool _al_destroy_menu_item_at(ALLEGRO_MENU_ITEM *item, int i); -extern bool _al_update_menu_item_at(ALLEGRO_MENU_ITEM *item, int i); +extern bool _al_insert_menu_item_at(A5O_MENU_ITEM *item, int i); +extern bool _al_destroy_menu_item_at(A5O_MENU_ITEM *item, int i); +extern bool _al_update_menu_item_at(A5O_MENU_ITEM *item, int i); -extern bool _al_show_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu); -extern bool _al_hide_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu); -extern bool _al_show_popup_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu); +extern bool _al_show_display_menu(A5O_DISPLAY *display, A5O_MENU *menu); +extern bool _al_hide_display_menu(A5O_DISPLAY *display, A5O_MENU *menu); +extern bool _al_show_popup_menu(A5O_DISPLAY *display, A5O_MENU *menu); /* Returns the height of the display taken up by the menu, so we can resize * the display to compensate. Windows only at the moment.*/ diff --git a/addons/native_dialog/allegro5/internal/aintern_native_dialog_cfg.h.cmake b/addons/native_dialog/allegro5/internal/aintern_native_dialog_cfg.h.cmake index 63bad0760c..464eb42d6b 100644 --- a/addons/native_dialog/allegro5/internal/aintern_native_dialog_cfg.h.cmake +++ b/addons/native_dialog/allegro5/internal/aintern_native_dialog_cfg.h.cmake @@ -1,4 +1,4 @@ -#cmakedefine ALLEGRO_CFG_NATIVE_DIALOG_GTK -#cmakedefine ALLEGRO_CFG_NATIVE_DIALOG_OSX -#cmakedefine ALLEGRO_CFG_NATIVE_DIALOG_WINDOWS -#cmakedefine ALLEGRO_CFG_NATIVE_DIALOG_ANDROID +#cmakedefine A5O_CFG_NATIVE_DIALOG_GTK +#cmakedefine A5O_CFG_NATIVE_DIALOG_OSX +#cmakedefine A5O_CFG_NATIVE_DIALOG_WINDOWS +#cmakedefine A5O_CFG_NATIVE_DIALOG_ANDROID diff --git a/addons/native_dialog/android_dialog.c b/addons/native_dialog/android_dialog.c index 10939bc3fc..ab74131d74 100644 --- a/addons/native_dialog/android_dialog.c +++ b/addons/native_dialog/android_dialog.c @@ -18,17 +18,17 @@ #include "allegro5/internal/aintern_android.h" #include "allegro5/internal/aintern_native_dialog.h" -ALLEGRO_DEBUG_CHANNEL("android") +A5O_DEBUG_CHANNEL("android") -static ALLEGRO_DISPLAY *get_active_display(void); -static void wait_for_display_events(ALLEGRO_DISPLAY *dpy); -static bool open_file_chooser(int flags, const char *patterns, const char *initial_path, ALLEGRO_PATH ***out_uri_strings, size_t *out_uri_count); +static A5O_DISPLAY *get_active_display(void); +static void wait_for_display_events(A5O_DISPLAY *dpy); +static bool open_file_chooser(int flags, const char *patterns, const char *initial_path, A5O_PATH ***out_uri_strings, size_t *out_uri_count); static char *really_open_file_chooser(int flags, const char *patterns, const char *initial_path); static int show_message_box(const char *title, const char *message, const char *buttons, int flags); static void append_to_textlog(const char *tag, const char *message); -static ALLEGRO_EVENT_QUEUE *queue = NULL; -static ALLEGRO_MUTEX *mutex = NULL; +static A5O_EVENT_QUEUE *queue = NULL; +static A5O_MUTEX *mutex = NULL; @@ -55,7 +55,7 @@ void _al_shutdown_native_dialog_addon(void) queue = NULL; } -bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display, ALLEGRO_NATIVE_DIALOG *fd) +bool _al_show_native_file_dialog(A5O_DISPLAY *display, A5O_NATIVE_DIALOG *fd) { /* al_show_native_file_dialog() has a blocking interface. Since there is a need to handle drawing halt and drawing resume events before this @@ -64,7 +64,7 @@ bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display, ALLEGRO_NATIVE_DIALOG /* fail if the native dialog addon is not initialized */ if (!al_is_native_dialog_addon_initialized()) { - ALLEGRO_DEBUG("the native dialog addon is not initialized"); + A5O_DEBUG("the native dialog addon is not initialized"); return false; } @@ -84,13 +84,13 @@ bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display, ALLEGRO_NATIVE_DIALOG } /* register the event source */ - ALLEGRO_DISPLAY *dpy = get_active_display(); + A5O_DISPLAY *dpy = get_active_display(); if (dpy != NULL) al_register_event_source(queue, &dpy->es); /* open the file chooser */ - ALLEGRO_DEBUG("waiting for the file chooser"); - ALLEGRO_USTR *mime_patterns = al_ustr_new(""); + A5O_DEBUG("waiting for the file chooser"); + A5O_USTR *mime_patterns = al_ustr_new(""); bool first = true; bool any_catchalls = false; for (size_t i = 0; i < _al_vector_size(&fd->fc_patterns); i++) { @@ -114,7 +114,7 @@ bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display, ALLEGRO_NATIVE_DIALOG al_ustr_truncate(mime_patterns, 0); bool ret = open_file_chooser(fd->flags, al_cstr(mime_patterns), initial_path, &fd->fc_paths, &fd->fc_path_count); al_ustr_free(mime_patterns); - ALLEGRO_DEBUG("done waiting for the file chooser"); + A5O_DEBUG("done waiting for the file chooser"); /* ensure predictable behavior */ if (dpy != NULL) { @@ -129,13 +129,13 @@ bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display, ALLEGRO_NATIVE_DIALOG } /* done! */ - ALLEGRO_DEBUG("done"); + A5O_DEBUG("done"); al_unlock_mutex(mutex); return ret; } -int _al_show_native_message_box(ALLEGRO_DISPLAY *display, ALLEGRO_NATIVE_DIALOG *nd) +int _al_show_native_message_box(A5O_DISPLAY *display, A5O_NATIVE_DIALOG *nd) { const char *heading = al_cstr(nd->mb_heading); const char *text = al_cstr(nd->mb_text); @@ -145,18 +145,18 @@ int _al_show_native_message_box(ALLEGRO_DISPLAY *display, ALLEGRO_NATIVE_DIALOG return show_message_box(heading, text, buttons, nd->flags); } -bool _al_open_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) +bool _al_open_native_text_log(A5O_NATIVE_DIALOG *textlog) { textlog->is_active = true; return true; } -void _al_close_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) +void _al_close_native_text_log(A5O_NATIVE_DIALOG *textlog) { textlog->is_active = false; } -void _al_append_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) +void _al_append_native_text_log(A5O_NATIVE_DIALOG *textlog) { if (textlog->is_active) { const char *title = al_cstr(textlog->title); @@ -168,54 +168,54 @@ void _al_append_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) } } -bool _al_init_menu(ALLEGRO_MENU *menu) +bool _al_init_menu(A5O_MENU *menu) { (void)menu; return false; } -bool _al_init_popup_menu(ALLEGRO_MENU *menu) +bool _al_init_popup_menu(A5O_MENU *menu) { (void)menu; return false; } -bool _al_insert_menu_item_at(ALLEGRO_MENU_ITEM *item, int i) +bool _al_insert_menu_item_at(A5O_MENU_ITEM *item, int i) { (void)item; (void)i; return false; } -bool _al_destroy_menu_item_at(ALLEGRO_MENU_ITEM *item, int i) +bool _al_destroy_menu_item_at(A5O_MENU_ITEM *item, int i) { (void)item; (void)i; return false; } -bool _al_update_menu_item_at(ALLEGRO_MENU_ITEM *item, int i) +bool _al_update_menu_item_at(A5O_MENU_ITEM *item, int i) { (void)item; (void)i; return false; } -bool _al_show_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) +bool _al_show_display_menu(A5O_DISPLAY *display, A5O_MENU *menu) { (void)display; (void)menu; return false; } -bool _al_hide_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) +bool _al_hide_display_menu(A5O_DISPLAY *display, A5O_MENU *menu) { (void)display; (void)menu; return false; } -bool _al_show_popup_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) +bool _al_show_popup_menu(A5O_DISPLAY *display, A5O_MENU *menu) { (void)display; (void)menu; @@ -230,32 +230,32 @@ int _al_get_menu_display_height(void) -ALLEGRO_DISPLAY *get_active_display(void) +A5O_DISPLAY *get_active_display(void) { - ALLEGRO_SYSTEM *sys = al_get_system_driver(); + A5O_SYSTEM *sys = al_get_system_driver(); ASSERT(sys); if (_al_vector_size(&sys->displays) == 0) return NULL; - ALLEGRO_DISPLAY **dptr = (ALLEGRO_DISPLAY **)_al_vector_ref(&sys->displays, 0); + A5O_DISPLAY **dptr = (A5O_DISPLAY **)_al_vector_ref(&sys->displays, 0); return *dptr; } -void wait_for_display_events(ALLEGRO_DISPLAY *dpy) +void wait_for_display_events(A5O_DISPLAY *dpy) { - ALLEGRO_DISPLAY_ANDROID *d = (ALLEGRO_DISPLAY_ANDROID *)dpy; - ALLEGRO_TIMEOUT timeout; - ALLEGRO_EVENT event; + A5O_DISPLAY_ANDROID *d = (A5O_DISPLAY_ANDROID *)dpy; + A5O_TIMEOUT timeout; + A5O_EVENT event; bool expected_state = false; memset(&event, 0, sizeof(event)); /* We expect a drawing halt event to be on the queue. If that is not true, then the drawing halt did not take place for some unusual reason */ - ALLEGRO_DEBUG("looking for a ALLEGRO_EVENT_DISPLAY_HALT_DRAWING"); + A5O_DEBUG("looking for a A5O_EVENT_DISPLAY_HALT_DRAWING"); while (al_get_next_event(queue, &event)) { - if (event.type == ALLEGRO_EVENT_DISPLAY_HALT_DRAWING) { + if (event.type == A5O_EVENT_DISPLAY_HALT_DRAWING) { expected_state = true; break; } @@ -263,25 +263,25 @@ void wait_for_display_events(ALLEGRO_DISPLAY *dpy) /* skip if we're in an unexpected state */ if (!expected_state) { - ALLEGRO_DEBUG("ALLEGRO_EVENT_DISPLAY_HALT_DRAWING not found"); + A5O_DEBUG("A5O_EVENT_DISPLAY_HALT_DRAWING not found"); return; } wait_for_drawing_resume: - /* wait for ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING */ - ALLEGRO_DEBUG("waiting for ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING"); - while (event.type != ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING) + /* wait for A5O_EVENT_DISPLAY_RESUME_DRAWING */ + A5O_DEBUG("waiting for A5O_EVENT_DISPLAY_RESUME_DRAWING"); + while (event.type != A5O_EVENT_DISPLAY_RESUME_DRAWING) al_wait_for_event(queue, &event); - ALLEGRO_DEBUG("done waiting for ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING"); + A5O_DEBUG("done waiting for A5O_EVENT_DISPLAY_RESUME_DRAWING"); /* wait for al_acknowledge_drawing_resume() */ - ALLEGRO_DEBUG("waiting for al_acknowledge_drawing_resume"); + A5O_DEBUG("waiting for al_acknowledge_drawing_resume"); al_lock_mutex(d->mutex); while (!d->resumed) al_wait_cond(d->cond, d->mutex); al_unlock_mutex(d->mutex); - ALLEGRO_DEBUG("done waiting for al_acknowledge_drawing_resume"); + A5O_DEBUG("done waiting for al_acknowledge_drawing_resume"); /* A resize event takes place here, as can be seen in the implementation of AllegroSurface.nativeOnChange() at src/android_display.c (at the time of @@ -293,19 +293,19 @@ void wait_for_display_events(ALLEGRO_DISPLAY *dpy) implementation changes someday. We just wait a little bit. */ ; - /* check if a new ALLEGRO_EVENT_DISPLAY_HALT_DRAWING is emitted */ - ALLEGRO_DEBUG("waiting for another ALLEGRO_EVENT_DISPLAY_HALT_DRAWING"); + /* check if a new A5O_EVENT_DISPLAY_HALT_DRAWING is emitted */ + A5O_DEBUG("waiting for another A5O_EVENT_DISPLAY_HALT_DRAWING"); al_init_timeout(&timeout, 0.5); while (al_wait_for_event_until(queue, &event, &timeout)) { - if (event.type == ALLEGRO_EVENT_DISPLAY_HALT_DRAWING) + if (event.type == A5O_EVENT_DISPLAY_HALT_DRAWING) goto wait_for_drawing_resume; - else if (event.type == ALLEGRO_EVENT_DISPLAY_RESIZE) + else if (event.type == A5O_EVENT_DISPLAY_RESIZE) al_init_timeout(&timeout, 0.5); } - ALLEGRO_DEBUG("done waiting for another ALLEGRO_EVENT_DISPLAY_HALT_DRAWING"); + A5O_DEBUG("done waiting for another A5O_EVENT_DISPLAY_HALT_DRAWING"); } -bool open_file_chooser(int flags, const char *patterns, const char *initial_path, ALLEGRO_PATH ***out_uri_strings, size_t *out_uri_count) +bool open_file_chooser(int flags, const char *patterns, const char *initial_path, A5O_PATH ***out_uri_strings, size_t *out_uri_count) { const char URI_DELIMITER = '\n'; char *result = NULL; @@ -325,9 +325,9 @@ bool open_file_chooser(int flags, const char *patterns, const char *initial_path for (char *next_uri = result, *p = result; *p; p++) { if (*p == URI_DELIMITER) { int last = (*out_uri_count)++; - *out_uri_strings = al_realloc(*out_uri_strings, (*out_uri_count) * sizeof(ALLEGRO_PATH**)); + *out_uri_strings = al_realloc(*out_uri_strings, (*out_uri_count) * sizeof(A5O_PATH**)); - /* ALLEGRO_PATHs don't explicitly support URIs at this time, but this works nonetheless. + /* A5O_PATHs don't explicitly support URIs at this time, but this works nonetheless. See parse_path_string() at src/path.c */ *p = '\0'; (*out_uri_strings)[last] = al_create_path(next_uri); @@ -346,7 +346,7 @@ char *really_open_file_chooser(int flags, const char *patterns, const char *init JNIEnv *env = _al_android_get_jnienv(); jobject activity = _al_android_activity_object(); - jobject dialog = _jni_callObjectMethod(env, activity, "getNativeDialogAddon", "()L" ALLEGRO_ANDROID_PACKAGE_NAME_SLASH "/AllegroDialog;"); + jobject dialog = _jni_callObjectMethod(env, activity, "getNativeDialogAddon", "()L" A5O_ANDROID_PACKAGE_NAME_SLASH "/AllegroDialog;"); jstring jpatterns = _jni_call(env, jstring, NewStringUTF, patterns != NULL ? patterns : ""); jstring jinitial_path = _jni_call(env, jstring, NewStringUTF, initial_path != NULL ? initial_path : ""); @@ -372,7 +372,7 @@ int show_message_box(const char *title, const char *message, const char *buttons { JNIEnv *env = _al_android_get_jnienv(); jobject activity = _al_android_activity_object(); - jobject dialog = _jni_callObjectMethod(env, activity, "getNativeDialogAddon", "()L" ALLEGRO_ANDROID_PACKAGE_NAME_SLASH "/AllegroDialog;"); + jobject dialog = _jni_callObjectMethod(env, activity, "getNativeDialogAddon", "()L" A5O_ANDROID_PACKAGE_NAME_SLASH "/AllegroDialog;"); jstring jtitle = _jni_call(env, jstring, NewStringUTF, title != NULL ? title : ""); jstring jmessage = _jni_call(env, jstring, NewStringUTF, message != NULL ? message : ""); @@ -393,7 +393,7 @@ void append_to_textlog(const char *tag, const char *message) { JNIEnv *env = _al_android_get_jnienv(); jobject activity = _al_android_activity_object(); - jobject dialog = _jni_callObjectMethod(env, activity, "getNativeDialogAddon", "()L" ALLEGRO_ANDROID_PACKAGE_NAME_SLASH "/AllegroDialog;"); + jobject dialog = _jni_callObjectMethod(env, activity, "getNativeDialogAddon", "()L" A5O_ANDROID_PACKAGE_NAME_SLASH "/AllegroDialog;"); jstring jtag = _jni_call(env, jstring, NewStringUTF, tag != NULL ? tag : ""); jstring jmessage = _jni_call(env, jstring, NewStringUTF, message != NULL ? message : ""); diff --git a/addons/native_dialog/dialog.c b/addons/native_dialog/dialog.c index 85142c1611..162ac66a9f 100644 --- a/addons/native_dialog/dialog.c +++ b/addons/native_dialog/dialog.c @@ -6,11 +6,11 @@ #include "allegro5/internal/aintern_system.h" #include "allegro5/internal/aintern_vector.h" -ALLEGRO_DEBUG_CHANNEL("native_dialog") +A5O_DEBUG_CHANNEL("native_dialog") static bool inited_addon = false; -static _AL_VECTOR make_patterns_and_desc_vec(const ALLEGRO_USTR* patterns_ustr); +static _AL_VECTOR make_patterns_and_desc_vec(const A5O_USTR* patterns_ustr); static void free_patterns_and_desc_vec(_AL_VECTOR *patterns_and_desc_vec); /* Function: al_init_native_dialog_addon @@ -19,7 +19,7 @@ bool al_init_native_dialog_addon(void) { if (!inited_addon) { if (!_al_init_native_dialog_addon()) { - ALLEGRO_ERROR("_al_init_native_dialog_addon failed.\n"); + A5O_ERROR("_al_init_native_dialog_addon failed.\n"); return false; } inited_addon = true; @@ -50,13 +50,13 @@ void al_shutdown_native_dialog_addon(void) /* Function: al_create_native_file_dialog */ -ALLEGRO_FILECHOOSER *al_create_native_file_dialog( +A5O_FILECHOOSER *al_create_native_file_dialog( char const *initial_path, char const *title, char const *patterns, int mode) { - ALLEGRO_NATIVE_DIALOG *fc; + A5O_NATIVE_DIALOG *fc; fc = al_calloc(1, sizeof *fc); if (initial_path) { @@ -70,42 +70,42 @@ ALLEGRO_FILECHOOSER *al_create_native_file_dialog( fc->dtor_item = _al_register_destructor(_al_dtor_list, "native_dialog", fc, (void (*)(void *))al_destroy_native_file_dialog); - return (ALLEGRO_FILECHOOSER *)fc; + return (A5O_FILECHOOSER *)fc; } /* Function: al_show_native_file_dialog */ -bool al_show_native_file_dialog(ALLEGRO_DISPLAY *display, - ALLEGRO_FILECHOOSER *dialog) +bool al_show_native_file_dialog(A5O_DISPLAY *display, + A5O_FILECHOOSER *dialog) { - ALLEGRO_NATIVE_DIALOG *fd = (ALLEGRO_NATIVE_DIALOG *)dialog; + A5O_NATIVE_DIALOG *fd = (A5O_NATIVE_DIALOG *)dialog; return _al_show_native_file_dialog(display, fd); } /* Function: al_get_native_file_dialog_count */ -int al_get_native_file_dialog_count(const ALLEGRO_FILECHOOSER *dialog) +int al_get_native_file_dialog_count(const A5O_FILECHOOSER *dialog) { - const ALLEGRO_NATIVE_DIALOG *fc = (const ALLEGRO_NATIVE_DIALOG *)dialog; + const A5O_NATIVE_DIALOG *fc = (const A5O_NATIVE_DIALOG *)dialog; return fc->fc_path_count; } /* Function: al_get_native_file_dialog_path */ const char *al_get_native_file_dialog_path( - const ALLEGRO_FILECHOOSER *dialog, size_t i) + const A5O_FILECHOOSER *dialog, size_t i) { - const ALLEGRO_NATIVE_DIALOG *fc = (const ALLEGRO_NATIVE_DIALOG *)dialog; + const A5O_NATIVE_DIALOG *fc = (const A5O_NATIVE_DIALOG *)dialog; if (i < fc->fc_path_count) - return al_path_cstr(fc->fc_paths[i], ALLEGRO_NATIVE_PATH_SEP); + return al_path_cstr(fc->fc_paths[i], A5O_NATIVE_PATH_SEP); return NULL; } /* Function: al_destroy_native_file_dialog */ -void al_destroy_native_file_dialog(ALLEGRO_FILECHOOSER *dialog) +void al_destroy_native_file_dialog(A5O_FILECHOOSER *dialog) { - ALLEGRO_NATIVE_DIALOG *fd = (ALLEGRO_NATIVE_DIALOG *)dialog; + A5O_NATIVE_DIALOG *fd = (A5O_NATIVE_DIALOG *)dialog; size_t i; if (!fd) @@ -126,11 +126,11 @@ void al_destroy_native_file_dialog(ALLEGRO_FILECHOOSER *dialog) /* Function: al_show_native_message_box */ -int al_show_native_message_box(ALLEGRO_DISPLAY *display, +int al_show_native_message_box(A5O_DISPLAY *display, char const *title, char const *heading, char const *text, char const *buttons, int flags) { - ALLEGRO_NATIVE_DIALOG *fc; + A5O_NATIVE_DIALOG *fc; int r; ASSERT(title); @@ -166,11 +166,11 @@ int al_show_native_message_box(ALLEGRO_DISPLAY *display, */ uint32_t al_get_allegro_native_dialog_version(void) { - return ALLEGRO_VERSION_INT; + return A5O_VERSION_INT; } -static _AL_VECTOR split_patterns(const ALLEGRO_USTR* ustr) +static _AL_VECTOR split_patterns(const A5O_USTR* ustr) { int pattern_start = 0; int cur_pos = 0; @@ -184,8 +184,8 @@ static _AL_VECTOR split_patterns(const ALLEGRO_USTR* ustr) while (true) { int32_t c = al_ustr_get(ustr, cur_pos); if (c == -1 || c == ';') { - ALLEGRO_USTR_INFO info; - const ALLEGRO_USTR *pattern_ustr = al_ref_buffer(&info, + A5O_USTR_INFO info; + const A5O_USTR *pattern_ustr = al_ref_buffer(&info, al_cstr(ustr) + pattern_start, cur_pos - pattern_start); if (al_ustr_length(pattern_ustr) > 0) { _AL_PATTERN pattern = { @@ -214,7 +214,7 @@ static _AL_VECTOR split_patterns(const ALLEGRO_USTR* ustr) } -static _AL_VECTOR make_patterns_and_desc_vec(const ALLEGRO_USTR* patterns_ustr) +static _AL_VECTOR make_patterns_and_desc_vec(const A5O_USTR* patterns_ustr) { _AL_VECTOR patterns_and_desc_vec; _al_vector_init(&patterns_and_desc_vec, sizeof(_AL_PATTERNS_AND_DESC)); @@ -235,8 +235,8 @@ static _AL_VECTOR make_patterns_and_desc_vec(const ALLEGRO_USTR* patterns_ustr) chunk_start = cur_pos + 1; } else if (c == '\n' || c == -1) { - ALLEGRO_USTR_INFO desc_info, real_patterns_info; - const ALLEGRO_USTR *ustr; + A5O_USTR_INFO desc_info, real_patterns_info; + const A5O_USTR *ustr; /* Strip trailing whitespace. */ int desc_end = chunk_start - 1; for (; desc_end >= line_start; desc_end--) { diff --git a/addons/native_dialog/gtk_dialog.c b/addons/native_dialog/gtk_dialog.c index 718d44469b..086d2789f2 100644 --- a/addons/native_dialog/gtk_dialog.c +++ b/addons/native_dialog/gtk_dialog.c @@ -9,7 +9,7 @@ #include "gtk_dialog.h" #include "gtk_xgtk.h" -ALLEGRO_DEBUG_CHANNEL("gtk_dialog") +A5O_DEBUG_CHANNEL("gtk_dialog") bool _al_init_native_dialog_addon(void) @@ -18,7 +18,7 @@ bool _al_init_native_dialog_addon(void) char **argv = NULL; gdk_set_allowed_backends("x11"); if (!gtk_init_check(&argc, &argv)) { - ALLEGRO_ERROR("gtk_init_check failed\n"); + A5O_ERROR("gtk_init_check failed\n"); return false; } @@ -31,7 +31,7 @@ void _al_shutdown_native_dialog_addon(void) _al_gtk_set_display_overridable_interface(false); } -static void really_make_transient(GtkWidget *window, ALLEGRO_DISPLAY_XGLX *glx) +static void really_make_transient(GtkWidget *window, A5O_DISPLAY_XGLX *glx) { GdkWindow *gdk_window = gtk_widget_get_window(GTK_WIDGET(window)); @@ -51,10 +51,10 @@ static void realized(GtkWidget *window, gpointer data) } -void _al_gtk_make_transient(ALLEGRO_DISPLAY *display, GtkWidget *window) +void _al_gtk_make_transient(A5O_DISPLAY *display, GtkWidget *window) { /* Set the current display window (if any) as the parent of the dialog. */ - ALLEGRO_DISPLAY_XGLX *glx = (void *)display; + A5O_DISPLAY_XGLX *glx = (void *)display; if (glx) { if (!gtk_widget_get_realized(window)) g_signal_connect(window, "realize", G_CALLBACK(realized), (void *)glx); diff --git a/addons/native_dialog/gtk_dialog.h b/addons/native_dialog/gtk_dialog.h index 95c368aa34..cff6e77a46 100644 --- a/addons/native_dialog/gtk_dialog.h +++ b/addons/native_dialog/gtk_dialog.h @@ -10,7 +10,7 @@ #define ACK_OPENED ((void *)0x3333) #define ACK_CLOSED ((void *)0x4444) -void _al_gtk_make_transient(ALLEGRO_DISPLAY *display, GtkWidget *window); +void _al_gtk_make_transient(A5O_DISPLAY *display, GtkWidget *window); bool _al_gtk_ensure_thread(void); @@ -24,8 +24,8 @@ typedef struct ARGS_BASE ARGS_BASE; struct ARGS_BASE { - ALLEGRO_MUTEX *mutex; - ALLEGRO_COND *cond; + A5O_MUTEX *mutex; + A5O_COND *cond; bool done; bool response; }; diff --git a/addons/native_dialog/gtk_filesel.c b/addons/native_dialog/gtk_filesel.c index 941a21c345..2999a0908e 100644 --- a/addons/native_dialog/gtk_filesel.c +++ b/addons/native_dialog/gtk_filesel.c @@ -22,18 +22,18 @@ #include "gtk_xgtk.h" typedef struct { - ALLEGRO_DISPLAY *display; - ALLEGRO_NATIVE_DIALOG *dialog; + A5O_DISPLAY *display; + A5O_NATIVE_DIALOG *dialog; } GTK_FILE_DIALOG_MESSAGE; /* [nd_gtk thread] */ static gboolean create_gtk_file_dialog(gpointer data) { GTK_FILE_DIALOG_MESSAGE *msg = data; - ALLEGRO_DISPLAY *display = msg->display; - ALLEGRO_NATIVE_DIALOG *fd = msg->dialog; - bool save = fd->flags & ALLEGRO_FILECHOOSER_SAVE; - bool folder = fd->flags & ALLEGRO_FILECHOOSER_FOLDER; + A5O_DISPLAY *display = msg->display; + A5O_NATIVE_DIALOG *fd = msg->dialog; + bool save = fd->flags & A5O_FILECHOOSER_SAVE; + bool folder = fd->flags & A5O_FILECHOOSER_FOLDER; gint result; GtkWidget *window; @@ -55,12 +55,12 @@ static gboolean create_gtk_file_dialog(gpointer data) if (fd->fc_initial_path) { bool is_dir; bool exists; - const char *path = al_path_cstr(fd->fc_initial_path, ALLEGRO_NATIVE_PATH_SEP); + const char *path = al_path_cstr(fd->fc_initial_path, A5O_NATIVE_PATH_SEP); if (al_filename_exists(path)) { exists = true; - ALLEGRO_FS_ENTRY *fs = al_create_fs_entry(path); - is_dir = al_get_fs_entry_mode(fs) & ALLEGRO_FILEMODE_ISDIR; + A5O_FS_ENTRY *fs = al_create_fs_entry(path); + is_dir = al_get_fs_entry_mode(fs) & A5O_FILEMODE_ISDIR; al_destroy_fs_entry(fs); } else { @@ -71,20 +71,20 @@ static gboolean create_gtk_file_dialog(gpointer data) if (is_dir) { gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER(window), - al_path_cstr(fd->fc_initial_path, ALLEGRO_NATIVE_PATH_SEP)); + al_path_cstr(fd->fc_initial_path, A5O_NATIVE_PATH_SEP)); } else if (exists) { gtk_file_chooser_set_filename (GTK_FILE_CHOOSER(window), - al_path_cstr(fd->fc_initial_path, ALLEGRO_NATIVE_PATH_SEP)); + al_path_cstr(fd->fc_initial_path, A5O_NATIVE_PATH_SEP)); } else { - ALLEGRO_PATH *dir_path = al_clone_path(fd->fc_initial_path); + A5O_PATH *dir_path = al_clone_path(fd->fc_initial_path); if (dir_path) { al_set_path_filename(dir_path, NULL); gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER(window), - al_path_cstr(dir_path, ALLEGRO_NATIVE_PATH_SEP)); + al_path_cstr(dir_path, A5O_NATIVE_PATH_SEP)); if (save) { gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER(window), @@ -95,13 +95,13 @@ static gboolean create_gtk_file_dialog(gpointer data) } } - if (fd->flags & ALLEGRO_FILECHOOSER_MULTIPLE) + if (fd->flags & A5O_FILECHOOSER_MULTIPLE) gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(window), true); for (size_t i = 0; i < _al_vector_size(&fd->fc_patterns); i++) { _AL_PATTERNS_AND_DESC *patterns_and_desc = _al_vector_ref(&fd->fc_patterns, i); - const ALLEGRO_USTR *desc = al_ref_info(&patterns_and_desc->desc); + const A5O_USTR *desc = al_ref_info(&patterns_and_desc->desc); GtkFileFilter* filter = gtk_file_filter_new(); if (al_ustr_size(desc) > 0) { char *cstr = al_cstr_dup(desc); @@ -149,8 +149,8 @@ static gboolean create_gtk_file_dialog(gpointer data) } /* [user thread] */ -bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display, - ALLEGRO_NATIVE_DIALOG *fd) +bool _al_show_native_file_dialog(A5O_DISPLAY *display, + A5O_NATIVE_DIALOG *fd) { GTK_FILE_DIALOG_MESSAGE msg; diff --git a/addons/native_dialog/gtk_menu.c b/addons/native_dialog/gtk_menu.c index 62e4fce961..2b3dbe85f6 100644 --- a/addons/native_dialog/gtk_menu.c +++ b/addons/native_dialog/gtk_menu.c @@ -22,7 +22,7 @@ #include "gtk_dialog.h" #include "gtk_xgtk.h" -ALLEGRO_DEBUG_CHANNEL("menu") +A5O_DEBUG_CHANNEL("menu") typedef struct ARGS ARGS; @@ -32,8 +32,8 @@ struct ARGS ARGS_BASE base; GtkWidget *gtk_window; - ALLEGRO_MENU *menu; - ALLEGRO_MENU_ITEM *item; + A5O_MENU *menu; + A5O_MENU_ITEM *item; int i; }; @@ -45,16 +45,16 @@ struct POPUP_ARGS ARGS_BASE base; GtkWidget *gtk_window; - ALLEGRO_MENU *menu; + A5O_MENU *menu; int x; int y; }; -static void build_menu(GtkWidget *gmenu, ALLEGRO_MENU *amenu); +static void build_menu(GtkWidget *gmenu, A5O_MENU *amenu); /* [user thread] */ -static bool clear_menu_extras(ALLEGRO_MENU *menu, ALLEGRO_MENU_ITEM *item, int index, void *extra) +static bool clear_menu_extras(A5O_MENU *menu, A5O_MENU_ITEM *item, int index, void *extra) { (void) index; (void) extra; @@ -68,7 +68,7 @@ static bool clear_menu_extras(ALLEGRO_MENU *menu, ALLEGRO_MENU_ITEM *item, int i } /* [user thread] */ -static bool make_menu_item_args(ARGS *args, ALLEGRO_MENU_ITEM *item, int i) +static bool make_menu_item_args(ARGS *args, A5O_MENU_ITEM *item, int i) { if (_al_gtk_init_args(args, sizeof(*args))) { args->item = item; @@ -79,26 +79,26 @@ static bool make_menu_item_args(ARGS *args, ALLEGRO_MENU_ITEM *item, int i) } /* [gtk thread] */ -static void menuitem_response(ALLEGRO_MENU_ITEM *menu_item) +static void menuitem_response(A5O_MENU_ITEM *menu_item) { if (menu_item->parent) _al_emit_menu_event(menu_item->parent->display, menu_item->unique_id); } /* [gtk thread] */ -static void checkbox_on_toggle(ALLEGRO_MENU_ITEM *item) +static void checkbox_on_toggle(A5O_MENU_ITEM *item) { /* make sure the menu item remains the same state */ if (gtk_check_menu_item_get_active(item->extra1)) { - item->flags |= ALLEGRO_MENU_ITEM_CHECKED; + item->flags |= A5O_MENU_ITEM_CHECKED; } else { - item->flags &= ~ALLEGRO_MENU_ITEM_CHECKED; + item->flags &= ~A5O_MENU_ITEM_CHECKED; } } /* [gtk thread] */ -static GtkWidget *build_menu_item(ALLEGRO_MENU_ITEM *aitem) +static GtkWidget *build_menu_item(A5O_MENU_ITEM *aitem) { GtkWidget *gitem; @@ -106,16 +106,16 @@ static GtkWidget *build_menu_item(ALLEGRO_MENU_ITEM *aitem) gitem = gtk_separator_menu_item_new(); } else { - ALLEGRO_USTR *caption = al_ustr_dup(aitem->caption); + A5O_USTR *caption = al_ustr_dup(aitem->caption); /* convert & to _ using unprintable chars as placeholders */ al_ustr_find_replace_cstr(caption, 0, "_", "\x01\x02"); al_ustr_find_replace_cstr(caption, 0, "&", "_"); al_ustr_find_replace_cstr(caption, 0, "\x01\x02", "__"); - if (aitem->flags & ALLEGRO_MENU_ITEM_CHECKBOX) { + if (aitem->flags & A5O_MENU_ITEM_CHECKBOX) { gitem = gtk_check_menu_item_new_with_mnemonic(al_cstr(caption)); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gitem), aitem->flags & ALLEGRO_MENU_ITEM_CHECKED); + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gitem), aitem->flags & A5O_MENU_ITEM_CHECKED); g_signal_connect_swapped (gitem, "toggled", G_CALLBACK(checkbox_on_toggle), (gpointer) aitem); } @@ -127,7 +127,7 @@ static GtkWidget *build_menu_item(ALLEGRO_MENU_ITEM *aitem) al_ustr_free(caption); - gtk_widget_set_sensitive(gitem, !(aitem->flags & ALLEGRO_MENU_ITEM_DISABLED)); + gtk_widget_set_sensitive(gitem, !(aitem->flags & A5O_MENU_ITEM_DISABLED)); aitem->extra1 = gitem; @@ -150,19 +150,19 @@ static GtkWidget *build_menu_item(ALLEGRO_MENU_ITEM *aitem) } /* [gtk thread] */ -static void build_menu(GtkWidget *gmenu, ALLEGRO_MENU *amenu) +static void build_menu(GtkWidget *gmenu, A5O_MENU *amenu) { size_t i; for (i = 0; i < _al_vector_size(&amenu->items); ++i) { - ALLEGRO_MENU_ITEM *aitem = * (ALLEGRO_MENU_ITEM **) _al_vector_ref(&amenu->items, i); + A5O_MENU_ITEM *aitem = * (A5O_MENU_ITEM **) _al_vector_ref(&amenu->items, i); GtkWidget *gitem = build_menu_item(aitem); gtk_menu_shell_append(GTK_MENU_SHELL(gmenu), gitem); } } /* [user thread] */ -bool _al_init_menu(ALLEGRO_MENU *menu) +bool _al_init_menu(A5O_MENU *menu) { (void) menu; @@ -172,7 +172,7 @@ bool _al_init_menu(ALLEGRO_MENU *menu) } /* [user thread] */ -bool _al_init_popup_menu(ALLEGRO_MENU *menu) +bool _al_init_popup_menu(A5O_MENU *menu) { return _al_init_menu(menu); } @@ -189,7 +189,7 @@ static gboolean do_destroy_menu(gpointer data) } /* [user thread] */ -bool _al_destroy_menu(ALLEGRO_MENU *menu) +bool _al_destroy_menu(A5O_MENU *menu) { ARGS args; @@ -220,7 +220,7 @@ static gboolean do_insert_menu_item_at(gpointer data) } /* [user thread] */ -bool _al_insert_menu_item_at(ALLEGRO_MENU_ITEM *item, int i) +bool _al_insert_menu_item_at(A5O_MENU_ITEM *item, int i) { if (item->parent->extra1) { ARGS args; @@ -249,7 +249,7 @@ static gboolean do_destroy_menu_item_at(gpointer data) } /* [user thread] */ -bool _al_destroy_menu_item_at(ALLEGRO_MENU_ITEM *item, int i) +bool _al_destroy_menu_item_at(A5O_MENU_ITEM *item, int i) { if (item->extra1) { ARGS args; @@ -284,7 +284,7 @@ static gboolean do_update_menu_item_at(gpointer data) } /* [user thread] */ -bool _al_update_menu_item_at(ALLEGRO_MENU_ITEM *item, int i) +bool _al_update_menu_item_at(A5O_MENU_ITEM *item, int i) { if (item->extra1) { ARGS args; @@ -320,7 +320,7 @@ static gboolean do_show_display_menu(gpointer data) } /* [user thread] */ -bool _al_show_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) +bool _al_show_display_menu(A5O_DISPLAY *display, A5O_MENU *menu) { GtkWidget *gtk_window; ARGS args; @@ -352,7 +352,7 @@ static gboolean do_hide_display_menu(gpointer data) } /* [user thread] */ -bool _al_hide_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) +bool _al_hide_display_menu(A5O_DISPLAY *display, A5O_MENU *menu) { GtkWidget *gtk_window; ARGS args; @@ -372,7 +372,7 @@ bool _al_hide_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) } /* [gtk thread] */ -static void popop_on_hide(ALLEGRO_MENU *menu) +static void popop_on_hide(A5O_MENU *menu) { (void) menu; /* in case we want to notify on popup close */ @@ -429,11 +429,11 @@ static gboolean do_show_popup_menu(gpointer data) return FALSE; } -bool _al_show_popup_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) +bool _al_show_popup_menu(A5O_DISPLAY *display, A5O_MENU *menu) { GtkWidget *gtk_window; POPUP_ARGS args; - ALLEGRO_MOUSE_STATE state; + A5O_MOUSE_STATE state; al_get_mouse_state(&state); diff --git a/addons/native_dialog/gtk_msgbox.c b/addons/native_dialog/gtk_msgbox.c index 06de91c883..f50eb64f4b 100644 --- a/addons/native_dialog/gtk_msgbox.c +++ b/addons/native_dialog/gtk_msgbox.c @@ -23,8 +23,8 @@ typedef struct { - ALLEGRO_DISPLAY *display; - ALLEGRO_NATIVE_DIALOG *dialog; + A5O_DISPLAY *display; + A5O_NATIVE_DIALOG *dialog; } Msg; @@ -32,7 +32,7 @@ typedef struct { static void msgbox_destroy(GtkWidget *w, gpointer data) { - ALLEGRO_NATIVE_DIALOG *nd = data; + A5O_NATIVE_DIALOG *nd = data; (void)w; ASSERT(nd->async_queue); @@ -42,7 +42,7 @@ static void msgbox_destroy(GtkWidget *w, gpointer data) static void msgbox_response(GtkDialog *dialog, gint response_id, gpointer user_data) { - ALLEGRO_NATIVE_DIALOG *nd = (void *)user_data; + A5O_NATIVE_DIALOG *nd = (void *)user_data; (void)dialog; switch (response_id) { case GTK_RESPONSE_DELETE_EVENT: @@ -65,19 +65,19 @@ static void msgbox_response(GtkDialog *dialog, gint response_id, static gboolean create_native_message_box(gpointer data) { Msg *msg = data; - ALLEGRO_DISPLAY *display = msg->display; - ALLEGRO_NATIVE_DIALOG *fd = msg->dialog; + A5O_DISPLAY *display = msg->display; + A5O_NATIVE_DIALOG *fd = msg->dialog; GtkWidget *window; /* Create a new file selection widget */ GtkMessageType type = GTK_MESSAGE_INFO; GtkButtonsType buttons = GTK_BUTTONS_OK; - if (fd->flags & ALLEGRO_MESSAGEBOX_YES_NO) type = GTK_MESSAGE_QUESTION; - if (fd->flags & ALLEGRO_MESSAGEBOX_QUESTION) type = GTK_MESSAGE_QUESTION; - if (fd->flags & ALLEGRO_MESSAGEBOX_WARN) type = GTK_MESSAGE_WARNING; - if (fd->flags & ALLEGRO_MESSAGEBOX_ERROR) type = GTK_MESSAGE_ERROR; - if (fd->flags & ALLEGRO_MESSAGEBOX_YES_NO) buttons = GTK_BUTTONS_YES_NO; - if (fd->flags & ALLEGRO_MESSAGEBOX_OK_CANCEL) buttons = GTK_BUTTONS_OK_CANCEL; + if (fd->flags & A5O_MESSAGEBOX_YES_NO) type = GTK_MESSAGE_QUESTION; + if (fd->flags & A5O_MESSAGEBOX_QUESTION) type = GTK_MESSAGE_QUESTION; + if (fd->flags & A5O_MESSAGEBOX_WARN) type = GTK_MESSAGE_WARNING; + if (fd->flags & A5O_MESSAGEBOX_ERROR) type = GTK_MESSAGE_ERROR; + if (fd->flags & A5O_MESSAGEBOX_YES_NO) buttons = GTK_BUTTONS_YES_NO; + if (fd->flags & A5O_MESSAGEBOX_OK_CANCEL) buttons = GTK_BUTTONS_OK_CANCEL; if (fd->mb_buttons) buttons = GTK_BUTTONS_NONE; window = gtk_message_dialog_new(NULL, 0, type, buttons, "%s", @@ -95,8 +95,8 @@ static gboolean create_native_message_box(gpointer data) int pos2 = next; if (next == -1) pos2 = al_ustr_size(fd->mb_buttons); - ALLEGRO_USTR_INFO info; - const ALLEGRO_USTR *button_text; + A5O_USTR_INFO info; + const A5O_USTR *button_text; button_text = al_ref_ustr(&info, fd->mb_buttons, pos, pos2); pos = pos2 + 1; char buffer[256]; @@ -119,8 +119,8 @@ static gboolean create_native_message_box(gpointer data) } /* [user thread] */ -int _al_show_native_message_box(ALLEGRO_DISPLAY *display, - ALLEGRO_NATIVE_DIALOG *fd) +int _al_show_native_message_box(A5O_DISPLAY *display, + A5O_NATIVE_DIALOG *fd) { Msg msg; diff --git a/addons/native_dialog/gtk_textlog.c b/addons/native_dialog/gtk_textlog.c index ed21fd515d..cba708824b 100644 --- a/addons/native_dialog/gtk_textlog.c +++ b/addons/native_dialog/gtk_textlog.c @@ -24,14 +24,14 @@ typedef struct { - ALLEGRO_NATIVE_DIALOG *dialog; + A5O_NATIVE_DIALOG *dialog; } Msg; -static void emit_close_event(ALLEGRO_NATIVE_DIALOG *textlog, bool keypress) +static void emit_close_event(A5O_NATIVE_DIALOG *textlog, bool keypress) { - ALLEGRO_EVENT event; - event.user.type = ALLEGRO_EVENT_NATIVE_DIALOG_CLOSE; + A5O_EVENT event; + event.user.type = A5O_EVENT_NATIVE_DIALOG_CLOSE; event.user.timestamp = al_get_time(); event.user.data1 = (intptr_t)textlog; event.user.data2 = (intptr_t)keypress; @@ -41,11 +41,11 @@ static void emit_close_event(ALLEGRO_NATIVE_DIALOG *textlog, bool keypress) static gboolean textlog_delete(GtkWidget *w, GdkEvent *gevent, gpointer userdata) { - ALLEGRO_NATIVE_DIALOG *textlog = userdata; + A5O_NATIVE_DIALOG *textlog = userdata; (void)w; (void)gevent; - if (!(textlog->flags & ALLEGRO_TEXTLOG_NO_CLOSE)) { + if (!(textlog->flags & A5O_TEXTLOG_NO_CLOSE)) { emit_close_event(textlog, false); } @@ -56,7 +56,7 @@ static gboolean textlog_delete(GtkWidget *w, GdkEvent *gevent, static gboolean textlog_key_press(GtkWidget *w, GdkEventKey *gevent, gpointer userdata) { - ALLEGRO_NATIVE_DIALOG *textlog = userdata; + A5O_NATIVE_DIALOG *textlog = userdata; (void)w; if (gevent->keyval == GDK_KEY_Escape) { @@ -68,7 +68,7 @@ static gboolean textlog_key_press(GtkWidget *w, GdkEventKey *gevent, static void textlog_destroy(GtkWidget *w, gpointer data) { - ALLEGRO_NATIVE_DIALOG *nd = data; + A5O_NATIVE_DIALOG *nd = data; (void)w; ASSERT(nd->async_queue); @@ -79,7 +79,7 @@ static void textlog_destroy(GtkWidget *w, gpointer data) static gboolean create_native_text_log(gpointer data) { Msg *msg = data; - ALLEGRO_NATIVE_DIALOG *textlog = msg->dialog; + A5O_NATIVE_DIALOG *textlog = msg->dialog; GtkCssProvider *css_provider; GtkStyleContext *context; @@ -88,7 +88,7 @@ static gboolean create_native_text_log(gpointer data) gtk_window_set_default_size(GTK_WINDOW(top), 640, 480); gtk_window_set_title(GTK_WINDOW(top), al_cstr(textlog->title)); - if (textlog->flags & ALLEGRO_TEXTLOG_NO_CLOSE) { + if (textlog->flags & A5O_TEXTLOG_NO_CLOSE) { gtk_window_set_deletable(GTK_WINDOW(top), false); } else { @@ -103,7 +103,7 @@ static gboolean create_native_text_log(gpointer data) GtkWidget *view = gtk_text_view_new(); gtk_text_view_set_editable(GTK_TEXT_VIEW(view), false); gtk_widget_set_name(GTK_WIDGET(view), "native_text_log"); - if (textlog->flags & ALLEGRO_TEXTLOG_MONOSPACE) { + if (textlog->flags & A5O_TEXTLOG_MONOSPACE) { css_provider = gtk_css_provider_new(); gtk_css_provider_load_from_data(GTK_CSS_PROVIDER(css_provider), "#native_text_log {\n" @@ -126,7 +126,7 @@ static gboolean create_native_text_log(gpointer data) } /* [user thread] */ -bool _al_open_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) +bool _al_open_native_text_log(A5O_NATIVE_DIALOG *textlog) { Msg msg; @@ -149,7 +149,7 @@ bool _al_open_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) /* [gtk thread] */ static gboolean do_append_native_text_log(gpointer data) { - ALLEGRO_NATIVE_DIALOG *textlog = data; + A5O_NATIVE_DIALOG *textlog = data; al_lock_mutex(textlog->tl_text_mutex); GtkTextView *tv = GTK_TEXT_VIEW(textlog->tl_textview); @@ -173,7 +173,7 @@ static gboolean do_append_native_text_log(gpointer data) } /* [user thread] */ -void _al_append_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) +void _al_append_native_text_log(A5O_NATIVE_DIALOG *textlog) { if (textlog->tl_have_pending) return; @@ -185,7 +185,7 @@ void _al_append_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) /* [gtk thread] */ static gboolean do_close_native_text_log(gpointer data) { - ALLEGRO_NATIVE_DIALOG *textlog = data; + A5O_NATIVE_DIALOG *textlog = data; /* Delay closing until appends are completed. */ if (textlog->tl_have_pending) { @@ -202,7 +202,7 @@ static gboolean do_close_native_text_log(gpointer data) } /* [user thread] */ -void _al_close_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) +void _al_close_native_text_log(A5O_NATIVE_DIALOG *textlog) { gdk_threads_add_timeout(0, do_close_native_text_log, textlog); diff --git a/addons/native_dialog/gtk_thread.c b/addons/native_dialog/gtk_thread.c index 37c4ffa845..2e4c6b7555 100644 --- a/addons/native_dialog/gtk_thread.c +++ b/addons/native_dialog/gtk_thread.c @@ -8,7 +8,7 @@ #include "allegro5/internal/aintern_vector.h" -ALLEGRO_DEBUG_CHANNEL("gtk") +A5O_DEBUG_CHANNEL("gtk") /* GTK is not thread safe. We launch a single thread which runs the GTK main @@ -42,7 +42,7 @@ static void *nd_gtk_thread_func(void *data) { GAsyncQueue *queue = data; - ALLEGRO_DEBUG("GLIB %d.%d.%d\n", + A5O_DEBUG("GLIB %d.%d.%d\n", GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); @@ -51,7 +51,7 @@ static void *nd_gtk_thread_func(void *data) gtk_main(); - ALLEGRO_INFO("GTK stopped.\n"); + A5O_INFO("GTK stopped.\n"); return NULL; } @@ -73,7 +73,7 @@ bool _al_gtk_ensure_thread(void) int argc = 0; char **argv = NULL; if (!gtk_init_check(&argc, &argv)) { - ALLEGRO_ERROR("gtk_init_check failed\n"); + A5O_ERROR("gtk_init_check failed\n"); return false; } } diff --git a/addons/native_dialog/gtk_xgtk.c b/addons/native_dialog/gtk_xgtk.c index 28e680d4e0..43cf2eb04a 100644 --- a/addons/native_dialog/gtk_xgtk.c +++ b/addons/native_dialog/gtk_xgtk.c @@ -1,7 +1,7 @@ #include #include -#define ALLEGRO_INTERNAL_UNSTABLE +#define A5O_INTERNAL_UNSTABLE #include "allegro5/allegro.h" #include "allegro5/internal/aintern_native_dialog_cfg.h" #include "allegro5/internal/aintern.h" @@ -14,13 +14,13 @@ #include "gtk_dialog.h" #include "gtk_xgtk.h" -ALLEGRO_DEBUG_CHANNEL("gtk") +A5O_DEBUG_CHANNEL("gtk") typedef struct ARGS_CREATE { ARGS_BASE base; /* must be first */ - ALLEGRO_DISPLAY_XGLX *display; + A5O_DISPLAY_XGLX *display; int w; int h; const char *title; @@ -29,14 +29,14 @@ typedef struct ARGS_CREATE typedef struct { ARGS_BASE base; /* must be first */ - ALLEGRO_DISPLAY_XGLX *display; + A5O_DISPLAY_XGLX *display; bool is_last; } ARGS_DESTROY; typedef struct { ARGS_BASE base; /* must be first */ - ALLEGRO_DISPLAY_XGLX *display; + A5O_DISPLAY_XGLX *display; int w; int h; } ARGS_RESIZE; @@ -44,21 +44,21 @@ typedef struct typedef struct { ARGS_BASE base; /* must be first */ - ALLEGRO_DISPLAY_XGLX *display; + A5O_DISPLAY_XGLX *display; const char *title; } ARGS_TITLE; typedef struct { ARGS_BASE base; /* must be first */ - ALLEGRO_DISPLAY_XGLX *display; + A5O_DISPLAY_XGLX *display; bool fullscreen; } ARGS_FULLSCREEN_WINDOW; typedef struct { ARGS_BASE base; /* must be first */ - ALLEGRO_DISPLAY_XGLX *display; + A5O_DISPLAY_XGLX *display; int x; int y; } ARGS_POSITION; @@ -67,27 +67,27 @@ typedef struct typedef struct ARGS_SET_FLAG { ARGS_BASE base; /* must be first */ - ALLEGRO_DISPLAY_XGLX *display; + A5O_DISPLAY_XGLX *display; bool onoff; } ARGS_SET_FLAG; /* forward declarations */ static gboolean xgtk_quit_callback(GtkWidget *widget, GdkEvent *event, - ALLEGRO_DISPLAY *display); + A5O_DISPLAY *display); static gboolean xgtk_handle_configure_event(GtkWidget *widget, - GdkEventConfigure *event, ALLEGRO_DISPLAY *display); -static void xgtk_set_fullscreen_window(ALLEGRO_DISPLAY *display, bool onoff); + GdkEventConfigure *event, A5O_DISPLAY *display); +static void xgtk_set_fullscreen_window(A5O_DISPLAY *display, bool onoff); -static struct ALLEGRO_XWIN_DISPLAY_OVERRIDABLE_INTERFACE xgtk_override_vt; +static struct A5O_XWIN_DISPLAY_OVERRIDABLE_INTERFACE xgtk_override_vt; /* [gtk thread] */ static gboolean do_create_display_hook(gpointer data) { const ARGS_CREATE *args = _al_gtk_lock_args(data); - ALLEGRO_DISPLAY *display = (ALLEGRO_DISPLAY *)args->display; - ALLEGRO_DISPLAY_XGLX *d = args->display; + A5O_DISPLAY *display = (A5O_DISPLAY *)args->display; + A5O_DISPLAY_XGLX *d = args->display; const int w = args->w; const int h = args->h; @@ -111,13 +111,13 @@ static gboolean do_create_display_hook(gpointer data) d->gtk->gtksocket = socket; gtk_box_pack_end(GTK_BOX(vbox), socket, TRUE, TRUE, 0); gtk_socket_add_id(GTK_SOCKET(socket), d->window); - ALLEGRO_DEBUG("gtk_socket_add_id: window = %ld\n", d->window); + A5O_DEBUG("gtk_socket_add_id: window = %ld\n", d->window); gtk_window_set_title(GTK_WINDOW(window), args->title); gtk_widget_show_all(window); - if (display->flags & ALLEGRO_RESIZABLE) { + if (display->flags & A5O_RESIZABLE) { /* Allow socket widget to be resized smaller than initial size. */ gtk_widget_set_size_request(socket, -1, -1); gtk_window_set_resizable(GTK_WINDOW(window), true); @@ -126,7 +126,7 @@ static gboolean do_create_display_hook(gpointer data) gtk_window_set_resizable(GTK_WINDOW(window), false); } - if (display->flags & ALLEGRO_FULLSCREEN_WINDOW) { + if (display->flags & A5O_FULLSCREEN_WINDOW) { gtk_window_fullscreen(GTK_WINDOW(window)); } @@ -137,14 +137,14 @@ static gboolean do_create_display_hook(gpointer data) /* [user thread] */ -static bool xgtk_create_display_hook(ALLEGRO_DISPLAY *display, int w, int h) +static bool xgtk_create_display_hook(A5O_DISPLAY *display, int w, int h) { - ALLEGRO_DISPLAY_XGLX *d = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_DISPLAY_XGLX *d = (A5O_DISPLAY_XGLX *)display; ARGS_CREATE args; d->gtk = al_calloc(1, sizeof(*(d->gtk))); if (!d->gtk) { - ALLEGRO_WARN("Out of memory\n"); + A5O_WARN("Out of memory\n"); return false; } @@ -170,7 +170,7 @@ static bool xgtk_create_display_hook(ALLEGRO_DISPLAY *display, int w, int h) static gboolean xgtk_quit_callback(GtkWidget *widget, GdkEvent *event, - ALLEGRO_DISPLAY *display) + A5O_DISPLAY *display) { (void)widget; (void)event; @@ -180,9 +180,9 @@ static gboolean xgtk_quit_callback(GtkWidget *widget, GdkEvent *event, static gboolean xgtk_handle_configure_event(GtkWidget *widget, - GdkEventConfigure *event, ALLEGRO_DISPLAY *display) + GdkEventConfigure *event, A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_XGLX *d = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_DISPLAY_XGLX *d = (A5O_DISPLAY_XGLX *)display; (void)widget; (void)event; @@ -199,7 +199,7 @@ static gboolean xgtk_handle_configure_event(GtkWidget *widget, static gboolean do_destroy_display_hook(gpointer data) { ARGS_DESTROY *args = _al_gtk_lock_args(data); - ALLEGRO_DISPLAY_XGLX *d = args->display; + A5O_DISPLAY_XGLX *d = args->display; bool is_last = args->is_last; gtk_widget_destroy(d->gtk->gtkwindow); @@ -213,9 +213,9 @@ static gboolean do_destroy_display_hook(gpointer data) /* [user thread] */ -static void xgtk_destroy_display_hook(ALLEGRO_DISPLAY *display, bool is_last) +static void xgtk_destroy_display_hook(A5O_DISPLAY *display, bool is_last) { - ALLEGRO_DISPLAY_XGLX *d = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_DISPLAY_XGLX *d = (A5O_DISPLAY_XGLX *)display; ARGS_DESTROY args; if (!_al_gtk_init_args(&args, sizeof(args))) @@ -235,7 +235,7 @@ static void xgtk_destroy_display_hook(ALLEGRO_DISPLAY *display, bool is_last) static gboolean do_resize_display1(gpointer data) { ARGS_RESIZE *args = _al_gtk_lock_args(data); - ALLEGRO_DISPLAY_XGLX *d = args->display; + A5O_DISPLAY_XGLX *d = args->display; int w = args->w; int h = args->h; @@ -257,7 +257,7 @@ static gboolean do_resize_display1(gpointer data) static gboolean do_resize_display2(gpointer data) { ARGS_RESIZE *args = _al_gtk_lock_args(data); - ALLEGRO_DISPLAY_XGLX *d = args->display; + A5O_DISPLAY_XGLX *d = args->display; /* Remove the minimum size constraint again. */ gtk_widget_set_size_request(d->gtk->gtksocket, -1, -1); @@ -267,10 +267,10 @@ static gboolean do_resize_display2(gpointer data) /* [user thread] */ -static bool xgtk_resize_display(ALLEGRO_DISPLAY *display, int w, int h) +static bool xgtk_resize_display(A5O_DISPLAY *display, int w, int h) { - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *d = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); + A5O_DISPLAY_XGLX *d = (A5O_DISPLAY_XGLX *)display; bool ret = true; _al_mutex_lock(&system->lock); @@ -312,7 +312,7 @@ static bool xgtk_resize_display(ALLEGRO_DISPLAY *display, int w, int h) static gboolean do_set_window_title(gpointer data) { ARGS_TITLE *args = _al_gtk_lock_args(data); - ALLEGRO_DISPLAY_XGLX *d = args->display; + A5O_DISPLAY_XGLX *d = args->display; const char *title = args->title; gtk_window_set_title(GTK_WINDOW(d->gtk->gtkwindow), title); @@ -322,12 +322,12 @@ static gboolean do_set_window_title(gpointer data) /* [user thread] */ -static void xgtk_set_window_title(ALLEGRO_DISPLAY *display, const char *title) +static void xgtk_set_window_title(A5O_DISPLAY *display, const char *title) { ARGS_TITLE args; if (_al_gtk_init_args(&args, sizeof(args))) { - args.display = (ALLEGRO_DISPLAY_XGLX *)display; + args.display = (A5O_DISPLAY_XGLX *)display; args.title = title; _al_gtk_wait_for_args(do_set_window_title, &args); } @@ -337,7 +337,7 @@ static void xgtk_set_window_title(ALLEGRO_DISPLAY *display, const char *title) static gboolean do_set_fullscreen_window(gpointer data) { ARGS_FULLSCREEN_WINDOW *args = _al_gtk_lock_args(data); - ALLEGRO_DISPLAY_XGLX *d = args->display; + A5O_DISPLAY_XGLX *d = args->display; bool fullscreen = args->fullscreen; if (fullscreen) { @@ -352,12 +352,12 @@ static gboolean do_set_fullscreen_window(gpointer data) /* [user thread] */ -static void xgtk_set_fullscreen_window(ALLEGRO_DISPLAY *display, bool onoff) +static void xgtk_set_fullscreen_window(A5O_DISPLAY *display, bool onoff) { - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *d = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); + A5O_DISPLAY_XGLX *d = (A5O_DISPLAY_XGLX *)display; - if (onoff == (display->flags & ALLEGRO_FULLSCREEN_WINDOW)) { + if (onoff == (display->flags & A5O_FULLSCREEN_WINDOW)) { return; } @@ -366,7 +366,7 @@ static void xgtk_set_fullscreen_window(ALLEGRO_DISPLAY *display, bool onoff) int old_resize_count; ARGS_FULLSCREEN_WINDOW args; - display->flags ^= ALLEGRO_FULLSCREEN_WINDOW; + display->flags ^= A5O_FULLSCREEN_WINDOW; old_resize_count = d->resize_count; d->programmatic_resize = true; @@ -376,7 +376,7 @@ static void xgtk_set_fullscreen_window(ALLEGRO_DISPLAY *display, bool onoff) _al_gtk_wait_for_args(do_set_fullscreen_window, &args); _al_display_xglx_await_resize(display, old_resize_count, - (display->flags & ALLEGRO_FULLSCREEN)); + (display->flags & A5O_FULLSCREEN)); } d->programmatic_resize = false; @@ -398,12 +398,12 @@ static gboolean do_set_window_position(gpointer data) /* [user thread] */ -static void xgtk_set_window_position(ALLEGRO_DISPLAY *display, int x, int y) +static void xgtk_set_window_position(A5O_DISPLAY *display, int x, int y) { ARGS_POSITION args; if (_al_gtk_init_args(&args, sizeof(args))) { - args.display = (ALLEGRO_DISPLAY_XGLX *)display; + args.display = (A5O_DISPLAY_XGLX *)display; args.x = x; args.y = y; _al_gtk_wait_for_args(do_set_window_position, &args); @@ -412,7 +412,7 @@ static void xgtk_set_window_position(ALLEGRO_DISPLAY *display, int x, int y) /* [user thread] */ -static bool xgtk_set_window_constraints(ALLEGRO_DISPLAY *display, +static bool xgtk_set_window_constraints(A5O_DISPLAY *display, int min_w, int min_h, int max_w, int max_h) { // FIXME @@ -456,37 +456,37 @@ static gboolean do_set_frameless(gpointer data) /* [user thread] */ -static bool xgtk_set_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff) +static bool xgtk_set_display_flag(A5O_DISPLAY *display, int flag, bool onoff) { switch (flag) { - case ALLEGRO_FRAMELESS: { - if (!!(display->flags & ALLEGRO_FRAMELESS) == onoff) + case A5O_FRAMELESS: { + if (!!(display->flags & A5O_FRAMELESS) == onoff) return true; - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); ARGS_SET_FLAG args; _al_mutex_lock(&system->lock); if (_al_gtk_init_args(&args, sizeof(args))) { - args.display = (ALLEGRO_DISPLAY_XGLX *)display; + args.display = (A5O_DISPLAY_XGLX *)display; args.onoff = onoff; _al_gtk_wait_for_args(do_set_frameless, &args); if (onoff) - display->flags |= ALLEGRO_FRAMELESS; + display->flags |= A5O_FRAMELESS; else - display->flags &= ~ALLEGRO_FRAMELESS; + display->flags &= ~A5O_FRAMELESS; } _al_mutex_unlock(&system->lock); return true; } - case ALLEGRO_MAXIMIZED: { - if (!!(display->flags & ALLEGRO_MAXIMIZED) == onoff) + case A5O_MAXIMIZED: { + if (!!(display->flags & A5O_MAXIMIZED) == onoff) return true; - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); ARGS_SET_FLAG args; _al_mutex_lock(&system->lock); if (_al_gtk_init_args(&args, sizeof(args))) { - args.display = (ALLEGRO_DISPLAY_XGLX *)display; + args.display = (A5O_DISPLAY_XGLX *)display; args.onoff = onoff; - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; int old_resize_count = glx->resize_count; _al_gtk_wait_for_args(do_maximize, &args); _al_display_xglx_await_resize(display, old_resize_count, true); @@ -495,7 +495,7 @@ static bool xgtk_set_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff return true; } - case ALLEGRO_FULLSCREEN_WINDOW: + case A5O_FULLSCREEN_WINDOW: xgtk_set_fullscreen_window(display, onoff); return true; } @@ -515,22 +515,22 @@ static gboolean do_check_maximized(gpointer data) /* [user thread] */ -static void xgtk_check_maximized(ALLEGRO_DISPLAY *display) +static void xgtk_check_maximized(A5O_DISPLAY *display) { ARGS_SET_FLAG args; if (_al_gtk_init_args(&args, sizeof(args))) { - args.display = (ALLEGRO_DISPLAY_XGLX *)display; + args.display = (A5O_DISPLAY_XGLX *)display; _al_gtk_wait_for_args(do_check_maximized, &args); if (args.onoff) { - display->flags |= ALLEGRO_MAXIMIZED; + display->flags |= A5O_MAXIMIZED; } else { - display->flags &= ~ALLEGRO_MAXIMIZED; + display->flags &= ~A5O_MAXIMIZED; } } } -static struct ALLEGRO_XWIN_DISPLAY_OVERRIDABLE_INTERFACE xgtk_override_vt = +static struct A5O_XWIN_DISPLAY_OVERRIDABLE_INTERFACE xgtk_override_vt = { xgtk_create_display_hook, xgtk_destroy_display_hook, @@ -546,20 +546,20 @@ static struct ALLEGRO_XWIN_DISPLAY_OVERRIDABLE_INTERFACE xgtk_override_vt = bool _al_gtk_set_display_overridable_interface(bool on) { - return _al_xwin_set_gtk_display_overridable_interface(ALLEGRO_VERSION_INT, + return _al_xwin_set_gtk_display_overridable_interface(A5O_VERSION_INT, (on) ? &xgtk_override_vt : NULL); } -GtkWidget *_al_gtk_get_window(ALLEGRO_DISPLAY *display) +GtkWidget *_al_gtk_get_window(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_XGLX *d = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_DISPLAY_XGLX *d = (A5O_DISPLAY_XGLX *)display; if (d->overridable_vt == &xgtk_override_vt) { return d->gtk->gtkwindow; } - ALLEGRO_WARN("Not display created with GTK.\n"); + A5O_WARN("Not display created with GTK.\n"); return NULL; } diff --git a/addons/native_dialog/gtk_xgtk.h b/addons/native_dialog/gtk_xgtk.h index 213e1cf121..78b354aff9 100644 --- a/addons/native_dialog/gtk_xgtk.h +++ b/addons/native_dialog/gtk_xgtk.h @@ -3,13 +3,13 @@ #include -struct ALLEGRO_DISPLAY_XGLX_GTK { +struct A5O_DISPLAY_XGLX_GTK { GtkWidget *gtkwindow; GtkWidget *gtksocket; }; bool _al_gtk_set_display_overridable_interface(bool on); -GtkWidget *_al_gtk_get_window(ALLEGRO_DISPLAY *display); +GtkWidget *_al_gtk_get_window(A5O_DISPLAY *display); #endif diff --git a/addons/native_dialog/iphone_dialog.m b/addons/native_dialog/iphone_dialog.m index 58c6700d74..89109666df 100644 --- a/addons/native_dialog/iphone_dialog.m +++ b/addons/native_dialog/iphone_dialog.m @@ -15,8 +15,8 @@ void _al_shutdown_native_dialog_addon(void) { } -bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display, - ALLEGRO_NATIVE_DIALOG *fd) +bool _al_show_native_file_dialog(A5O_DISPLAY *display, + A5O_NATIVE_DIALOG *fd) { (void)display; (void)fd; @@ -24,11 +24,11 @@ bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display, } @interface AlertDelegate : NSObject { - ALLEGRO_MUTEX *mutex; - ALLEGRO_COND *button_pressed; + A5O_MUTEX *mutex; + A5O_COND *button_pressed; } -@property ALLEGRO_MUTEX *mutex; -@property ALLEGRO_COND *button_pressed; +@property A5O_MUTEX *mutex; +@property A5O_COND *button_pressed; @end @implementation AlertDelegate @@ -51,8 +51,8 @@ - (void) createAlert:(NSArray*)array { @end -int _al_show_native_message_box(ALLEGRO_DISPLAY *display, - ALLEGRO_NATIVE_DIALOG *nd) +int _al_show_native_message_box(A5O_DISPLAY *display, + A5O_NATIVE_DIALOG *nd) { (void)display; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; @@ -92,70 +92,70 @@ int _al_show_native_message_box(ALLEGRO_DISPLAY *display, return 0; } -bool _al_open_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) +bool _al_open_native_text_log(A5O_NATIVE_DIALOG *textlog) { (void)textlog; return false; } -void _al_close_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) +void _al_close_native_text_log(A5O_NATIVE_DIALOG *textlog) { (void) textlog; } -void _al_append_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) +void _al_append_native_text_log(A5O_NATIVE_DIALOG *textlog) { (void) textlog; } -bool _al_init_menu(ALLEGRO_MENU *menu) +bool _al_init_menu(A5O_MENU *menu) { (void) menu; return false; } -bool _al_init_popup_menu(ALLEGRO_MENU *menu) +bool _al_init_popup_menu(A5O_MENU *menu) { (void) menu; return false; } -bool _al_insert_menu_item_at(ALLEGRO_MENU_ITEM *item, int i) +bool _al_insert_menu_item_at(A5O_MENU_ITEM *item, int i) { (void) item; (void) i; return false; } -bool _al_destroy_menu_item_at(ALLEGRO_MENU_ITEM *item, int i) +bool _al_destroy_menu_item_at(A5O_MENU_ITEM *item, int i) { (void) item; (void) i; return false; } -bool _al_update_menu_item_at(ALLEGRO_MENU_ITEM *item, int i) +bool _al_update_menu_item_at(A5O_MENU_ITEM *item, int i) { (void) item; (void) i; return false; } -bool _al_show_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) +bool _al_show_display_menu(A5O_DISPLAY *display, A5O_MENU *menu) { (void) display; (void) menu; return false; } -bool _al_hide_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) +bool _al_hide_display_menu(A5O_DISPLAY *display, A5O_MENU *menu) { (void) display; (void) menu; return false; } -bool _al_show_popup_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) +bool _al_show_popup_menu(A5O_DISPLAY *display, A5O_MENU *menu) { (void) display; (void) menu; diff --git a/addons/native_dialog/menu.c b/addons/native_dialog/menu.c index e7f4831c80..c8ed1e667a 100644 --- a/addons/native_dialog/menu.c +++ b/addons/native_dialog/menu.c @@ -10,30 +10,30 @@ typedef struct DISPLAY_MENU DISPLAY_MENU; struct DISPLAY_MENU { - ALLEGRO_DISPLAY *display; - ALLEGRO_MENU *menu; + A5O_DISPLAY *display; + A5O_MENU *menu; }; static _AL_VECTOR display_menus = _AL_VECTOR_INITIALIZER(DISPLAY_MENU); /* The unique id. This is used to reverse lookup menus. * The primarily need for this arises from Windows, which cannot store - * ALLEGRO_MENU_ID's wholesale.*/ + * A5O_MENU_ID's wholesale.*/ static uint16_t unique_id; static _AL_VECTOR menu_ids = _AL_VECTOR_INITIALIZER(_AL_MENU_ID); /* The default event source is used with any menu that does not have its own event source enabled. */ -static ALLEGRO_EVENT_SOURCE default_menu_es; +static A5O_EVENT_SOURCE default_menu_es; /* Private functions */ -static ALLEGRO_MENU *clone_menu(ALLEGRO_MENU *menu, bool popup); -static ALLEGRO_MENU_ITEM *create_menu_item(char const *title, uint16_t id, int flags, ALLEGRO_MENU *popup); -static void destroy_menu_item(ALLEGRO_MENU_ITEM *item); -static bool find_menu_item_r(ALLEGRO_MENU *menu, ALLEGRO_MENU_ITEM *item, int index, void *extra); -static ALLEGRO_MENU_ITEM *interpret_menu_id_param(ALLEGRO_MENU **menu, int *id); -static ALLEGRO_MENU_INFO *parse_menu_info(ALLEGRO_MENU *parent, ALLEGRO_MENU_INFO *info); -static bool set_menu_display_r(ALLEGRO_MENU *menu, ALLEGRO_MENU_ITEM *item, int index, void *extra); +static A5O_MENU *clone_menu(A5O_MENU *menu, bool popup); +static A5O_MENU_ITEM *create_menu_item(char const *title, uint16_t id, int flags, A5O_MENU *popup); +static void destroy_menu_item(A5O_MENU_ITEM *item); +static bool find_menu_item_r(A5O_MENU *menu, A5O_MENU_ITEM *item, int index, void *extra); +static A5O_MENU_ITEM *interpret_menu_id_param(A5O_MENU **menu, int *id); +static A5O_MENU_INFO *parse_menu_info(A5O_MENU *parent, A5O_MENU_INFO *info); +static bool set_menu_display_r(A5O_MENU *menu, A5O_MENU_ITEM *item, int index, void *extra); /* True if the id is actually unique. */ @@ -49,29 +49,29 @@ static bool get_unique_id(uint16_t* id) /* The menu item owns the icon bitmap. It is converted to a memory bitmap * when set to make sure any system threads will be able to read the data. */ -static void set_item_icon(ALLEGRO_MENU_ITEM *item, ALLEGRO_BITMAP *icon) +static void set_item_icon(A5O_MENU_ITEM *item, A5O_BITMAP *icon) { item->icon = icon; - if (icon && al_get_bitmap_flags(item->icon) & ALLEGRO_VIDEO_BITMAP) { + if (icon && al_get_bitmap_flags(item->icon) & A5O_VIDEO_BITMAP) { int old_flags = al_get_new_bitmap_flags(); - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); item->icon = al_clone_bitmap(icon); al_destroy_bitmap(icon); al_set_new_bitmap_flags(old_flags); } } -static ALLEGRO_MENU_ITEM *create_menu_item(char const *title, uint16_t id, int flags, ALLEGRO_MENU *popup) +static A5O_MENU_ITEM *create_menu_item(char const *title, uint16_t id, int flags, A5O_MENU *popup) { - ALLEGRO_MENU_ITEM *item = al_calloc(1, sizeof(*item)); + A5O_MENU_ITEM *item = al_calloc(1, sizeof(*item)); if (!item) return NULL; if (!get_unique_id(&item->unique_id)) { return NULL; } - if (flags & ALLEGRO_MENU_ITEM_CHECKED) - flags |= ALLEGRO_MENU_ITEM_CHECKBOX; + if (flags & A5O_MENU_ITEM_CHECKED) + flags |= A5O_MENU_ITEM_CHECKBOX; if (title) item->caption = al_ustr_new(title); @@ -86,10 +86,10 @@ static ALLEGRO_MENU_ITEM *create_menu_item(char const *title, uint16_t id, int f * and once per menu. The deepest menu is called first. If the proc returns true, then the * process terminates. It is not safe for the proc to modify the structure (add/remove items). */ -bool _al_walk_over_menu(ALLEGRO_MENU *menu, - bool (*proc)(ALLEGRO_MENU *menu, ALLEGRO_MENU_ITEM *item, int index, void *extra), void *extra) +bool _al_walk_over_menu(A5O_MENU *menu, + bool (*proc)(A5O_MENU *menu, A5O_MENU_ITEM *item, int index, void *extra), void *extra) { - ALLEGRO_MENU_ITEM **slot; + A5O_MENU_ITEM **slot; size_t i; ASSERT(menu); ASSERT(proc); @@ -110,7 +110,7 @@ bool _al_walk_over_menu(ALLEGRO_MENU *menu, /* A callback proc for _al_walk_over_menu that sets each menu's display parameter * to the "extra" parameter. */ -static bool set_menu_display_r(ALLEGRO_MENU *menu, ALLEGRO_MENU_ITEM *item, int index, void *extra) +static bool set_menu_display_r(A5O_MENU *menu, A5O_MENU_ITEM *item, int index, void *extra) { (void) index; @@ -124,9 +124,9 @@ static bool set_menu_display_r(ALLEGRO_MENU *menu, ALLEGRO_MENU_ITEM *item, int /* A callback proc for _al_walk_over_menu that searches a menu for a given id. If found it sets * the "parent" parameter to the menu that contains it, and the "id" parameter to the index. */ -static bool find_menu_item_r(ALLEGRO_MENU *menu, ALLEGRO_MENU_ITEM *item, int index, void *extra) +static bool find_menu_item_r(A5O_MENU *menu, A5O_MENU_ITEM *item, int index, void *extra) { - ALLEGRO_MENU_ITEM *info = (ALLEGRO_MENU_ITEM *) extra; + A5O_MENU_ITEM *info = (A5O_MENU_ITEM *) extra; if (item != NULL && info->id == item->id) { info->id = index; @@ -139,9 +139,9 @@ static bool find_menu_item_r(ALLEGRO_MENU *menu, ALLEGRO_MENU_ITEM *item, int in /* Like find_menu_item_r, but searches by unique_id. */ -static bool find_menu_item_r_unique(ALLEGRO_MENU *menu, ALLEGRO_MENU_ITEM *item, int index, void *extra) +static bool find_menu_item_r_unique(A5O_MENU *menu, A5O_MENU_ITEM *item, int index, void *extra) { - ALLEGRO_MENU_ITEM *info = (ALLEGRO_MENU_ITEM *) extra; + A5O_MENU_ITEM *info = (A5O_MENU_ITEM *) extra; if (item != NULL && info->unique_id == item->unique_id) { info->id = index; @@ -155,7 +155,7 @@ static bool find_menu_item_r_unique(ALLEGRO_MENU *menu, ALLEGRO_MENU_ITEM *item, /* Carefully destroy a menu item... If the item is part of a menu, it must be * removed from it. */ -static void destroy_menu_item(ALLEGRO_MENU_ITEM *item) +static void destroy_menu_item(A5O_MENU_ITEM *item) { ASSERT(item); @@ -166,7 +166,7 @@ static void destroy_menu_item(ALLEGRO_MENU_ITEM *item) else { size_t i; for (i = 0; i < _al_vector_size(&item->parent->items); ++i) { - if (*(ALLEGRO_MENU_ITEM **)_al_vector_ref(&item->parent->items, i) == item) { + if (*(A5O_MENU_ITEM **)_al_vector_ref(&item->parent->items, i) == item) { /* Notify the platform that the item is to be removed. */ _al_destroy_menu_item_at(item, i); @@ -211,10 +211,10 @@ static void destroy_menu_item(ALLEGRO_MENU_ITEM *item) al_free(item); } -/* An ALLEGRO_MENU_INFO structure represents a heirarchy of menus. This function +/* An A5O_MENU_INFO structure represents a heirarchy of menus. This function * recursively steps through it and builds the entire menu. */ -static ALLEGRO_MENU_INFO *parse_menu_info(ALLEGRO_MENU *parent, ALLEGRO_MENU_INFO *info) +static A5O_MENU_INFO *parse_menu_info(A5O_MENU *parent, A5O_MENU_INFO *info) { ASSERT(parent); ASSERT(info); @@ -231,10 +231,10 @@ static ALLEGRO_MENU_INFO *parse_menu_info(ALLEGRO_MENU *parent, ALLEGRO_MENU_INF /* An item with a sub-menu has a -> marker as part of its caption. * (e.g., "File->"). */ - ALLEGRO_MENU *menu = al_create_menu(); + A5O_MENU *menu = al_create_menu(); if (menu) { /* Strip the -> mark off the end. */ - ALLEGRO_USTR *s = al_ustr_new(info->caption); + A5O_USTR *s = al_ustr_new(info->caption); al_ustr_remove_range(s, al_ustr_size(s) - 2, al_ustr_size(s)); al_append_menu_item(parent, al_cstr(s), info->id, 0, NULL, menu); info = parse_menu_info(menu, info + 1); @@ -267,7 +267,7 @@ static ALLEGRO_MENU_INFO *parse_menu_info(ALLEGRO_MENU *parent, ALLEGRO_MENU_INF * * (Note that the private OS specific functions always take a direct index.) */ -static ALLEGRO_MENU_ITEM *interpret_menu_id_param(ALLEGRO_MENU **menu, int *id) +static A5O_MENU_ITEM *interpret_menu_id_param(A5O_MENU **menu, int *id) { if (*id > 0) { if (!al_find_menu_item(*menu, *id, menu, id)) @@ -280,23 +280,23 @@ static ALLEGRO_MENU_ITEM *interpret_menu_id_param(ALLEGRO_MENU **menu, int *id) return NULL; } - return *(ALLEGRO_MENU_ITEM **) _al_vector_ref(&((*menu)->items), (size_t) *id); + return *(A5O_MENU_ITEM **) _al_vector_ref(&((*menu)->items), (size_t) *id); } /* A helper function for al_clone_menu() and al_clone_menu_for_popup(). * Note that only the root menu is created as a "popup" (if popup == TRUE). */ -static ALLEGRO_MENU *clone_menu(ALLEGRO_MENU *menu, bool popup) +static A5O_MENU *clone_menu(A5O_MENU *menu, bool popup) { - ALLEGRO_MENU *clone = NULL; + A5O_MENU *clone = NULL; size_t i; if (menu) { clone = popup ? al_create_popup_menu() : al_create_menu(); for (i = 0; i < _al_vector_size(&menu->items); ++i) { - const ALLEGRO_MENU_ITEM *item = *(ALLEGRO_MENU_ITEM **)_al_vector_ref(&menu->items, i); - ALLEGRO_BITMAP *icon = item->icon; + const A5O_MENU_ITEM *item = *(A5O_MENU_ITEM **)_al_vector_ref(&menu->items, i); + A5O_BITMAP *icon = item->icon; if (icon) icon = al_clone_bitmap(icon); @@ -311,12 +311,12 @@ static ALLEGRO_MENU *clone_menu(ALLEGRO_MENU *menu, bool popup) /* Function: al_create_menu */ -ALLEGRO_MENU *al_create_menu(void) +A5O_MENU *al_create_menu(void) { - ALLEGRO_MENU *m = al_calloc(1, sizeof(*m)); + A5O_MENU *m = al_calloc(1, sizeof(*m)); if (m) { - _al_vector_init(&m->items, sizeof(ALLEGRO_MENU_ITEM*)); + _al_vector_init(&m->items, sizeof(A5O_MENU_ITEM*)); /* Make sure the platform actually supports menus */ if (!_al_init_menu(m)) { @@ -330,12 +330,12 @@ ALLEGRO_MENU *al_create_menu(void) /* Function: al_create_popup_menu */ -ALLEGRO_MENU *al_create_popup_menu(void) +A5O_MENU *al_create_popup_menu(void) { - ALLEGRO_MENU *m = al_calloc(1, sizeof(*m)); + A5O_MENU *m = al_calloc(1, sizeof(*m)); if (m) { - _al_vector_init(&m->items, sizeof(ALLEGRO_MENU_ITEM*)); + _al_vector_init(&m->items, sizeof(A5O_MENU_ITEM*)); if (!_al_init_popup_menu(m)) { al_destroy_menu(m); @@ -354,23 +354,23 @@ ALLEGRO_MENU *al_create_popup_menu(void) /* Function: al_clone_menu */ -ALLEGRO_MENU *al_clone_menu(ALLEGRO_MENU *menu) +A5O_MENU *al_clone_menu(A5O_MENU *menu) { return clone_menu(menu, false); } /* Function: al_clone_menu_for_popup */ -ALLEGRO_MENU *al_clone_menu_for_popup(ALLEGRO_MENU *menu) +A5O_MENU *al_clone_menu_for_popup(A5O_MENU *menu) { return clone_menu(menu, true); } /* Function: al_build_menu */ -ALLEGRO_MENU *al_build_menu(ALLEGRO_MENU_INFO *info) +A5O_MENU *al_build_menu(A5O_MENU_INFO *info) { - ALLEGRO_MENU *root = al_create_menu(); + A5O_MENU *root = al_create_menu(); if (root) parse_menu_info(root, info); @@ -380,8 +380,8 @@ ALLEGRO_MENU *al_build_menu(ALLEGRO_MENU_INFO *info) /* Function: al_append_menu_item */ -int al_append_menu_item(ALLEGRO_MENU *parent, char const *title, uint16_t id, - int flags, ALLEGRO_BITMAP *icon, ALLEGRO_MENU *submenu) +int al_append_menu_item(A5O_MENU *parent, char const *title, uint16_t id, + int flags, A5O_BITMAP *icon, A5O_MENU *submenu) { ASSERT(parent); @@ -392,11 +392,11 @@ int al_append_menu_item(ALLEGRO_MENU *parent, char const *title, uint16_t id, /* Function: al_insert_menu_item */ -int al_insert_menu_item(ALLEGRO_MENU *parent, int pos, char const *title, - uint16_t id, int flags, ALLEGRO_BITMAP *icon, ALLEGRO_MENU *submenu) +int al_insert_menu_item(A5O_MENU *parent, int pos, char const *title, + uint16_t id, int flags, A5O_BITMAP *icon, A5O_MENU *submenu) { - ALLEGRO_MENU_ITEM *item; - ALLEGRO_MENU_ITEM **slot; + A5O_MENU_ITEM *item; + A5O_MENU_ITEM **slot; _AL_MENU_ID *menu_id; size_t i; @@ -459,9 +459,9 @@ int al_insert_menu_item(ALLEGRO_MENU *parent, int pos, char const *title, /* Function: al_remove_menu_item */ -bool al_remove_menu_item(ALLEGRO_MENU *menu, int pos) +bool al_remove_menu_item(A5O_MENU *menu, int pos) { - ALLEGRO_MENU_ITEM *item; + A5O_MENU_ITEM *item; ASSERT(menu); @@ -476,24 +476,24 @@ bool al_remove_menu_item(ALLEGRO_MENU *menu, int pos) /* Function: al_find_menu */ -ALLEGRO_MENU *al_find_menu(ALLEGRO_MENU *haystack, uint16_t id) +A5O_MENU *al_find_menu(A5O_MENU *haystack, uint16_t id) { int index; return !al_find_menu_item(haystack, id, &haystack, &index) ? NULL : - (*(ALLEGRO_MENU_ITEM **)_al_vector_ref(&haystack->items, index))->popup; + (*(A5O_MENU_ITEM **)_al_vector_ref(&haystack->items, index))->popup; } /* Function: al_find_menu_item */ -bool al_find_menu_item(ALLEGRO_MENU *haystack, uint16_t id, ALLEGRO_MENU **menu, +bool al_find_menu_item(A5O_MENU *haystack, uint16_t id, A5O_MENU **menu, int *index) { - ALLEGRO_MENU_ITEM item; + A5O_MENU_ITEM item; ASSERT(haystack); - /* Abuse the ALLEGRO_MENU_ITEM struct as a container for the _al_walk_over_menu callback. + /* Abuse the A5O_MENU_ITEM struct as a container for the _al_walk_over_menu callback. * If found, it will return true, and the "parent" field will be the menu that and * the "id" will be the index. */ @@ -513,10 +513,10 @@ bool al_find_menu_item(ALLEGRO_MENU *haystack, uint16_t id, ALLEGRO_MENU **menu, /* As al_find_menu_item, but searches by the unique id. */ -bool _al_find_menu_item_unique(ALLEGRO_MENU *haystack, uint16_t unique_id, ALLEGRO_MENU **menu, +bool _al_find_menu_item_unique(A5O_MENU *haystack, uint16_t unique_id, A5O_MENU **menu, int *index) { - ALLEGRO_MENU_ITEM item; + A5O_MENU_ITEM item; ASSERT(haystack); @@ -536,9 +536,9 @@ bool _al_find_menu_item_unique(ALLEGRO_MENU *haystack, uint16_t unique_id, ALLEG /* Function: al_get_menu_item_caption */ -const char *al_get_menu_item_caption(ALLEGRO_MENU *menu, int pos) +const char *al_get_menu_item_caption(A5O_MENU *menu, int pos) { - ALLEGRO_MENU_ITEM *item; + A5O_MENU_ITEM *item; ASSERT(menu); @@ -549,9 +549,9 @@ const char *al_get_menu_item_caption(ALLEGRO_MENU *menu, int pos) /* Function: al_set_menu_item_caption */ -void al_set_menu_item_caption(ALLEGRO_MENU *menu, int pos, const char *caption) +void al_set_menu_item_caption(A5O_MENU *menu, int pos, const char *caption) { - ALLEGRO_MENU_ITEM *item; + A5O_MENU_ITEM *item; ASSERT(menu); @@ -566,9 +566,9 @@ void al_set_menu_item_caption(ALLEGRO_MENU *menu, int pos, const char *caption) /* Function: al_get_menu_item_flags */ -int al_get_menu_item_flags(ALLEGRO_MENU *menu, int pos) +int al_get_menu_item_flags(A5O_MENU *menu, int pos) { - ALLEGRO_MENU_ITEM *item; + A5O_MENU_ITEM *item; ASSERT(menu); @@ -578,9 +578,9 @@ int al_get_menu_item_flags(ALLEGRO_MENU *menu, int pos) /* Function: al_set_menu_item_flags */ -void al_set_menu_item_flags(ALLEGRO_MENU *menu, int pos, int flags) +void al_set_menu_item_flags(A5O_MENU *menu, int pos, int flags) { - ALLEGRO_MENU_ITEM *item; + A5O_MENU_ITEM *item; ASSERT(menu); @@ -590,11 +590,11 @@ void al_set_menu_item_flags(ALLEGRO_MENU *menu, int pos, int flags) /* The CHECKBOX flag is read-only after the menu is created, and * the CHECKED flag can only be set if it is a CHECKBOX. */ - if (item->flags & ALLEGRO_MENU_ITEM_CHECKBOX) - flags |= ALLEGRO_MENU_ITEM_CHECKBOX; + if (item->flags & A5O_MENU_ITEM_CHECKBOX) + flags |= A5O_MENU_ITEM_CHECKBOX; else { - flags &= ~ALLEGRO_MENU_ITEM_CHECKED; - flags &= ~ALLEGRO_MENU_ITEM_CHECKBOX; + flags &= ~A5O_MENU_ITEM_CHECKED; + flags &= ~A5O_MENU_ITEM_CHECKBOX; } item->flags = flags; @@ -604,9 +604,9 @@ void al_set_menu_item_flags(ALLEGRO_MENU *menu, int pos, int flags) /* Function: al_toggle_menu_item_flags */ -int al_toggle_menu_item_flags(ALLEGRO_MENU *menu, int pos, int flags) +int al_toggle_menu_item_flags(A5O_MENU *menu, int pos, int flags) { - ALLEGRO_MENU_ITEM *item; + A5O_MENU_ITEM *item; ASSERT(menu); @@ -618,9 +618,9 @@ int al_toggle_menu_item_flags(ALLEGRO_MENU *menu, int pos, int flags) /* The CHECKBOX flag is read-only after the menu is created, and * the CHECKED flag can only be set if it is a CHECKBOX. */ - flags &= ~ALLEGRO_MENU_ITEM_CHECKBOX; - if (!(item->flags & ALLEGRO_MENU_ITEM_CHECKBOX)) { - flags &= ~ALLEGRO_MENU_ITEM_CHECKED; + flags &= ~A5O_MENU_ITEM_CHECKBOX; + if (!(item->flags & A5O_MENU_ITEM_CHECKBOX)) { + flags &= ~A5O_MENU_ITEM_CHECKED; } item->flags ^= flags; @@ -631,9 +631,9 @@ int al_toggle_menu_item_flags(ALLEGRO_MENU *menu, int pos, int flags) /* Function: al_get_menu_item_icon */ -ALLEGRO_BITMAP *al_get_menu_item_icon(ALLEGRO_MENU *menu, int pos) +A5O_BITMAP *al_get_menu_item_icon(A5O_MENU *menu, int pos) { - ALLEGRO_MENU_ITEM *item; + A5O_MENU_ITEM *item; ASSERT(menu); @@ -644,9 +644,9 @@ ALLEGRO_BITMAP *al_get_menu_item_icon(ALLEGRO_MENU *menu, int pos) /* Function: al_set_menu_item_icon */ -void al_set_menu_item_icon(ALLEGRO_MENU *menu, int pos, ALLEGRO_BITMAP *icon) +void al_set_menu_item_icon(A5O_MENU *menu, int pos, A5O_BITMAP *icon) { - ALLEGRO_MENU_ITEM *item; + A5O_MENU_ITEM *item; ASSERT(menu); @@ -663,16 +663,16 @@ void al_set_menu_item_icon(ALLEGRO_MENU *menu, int pos, ALLEGRO_BITMAP *icon) /* Function: al_destroy_menu */ -void al_destroy_menu(ALLEGRO_MENU *menu) +void al_destroy_menu(A5O_MENU *menu) { - ALLEGRO_MENU_ITEM **slot; + A5O_MENU_ITEM **slot; size_t i; ASSERT(menu); if (menu->parent) { /* If the menu is attached to a menu item, then this is equivelant to removing that menu item. */ - ALLEGRO_MENU *parent = menu->parent->parent; + A5O_MENU *parent = menu->parent->parent; ASSERT(parent); for (i = 0; i < _al_vector_size(&parent->items); ++i) { @@ -706,14 +706,14 @@ void al_destroy_menu(ALLEGRO_MENU *menu) /* Function: al_get_default_menu_event_source */ -ALLEGRO_EVENT_SOURCE *al_get_default_menu_event_source(void) +A5O_EVENT_SOURCE *al_get_default_menu_event_source(void) { return &default_menu_es; } /* Function: al_enable_menu_event_source */ -ALLEGRO_EVENT_SOURCE *al_enable_menu_event_source(ALLEGRO_MENU *menu) +A5O_EVENT_SOURCE *al_enable_menu_event_source(A5O_MENU *menu) { ASSERT(menu); @@ -727,7 +727,7 @@ ALLEGRO_EVENT_SOURCE *al_enable_menu_event_source(ALLEGRO_MENU *menu) /* Function: al_disable_menu_event_source */ -void al_disable_menu_event_source(ALLEGRO_MENU *menu) +void al_disable_menu_event_source(A5O_MENU *menu) { ASSERT(menu); @@ -739,7 +739,7 @@ void al_disable_menu_event_source(ALLEGRO_MENU *menu) /* Function: al_get_display_menu */ -ALLEGRO_MENU *al_get_display_menu(ALLEGRO_DISPLAY *display) +A5O_MENU *al_get_display_menu(A5O_DISPLAY *display) { size_t i; ASSERT(display); @@ -757,7 +757,7 @@ ALLEGRO_MENU *al_get_display_menu(ALLEGRO_DISPLAY *display) /* Function: al_set_display_menu */ -bool al_set_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) +bool al_set_display_menu(A5O_DISPLAY *display, A5O_MENU *menu) { DISPLAY_MENU *dm = NULL; size_t i; @@ -838,7 +838,7 @@ bool al_set_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) /* Function: al_popup_menu */ -bool al_popup_menu(ALLEGRO_MENU *popup, ALLEGRO_DISPLAY *display) +bool al_popup_menu(A5O_MENU *popup, A5O_DISPLAY *display) { bool ret; ASSERT(popup); @@ -862,9 +862,9 @@ bool al_popup_menu(ALLEGRO_MENU *popup, ALLEGRO_DISPLAY *display) /* Function: al_remove_display_menu */ -ALLEGRO_MENU *al_remove_display_menu(ALLEGRO_DISPLAY *display) +A5O_MENU *al_remove_display_menu(A5O_DISPLAY *display) { - ALLEGRO_MENU *menu; + A5O_MENU *menu; ASSERT(display); @@ -879,7 +879,7 @@ ALLEGRO_MENU *al_remove_display_menu(ALLEGRO_DISPLAY *display) /* Tries to find the menu that has a child with the given id. If display * is not NULL, then it must also match. The first match is returned. */ -_AL_MENU_ID *_al_find_parent_menu_by_id(ALLEGRO_DISPLAY *display, uint16_t unique_id) +_AL_MENU_ID *_al_find_parent_menu_by_id(A5O_DISPLAY *display, uint16_t unique_id) { _AL_MENU_ID *menu_id; size_t i; @@ -901,11 +901,11 @@ _AL_MENU_ID *_al_find_parent_menu_by_id(ALLEGRO_DISPLAY *display, uint16_t uniqu * and the user is using non-unique ids, it won't know which display actually * triggered the menu click. */ -bool _al_emit_menu_event(ALLEGRO_DISPLAY *display, uint16_t unique_id) +bool _al_emit_menu_event(A5O_DISPLAY *display, uint16_t unique_id) { - ALLEGRO_EVENT event; + A5O_EVENT event; _AL_MENU_ID *menu_id = NULL; - ALLEGRO_EVENT_SOURCE *source = al_get_default_menu_event_source(); + A5O_EVENT_SOURCE *source = al_get_default_menu_event_source(); /* try to find the menu that triggered the event */ menu_id = _al_find_parent_menu_by_id(display, unique_id); @@ -919,7 +919,7 @@ bool _al_emit_menu_event(ALLEGRO_DISPLAY *display, uint16_t unique_id) if (menu_id) { /* A menu was found associated with the id. See if it has an * event source associated with it, and adjust "source" accordingly. */ - ALLEGRO_MENU *m = menu_id->menu; + A5O_MENU *m = menu_id->menu; while (true) { if (m->is_event_source) { source = &m->es; @@ -936,7 +936,7 @@ bool _al_emit_menu_event(ALLEGRO_DISPLAY *display, uint16_t unique_id) } } - event.user.type = ALLEGRO_EVENT_MENU_CLICK; + event.user.type = A5O_EVENT_MENU_CLICK; event.user.data1 = menu_id->id; event.user.data2 = (intptr_t) display; event.user.data3 = (intptr_t) menu_id->menu; diff --git a/addons/native_dialog/osx_dialog.m b/addons/native_dialog/osx_dialog.m index 0e326ed33d..f2f692942b 100644 --- a/addons/native_dialog/osx_dialog.m +++ b/addons/native_dialog/osx_dialog.m @@ -70,8 +70,8 @@ void _al_shutdown_native_dialog_addon(void) return filter_array; } -bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display, - ALLEGRO_NATIVE_DIALOG *fd) +bool _al_show_native_file_dialog(A5O_DISPLAY *display, + A5O_NATIVE_DIALOG *fd) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; (void)display; @@ -81,7 +81,7 @@ bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display, /* Set initial directory to pass to the file selector */ if (fd->fc_initial_path) { - ALLEGRO_PATH *initial_directory = al_clone_path(fd->fc_initial_path); + A5O_PATH *initial_directory = al_clone_path(fd->fc_initial_path); /* Strip filename from path */ al_set_path_filename(initial_directory, NULL); @@ -98,7 +98,7 @@ bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display, /* We need slightly different code for SAVE and LOAD dialog boxes, which * are handled by slightly different classes. */ - if (mode & ALLEGRO_FILECHOOSER_SAVE) { // Save dialog + if (mode & A5O_FILECHOOSER_SAVE) { // Save dialog NSSavePanel *panel = [NSSavePanel savePanel]; NSArray *filter_array; @@ -138,7 +138,7 @@ bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display, NSArray *filter_array; /* Set file selection box options */ - if (mode & ALLEGRO_FILECHOOSER_FOLDER) { + if (mode & A5O_FILECHOOSER_FOLDER) { [panel setCanChooseFiles: NO]; [panel setCanChooseDirectories: YES]; } else { @@ -147,7 +147,7 @@ bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display, } [panel setResolvesAliases:YES]; - if (mode & ALLEGRO_FILECHOOSER_MULTIPLE) + if (mode & A5O_FILECHOOSER_MULTIPLE) [panel setAllowsMultipleSelection: YES]; else [panel setAllowsMultipleSelection: NO]; @@ -192,8 +192,8 @@ bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display, } #pragma mark Alert Box -int _al_show_native_message_box(ALLEGRO_DISPLAY *display, - ALLEGRO_NATIVE_DIALOG *fd) +int _al_show_native_message_box(A5O_DISPLAY *display, + A5O_NATIVE_DIALOG *fd) { (void)display; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; @@ -204,8 +204,8 @@ int _al_show_native_message_box(ALLEGRO_DISPLAY *display, if (fd->mb_buttons == NULL) { button_text = @"OK"; - if (fd->flags & ALLEGRO_MESSAGEBOX_YES_NO) button_text = @"Yes|No"; - if (fd->flags & ALLEGRO_MESSAGEBOX_OK_CANCEL) button_text = @"OK|Cancel"; + if (fd->flags & A5O_MESSAGEBOX_YES_NO) button_text = @"Yes|No"; + if (fd->flags & A5O_MESSAGEBOX_OK_CANCEL) button_text = @"OK|Cancel"; } else { button_text = [NSString stringWithUTF8String: al_cstr(fd->mb_buttons)]; @@ -237,7 +237,7 @@ @interface ALLogView : NSTextView #endif { @public - ALLEGRO_NATIVE_DIALOG *textlog; + A5O_NATIVE_DIALOG *textlog; } - (void)keyDown: (NSEvent*)event; - (BOOL)windowShouldClose: (id)sender; @@ -265,7 +265,7 @@ - (BOOL)windowShouldClose: (id)sender { (void)sender; if (self->textlog->is_active) { - if (!(self->textlog->flags & ALLEGRO_TEXTLOG_NO_CLOSE)) { + if (!(self->textlog->flags & A5O_TEXTLOG_NO_CLOSE)) { [self emitCloseEventWithKeypress: NO]; } } @@ -274,8 +274,8 @@ - (BOOL)windowShouldClose: (id)sender - (void)emitCloseEventWithKeypress: (BOOL)keypress { - ALLEGRO_EVENT event; - event.user.type = ALLEGRO_EVENT_NATIVE_DIALOG_CLOSE; + A5O_EVENT event; + event.user.type = A5O_EVENT_NATIVE_DIALOG_CLOSE; event.user.timestamp = al_get_time(); event.user.data1 = (intptr_t)self->textlog; event.user.data2 = (intptr_t)keypress; @@ -293,13 +293,13 @@ - (void)appendText: (NSString*)text } @end -bool _al_open_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) +bool _al_open_native_text_log(A5O_NATIVE_DIALOG *textlog) { NSRect rect = NSMakeRect(0, 0, 640, 480); int adapter = al_get_new_display_adapter(); NSScreen *screen; unsigned int mask = NSTitledWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask; - if (!(textlog->flags & ALLEGRO_TEXTLOG_NO_CLOSE)) + if (!(textlog->flags & A5O_TEXTLOG_NO_CLOSE)) mask |= NSClosableWindowMask; if ((adapter >= 0) && (adapter < al_get_num_video_adapters())) { @@ -335,7 +335,7 @@ bool _al_open_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) [[view textContainer] setContainerSize: NSMakeSize(rect.size.width, 1000000)]; [[view textContainer] setWidthTracksTextView: NO]; [view setTextColor: [NSColor grayColor]]; - if (textlog->flags & ALLEGRO_TEXTLOG_MONOSPACE) { + if (textlog->flags & A5O_TEXTLOG_MONOSPACE) { [view setFont: [NSFont userFixedPitchFontOfSize: 0]]; } [view setEditable: NO]; @@ -357,7 +357,7 @@ bool _al_open_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) return true; } -void _al_close_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) +void _al_close_native_text_log(A5O_NATIVE_DIALOG *textlog) { NSWindow *win = (NSWindow *)textlog->window; __block bool is_visible = false; @@ -375,7 +375,7 @@ void _al_close_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) textlog->tl_done = true; } -void _al_append_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) +void _al_append_native_text_log(A5O_NATIVE_DIALOG *textlog) { if (textlog->is_active) { ALLEGLogView *view = (ALLEGLogView *)textlog->tl_textview; @@ -407,29 +407,29 @@ -(void) setMenu: (NSMenu*) menu forWindow:(NSWindow*) window; /* This class represents a menu item target. There is one of these * for each NSMenu and it handles all the items in that menu. It - * maintains the correspondence between ALLEGRO_MENU_ITEMs and + * maintains the correspondence between A5O_MENU_ITEMs and * NSMenuItems, taking into account the 'App menu' (the one with * the app's name in bold) which appears by convention on OS X. */ @interface ALLEGMenuTarget : NSObject { NSLock* lock; - ALLEGRO_MENU* amenu; + A5O_MENU* amenu; BOOL _hasAppMenu; NSMenu* _menu; } -(NSMenu*) menu; --(id) initWithMenu:(ALLEGRO_MENU*) amenu; // Designated initializer +-(id) initWithMenu:(A5O_MENU*) amenu; // Designated initializer -(NSMenu*) menu; -(void) show; -(void) showPopup; --(void) insertItem:(ALLEGRO_MENU_ITEM*) item atIndex:(int) index; --(void) updateItem:(ALLEGRO_MENU_ITEM*) item atIndex: (int) index; --(void) destroyItem:(ALLEGRO_MENU_ITEM*) item atIndex: (int) index; +-(void) insertItem:(A5O_MENU_ITEM*) item atIndex:(int) index; +-(void) updateItem:(A5O_MENU_ITEM*) item atIndex: (int) index; +-(void) destroyItem:(A5O_MENU_ITEM*) item atIndex: (int) index; -(void) activated: (id) sender; -(BOOL) validateMenuItem:(NSMenuItem *)menuItem; -(void) dealloc; -+(ALLEGMenuTarget*) targetForMenu:(ALLEGRO_MENU*) amenu; ++(ALLEGMenuTarget*) targetForMenu:(A5O_MENU*) amenu; @end /* Take a menu caption. If it has an accelerator char (preceeded by & or _) @@ -446,39 +446,39 @@ +(ALLEGMenuTarget*) targetForMenu:(ALLEGRO_MENU*) amenu; } } -bool _al_init_menu(ALLEGRO_MENU *amenu) +bool _al_init_menu(A5O_MENU *amenu) { amenu->extra1 = [[ALLEGMenuTarget alloc] initWithMenu: amenu]; return true; } -bool _al_init_popup_menu(ALLEGRO_MENU *amenu) +bool _al_init_popup_menu(A5O_MENU *amenu) { amenu->extra1 = [[ALLEGMenuTarget alloc] initWithMenu: amenu]; return true; } -bool _al_insert_menu_item_at(ALLEGRO_MENU_ITEM *aitem, int i) +bool _al_insert_menu_item_at(A5O_MENU_ITEM *aitem, int i) { ALLEGMenuTarget* mt = [ALLEGMenuTarget targetForMenu: aitem->parent]; [mt insertItem: aitem atIndex: i]; return true; } -bool _al_destroy_menu_item_at(ALLEGRO_MENU_ITEM *aitem, int i) +bool _al_destroy_menu_item_at(A5O_MENU_ITEM *aitem, int i) { ALLEGMenuTarget* mt = [ALLEGMenuTarget targetForMenu: aitem->parent]; [mt destroyItem: aitem atIndex: i]; return true;} -bool _al_update_menu_item_at(ALLEGRO_MENU_ITEM *item, int i) +bool _al_update_menu_item_at(A5O_MENU_ITEM *item, int i) { ALLEGMenuTarget* mt = [ALLEGMenuTarget targetForMenu: item->parent]; [mt updateItem: item atIndex: i]; return true; } -bool _al_show_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *amenu) +bool _al_show_display_menu(A5O_DISPLAY *display, A5O_MENU *amenu) { ALLEGMenuTarget* target = [ALLEGMenuTarget targetForMenu:amenu]; NSWindow* window = al_osx_get_window(display); @@ -488,7 +488,7 @@ bool _al_show_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *amenu) return true; } -bool _al_hide_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) +bool _al_hide_display_menu(A5O_DISPLAY *display, A5O_MENU *menu) { (void)menu; (void)display; @@ -496,7 +496,7 @@ bool _al_hide_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) return false; } -bool _al_show_popup_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *amenu) +bool _al_show_popup_menu(A5O_DISPLAY *display, A5O_MENU *amenu) { (void) display; ALLEGMenuTarget* target = [ALLEGMenuTarget targetForMenu: amenu]; @@ -511,11 +511,11 @@ int _al_get_menu_display_height(void) } @implementation ALLEGMenuTarget -/* Initial conversion of ALLEGRO_MENU_ITEM to NSMenuItem. +/* Initial conversion of A5O_MENU_ITEM to NSMenuItem. * The target (self) is set for the item. * The checkbox state is not set here, it's done dynamically in -validateMenuItem. */ --(NSMenuItem*) buildMenuItemFor:(ALLEGRO_MENU_ITEM*) aitem +-(NSMenuItem*) buildMenuItemFor:(A5O_MENU_ITEM*) aitem { NSMenuItem* item; if (aitem->caption && al_ustr_length(aitem->caption) > 0) { @@ -552,8 +552,8 @@ -(void) insertAppMenu self->_hasAppMenu = YES; } } -// Get the NSMenuItem corresponding to this ALLEGRO_MENU_ITEM -- (NSMenuItem*) itemForAllegroItem:(ALLEGRO_MENU_ITEM*) aitem +// Get the NSMenuItem corresponding to this A5O_MENU_ITEM +- (NSMenuItem*) itemForAllegroItem:(A5O_MENU_ITEM*) aitem { int index = _al_vector_find(&self->amenu->items, &aitem); if (index >= 0) { @@ -566,22 +566,22 @@ - (NSMenuItem*) itemForAllegroItem:(ALLEGRO_MENU_ITEM*) aitem return nil; } } -// Get the ALLEGRO_MENU_ITEM corresponding to this NSMenuItem -- (ALLEGRO_MENU_ITEM*) allegroItemforItem: (NSMenuItem*) mi +// Get the A5O_MENU_ITEM corresponding to this NSMenuItem +- (A5O_MENU_ITEM*) allegroItemforItem: (NSMenuItem*) mi { int i; - ALLEGRO_MENU_ITEM * ami; + A5O_MENU_ITEM * ami; for (i = 0; i < (int)_al_vector_size(&self->amenu->items); i++) { - ami = *(ALLEGRO_MENU_ITEM**) _al_vector_ref(&self->amenu->items, i); + ami = *(A5O_MENU_ITEM**) _al_vector_ref(&self->amenu->items, i); if (ami->extra1 == mi) { return ami; } } return NULL; } -// Create target with ALLEGRO_MENU bound to it. -- (id)initWithMenu:(ALLEGRO_MENU*) source_menu +// Create target with A5O_MENU bound to it. +- (id)initWithMenu:(A5O_MENU*) source_menu { self = [super init]; if (self) { @@ -599,11 +599,11 @@ -(id) init } // Manage the enabled and checked state (done dynamically by the framework) -(BOOL) validateMenuItem:(NSMenuItem *)menuItem { - ALLEGRO_MENU_ITEM* aitem = [self allegroItemforItem:menuItem]; + A5O_MENU_ITEM* aitem = [self allegroItemforItem:menuItem]; if (aitem) { - int checked = (aitem->flags & (ALLEGRO_MENU_ITEM_CHECKBOX|ALLEGRO_MENU_ITEM_CHECKED)) == (ALLEGRO_MENU_ITEM_CHECKBOX|ALLEGRO_MENU_ITEM_CHECKED); + int checked = (aitem->flags & (A5O_MENU_ITEM_CHECKBOX|A5O_MENU_ITEM_CHECKED)) == (A5O_MENU_ITEM_CHECKBOX|A5O_MENU_ITEM_CHECKED); [menuItem setState: checked ? NSOnState : NSOffState ]; - return aitem->flags & ALLEGRO_MENU_ITEM_DISABLED ? NO : YES; + return aitem->flags & A5O_MENU_ITEM_DISABLED ? NO : YES; } return YES; } @@ -621,16 +621,16 @@ -(NSMenu*) menu // Action event when the menu is selected -(void) activated:(id)sender { NSMenuItem* mitem = (NSMenuItem*) sender; - ALLEGRO_MENU_ITEM* aitim = [self allegroItemforItem:mitem]; + A5O_MENU_ITEM* aitim = [self allegroItemforItem:mitem]; if (aitim) { - if (aitim->flags & ALLEGRO_MENU_ITEM_CHECKBOX) { - aitim->flags ^= ALLEGRO_MENU_ITEM_CHECKED; + if (aitim->flags & A5O_MENU_ITEM_CHECKBOX) { + aitim->flags ^= A5O_MENU_ITEM_CHECKED; } _al_emit_menu_event(aitim->parent->display, aitim->unique_id); } } // Insert an item, keep the NSMenu in sync --(void) insertItem:(ALLEGRO_MENU_ITEM*) aitem atIndex: (int) index +-(void) insertItem:(A5O_MENU_ITEM*) aitem atIndex: (int) index { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSMenuItem* item = [self buildMenuItemFor:aitem]; @@ -644,7 +644,7 @@ -(void) insertItem:(ALLEGRO_MENU_ITEM*) aitem atIndex: (int) index [pool release]; } // Update an item (caption only, see -validateMenuItem: ) --(void) updateItem:(ALLEGRO_MENU_ITEM *)aitem atIndex:(int)index +-(void) updateItem:(A5O_MENU_ITEM *)aitem atIndex:(int)index { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; (void) index; @@ -654,12 +654,12 @@ -(void) updateItem:(ALLEGRO_MENU_ITEM *)aitem atIndex:(int)index [item setTitle:caption]; [item setKeyEquivalent:key]; if (aitem->popup) { - [item setEnabled:(aitem->flags & ALLEGRO_MENU_ITEM_DISABLED) ? NO : YES]; + [item setEnabled:(aitem->flags & A5O_MENU_ITEM_DISABLED) ? NO : YES]; } [pool release]; } // Remove an item, keep the NSMenu in sync --(void) destroyItem:(ALLEGRO_MENU_ITEM *)aitem atIndex:(int)index +-(void) destroyItem:(A5O_MENU_ITEM *)aitem atIndex:(int)index { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; (void) index; @@ -693,8 +693,8 @@ -(void) showPopup [NSMenu popUpContextMenu:self.menu withEvent:fakeMouseEvent forView:[window contentView]]; } -// Find the target associated with this ALLEGRO_MENU -+(ALLEGMenuTarget*) targetForMenu:(ALLEGRO_MENU *)amenu { +// Find the target associated with this A5O_MENU ++(ALLEGMenuTarget*) targetForMenu:(A5O_MENU *)amenu { if (!amenu->extra1) { amenu->extra1 = [[ALLEGMenuTarget alloc] initWithMenu:amenu]; } diff --git a/addons/native_dialog/textlog.c b/addons/native_dialog/textlog.c index aa7c64514a..64715914df 100644 --- a/addons/native_dialog/textlog.c +++ b/addons/native_dialog/textlog.c @@ -11,7 +11,7 @@ /* The GTK and OSX implementations do not require an extra thread. * The Windows implementation does. */ -#if defined(ALLEGRO_CFG_NATIVE_DIALOG_WINDOWS) +#if defined(A5O_CFG_NATIVE_DIALOG_WINDOWS) #define TEXT_LOG_EXTRA_THREAD true #else #define TEXT_LOG_EXTRA_THREAD false @@ -19,9 +19,9 @@ /* This will only return when the text window is closed. */ -static void *text_log_thread_proc(ALLEGRO_THREAD *thread, void *arg) +static void *text_log_thread_proc(A5O_THREAD *thread, void *arg) { - ALLEGRO_NATIVE_DIALOG *textlog = arg; + A5O_NATIVE_DIALOG *textlog = arg; if (!_al_open_native_text_log(textlog)) { al_lock_mutex(textlog->tl_text_mutex); @@ -36,9 +36,9 @@ static void *text_log_thread_proc(ALLEGRO_THREAD *thread, void *arg) /* Function: al_open_native_text_log */ -ALLEGRO_TEXTLOG *al_open_native_text_log(char const *title, int flags) +A5O_TEXTLOG *al_open_native_text_log(char const *title, int flags) { - ALLEGRO_NATIVE_DIALOG *textlog = NULL; + A5O_NATIVE_DIALOG *textlog = NULL; /* Avoid warnings when log windows are unimplemented. */ (void)title; @@ -76,22 +76,22 @@ ALLEGRO_TEXTLOG *al_open_native_text_log(char const *title, int flags) } if (textlog->tl_init_error) { - al_close_native_text_log((ALLEGRO_TEXTLOG *)textlog); + al_close_native_text_log((A5O_TEXTLOG *)textlog); return NULL; } textlog->dtor_item = _al_register_destructor(_al_dtor_list, "textlog", textlog, (void (*)(void *))al_close_native_text_log); - return (ALLEGRO_TEXTLOG *)textlog; + return (A5O_TEXTLOG *)textlog; } /* Function: al_close_native_text_log */ -void al_close_native_text_log(ALLEGRO_TEXTLOG *textlog) +void al_close_native_text_log(A5O_TEXTLOG *textlog) { - ALLEGRO_NATIVE_DIALOG *dialog = (ALLEGRO_NATIVE_DIALOG *)textlog; + A5O_NATIVE_DIALOG *dialog = (A5O_NATIVE_DIALOG *)textlog; if (!dialog) return; @@ -132,10 +132,10 @@ void al_close_native_text_log(ALLEGRO_TEXTLOG *textlog) /* Function: al_append_native_text_log */ -void al_append_native_text_log(ALLEGRO_TEXTLOG *textlog, +void al_append_native_text_log(A5O_TEXTLOG *textlog, char const *format, ...) { - ALLEGRO_NATIVE_DIALOG *dialog = (ALLEGRO_NATIVE_DIALOG *)textlog; + A5O_NATIVE_DIALOG *dialog = (A5O_NATIVE_DIALOG *)textlog; va_list args; /* Fall back to printf if no window. */ @@ -161,10 +161,10 @@ void al_append_native_text_log(ALLEGRO_TEXTLOG *textlog, /* Function: al_get_native_text_log_event_source */ -ALLEGRO_EVENT_SOURCE *al_get_native_text_log_event_source( - ALLEGRO_TEXTLOG *textlog) +A5O_EVENT_SOURCE *al_get_native_text_log_event_source( + A5O_TEXTLOG *textlog) { - ALLEGRO_NATIVE_DIALOG *dialog = (ALLEGRO_NATIVE_DIALOG *)textlog; + A5O_NATIVE_DIALOG *dialog = (A5O_NATIVE_DIALOG *)textlog; ASSERT(dialog); return &dialog->tl_events; diff --git a/addons/native_dialog/win_dialog.c b/addons/native_dialog/win_dialog.c index 57c38c72e2..c4087a3da1 100644 --- a/addons/native_dialog/win_dialog.c +++ b/addons/native_dialog/win_dialog.c @@ -24,7 +24,7 @@ #include #include // for folder selector -ALLEGRO_DEBUG_CHANNEL("win_dialog") +A5O_DEBUG_CHANNEL("win_dialog") #define WM_SHOW_POPUP (WM_APP + 42) #define WM_HIDE_MENU (WM_APP + 43) @@ -42,9 +42,9 @@ static TCHAR* wlog_edit_control = TEXT("EDIT"); /* True if output support unicode */ static bool wlog_unicode = false; -static ALLEGRO_MUTEX* global_mutex; +static A5O_MUTEX* global_mutex; -static ALLEGRO_COND* wm_size_cond; +static A5O_COND* wm_size_cond; static bool got_wm_size_event = false; /* For Unicode support, define some helper functions @@ -55,20 +55,20 @@ static bool got_wm_size_event = false; /* tcreate_path: * Create path from TCHARs */ -static ALLEGRO_PATH* _tcreate_path(const TCHAR* ts) +static A5O_PATH* _tcreate_path(const TCHAR* ts) { char* tmp = _twin_tchar_to_utf8(ts); - ALLEGRO_PATH* path = al_create_path(tmp); + A5O_PATH* path = al_create_path(tmp); al_free(tmp); return path; } /* tcreate_path: * Create directory path from TCHARs */ -static ALLEGRO_PATH* _tcreate_path_for_directory(const TCHAR* ts) +static A5O_PATH* _tcreate_path_for_directory(const TCHAR* ts) { char* tmp = _twin_tchar_to_utf8(ts); - ALLEGRO_PATH* path = al_create_path_for_directory(tmp); + A5O_PATH* path = al_create_path_for_directory(tmp); al_free(tmp); return path; } @@ -100,15 +100,15 @@ static INT CALLBACK _browse_callback_proc(HWND hwnd, UINT uMsg, LPARAM unused, L return 0; } -static TCHAR* _extract_dirname(ALLEGRO_PATH *fullpath) +static TCHAR* _extract_dirname(A5O_PATH *fullpath) { TCHAR* wpath = NULL; bool is_dir; - const ALLEGRO_USTR *path = al_path_ustr(fullpath, ALLEGRO_NATIVE_PATH_SEP); + const A5O_USTR *path = al_path_ustr(fullpath, A5O_NATIVE_PATH_SEP); if (al_filename_exists(al_cstr(path))) { - ALLEGRO_FS_ENTRY *fs = al_create_fs_entry(al_cstr(path)); - is_dir = al_get_fs_entry_mode(fs) & ALLEGRO_FILEMODE_ISDIR; + A5O_FS_ENTRY *fs = al_create_fs_entry(al_cstr(path)); + is_dir = al_get_fs_entry_mode(fs) & A5O_FILEMODE_ISDIR; al_destroy_fs_entry(fs); } else { @@ -121,19 +121,19 @@ static TCHAR* _extract_dirname(ALLEGRO_PATH *fullpath) else { /* Extract the directory from the path. */ - ALLEGRO_PATH* initial_dir_path = NULL; + A5O_PATH* initial_dir_path = NULL; initial_dir_path = al_clone_path(fullpath); if (initial_dir_path) { al_set_path_filename(initial_dir_path, NULL); - wpath = _twin_utf8_to_tchar(al_path_cstr(initial_dir_path, ALLEGRO_NATIVE_PATH_SEP)); + wpath = _twin_utf8_to_tchar(al_path_cstr(initial_dir_path, A5O_NATIVE_PATH_SEP)); al_destroy_path(initial_dir_path); } } return wpath; } -static bool select_folder(ALLEGRO_DISPLAY_WIN *win_display, - ALLEGRO_NATIVE_DIALOG *fd) +static bool select_folder(A5O_DISPLAY_WIN *win_display, + A5O_NATIVE_DIALOG *fd) { BROWSEINFO folderinfo; TCHAR* wpath = NULL; @@ -171,9 +171,9 @@ static bool select_folder(ALLEGRO_DISPLAY_WIN *win_display, return false; } -static ALLEGRO_USTR *create_filter_string(const _AL_VECTOR *patterns) +static A5O_USTR *create_filter_string(const _AL_VECTOR *patterns) { - ALLEGRO_USTR *filter = al_ustr_new(""); + A5O_USTR *filter = al_ustr_new(""); for (size_t i = 0; i < _al_vector_size(patterns); i++) { _AL_PATTERNS_AND_DESC *patterns_and_desc = _al_vector_ref(patterns, i); @@ -185,7 +185,7 @@ static ALLEGRO_USTR *create_filter_string(const _AL_VECTOR *patterns) if (!any_valid) { continue; } - const ALLEGRO_USTR *desc = al_ref_info(&patterns_and_desc->desc); + const A5O_USTR *desc = al_ref_info(&patterns_and_desc->desc); if (al_ustr_size(desc) > 0) { al_ustr_append(filter, desc); } @@ -224,24 +224,24 @@ static int skip_nul_terminated_string(TCHAR *s) return i+1; } -bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display, - ALLEGRO_NATIVE_DIALOG *fd) +bool _al_show_native_file_dialog(A5O_DISPLAY *display, + A5O_NATIVE_DIALOG *fd) { OPENFILENAME ofn; - ALLEGRO_DISPLAY_WIN *win_display; + A5O_DISPLAY_WIN *win_display; int flags = 0; bool ret; TCHAR buf[4096]; const int BUFSIZE = sizeof(buf) / sizeof(TCHAR); TCHAR* wfilter = NULL; TCHAR* wpath = NULL; - ALLEGRO_USTR *filter_string = NULL; + A5O_USTR *filter_string = NULL; buf[0] = '\0'; - win_display = (ALLEGRO_DISPLAY_WIN *)display; + win_display = (A5O_DISPLAY_WIN *)display; - if (fd->flags & ALLEGRO_FILECHOOSER_FOLDER) { + if (fd->flags & A5O_FILECHOOSER_FOLDER) { return select_folder(win_display, fd); } @@ -276,14 +276,14 @@ bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display, ofn.lpstrTitle = _twin_ustr_to_tchar(fd->title); flags |= OFN_NOCHANGEDIR | OFN_EXPLORER; - if (fd->flags & ALLEGRO_FILECHOOSER_SAVE) { + if (fd->flags & A5O_FILECHOOSER_SAVE) { flags |= OFN_OVERWRITEPROMPT; } else { - flags |= (fd->flags & ALLEGRO_FILECHOOSER_FILE_MUST_EXIST) ? OFN_FILEMUSTEXIST : 0; + flags |= (fd->flags & A5O_FILECHOOSER_FILE_MUST_EXIST) ? OFN_FILEMUSTEXIST : 0; } - flags |= (fd->flags & ALLEGRO_FILECHOOSER_MULTIPLE) ? OFN_ALLOWMULTISELECT : 0; - flags |= (fd->flags & ALLEGRO_FILECHOOSER_SHOW_HIDDEN) ? 0x10000000 : 0; // NOTE: 0x10000000 is FORCESHOWHIDDEN + flags |= (fd->flags & A5O_FILECHOOSER_MULTIPLE) ? OFN_ALLOWMULTISELECT : 0; + flags |= (fd->flags & A5O_FILECHOOSER_SHOW_HIDDEN) ? 0x10000000 : 0; // NOTE: 0x10000000 is FORCESHOWHIDDEN ofn.Flags = flags; if (flags & OFN_OVERWRITEPROMPT) { @@ -301,7 +301,7 @@ bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display, if (!ret) { DWORD err = GetLastError(); if (err != ERROR_SUCCESS) { - ALLEGRO_ERROR("al_show_native_file_dialog failed: %s\n", _al_win_error(err)); + A5O_ERROR("al_show_native_file_dialog failed: %s\n", _al_win_error(err)); } return false; } @@ -346,8 +346,8 @@ bool _al_show_native_file_dialog(ALLEGRO_DISPLAY *display, return true; } -int _al_show_native_message_box(ALLEGRO_DISPLAY *display, - ALLEGRO_NATIVE_DIALOG *fd) +int _al_show_native_message_box(A5O_DISPLAY *display, + A5O_NATIVE_DIALOG *fd) { UINT type = MB_SETFOREGROUND; int result; @@ -355,18 +355,18 @@ int _al_show_native_message_box(ALLEGRO_DISPLAY *display, /* Note: the message box code cannot assume that Allegro is installed. */ - if (fd->flags & ALLEGRO_MESSAGEBOX_QUESTION) + if (fd->flags & A5O_MESSAGEBOX_QUESTION) type |= MB_ICONQUESTION; - else if (fd->flags & ALLEGRO_MESSAGEBOX_WARN) + else if (fd->flags & A5O_MESSAGEBOX_WARN) type |= MB_ICONWARNING; - else if (fd->flags & ALLEGRO_MESSAGEBOX_ERROR) + else if (fd->flags & A5O_MESSAGEBOX_ERROR) type |= MB_ICONERROR; else type |= MB_ICONINFORMATION; - if (fd->flags & ALLEGRO_MESSAGEBOX_YES_NO) + if (fd->flags & A5O_MESSAGEBOX_YES_NO) type |= MB_YESNO; - else if (fd->flags & ALLEGRO_MESSAGEBOX_OK_CANCEL) + else if (fd->flags & A5O_MESSAGEBOX_OK_CANCEL) type |= MB_OKCANCEL; /* heading + text are combined together */ @@ -399,10 +399,10 @@ int _al_show_native_message_box(ALLEGRO_DISPLAY *display, /* Emit close event. */ -static void wlog_emit_close_event(ALLEGRO_NATIVE_DIALOG *textlog, bool keypress) +static void wlog_emit_close_event(A5O_NATIVE_DIALOG *textlog, bool keypress) { - ALLEGRO_EVENT event; - event.user.type = ALLEGRO_EVENT_NATIVE_DIALOG_CLOSE; + A5O_EVENT event; + event.user.type = A5O_EVENT_NATIVE_DIALOG_CLOSE; event.user.timestamp = al_get_time(); event.user.data1 = (intptr_t)textlog; event.user.data2 = (intptr_t)keypress; @@ -412,7 +412,7 @@ static void wlog_emit_close_event(ALLEGRO_NATIVE_DIALOG *textlog, bool keypress) /* convert_crlf: * Alter this string to change every LF to CRLF */ -static ALLEGRO_USTR* convert_crlf(ALLEGRO_USTR* s) { +static A5O_USTR* convert_crlf(A5O_USTR* s) { int pos = 0; int ch, prev; while ((pos = al_ustr_find_chr(s, pos, '\n')) >= 0) { @@ -429,7 +429,7 @@ static ALLEGRO_USTR* convert_crlf(ALLEGRO_USTR* s) { return s; } /* General function to output log message. */ -static void wlog_do_append_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) +static void wlog_do_append_native_text_log(A5O_NATIVE_DIALOG *textlog) { int index; index = GetWindowTextLength(textlog->tl_textview); @@ -449,7 +449,7 @@ static LRESULT CALLBACK wlog_text_log_callback(HWND hWnd, UINT uMsg, WPARAM wPar { CREATESTRUCT* create_struct; - ALLEGRO_NATIVE_DIALOG* textlog = (ALLEGRO_NATIVE_DIALOG*)GetWindowLongPtr(hWnd, GWLP_USERDATA); + A5O_NATIVE_DIALOG* textlog = (A5O_NATIVE_DIALOG*)GetWindowLongPtr(hWnd, GWLP_USERDATA); switch (uMsg) { case WM_CREATE: @@ -460,7 +460,7 @@ static LRESULT CALLBACK wlog_text_log_callback(HWND hWnd, UINT uMsg, WPARAM wPar case WM_CLOSE: if (textlog->is_active) { - if (!(textlog->flags & ALLEGRO_TEXTLOG_NO_CLOSE)) { + if (!(textlog->flags & A5O_TEXTLOG_NO_CLOSE)) { wlog_emit_close_event(textlog, false); } return 0; @@ -504,7 +504,7 @@ static LRESULT CALLBACK wlog_text_log_callback(HWND hWnd, UINT uMsg, WPARAM wPar /* We hold textlog->tl_text_mutex. */ -static bool open_native_text_log_inner(ALLEGRO_NATIVE_DIALOG *textlog) +static bool open_native_text_log_inner(A5O_NATIVE_DIALOG *textlog) { LPCTSTR font_name; HWND hWnd; @@ -523,7 +523,7 @@ static bool open_native_text_log_inner(ALLEGRO_NATIVE_DIALOG *textlog) (HINSTANCE)GetModuleHandle(NULL), textlog); al_free(title); if (!hWnd) { - ALLEGRO_ERROR("CreateWindow failed\n"); + A5O_ERROR("CreateWindow failed\n"); return false; } @@ -536,7 +536,7 @@ static bool open_native_text_log_inner(ALLEGRO_NATIVE_DIALOG *textlog) client_rect.left, client_rect.top, client_rect.right - client_rect.left, client_rect.bottom - client_rect.top, hWnd, NULL, (HINSTANCE)GetModuleHandle(NULL), NULL); if (!hLog) { - ALLEGRO_ERROR("CreateWindow failed\n"); + A5O_ERROR("CreateWindow failed\n"); DestroyWindow(hWnd); return false; } @@ -545,7 +545,7 @@ static bool open_native_text_log_inner(ALLEGRO_NATIVE_DIALOG *textlog) SetWindowLong(hLog, GWL_EXSTYLE, GetWindowLong(hLog, GWL_EXSTYLE) | 0x02000000L/*WS_EX_COMPOSITED*/); /* Select font name. */ - if (textlog->flags & ALLEGRO_TEXTLOG_MONOSPACE) + if (textlog->flags & A5O_TEXTLOG_MONOSPACE) font_name = TEXT("Courier New"); else font_name = TEXT("Arial"); @@ -604,7 +604,7 @@ static bool open_native_text_log_inner(ALLEGRO_NATIVE_DIALOG *textlog) return true; } -bool _al_open_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) +bool _al_open_native_text_log(A5O_NATIVE_DIALOG *textlog) { WNDCLASS text_log_class; bool rc; @@ -617,7 +617,7 @@ bool _al_open_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) /* Prepare text log class info. */ if (wlog_count == 0) { - ALLEGRO_DEBUG("Register text log class\n"); + A5O_DEBUG("Register text log class\n"); memset(&text_log_class, 0, sizeof(text_log_class)); text_log_class.hInstance = (HINSTANCE)GetModuleHandle(NULL); @@ -630,7 +630,7 @@ bool _al_open_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) if (RegisterClass(&text_log_class) == 0) { /* Failure, window class is a basis and we do not have one. */ - ALLEGRO_ERROR("RegisterClass failed\n"); + A5O_ERROR("RegisterClass failed\n"); al_unlock_mutex(textlog->tl_text_mutex); return false; } @@ -638,8 +638,8 @@ bool _al_open_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) /* Load RichEdit control. */ if (wlog_count == 0) { - ALLEGRO_DEBUG("Load rich edit module\n"); - ALLEGRO_ASSERT(!wlog_rich_edit_module); + A5O_DEBUG("Load rich edit module\n"); + A5O_ASSERT(!wlog_rich_edit_module); if ((wlog_rich_edit_module = _al_open_library("msftedit.dll"))) { /* 4.1 and emulation of 3.0, 2.0, 1.0 */ @@ -663,23 +663,23 @@ bool _al_open_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) } wlog_count++; - ALLEGRO_DEBUG("wlog_count = %d\n", wlog_count); + A5O_DEBUG("wlog_count = %d\n", wlog_count); rc = open_native_text_log_inner(textlog); wlog_count--; - ALLEGRO_DEBUG("wlog_count = %d\n", wlog_count); + A5O_DEBUG("wlog_count = %d\n", wlog_count); /* Release RichEdit module. */ if (wlog_count == 0 && wlog_rich_edit_module) { - ALLEGRO_DEBUG("Unload rich edit module\n"); + A5O_DEBUG("Unload rich edit module\n"); _al_close_library(wlog_rich_edit_module); wlog_rich_edit_module = NULL; } /* Unregister window class. */ if (wlog_count == 0) { - ALLEGRO_DEBUG("Unregister text log class\n"); + A5O_DEBUG("Unregister text log class\n"); UnregisterClass(TEXT("Allegro Text Log"), (HINSTANCE)GetModuleHandle(NULL)); } @@ -688,7 +688,7 @@ bool _al_open_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) return rc; } -void _al_close_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) +void _al_close_native_text_log(A5O_NATIVE_DIALOG *textlog) { /* Just deactivate text log and send bye, bye message. */ if (IsWindow(textlog->window)) { @@ -697,7 +697,7 @@ void _al_close_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) } } -void _al_append_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) +void _al_append_native_text_log(A5O_NATIVE_DIALOG *textlog) { if (textlog->tl_have_pending) return; @@ -711,7 +711,7 @@ void _al_append_native_text_log(ALLEGRO_NATIVE_DIALOG *textlog) } } -static bool menu_callback(ALLEGRO_DISPLAY *display, UINT msg, WPARAM wParam, LPARAM lParam, +static bool menu_callback(A5O_DISPLAY *display, UINT msg, WPARAM wParam, LPARAM lParam, LPARAM* result, void *userdata) { (void) userdata; @@ -723,9 +723,9 @@ static bool menu_callback(ALLEGRO_DISPLAY *display, UINT msg, WPARAM wParam, LPA if (menu_id) { int index; if (_al_find_menu_item_unique(menu_id->menu, id, NULL, &index)) { - if (al_get_menu_item_flags(menu_id->menu, -index) & ALLEGRO_MENU_ITEM_CHECKBOX) { + if (al_get_menu_item_flags(menu_id->menu, -index) & A5O_MENU_ITEM_CHECKBOX) { /* Toggle the checkbox, since Windows doesn't do that automatically. */ - al_toggle_menu_item_flags(menu_id->menu, -index, ALLEGRO_MENU_ITEM_CHECKED); + al_toggle_menu_item_flags(menu_id->menu, -index, A5O_MENU_ITEM_CHECKED); } } } @@ -742,7 +742,7 @@ static bool menu_callback(ALLEGRO_DISPLAY *display, UINT msg, WPARAM wParam, LPA } } else if (msg == WM_SHOW_POPUP) { - ALLEGRO_MENU *menu = (ALLEGRO_MENU *) lParam; + A5O_MENU *menu = (A5O_MENU *) lParam; HWND hwnd = al_get_win_window_handle(display); POINT pos; GetCursorPos(&pos); @@ -756,12 +756,12 @@ static bool menu_callback(ALLEGRO_DISPLAY *display, UINT msg, WPARAM wParam, LPA return true; } else if (msg == WM_SHOW_MENU) { - ALLEGRO_MENU *menu = (ALLEGRO_MENU *) lParam; + A5O_MENU *menu = (A5O_MENU *) lParam; SetMenu(al_get_win_window_handle(display), (HMENU) menu->extra1); return true; } else if (msg == WM_SIZE) { - ALLEGRO_DEBUG("Got the WM_SIZE event.\n"); + A5O_DEBUG("Got the WM_SIZE event.\n"); got_wm_size_event = true; al_signal_cond(wm_size_cond); } @@ -772,7 +772,7 @@ static bool menu_callback(ALLEGRO_DISPLAY *display, UINT msg, WPARAM wParam, LPA return false; } -static void init_menu_info(MENUITEMINFO *info, ALLEGRO_MENU_ITEM *menu) +static void init_menu_info(MENUITEMINFO *info, A5O_MENU_ITEM *menu) { memset(info, 0, sizeof(*info)); @@ -789,22 +789,22 @@ static void init_menu_info(MENUITEMINFO *info, ALLEGRO_MENU_ITEM *menu) info->cch = al_ustr_size(menu->caption); } - if (menu->flags & ALLEGRO_MENU_ITEM_CHECKED) { + if (menu->flags & A5O_MENU_ITEM_CHECKED) { info->fState |= MFS_CHECKED; } - if (menu->flags & ALLEGRO_MENU_ITEM_DISABLED) { + if (menu->flags & A5O_MENU_ITEM_DISABLED) { info->fState |= MFS_DISABLED; } if (menu->icon) { - /* convert ALLEGRO_BITMAP to HBITMAP (could be moved into a public function) */ + /* convert A5O_BITMAP to HBITMAP (could be moved into a public function) */ const int h = al_get_bitmap_height(menu->icon), w = al_get_bitmap_width(menu->icon); HDC hdc; HBITMAP hbmp; BITMAPINFO bi; uint8_t *data = NULL; - ALLEGRO_LOCKED_REGION *lock; + A5O_LOCKED_REGION *lock; ZeroMemory(&bi, sizeof(BITMAPINFO)); bi.bmiHeader.biSize = sizeof(BITMAPINFO); @@ -818,7 +818,7 @@ static void init_menu_info(MENUITEMINFO *info, ALLEGRO_MENU_ITEM *menu) hbmp = CreateDIBSection(hdc, (BITMAPINFO *)&bi, DIB_RGB_COLORS, (void **)&data, NULL, 0); - lock = al_lock_bitmap(menu->icon, ALLEGRO_PIXEL_FORMAT_ARGB_8888, ALLEGRO_LOCK_READONLY); + lock = al_lock_bitmap(menu->icon, A5O_PIXEL_FORMAT_ARGB_8888, A5O_LOCK_READONLY); memcpy(data, lock->data, w * h * 4); al_unlock_bitmap(menu->icon); @@ -838,19 +838,19 @@ static void destroy_menu_info(MENUITEMINFO *info) { al_free(info->dwTypeData); } } -bool _al_init_menu(ALLEGRO_MENU *menu) +bool _al_init_menu(A5O_MENU *menu) { menu->extra1 = CreateMenu(); return menu->extra1 != NULL; } -bool _al_init_popup_menu(ALLEGRO_MENU *menu) +bool _al_init_popup_menu(A5O_MENU *menu) { menu->extra1 = CreatePopupMenu(); return menu->extra1 != NULL; } -bool _al_insert_menu_item_at(ALLEGRO_MENU_ITEM *item, int i) +bool _al_insert_menu_item_at(A5O_MENU_ITEM *item, int i) { MENUITEMINFO info; init_menu_info(&info, item); @@ -860,7 +860,7 @@ bool _al_insert_menu_item_at(ALLEGRO_MENU_ITEM *item, int i) return true; } -bool _al_update_menu_item_at(ALLEGRO_MENU_ITEM *item, int i) +bool _al_update_menu_item_at(A5O_MENU_ITEM *item, int i) { MENUITEMINFO info; @@ -873,7 +873,7 @@ bool _al_update_menu_item_at(ALLEGRO_MENU_ITEM *item, int i) return true; } -bool _al_destroy_menu_item_at(ALLEGRO_MENU_ITEM *item, int i) +bool _al_destroy_menu_item_at(A5O_MENU_ITEM *item, int i) { DeleteMenu((HMENU) item->parent->extra1, i, MF_BYPOSITION); @@ -883,7 +883,7 @@ bool _al_destroy_menu_item_at(ALLEGRO_MENU_ITEM *item, int i) return true; } -bool _al_show_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) +bool _al_show_display_menu(A5O_DISPLAY *display, A5O_MENU *menu) { HWND hwnd = al_get_win_window_handle(display); if (!hwnd) return false; @@ -900,7 +900,7 @@ bool _al_show_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) /* Wait for the WM_SIZE event, otherwise the compensatory * al_resize_display (see menu.c) won't work right. */ if (wm_size_cond && global_mutex) { - ALLEGRO_DEBUG("Sent WM_SHOW_MENU, waiting for WM_SIZE.\n"); + A5O_DEBUG("Sent WM_SHOW_MENU, waiting for WM_SIZE.\n"); al_lock_mutex(global_mutex); while (!got_wm_size_event) { al_wait_cond(wm_size_cond, global_mutex); @@ -911,7 +911,7 @@ bool _al_show_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) return true; } -bool _al_hide_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) +bool _al_hide_display_menu(A5O_DISPLAY *display, A5O_MENU *menu) { HWND hwnd = al_get_win_window_handle(display); if (!hwnd) return false; @@ -923,7 +923,7 @@ bool _al_hide_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) /* Wait for the WM_SIZE event, otherwise the compensatory * al_resize_display (see menu.c) won't work right. */ if (wm_size_cond && global_mutex) { - ALLEGRO_DEBUG("Sent WM_HIDE_MENU, waiting for WM_SIZE.\n"); + A5O_DEBUG("Sent WM_HIDE_MENU, waiting for WM_SIZE.\n"); al_lock_mutex(global_mutex); while (!got_wm_size_event) { al_wait_cond(wm_size_cond, global_mutex); @@ -936,7 +936,7 @@ bool _al_hide_display_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) return true; } -bool _al_show_popup_menu(ALLEGRO_DISPLAY *display, ALLEGRO_MENU *menu) +bool _al_show_popup_menu(A5O_DISPLAY *display, A5O_MENU *menu) { /* The popup request must come from the main thread. */ diff --git a/addons/physfs/CMakeLists.txt b/addons/physfs/CMakeLists.txt index e194bd2c99..8eb095159a 100644 --- a/addons/physfs/CMakeLists.txt +++ b/addons/physfs/CMakeLists.txt @@ -10,10 +10,10 @@ set(PHYSFS_INCLUDE_DIRECTORIES ${PHYSFS_INCLUDE_DIR}) set_our_header_properties(${PHYSFS_INCLUDE_FILES}) add_our_addon_library(allegro_physfs - AllegroPhysfs-${ALLEGRO_SOVERSION} + AllegroPhysfs-${A5O_SOVERSION} "${PHYSFS_SOURCES};${PHYSFS_INCLUDE_FILES}" - "-DALLEGRO_PHYSFS_SRC" - "${ALLEGRO_LINK_WITH};${PHYSFS_LIBRARIES}" + "-DA5O_PHYSFS_SRC" + "${A5O_LINK_WITH};${PHYSFS_LIBRARIES}" ) install_our_headers(${PHYSFS_INCLUDE_FILES}) diff --git a/addons/physfs/a5_physfs.c b/addons/physfs/a5_physfs.c index 366266a6c7..8bca54def8 100644 --- a/addons/physfs/a5_physfs.c +++ b/addons/physfs/a5_physfs.c @@ -10,12 +10,12 @@ #include "allegro_physfs_intern.h" -ALLEGRO_DEBUG_CHANNEL("physfs") +A5O_DEBUG_CHANNEL("physfs") -typedef struct ALLEGRO_FILE_PHYSFS ALLEGRO_FILE_PHYSFS; +typedef struct A5O_FILE_PHYSFS A5O_FILE_PHYSFS; -struct ALLEGRO_FILE_PHYSFS +struct A5O_FILE_PHYSFS { PHYSFS_file *phys; bool error_indicator; @@ -23,9 +23,9 @@ struct ALLEGRO_FILE_PHYSFS }; /* forward declaration */ -static const ALLEGRO_FILE_INTERFACE file_phys_vtable; +static const A5O_FILE_INTERFACE file_phys_vtable; -const ALLEGRO_FILE_INTERFACE *_al_get_phys_vtable(void) +const A5O_FILE_INTERFACE *_al_get_phys_vtable(void) { return &file_phys_vtable; } @@ -34,13 +34,13 @@ const ALLEGRO_FILE_INTERFACE *_al_get_phys_vtable(void) #define streq(a, b) (0 == strcmp(a, b)) -static ALLEGRO_FILE_PHYSFS *cast_stream(ALLEGRO_FILE *f) +static A5O_FILE_PHYSFS *cast_stream(A5O_FILE *f) { - return (ALLEGRO_FILE_PHYSFS *)al_get_file_userdata(f); + return (A5O_FILE_PHYSFS *)al_get_file_userdata(f); } -static void phys_set_errno(ALLEGRO_FILE_PHYSFS *fp) +static void phys_set_errno(A5O_FILE_PHYSFS *fp) { /* It might be worth mapping some common error strings from * PHYSFS_getLastError() onto errno values. There are no guarantees, @@ -51,7 +51,7 @@ static void phys_set_errno(ALLEGRO_FILE_PHYSFS *fp) PHYSFS_ErrorCode error = PHYSFS_getLastErrorCode(); const char* msg = PHYSFS_getErrorByCode(error); if (error != PHYSFS_ERR_OK) { - ALLEGRO_ERROR("PhysFS error code: %s\n", msg); + A5O_ERROR("PhysFS error code: %s\n", msg); } if (fp) { fp->error_indicator = true; @@ -68,9 +68,9 @@ static void phys_set_errno(ALLEGRO_FILE_PHYSFS *fp) static void *file_phys_fopen(const char *filename, const char *mode) { - ALLEGRO_USTR *us; + A5O_USTR *us; PHYSFS_file *phys; - ALLEGRO_FILE_PHYSFS *fp; + A5O_FILE_PHYSFS *fp; us = _al_physfs_process_path(filename); @@ -109,9 +109,9 @@ static void *file_phys_fopen(const char *filename, const char *mode) } -static bool file_phys_fclose(ALLEGRO_FILE *f) +static bool file_phys_fclose(A5O_FILE *f) { - ALLEGRO_FILE_PHYSFS *fp = cast_stream(f); + A5O_FILE_PHYSFS *fp = cast_stream(f); PHYSFS_file *phys_fp = fp->phys; al_free(fp); @@ -125,9 +125,9 @@ static bool file_phys_fclose(ALLEGRO_FILE *f) } -static size_t file_phys_fread(ALLEGRO_FILE *f, void *buf, size_t buf_size) +static size_t file_phys_fread(A5O_FILE *f, void *buf, size_t buf_size) { - ALLEGRO_FILE_PHYSFS *fp = cast_stream(f); + A5O_FILE_PHYSFS *fp = cast_stream(f); PHYSFS_sint64 n; if (buf_size == 0) @@ -142,10 +142,10 @@ static size_t file_phys_fread(ALLEGRO_FILE *f, void *buf, size_t buf_size) } -static size_t file_phys_fwrite(ALLEGRO_FILE *f, const void *buf, +static size_t file_phys_fwrite(A5O_FILE *f, const void *buf, size_t buf_size) { - ALLEGRO_FILE_PHYSFS *fp = cast_stream(f); + A5O_FILE_PHYSFS *fp = cast_stream(f); PHYSFS_sint64 n; n = PHYSFS_writeBytes(fp->phys, buf, buf_size); @@ -158,9 +158,9 @@ static size_t file_phys_fwrite(ALLEGRO_FILE *f, const void *buf, } -static bool file_phys_fflush(ALLEGRO_FILE *f) +static bool file_phys_fflush(A5O_FILE *f) { - ALLEGRO_FILE_PHYSFS *fp = cast_stream(f); + A5O_FILE_PHYSFS *fp = cast_stream(f); if (!PHYSFS_flush(fp->phys)) { phys_set_errno(fp); @@ -171,9 +171,9 @@ static bool file_phys_fflush(ALLEGRO_FILE *f) } -static int64_t file_phys_ftell(ALLEGRO_FILE *f) +static int64_t file_phys_ftell(A5O_FILE *f) { - ALLEGRO_FILE_PHYSFS *fp = cast_stream(f); + A5O_FILE_PHYSFS *fp = cast_stream(f); PHYSFS_sint64 n; n = PHYSFS_tell(fp->phys); @@ -186,17 +186,17 @@ static int64_t file_phys_ftell(ALLEGRO_FILE *f) } -static bool file_phys_seek(ALLEGRO_FILE *f, int64_t offset, int whence) +static bool file_phys_seek(A5O_FILE *f, int64_t offset, int whence) { - ALLEGRO_FILE_PHYSFS *fp = cast_stream(f); + A5O_FILE_PHYSFS *fp = cast_stream(f); PHYSFS_sint64 base; switch (whence) { - case ALLEGRO_SEEK_SET: + case A5O_SEEK_SET: base = 0; break; - case ALLEGRO_SEEK_CUR: + case A5O_SEEK_CUR: base = PHYSFS_tell(fp->phys); if (base < 0) { phys_set_errno(fp); @@ -204,7 +204,7 @@ static bool file_phys_seek(ALLEGRO_FILE *f, int64_t offset, int whence) } break; - case ALLEGRO_SEEK_END: + case A5O_SEEK_END: base = PHYSFS_fileLength(fp->phys); if (base < 0) { phys_set_errno(fp); @@ -226,25 +226,25 @@ static bool file_phys_seek(ALLEGRO_FILE *f, int64_t offset, int whence) } -static bool file_phys_feof(ALLEGRO_FILE *f) +static bool file_phys_feof(A5O_FILE *f) { - ALLEGRO_FILE_PHYSFS *fp = cast_stream(f); + A5O_FILE_PHYSFS *fp = cast_stream(f); return PHYSFS_eof(fp->phys); } -static int file_phys_ferror(ALLEGRO_FILE *f) +static int file_phys_ferror(A5O_FILE *f) { - ALLEGRO_FILE_PHYSFS *fp = cast_stream(f); + A5O_FILE_PHYSFS *fp = cast_stream(f); return (fp->error_indicator) ? 1 : 0; } -static const char *file_phys_ferrmsg(ALLEGRO_FILE *f) +static const char *file_phys_ferrmsg(A5O_FILE *f) { - ALLEGRO_FILE_PHYSFS *fp = cast_stream(f); + A5O_FILE_PHYSFS *fp = cast_stream(f); if (fp->error_indicator) return fp->error_msg; @@ -253,9 +253,9 @@ static const char *file_phys_ferrmsg(ALLEGRO_FILE *f) } -static void file_phys_fclearerr(ALLEGRO_FILE *f) +static void file_phys_fclearerr(A5O_FILE *f) { - ALLEGRO_FILE_PHYSFS *fp = cast_stream(f); + A5O_FILE_PHYSFS *fp = cast_stream(f); fp->error_indicator = false; @@ -263,9 +263,9 @@ static void file_phys_fclearerr(ALLEGRO_FILE *f) } -static off_t file_phys_fsize(ALLEGRO_FILE *f) +static off_t file_phys_fsize(A5O_FILE *f) { - ALLEGRO_FILE_PHYSFS *fp = cast_stream(f); + A5O_FILE_PHYSFS *fp = cast_stream(f); PHYSFS_sint64 n; n = PHYSFS_fileLength(fp->phys); @@ -278,7 +278,7 @@ static off_t file_phys_fsize(ALLEGRO_FILE *f) } -static const ALLEGRO_FILE_INTERFACE file_phys_vtable = +static const A5O_FILE_INTERFACE file_phys_vtable = { file_phys_fopen, file_phys_fclose, @@ -309,7 +309,7 @@ void al_set_physfs_file_interface(void) */ uint32_t al_get_allegro_physfs_version(void) { - return ALLEGRO_VERSION_INT; + return A5O_VERSION_INT; } diff --git a/addons/physfs/a5_physfs_dir.c b/addons/physfs/a5_physfs_dir.c index bc0ea044e0..4543fb360e 100644 --- a/addons/physfs/a5_physfs_dir.c +++ b/addons/physfs/a5_physfs_dir.c @@ -19,12 +19,12 @@ #endif -typedef struct ALLEGRO_FS_ENTRY_PHYSFS ALLEGRO_FS_ENTRY_PHYSFS; +typedef struct A5O_FS_ENTRY_PHYSFS A5O_FS_ENTRY_PHYSFS; -struct ALLEGRO_FS_ENTRY_PHYSFS +struct A5O_FS_ENTRY_PHYSFS { - ALLEGRO_FS_ENTRY fs_entry; /* must be first */ - ALLEGRO_PATH *path; + A5O_FS_ENTRY fs_entry; /* must be first */ + A5O_PATH *path; const char *path_cstr; /* For directory listing. */ @@ -34,10 +34,10 @@ struct ALLEGRO_FS_ENTRY_PHYSFS }; /* forward declaration */ -static const ALLEGRO_FS_INTERFACE fs_phys_vtable; +static const A5O_FS_INTERFACE fs_phys_vtable; /* current working directory */ -/* We cannot use ALLEGRO_USTR because we have nowhere to free it. */ +/* We cannot use A5O_USTR because we have nowhere to free it. */ static char fs_phys_cwd[1024] = "/"; static bool path_is_absolute(const char *path) @@ -45,7 +45,7 @@ static bool path_is_absolute(const char *path) return (path && path[0] == '/'); } -static void ensure_trailing_slash(ALLEGRO_USTR *us) +static void ensure_trailing_slash(A5O_USTR *us) { int pos = al_ustr_size(us); if (al_ustr_prev_get(us, &pos) != '/') { @@ -53,11 +53,11 @@ static void ensure_trailing_slash(ALLEGRO_USTR *us) } } -ALLEGRO_USTR *_al_physfs_process_path(const char *path) +A5O_USTR *_al_physfs_process_path(const char *path) { - ALLEGRO_USTR *us; - ALLEGRO_PATH *p = al_create_path(path); - ALLEGRO_PATH *cwd = al_create_path(fs_phys_cwd); + A5O_USTR *us; + A5O_PATH *p = al_create_path(path); + A5O_PATH *cwd = al_create_path(fs_phys_cwd); al_rebase_path(cwd, p); al_destroy_path(cwd); /* PHYSFS always uses / separator. */ @@ -66,10 +66,10 @@ ALLEGRO_USTR *_al_physfs_process_path(const char *path) return us; } -static ALLEGRO_FS_ENTRY *fs_phys_create_entry(const char *path) +static A5O_FS_ENTRY *fs_phys_create_entry(const char *path) { - ALLEGRO_FS_ENTRY_PHYSFS *e; - ALLEGRO_USTR *us; + A5O_FS_ENTRY_PHYSFS *e; + A5O_USTR *us; e = al_calloc(1, sizeof *e); if (!e) @@ -99,7 +99,7 @@ static char *fs_phys_get_current_directory(void) static bool fs_phys_change_directory(const char *path) { - ALLEGRO_USTR *us; + A5O_USTR *us; bool ret; PHYSFS_Stat stat; @@ -138,7 +138,7 @@ static bool fs_phys_change_directory(const char *path) static bool fs_phys_filename_exists(const char *path) { - ALLEGRO_USTR *us; + A5O_USTR *us; bool ret; us = _al_physfs_process_path(path); @@ -149,7 +149,7 @@ static bool fs_phys_filename_exists(const char *path) static bool fs_phys_remove_filename(const char *path) { - ALLEGRO_USTR *us; + A5O_USTR *us; bool ret; us = _al_physfs_process_path(path); @@ -160,7 +160,7 @@ static bool fs_phys_remove_filename(const char *path) static bool fs_phys_make_directory(const char *path) { - ALLEGRO_USTR *us; + A5O_USTR *us; bool ret; us = _al_physfs_process_path(path); @@ -169,21 +169,21 @@ static bool fs_phys_make_directory(const char *path) return ret; } -static const char *fs_phys_entry_name(ALLEGRO_FS_ENTRY *fse) +static const char *fs_phys_entry_name(A5O_FS_ENTRY *fse) { - ALLEGRO_FS_ENTRY_PHYSFS *e = (ALLEGRO_FS_ENTRY_PHYSFS *)fse; + A5O_FS_ENTRY_PHYSFS *e = (A5O_FS_ENTRY_PHYSFS *)fse; return al_path_cstr(e->path, '/'); } -static bool fs_phys_update_entry(ALLEGRO_FS_ENTRY *fse) +static bool fs_phys_update_entry(A5O_FS_ENTRY *fse) { (void)fse; return true; } -static off_t fs_phys_entry_size(ALLEGRO_FS_ENTRY *fse) +static off_t fs_phys_entry_size(A5O_FS_ENTRY *fse) { - ALLEGRO_FS_ENTRY_PHYSFS *e = (ALLEGRO_FS_ENTRY_PHYSFS *)fse; + A5O_FS_ENTRY_PHYSFS *e = (A5O_FS_ENTRY_PHYSFS *)fse; PHYSFS_file *f = PHYSFS_openRead(e->path_cstr); if (f) { off_t s = PHYSFS_fileLength(f); @@ -193,45 +193,45 @@ static off_t fs_phys_entry_size(ALLEGRO_FS_ENTRY *fse) return 0; } -static uint32_t fs_phys_entry_mode(ALLEGRO_FS_ENTRY *fse) +static uint32_t fs_phys_entry_mode(A5O_FS_ENTRY *fse) { - ALLEGRO_FS_ENTRY_PHYSFS *e = (ALLEGRO_FS_ENTRY_PHYSFS *)fse; - uint32_t mode = ALLEGRO_FILEMODE_READ; + A5O_FS_ENTRY_PHYSFS *e = (A5O_FS_ENTRY_PHYSFS *)fse; + uint32_t mode = A5O_FILEMODE_READ; PHYSFS_Stat stat; if (!PHYSFS_stat(e->path_cstr, &stat)) return mode; if (stat.filetype == PHYSFS_FILETYPE_DIRECTORY ) - mode |= ALLEGRO_FILEMODE_ISDIR | ALLEGRO_FILEMODE_EXECUTE; + mode |= A5O_FILEMODE_ISDIR | A5O_FILEMODE_EXECUTE; else - mode |= ALLEGRO_FILEMODE_ISFILE; + mode |= A5O_FILEMODE_ISFILE; return mode; } -static time_t fs_phys_entry_mtime(ALLEGRO_FS_ENTRY *fse) +static time_t fs_phys_entry_mtime(A5O_FS_ENTRY *fse) { - ALLEGRO_FS_ENTRY_PHYSFS *e = (ALLEGRO_FS_ENTRY_PHYSFS *)fse; + A5O_FS_ENTRY_PHYSFS *e = (A5O_FS_ENTRY_PHYSFS *)fse; PHYSFS_Stat stat; if (!PHYSFS_stat(e->path_cstr, &stat)) return -1; return stat.modtime; } -static bool fs_phys_entry_exists(ALLEGRO_FS_ENTRY *fse) +static bool fs_phys_entry_exists(A5O_FS_ENTRY *fse) { - ALLEGRO_FS_ENTRY_PHYSFS *e = (ALLEGRO_FS_ENTRY_PHYSFS *)fse; + A5O_FS_ENTRY_PHYSFS *e = (A5O_FS_ENTRY_PHYSFS *)fse; return PHYSFS_exists(e->path_cstr) != 0; } -static bool fs_phys_remove_entry(ALLEGRO_FS_ENTRY *fse) +static bool fs_phys_remove_entry(A5O_FS_ENTRY *fse) { - ALLEGRO_FS_ENTRY_PHYSFS *e = (ALLEGRO_FS_ENTRY_PHYSFS *)fse; + A5O_FS_ENTRY_PHYSFS *e = (A5O_FS_ENTRY_PHYSFS *)fse; return PHYSFS_delete(e->path_cstr) != 0; } -static bool fs_phys_open_directory(ALLEGRO_FS_ENTRY *fse) +static bool fs_phys_open_directory(A5O_FS_ENTRY *fse) { - ALLEGRO_FS_ENTRY_PHYSFS *e = (ALLEGRO_FS_ENTRY_PHYSFS *)fse; + A5O_FS_ENTRY_PHYSFS *e = (A5O_FS_ENTRY_PHYSFS *)fse; e->file_list = PHYSFS_enumerateFiles(e->path_cstr); e->file_list_pos = e->file_list; @@ -240,11 +240,11 @@ static bool fs_phys_open_directory(ALLEGRO_FS_ENTRY *fse) return true; } -static ALLEGRO_FS_ENTRY *fs_phys_read_directory(ALLEGRO_FS_ENTRY *fse) +static A5O_FS_ENTRY *fs_phys_read_directory(A5O_FS_ENTRY *fse) { - ALLEGRO_FS_ENTRY_PHYSFS *e = (ALLEGRO_FS_ENTRY_PHYSFS *)fse; - ALLEGRO_FS_ENTRY *next; - ALLEGRO_USTR *tmp; + A5O_FS_ENTRY_PHYSFS *e = (A5O_FS_ENTRY_PHYSFS *)fse; + A5O_FS_ENTRY *next; + A5O_USTR *tmp; if (!e->file_list_pos) return NULL; @@ -262,31 +262,31 @@ static ALLEGRO_FS_ENTRY *fs_phys_read_directory(ALLEGRO_FS_ENTRY *fse) return next; } -static bool fs_phys_close_directory(ALLEGRO_FS_ENTRY *fse) +static bool fs_phys_close_directory(A5O_FS_ENTRY *fse) { - ALLEGRO_FS_ENTRY_PHYSFS *e = (ALLEGRO_FS_ENTRY_PHYSFS *)fse; + A5O_FS_ENTRY_PHYSFS *e = (A5O_FS_ENTRY_PHYSFS *)fse; PHYSFS_freeList(e->file_list); e->file_list = NULL; e->is_dir_open = false; return true; } -static void fs_phys_destroy_entry(ALLEGRO_FS_ENTRY *fse) +static void fs_phys_destroy_entry(A5O_FS_ENTRY *fse) { - ALLEGRO_FS_ENTRY_PHYSFS *e = (ALLEGRO_FS_ENTRY_PHYSFS *)fse; + A5O_FS_ENTRY_PHYSFS *e = (A5O_FS_ENTRY_PHYSFS *)fse; if (e->is_dir_open) fs_phys_close_directory(fse); al_destroy_path(e->path); al_free(e); } -static ALLEGRO_FILE *fs_phys_open_file(ALLEGRO_FS_ENTRY *fse, const char *mode) +static A5O_FILE *fs_phys_open_file(A5O_FS_ENTRY *fse, const char *mode) { return al_fopen_interface(_al_get_phys_vtable(), fs_phys_entry_name(fse), mode); } -static const ALLEGRO_FS_INTERFACE fs_phys_vtable = +static const A5O_FS_INTERFACE fs_phys_vtable = { fs_phys_create_entry, fs_phys_destroy_entry, diff --git a/addons/physfs/allegro5/allegro_physfs.h b/addons/physfs/allegro5/allegro_physfs.h index 494da6a4aa..ee5bc112c4 100644 --- a/addons/physfs/allegro5/allegro_physfs.h +++ b/addons/physfs/allegro5/allegro_physfs.h @@ -7,31 +7,31 @@ extern "C" { #endif -#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32) - #ifndef ALLEGRO_STATICLINK - #ifdef ALLEGRO_PHYSFS_SRC - #define _ALLEGRO_PHYSFS_DLL __declspec(dllexport) +#if (defined A5O_MINGW32) || (defined A5O_MSVC) || (defined A5O_BCC32) + #ifndef A5O_STATICLINK + #ifdef A5O_PHYSFS_SRC + #define _A5O_PHYSFS_DLL __declspec(dllexport) #else - #define _ALLEGRO_PHYSFS_DLL __declspec(dllimport) + #define _A5O_PHYSFS_DLL __declspec(dllimport) #endif #else - #define _ALLEGRO_PHYSFS_DLL + #define _A5O_PHYSFS_DLL #endif #endif -#if defined ALLEGRO_MSVC - #define ALLEGRO_PHYSFS_FUNC(type, name, args) _ALLEGRO_PHYSFS_DLL type __cdecl name args -#elif defined ALLEGRO_MINGW32 - #define ALLEGRO_PHYSFS_FUNC(type, name, args) extern type name args -#elif defined ALLEGRO_BCC32 - #define ALLEGRO_PHYSFS_FUNC(type, name, args) extern _ALLEGRO_PHYSFS_DLL type name args +#if defined A5O_MSVC + #define A5O_PHYSFS_FUNC(type, name, args) _A5O_PHYSFS_DLL type __cdecl name args +#elif defined A5O_MINGW32 + #define A5O_PHYSFS_FUNC(type, name, args) extern type name args +#elif defined A5O_BCC32 + #define A5O_PHYSFS_FUNC(type, name, args) extern _A5O_PHYSFS_DLL type name args #else - #define ALLEGRO_PHYSFS_FUNC AL_FUNC + #define A5O_PHYSFS_FUNC AL_FUNC #endif -ALLEGRO_PHYSFS_FUNC(void, al_set_physfs_file_interface, (void)); -ALLEGRO_PHYSFS_FUNC(uint32_t, al_get_allegro_physfs_version, (void)); +A5O_PHYSFS_FUNC(void, al_set_physfs_file_interface, (void)); +A5O_PHYSFS_FUNC(uint32_t, al_get_allegro_physfs_version, (void)); #ifdef __cplusplus diff --git a/addons/physfs/allegro_physfs_intern.h b/addons/physfs/allegro_physfs_intern.h index 33d67eec4c..8eb930e64b 100644 --- a/addons/physfs/allegro_physfs_intern.h +++ b/addons/physfs/allegro_physfs_intern.h @@ -2,7 +2,7 @@ #define __al_included_allegro5_allegro_physfs_intern_h void _al_set_physfs_fs_interface(void); -const ALLEGRO_FILE_INTERFACE *_al_get_phys_vtable(void); -ALLEGRO_USTR *_al_physfs_process_path(const char *path); +const A5O_FILE_INTERFACE *_al_get_phys_vtable(void); +A5O_USTR *_al_physfs_process_path(const char *path); #endif diff --git a/addons/primitives/CMakeLists.txt b/addons/primitives/CMakeLists.txt index b65a2c5ed0..2af5ca689a 100644 --- a/addons/primitives/CMakeLists.txt +++ b/addons/primitives/CMakeLists.txt @@ -23,10 +23,10 @@ set(PRIMITIVES_INCLUDE_FILES allegro5/allegro_primitives.h) set_our_header_properties(${PRIMITIVES_INCLUDE_FILES}) add_our_addon_library(allegro_primitives - AllegroPrimitives-${ALLEGRO_SOVERSION} + AllegroPrimitives-${A5O_SOVERSION} "${PRIMITIVES_SOURCES};${PRIMITIVES_INCLUDE_FILES}" - "-DALLEGRO_PRIMITIVES_SRC" - "${ALLEGRO_LINK_WITH}" + "-DA5O_PRIMITIVES_SRC" + "${A5O_LINK_WITH}" ) install_our_headers(${PRIMITIVES_INCLUDE_FILES}) diff --git a/addons/primitives/allegro5/allegro_primitives.h b/addons/primitives/allegro5/allegro_primitives.h index 6fae3b02fb..65624cd980 100644 --- a/addons/primitives/allegro5/allegro_primitives.h +++ b/addons/primitives/allegro5/allegro_primitives.h @@ -3,26 +3,26 @@ #include -#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32) -#ifndef ALLEGRO_STATICLINK -#ifdef ALLEGRO_PRIMITIVES_SRC -#define _ALLEGRO_PRIM_DLL __declspec(dllexport) +#if (defined A5O_MINGW32) || (defined A5O_MSVC) || (defined A5O_BCC32) +#ifndef A5O_STATICLINK +#ifdef A5O_PRIMITIVES_SRC +#define _A5O_PRIM_DLL __declspec(dllexport) #else -#define _ALLEGRO_PRIM_DLL __declspec(dllimport) +#define _A5O_PRIM_DLL __declspec(dllimport) #endif #else -#define _ALLEGRO_PRIM_DLL +#define _A5O_PRIM_DLL #endif #endif -#if defined ALLEGRO_MSVC -#define ALLEGRO_PRIM_FUNC(type, name, args) _ALLEGRO_PRIM_DLL type __cdecl name args -#elif defined ALLEGRO_MINGW32 -#define ALLEGRO_PRIM_FUNC(type, name, args) extern type name args -#elif defined ALLEGRO_BCC32 -#define ALLEGRO_PRIM_FUNC(type, name, args) extern _ALLEGRO_PRIM_DLL type name args +#if defined A5O_MSVC +#define A5O_PRIM_FUNC(type, name, args) _A5O_PRIM_DLL type __cdecl name args +#elif defined A5O_MINGW32 +#define A5O_PRIM_FUNC(type, name, args) extern type name args +#elif defined A5O_BCC32 +#define A5O_PRIM_FUNC(type, name, args) extern _A5O_PRIM_DLL type name args #else -#define ALLEGRO_PRIM_FUNC AL_FUNC +#define A5O_PRIM_FUNC AL_FUNC #endif #ifdef __cplusplus @@ -31,220 +31,220 @@ extern "C" #endif -/* Enum: ALLEGRO_PRIM_TYPE +/* Enum: A5O_PRIM_TYPE */ -typedef enum ALLEGRO_PRIM_TYPE +typedef enum A5O_PRIM_TYPE { - ALLEGRO_PRIM_LINE_LIST, - ALLEGRO_PRIM_LINE_STRIP, - ALLEGRO_PRIM_LINE_LOOP, - ALLEGRO_PRIM_TRIANGLE_LIST, - ALLEGRO_PRIM_TRIANGLE_STRIP, - ALLEGRO_PRIM_TRIANGLE_FAN, - ALLEGRO_PRIM_POINT_LIST, - ALLEGRO_PRIM_NUM_TYPES -} ALLEGRO_PRIM_TYPE; + A5O_PRIM_LINE_LIST, + A5O_PRIM_LINE_STRIP, + A5O_PRIM_LINE_LOOP, + A5O_PRIM_TRIANGLE_LIST, + A5O_PRIM_TRIANGLE_STRIP, + A5O_PRIM_TRIANGLE_FAN, + A5O_PRIM_POINT_LIST, + A5O_PRIM_NUM_TYPES +} A5O_PRIM_TYPE; enum { - ALLEGRO_PRIM_MAX_USER_ATTR = _ALLEGRO_PRIM_MAX_USER_ATTR + A5O_PRIM_MAX_USER_ATTR = _A5O_PRIM_MAX_USER_ATTR }; -/* Enum: ALLEGRO_PRIM_ATTR +/* Enum: A5O_PRIM_ATTR */ -typedef enum ALLEGRO_PRIM_ATTR +typedef enum A5O_PRIM_ATTR { - ALLEGRO_PRIM_POSITION = 1, - ALLEGRO_PRIM_COLOR_ATTR, - ALLEGRO_PRIM_TEX_COORD, - ALLEGRO_PRIM_TEX_COORD_PIXEL, - ALLEGRO_PRIM_USER_ATTR, - ALLEGRO_PRIM_ATTR_NUM = ALLEGRO_PRIM_USER_ATTR + ALLEGRO_PRIM_MAX_USER_ATTR -} ALLEGRO_PRIM_ATTR; - -/* Enum: ALLEGRO_PRIM_STORAGE + A5O_PRIM_POSITION = 1, + A5O_PRIM_COLOR_ATTR, + A5O_PRIM_TEX_COORD, + A5O_PRIM_TEX_COORD_PIXEL, + A5O_PRIM_USER_ATTR, + A5O_PRIM_ATTR_NUM = A5O_PRIM_USER_ATTR + A5O_PRIM_MAX_USER_ATTR +} A5O_PRIM_ATTR; + +/* Enum: A5O_PRIM_STORAGE */ -typedef enum ALLEGRO_PRIM_STORAGE +typedef enum A5O_PRIM_STORAGE { - ALLEGRO_PRIM_FLOAT_2, - ALLEGRO_PRIM_FLOAT_3, - ALLEGRO_PRIM_SHORT_2, - ALLEGRO_PRIM_FLOAT_1, - ALLEGRO_PRIM_FLOAT_4, - ALLEGRO_PRIM_UBYTE_4, - ALLEGRO_PRIM_SHORT_4, - ALLEGRO_PRIM_NORMALIZED_UBYTE_4, - ALLEGRO_PRIM_NORMALIZED_SHORT_2, - ALLEGRO_PRIM_NORMALIZED_SHORT_4, - ALLEGRO_PRIM_NORMALIZED_USHORT_2, - ALLEGRO_PRIM_NORMALIZED_USHORT_4, - ALLEGRO_PRIM_HALF_FLOAT_2, - ALLEGRO_PRIM_HALF_FLOAT_4 -} ALLEGRO_PRIM_STORAGE; - -/* Enum: ALLEGRO_LINE_JOIN + A5O_PRIM_FLOAT_2, + A5O_PRIM_FLOAT_3, + A5O_PRIM_SHORT_2, + A5O_PRIM_FLOAT_1, + A5O_PRIM_FLOAT_4, + A5O_PRIM_UBYTE_4, + A5O_PRIM_SHORT_4, + A5O_PRIM_NORMALIZED_UBYTE_4, + A5O_PRIM_NORMALIZED_SHORT_2, + A5O_PRIM_NORMALIZED_SHORT_4, + A5O_PRIM_NORMALIZED_USHORT_2, + A5O_PRIM_NORMALIZED_USHORT_4, + A5O_PRIM_HALF_FLOAT_2, + A5O_PRIM_HALF_FLOAT_4 +} A5O_PRIM_STORAGE; + +/* Enum: A5O_LINE_JOIN */ -typedef enum ALLEGRO_LINE_JOIN +typedef enum A5O_LINE_JOIN { - ALLEGRO_LINE_JOIN_NONE, - ALLEGRO_LINE_JOIN_BEVEL, - ALLEGRO_LINE_JOIN_ROUND, - ALLEGRO_LINE_JOIN_MITER, - ALLEGRO_LINE_JOIN_MITRE = ALLEGRO_LINE_JOIN_MITER -} ALLEGRO_LINE_JOIN; - -/* Enum: ALLEGRO_LINE_CAP + A5O_LINE_JOIN_NONE, + A5O_LINE_JOIN_BEVEL, + A5O_LINE_JOIN_ROUND, + A5O_LINE_JOIN_MITER, + A5O_LINE_JOIN_MITRE = A5O_LINE_JOIN_MITER +} A5O_LINE_JOIN; + +/* Enum: A5O_LINE_CAP */ -typedef enum ALLEGRO_LINE_CAP +typedef enum A5O_LINE_CAP { - ALLEGRO_LINE_CAP_NONE, - ALLEGRO_LINE_CAP_SQUARE, - ALLEGRO_LINE_CAP_ROUND, - ALLEGRO_LINE_CAP_TRIANGLE, - ALLEGRO_LINE_CAP_CLOSED -} ALLEGRO_LINE_CAP; - -/* Enum: ALLEGRO_PRIM_BUFFER_FLAGS + A5O_LINE_CAP_NONE, + A5O_LINE_CAP_SQUARE, + A5O_LINE_CAP_ROUND, + A5O_LINE_CAP_TRIANGLE, + A5O_LINE_CAP_CLOSED +} A5O_LINE_CAP; + +/* Enum: A5O_PRIM_BUFFER_FLAGS */ -typedef enum ALLEGRO_PRIM_BUFFER_FLAGS +typedef enum A5O_PRIM_BUFFER_FLAGS { - ALLEGRO_PRIM_BUFFER_STREAM = 0x01, - ALLEGRO_PRIM_BUFFER_STATIC = 0x02, - ALLEGRO_PRIM_BUFFER_DYNAMIC = 0x04, - ALLEGRO_PRIM_BUFFER_READWRITE = 0x08 -} ALLEGRO_PRIM_BUFFER_FLAGS; + A5O_PRIM_BUFFER_STREAM = 0x01, + A5O_PRIM_BUFFER_STATIC = 0x02, + A5O_PRIM_BUFFER_DYNAMIC = 0x04, + A5O_PRIM_BUFFER_READWRITE = 0x08 +} A5O_PRIM_BUFFER_FLAGS; -/* Enum: ALLEGRO_VERTEX_CACHE_SIZE +/* Enum: A5O_VERTEX_CACHE_SIZE */ -#define ALLEGRO_VERTEX_CACHE_SIZE 256 +#define A5O_VERTEX_CACHE_SIZE 256 -/* Enum: ALLEGRO_PRIM_QUALITY +/* Enum: A5O_PRIM_QUALITY */ -#define ALLEGRO_PRIM_QUALITY 10 +#define A5O_PRIM_QUALITY 10 -/* Type: ALLEGRO_VERTEX_ELEMENT +/* Type: A5O_VERTEX_ELEMENT */ -typedef struct ALLEGRO_VERTEX_ELEMENT ALLEGRO_VERTEX_ELEMENT; +typedef struct A5O_VERTEX_ELEMENT A5O_VERTEX_ELEMENT; -struct ALLEGRO_VERTEX_ELEMENT { +struct A5O_VERTEX_ELEMENT { int attribute; int storage; int offset; }; -/* Type: ALLEGRO_VERTEX_DECL +/* Type: A5O_VERTEX_DECL */ -typedef struct ALLEGRO_VERTEX_DECL ALLEGRO_VERTEX_DECL; +typedef struct A5O_VERTEX_DECL A5O_VERTEX_DECL; /* Duplicated in allegro5/internal/aintern_tri_soft.h */ -#ifndef _ALLEGRO_VERTEX_DEFINED -#define _ALLEGRO_VERTEX_DEFINED +#ifndef _A5O_VERTEX_DEFINED +#define _A5O_VERTEX_DEFINED -/* Type: ALLEGRO_VERTEX +/* Type: A5O_VERTEX */ -typedef struct ALLEGRO_VERTEX ALLEGRO_VERTEX; +typedef struct A5O_VERTEX A5O_VERTEX; -struct ALLEGRO_VERTEX { +struct A5O_VERTEX { float x, y, z; float u, v; - ALLEGRO_COLOR color; + A5O_COLOR color; }; #endif -/* Type: ALLEGRO_VERTEX_BUFFER +/* Type: A5O_VERTEX_BUFFER */ -typedef struct ALLEGRO_VERTEX_BUFFER ALLEGRO_VERTEX_BUFFER; +typedef struct A5O_VERTEX_BUFFER A5O_VERTEX_BUFFER; -/* Type: ALLEGRO_INDEX_BUFFER +/* Type: A5O_INDEX_BUFFER */ -typedef struct ALLEGRO_INDEX_BUFFER ALLEGRO_INDEX_BUFFER; +typedef struct A5O_INDEX_BUFFER A5O_INDEX_BUFFER; -ALLEGRO_PRIM_FUNC(uint32_t, al_get_allegro_primitives_version, (void)); +A5O_PRIM_FUNC(uint32_t, al_get_allegro_primitives_version, (void)); /* * Primary Functions */ -ALLEGRO_PRIM_FUNC(bool, al_init_primitives_addon, (void)); -ALLEGRO_PRIM_FUNC(bool, al_is_primitives_addon_initialized, (void)); -ALLEGRO_PRIM_FUNC(void, al_shutdown_primitives_addon, (void)); -ALLEGRO_PRIM_FUNC(int, al_draw_prim, (const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, ALLEGRO_BITMAP* texture, int start, int end, int type)); -ALLEGRO_PRIM_FUNC(int, al_draw_indexed_prim, (const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, ALLEGRO_BITMAP* texture, const int* indices, int num_vtx, int type)); -ALLEGRO_PRIM_FUNC(int, al_draw_vertex_buffer, (ALLEGRO_VERTEX_BUFFER* vertex_buffer, ALLEGRO_BITMAP* texture, int start, int end, int type)); -ALLEGRO_PRIM_FUNC(int, al_draw_indexed_buffer, (ALLEGRO_VERTEX_BUFFER* vertex_buffer, ALLEGRO_BITMAP* texture, ALLEGRO_INDEX_BUFFER* index_buffer, int start, int end, int type)); +A5O_PRIM_FUNC(bool, al_init_primitives_addon, (void)); +A5O_PRIM_FUNC(bool, al_is_primitives_addon_initialized, (void)); +A5O_PRIM_FUNC(void, al_shutdown_primitives_addon, (void)); +A5O_PRIM_FUNC(int, al_draw_prim, (const void* vtxs, const A5O_VERTEX_DECL* decl, A5O_BITMAP* texture, int start, int end, int type)); +A5O_PRIM_FUNC(int, al_draw_indexed_prim, (const void* vtxs, const A5O_VERTEX_DECL* decl, A5O_BITMAP* texture, const int* indices, int num_vtx, int type)); +A5O_PRIM_FUNC(int, al_draw_vertex_buffer, (A5O_VERTEX_BUFFER* vertex_buffer, A5O_BITMAP* texture, int start, int end, int type)); +A5O_PRIM_FUNC(int, al_draw_indexed_buffer, (A5O_VERTEX_BUFFER* vertex_buffer, A5O_BITMAP* texture, A5O_INDEX_BUFFER* index_buffer, int start, int end, int type)); -ALLEGRO_PRIM_FUNC(ALLEGRO_VERTEX_DECL*, al_create_vertex_decl, (const ALLEGRO_VERTEX_ELEMENT* elements, int stride)); -ALLEGRO_PRIM_FUNC(void, al_destroy_vertex_decl, (ALLEGRO_VERTEX_DECL* decl)); +A5O_PRIM_FUNC(A5O_VERTEX_DECL*, al_create_vertex_decl, (const A5O_VERTEX_ELEMENT* elements, int stride)); +A5O_PRIM_FUNC(void, al_destroy_vertex_decl, (A5O_VERTEX_DECL* decl)); /* * Vertex buffers */ -ALLEGRO_PRIM_FUNC(ALLEGRO_VERTEX_BUFFER*, al_create_vertex_buffer, (ALLEGRO_VERTEX_DECL* decl, const void* initial_data, int num_vertices, int flags)); -ALLEGRO_PRIM_FUNC(void, al_destroy_vertex_buffer, (ALLEGRO_VERTEX_BUFFER* buffer)); -ALLEGRO_PRIM_FUNC(void*, al_lock_vertex_buffer, (ALLEGRO_VERTEX_BUFFER* buffer, int offset, int length, int flags)); -ALLEGRO_PRIM_FUNC(void, al_unlock_vertex_buffer, (ALLEGRO_VERTEX_BUFFER* buffer)); -ALLEGRO_PRIM_FUNC(int, al_get_vertex_buffer_size, (ALLEGRO_VERTEX_BUFFER* buffer)); +A5O_PRIM_FUNC(A5O_VERTEX_BUFFER*, al_create_vertex_buffer, (A5O_VERTEX_DECL* decl, const void* initial_data, int num_vertices, int flags)); +A5O_PRIM_FUNC(void, al_destroy_vertex_buffer, (A5O_VERTEX_BUFFER* buffer)); +A5O_PRIM_FUNC(void*, al_lock_vertex_buffer, (A5O_VERTEX_BUFFER* buffer, int offset, int length, int flags)); +A5O_PRIM_FUNC(void, al_unlock_vertex_buffer, (A5O_VERTEX_BUFFER* buffer)); +A5O_PRIM_FUNC(int, al_get_vertex_buffer_size, (A5O_VERTEX_BUFFER* buffer)); /* * Index buffers */ -ALLEGRO_PRIM_FUNC(ALLEGRO_INDEX_BUFFER*, al_create_index_buffer, (int index_size, const void* initial_data, int num_indices, int flags)); -ALLEGRO_PRIM_FUNC(void, al_destroy_index_buffer, (ALLEGRO_INDEX_BUFFER* buffer)); -ALLEGRO_PRIM_FUNC(void*, al_lock_index_buffer, (ALLEGRO_INDEX_BUFFER* buffer, int offset, int length, int flags)); -ALLEGRO_PRIM_FUNC(void, al_unlock_index_buffer, (ALLEGRO_INDEX_BUFFER* buffer)); -ALLEGRO_PRIM_FUNC(int, al_get_index_buffer_size, (ALLEGRO_INDEX_BUFFER* buffer)); +A5O_PRIM_FUNC(A5O_INDEX_BUFFER*, al_create_index_buffer, (int index_size, const void* initial_data, int num_indices, int flags)); +A5O_PRIM_FUNC(void, al_destroy_index_buffer, (A5O_INDEX_BUFFER* buffer)); +A5O_PRIM_FUNC(void*, al_lock_index_buffer, (A5O_INDEX_BUFFER* buffer, int offset, int length, int flags)); +A5O_PRIM_FUNC(void, al_unlock_index_buffer, (A5O_INDEX_BUFFER* buffer)); +A5O_PRIM_FUNC(int, al_get_index_buffer_size, (A5O_INDEX_BUFFER* buffer)); /* * Utilities for high level primitives. */ -ALLEGRO_PRIM_FUNC(bool, al_triangulate_polygon, (const float* vertices, size_t vertex_stride, const int* vertex_counts, void (*emit_triangle)(int, int, int, void*), void* userdata)); +A5O_PRIM_FUNC(bool, al_triangulate_polygon, (const float* vertices, size_t vertex_stride, const int* vertex_counts, void (*emit_triangle)(int, int, int, void*), void* userdata)); /* * Custom primitives */ -ALLEGRO_PRIM_FUNC(void, al_draw_soft_triangle, (ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, ALLEGRO_VERTEX* v3, uintptr_t state, - void (*init)(uintptr_t, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*), +A5O_PRIM_FUNC(void, al_draw_soft_triangle, (A5O_VERTEX* v1, A5O_VERTEX* v2, A5O_VERTEX* v3, uintptr_t state, + void (*init)(uintptr_t, A5O_VERTEX*, A5O_VERTEX*, A5O_VERTEX*), void (*first)(uintptr_t, int, int, int, int), void (*step)(uintptr_t, int), void (*draw)(uintptr_t, int, int, int))); -ALLEGRO_PRIM_FUNC(void, al_draw_soft_line, (ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, uintptr_t state, - void (*first)(uintptr_t, int, int, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*), +A5O_PRIM_FUNC(void, al_draw_soft_line, (A5O_VERTEX* v1, A5O_VERTEX* v2, uintptr_t state, + void (*first)(uintptr_t, int, int, A5O_VERTEX*, A5O_VERTEX*), void (*step)(uintptr_t, int), void (*draw)(uintptr_t, int, int))); /* *High level primitives */ -ALLEGRO_PRIM_FUNC(void, al_draw_line, (float x1, float y1, float x2, float y2, ALLEGRO_COLOR color, float thickness)); -ALLEGRO_PRIM_FUNC(void, al_draw_triangle, (float x1, float y1, float x2, float y2, float x3, float y3, ALLEGRO_COLOR color, float thickness)); -ALLEGRO_PRIM_FUNC(void, al_draw_rectangle, (float x1, float y1, float x2, float y2, ALLEGRO_COLOR color, float thickness)); -ALLEGRO_PRIM_FUNC(void, al_draw_rounded_rectangle, (float x1, float y1, float x2, float y2, float rx, float ry, ALLEGRO_COLOR color, float thickness)); - -ALLEGRO_PRIM_FUNC(void, al_calculate_arc, (float* dest, int stride, float cx, float cy, float rx, float ry, float start_theta, float delta_theta, float thickness, int num_points)); -ALLEGRO_PRIM_FUNC(void, al_draw_circle, (float cx, float cy, float r, ALLEGRO_COLOR color, float thickness)); -ALLEGRO_PRIM_FUNC(void, al_draw_ellipse, (float cx, float cy, float rx, float ry, ALLEGRO_COLOR color, float thickness)); -ALLEGRO_PRIM_FUNC(void, al_draw_arc, (float cx, float cy, float r, float start_theta, float delta_theta, ALLEGRO_COLOR color, float thickness)); -ALLEGRO_PRIM_FUNC(void, al_draw_elliptical_arc, (float cx, float cy, float rx, float ry, float start_theta, float delta_theta, ALLEGRO_COLOR color, float thickness)); -ALLEGRO_PRIM_FUNC(void, al_draw_pieslice, (float cx, float cy, float r, float start_theta, float delta_theta, ALLEGRO_COLOR color, float thickness)); - -ALLEGRO_PRIM_FUNC(void, al_calculate_spline, (float* dest, int stride, const float points[8], float thickness, int num_segments)); -ALLEGRO_PRIM_FUNC(void, al_draw_spline, (const float points[8], ALLEGRO_COLOR color, float thickness)); - -ALLEGRO_PRIM_FUNC(void, al_calculate_ribbon, (float* dest, int dest_stride, const float *points, int points_stride, float thickness, int num_segments)); -ALLEGRO_PRIM_FUNC(void, al_draw_ribbon, (const float *points, int points_stride, ALLEGRO_COLOR color, float thickness, int num_segments)); - -ALLEGRO_PRIM_FUNC(void, al_draw_filled_triangle, (float x1, float y1, float x2, float y2, float x3, float y3, ALLEGRO_COLOR color)); -ALLEGRO_PRIM_FUNC(void, al_draw_filled_rectangle, (float x1, float y1, float x2, float y2, ALLEGRO_COLOR color)); -ALLEGRO_PRIM_FUNC(void, al_draw_filled_ellipse, (float cx, float cy, float rx, float ry, ALLEGRO_COLOR color)); -ALLEGRO_PRIM_FUNC(void, al_draw_filled_circle, (float cx, float cy, float r, ALLEGRO_COLOR color)); -ALLEGRO_PRIM_FUNC(void, al_draw_filled_pieslice, (float cx, float cy, float r, float start_theta, float delta_theta, ALLEGRO_COLOR color)); -ALLEGRO_PRIM_FUNC(void, al_draw_filled_rounded_rectangle, (float x1, float y1, float x2, float y2, float rx, float ry, ALLEGRO_COLOR color)); - -ALLEGRO_PRIM_FUNC(void, al_draw_polyline, (const float* vertices, int vertex_stride, int vertex_count, int join_style, int cap_style, ALLEGRO_COLOR color, float thickness, float miter_limit)); - -ALLEGRO_PRIM_FUNC(void, al_draw_polygon, (const float* vertices, int vertex_count, int join_style, ALLEGRO_COLOR color, float thickness, float miter_limit)); -ALLEGRO_PRIM_FUNC(void, al_draw_filled_polygon, (const float* vertices, int vertex_count, ALLEGRO_COLOR color)); -ALLEGRO_PRIM_FUNC(void, al_draw_filled_polygon_with_holes, (const float* vertices, const int* vertex_counts, ALLEGRO_COLOR color)); +A5O_PRIM_FUNC(void, al_draw_line, (float x1, float y1, float x2, float y2, A5O_COLOR color, float thickness)); +A5O_PRIM_FUNC(void, al_draw_triangle, (float x1, float y1, float x2, float y2, float x3, float y3, A5O_COLOR color, float thickness)); +A5O_PRIM_FUNC(void, al_draw_rectangle, (float x1, float y1, float x2, float y2, A5O_COLOR color, float thickness)); +A5O_PRIM_FUNC(void, al_draw_rounded_rectangle, (float x1, float y1, float x2, float y2, float rx, float ry, A5O_COLOR color, float thickness)); + +A5O_PRIM_FUNC(void, al_calculate_arc, (float* dest, int stride, float cx, float cy, float rx, float ry, float start_theta, float delta_theta, float thickness, int num_points)); +A5O_PRIM_FUNC(void, al_draw_circle, (float cx, float cy, float r, A5O_COLOR color, float thickness)); +A5O_PRIM_FUNC(void, al_draw_ellipse, (float cx, float cy, float rx, float ry, A5O_COLOR color, float thickness)); +A5O_PRIM_FUNC(void, al_draw_arc, (float cx, float cy, float r, float start_theta, float delta_theta, A5O_COLOR color, float thickness)); +A5O_PRIM_FUNC(void, al_draw_elliptical_arc, (float cx, float cy, float rx, float ry, float start_theta, float delta_theta, A5O_COLOR color, float thickness)); +A5O_PRIM_FUNC(void, al_draw_pieslice, (float cx, float cy, float r, float start_theta, float delta_theta, A5O_COLOR color, float thickness)); + +A5O_PRIM_FUNC(void, al_calculate_spline, (float* dest, int stride, const float points[8], float thickness, int num_segments)); +A5O_PRIM_FUNC(void, al_draw_spline, (const float points[8], A5O_COLOR color, float thickness)); + +A5O_PRIM_FUNC(void, al_calculate_ribbon, (float* dest, int dest_stride, const float *points, int points_stride, float thickness, int num_segments)); +A5O_PRIM_FUNC(void, al_draw_ribbon, (const float *points, int points_stride, A5O_COLOR color, float thickness, int num_segments)); + +A5O_PRIM_FUNC(void, al_draw_filled_triangle, (float x1, float y1, float x2, float y2, float x3, float y3, A5O_COLOR color)); +A5O_PRIM_FUNC(void, al_draw_filled_rectangle, (float x1, float y1, float x2, float y2, A5O_COLOR color)); +A5O_PRIM_FUNC(void, al_draw_filled_ellipse, (float cx, float cy, float rx, float ry, A5O_COLOR color)); +A5O_PRIM_FUNC(void, al_draw_filled_circle, (float cx, float cy, float r, A5O_COLOR color)); +A5O_PRIM_FUNC(void, al_draw_filled_pieslice, (float cx, float cy, float r, float start_theta, float delta_theta, A5O_COLOR color)); +A5O_PRIM_FUNC(void, al_draw_filled_rounded_rectangle, (float x1, float y1, float x2, float y2, float rx, float ry, A5O_COLOR color)); + +A5O_PRIM_FUNC(void, al_draw_polyline, (const float* vertices, int vertex_stride, int vertex_count, int join_style, int cap_style, A5O_COLOR color, float thickness, float miter_limit)); + +A5O_PRIM_FUNC(void, al_draw_polygon, (const float* vertices, int vertex_count, int join_style, A5O_COLOR color, float thickness, float miter_limit)); +A5O_PRIM_FUNC(void, al_draw_filled_polygon, (const float* vertices, int vertex_count, A5O_COLOR color)); +A5O_PRIM_FUNC(void, al_draw_filled_polygon_with_holes, (const float* vertices, const int* vertex_counts, A5O_COLOR color)); #ifdef __cplusplus diff --git a/addons/primitives/allegro5/internal/aintern_prim.h b/addons/primitives/allegro5/internal/aintern_prim.h index fa726e0f26..0f50815133 100644 --- a/addons/primitives/allegro5/internal/aintern_prim.h +++ b/addons/primitives/allegro5/internal/aintern_prim.h @@ -5,29 +5,29 @@ extern "C" { #endif -enum ALLEGRO_PRIM_VERTEX_CACHE_TYPE +enum A5O_PRIM_VERTEX_CACHE_TYPE { - ALLEGRO_PRIM_VERTEX_CACHE_TRIANGLE, - ALLEGRO_PRIM_VERTEX_CACHE_LINE_STRIP + A5O_PRIM_VERTEX_CACHE_TRIANGLE, + A5O_PRIM_VERTEX_CACHE_LINE_STRIP }; -struct ALLEGRO_VERTEX_DECL { - ALLEGRO_VERTEX_ELEMENT* elements; +struct A5O_VERTEX_DECL { + A5O_VERTEX_ELEMENT* elements; int stride; void* d3d_decl; void* d3d_dummy_shader; }; -typedef struct ALLEGRO_PRIM_VERTEX_CACHE { - ALLEGRO_VERTEX buffer[ALLEGRO_VERTEX_CACHE_SIZE]; - ALLEGRO_VERTEX* current; +typedef struct A5O_PRIM_VERTEX_CACHE { + A5O_VERTEX buffer[A5O_VERTEX_CACHE_SIZE]; + A5O_VERTEX* current; size_t size; - ALLEGRO_COLOR color; + A5O_COLOR color; int prim_type; void* user_data; -} ALLEGRO_PRIM_VERTEX_CACHE; +} A5O_PRIM_VERTEX_CACHE; -typedef struct ALLEGRO_BUFFER_COMMON { +typedef struct A5O_BUFFER_COMMON { uintptr_t handle; bool write_only; /* In elements */ @@ -40,25 +40,25 @@ typedef struct ALLEGRO_BUFFER_COMMON { int local_buffer_length; int lock_offset; int lock_length; -} ALLEGRO_BUFFER_COMMON; +} A5O_BUFFER_COMMON; -struct ALLEGRO_VERTEX_BUFFER { - ALLEGRO_VERTEX_DECL* decl; - ALLEGRO_BUFFER_COMMON common; +struct A5O_VERTEX_BUFFER { + A5O_VERTEX_DECL* decl; + A5O_BUFFER_COMMON common; }; -struct ALLEGRO_INDEX_BUFFER { +struct A5O_INDEX_BUFFER { int index_size; - ALLEGRO_BUFFER_COMMON common; + A5O_BUFFER_COMMON common; }; /* Internal cache for primitives. */ -void _al_prim_cache_init(ALLEGRO_PRIM_VERTEX_CACHE* cache, int prim_type, ALLEGRO_COLOR color); -void _al_prim_cache_init_ex(ALLEGRO_PRIM_VERTEX_CACHE* cache, int prim_type, ALLEGRO_COLOR color, void* user_data); -void _al_prim_cache_term(ALLEGRO_PRIM_VERTEX_CACHE* cache); -void _al_prim_cache_flush(ALLEGRO_PRIM_VERTEX_CACHE* cache); -void _al_prim_cache_push_point(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* v); -void _al_prim_cache_push_triangle(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* v0, const float* v1, const float* v2); +void _al_prim_cache_init(A5O_PRIM_VERTEX_CACHE* cache, int prim_type, A5O_COLOR color); +void _al_prim_cache_init_ex(A5O_PRIM_VERTEX_CACHE* cache, int prim_type, A5O_COLOR color, void* user_data); +void _al_prim_cache_term(A5O_PRIM_VERTEX_CACHE* cache); +void _al_prim_cache_flush(A5O_PRIM_VERTEX_CACHE* cache); +void _al_prim_cache_push_point(A5O_PRIM_VERTEX_CACHE* cache, const float* v); +void _al_prim_cache_push_triangle(A5O_PRIM_VERTEX_CACHE* cache, const float* v0, const float* v1, const float* v2); /* Internal functions. */ @@ -69,8 +69,8 @@ bool _al_prim_is_point_in_triangle(const float* point, const float* v0, con bool _al_prim_intersect_segment(const float* v0, const float* v1, const float* p0, const float* p1, float* point, float* t0, float* t1); bool _al_prim_are_points_equal(const float* point_a, const float* point_b); -int _al_bitmap_region_is_locked(ALLEGRO_BITMAP* bmp, int x1, int y1, int x2, int y2); -int _al_draw_buffer_common_soft(ALLEGRO_VERTEX_BUFFER* vertex_buffer, ALLEGRO_BITMAP* texture, ALLEGRO_INDEX_BUFFER* index_buffer, int start, int end, int type); +int _al_bitmap_region_is_locked(A5O_BITMAP* bmp, int x1, int y1, int x2, int y2); +int _al_draw_buffer_common_soft(A5O_VERTEX_BUFFER* vertex_buffer, A5O_BITMAP* texture, A5O_INDEX_BUFFER* index_buffer, int start, int end, int type); #ifdef __cplusplus } diff --git a/addons/primitives/allegro5/internal/aintern_prim_directx.h b/addons/primitives/allegro5/internal/aintern_prim_directx.h index 6abff2f495..9cd4c19768 100644 --- a/addons/primitives/allegro5/internal/aintern_prim_directx.h +++ b/addons/primitives/allegro5/internal/aintern_prim_directx.h @@ -1,29 +1,29 @@ #ifndef __al_included_allegro5_aintern_prim_directx_h #define __al_included_allegro5_aintern_prim_directx_h -struct ALLEGRO_BITMAP; -struct ALLEGRO_VERTEX; +struct A5O_BITMAP; +struct A5O_VERTEX; #ifdef __cplusplus extern "C" { #endif -int _al_draw_prim_directx(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, int start, int end, int type); -int _al_draw_prim_indexed_directx(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, const int* indices, int num_vtx, int type); -void _al_set_d3d_decl(ALLEGRO_DISPLAY* display, ALLEGRO_VERTEX_DECL* ret); +int _al_draw_prim_directx(A5O_BITMAP* target, A5O_BITMAP* texture, const void* vtxs, const A5O_VERTEX_DECL* decl, int start, int end, int type); +int _al_draw_prim_indexed_directx(A5O_BITMAP* target, A5O_BITMAP* texture, const void* vtxs, const A5O_VERTEX_DECL* decl, const int* indices, int num_vtx, int type); +void _al_set_d3d_decl(A5O_DISPLAY* display, A5O_VERTEX_DECL* ret); -bool _al_create_vertex_buffer_directx(ALLEGRO_VERTEX_BUFFER* buf, const void* initial_data, size_t num_vertices, int flags); -void _al_destroy_vertex_buffer_directx(ALLEGRO_VERTEX_BUFFER* buf); -void* _al_lock_vertex_buffer_directx(ALLEGRO_VERTEX_BUFFER* buf); -void _al_unlock_vertex_buffer_directx(ALLEGRO_VERTEX_BUFFER* buf); +bool _al_create_vertex_buffer_directx(A5O_VERTEX_BUFFER* buf, const void* initial_data, size_t num_vertices, int flags); +void _al_destroy_vertex_buffer_directx(A5O_VERTEX_BUFFER* buf); +void* _al_lock_vertex_buffer_directx(A5O_VERTEX_BUFFER* buf); +void _al_unlock_vertex_buffer_directx(A5O_VERTEX_BUFFER* buf); -bool _al_create_index_buffer_directx(ALLEGRO_INDEX_BUFFER* buf, const void* initial_data, size_t num_indices, int flags); -void _al_destroy_index_buffer_directx(ALLEGRO_INDEX_BUFFER* buf); -void* _al_lock_index_buffer_directx(ALLEGRO_INDEX_BUFFER* buf); -void _al_unlock_index_buffer_directx(ALLEGRO_INDEX_BUFFER* buf); +bool _al_create_index_buffer_directx(A5O_INDEX_BUFFER* buf, const void* initial_data, size_t num_indices, int flags); +void _al_destroy_index_buffer_directx(A5O_INDEX_BUFFER* buf); +void* _al_lock_index_buffer_directx(A5O_INDEX_BUFFER* buf); +void _al_unlock_index_buffer_directx(A5O_INDEX_BUFFER* buf); -int _al_draw_vertex_buffer_directx(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX_BUFFER* vertex_buffer, int start, int end, int type); -int _al_draw_indexed_buffer_directx(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX_BUFFER* vertex_buffer, ALLEGRO_INDEX_BUFFER* index_buffer, int start, int end, int type); +int _al_draw_vertex_buffer_directx(A5O_BITMAP* target, A5O_BITMAP* texture, A5O_VERTEX_BUFFER* vertex_buffer, int start, int end, int type); +int _al_draw_indexed_buffer_directx(A5O_BITMAP* target, A5O_BITMAP* texture, A5O_VERTEX_BUFFER* vertex_buffer, A5O_INDEX_BUFFER* index_buffer, int start, int end, int type); bool _al_init_d3d_driver(void); void _al_shutdown_d3d_driver(void); @@ -31,8 +31,8 @@ void _al_shutdown_d3d_driver(void); void* _al_create_default_primitives_shader(void* dev); void _al_setup_default_primitives_shader(void* dev, void* shader); -void _al_setup_primitives_shader(void* dev, const ALLEGRO_VERTEX_DECL* decl); -void _al_create_primitives_shader(void* dev, ALLEGRO_VERTEX_DECL* decl); +void _al_setup_primitives_shader(void* dev, const A5O_VERTEX_DECL* decl); +void _al_create_primitives_shader(void* dev, A5O_VERTEX_DECL* decl); void _al_set_texture_matrix(void* dev, float* mat); #ifdef __cplusplus diff --git a/addons/primitives/allegro5/internal/aintern_prim_opengl.h b/addons/primitives/allegro5/internal/aintern_prim_opengl.h index 9d8e42c823..3db12fedca 100644 --- a/addons/primitives/allegro5/internal/aintern_prim_opengl.h +++ b/addons/primitives/allegro5/internal/aintern_prim_opengl.h @@ -1,20 +1,20 @@ #ifndef __al_included_allegro5_aintern_prim_opengl_h #define __al_included_allegro5_aintern_prim_opengl_h -int _al_draw_prim_opengl(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, int start, int end, int type); -int _al_draw_prim_indexed_opengl(ALLEGRO_BITMAP *target, ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, const int* indices, int num_vtx, int type); +int _al_draw_prim_opengl(A5O_BITMAP* target, A5O_BITMAP* texture, const void* vtxs, const A5O_VERTEX_DECL* decl, int start, int end, int type); +int _al_draw_prim_indexed_opengl(A5O_BITMAP *target, A5O_BITMAP* texture, const void* vtxs, const A5O_VERTEX_DECL* decl, const int* indices, int num_vtx, int type); -bool _al_create_vertex_buffer_opengl(ALLEGRO_VERTEX_BUFFER* buf, const void* initial_data, size_t num_vertices, int flags); -void _al_destroy_vertex_buffer_opengl(ALLEGRO_VERTEX_BUFFER* buf); -void* _al_lock_vertex_buffer_opengl(ALLEGRO_VERTEX_BUFFER* buf); -void _al_unlock_vertex_buffer_opengl(ALLEGRO_VERTEX_BUFFER* buf); +bool _al_create_vertex_buffer_opengl(A5O_VERTEX_BUFFER* buf, const void* initial_data, size_t num_vertices, int flags); +void _al_destroy_vertex_buffer_opengl(A5O_VERTEX_BUFFER* buf); +void* _al_lock_vertex_buffer_opengl(A5O_VERTEX_BUFFER* buf); +void _al_unlock_vertex_buffer_opengl(A5O_VERTEX_BUFFER* buf); -bool _al_create_index_buffer_opengl(ALLEGRO_INDEX_BUFFER* buf, const void* initial_data, size_t num_indices, int flags); -void _al_destroy_index_buffer_opengl(ALLEGRO_INDEX_BUFFER* buf); -void* _al_lock_index_buffer_opengl(ALLEGRO_INDEX_BUFFER* buf); -void _al_unlock_index_buffer_opengl(ALLEGRO_INDEX_BUFFER* buf); +bool _al_create_index_buffer_opengl(A5O_INDEX_BUFFER* buf, const void* initial_data, size_t num_indices, int flags); +void _al_destroy_index_buffer_opengl(A5O_INDEX_BUFFER* buf); +void* _al_lock_index_buffer_opengl(A5O_INDEX_BUFFER* buf); +void _al_unlock_index_buffer_opengl(A5O_INDEX_BUFFER* buf); -int _al_draw_vertex_buffer_opengl(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX_BUFFER* vertex_buffer, int start, int end, int type); -int _al_draw_indexed_buffer_opengl(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX_BUFFER* vertex_buffer, ALLEGRO_INDEX_BUFFER* index_buffer, int start, int end, int type); +int _al_draw_vertex_buffer_opengl(A5O_BITMAP* target, A5O_BITMAP* texture, A5O_VERTEX_BUFFER* vertex_buffer, int start, int end, int type); +int _al_draw_indexed_buffer_opengl(A5O_BITMAP* target, A5O_BITMAP* texture, A5O_VERTEX_BUFFER* vertex_buffer, A5O_INDEX_BUFFER* index_buffer, int start, int end, int type); #endif diff --git a/addons/primitives/allegro5/internal/aintern_prim_soft.h b/addons/primitives/allegro5/internal/aintern_prim_soft.h index 5122d78045..4d263325e7 100644 --- a/addons/primitives/allegro5/internal/aintern_prim_soft.h +++ b/addons/primitives/allegro5/internal/aintern_prim_soft.h @@ -1,20 +1,20 @@ #ifndef __al_included_allegro5_aintern_prim_soft_h #define __al_included_allegro5_aintern_prim_soft_h -struct ALLEGRO_BITMAP; -struct ALLEGRO_VERTEX; -enum ALLEGRO_BITMAP_WRAP; +struct A5O_BITMAP; +struct A5O_VERTEX; +enum A5O_BITMAP_WRAP; #ifdef __cplusplus extern "C" { #endif -int _al_fix_texcoord(float var, int max_var, ALLEGRO_BITMAP_WRAP wrap); -int _al_draw_prim_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, int start, int end, int type); -int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, const int* indices, int num_vtx, int type); +int _al_fix_texcoord(float var, int max_var, A5O_BITMAP_WRAP wrap); +int _al_draw_prim_soft(A5O_BITMAP* texture, const void* vtxs, const A5O_VERTEX_DECL* decl, int start, int end, int type); +int _al_draw_prim_indexed_soft(A5O_BITMAP* texture, const void* vtxs, const A5O_VERTEX_DECL* decl, const int* indices, int num_vtx, int type); -void _al_line_2d(ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2); -void _al_point_2d(ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX* v); +void _al_line_2d(A5O_BITMAP* texture, A5O_VERTEX* v1, A5O_VERTEX* v2); +void _al_point_2d(A5O_BITMAP* texture, A5O_VERTEX* v); #ifdef __cplusplus } diff --git a/addons/primitives/directx_shaders.cpp b/addons/primitives/directx_shaders.cpp index a27777c39b..6e8253da0d 100644 --- a/addons/primitives/directx_shaders.cpp +++ b/addons/primitives/directx_shaders.cpp @@ -24,19 +24,19 @@ #include "allegro5/internal/aintern_prim.h" #include "allegro5/platform/alplatf.h" -#ifdef ALLEGRO_CFG_D3D +#ifdef A5O_CFG_D3D #include "allegro5/allegro_direct3d.h" #include "allegro5/internal/aintern_prim_directx.h" #include "precompiled_shaders.inc" -void _al_create_primitives_shader(void* dev, ALLEGRO_VERTEX_DECL* decl) +void _al_create_primitives_shader(void* dev, A5O_VERTEX_DECL* decl) { LPDIRECT3DDEVICE9 device = (LPDIRECT3DDEVICE9)dev; LPDIRECT3DVERTEXSHADER9 ret = 0; - ALLEGRO_VERTEX_ELEMENT* e; + A5O_VERTEX_ELEMENT* e; int position = 0; int texture = 0; @@ -61,27 +61,27 @@ void _al_create_primitives_shader(void* dev, ALLEGRO_VERTEX_DECL* decl) } }; - e = &decl->elements[ALLEGRO_PRIM_POSITION]; + e = &decl->elements[A5O_PRIM_POSITION]; if (e->attribute) { switch(e->storage) { - case ALLEGRO_PRIM_SHORT_2: - case ALLEGRO_PRIM_FLOAT_2: + case A5O_PRIM_SHORT_2: + case A5O_PRIM_FLOAT_2: position = 1; break; - case ALLEGRO_PRIM_FLOAT_3: + case A5O_PRIM_FLOAT_3: position = 2; break; } } - e = &decl->elements[ALLEGRO_PRIM_TEX_COORD]; + e = &decl->elements[A5O_PRIM_TEX_COORD]; if(!e->attribute) - e = &decl->elements[ALLEGRO_PRIM_TEX_COORD_PIXEL]; + e = &decl->elements[A5O_PRIM_TEX_COORD_PIXEL]; if(e->attribute) { texture = 1; } - e = &decl->elements[ALLEGRO_PRIM_COLOR_ATTR]; + e = &decl->elements[A5O_PRIM_COLOR_ATTR]; if(e->attribute) { color = 1; } @@ -172,7 +172,7 @@ static void setup_transforms(IDirect3DDevice9* device) IDirect3DDevice9_SetVertexShaderConstantF(device, 0, (float*)&matWorldViewProj, 4); } -void _al_setup_primitives_shader(void* dev, const ALLEGRO_VERTEX_DECL* decl) +void _al_setup_primitives_shader(void* dev, const A5O_VERTEX_DECL* decl) { IDirect3DDevice9* device = (IDirect3DDevice9*)dev; setup_transforms(device); @@ -186,6 +186,6 @@ void _al_setup_default_primitives_shader(void* dev, void* shader) IDirect3DDevice9_SetVertexShader(device, (LPDIRECT3DVERTEXSHADER9)shader); } -#endif /* ALLEGRO_CFG_D3D */ +#endif /* A5O_CFG_D3D */ /* vim: set sts=3 sw=3 et: */ diff --git a/addons/primitives/high_primitives.c b/addons/primitives/high_primitives.c index bea2d1edcd..a6e41cbac0 100644 --- a/addons/primitives/high_primitives.c +++ b/addons/primitives/high_primitives.c @@ -37,22 +37,22 @@ */ -#define ALLEGRO_INTERNAL_UNSTABLE +#define A5O_INTERNAL_UNSTABLE #include "allegro5/allegro_primitives.h" -#ifdef ALLEGRO_CFG_OPENGL +#ifdef A5O_CFG_OPENGL #include "allegro5/allegro_opengl.h" #endif #include "allegro5/internal/aintern_bitmap.h" #include "allegro5/debug.h" #include -ALLEGRO_DEBUG_CHANNEL("primitives") +A5O_DEBUG_CHANNEL("primitives") -#ifdef ALLEGRO_MSVC +#ifdef A5O_MSVC #define hypotf(x, y) _hypotf((x), (y)) #endif -#define LOCAL_VERTEX_CACHE ALLEGRO_VERTEX vertex_cache[ALLEGRO_VERTEX_CACHE_SIZE] +#define LOCAL_VERTEX_CACHE A5O_VERTEX vertex_cache[A5O_VERTEX_CACHE_SIZE] /* * Make an estimate of the scale of the current transformation. @@ -62,11 +62,11 @@ static float get_scale(void) { #define DET2D(T) (fabs((T)->m[0][0] * (T)->m[1][1] - (T)->m[0][1] * (T)->m[1][0])) - const ALLEGRO_TRANSFORM* t = al_get_current_transform(); + const A5O_TRANSFORM* t = al_get_current_transform(); float scale_sq = DET2D(t); - ALLEGRO_BITMAP* b = al_get_target_bitmap(); + A5O_BITMAP* b = al_get_target_bitmap(); if (b) { - const ALLEGRO_TRANSFORM* p = al_get_current_projection_transform(); + const A5O_TRANSFORM* p = al_get_current_projection_transform(); /* Divide by 4.0f as the screen coordinates range from -1 to 1 on both axes. */ scale_sq *= DET2D(p) * al_get_bitmap_width(b) * al_get_bitmap_height(b) / 4.0f; } @@ -79,14 +79,14 @@ static float get_scale(void) /* Function: al_draw_line */ void al_draw_line(float x1, float y1, float x2, float y2, - ALLEGRO_COLOR color, float thickness) + A5O_COLOR color, float thickness) { if (thickness > 0) { int ii; float tx, ty; float len = hypotf(x2 - x1, y2 - y1); - ALLEGRO_VERTEX vtx[4]; + A5O_VERTEX vtx[4]; if (len == 0) return; @@ -104,10 +104,10 @@ void al_draw_line(float x1, float y1, float x2, float y2, vtx[ii].z = 0; } - al_draw_prim(vtx, 0, 0, 0, 4, ALLEGRO_PRIM_TRIANGLE_FAN); + al_draw_prim(vtx, 0, 0, 0, 4, A5O_PRIM_TRIANGLE_FAN); } else { - ALLEGRO_VERTEX vtx[2]; + A5O_VERTEX vtx[2]; vtx[0].x = x1; vtx[0].y = y1; vtx[1].x = x2; vtx[1].y = y2; @@ -117,14 +117,14 @@ void al_draw_line(float x1, float y1, float x2, float y2, vtx[0].z = 0; vtx[1].z = 0; - al_draw_prim(vtx, 0, 0, 0, 2, ALLEGRO_PRIM_LINE_LIST); + al_draw_prim(vtx, 0, 0, 0, 2, A5O_PRIM_LINE_LIST); } } /* Function: al_draw_triangle */ void al_draw_triangle(float x1, float y1, float x2, float y2, - float x3, float y3, ALLEGRO_COLOR color, float thickness) + float x3, float y3, A5O_COLOR color, float thickness) { if (thickness > 0) { int ii = 0; @@ -134,12 +134,12 @@ void al_draw_triangle(float x1, float y1, float x2, float y2, float incenter_x, incenter_y; float incircle_rad; int idx = 0; - ALLEGRO_VERTEX vtx[5]; + A5O_VERTEX vtx[5]; float x[3] = {x1, x2, x3}; float y[3] = {y1, y2, y3}; - ALLEGRO_VERTEX first_inner_vtx; - ALLEGRO_VERTEX first_outer_vtx; - ALLEGRO_VERTEX ini_vtx; + A5O_VERTEX first_inner_vtx; + A5O_VERTEX first_outer_vtx; + A5O_VERTEX ini_vtx; float cross = (x[1] - x[0]) * (y[2] - y[0]) - (x[2] - x[0]) * (y[1] - y[0]); ini_vtx.x = ini_vtx.y = ini_vtx.z = ini_vtx.u = ini_vtx.v = 0; @@ -190,7 +190,7 @@ void al_draw_triangle(float x1, float y1, float x2, float y2, vtx[ii].z = 0; } - al_draw_prim(vtx, 0, 0, 0, 4, ALLEGRO_PRIM_TRIANGLE_FAN); + al_draw_prim(vtx, 0, 0, 0, 4, A5O_PRIM_TRIANGLE_FAN); return; } else if(cross > 0) { @@ -235,7 +235,7 @@ void al_draw_triangle(float x1, float y1, float x2, float y2, vtx[idx++] = outer_vtx; \ vtx[idx++] = inner_vtx; \ \ - al_draw_prim(vtx, 0, 0, 0, idx, ALLEGRO_PRIM_TRIANGLE_FAN); \ + al_draw_prim(vtx, 0, 0, 0, idx, A5O_PRIM_TRIANGLE_FAN); \ \ idx = 0; \ } @@ -257,8 +257,8 @@ void al_draw_triangle(float x1, float y1, float x2, float y2, float tdx = o_dx - i_dx; float tdy = o_dy - i_dy; - ALLEGRO_VERTEX inner_vtx = ini_vtx; - ALLEGRO_VERTEX outer_vtx = ini_vtx; + A5O_VERTEX inner_vtx = ini_vtx; + A5O_VERTEX outer_vtx = ini_vtx; if(tdx * tdx + tdy * tdy > 16 * thickness * thickness) { float x_pos = x[(ii + 1) % 3]; @@ -276,7 +276,7 @@ void al_draw_triangle(float x1, float y1, float x2, float y2, float mag_1_2 = hypotf(x1_x2, y1_y2); float mag_1_3 = hypotf(x1_x3, y1_y3); - ALLEGRO_VERTEX next_vtx = ini_vtx; + A5O_VERTEX next_vtx = ini_vtx; x1_x2 *= thickness / 2 / mag_1_2; y1_y2 *= thickness / 2 / mag_1_2; @@ -312,11 +312,11 @@ void al_draw_triangle(float x1, float y1, float x2, float y2, vtx[idx++] = first_outer_vtx; vtx[idx++] = first_inner_vtx; - al_draw_prim(vtx, 0, 0, 0, idx, ALLEGRO_PRIM_TRIANGLE_FAN); + al_draw_prim(vtx, 0, 0, 0, idx, A5O_PRIM_TRIANGLE_FAN); #undef DRAW } else { - ALLEGRO_VERTEX vtx[3]; + A5O_VERTEX vtx[3]; vtx[0].x = x1; vtx[0].y = y1; vtx[1].x = x2; vtx[1].y = y2; @@ -330,16 +330,16 @@ void al_draw_triangle(float x1, float y1, float x2, float y2, vtx[1].z = 0; vtx[2].z = 0; - al_draw_prim(vtx, 0, 0, 0, 3, ALLEGRO_PRIM_LINE_LOOP); + al_draw_prim(vtx, 0, 0, 0, 3, A5O_PRIM_LINE_LOOP); } } /* Function: al_draw_filled_triangle */ void al_draw_filled_triangle(float x1, float y1, float x2, float y2, - float x3, float y3, ALLEGRO_COLOR color) + float x3, float y3, A5O_COLOR color) { - ALLEGRO_VERTEX vtx[3]; + A5O_VERTEX vtx[3]; vtx[0].x = x1; vtx[0].y = y1; vtx[1].x = x2; vtx[1].y = y2; @@ -353,19 +353,19 @@ void al_draw_filled_triangle(float x1, float y1, float x2, float y2, vtx[1].z = 0; vtx[2].z = 0; - al_draw_prim(vtx, 0, 0, 0, 3, ALLEGRO_PRIM_TRIANGLE_LIST); + al_draw_prim(vtx, 0, 0, 0, 3, A5O_PRIM_TRIANGLE_LIST); } /* Function: al_draw_rectangle */ void al_draw_rectangle(float x1, float y1, float x2, float y2, - ALLEGRO_COLOR color, float thickness) + A5O_COLOR color, float thickness) { int ii; if (thickness > 0) { float t = thickness / 2; - ALLEGRO_VERTEX vtx[10]; + A5O_VERTEX vtx[10]; vtx[0].x = x1 - t; vtx[0].y = y1 - t; vtx[1].x = x1 + t; vtx[1].y = y1 + t; @@ -383,9 +383,9 @@ void al_draw_rectangle(float x1, float y1, float x2, float y2, vtx[ii].z = 0; } - al_draw_prim(vtx, 0, 0, 0, 10, ALLEGRO_PRIM_TRIANGLE_STRIP); + al_draw_prim(vtx, 0, 0, 0, 10, A5O_PRIM_TRIANGLE_STRIP); } else { - ALLEGRO_VERTEX vtx[4]; + A5O_VERTEX vtx[4]; vtx[0].x = x1; vtx[0].y = y1; vtx[1].x = x2; vtx[1].y = y1; @@ -397,16 +397,16 @@ void al_draw_rectangle(float x1, float y1, float x2, float y2, vtx[ii].z = 0; } - al_draw_prim(vtx, 0, 0, 0, 4, ALLEGRO_PRIM_LINE_LOOP); + al_draw_prim(vtx, 0, 0, 0, 4, A5O_PRIM_LINE_LOOP); } } /* Function: al_draw_filled_rectangle */ void al_draw_filled_rectangle(float x1, float y1, float x2, float y2, - ALLEGRO_COLOR color) + A5O_COLOR color) { - ALLEGRO_VERTEX vtx[4]; + A5O_VERTEX vtx[4]; int ii; vtx[0].x = x1; vtx[0].y = y1; @@ -419,7 +419,7 @@ void al_draw_filled_rectangle(float x1, float y1, float x2, float y2, vtx[ii].z = 0; } - al_draw_prim(vtx, 0, 0, 0, 4, ALLEGRO_PRIM_TRIANGLE_FAN); + al_draw_prim(vtx, 0, 0, 0, 4, A5O_PRIM_TRIANGLE_FAN); } /* Function: al_calculate_arc @@ -506,7 +506,7 @@ void al_calculate_arc(float* dest, int stride, float cx, float cy, /* Function: al_draw_pieslice */ void al_draw_pieslice(float cx, float cy, float r, float start_theta, - float delta_theta, ALLEGRO_COLOR color, float thickness) + float delta_theta, A5O_COLOR color, float thickness) { LOCAL_VERTEX_CACHE; float scale = get_scale(); @@ -521,16 +521,16 @@ void al_draw_pieslice(float cx, float cy, float r, float start_theta, } if (thickness <= 0) { - num_segments = fabs(delta_theta / (2 * ALLEGRO_PI) * ALLEGRO_PRIM_QUALITY * sqrtf(scale * r)); + num_segments = fabs(delta_theta / (2 * A5O_PI) * A5O_PRIM_QUALITY * sqrtf(scale * r)); if (num_segments < 2) num_segments = 2; - if (num_segments + 1 >= ALLEGRO_VERTEX_CACHE_SIZE) { - num_segments = ALLEGRO_VERTEX_CACHE_SIZE - 1 - 1; + if (num_segments + 1 >= A5O_VERTEX_CACHE_SIZE) { + num_segments = A5O_VERTEX_CACHE_SIZE - 1 - 1; } - al_calculate_arc(&(vertex_cache[1].x), sizeof(ALLEGRO_VERTEX), cx, cy, r, r, start_theta, delta_theta, 0, num_segments); + al_calculate_arc(&(vertex_cache[1].x), sizeof(A5O_VERTEX), cx, cy, r, r, start_theta, delta_theta, 0, num_segments); vertex_cache[0].x = cx; vertex_cache[0].y = cy; for (ii = 0; ii < num_segments + 1; ii++) { @@ -538,14 +538,14 @@ void al_draw_pieslice(float cx, float cy, float r, float start_theta, vertex_cache[ii].z = 0; } - al_draw_prim(vertex_cache, 0, 0, 0, num_segments + 1, ALLEGRO_PRIM_LINE_LOOP); + al_draw_prim(vertex_cache, 0, 0, 0, num_segments + 1, A5O_PRIM_LINE_LOOP); } else { float ht = thickness / 2; float inner_side_angle = asinf(ht / (r - ht)); float outer_side_angle = asinf(ht / (r + ht)); float central_angle = delta_theta - 2 * inner_side_angle; - bool inverted_winding = ((int)(delta_theta / ALLEGRO_PI)) % 2 == 1; - float midangle = start_theta + (fmodf(delta_theta + ALLEGRO_PI, 2 * ALLEGRO_PI) - ALLEGRO_PI) / 2; + bool inverted_winding = ((int)(delta_theta / A5O_PI)) % 2 == 1; + float midangle = start_theta + (fmodf(delta_theta + A5O_PI, 2 * A5O_PI) - A5O_PI) / 2; float midpoint_dir_x = cosf(midangle); float midpoint_dir_y = sinf(midangle); float side_dir_x = cosf(start_theta); @@ -567,15 +567,15 @@ void al_draw_pieslice(float cx, float cy, float r, float start_theta, vertex_cache[0].x = cx + (r - thickness / 2) * cosf(central_start_angle); vertex_cache[0].y = cy + (r - thickness / 2) * sinf(central_start_angle); - num_segments = (inner_side_angle + outer_side_angle) / (2 * ALLEGRO_PI) * ALLEGRO_PRIM_QUALITY * sqrtf(scale * (r + ht)); + num_segments = (inner_side_angle + outer_side_angle) / (2 * A5O_PI) * A5O_PRIM_QUALITY * sqrtf(scale * (r + ht)); if (num_segments < 2) num_segments = 2; - if (num_segments + extra_vtx >= ALLEGRO_VERTEX_CACHE_SIZE) - num_segments = ALLEGRO_VERTEX_CACHE_SIZE - 1 - extra_vtx; + if (num_segments + extra_vtx >= A5O_VERTEX_CACHE_SIZE) + num_segments = A5O_VERTEX_CACHE_SIZE - 1 - extra_vtx; - al_calculate_arc(&(vertex_cache[1].x), sizeof(ALLEGRO_VERTEX), cx, cy, r + ht, r + ht, central_start_angle, -(outer_side_angle + inner_side_angle), 0, num_segments); + al_calculate_arc(&(vertex_cache[1].x), sizeof(A5O_VERTEX), cx, cy, r + ht, r + ht, central_start_angle, -(outer_side_angle + inner_side_angle), 0, num_segments); /* Do the tip */ vtx_id = num_segments + 1 + (inverted_winding ? (1 + (blunt_tip ? 1 : 0)) : 0); @@ -607,7 +607,7 @@ void al_draw_pieslice(float cx, float cy, float r, float start_theta, vertex_cache[ii].z = 0; } - al_draw_prim(vertex_cache, 0, 0, 0, num_segments + extra_vtx, ALLEGRO_PRIM_TRIANGLE_FAN); + al_draw_prim(vertex_cache, 0, 0, 0, num_segments + extra_vtx, A5O_PRIM_TRIANGLE_FAN); /* Mirror the vertices and draw them again */ for (ii = 0; ii < num_segments + extra_vtx; ii++) { @@ -616,20 +616,20 @@ void al_draw_pieslice(float cx, float cy, float r, float start_theta, vertex_cache[ii].y = 2 * cy + 2 * dot * midpoint_dir_y - vertex_cache[ii].y; } - al_draw_prim(vertex_cache, 0, 0, 0, num_segments + extra_vtx, ALLEGRO_PRIM_TRIANGLE_FAN); + al_draw_prim(vertex_cache, 0, 0, 0, num_segments + extra_vtx, A5O_PRIM_TRIANGLE_FAN); } else { /* Apex: 2 vertices if the apex is blunt) */ int extra_vtx = blunt_tip ? 2 : 1; - num_segments = (2 * outer_side_angle) / (2 * ALLEGRO_PI) * ALLEGRO_PRIM_QUALITY * sqrtf(scale * (r + ht)); + num_segments = (2 * outer_side_angle) / (2 * A5O_PI) * A5O_PRIM_QUALITY * sqrtf(scale * (r + ht)); if (num_segments < 2) num_segments = 2; - if (num_segments + extra_vtx >= ALLEGRO_VERTEX_CACHE_SIZE) - num_segments = ALLEGRO_VERTEX_CACHE_SIZE - 1 - extra_vtx; + if (num_segments + extra_vtx >= A5O_VERTEX_CACHE_SIZE) + num_segments = A5O_VERTEX_CACHE_SIZE - 1 - extra_vtx; - al_calculate_arc(&(vertex_cache[1].x), sizeof(ALLEGRO_VERTEX), cx, cy, r + ht, r + ht, start_theta - outer_side_angle, 2 * outer_side_angle + delta_theta, 0, num_segments); + al_calculate_arc(&(vertex_cache[1].x), sizeof(A5O_VERTEX), cx, cy, r + ht, r + ht, start_theta - outer_side_angle, 2 * outer_side_angle + delta_theta, 0, num_segments); if (blunt_tip) { float vx = ht * (side_dir_y - side_dir_x); @@ -654,7 +654,7 @@ void al_draw_pieslice(float cx, float cy, float r, float start_theta, vertex_cache[ii].z = 0; } - al_draw_prim(vertex_cache, 0, 0, 0, num_segments + extra_vtx, ALLEGRO_PRIM_TRIANGLE_FAN); + al_draw_prim(vertex_cache, 0, 0, 0, num_segments + extra_vtx, A5O_PRIM_TRIANGLE_FAN); } } } @@ -662,7 +662,7 @@ void al_draw_pieslice(float cx, float cy, float r, float start_theta, /* Function: al_draw_filled_pieslice */ void al_draw_filled_pieslice(float cx, float cy, float r, float start_theta, - float delta_theta, ALLEGRO_COLOR color) + float delta_theta, A5O_COLOR color) { LOCAL_VERTEX_CACHE; float scale = get_scale(); @@ -670,16 +670,16 @@ void al_draw_filled_pieslice(float cx, float cy, float r, float start_theta, ASSERT(r >= 0); - num_segments = fabs(delta_theta / (2 * ALLEGRO_PI) * ALLEGRO_PRIM_QUALITY * sqrtf(scale * r)); + num_segments = fabs(delta_theta / (2 * A5O_PI) * A5O_PRIM_QUALITY * sqrtf(scale * r)); if (num_segments < 2) num_segments = 2; - if (num_segments + 1 >= ALLEGRO_VERTEX_CACHE_SIZE) { - num_segments = ALLEGRO_VERTEX_CACHE_SIZE - 1 - 1; + if (num_segments + 1 >= A5O_VERTEX_CACHE_SIZE) { + num_segments = A5O_VERTEX_CACHE_SIZE - 1 - 1; } - al_calculate_arc(&(vertex_cache[1].x), sizeof(ALLEGRO_VERTEX), cx, cy, r, r, start_theta, delta_theta, 0, num_segments); + al_calculate_arc(&(vertex_cache[1].x), sizeof(A5O_VERTEX), cx, cy, r, r, start_theta, delta_theta, 0, num_segments); vertex_cache[0].x = cx; vertex_cache[0].y = cy; for (ii = 0; ii < num_segments + 1; ii++) { @@ -687,13 +687,13 @@ void al_draw_filled_pieslice(float cx, float cy, float r, float start_theta, vertex_cache[ii].z = 0; } - al_draw_prim(vertex_cache, 0, 0, 0, num_segments + 1, ALLEGRO_PRIM_TRIANGLE_FAN); + al_draw_prim(vertex_cache, 0, 0, 0, num_segments + 1, A5O_PRIM_TRIANGLE_FAN); } /* Function: al_draw_ellipse */ void al_draw_ellipse(float cx, float cy, float rx, float ry, - ALLEGRO_COLOR color, float thickness) + A5O_COLOR color, float thickness) { LOCAL_VERTEX_CACHE; float scale = get_scale(); @@ -702,50 +702,50 @@ void al_draw_ellipse(float cx, float cy, float rx, float ry, ASSERT(ry >= 0); if (thickness > 0) { - int num_segments = ALLEGRO_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f); + int num_segments = A5O_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f); int ii; /* In case rx and ry are both 0. */ if (num_segments < 2) return; - if (2 * num_segments >= ALLEGRO_VERTEX_CACHE_SIZE) { - num_segments = (ALLEGRO_VERTEX_CACHE_SIZE - 1) / 2; + if (2 * num_segments >= A5O_VERTEX_CACHE_SIZE) { + num_segments = (A5O_VERTEX_CACHE_SIZE - 1) / 2; } - al_calculate_arc(&(vertex_cache[0].x), sizeof(ALLEGRO_VERTEX), cx, cy, rx, ry, 0, ALLEGRO_PI * 2, thickness, num_segments); + al_calculate_arc(&(vertex_cache[0].x), sizeof(A5O_VERTEX), cx, cy, rx, ry, 0, A5O_PI * 2, thickness, num_segments); for (ii = 0; ii < 2 * num_segments; ii++) { vertex_cache[ii].color = color; vertex_cache[ii].z = 0; } - al_draw_prim(vertex_cache, 0, 0, 0, 2 * num_segments, ALLEGRO_PRIM_TRIANGLE_STRIP); + al_draw_prim(vertex_cache, 0, 0, 0, 2 * num_segments, A5O_PRIM_TRIANGLE_STRIP); } else { - int num_segments = ALLEGRO_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f); + int num_segments = A5O_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f); int ii; /* In case rx and ry are both 0. */ if (num_segments < 2) return; - if (num_segments >= ALLEGRO_VERTEX_CACHE_SIZE) { - num_segments = ALLEGRO_VERTEX_CACHE_SIZE - 1; + if (num_segments >= A5O_VERTEX_CACHE_SIZE) { + num_segments = A5O_VERTEX_CACHE_SIZE - 1; } - al_calculate_arc(&(vertex_cache[0].x), sizeof(ALLEGRO_VERTEX), cx, cy, rx, ry, 0, ALLEGRO_PI * 2, 0, num_segments); + al_calculate_arc(&(vertex_cache[0].x), sizeof(A5O_VERTEX), cx, cy, rx, ry, 0, A5O_PI * 2, 0, num_segments); for (ii = 0; ii < num_segments; ii++) { vertex_cache[ii].color = color; vertex_cache[ii].z = 0; } - al_draw_prim(vertex_cache, 0, 0, 0, num_segments - 1, ALLEGRO_PRIM_LINE_LOOP); + al_draw_prim(vertex_cache, 0, 0, 0, num_segments - 1, A5O_PRIM_LINE_LOOP); } } /* Function: al_draw_filled_ellipse */ void al_draw_filled_ellipse(float cx, float cy, float rx, float ry, - ALLEGRO_COLOR color) + A5O_COLOR color) { LOCAL_VERTEX_CACHE; int num_segments, ii; @@ -754,7 +754,7 @@ void al_draw_filled_ellipse(float cx, float cy, float rx, float ry, ASSERT(rx >= 0); ASSERT(ry >= 0); - num_segments = ALLEGRO_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f); + num_segments = A5O_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f); /* In case rx and ry are both close to 0. If al_calculate_arc is passed * 0 or 1 it will assert. @@ -762,11 +762,11 @@ void al_draw_filled_ellipse(float cx, float cy, float rx, float ry, if (num_segments < 2) return; - if (num_segments >= ALLEGRO_VERTEX_CACHE_SIZE) { - num_segments = ALLEGRO_VERTEX_CACHE_SIZE - 1; + if (num_segments >= A5O_VERTEX_CACHE_SIZE) { + num_segments = A5O_VERTEX_CACHE_SIZE - 1; } - al_calculate_arc(&(vertex_cache[1].x), sizeof(ALLEGRO_VERTEX), cx, cy, rx, ry, 0, ALLEGRO_PI * 2, 0, num_segments); + al_calculate_arc(&(vertex_cache[1].x), sizeof(A5O_VERTEX), cx, cy, rx, ry, 0, A5O_PI * 2, 0, num_segments); vertex_cache[0].x = cx; vertex_cache[0].y = cy; for (ii = 0; ii < num_segments + 1; ii++) { @@ -774,12 +774,12 @@ void al_draw_filled_ellipse(float cx, float cy, float rx, float ry, vertex_cache[ii].z = 0; } - al_draw_prim(vertex_cache, 0, 0, 0, num_segments + 1, ALLEGRO_PRIM_TRIANGLE_FAN); + al_draw_prim(vertex_cache, 0, 0, 0, num_segments + 1, A5O_PRIM_TRIANGLE_FAN); } /* Function: al_draw_circle */ -void al_draw_circle(float cx, float cy, float r, ALLEGRO_COLOR color, +void al_draw_circle(float cx, float cy, float r, A5O_COLOR color, float thickness) { al_draw_ellipse(cx, cy, r, r, color, thickness); @@ -787,7 +787,7 @@ void al_draw_circle(float cx, float cy, float r, ALLEGRO_COLOR color, /* Function: al_draw_filled_circle */ -void al_draw_filled_circle(float cx, float cy, float r, ALLEGRO_COLOR color) +void al_draw_filled_circle(float cx, float cy, float r, A5O_COLOR color) { al_draw_filled_ellipse(cx, cy, r, r, color); } @@ -795,57 +795,57 @@ void al_draw_filled_circle(float cx, float cy, float r, ALLEGRO_COLOR color) /* Function: al_draw_elliptical_arc */ void al_draw_elliptical_arc(float cx, float cy, float rx, float ry, float start_theta, - float delta_theta, ALLEGRO_COLOR color, float thickness) + float delta_theta, A5O_COLOR color, float thickness) { LOCAL_VERTEX_CACHE; float scale = get_scale(); ASSERT(rx >= 0 && ry >= 0); if (thickness > 0) { - int num_segments = fabs(delta_theta / (2 * ALLEGRO_PI) * ALLEGRO_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f)); + int num_segments = fabs(delta_theta / (2 * A5O_PI) * A5O_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f)); int ii; if (num_segments < 2) num_segments = 2; - if (2 * num_segments >= ALLEGRO_VERTEX_CACHE_SIZE) { - num_segments = (ALLEGRO_VERTEX_CACHE_SIZE - 1) / 2; + if (2 * num_segments >= A5O_VERTEX_CACHE_SIZE) { + num_segments = (A5O_VERTEX_CACHE_SIZE - 1) / 2; } - al_calculate_arc(&(vertex_cache[0].x), sizeof(ALLEGRO_VERTEX), cx, cy, rx, ry, start_theta, delta_theta, thickness, num_segments); + al_calculate_arc(&(vertex_cache[0].x), sizeof(A5O_VERTEX), cx, cy, rx, ry, start_theta, delta_theta, thickness, num_segments); for (ii = 0; ii < 2 * num_segments; ii++) { vertex_cache[ii].color = color; vertex_cache[ii].z = 0; } - al_draw_prim(vertex_cache, 0, 0, 0, 2 * num_segments, ALLEGRO_PRIM_TRIANGLE_STRIP); + al_draw_prim(vertex_cache, 0, 0, 0, 2 * num_segments, A5O_PRIM_TRIANGLE_STRIP); } else { - int num_segments = fabs(delta_theta / (2 * ALLEGRO_PI) * ALLEGRO_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f)); + int num_segments = fabs(delta_theta / (2 * A5O_PI) * A5O_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f)); int ii; if (num_segments < 2) num_segments = 2; - if (num_segments >= ALLEGRO_VERTEX_CACHE_SIZE) { - num_segments = ALLEGRO_VERTEX_CACHE_SIZE - 1; + if (num_segments >= A5O_VERTEX_CACHE_SIZE) { + num_segments = A5O_VERTEX_CACHE_SIZE - 1; } - al_calculate_arc(&(vertex_cache[0].x), sizeof(ALLEGRO_VERTEX), cx, cy, rx, ry, start_theta, delta_theta, 0, num_segments); + al_calculate_arc(&(vertex_cache[0].x), sizeof(A5O_VERTEX), cx, cy, rx, ry, start_theta, delta_theta, 0, num_segments); for (ii = 0; ii < num_segments; ii++) { vertex_cache[ii].color = color; vertex_cache[ii].z = 0; } - al_draw_prim(vertex_cache, 0, 0, 0, num_segments, ALLEGRO_PRIM_LINE_STRIP); + al_draw_prim(vertex_cache, 0, 0, 0, num_segments, A5O_PRIM_LINE_STRIP); } } /* Function: al_draw_arc */ void al_draw_arc(float cx, float cy, float r, float start_theta, - float delta_theta, ALLEGRO_COLOR color, float thickness) + float delta_theta, A5O_COLOR color, float thickness) { al_draw_elliptical_arc(cx, cy, r, r, start_theta, delta_theta, color, thickness); } @@ -853,7 +853,7 @@ void al_draw_arc(float cx, float cy, float r, float start_theta, /* Function: al_draw_rounded_rectangle */ void al_draw_rounded_rectangle(float x1, float y1, float x2, float y2, - float rx, float ry, ALLEGRO_COLOR color, float thickness) + float rx, float ry, A5O_COLOR color, float thickness) { LOCAL_VERTEX_CACHE; float scale = get_scale(); @@ -862,7 +862,7 @@ void al_draw_rounded_rectangle(float x1, float y1, float x2, float y2, ASSERT(ry >= 0); if (thickness > 0) { - int num_segments = ALLEGRO_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f) / 4; + int num_segments = A5O_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f) / 4; int ii; /* In case rx and ry are both 0. */ @@ -871,11 +871,11 @@ void al_draw_rounded_rectangle(float x1, float y1, float x2, float y2, return; } - if (8 * num_segments + 2 >= ALLEGRO_VERTEX_CACHE_SIZE) { - num_segments = (ALLEGRO_VERTEX_CACHE_SIZE - 3) / 8; + if (8 * num_segments + 2 >= A5O_VERTEX_CACHE_SIZE) { + num_segments = (A5O_VERTEX_CACHE_SIZE - 3) / 8; } - al_calculate_arc(&(vertex_cache[0].x), sizeof(ALLEGRO_VERTEX), 0, 0, rx, ry, 0, ALLEGRO_PI / 2, thickness, num_segments); + al_calculate_arc(&(vertex_cache[0].x), sizeof(A5O_VERTEX), 0, 0, rx, ry, 0, A5O_PI / 2, thickness, num_segments); for (ii = 0; ii < 2 * num_segments; ii += 2) { vertex_cache[ii + 2 * num_segments + 1].x = x1 + rx - vertex_cache[2 * num_segments - 1 - ii].x; @@ -907,9 +907,9 @@ void al_draw_rounded_rectangle(float x1, float y1, float x2, float y2, vertex_cache[ii].z = 0; } - al_draw_prim(vertex_cache, 0, 0, 0, 8 * num_segments + 2, ALLEGRO_PRIM_TRIANGLE_STRIP); + al_draw_prim(vertex_cache, 0, 0, 0, 8 * num_segments + 2, A5O_PRIM_TRIANGLE_STRIP); } else { - int num_segments = ALLEGRO_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f) / 4; + int num_segments = A5O_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f) / 4; int ii; /* In case rx and ry are both 0. */ @@ -918,11 +918,11 @@ void al_draw_rounded_rectangle(float x1, float y1, float x2, float y2, return; } - if (num_segments * 4 >= ALLEGRO_VERTEX_CACHE_SIZE) { - num_segments = (ALLEGRO_VERTEX_CACHE_SIZE - 1) / 4; + if (num_segments * 4 >= A5O_VERTEX_CACHE_SIZE) { + num_segments = (A5O_VERTEX_CACHE_SIZE - 1) / 4; } - al_calculate_arc(&(vertex_cache[0].x), sizeof(ALLEGRO_VERTEX), 0, 0, rx, ry, 0, ALLEGRO_PI / 2, 0, num_segments + 1); + al_calculate_arc(&(vertex_cache[0].x), sizeof(A5O_VERTEX), 0, 0, rx, ry, 0, A5O_PI / 2, 0, num_segments + 1); for (ii = 0; ii < num_segments; ii++) { vertex_cache[ii + 1 * num_segments].x = x1 + rx - vertex_cache[num_segments - 1 - ii].x; @@ -944,19 +944,19 @@ void al_draw_rounded_rectangle(float x1, float y1, float x2, float y2, vertex_cache[ii].z = 0; } - al_draw_prim(vertex_cache, 0, 0, 0, 4 * num_segments, ALLEGRO_PRIM_LINE_LOOP); + al_draw_prim(vertex_cache, 0, 0, 0, 4 * num_segments, A5O_PRIM_LINE_LOOP); } } /* Function: al_draw_filled_rounded_rectangle */ void al_draw_filled_rounded_rectangle(float x1, float y1, float x2, float y2, - float rx, float ry, ALLEGRO_COLOR color) + float rx, float ry, A5O_COLOR color) { LOCAL_VERTEX_CACHE; int ii; float scale = get_scale(); - int num_segments = ALLEGRO_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f) / 4; + int num_segments = A5O_PRIM_QUALITY * sqrtf(scale * (rx + ry) / 2.0f) / 4; ASSERT(rx >= 0); ASSERT(ry >= 0); @@ -967,11 +967,11 @@ void al_draw_filled_rounded_rectangle(float x1, float y1, float x2, float y2, return; } - if (num_segments * 4 >= ALLEGRO_VERTEX_CACHE_SIZE) { - num_segments = (ALLEGRO_VERTEX_CACHE_SIZE - 1) / 4; + if (num_segments * 4 >= A5O_VERTEX_CACHE_SIZE) { + num_segments = (A5O_VERTEX_CACHE_SIZE - 1) / 4; } - al_calculate_arc(&(vertex_cache[0].x), sizeof(ALLEGRO_VERTEX), 0, 0, rx, ry, 0, ALLEGRO_PI / 2, 0, num_segments + 1); + al_calculate_arc(&(vertex_cache[0].x), sizeof(A5O_VERTEX), 0, 0, rx, ry, 0, A5O_PI / 2, 0, num_segments + 1); for (ii = 0; ii < num_segments; ii++) { vertex_cache[ii + 1 * num_segments].x = x1 + rx - vertex_cache[num_segments - 1 - ii].x; @@ -996,7 +996,7 @@ void al_draw_filled_rounded_rectangle(float x1, float y1, float x2, float y2, /* TODO: Doing this as a triangle fan just doesn't sound all that great, perhaps shuffle the vertices somehow to at least make it a strip */ - al_draw_prim(vertex_cache, 0, 0, 0, 4 * num_segments, ALLEGRO_PRIM_TRIANGLE_FAN); + al_draw_prim(vertex_cache, 0, 0, 0, 4 * num_segments, A5O_PRIM_TRIANGLE_FAN); } /* Function: al_calculate_spline @@ -1080,45 +1080,45 @@ void al_calculate_spline(float* dest, int stride, const float points[8], /* Function: al_draw_spline */ -void al_draw_spline(const float points[8], ALLEGRO_COLOR color, float thickness) +void al_draw_spline(const float points[8], A5O_COLOR color, float thickness) { int ii; float scale = get_scale(); int num_segments = (int)(sqrtf(hypotf(points[2] - points[0], points[3] - points[1]) + hypotf(points[4] - points[2], points[5] - points[3]) + hypotf(points[6] - points[4], points[7] - points[5])) * - 1.2 * ALLEGRO_PRIM_QUALITY * scale / 10); + 1.2 * A5O_PRIM_QUALITY * scale / 10); LOCAL_VERTEX_CACHE; if(num_segments < 2) num_segments = 2; if (thickness > 0) { - if (2 * num_segments >= ALLEGRO_VERTEX_CACHE_SIZE) { - num_segments = (ALLEGRO_VERTEX_CACHE_SIZE - 1) / 2; + if (2 * num_segments >= A5O_VERTEX_CACHE_SIZE) { + num_segments = (A5O_VERTEX_CACHE_SIZE - 1) / 2; } - al_calculate_spline(&(vertex_cache[0].x), sizeof(ALLEGRO_VERTEX), points, thickness, num_segments); + al_calculate_spline(&(vertex_cache[0].x), sizeof(A5O_VERTEX), points, thickness, num_segments); for (ii = 0; ii < 2 * num_segments; ii++) { vertex_cache[ii].color = color; vertex_cache[ii].z = 0; } - al_draw_prim(vertex_cache, 0, 0, 0, 2 * num_segments, ALLEGRO_PRIM_TRIANGLE_STRIP); + al_draw_prim(vertex_cache, 0, 0, 0, 2 * num_segments, A5O_PRIM_TRIANGLE_STRIP); } else { - if (num_segments >= ALLEGRO_VERTEX_CACHE_SIZE) { - num_segments = ALLEGRO_VERTEX_CACHE_SIZE - 1; + if (num_segments >= A5O_VERTEX_CACHE_SIZE) { + num_segments = A5O_VERTEX_CACHE_SIZE - 1; } - al_calculate_spline(&(vertex_cache[0].x), sizeof(ALLEGRO_VERTEX), points, thickness, num_segments); + al_calculate_spline(&(vertex_cache[0].x), sizeof(A5O_VERTEX), points, thickness, num_segments); for (ii = 0; ii < num_segments; ii++) { vertex_cache[ii].color = color; vertex_cache[ii].z = 0; } - al_draw_prim(vertex_cache, 0, 0, 0, num_segments, ALLEGRO_PRIM_LINE_STRIP); + al_draw_prim(vertex_cache, 0, 0, 0, num_segments, A5O_PRIM_LINE_STRIP); } } @@ -1246,18 +1246,18 @@ void al_calculate_ribbon(float* dest, int dest_stride, const float *points, /* Function: al_draw_ribbon */ -void al_draw_ribbon(const float *points, int points_stride, ALLEGRO_COLOR color, +void al_draw_ribbon(const float *points, int points_stride, A5O_COLOR color, float thickness, int num_segments) { LOCAL_VERTEX_CACHE; int ii; - if (num_segments * (thickness > 0 ? 2 : 1) > ALLEGRO_VERTEX_CACHE_SIZE) { - ALLEGRO_ERROR("Ribbon has too many segments.\n"); + if (num_segments * (thickness > 0 ? 2 : 1) > A5O_VERTEX_CACHE_SIZE) { + A5O_ERROR("Ribbon has too many segments.\n"); return; } - al_calculate_ribbon(&(vertex_cache[0].x), sizeof(ALLEGRO_VERTEX), points, points_stride, thickness, num_segments); + al_calculate_ribbon(&(vertex_cache[0].x), sizeof(A5O_VERTEX), points, points_stride, thickness, num_segments); if (thickness > 0) { for (ii = 0; ii < 2 * num_segments; ii++) { @@ -1265,14 +1265,14 @@ void al_draw_ribbon(const float *points, int points_stride, ALLEGRO_COLOR color, vertex_cache[ii].z = 0; } - al_draw_prim(vertex_cache, 0, 0, 0, 2 * num_segments, ALLEGRO_PRIM_TRIANGLE_STRIP); + al_draw_prim(vertex_cache, 0, 0, 0, 2 * num_segments, A5O_PRIM_TRIANGLE_STRIP); } else { for (ii = 0; ii < num_segments; ii++) { vertex_cache[ii].color = color; vertex_cache[ii].z = 0; } - al_draw_prim(vertex_cache, 0, 0, 0, num_segments, ALLEGRO_PRIM_LINE_STRIP); + al_draw_prim(vertex_cache, 0, 0, 0, num_segments, A5O_PRIM_LINE_STRIP); } } diff --git a/addons/primitives/line_soft.c b/addons/primitives/line_soft.c index a43b9ac2d1..8db1b84d58 100644 --- a/addons/primitives/line_soft.c +++ b/addons/primitives/line_soft.c @@ -17,7 +17,7 @@ */ -#define ALLEGRO_INTERNAL_UNSTABLE +#define A5O_INTERNAL_UNSTABLE #define _AL_NO_BLEND_INLINE_FUNC #include "allegro5/allegro.h" @@ -35,11 +35,11 @@ shader_{texture}_{grad,solid}_{any,rgb888,rgba8888,etc}_{draw_{shade,opaque},ste */ typedef void (*shader_draw)(uintptr_t, int, int); -typedef void (*shader_first)(uintptr_t, int, int, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*); +typedef void (*shader_first)(uintptr_t, int, int, A5O_VERTEX*, A5O_VERTEX*); typedef void (*shader_step)(uintptr_t, int); typedef struct { - ALLEGRO_COLOR color; + A5O_COLOR color; } state_solid_any_2d; static void shader_solid_any_draw_shade(uintptr_t state, int x, int y) @@ -54,7 +54,7 @@ static void shader_solid_any_draw_opaque(uintptr_t state, int x, int y) al_put_pixel(x, y, s->color); } -static void shader_solid_any_first(uintptr_t state, int start_x, int start_y, ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2) +static void shader_solid_any_first(uintptr_t state, int start_x, int start_y, A5O_VERTEX* v1, A5O_VERTEX* v2) { state_solid_any_2d* s = (state_solid_any_2d*)state; s->color = v1->color; @@ -74,11 +74,11 @@ static void shader_solid_any_step(uintptr_t state, int minor_step) typedef struct { state_solid_any_2d solid; - ALLEGRO_COLOR minor_color; - ALLEGRO_COLOR major_color; + A5O_COLOR minor_color; + A5O_COLOR major_color; } state_grad_any_2d; -static void get_interpolation_parameters(int start_x, int start_y, ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, float* param, float* minor_delta_param, float* major_delta_param) +static void get_interpolation_parameters(int start_x, int start_y, A5O_VERTEX* v1, A5O_VERTEX* v2, float* param, float* minor_delta_param, float* major_delta_param) { float dx = v2->x - v1->x; float dy = v2->y - v1->y; @@ -101,13 +101,13 @@ static void get_interpolation_parameters(int start_x, int start_y, ALLEGRO_VERTE *major_delta_param = (dx + dy) / lensq; } -static void shader_grad_any_first(uintptr_t state, int start_x, int start_y, ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2) +static void shader_grad_any_first(uintptr_t state, int start_x, int start_y, A5O_VERTEX* v1, A5O_VERTEX* v2) { float param; float minor_delta_param; float major_delta_param; state_grad_any_2d* st = (state_grad_any_2d*)state; - ALLEGRO_COLOR diff, v1c, v2c; + A5O_COLOR diff, v1c, v2c; v1c = v1->color; v2c = v2->color; @@ -160,8 +160,8 @@ static void shader_grad_any_step(uintptr_t state, int minor_step) A.a = B.a * A.a; typedef struct { - ALLEGRO_COLOR color; - ALLEGRO_BITMAP* texture; + A5O_COLOR color; + A5O_BITMAP* texture; int w, h; float u, v; float minor_du; @@ -172,7 +172,7 @@ typedef struct { static void get_texcoords(state_texture_solid_any_2d *s, int *u, int *v) { - ALLEGRO_BITMAP_WRAP wrap_u, wrap_v; + A5O_BITMAP_WRAP wrap_u, wrap_v; _al_get_bitmap_wrap(s->texture, &wrap_u, &wrap_v); *u = _al_fix_texcoord(s->u, s->w, wrap_u); *v = _al_fix_texcoord(s->v, s->h, wrap_v); @@ -185,7 +185,7 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x, int y) state_texture_solid_any_2d* s = (state_texture_solid_any_2d*)state; GET_UV - ALLEGRO_COLOR color = al_get_pixel(s->texture, u, v); + A5O_COLOR color = al_get_pixel(s->texture, u, v); SHADE_COLORS(color, s->color) al_put_blended_pixel(x, y, color); } @@ -203,7 +203,7 @@ static void shader_texture_solid_any_draw_opaque(uintptr_t state, int x, int y) state_texture_solid_any_2d* s = (state_texture_solid_any_2d*)state; GET_UV - ALLEGRO_COLOR color = al_get_pixel(s->texture, u, v); + A5O_COLOR color = al_get_pixel(s->texture, u, v); SHADE_COLORS(color, s->color) al_put_pixel(x, y, color); } @@ -216,14 +216,14 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x, i al_put_pixel(x, y, al_get_pixel(s->texture, u, v)); } -static void shader_texture_solid_any_first(uintptr_t state, int start_x, int start_y, ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2) +static void shader_texture_solid_any_first(uintptr_t state, int start_x, int start_y, A5O_VERTEX* v1, A5O_VERTEX* v2) { float param; float minor_delta_param; float major_delta_param; state_texture_solid_any_2d* st = (state_texture_solid_any_2d*)state; float du, dv; - ALLEGRO_COLOR v1c; + A5O_COLOR v1c; v1c = v1->color; @@ -266,18 +266,18 @@ static void shader_texture_solid_any_step(uintptr_t state, int minor_step) typedef struct { state_texture_solid_any_2d solid; - ALLEGRO_COLOR minor_color; - ALLEGRO_COLOR major_color; + A5O_COLOR minor_color; + A5O_COLOR major_color; } state_texture_grad_any_2d; -static void shader_texture_grad_any_first(uintptr_t state, int start_x, int start_y, ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2) +static void shader_texture_grad_any_first(uintptr_t state, int start_x, int start_y, A5O_VERTEX* v1, A5O_VERTEX* v2) { float param; float minor_delta_param; float major_delta_param; state_texture_grad_any_2d* st = (state_texture_grad_any_2d*)state; float du, dv; - ALLEGRO_COLOR diff, v1c, v2c; + A5O_COLOR diff, v1c, v2c; v1c = v1->color; v2c = v2->color; @@ -342,14 +342,14 @@ static void shader_texture_grad_any_step(uintptr_t state, int minor_step) } } -static void line_stepper(uintptr_t state, shader_first first, shader_step step, shader_draw draw, ALLEGRO_VERTEX* vtx1, ALLEGRO_VERTEX* vtx2) +static void line_stepper(uintptr_t state, shader_first first, shader_step step, shader_draw draw, A5O_VERTEX* vtx1, A5O_VERTEX* vtx2) { float x1, y1, x2, y2; float dx, dy; int end_x, end_y; if (vtx2->y < vtx1->y) { - ALLEGRO_VERTEX* t; + A5O_VERTEX* t; t = vtx1; vtx1 = vtx2; vtx2 = t; @@ -495,12 +495,12 @@ static void line_stepper(uintptr_t state, shader_first first, shader_step step, This one will check to see what exactly we need to draw... I.e. this will call all of the actual renderers and set the appropriate callbacks */ -void _al_line_2d(ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2) +void _al_line_2d(A5O_BITMAP* texture, A5O_VERTEX* v1, A5O_VERTEX* v2) { int shade = 1; int grad = 1; int op, src_mode, dst_mode, op_alpha, src_alpha, dst_alpha; - ALLEGRO_COLOR v1c, v2c; + A5O_COLOR v1c, v2c; v1c = v1->color; v2c = v2->color; @@ -568,19 +568,19 @@ void _al_line_2d(ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2 /* Function: al_draw_soft_line */ -void al_draw_soft_line(ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, uintptr_t state, - void (*first)(uintptr_t, int, int, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*), +void al_draw_soft_line(A5O_VERTEX* v1, A5O_VERTEX* v2, uintptr_t state, + void (*first)(uintptr_t, int, int, A5O_VERTEX*, A5O_VERTEX*), void (*step)(uintptr_t, int), void (*draw)(uintptr_t, int, int)) { /* Copy the vertices, because we need to alter them a bit before drawing. */ - ALLEGRO_VERTEX vtx1 = *v1; - ALLEGRO_VERTEX vtx2 = *v2; - ALLEGRO_BITMAP *target = al_get_target_bitmap(); + A5O_VERTEX vtx1 = *v1; + A5O_VERTEX vtx2 = *v2; + A5O_BITMAP *target = al_get_target_bitmap(); int need_unlock = 0; - ALLEGRO_LOCKED_REGION *lr; + A5O_LOCKED_REGION *lr; int min_x, max_x, min_y, max_y; int clip_min_x, clip_min_y, clip_max_x, clip_max_y; @@ -635,7 +635,7 @@ void al_draw_soft_line(ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, uintptr_t state, _al_pixel_format_is_video_only(target->locked_region.format)) return; } else { - if (!(lr = al_lock_bitmap_region(target, min_x, min_y, max_x - min_x, max_y - min_y, ALLEGRO_PIXEL_FORMAT_ANY, 0))) + if (!(lr = al_lock_bitmap_region(target, min_x, min_y, max_x - min_x, max_y - min_y, A5O_PIXEL_FORMAT_ANY, 0))) return; need_unlock = 1; } diff --git a/addons/primitives/point_soft.c b/addons/primitives/point_soft.c index 1ed4b2bc85..60c2186320 100644 --- a/addons/primitives/point_soft.c +++ b/addons/primitives/point_soft.c @@ -19,7 +19,7 @@ #define _AL_NO_BLEND_INLINE_FUNC -#define ALLEGRO_INTERNAL_UNSTABLE +#define A5O_INTERNAL_UNSTABLE #include "allegro5/allegro.h" #include "allegro5/allegro_primitives.h" #include "allegro5/internal/aintern_bitmap.h" @@ -28,12 +28,12 @@ #include "allegro5/internal/aintern_prim_soft.h" #include -int _al_fix_texcoord(float var, int max_var, ALLEGRO_BITMAP_WRAP wrap) +int _al_fix_texcoord(float var, int max_var, A5O_BITMAP_WRAP wrap) { int ivar = (int)floorf(var); float ret; switch (wrap) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (ivar < 0) ret = 0; else if (ivar > max_var - 1) @@ -41,7 +41,7 @@ int _al_fix_texcoord(float var, int max_var, ALLEGRO_BITMAP_WRAP wrap) else ret = ivar; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: { + case A5O_BITMAP_WRAP_MIRROR: { ret = ivar % max_var; if(ret < 0) ret += max_var; @@ -58,11 +58,11 @@ int _al_fix_texcoord(float var, int max_var, ALLEGRO_BITMAP_WRAP wrap) return ret; } -void _al_point_2d(ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX* v) +void _al_point_2d(A5O_BITMAP* texture, A5O_VERTEX* v) { int shade = 1; int op, src_mode, dst_mode, op_alpha, src_alpha, dst_alpha; - ALLEGRO_COLOR vc; + A5O_COLOR vc; int clip_min_x, clip_min_y, clip_max_x, clip_max_y; int x = (int)floorf(v->x); int y = (int)floorf(v->x); @@ -82,11 +82,11 @@ void _al_point_2d(ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX* v) } if (texture) { - ALLEGRO_BITMAP_WRAP wrap_u, wrap_v; + A5O_BITMAP_WRAP wrap_u, wrap_v; _al_get_bitmap_wrap(texture, &wrap_u, &wrap_v); int iu = _al_fix_texcoord(v->u, al_get_bitmap_width(texture), wrap_u); int iv = _al_fix_texcoord(v->v, al_get_bitmap_height(texture), wrap_v); - ALLEGRO_COLOR color = al_get_pixel(texture, iu, iv); + A5O_COLOR color = al_get_pixel(texture, iu, iv); if(vc.r != 1 || vc.g != 1 || vc.b != 1 || vc.a != 1) { color.r *= vc.r; @@ -101,7 +101,7 @@ void _al_point_2d(ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX* v) al_put_pixel(v->x, v->y, color); } } else { - ALLEGRO_COLOR color = al_map_rgba_f(vc.r, vc.g, vc.b, vc.a); + A5O_COLOR color = al_map_rgba_f(vc.r, vc.g, vc.b, vc.a); if (shade) { al_put_blended_pixel(v->x, v->y, color); } else { diff --git a/addons/primitives/polygon.c b/addons/primitives/polygon.c index d245629be7..26d01ac5a8 100644 --- a/addons/primitives/polygon.c +++ b/addons/primitives/polygon.c @@ -21,13 +21,13 @@ #include "allegro5/internal/aintern_prim.h" #include -#ifdef ALLEGRO_MSVC +#ifdef A5O_MSVC #define hypotf(x, y) _hypotf((x), (y)) #endif static void polygon_push_triangle_callback(int i0, int i1, int i2, void* user_data) { - ALLEGRO_PRIM_VERTEX_CACHE* cache = (ALLEGRO_PRIM_VERTEX_CACHE*)user_data; + A5O_PRIM_VERTEX_CACHE* cache = (A5O_PRIM_VERTEX_CACHE*)user_data; const float* vertices = (const float*)cache->user_data; @@ -42,21 +42,21 @@ static void polygon_push_triangle_callback(int i0, int i1, int i2, void* user_da /* Function: al_draw_polygon */ void al_draw_polygon(const float *vertices, int vertex_count, - int join_style, ALLEGRO_COLOR color, float thickness, float miter_limit) + int join_style, A5O_COLOR color, float thickness, float miter_limit) { al_draw_polyline(vertices, 2 * sizeof(float), vertex_count, join_style, - ALLEGRO_LINE_CAP_CLOSED, color, thickness, miter_limit); + A5O_LINE_CAP_CLOSED, color, thickness, miter_limit); } /* Function: al_draw_filled_polygon */ void al_draw_filled_polygon(const float *vertices, int vertex_count, - ALLEGRO_COLOR color) + A5O_COLOR color) { - ALLEGRO_PRIM_VERTEX_CACHE cache; + A5O_PRIM_VERTEX_CACHE cache; int vertex_counts[2]; - _al_prim_cache_init_ex(&cache, ALLEGRO_PRIM_VERTEX_CACHE_TRIANGLE, color, (void*)vertices); + _al_prim_cache_init_ex(&cache, A5O_PRIM_VERTEX_CACHE_TRIANGLE, color, (void*)vertices); vertex_counts[0] = vertex_count; vertex_counts[1] = 0; /* terminator */ @@ -69,11 +69,11 @@ void al_draw_filled_polygon(const float *vertices, int vertex_count, /* Function: al_draw_filled_polygon_with_holes */ void al_draw_filled_polygon_with_holes(const float *vertices, - const int *vertex_counts, ALLEGRO_COLOR color) + const int *vertex_counts, A5O_COLOR color) { - ALLEGRO_PRIM_VERTEX_CACHE cache; + A5O_PRIM_VERTEX_CACHE cache; - _al_prim_cache_init_ex(&cache, ALLEGRO_PRIM_VERTEX_CACHE_TRIANGLE, color, (void*)vertices); + _al_prim_cache_init_ex(&cache, A5O_PRIM_VERTEX_CACHE_TRIANGLE, color, (void*)vertices); al_triangulate_polygon(vertices, sizeof(float) * 2, vertex_counts, polygon_push_triangle_callback, &cache); diff --git a/addons/primitives/polyline.c b/addons/primitives/polyline.c index 5dc17c2197..07ba05e64e 100644 --- a/addons/primitives/polyline.c +++ b/addons/primitives/polyline.c @@ -170,7 +170,7 @@ static void compute_cross_points(const float* v0, const float* v1, const float* * Arc is defined by pivot point, radius, start and end angle. * Starting and ending angle are wrapped to two pi range. */ -static void emit_arc(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* pivot, float start, float end, float radius, int segments) +static void emit_arc(A5O_PRIM_VERTEX_CACHE* cache, const float* pivot, float start, float end, float radius, int segments) { float arc; float c, s, t; @@ -187,14 +187,14 @@ static void emit_arc(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* pivot, float * range [0, 2 * pi) and end angle is greater than * start angle. */ - start = fmodf(start, ALLEGRO_PI * 2.0f); - end = fmodf(end, ALLEGRO_PI * 2.0f); + start = fmodf(start, A5O_PI * 2.0f); + end = fmodf(end, A5O_PI * 2.0f); if (end <= start) - end += ALLEGRO_PI * 2.0f; + end += A5O_PI * 2.0f; arc = end - start; - segments = (int)(segments * arc / ALLEGRO_PI * 2.0f); + segments = (int)(segments * arc / A5O_PI * 2.0f); if (segments < 1) segments = 1; @@ -232,7 +232,7 @@ static void emit_arc(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* pivot, float * and double radius, first along direction second along normal * direction. */ -static void emit_square_end_cap(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* pivot, const float* dir, const float* normal, float radius) +static void emit_square_end_cap(A5O_PRIM_VERTEX_CACHE* cache, const float* pivot, const float* dir, const float* normal, float radius) { /* Prepare all four vertices of the rectangle. */ float v0[2] = { pivot[0] + normal[0] * radius, pivot[1] + normal[1] * radius }; @@ -248,7 +248,7 @@ static void emit_square_end_cap(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* p /* * Emits triangular cap. */ -static void emit_triange_end_cap(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* pivot, const float* dir, const float* normal, float radius) +static void emit_triange_end_cap(A5O_PRIM_VERTEX_CACHE* cache, const float* pivot, const float* dir, const float* normal, float radius) { /* Prepare all four vertices of the rectangle. */ float v0[2] = { pivot[0] + normal[0] * radius, pivot[1] + normal[1] * radius }; @@ -262,14 +262,14 @@ static void emit_triange_end_cap(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* /* * Emits rounded cap. */ -static void emit_round_end_cap(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* pivot, const float* dir, const float* normal, float radius) +static void emit_round_end_cap(A5O_PRIM_VERTEX_CACHE* cache, const float* pivot, const float* dir, const float* normal, float radius) { float angle = atan2f(-normal[1], -normal[0]); /* XXX delete these parameters? */ (void)dir; (void)radius; - emit_arc(cache, pivot, angle, angle + ALLEGRO_PI, radius, 16); + emit_arc(cache, pivot, angle, angle + A5O_PI, radius, 16); } /* @@ -280,7 +280,7 @@ static void emit_round_end_cap(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* pi * in v1 and specified radius. p0 have to be located on the negative and p0 on the * positive half plane defined by direction vector. */ -static void emit_end_cap(ALLEGRO_PRIM_VERTEX_CACHE* cache, int cap_style, const float* v0, const float* v1, float radius) +static void emit_end_cap(A5O_PRIM_VERTEX_CACHE* cache, int cap_style, const float* v0, const float* v1, float radius) { float dir[2]; float normal[2]; @@ -288,21 +288,21 @@ static void emit_end_cap(ALLEGRO_PRIM_VERTEX_CACHE* cache, int cap_style, const /* Do do not want you to call this function for closed cap. * It is special and there is nothing we can do with it there. */ - ASSERT(cap_style != ALLEGRO_LINE_CAP_CLOSED); + ASSERT(cap_style != A5O_LINE_CAP_CLOSED); /* There nothing we can do for this kind of ending cap. */ - if (cap_style == ALLEGRO_LINE_CAP_NONE) + if (cap_style == A5O_LINE_CAP_NONE) return; /* Compute normal and direction for our segment. */ compute_direction_and_normal(v0, v1, dir, normal); /* Emit vertices for cap. */ - if (cap_style == ALLEGRO_LINE_CAP_SQUARE) + if (cap_style == A5O_LINE_CAP_SQUARE) emit_square_end_cap(cache, v1, dir, normal, radius); - else if (cap_style == ALLEGRO_LINE_CAP_TRIANGLE) + else if (cap_style == A5O_LINE_CAP_TRIANGLE) emit_triange_end_cap(cache, v1, dir, normal, radius); - else if (cap_style == ALLEGRO_LINE_CAP_ROUND) + else if (cap_style == A5O_LINE_CAP_ROUND) emit_round_end_cap(cache, v1, dir, normal, radius); else { @@ -313,7 +313,7 @@ static void emit_end_cap(ALLEGRO_PRIM_VERTEX_CACHE* cache, int cap_style, const /* * Emits bevel join. */ -static void emit_bevel_join(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* pivot, const float* p0, const float* p1) +static void emit_bevel_join(A5O_PRIM_VERTEX_CACHE* cache, const float* pivot, const float* p0, const float* p1) { _al_prim_cache_push_triangle(cache, pivot, p0, p1); } @@ -321,13 +321,13 @@ static void emit_bevel_join(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* pivot /* * Emits round join. */ -static void emit_round_join(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* pivot, const float* p0, const float* p1, float radius) +static void emit_round_join(A5O_PRIM_VERTEX_CACHE* cache, const float* pivot, const float* p0, const float* p1, float radius) { float start = atan2f(p1[1] - pivot[1], p1[0] - pivot[0]); float end = atan2f(p0[1] - pivot[1], p0[0] - pivot[0]); if (end < start) - end += ALLEGRO_PI * 2.0f; + end += A5O_PI * 2.0f; emit_arc(cache, pivot, start, end, radius, 16); } @@ -335,7 +335,7 @@ static void emit_round_join(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* pivot /* * Emits miter join. */ -static void emit_miter_join(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* pivot, const float* p0, const float* p1, +static void emit_miter_join(A5O_PRIM_VERTEX_CACHE* cache, const float* pivot, const float* p0, const float* p1, float radius, const float* middle, float angle, float miter_distance, float max_miter_distance) { /* XXX delete this parameter? */ @@ -345,7 +345,7 @@ static void emit_miter_join(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* pivot float normal[2] = { -middle[1], middle[0] }; - float offset = (miter_distance - max_miter_distance) * tanf((ALLEGRO_PI - fabsf(angle)) * 0.5f); + float offset = (miter_distance - max_miter_distance) * tanf((A5O_PI - fabsf(angle)) * 0.5f); float v0[2] = { pivot[0] + middle[0] * max_miter_distance + normal[0] * offset, @@ -376,19 +376,19 @@ static void emit_miter_join(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* pivot /* Emit join between segments. */ -static void emit_join(ALLEGRO_PRIM_VERTEX_CACHE* cache, int join_style, const float* pivot, +static void emit_join(A5O_PRIM_VERTEX_CACHE* cache, int join_style, const float* pivot, const float* p0, const float* p1, float radius, const float* middle, float angle, float miter_distance, float miter_limit) { /* There is nothing to do for this type of join. */ - if (join_style == ALLEGRO_LINE_JOIN_NONE) + if (join_style == A5O_LINE_JOIN_NONE) return; - if (join_style == ALLEGRO_LINE_JOIN_BEVEL) + if (join_style == A5O_LINE_JOIN_BEVEL) emit_bevel_join(cache, pivot, p0, p1); - else if (join_style == ALLEGRO_LINE_JOIN_ROUND) + else if (join_style == A5O_LINE_JOIN_ROUND) emit_round_join(cache, pivot, p0, p1, radius); - else if (join_style == ALLEGRO_LINE_JOIN_MITER) + else if (join_style == A5O_LINE_JOIN_MITER) emit_miter_join(cache, pivot, p0, p1, radius, middle, angle, miter_distance, miter_limit * radius); else { @@ -396,7 +396,7 @@ static void emit_join(ALLEGRO_PRIM_VERTEX_CACHE* cache, int join_style, const fl } } -static void emit_polyline(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* vertices, int vertex_stride, int vertex_count, int join_style, int cap_style, float thickness, float miter_limit) +static void emit_polyline(A5O_PRIM_VERTEX_CACHE* cache, const float* vertices, int vertex_stride, int vertex_count, int join_style, int cap_style, float thickness, float miter_limit) { # define VERTEX(index) ((const float*)(((uint8_t*)vertices) + vertex_stride * ((vertex_count + (index)) % vertex_count))) @@ -418,11 +418,11 @@ static void emit_polyline(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* vertice /* Single line cannot be closed. If user forgot to explicitly specify * most desired alternative cap style, we just disable capping at all. */ - if (vertex_count == 2 && cap_style == ALLEGRO_LINE_CAP_CLOSED) - cap_style = ALLEGRO_LINE_CAP_NONE; + if (vertex_count == 2 && cap_style == A5O_LINE_CAP_CLOSED) + cap_style = A5O_LINE_CAP_NONE; /* Prepare initial set of vertices. */ - if (cap_style != ALLEGRO_LINE_CAP_CLOSED) + if (cap_style != A5O_LINE_CAP_CLOSED) { /* We can emit ending caps right now. * @@ -461,7 +461,7 @@ static void emit_polyline(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* vertice const float* v2 = VERTEX(i + 1); /* Choose correct cross points. */ - if ((cap_style == ALLEGRO_LINE_CAP_CLOSED) || (i < steps - 1)) { + if ((cap_style == A5O_LINE_CAP_CLOSED) || (i < steps - 1)) { float middle[2]; float miter_distance; @@ -493,11 +493,11 @@ static void emit_polyline(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* vertice # undef VERTEX } -static void do_draw_polyline(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* vertices, int vertex_stride, int vertex_count, int join_style, int cap_style, ALLEGRO_COLOR color, float thickness, float miter_limit) +static void do_draw_polyline(A5O_PRIM_VERTEX_CACHE* cache, const float* vertices, int vertex_stride, int vertex_count, int join_style, int cap_style, A5O_COLOR color, float thickness, float miter_limit) { if (thickness > 0.0f) { - _al_prim_cache_init(cache, ALLEGRO_PRIM_VERTEX_CACHE_TRIANGLE, color); + _al_prim_cache_init(cache, A5O_PRIM_VERTEX_CACHE_TRIANGLE, color); emit_polyline(cache, vertices, vertex_stride, vertex_count, join_style, cap_style, thickness, miter_limit); _al_prim_cache_term(cache); } @@ -507,17 +507,17 @@ static void do_draw_polyline(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* vert int i; - _al_prim_cache_init(cache, ALLEGRO_PRIM_VERTEX_CACHE_LINE_STRIP, color); + _al_prim_cache_init(cache, A5O_PRIM_VERTEX_CACHE_LINE_STRIP, color); for (i = 0; i < vertex_count; ++i) { - if (cache->size >= (ALLEGRO_VERTEX_CACHE_SIZE - 2)) + if (cache->size >= (A5O_VERTEX_CACHE_SIZE - 2)) _al_prim_cache_flush(cache); _al_prim_cache_push_point(cache, VERTEX(i)); } - if (cap_style == ALLEGRO_LINE_CAP_CLOSED && vertex_count > 2) { - if (cache->size >= (ALLEGRO_VERTEX_CACHE_SIZE - 2)) + if (cap_style == A5O_LINE_CAP_CLOSED && vertex_count > 2) { + if (cache->size >= (A5O_VERTEX_CACHE_SIZE - 2)) _al_prim_cache_flush(cache); _al_prim_cache_push_point(cache, VERTEX(0)); @@ -533,9 +533,9 @@ static void do_draw_polyline(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* vert */ void al_draw_polyline(const float* vertices, int vertex_stride, int vertex_count, int join_style, int cap_style, - ALLEGRO_COLOR color, float thickness, float miter_limit) + A5O_COLOR color, float thickness, float miter_limit) { - ALLEGRO_PRIM_VERTEX_CACHE cache; + A5O_PRIM_VERTEX_CACHE cache; do_draw_polyline(&cache, vertices, vertex_stride, vertex_count, join_style, cap_style, color, thickness, miter_limit); } diff --git a/addons/primitives/prim_directx.cpp b/addons/primitives/prim_directx.cpp index 6424dfafd2..c5d0f5cb0f 100644 --- a/addons/primitives/prim_directx.cpp +++ b/addons/primitives/prim_directx.cpp @@ -16,7 +16,7 @@ * See readme.txt for copyright information. */ -#define ALLEGRO_INTERNAL_UNSTABLE +#define A5O_INTERNAL_UNSTABLE #include "allegro5/allegro.h" #include "allegro5/allegro_primitives.h" @@ -28,14 +28,14 @@ #include "allegro5/platform/alplatf.h" -#ifdef ALLEGRO_CFG_D3D +#ifdef A5O_CFG_D3D #include "allegro5/allegro_direct3d.h" #include "allegro5/internal/aintern_direct3d.h" -ALLEGRO_DEBUG_CHANNEL("d3d_primitives") +A5O_DEBUG_CHANNEL("d3d_primitives") -static ALLEGRO_MUTEX *d3d_mutex; +static A5O_MUTEX *d3d_mutex; /* * In the context of this file, legacy cards pretty much refer to older Intel cards. * They are distinguished by three misfeatures: @@ -53,7 +53,7 @@ static bool know_card_type = false; static bool is_legacy_card(void) { if (!know_card_type) { - ALLEGRO_CONFIG* sys_cfg = al_get_system_config(); + A5O_CONFIG* sys_cfg = al_get_system_config(); const char* detection_setting = al_get_config_value(sys_cfg, "graphics", "prim_d3d_legacy_detection"); detection_setting = detection_setting ? detection_setting : "default"; if (strcmp(detection_setting, "default") == 0) { @@ -67,11 +67,11 @@ static bool is_legacy_card(void) } else if(strcmp(detection_setting, "force_modern") == 0) { legacy_card = false; } else { - ALLEGRO_WARN("Invalid setting for prim_d3d_legacy_detection.\n"); + A5O_WARN("Invalid setting for prim_d3d_legacy_detection.\n"); legacy_card = false; } if (legacy_card) { - ALLEGRO_WARN("Your GPU is considered legacy! Some of the features of the primitives addon will be slower/disabled.\n"); + A5O_WARN("Your GPU is considered legacy! Some of the features of the primitives addon will be slower/disabled.\n"); } know_card_type = true; } @@ -94,13 +94,13 @@ struct DISPLAY_LOCAL_DATA { LPDIRECT3DDEVICE9 device; LPDIRECT3DVERTEXSHADER9 shader; - ALLEGRO_INDEX_BUFFER* loop_index_buffer; + A5O_INDEX_BUFFER* loop_index_buffer; }; static DISPLAY_LOCAL_DATA* display_local_data; static int display_local_data_size = 0; -static void display_invalidated(ALLEGRO_DISPLAY* display) +static void display_invalidated(A5O_DISPLAY* display) { int ii; LPDIRECT3DDEVICE9 device = al_get_d3d_device(display); @@ -125,7 +125,7 @@ static void display_invalidated(ALLEGRO_DISPLAY* display) al_unlock_mutex(d3d_mutex); } -static DISPLAY_LOCAL_DATA get_display_local_data(ALLEGRO_DISPLAY* display) +static DISPLAY_LOCAL_DATA get_display_local_data(A5O_DISPLAY* display) { LPDIRECT3DDEVICE9 device = al_get_d3d_device(display); DISPLAY_LOCAL_DATA ret; @@ -207,7 +207,7 @@ static void destroy_display_local_data(void) bool _al_init_d3d_driver(void) { - #ifdef ALLEGRO_CFG_D3D + #ifdef A5O_CFG_D3D d3d_mutex = al_create_mutex(); #endif return true; @@ -215,7 +215,7 @@ bool _al_init_d3d_driver(void) void _al_shutdown_d3d_driver(void) { - #ifdef ALLEGRO_CFG_D3D + #ifdef A5O_CFG_D3D al_destroy_mutex(d3d_mutex); al_free(legacy_buffer); d3d_mutex = NULL; @@ -229,11 +229,11 @@ void _al_shutdown_d3d_driver(void) #endif } -#ifdef ALLEGRO_CFG_D3D +#ifdef A5O_CFG_D3D static void* convert_to_legacy_vertices(const void* vtxs, int num_vertices, const int* indices, bool loop, bool pp) { - const ALLEGRO_VERTEX* vtx = (const ALLEGRO_VERTEX *)vtxs; + const A5O_VERTEX* vtx = (const A5O_VERTEX *)vtxs; int ii; int num_needed_vertices = num_vertices; size_t needed_size; @@ -245,7 +245,7 @@ static void* convert_to_legacy_vertices(const void* vtxs, int num_vertices, cons if(loop) num_needed_vertices++; - needed_size = num_needed_vertices * (pp ? sizeof(ALLEGRO_VERTEX) : sizeof(LEGACY_VERTEX)); + needed_size = num_needed_vertices * (pp ? sizeof(A5O_VERTEX) : sizeof(LEGACY_VERTEX)); if(legacy_buffer == 0) { legacy_buffer = (uint8_t *)al_malloc(needed_size); @@ -257,7 +257,7 @@ static void* convert_to_legacy_vertices(const void* vtxs, int num_vertices, cons } if (pp) { - ALLEGRO_VERTEX *buffer = (ALLEGRO_VERTEX *)legacy_buffer; + A5O_VERTEX *buffer = (A5O_VERTEX *)legacy_buffer; for(ii = 0; ii < num_vertices; ii++) { if(indices) buffer[ii] = vtx[indices[ii]]; @@ -270,7 +270,7 @@ static void* convert_to_legacy_vertices(const void* vtxs, int num_vertices, cons else { LEGACY_VERTEX *buffer = (LEGACY_VERTEX *)legacy_buffer; for(ii = 0; ii < num_vertices; ii++) { - ALLEGRO_VERTEX vertex; + A5O_VERTEX vertex; if(indices) vertex = vtx[indices[ii]]; @@ -300,13 +300,13 @@ struct D3D_STATE IDirect3DVertexShader9* old_vtx_shader; }; -static D3D_STATE setup_state(LPDIRECT3DDEVICE9 device, const ALLEGRO_VERTEX_DECL* decl, ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, DISPLAY_LOCAL_DATA data) +static D3D_STATE setup_state(LPDIRECT3DDEVICE9 device, const A5O_VERTEX_DECL* decl, A5O_BITMAP* target, A5O_BITMAP* texture, DISPLAY_LOCAL_DATA data) { D3D_STATE state; - ALLEGRO_DISPLAY *disp = _al_get_bitmap_display(target); - ALLEGRO_DISPLAY_D3D *d3d_disp = (ALLEGRO_DISPLAY_D3D *)disp; + A5O_DISPLAY *disp = _al_get_bitmap_display(target); + A5O_DISPLAY_D3D *d3d_disp = (A5O_DISPLAY_D3D *)disp; - if (!(disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE)) { + if (!(disp->flags & A5O_PROGRAMMABLE_PIPELINE)) { IDirect3DPixelShader9* old_pix_shader; device->GetVertexShader(&state.old_vtx_shader); device->GetPixelShader(&old_pix_shader); @@ -331,7 +331,7 @@ static D3D_STATE setup_state(LPDIRECT3DDEVICE9 device, const ALLEGRO_VERTEX_DECL } /* Set the vertex declarations */ - if(is_legacy_card() && !(disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE)) { + if(is_legacy_card() && !(disp->flags & A5O_PROGRAMMABLE_PIPELINE)) { device->SetFVF(A5V_LEGACY_FVF); } else { if(decl) { @@ -341,7 +341,7 @@ static D3D_STATE setup_state(LPDIRECT3DDEVICE9 device, const ALLEGRO_VERTEX_DECL } } - if(!state.old_vtx_shader || (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE)) { + if(!state.old_vtx_shader || (disp->flags & A5O_PROGRAMMABLE_PIPELINE)) { /* Set up the texture */ if (texture) { LPDIRECT3DTEXTURE9 d3d_texture; @@ -360,7 +360,7 @@ static D3D_STATE setup_state(LPDIRECT3DDEVICE9 device, const ALLEGRO_VERTEX_DECL al_get_d3d_texture_position(texture, &tex_x, &tex_y); if(decl) { - if(decl->elements[ALLEGRO_PRIM_TEX_COORD_PIXEL].attribute) { + if(decl->elements[A5O_PRIM_TEX_COORD_PIXEL].attribute) { mat[0][0] = 1.0f / desc.Width; mat[1][1] = 1.0f / desc.Height; } else { @@ -375,12 +375,12 @@ static D3D_STATE setup_state(LPDIRECT3DDEVICE9 device, const ALLEGRO_VERTEX_DECL mat[2][1] = (float)tex_y / desc.Height; - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { -#ifdef ALLEGRO_CFG_SHADER_HLSL - d3d_disp->effect->SetMatrix(ALLEGRO_SHADER_VAR_TEX_MATRIX, (D3DXMATRIX *)mat); - d3d_disp->effect->SetBool(ALLEGRO_SHADER_VAR_USE_TEX_MATRIX, true); - d3d_disp->effect->SetBool(ALLEGRO_SHADER_VAR_USE_TEX, true); - d3d_disp->effect->SetTexture(ALLEGRO_SHADER_VAR_TEX, d3d_texture); + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_SHADER_HLSL + d3d_disp->effect->SetMatrix(A5O_SHADER_VAR_TEX_MATRIX, (D3DXMATRIX *)mat); + d3d_disp->effect->SetBool(A5O_SHADER_VAR_USE_TEX_MATRIX, true); + d3d_disp->effect->SetBool(A5O_SHADER_VAR_USE_TEX, true); + d3d_disp->effect->SetTexture(A5O_SHADER_VAR_TEX, d3d_texture); #endif } else { @@ -398,7 +398,7 @@ static D3D_STATE setup_state(LPDIRECT3DDEVICE9 device, const ALLEGRO_VERTEX_DECL } else { /* Don't unbind the texture here if shaders are used, since the user may * have set the 0'th texture unit manually via the shader API. */ - if (!(disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE)) { + if (!(disp->flags & A5O_PROGRAMMABLE_PIPELINE)) { device->SetTexture(0, NULL); } } @@ -413,16 +413,16 @@ static D3D_STATE setup_state(LPDIRECT3DDEVICE9 device, const ALLEGRO_VERTEX_DECL return state; } -static void revert_state(D3D_STATE state, LPDIRECT3DDEVICE9 device, ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture) +static void revert_state(D3D_STATE state, LPDIRECT3DDEVICE9 device, A5O_BITMAP* target, A5O_BITMAP* texture) { - ALLEGRO_DISPLAY *disp = _al_get_bitmap_display(target); - ALLEGRO_DISPLAY_D3D *d3d_disp = (ALLEGRO_DISPLAY_D3D *)disp; + A5O_DISPLAY *disp = _al_get_bitmap_display(target); + A5O_DISPLAY_D3D *d3d_disp = (A5O_DISPLAY_D3D *)disp; (void)d3d_disp; -#ifdef ALLEGRO_CFG_SHADER_HLSL - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_SHADER_HLSL + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { d3d_disp->effect->End(); - d3d_disp->effect->SetBool(ALLEGRO_SHADER_VAR_USE_TEX_MATRIX, false); - d3d_disp->effect->SetBool(ALLEGRO_SHADER_VAR_USE_TEX, false); + d3d_disp->effect->SetBool(A5O_SHADER_VAR_USE_TEX_MATRIX, false); + d3d_disp->effect->SetBool(A5O_SHADER_VAR_USE_TEX, false); } #endif @@ -435,22 +435,22 @@ static void revert_state(D3D_STATE state, LPDIRECT3DDEVICE9 device, ALLEGRO_BITM device->SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, state.old_ttf_state); } - if (!(disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE)) { + if (!(disp->flags & A5O_PROGRAMMABLE_PIPELINE)) { if(!state.old_vtx_shader) device->SetVertexShader(0); } } -static int draw_prim_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, - const void* vtx, const ALLEGRO_VERTEX_DECL* decl, +static int draw_prim_raw(A5O_BITMAP* target, A5O_BITMAP* texture, + const void* vtx, const A5O_VERTEX_DECL* decl, const int* indices, int num_vtx, int type) { int stride; int num_primitives = 0; LPDIRECT3DDEVICE9 device; int min_idx = 0, max_idx = num_vtx - 1; - ALLEGRO_DISPLAY *disp = _al_get_bitmap_display(target); - ALLEGRO_DISPLAY_D3D *d3d_disp = (ALLEGRO_DISPLAY_D3D *)disp; + A5O_DISPLAY *disp = _al_get_bitmap_display(target); + A5O_DISPLAY_D3D *d3d_disp = (A5O_DISPLAY_D3D *)disp; UINT required_passes = 1; unsigned int i; D3D_STATE state; @@ -461,11 +461,11 @@ static int draw_prim_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, return 0; } - if (is_legacy_card() && !(disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE)) { + if (is_legacy_card() && !(disp->flags & A5O_PROGRAMMABLE_PIPELINE)) { stride = (int)sizeof(LEGACY_VERTEX); } else { - stride = (decl ? decl->stride : (int)sizeof(ALLEGRO_VERTEX)); + stride = (decl ? decl->stride : (int)sizeof(A5O_VERTEX)); } /* Check for early exit */ @@ -504,19 +504,19 @@ static int draw_prim_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, /* Convert vertices for legacy cards */ if(is_legacy_card()) { al_lock_mutex(d3d_mutex); - vtx = convert_to_legacy_vertices(vtx, num_vtx, indices, type == ALLEGRO_PRIM_LINE_LOOP, - disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE); + vtx = convert_to_legacy_vertices(vtx, num_vtx, indices, type == A5O_PRIM_LINE_LOOP, + disp->flags & A5O_PROGRAMMABLE_PIPELINE); } -#ifdef ALLEGRO_CFG_SHADER_HLSL - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_SHADER_HLSL + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { d3d_disp->effect->Begin(&required_passes, 0); } #endif for (i = 0; i < required_passes; i++) { -#ifdef ALLEGRO_CFG_SHADER_HLSL - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_SHADER_HLSL + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { d3d_disp->effect->BeginPass(i); } #endif @@ -524,17 +524,17 @@ static int draw_prim_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, if (!indices || is_legacy_card()) { switch (type) { - case ALLEGRO_PRIM_LINE_LIST: { + case A5O_PRIM_LINE_LIST: { num_primitives = num_vtx / 2; device->DrawPrimitiveUP(D3DPT_LINELIST, num_primitives, vtx, stride); break; }; - case ALLEGRO_PRIM_LINE_STRIP: { + case A5O_PRIM_LINE_STRIP: { num_primitives = num_vtx - 1; device->DrawPrimitiveUP(D3DPT_LINESTRIP, num_primitives, vtx, stride); break; }; - case ALLEGRO_PRIM_LINE_LOOP: { + case A5O_PRIM_LINE_LOOP: { num_primitives = num_vtx - 1; device->DrawPrimitiveUP(D3DPT_LINESTRIP, num_primitives, vtx, stride); if(!is_legacy_card()) { @@ -548,22 +548,22 @@ static int draw_prim_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, } break; }; - case ALLEGRO_PRIM_TRIANGLE_LIST: { + case A5O_PRIM_TRIANGLE_LIST: { num_primitives = num_vtx / 3; device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, num_primitives, vtx, stride); break; }; - case ALLEGRO_PRIM_TRIANGLE_STRIP: { + case A5O_PRIM_TRIANGLE_STRIP: { num_primitives = num_vtx - 2; device->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, num_primitives, vtx, stride); break; }; - case ALLEGRO_PRIM_TRIANGLE_FAN: { + case A5O_PRIM_TRIANGLE_FAN: { num_primitives = num_vtx - 2; device->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, num_primitives, vtx, stride); break; }; - case ALLEGRO_PRIM_POINT_LIST: { + case A5O_PRIM_POINT_LIST: { num_primitives = num_vtx; device->DrawPrimitiveUP(D3DPT_POINTLIST, num_primitives, vtx, stride); break; @@ -571,17 +571,17 @@ static int draw_prim_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, } } else { switch (type) { - case ALLEGRO_PRIM_LINE_LIST: { + case A5O_PRIM_LINE_LIST: { num_primitives = num_vtx / 2; device->DrawIndexedPrimitiveUP(D3DPT_LINELIST, min_idx, num_idx, num_primitives, indices, D3DFMT_INDEX32, vtx, stride); break; }; - case ALLEGRO_PRIM_LINE_STRIP: { + case A5O_PRIM_LINE_STRIP: { num_primitives = num_vtx - 1; device->DrawIndexedPrimitiveUP(D3DPT_LINESTRIP, min_idx, num_idx, num_primitives, indices, D3DFMT_INDEX32, vtx, stride); break; }; - case ALLEGRO_PRIM_LINE_LOOP: { + case A5O_PRIM_LINE_LOOP: { int in[2]; num_primitives = num_vtx - 1; device->DrawIndexedPrimitiveUP(D3DPT_LINESTRIP, min_idx, num_idx, num_primitives, indices, D3DFMT_INDEX32, vtx, stride); @@ -594,22 +594,22 @@ static int draw_prim_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, device->DrawIndexedPrimitiveUP(D3DPT_LINELIST, min_idx, num_idx, 1, in, D3DFMT_INDEX32, vtx, stride); break; }; - case ALLEGRO_PRIM_TRIANGLE_LIST: { + case A5O_PRIM_TRIANGLE_LIST: { num_primitives = num_vtx / 3; device->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, min_idx, num_idx, num_primitives, indices, D3DFMT_INDEX32, vtx, stride); break; }; - case ALLEGRO_PRIM_TRIANGLE_STRIP: { + case A5O_PRIM_TRIANGLE_STRIP: { num_primitives = num_vtx - 2; device->DrawIndexedPrimitiveUP(D3DPT_TRIANGLESTRIP, min_idx, num_idx, num_primitives, indices, D3DFMT_INDEX32, vtx, stride); break; }; - case ALLEGRO_PRIM_TRIANGLE_FAN: { + case A5O_PRIM_TRIANGLE_FAN: { num_primitives = num_vtx - 2; device->DrawIndexedPrimitiveUP(D3DPT_TRIANGLEFAN, min_idx, num_idx, num_primitives, indices, D3DFMT_INDEX32, vtx, stride); break; }; - case ALLEGRO_PRIM_POINT_LIST: { + case A5O_PRIM_POINT_LIST: { /* * D3D does not support point lists in indexed mode, so we draw them using the non-indexed mode. To gain at least a semblance * of speed, we detect consecutive runs of vertices and draw them using a single DrawPrimitiveUP call @@ -632,8 +632,8 @@ static int draw_prim_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, } } -#ifdef ALLEGRO_CFG_SHADER_HLSL - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_SHADER_HLSL + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { d3d_disp->effect->EndPass(); } #endif @@ -649,10 +649,10 @@ static int draw_prim_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, #endif -int _al_draw_prim_directx(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, int start, int end, int type) +int _al_draw_prim_directx(A5O_BITMAP* target, A5O_BITMAP* texture, const void* vtxs, const A5O_VERTEX_DECL* decl, int start, int end, int type) { -#ifdef ALLEGRO_CFG_D3D - int stride = decl ? decl->stride : (int)sizeof(ALLEGRO_VERTEX); +#ifdef A5O_CFG_D3D + int stride = decl ? decl->stride : (int)sizeof(A5O_VERTEX); return draw_prim_raw(target, texture, (const char*)vtxs + start * stride, decl, 0, end - start, type); #else (void)target; @@ -667,9 +667,9 @@ int _al_draw_prim_directx(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, const #endif } -int _al_draw_prim_indexed_directx(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, const int* indices, int num_vtx, int type) +int _al_draw_prim_indexed_directx(A5O_BITMAP* target, A5O_BITMAP* texture, const void* vtxs, const A5O_VERTEX_DECL* decl, const int* indices, int num_vtx, int type) { -#ifdef ALLEGRO_CFG_D3D +#ifdef A5O_CFG_D3D return draw_prim_raw(target, texture, vtxs, decl, indices, num_vtx, type); #else (void)target; @@ -684,14 +684,14 @@ int _al_draw_prim_indexed_directx(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* textur #endif } -#ifdef ALLEGRO_CFG_D3D -static int draw_buffer_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX_BUFFER* vertex_buffer, ALLEGRO_INDEX_BUFFER* index_buffer, int start, int end, int type) +#ifdef A5O_CFG_D3D +static int draw_buffer_raw(A5O_BITMAP* target, A5O_BITMAP* texture, A5O_VERTEX_BUFFER* vertex_buffer, A5O_INDEX_BUFFER* index_buffer, int start, int end, int type) { int num_primitives = 0; int num_vtx = end - start; LPDIRECT3DDEVICE9 device; - ALLEGRO_DISPLAY *disp = _al_get_bitmap_display(target); - ALLEGRO_DISPLAY_D3D *d3d_disp = (ALLEGRO_DISPLAY_D3D *)disp; + A5O_DISPLAY *disp = _al_get_bitmap_display(target); + A5O_DISPLAY_D3D *d3d_disp = (A5O_DISPLAY_D3D *)disp; UINT required_passes = 1; unsigned int i; D3D_STATE state; @@ -713,45 +713,45 @@ static int draw_buffer_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, ALLE state = setup_state(device, vertex_buffer->decl, target, texture, data); - device->SetStreamSource(0, (IDirect3DVertexBuffer9*)vertex_buffer->common.handle, 0, vertex_buffer->decl ? vertex_buffer->decl->stride : (int)sizeof(ALLEGRO_VERTEX)); + device->SetStreamSource(0, (IDirect3DVertexBuffer9*)vertex_buffer->common.handle, 0, vertex_buffer->decl ? vertex_buffer->decl->stride : (int)sizeof(A5O_VERTEX)); if (index_buffer) { device->SetIndices((IDirect3DIndexBuffer9*)index_buffer->common.handle); } -#ifdef ALLEGRO_CFG_SHADER_HLSL - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_SHADER_HLSL + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { d3d_disp->effect->Begin(&required_passes, 0); } #endif for (i = 0; i < required_passes; i++) { -#ifdef ALLEGRO_CFG_SHADER_HLSL - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_SHADER_HLSL + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { d3d_disp->effect->BeginPass(i); } #endif if (!index_buffer) { switch (type) { - case ALLEGRO_PRIM_LINE_LIST: { + case A5O_PRIM_LINE_LIST: { num_primitives = num_vtx / 2; device->DrawPrimitive(D3DPT_LINELIST, start, num_primitives); break; }; - case ALLEGRO_PRIM_LINE_STRIP: { + case A5O_PRIM_LINE_STRIP: { num_primitives = num_vtx - 1; device->DrawPrimitive(D3DPT_LINESTRIP, start, num_primitives); break; }; - case ALLEGRO_PRIM_LINE_LOOP: { + case A5O_PRIM_LINE_LOOP: { int* indices; num_primitives = num_vtx - 1; device->DrawPrimitive(D3DPT_LINESTRIP, start, num_primitives); if (data.loop_index_buffer) { al_lock_mutex(d3d_mutex); - indices = (int*)al_lock_index_buffer(data.loop_index_buffer, 0, 2, ALLEGRO_LOCK_WRITEONLY); + indices = (int*)al_lock_index_buffer(data.loop_index_buffer, 0, 2, A5O_LOCK_WRITEONLY); ASSERT(indices); indices[0] = start; indices[1] = start + num_vtx - 1; @@ -762,22 +762,22 @@ static int draw_buffer_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, ALLE } break; }; - case ALLEGRO_PRIM_TRIANGLE_LIST: { + case A5O_PRIM_TRIANGLE_LIST: { num_primitives = num_vtx / 3; device->DrawPrimitive(D3DPT_TRIANGLELIST, start, num_primitives); break; }; - case ALLEGRO_PRIM_TRIANGLE_STRIP: { + case A5O_PRIM_TRIANGLE_STRIP: { num_primitives = num_vtx - 2; device->DrawPrimitive(D3DPT_TRIANGLESTRIP, start, num_primitives); break; }; - case ALLEGRO_PRIM_TRIANGLE_FAN: { + case A5O_PRIM_TRIANGLE_FAN: { num_primitives = num_vtx - 2; device->DrawPrimitive(D3DPT_TRIANGLEFAN, start, num_primitives); break; }; - case ALLEGRO_PRIM_POINT_LIST: { + case A5O_PRIM_POINT_LIST: { num_primitives = num_vtx; device->DrawPrimitive(D3DPT_POINTLIST, start, num_primitives); break; @@ -787,44 +787,44 @@ static int draw_buffer_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, ALLE else { int vbuff_size = al_get_vertex_buffer_size(vertex_buffer); switch (type) { - case ALLEGRO_PRIM_LINE_LIST: { + case A5O_PRIM_LINE_LIST: { num_primitives = num_vtx / 2; device->DrawIndexedPrimitive(D3DPT_LINELIST, 0, 0, vbuff_size, start, num_primitives); break; }; - case ALLEGRO_PRIM_LINE_STRIP: { + case A5O_PRIM_LINE_STRIP: { num_primitives = num_vtx - 1; device->DrawIndexedPrimitive(D3DPT_LINESTRIP, 0, 0, vbuff_size, start, num_primitives); break; }; - case ALLEGRO_PRIM_LINE_LOOP: { + case A5O_PRIM_LINE_LOOP: { /* Unimplemented, too hard to do in a consistent fashion. */ break; }; - case ALLEGRO_PRIM_TRIANGLE_LIST: { + case A5O_PRIM_TRIANGLE_LIST: { num_primitives = num_vtx / 3; device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, vbuff_size, start, num_primitives); break; }; - case ALLEGRO_PRIM_TRIANGLE_STRIP: { + case A5O_PRIM_TRIANGLE_STRIP: { num_primitives = num_vtx - 2; device->DrawIndexedPrimitive(D3DPT_TRIANGLESTRIP, 0, 0, vbuff_size, start, num_primitives); break; }; - case ALLEGRO_PRIM_TRIANGLE_FAN: { + case A5O_PRIM_TRIANGLE_FAN: { num_primitives = num_vtx - 2; device->DrawIndexedPrimitive(D3DPT_TRIANGLEFAN, 0, 0, vbuff_size, start, num_primitives); break; }; - case ALLEGRO_PRIM_POINT_LIST: { + case A5O_PRIM_POINT_LIST: { /* Unimplemented, too hard to do in a consistent fashion. */ break; }; } } -#ifdef ALLEGRO_CFG_SHADER_HLSL - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_SHADER_HLSL + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { d3d_disp->effect->EndPass(); } #endif @@ -839,9 +839,9 @@ static int draw_buffer_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, ALLE } #endif -int _al_draw_vertex_buffer_directx(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX_BUFFER* vertex_buffer, int start, int end, int type) +int _al_draw_vertex_buffer_directx(A5O_BITMAP* target, A5O_BITMAP* texture, A5O_VERTEX_BUFFER* vertex_buffer, int start, int end, int type) { -#ifdef ALLEGRO_CFG_D3D +#ifdef A5O_CFG_D3D return draw_buffer_raw(target, texture, vertex_buffer, NULL, start, end, type); #else (void)target; @@ -855,9 +855,9 @@ int _al_draw_vertex_buffer_directx(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* textu #endif } -int _al_draw_indexed_buffer_directx(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX_BUFFER* vertex_buffer, ALLEGRO_INDEX_BUFFER* index_buffer, int start, int end, int type) +int _al_draw_indexed_buffer_directx(A5O_BITMAP* target, A5O_BITMAP* texture, A5O_VERTEX_BUFFER* vertex_buffer, A5O_INDEX_BUFFER* index_buffer, int start, int end, int type) { -#ifdef ALLEGRO_CFG_D3D +#ifdef A5O_CFG_D3D return draw_buffer_raw(target, texture, vertex_buffer, index_buffer, start, end, type); #else (void)target; @@ -872,50 +872,50 @@ int _al_draw_indexed_buffer_directx(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* text #endif } -#ifdef ALLEGRO_CFG_D3D +#ifdef A5O_CFG_D3D static int convert_storage(int storage) { switch(storage) { - case ALLEGRO_PRIM_FLOAT_2: + case A5O_PRIM_FLOAT_2: return D3DDECLTYPE_FLOAT2; break; - case ALLEGRO_PRIM_FLOAT_3: + case A5O_PRIM_FLOAT_3: return D3DDECLTYPE_FLOAT3; break; - case ALLEGRO_PRIM_SHORT_2: + case A5O_PRIM_SHORT_2: return D3DDECLTYPE_SHORT2; break; - case ALLEGRO_PRIM_FLOAT_1: + case A5O_PRIM_FLOAT_1: return D3DDECLTYPE_FLOAT1; break; - case ALLEGRO_PRIM_FLOAT_4: + case A5O_PRIM_FLOAT_4: return D3DDECLTYPE_FLOAT4; break; - case ALLEGRO_PRIM_UBYTE_4: + case A5O_PRIM_UBYTE_4: return D3DDECLTYPE_UBYTE4; break; - case ALLEGRO_PRIM_SHORT_4: + case A5O_PRIM_SHORT_4: return D3DDECLTYPE_SHORT4; break; - case ALLEGRO_PRIM_NORMALIZED_UBYTE_4: + case A5O_PRIM_NORMALIZED_UBYTE_4: return D3DDECLTYPE_UBYTE4N; break; - case ALLEGRO_PRIM_NORMALIZED_SHORT_2: + case A5O_PRIM_NORMALIZED_SHORT_2: return D3DDECLTYPE_SHORT2N; break; - case ALLEGRO_PRIM_NORMALIZED_SHORT_4: + case A5O_PRIM_NORMALIZED_SHORT_4: return D3DDECLTYPE_SHORT4N; break; - case ALLEGRO_PRIM_NORMALIZED_USHORT_2: + case A5O_PRIM_NORMALIZED_USHORT_2: return D3DDECLTYPE_USHORT2N; break; - case ALLEGRO_PRIM_NORMALIZED_USHORT_4: + case A5O_PRIM_NORMALIZED_USHORT_4: return D3DDECLTYPE_USHORT4N; break; - case ALLEGRO_PRIM_HALF_FLOAT_2: + case A5O_PRIM_HALF_FLOAT_2: return D3DDECLTYPE_FLOAT16_2; break; - case ALLEGRO_PRIM_HALF_FLOAT_4: + case A5O_PRIM_HALF_FLOAT_4: return D3DDECLTYPE_FLOAT16_4; break; default: @@ -925,14 +925,14 @@ static int convert_storage(int storage) } #endif -void _al_set_d3d_decl(ALLEGRO_DISPLAY* display, ALLEGRO_VERTEX_DECL* ret) +void _al_set_d3d_decl(A5O_DISPLAY* display, A5O_VERTEX_DECL* ret) { -#ifdef ALLEGRO_CFG_D3D +#ifdef A5O_CFG_D3D { LPDIRECT3DDEVICE9 device; - D3DVERTEXELEMENT9 d3delements[ALLEGRO_PRIM_ATTR_NUM + 1]; + D3DVERTEXELEMENT9 d3delements[A5O_PRIM_ATTR_NUM + 1]; int idx = 0; - ALLEGRO_VERTEX_ELEMENT* e; + A5O_VERTEX_ELEMENT* e; D3DCAPS9 caps; device = al_get_d3d_device(display); @@ -942,7 +942,7 @@ void _al_set_d3d_decl(ALLEGRO_DISPLAY* display, ALLEGRO_VERTEX_DECL* ret) ret->d3d_decl = 0; } else { int i; - e = &ret->elements[ALLEGRO_PRIM_POSITION]; + e = &ret->elements[A5O_PRIM_POSITION]; if(e->attribute) { d3delements[idx].Stream = 0; d3delements[idx].Offset = e->offset; @@ -953,9 +953,9 @@ void _al_set_d3d_decl(ALLEGRO_DISPLAY* display, ALLEGRO_VERTEX_DECL* ret) idx++; } - e = &ret->elements[ALLEGRO_PRIM_TEX_COORD]; + e = &ret->elements[A5O_PRIM_TEX_COORD]; if(!e->attribute) - e = &ret->elements[ALLEGRO_PRIM_TEX_COORD_PIXEL]; + e = &ret->elements[A5O_PRIM_TEX_COORD_PIXEL]; if(e->attribute) { d3delements[idx].Stream = 0; d3delements[idx].Offset = e->offset; @@ -966,7 +966,7 @@ void _al_set_d3d_decl(ALLEGRO_DISPLAY* display, ALLEGRO_VERTEX_DECL* ret) idx++; } - e = &ret->elements[ALLEGRO_PRIM_COLOR_ATTR]; + e = &ret->elements[A5O_PRIM_COLOR_ATTR]; if(e->attribute) { d3delements[idx].Stream = 0; d3delements[idx].Offset = e->offset; @@ -977,8 +977,8 @@ void _al_set_d3d_decl(ALLEGRO_DISPLAY* display, ALLEGRO_VERTEX_DECL* ret) idx++; } - for (i = 0; i < _ALLEGRO_PRIM_MAX_USER_ATTR; i++) { - e = &ret->elements[ALLEGRO_PRIM_USER_ATTR + i]; + for (i = 0; i < _A5O_PRIM_MAX_USER_ATTR; i++) { + e = &ret->elements[A5O_PRIM_USER_ATTR + i]; if (e->attribute) { d3delements[idx].Stream = 0; d3delements[idx].Offset = e->offset; @@ -1008,19 +1008,19 @@ void _al_set_d3d_decl(ALLEGRO_DISPLAY* display, ALLEGRO_VERTEX_DECL* ret) #endif } -bool _al_create_vertex_buffer_directx(ALLEGRO_VERTEX_BUFFER* buf, const void* initial_data, size_t num_vertices, int flags) +bool _al_create_vertex_buffer_directx(A5O_VERTEX_BUFFER* buf, const void* initial_data, size_t num_vertices, int flags) { -#ifdef ALLEGRO_CFG_D3D +#ifdef A5O_CFG_D3D LPDIRECT3DDEVICE9 device; IDirect3DVertexBuffer9* d3d_vbuff; DWORD fvf = A5V_FVF; - int stride = buf->decl ? buf->decl->stride : (int)sizeof(ALLEGRO_VERTEX); + int stride = buf->decl ? buf->decl->stride : (int)sizeof(A5O_VERTEX); HRESULT res; void* locked_memory; /* There's just no point */ if (is_legacy_card()) { - ALLEGRO_WARN("Cannot create vertex buffer for a legacy card.\n"); + A5O_WARN("Cannot create vertex buffer for a legacy card.\n"); return false; } @@ -1031,10 +1031,10 @@ bool _al_create_vertex_buffer_directx(ALLEGRO_VERTEX_BUFFER* buf, const void* in fvf = 0; } - res = device->CreateVertexBuffer(stride * num_vertices, !(flags & ALLEGRO_PRIM_BUFFER_READWRITE) ? D3DUSAGE_WRITEONLY : 0, + res = device->CreateVertexBuffer(stride * num_vertices, !(flags & A5O_PRIM_BUFFER_READWRITE) ? D3DUSAGE_WRITEONLY : 0, fvf, D3DPOOL_MANAGED, &d3d_vbuff, 0); if (res != D3D_OK) { - ALLEGRO_WARN("CreateVertexBuffer failed: %ld.\n", res); + A5O_WARN("CreateVertexBuffer failed: %ld.\n", res); return false; } @@ -1057,9 +1057,9 @@ bool _al_create_vertex_buffer_directx(ALLEGRO_VERTEX_BUFFER* buf, const void* in #endif } -bool _al_create_index_buffer_directx(ALLEGRO_INDEX_BUFFER* buf, const void* initial_data, size_t num_indices, int flags) +bool _al_create_index_buffer_directx(A5O_INDEX_BUFFER* buf, const void* initial_data, size_t num_indices, int flags) { -#ifdef ALLEGRO_CFG_D3D +#ifdef A5O_CFG_D3D LPDIRECT3DDEVICE9 device; IDirect3DIndexBuffer9* d3d_ibuff; HRESULT res; @@ -1067,16 +1067,16 @@ bool _al_create_index_buffer_directx(ALLEGRO_INDEX_BUFFER* buf, const void* init /* There's just no point */ if (is_legacy_card()) { - ALLEGRO_WARN("Cannot create index buffer for a legacy card.\n"); + A5O_WARN("Cannot create index buffer for a legacy card.\n"); return false; } device = al_get_d3d_device(al_get_current_display()); - res = device->CreateIndexBuffer(num_indices * buf->index_size, !(flags & ALLEGRO_PRIM_BUFFER_READWRITE) ? D3DUSAGE_WRITEONLY : 0, + res = device->CreateIndexBuffer(num_indices * buf->index_size, !(flags & A5O_PRIM_BUFFER_READWRITE) ? D3DUSAGE_WRITEONLY : 0, buf->index_size == 4 ? D3DFMT_INDEX32 : D3DFMT_INDEX16, D3DPOOL_MANAGED, &d3d_ibuff, 0); if (res != D3D_OK) { - ALLEGRO_WARN("CreateIndexBuffer failed: %ld.\n", res); + A5O_WARN("CreateIndexBuffer failed: %ld.\n", res); return false; } @@ -1099,33 +1099,33 @@ bool _al_create_index_buffer_directx(ALLEGRO_INDEX_BUFFER* buf, const void* init #endif } -void _al_destroy_vertex_buffer_directx(ALLEGRO_VERTEX_BUFFER* buf) +void _al_destroy_vertex_buffer_directx(A5O_VERTEX_BUFFER* buf) { -#ifdef ALLEGRO_CFG_D3D +#ifdef A5O_CFG_D3D ((IDirect3DVertexBuffer9*)buf->common.handle)->Release(); #else (void)buf; #endif } -void _al_destroy_index_buffer_directx(ALLEGRO_INDEX_BUFFER* buf) +void _al_destroy_index_buffer_directx(A5O_INDEX_BUFFER* buf) { -#ifdef ALLEGRO_CFG_D3D +#ifdef A5O_CFG_D3D ((IDirect3DIndexBuffer9*)buf->common.handle)->Release(); #else (void)buf; #endif } -void* _al_lock_vertex_buffer_directx(ALLEGRO_VERTEX_BUFFER* buf) +void* _al_lock_vertex_buffer_directx(A5O_VERTEX_BUFFER* buf) { -#ifdef ALLEGRO_CFG_D3D - DWORD flags = buf->common.lock_flags == ALLEGRO_LOCK_READONLY ? D3DLOCK_READONLY : 0; +#ifdef A5O_CFG_D3D + DWORD flags = buf->common.lock_flags == A5O_LOCK_READONLY ? D3DLOCK_READONLY : 0; HRESULT res; res = ((IDirect3DVertexBuffer9*)buf->common.handle)->Lock((UINT)buf->common.lock_offset, (UINT)buf->common.lock_length, &buf->common.locked_memory, flags); if (res != D3D_OK) { - ALLEGRO_WARN("Locking vertex buffer failed: %ld.\n", res); + A5O_WARN("Locking vertex buffer failed: %ld.\n", res); return 0; } @@ -1137,16 +1137,16 @@ void* _al_lock_vertex_buffer_directx(ALLEGRO_VERTEX_BUFFER* buf) #endif } -void* _al_lock_index_buffer_directx(ALLEGRO_INDEX_BUFFER* buf) +void* _al_lock_index_buffer_directx(A5O_INDEX_BUFFER* buf) { -#ifdef ALLEGRO_CFG_D3D - DWORD flags = buf->common.lock_flags == ALLEGRO_LOCK_READONLY ? D3DLOCK_READONLY : 0; +#ifdef A5O_CFG_D3D + DWORD flags = buf->common.lock_flags == A5O_LOCK_READONLY ? D3DLOCK_READONLY : 0; HRESULT res; res = ((IDirect3DIndexBuffer9*)buf->common.handle)->Lock((UINT)buf->common.lock_offset, (UINT)buf->common.lock_length, &buf->common.locked_memory, flags); if (res != D3D_OK) { - ALLEGRO_WARN("Locking index buffer failed: %ld.\n", res); + A5O_WARN("Locking index buffer failed: %ld.\n", res); return 0; } @@ -1158,18 +1158,18 @@ void* _al_lock_index_buffer_directx(ALLEGRO_INDEX_BUFFER* buf) #endif } -void _al_unlock_vertex_buffer_directx(ALLEGRO_VERTEX_BUFFER* buf) +void _al_unlock_vertex_buffer_directx(A5O_VERTEX_BUFFER* buf) { -#ifdef ALLEGRO_CFG_D3D +#ifdef A5O_CFG_D3D ((IDirect3DVertexBuffer9*)buf->common.handle)->Unlock(); #else (void)buf; #endif } -void _al_unlock_index_buffer_directx(ALLEGRO_INDEX_BUFFER* buf) +void _al_unlock_index_buffer_directx(A5O_INDEX_BUFFER* buf) { -#ifdef ALLEGRO_CFG_D3D +#ifdef A5O_CFG_D3D ((IDirect3DIndexBuffer9*)buf->common.handle)->Unlock(); #else (void)buf; diff --git a/addons/primitives/prim_opengl.c b/addons/primitives/prim_opengl.c index 75b9b91f93..152dc4b735 100644 --- a/addons/primitives/prim_opengl.c +++ b/addons/primitives/prim_opengl.c @@ -16,7 +16,7 @@ * See readme.txt for copyright information. */ -#define ALLEGRO_INTERNAL_UNSTABLE +#define A5O_INTERNAL_UNSTABLE #include "allegro5/allegro.h" #include "allegro5/allegro_primitives.h" @@ -27,81 +27,81 @@ #include "allegro5/platform/alplatf.h" #include "allegro5/internal/aintern_prim.h" -#ifdef ALLEGRO_CFG_OPENGL +#ifdef A5O_CFG_OPENGL #include "allegro5/allegro_opengl.h" #include "allegro5/internal/aintern_opengl.h" -static void convert_storage(ALLEGRO_PRIM_STORAGE storage, GLenum* type, int* ncoord, bool* normalized) +static void convert_storage(A5O_PRIM_STORAGE storage, GLenum* type, int* ncoord, bool* normalized) { switch(storage) { - case ALLEGRO_PRIM_FLOAT_2: + case A5O_PRIM_FLOAT_2: *type = GL_FLOAT; *ncoord = 2; *normalized = false; break; - case ALLEGRO_PRIM_FLOAT_3: + case A5O_PRIM_FLOAT_3: *type = GL_FLOAT; *ncoord = 3; *normalized = false; break; - case ALLEGRO_PRIM_SHORT_2: + case A5O_PRIM_SHORT_2: *type = GL_SHORT; *ncoord = 2; *normalized = false; break; - case ALLEGRO_PRIM_FLOAT_1: + case A5O_PRIM_FLOAT_1: *type = GL_FLOAT; *ncoord = 1; *normalized = false; break; - case ALLEGRO_PRIM_FLOAT_4: + case A5O_PRIM_FLOAT_4: *type = GL_FLOAT; *ncoord = 4; *normalized = false; break; - case ALLEGRO_PRIM_UBYTE_4: + case A5O_PRIM_UBYTE_4: *type = GL_UNSIGNED_BYTE; *ncoord = 4; *normalized = false; break; - case ALLEGRO_PRIM_SHORT_4: + case A5O_PRIM_SHORT_4: *type = GL_SHORT; *ncoord = 4; *normalized = false; break; - case ALLEGRO_PRIM_NORMALIZED_UBYTE_4: + case A5O_PRIM_NORMALIZED_UBYTE_4: *type = GL_UNSIGNED_BYTE; *ncoord = 4; *normalized = true; break; - case ALLEGRO_PRIM_NORMALIZED_SHORT_2: + case A5O_PRIM_NORMALIZED_SHORT_2: *type = GL_SHORT; *ncoord = 2; *normalized = true; break; - case ALLEGRO_PRIM_NORMALIZED_SHORT_4: + case A5O_PRIM_NORMALIZED_SHORT_4: *type = GL_SHORT; *ncoord = 4; *normalized = true; break; - case ALLEGRO_PRIM_NORMALIZED_USHORT_2: + case A5O_PRIM_NORMALIZED_USHORT_2: *type = GL_UNSIGNED_SHORT; *ncoord = 2; *normalized = true; break; - case ALLEGRO_PRIM_NORMALIZED_USHORT_4: + case A5O_PRIM_NORMALIZED_USHORT_4: *type = GL_UNSIGNED_SHORT; *ncoord = 4; *normalized = true; break; -#ifndef ALLEGRO_CFG_OPENGLES - case ALLEGRO_PRIM_HALF_FLOAT_2: +#ifndef A5O_CFG_OPENGLES + case A5O_PRIM_HALF_FLOAT_2: *type = GL_HALF_FLOAT; *ncoord = 2; *normalized = false; break; - case ALLEGRO_PRIM_HALF_FLOAT_4: + case A5O_PRIM_HALF_FLOAT_4: *type = GL_HALF_FLOAT; *ncoord = 4; *normalized = false; @@ -112,20 +112,20 @@ static void convert_storage(ALLEGRO_PRIM_STORAGE storage, GLenum* type, int* nco } } -static void setup_state(const char* vtxs, const ALLEGRO_VERTEX_DECL* decl, ALLEGRO_BITMAP* texture) +static void setup_state(const char* vtxs, const A5O_VERTEX_DECL* decl, A5O_BITMAP* texture) { - ALLEGRO_DISPLAY *display = al_get_current_display(); + A5O_DISPLAY *display = al_get_current_display(); GLenum type; int ncoord; bool normalized; - if (display->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { -#ifdef ALLEGRO_CFG_OPENGL_PROGRAMMABLE_PIPELINE + if (display->flags & A5O_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_OPENGL_PROGRAMMABLE_PIPELINE if(decl) { - ALLEGRO_VERTEX_ELEMENT* e; + A5O_VERTEX_ELEMENT* e; int i; - e = &decl->elements[ALLEGRO_PRIM_POSITION]; + e = &decl->elements[A5O_PRIM_POSITION]; if(e->attribute) { convert_storage(e->storage, &type, &ncoord, &normalized); @@ -139,9 +139,9 @@ static void setup_state(const char* vtxs, const ALLEGRO_VERTEX_DECL* decl, ALLEG } } - e = &decl->elements[ALLEGRO_PRIM_TEX_COORD]; + e = &decl->elements[A5O_PRIM_TEX_COORD]; if(!e->attribute) - e = &decl->elements[ALLEGRO_PRIM_TEX_COORD_PIXEL]; + e = &decl->elements[A5O_PRIM_TEX_COORD_PIXEL]; if(e->attribute) { convert_storage(e->storage, &type, &ncoord, &normalized); @@ -155,7 +155,7 @@ static void setup_state(const char* vtxs, const ALLEGRO_VERTEX_DECL* decl, ALLEG } } - e = &decl->elements[ALLEGRO_PRIM_COLOR_ATTR]; + e = &decl->elements[A5O_PRIM_COLOR_ATTR]; if(e->attribute) { if (display->ogl_extras->varlocs.color_loc >= 0) { glVertexAttribPointer(display->ogl_extras->varlocs.color_loc, 4, GL_FLOAT, true, decl->stride, vtxs + e->offset); @@ -167,8 +167,8 @@ static void setup_state(const char* vtxs, const ALLEGRO_VERTEX_DECL* decl, ALLEG } } - for (i = 0; i < _ALLEGRO_PRIM_MAX_USER_ATTR; i++) { - e = &decl->elements[ALLEGRO_PRIM_USER_ATTR + i]; + for (i = 0; i < _A5O_PRIM_MAX_USER_ATTR; i++) { + e = &decl->elements[A5O_PRIM_USER_ATTR + i]; if (e->attribute) { convert_storage(e->storage, &type, &ncoord, &normalized); @@ -184,27 +184,27 @@ static void setup_state(const char* vtxs, const ALLEGRO_VERTEX_DECL* decl, ALLEG } } else { if (display->ogl_extras->varlocs.pos_loc >= 0) { - glVertexAttribPointer(display->ogl_extras->varlocs.pos_loc, 3, GL_FLOAT, false, sizeof(ALLEGRO_VERTEX), vtxs + offsetof(ALLEGRO_VERTEX, x)); + glVertexAttribPointer(display->ogl_extras->varlocs.pos_loc, 3, GL_FLOAT, false, sizeof(A5O_VERTEX), vtxs + offsetof(A5O_VERTEX, x)); glEnableVertexAttribArray(display->ogl_extras->varlocs.pos_loc); } if (display->ogl_extras->varlocs.texcoord_loc >= 0) { - glVertexAttribPointer(display->ogl_extras->varlocs.texcoord_loc, 2, GL_FLOAT, false, sizeof(ALLEGRO_VERTEX), vtxs + offsetof(ALLEGRO_VERTEX, u)); + glVertexAttribPointer(display->ogl_extras->varlocs.texcoord_loc, 2, GL_FLOAT, false, sizeof(A5O_VERTEX), vtxs + offsetof(A5O_VERTEX, u)); glEnableVertexAttribArray(display->ogl_extras->varlocs.texcoord_loc); } if (display->ogl_extras->varlocs.color_loc >= 0) { - glVertexAttribPointer(display->ogl_extras->varlocs.color_loc, 4, GL_FLOAT, true, sizeof(ALLEGRO_VERTEX), vtxs + offsetof(ALLEGRO_VERTEX, color)); + glVertexAttribPointer(display->ogl_extras->varlocs.color_loc, 4, GL_FLOAT, true, sizeof(A5O_VERTEX), vtxs + offsetof(A5O_VERTEX, color)); glEnableVertexAttribArray(display->ogl_extras->varlocs.color_loc); } } #endif } else { -#ifdef ALLEGRO_CFG_OPENGL_FIXED_FUNCTION +#ifdef A5O_CFG_OPENGL_FIXED_FUNCTION if(decl) { - ALLEGRO_VERTEX_ELEMENT* e; - e = &decl->elements[ALLEGRO_PRIM_POSITION]; + A5O_VERTEX_ELEMENT* e; + e = &decl->elements[A5O_PRIM_POSITION]; if(e->attribute) { glEnableClientState(GL_VERTEX_ARRAY); @@ -215,9 +215,9 @@ static void setup_state(const char* vtxs, const ALLEGRO_VERTEX_DECL* decl, ALLEG glDisableClientState(GL_VERTEX_ARRAY); } - e = &decl->elements[ALLEGRO_PRIM_TEX_COORD]; + e = &decl->elements[A5O_PRIM_TEX_COORD]; if(!e->attribute) - e = &decl->elements[ALLEGRO_PRIM_TEX_COORD_PIXEL]; + e = &decl->elements[A5O_PRIM_TEX_COORD_PIXEL]; if(texture && e->attribute) { glEnableClientState(GL_TEXTURE_COORD_ARRAY); @@ -228,7 +228,7 @@ static void setup_state(const char* vtxs, const ALLEGRO_VERTEX_DECL* decl, ALLEG glDisableClientState(GL_TEXTURE_COORD_ARRAY); } - e = &decl->elements[ALLEGRO_PRIM_COLOR_ATTR]; + e = &decl->elements[A5O_PRIM_COLOR_ATTR]; if(e->attribute) { glEnableClientState(GL_COLOR_ARRAY); @@ -241,12 +241,12 @@ static void setup_state(const char* vtxs, const ALLEGRO_VERTEX_DECL* decl, ALLEG glEnableClientState(GL_COLOR_ARRAY); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - if (!(display->flags & ALLEGRO_PROGRAMMABLE_PIPELINE)) + if (!(display->flags & A5O_PROGRAMMABLE_PIPELINE)) glDisableClientState(GL_NORMAL_ARRAY); - glVertexPointer(3, GL_FLOAT, sizeof(ALLEGRO_VERTEX), vtxs + offsetof(ALLEGRO_VERTEX, x)); - glColorPointer(4, GL_FLOAT, sizeof(ALLEGRO_VERTEX), vtxs + offsetof(ALLEGRO_VERTEX, color)); - glTexCoordPointer(2, GL_FLOAT, sizeof(ALLEGRO_VERTEX), vtxs + offsetof(ALLEGRO_VERTEX, u)); + glVertexPointer(3, GL_FLOAT, sizeof(A5O_VERTEX), vtxs + offsetof(A5O_VERTEX, x)); + glColorPointer(4, GL_FLOAT, sizeof(A5O_VERTEX), vtxs + offsetof(A5O_VERTEX, color)); + glTexCoordPointer(2, GL_FLOAT, sizeof(A5O_VERTEX), vtxs + offsetof(A5O_VERTEX, u)); } #endif } @@ -275,7 +275,7 @@ static void setup_state(const char* vtxs, const ALLEGRO_VERTEX_DECL* decl, ALLEG mat[3][1] = (float)(height - tex_y) / true_h; if(decl) { - if(decl->elements[ALLEGRO_PRIM_TEX_COORD_PIXEL].attribute) { + if(decl->elements[A5O_PRIM_TEX_COORD_PIXEL].attribute) { mat[0][0] = 1.0f / true_w; mat[1][1] = -1.0f / true_h; } else { @@ -287,15 +287,15 @@ static void setup_state(const char* vtxs, const ALLEGRO_VERTEX_DECL* decl, ALLEG mat[1][1] = -1.0f / true_h; } - if (!(display->flags & ALLEGRO_PROGRAMMABLE_PIPELINE)) { + if (!(display->flags & A5O_PROGRAMMABLE_PIPELINE)) { glBindTexture(GL_TEXTURE_2D, gl_texture); } - ALLEGRO_BITMAP_WRAP wrap_u, wrap_v; + A5O_BITMAP_WRAP wrap_u, wrap_v; _al_get_bitmap_wrap(texture, &wrap_u, &wrap_v); - if (display->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { -#ifdef ALLEGRO_CFG_OPENGL_PROGRAMMABLE_PIPELINE + if (display->flags & A5O_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_OPENGL_PROGRAMMABLE_PIPELINE GLint handle; handle = display->ogl_extras->varlocs.tex_matrix_loc; @@ -314,44 +314,44 @@ static void setup_state(const char* vtxs, const ALLEGRO_VERTEX_DECL* decl, ALLEG glBindTexture(GL_TEXTURE_2D, al_get_opengl_texture(texture)); glUniform1i(display->ogl_extras->varlocs.tex_loc, 0); // 0th sampler - if (wrap_u == ALLEGRO_BITMAP_WRAP_DEFAULT) + if (wrap_u == A5O_BITMAP_WRAP_DEFAULT) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - if (wrap_v == ALLEGRO_BITMAP_WRAP_DEFAULT) + if (wrap_v == A5O_BITMAP_WRAP_DEFAULT) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); } #endif } else { -#ifdef ALLEGRO_CFG_OPENGL_FIXED_FUNCTION +#ifdef A5O_CFG_OPENGL_FIXED_FUNCTION glMatrixMode(GL_TEXTURE); glLoadMatrixf(mat[0]); glMatrixMode(GL_MODELVIEW); glEnable(GL_TEXTURE_2D); - if (wrap_u == ALLEGRO_BITMAP_WRAP_DEFAULT) + if (wrap_u == A5O_BITMAP_WRAP_DEFAULT) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - if (wrap_v == ALLEGRO_BITMAP_WRAP_DEFAULT) + if (wrap_v == A5O_BITMAP_WRAP_DEFAULT) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); #endif } } else { /* Don't unbind the texture here if shaders are used, since the user may * have set the 0'th texture unit manually via the shader API. */ - if (!(display->flags & ALLEGRO_PROGRAMMABLE_PIPELINE)) { + if (!(display->flags & A5O_PROGRAMMABLE_PIPELINE)) { glBindTexture(GL_TEXTURE_2D, 0); } } } -static void revert_state(ALLEGRO_BITMAP* texture) +static void revert_state(A5O_BITMAP* texture) { - ALLEGRO_DISPLAY *display = al_get_current_display(); + A5O_DISPLAY *display = al_get_current_display(); if(texture) { - ALLEGRO_BITMAP_WRAP wrap_u, wrap_v; + A5O_BITMAP_WRAP wrap_u, wrap_v; _al_get_bitmap_wrap(texture, &wrap_u, &wrap_v); - if (display->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { -#ifdef ALLEGRO_CFG_OPENGL_PROGRAMMABLE_PIPELINE + if (display->flags & A5O_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_OPENGL_PROGRAMMABLE_PIPELINE float identity[16] = { 1, 0, 0, 0, 0, 1, 0, 0, @@ -369,18 +369,18 @@ static void revert_state(ALLEGRO_BITMAP* texture) glUniform1i(display->ogl_extras->varlocs.use_tex_loc, 0); if (display->ogl_extras->varlocs.tex_loc >= 0) { - if (wrap_u == ALLEGRO_BITMAP_WRAP_DEFAULT) + if (wrap_u == A5O_BITMAP_WRAP_DEFAULT) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - if (wrap_v == ALLEGRO_BITMAP_WRAP_DEFAULT) + if (wrap_v == A5O_BITMAP_WRAP_DEFAULT) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } #endif } else { -#ifdef ALLEGRO_CFG_OPENGL_FIXED_FUNCTION - if (wrap_u == ALLEGRO_BITMAP_WRAP_DEFAULT) +#ifdef A5O_CFG_OPENGL_FIXED_FUNCTION + if (wrap_u == A5O_BITMAP_WRAP_DEFAULT) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - if (wrap_v == ALLEGRO_BITMAP_WRAP_DEFAULT) + if (wrap_v == A5O_BITMAP_WRAP_DEFAULT) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glDisable(GL_TEXTURE_2D); @@ -391,8 +391,8 @@ static void revert_state(ALLEGRO_BITMAP* texture) } } - if (display->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { -#ifdef ALLEGRO_CFG_OPENGL_PROGRAMMABLE_PIPELINE + if (display->flags & A5O_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_OPENGL_PROGRAMMABLE_PIPELINE if (display->ogl_extras->varlocs.pos_loc >= 0) glDisableVertexAttribArray(display->ogl_extras->varlocs.pos_loc); if (display->ogl_extras->varlocs.color_loc >= 0) @@ -402,7 +402,7 @@ static void revert_state(ALLEGRO_BITMAP* texture) #endif } else { -#ifdef ALLEGRO_CFG_OPENGL_FIXED_FUNCTION +#ifdef A5O_CFG_OPENGL_FIXED_FUNCTION glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_TEXTURE_COORD_ARRAY); @@ -410,15 +410,15 @@ static void revert_state(ALLEGRO_BITMAP* texture) } } -static int draw_prim_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, - ALLEGRO_VERTEX_BUFFER* vertex_buffer, - const void* vtx, const ALLEGRO_VERTEX_DECL* decl, +static int draw_prim_raw(A5O_BITMAP* target, A5O_BITMAP* texture, + A5O_VERTEX_BUFFER* vertex_buffer, + const void* vtx, const A5O_VERTEX_DECL* decl, int start, int end, int type) { int num_primitives = 0; - ALLEGRO_DISPLAY *disp = _al_get_bitmap_display(target); - ALLEGRO_BITMAP *opengl_target = target; - ALLEGRO_BITMAP_EXTRA_OPENGL *extra; + A5O_DISPLAY *disp = _al_get_bitmap_display(target); + A5O_BITMAP *opengl_target = target; + A5O_BITMAP_EXTRA_OPENGL *extra; int num_vtx = end - start; if (target->parent) { @@ -444,37 +444,37 @@ static int draw_prim_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, setup_state(vtx, decl, texture); switch (type) { - case ALLEGRO_PRIM_LINE_LIST: { + case A5O_PRIM_LINE_LIST: { glDrawArrays(GL_LINES, start, num_vtx); num_primitives = num_vtx / 2; break; }; - case ALLEGRO_PRIM_LINE_STRIP: { + case A5O_PRIM_LINE_STRIP: { glDrawArrays(GL_LINE_STRIP, start, num_vtx); num_primitives = num_vtx - 1; break; }; - case ALLEGRO_PRIM_LINE_LOOP: { + case A5O_PRIM_LINE_LOOP: { glDrawArrays(GL_LINE_LOOP, start, num_vtx); num_primitives = num_vtx; break; }; - case ALLEGRO_PRIM_TRIANGLE_LIST: { + case A5O_PRIM_TRIANGLE_LIST: { glDrawArrays(GL_TRIANGLES, start, num_vtx); num_primitives = num_vtx / 3; break; }; - case ALLEGRO_PRIM_TRIANGLE_STRIP: { + case A5O_PRIM_TRIANGLE_STRIP: { glDrawArrays(GL_TRIANGLE_STRIP, start, num_vtx); num_primitives = num_vtx - 2; break; }; - case ALLEGRO_PRIM_TRIANGLE_FAN: { + case A5O_PRIM_TRIANGLE_FAN: { glDrawArrays(GL_TRIANGLE_FAN, start, num_vtx); num_primitives = num_vtx - 2; break; }; - case ALLEGRO_PRIM_POINT_LIST: { + case A5O_PRIM_POINT_LIST: { glDrawArrays(GL_POINTS, start, num_vtx); num_primitives = num_vtx; break; @@ -490,23 +490,23 @@ static int draw_prim_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, return num_primitives; } -static int draw_prim_indexed_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, - ALLEGRO_VERTEX_BUFFER* vertex_buffer, - const void* vtx, const ALLEGRO_VERTEX_DECL* decl, - ALLEGRO_INDEX_BUFFER* index_buffer, +static int draw_prim_indexed_raw(A5O_BITMAP* target, A5O_BITMAP* texture, + A5O_VERTEX_BUFFER* vertex_buffer, + const void* vtx, const A5O_VERTEX_DECL* decl, + A5O_INDEX_BUFFER* index_buffer, const int* indices, int start, int end, int type) { int num_primitives = 0; - ALLEGRO_DISPLAY *disp = _al_get_bitmap_display(target); - ALLEGRO_BITMAP *opengl_target = target; - ALLEGRO_BITMAP_EXTRA_OPENGL *extra; + A5O_DISPLAY *disp = _al_get_bitmap_display(target); + A5O_BITMAP *opengl_target = target; + A5O_BITMAP_EXTRA_OPENGL *extra; const char* idx = (const char*)indices; int start_offset = 0; GLenum idx_size = GL_UNSIGNED_INT; bool use_buffers = index_buffer != NULL; int num_vtx = end - start; -#if defined ALLEGRO_IPHONE +#if defined A5O_IPHONE GLushort* iphone_idx = NULL; #endif @@ -530,7 +530,7 @@ static int draw_prim_indexed_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture } } -#if defined ALLEGRO_IPHONE +#if defined A5O_IPHONE if (!use_buffers) { int ii; iphone_idx = al_malloc(num_vtx * sizeof(GLushort)); @@ -553,36 +553,36 @@ static int draw_prim_indexed_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture setup_state(vtx, decl, texture); switch (type) { - case ALLEGRO_PRIM_LINE_LIST: { + case A5O_PRIM_LINE_LIST: { glDrawElements(GL_LINES, num_vtx, idx_size, idx + start_offset); num_primitives = num_vtx / 2; break; }; - case ALLEGRO_PRIM_LINE_STRIP: { + case A5O_PRIM_LINE_STRIP: { glDrawElements(GL_LINE_STRIP, num_vtx, idx_size, idx + start_offset); num_primitives = num_vtx - 1; break; }; - case ALLEGRO_PRIM_LINE_LOOP: { + case A5O_PRIM_LINE_LOOP: { /* Unimplemented, as it's too hard to do for Direct3D */ break; }; - case ALLEGRO_PRIM_TRIANGLE_LIST: { + case A5O_PRIM_TRIANGLE_LIST: { glDrawElements(GL_TRIANGLES, num_vtx, idx_size, idx + start_offset); num_primitives = num_vtx / 3; break; }; - case ALLEGRO_PRIM_TRIANGLE_STRIP: { + case A5O_PRIM_TRIANGLE_STRIP: { glDrawElements(GL_TRIANGLE_STRIP, num_vtx, idx_size, idx + start_offset); num_primitives = num_vtx - 2; break; }; - case ALLEGRO_PRIM_TRIANGLE_FAN: { + case A5O_PRIM_TRIANGLE_FAN: { glDrawElements(GL_TRIANGLE_FAN, num_vtx, idx_size, idx + start_offset); num_primitives = num_vtx - 2; break; }; - case ALLEGRO_PRIM_POINT_LIST: { + case A5O_PRIM_POINT_LIST: { /* Unimplemented, as it's too hard to do for Direct3D */ break; }; @@ -595,18 +595,18 @@ static int draw_prim_indexed_raw(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); } -#if defined ALLEGRO_IPHONE +#if defined A5O_IPHONE al_free(iphone_idx); #endif return num_primitives; } -#endif /* ALLEGRO_CFG_OPENGL */ +#endif /* A5O_CFG_OPENGL */ -int _al_draw_prim_opengl(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, int start, int end, int type) +int _al_draw_prim_opengl(A5O_BITMAP* target, A5O_BITMAP* texture, const void* vtxs, const A5O_VERTEX_DECL* decl, int start, int end, int type) { -#ifdef ALLEGRO_CFG_OPENGL +#ifdef A5O_CFG_OPENGL return draw_prim_raw(target, texture, 0, vtxs, decl, start, end, type); #else (void)target; @@ -621,9 +621,9 @@ int _al_draw_prim_opengl(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, const #endif } -int _al_draw_vertex_buffer_opengl(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX_BUFFER* vertex_buffer, int start, int end, int type) +int _al_draw_vertex_buffer_opengl(A5O_BITMAP* target, A5O_BITMAP* texture, A5O_VERTEX_BUFFER* vertex_buffer, int start, int end, int type) { -#ifdef ALLEGRO_CFG_OPENGL +#ifdef A5O_CFG_OPENGL return draw_prim_raw(target, texture, vertex_buffer, 0, vertex_buffer->decl, start, end, type); #else (void)target; @@ -637,9 +637,9 @@ int _al_draw_vertex_buffer_opengl(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* textur #endif } -int _al_draw_prim_indexed_opengl(ALLEGRO_BITMAP *target, ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, const int* indices, int num_vtx, int type) +int _al_draw_prim_indexed_opengl(A5O_BITMAP *target, A5O_BITMAP* texture, const void* vtxs, const A5O_VERTEX_DECL* decl, const int* indices, int num_vtx, int type) { -#ifdef ALLEGRO_CFG_OPENGL +#ifdef A5O_CFG_OPENGL return draw_prim_indexed_raw(target, texture, NULL, vtxs, decl, NULL, indices, 0, num_vtx, type); #else (void)target; @@ -654,9 +654,9 @@ int _al_draw_prim_indexed_opengl(ALLEGRO_BITMAP *target, ALLEGRO_BITMAP* texture #endif } -int _al_draw_indexed_buffer_opengl(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX_BUFFER* vertex_buffer, ALLEGRO_INDEX_BUFFER* index_buffer, int start, int end, int type) +int _al_draw_indexed_buffer_opengl(A5O_BITMAP* target, A5O_BITMAP* texture, A5O_VERTEX_BUFFER* vertex_buffer, A5O_INDEX_BUFFER* index_buffer, int start, int end, int type) { -#ifdef ALLEGRO_CFG_OPENGL +#ifdef A5O_CFG_OPENGL return draw_prim_indexed_raw(target, texture, vertex_buffer, NULL, vertex_buffer->decl, index_buffer, NULL, start, end, type); #else (void)target; @@ -671,23 +671,23 @@ int _al_draw_indexed_buffer_opengl(ALLEGRO_BITMAP* target, ALLEGRO_BITMAP* textu #endif } -#ifdef ALLEGRO_CFG_OPENGL -static bool create_buffer_common(ALLEGRO_BUFFER_COMMON* common, GLenum type, const void* initial_data, GLsizeiptr size, int flags) +#ifdef A5O_CFG_OPENGL +static bool create_buffer_common(A5O_BUFFER_COMMON* common, GLenum type, const void* initial_data, GLsizeiptr size, int flags) { GLuint vbo; GLenum usage; switch (flags) { -#if !defined ALLEGRO_CFG_OPENGLES - case ALLEGRO_PRIM_BUFFER_STREAM: +#if !defined A5O_CFG_OPENGLES + case A5O_PRIM_BUFFER_STREAM: usage = GL_STREAM_DRAW; break; #endif - case ALLEGRO_PRIM_BUFFER_STATIC: + case A5O_PRIM_BUFFER_STATIC: usage = GL_STATIC_DRAW; break; - case ALLEGRO_PRIM_BUFFER_DYNAMIC: + case A5O_PRIM_BUFFER_DYNAMIC: usage = GL_DYNAMIC_DRAW; break; default: @@ -708,10 +708,10 @@ static bool create_buffer_common(ALLEGRO_BUFFER_COMMON* common, GLenum type, con } #endif -bool _al_create_vertex_buffer_opengl(ALLEGRO_VERTEX_BUFFER* buf, const void* initial_data, size_t num_vertices, int flags) +bool _al_create_vertex_buffer_opengl(A5O_VERTEX_BUFFER* buf, const void* initial_data, size_t num_vertices, int flags) { -#ifdef ALLEGRO_CFG_OPENGL - int stride = buf->decl ? buf->decl->stride : (int)sizeof(ALLEGRO_VERTEX); +#ifdef A5O_CFG_OPENGL + int stride = buf->decl ? buf->decl->stride : (int)sizeof(A5O_VERTEX); return create_buffer_common(&buf->common, GL_ARRAY_BUFFER, initial_data, num_vertices * stride, flags); #else @@ -724,9 +724,9 @@ bool _al_create_vertex_buffer_opengl(ALLEGRO_VERTEX_BUFFER* buf, const void* ini #endif } -bool _al_create_index_buffer_opengl(ALLEGRO_INDEX_BUFFER* buf, const void* initial_data, size_t num_indices, int flags) +bool _al_create_index_buffer_opengl(A5O_INDEX_BUFFER* buf, const void* initial_data, size_t num_indices, int flags) { -#ifdef ALLEGRO_CFG_OPENGL +#ifdef A5O_CFG_OPENGL return create_buffer_common(&buf->common, GL_ELEMENT_ARRAY_BUFFER, initial_data, num_indices * buf->index_size, flags);; #else (void)buf; @@ -738,9 +738,9 @@ bool _al_create_index_buffer_opengl(ALLEGRO_INDEX_BUFFER* buf, const void* initi #endif } -void _al_destroy_vertex_buffer_opengl(ALLEGRO_VERTEX_BUFFER* buf) +void _al_destroy_vertex_buffer_opengl(A5O_VERTEX_BUFFER* buf) { -#ifdef ALLEGRO_CFG_OPENGL +#ifdef A5O_CFG_OPENGL glDeleteBuffers(1, (GLuint*)&buf->common.handle); al_free(buf->common.locked_memory); #else @@ -748,9 +748,9 @@ void _al_destroy_vertex_buffer_opengl(ALLEGRO_VERTEX_BUFFER* buf) #endif } -void _al_destroy_index_buffer_opengl(ALLEGRO_INDEX_BUFFER* buf) +void _al_destroy_index_buffer_opengl(A5O_INDEX_BUFFER* buf) { -#ifdef ALLEGRO_CFG_OPENGL +#ifdef A5O_CFG_OPENGL glDeleteBuffers(1, (GLuint*)&buf->common.handle); al_free(buf->common.locked_memory); #else @@ -758,16 +758,16 @@ void _al_destroy_index_buffer_opengl(ALLEGRO_INDEX_BUFFER* buf) #endif } -#ifdef ALLEGRO_CFG_OPENGL -static void* lock_buffer_common(ALLEGRO_BUFFER_COMMON* common, GLenum type) +#ifdef A5O_CFG_OPENGL +static void* lock_buffer_common(A5O_BUFFER_COMMON* common, GLenum type) { if (common->local_buffer_length < common->lock_length) { common->locked_memory = al_realloc(common->locked_memory, common->lock_length); common->local_buffer_length = common->lock_length; } - if (common->lock_flags != ALLEGRO_LOCK_WRITEONLY) { -#if !defined ALLEGRO_CFG_OPENGLES + if (common->lock_flags != A5O_LOCK_WRITEONLY) { +#if !defined A5O_CFG_OPENGLES glBindBuffer(type, (GLuint)common->handle); glGetBufferSubData(type, common->lock_offset, common->lock_length, common->locked_memory); glBindBuffer(type, 0); @@ -782,9 +782,9 @@ static void* lock_buffer_common(ALLEGRO_BUFFER_COMMON* common, GLenum type) } #endif -void* _al_lock_vertex_buffer_opengl(ALLEGRO_VERTEX_BUFFER* buf) +void* _al_lock_vertex_buffer_opengl(A5O_VERTEX_BUFFER* buf) { -#ifdef ALLEGRO_CFG_OPENGL +#ifdef A5O_CFG_OPENGL return lock_buffer_common(&buf->common, GL_ARRAY_BUFFER); #else (void)buf; @@ -793,9 +793,9 @@ void* _al_lock_vertex_buffer_opengl(ALLEGRO_VERTEX_BUFFER* buf) #endif } -void* _al_lock_index_buffer_opengl(ALLEGRO_INDEX_BUFFER* buf) +void* _al_lock_index_buffer_opengl(A5O_INDEX_BUFFER* buf) { -#ifdef ALLEGRO_CFG_OPENGL +#ifdef A5O_CFG_OPENGL return lock_buffer_common(&buf->common, GL_ELEMENT_ARRAY_BUFFER); #else (void)buf; @@ -804,10 +804,10 @@ void* _al_lock_index_buffer_opengl(ALLEGRO_INDEX_BUFFER* buf) #endif } -#ifdef ALLEGRO_CFG_OPENGL -static void unlock_buffer_common(ALLEGRO_BUFFER_COMMON* common, GLenum type) +#ifdef A5O_CFG_OPENGL +static void unlock_buffer_common(A5O_BUFFER_COMMON* common, GLenum type) { - if (common->lock_flags != ALLEGRO_LOCK_READONLY) { + if (common->lock_flags != A5O_LOCK_READONLY) { glBindBuffer(type, (GLuint)common->handle); glBufferSubData(type, common->lock_offset, common->lock_length, common->locked_memory); glBindBuffer(type, 0); @@ -815,18 +815,18 @@ static void unlock_buffer_common(ALLEGRO_BUFFER_COMMON* common, GLenum type) } #endif -void _al_unlock_vertex_buffer_opengl(ALLEGRO_VERTEX_BUFFER* buf) +void _al_unlock_vertex_buffer_opengl(A5O_VERTEX_BUFFER* buf) { -#ifdef ALLEGRO_CFG_OPENGL +#ifdef A5O_CFG_OPENGL unlock_buffer_common(&buf->common, GL_ARRAY_BUFFER); #else (void)buf; #endif } -void _al_unlock_index_buffer_opengl(ALLEGRO_INDEX_BUFFER* buf) +void _al_unlock_index_buffer_opengl(A5O_INDEX_BUFFER* buf) { -#ifdef ALLEGRO_CFG_OPENGL +#ifdef A5O_CFG_OPENGL unlock_buffer_common(&buf->common, GL_ELEMENT_ARRAY_BUFFER); #else (void)buf; diff --git a/addons/primitives/prim_soft.c b/addons/primitives/prim_soft.c index b33c7fbfda..f2b35d50d2 100644 --- a/addons/primitives/prim_soft.c +++ b/addons/primitives/prim_soft.c @@ -16,7 +16,7 @@ * See readme.txt for copyright information. */ -#define ALLEGRO_INTERNAL_UNSTABLE +#define A5O_INTERNAL_UNSTABLE #include "allegro5/allegro.h" #include "allegro5/internal/aintern_bitmap.h" @@ -30,27 +30,27 @@ /* The vertex cache allows for bulk transformation of vertices, for faster run speeds */ -#define LOCAL_VERTEX_CACHE ALLEGRO_VERTEX vertex_cache[ALLEGRO_VERTEX_CACHE_SIZE] +#define LOCAL_VERTEX_CACHE A5O_VERTEX vertex_cache[A5O_VERTEX_CACHE_SIZE] -static void convert_vtx(ALLEGRO_BITMAP* texture, const char* src, ALLEGRO_VERTEX* dest, const ALLEGRO_VERTEX_DECL* decl) +static void convert_vtx(A5O_BITMAP* texture, const char* src, A5O_VERTEX* dest, const A5O_VERTEX_DECL* decl) { - ALLEGRO_VERTEX_ELEMENT* e; + A5O_VERTEX_ELEMENT* e; if(!decl) { - *dest = *((ALLEGRO_VERTEX*)src); + *dest = *((A5O_VERTEX*)src); return; } - e = &decl->elements[ALLEGRO_PRIM_POSITION]; + e = &decl->elements[A5O_PRIM_POSITION]; if(e->attribute) { switch(e->storage) { - case ALLEGRO_PRIM_FLOAT_2: - case ALLEGRO_PRIM_FLOAT_3: + case A5O_PRIM_FLOAT_2: + case A5O_PRIM_FLOAT_3: { float *ptr = (float*)(src + e->offset); dest->x = *(ptr); dest->y = *(ptr + 1); break; } - case ALLEGRO_PRIM_SHORT_2: + case A5O_PRIM_SHORT_2: { short *ptr = (short*)(src + e->offset); dest->x = (float)*(ptr); @@ -63,20 +63,20 @@ static void convert_vtx(ALLEGRO_BITMAP* texture, const char* src, ALLEGRO_VERTEX dest->y = 0; } - e = &decl->elements[ALLEGRO_PRIM_TEX_COORD]; + e = &decl->elements[A5O_PRIM_TEX_COORD]; if(!e->attribute) - e = &decl->elements[ALLEGRO_PRIM_TEX_COORD_PIXEL]; + e = &decl->elements[A5O_PRIM_TEX_COORD_PIXEL]; if(e->attribute) { switch(e->storage) { - case ALLEGRO_PRIM_FLOAT_2: - case ALLEGRO_PRIM_FLOAT_3: + case A5O_PRIM_FLOAT_2: + case A5O_PRIM_FLOAT_3: { float *ptr = (float*)(src + e->offset); dest->u = *(ptr); dest->v = *(ptr + 1); break; } - case ALLEGRO_PRIM_SHORT_2: + case A5O_PRIM_SHORT_2: { short *ptr = (short*)(src + e->offset); dest->u = (float)*(ptr); @@ -84,7 +84,7 @@ static void convert_vtx(ALLEGRO_BITMAP* texture, const char* src, ALLEGRO_VERTEX break; } } - if(texture && e->attribute == ALLEGRO_PRIM_TEX_COORD) { + if(texture && e->attribute == A5O_PRIM_TEX_COORD) { dest->u *= (float)al_get_bitmap_width(texture); dest->v *= (float)al_get_bitmap_height(texture); } @@ -93,29 +93,29 @@ static void convert_vtx(ALLEGRO_BITMAP* texture, const char* src, ALLEGRO_VERTEX dest->v = 0; } - e = &decl->elements[ALLEGRO_PRIM_COLOR_ATTR]; + e = &decl->elements[A5O_PRIM_COLOR_ATTR]; if(e->attribute) { - dest->color = *(ALLEGRO_COLOR*)(src + e->offset); + dest->color = *(A5O_COLOR*)(src + e->offset); } else { dest->color = al_map_rgba_f(1,1,1,1); } } -int _al_draw_prim_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, int start, int end, int type) +int _al_draw_prim_soft(A5O_BITMAP* texture, const void* vtxs, const A5O_VERTEX_DECL* decl, int start, int end, int type) { LOCAL_VERTEX_CACHE; int num_primitives; int num_vtx; int use_cache; - int stride = decl ? decl->stride : (int)sizeof(ALLEGRO_VERTEX); - const ALLEGRO_TRANSFORM* global_trans = al_get_current_transform(); + int stride = decl ? decl->stride : (int)sizeof(A5O_VERTEX); + const A5O_TRANSFORM* global_trans = al_get_current_transform(); num_primitives = 0; num_vtx = end - start; - use_cache = num_vtx < ALLEGRO_VERTEX_CACHE_SIZE; + use_cache = num_vtx < A5O_VERTEX_CACHE_SIZE; if (texture) - al_lock_bitmap(texture, ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_READONLY); + al_lock_bitmap(texture, A5O_PIXEL_FORMAT_ANY, A5O_LOCK_READONLY); if (use_cache) { int ii; @@ -134,7 +134,7 @@ int _al_draw_prim_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_ al_transform_coordinates(global_trans, &v.x, &v.y); \ switch (type) { - case ALLEGRO_PRIM_LINE_LIST: { + case A5O_PRIM_LINE_LIST: { if (use_cache) { int ii; for (ii = 0; ii < num_vtx - 1; ii += 2) { @@ -143,7 +143,7 @@ int _al_draw_prim_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_ } else { int ii; for (ii = start; ii < end - 1; ii += 2) { - ALLEGRO_VERTEX v1, v2; + A5O_VERTEX v1, v2; SET_VERTEX(v1, ii); SET_VERTEX(v2, ii + 1); @@ -153,7 +153,7 @@ int _al_draw_prim_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_ num_primitives = num_vtx / 2; break; }; - case ALLEGRO_PRIM_LINE_STRIP: { + case A5O_PRIM_LINE_STRIP: { if (use_cache) { int ii; for (ii = 1; ii < num_vtx; ii++) { @@ -162,7 +162,7 @@ int _al_draw_prim_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_ } else { int ii; int idx = 1; - ALLEGRO_VERTEX vtx[2]; + A5O_VERTEX vtx[2]; SET_VERTEX(vtx[0], start); for (ii = start + 1; ii < end; ii++) { SET_VERTEX(vtx[idx], ii) @@ -173,7 +173,7 @@ int _al_draw_prim_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_ num_primitives = num_vtx - 1; break; }; - case ALLEGRO_PRIM_LINE_LOOP: { + case A5O_PRIM_LINE_LOOP: { if (use_cache) { int ii; for (ii = 1; ii < num_vtx; ii++) { @@ -183,7 +183,7 @@ int _al_draw_prim_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_ } else { int ii; int idx = 1; - ALLEGRO_VERTEX vtx[2]; + A5O_VERTEX vtx[2]; SET_VERTEX(vtx[0], start); for (ii = start + 1; ii < end; ii++) { SET_VERTEX(vtx[idx], ii) @@ -196,7 +196,7 @@ int _al_draw_prim_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_ num_primitives = num_vtx; break; }; - case ALLEGRO_PRIM_TRIANGLE_LIST: { + case A5O_PRIM_TRIANGLE_LIST: { if (use_cache) { int ii; for (ii = 0; ii < num_vtx - 2; ii += 3) { @@ -205,7 +205,7 @@ int _al_draw_prim_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_ } else { int ii; for (ii = start; ii < end - 2; ii += 3) { - ALLEGRO_VERTEX v1, v2, v3; + A5O_VERTEX v1, v2, v3; SET_VERTEX(v1, ii); SET_VERTEX(v2, ii + 1); SET_VERTEX(v3, ii + 2); @@ -216,7 +216,7 @@ int _al_draw_prim_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_ num_primitives = num_vtx / 3; break; }; - case ALLEGRO_PRIM_TRIANGLE_STRIP: { + case A5O_PRIM_TRIANGLE_STRIP: { if (use_cache) { int ii; for (ii = 2; ii < num_vtx; ii++) { @@ -225,7 +225,7 @@ int _al_draw_prim_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_ } else { int ii; int idx = 2; - ALLEGRO_VERTEX vtx[3]; + A5O_VERTEX vtx[3]; SET_VERTEX(vtx[0], start); SET_VERTEX(vtx[1], start + 1); for (ii = start + 2; ii < end; ii++) { @@ -238,7 +238,7 @@ int _al_draw_prim_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_ num_primitives = num_vtx - 2; break; }; - case ALLEGRO_PRIM_TRIANGLE_FAN: { + case A5O_PRIM_TRIANGLE_FAN: { if (use_cache) { int ii; for (ii = 1; ii < num_vtx; ii++) { @@ -247,8 +247,8 @@ int _al_draw_prim_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_ } else { int ii; int idx = 1; - ALLEGRO_VERTEX v0; - ALLEGRO_VERTEX vtx[2]; + A5O_VERTEX v0; + A5O_VERTEX vtx[2]; SET_VERTEX(v0, start); SET_VERTEX(vtx[0], start + 1); for (ii = start + 1; ii < end; ii++) { @@ -260,7 +260,7 @@ int _al_draw_prim_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_ num_primitives = num_vtx - 2; break; }; - case ALLEGRO_PRIM_POINT_LIST: { + case A5O_PRIM_POINT_LIST: { if (use_cache) { int ii; for (ii = 0; ii < num_vtx; ii++) { @@ -269,7 +269,7 @@ int _al_draw_prim_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_ } else { int ii; for (ii = start; ii < end; ii++) { - ALLEGRO_VERTEX v; + A5O_VERTEX v; SET_VERTEX(v, ii); _al_point_2d(texture, &v); @@ -287,7 +287,7 @@ int _al_draw_prim_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_ #undef SET_VERTEX } -int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, +int _al_draw_prim_indexed_soft(A5O_BITMAP* texture, const void* vtxs, const A5O_VERTEX_DECL* decl, const int* indices, int num_vtx, int type) { LOCAL_VERTEX_CACHE; @@ -295,8 +295,8 @@ int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const int use_cache; int min_idx, max_idx; int ii; - int stride = decl ? decl->stride : (int)sizeof(ALLEGRO_VERTEX); - const ALLEGRO_TRANSFORM* global_trans = al_get_current_transform(); + int stride = decl ? decl->stride : (int)sizeof(A5O_VERTEX); + const A5O_TRANSFORM* global_trans = al_get_current_transform(); num_primitives = 0; use_cache = 1; @@ -313,12 +313,12 @@ int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const else if (min_idx > indices[ii]) min_idx = idx; } - if (max_idx - min_idx >= ALLEGRO_VERTEX_CACHE_SIZE) { + if (max_idx - min_idx >= A5O_VERTEX_CACHE_SIZE) { use_cache = 0; } if (texture) - al_lock_bitmap(texture, ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_READONLY); + al_lock_bitmap(texture, A5O_PIXEL_FORMAT_ANY, A5O_LOCK_READONLY); if (use_cache) { int ii; @@ -334,7 +334,7 @@ int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const al_transform_coordinates(global_trans, &v.x, &v.y); \ switch (type) { - case ALLEGRO_PRIM_LINE_LIST: { + case A5O_PRIM_LINE_LIST: { if (use_cache) { int ii; for (ii = 0; ii < num_vtx - 1; ii += 2) { @@ -349,7 +349,7 @@ int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const int idx1 = indices[ii]; int idx2 = indices[ii + 1]; - ALLEGRO_VERTEX v1, v2; + A5O_VERTEX v1, v2; SET_VERTEX(v1, idx1); SET_VERTEX(v2, idx2); @@ -359,7 +359,7 @@ int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const num_primitives = num_vtx / 2; break; }; - case ALLEGRO_PRIM_LINE_STRIP: { + case A5O_PRIM_LINE_STRIP: { if (use_cache) { int ii; for (ii = 1; ii < num_vtx; ii++) { @@ -371,7 +371,7 @@ int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const } else { int ii; int idx = 1; - ALLEGRO_VERTEX vtx[2]; + A5O_VERTEX vtx[2]; SET_VERTEX(vtx[0], indices[0]); for (ii = 1; ii < num_vtx; ii++) { SET_VERTEX(vtx[idx], indices[ii]) @@ -382,7 +382,7 @@ int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const num_primitives = num_vtx - 1; break; }; - case ALLEGRO_PRIM_LINE_LOOP: { + case A5O_PRIM_LINE_LOOP: { if (use_cache) { int ii; int idx1, idx2; @@ -400,7 +400,7 @@ int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const } else { int ii; int idx = 1; - ALLEGRO_VERTEX vtx[2]; + A5O_VERTEX vtx[2]; SET_VERTEX(vtx[0], indices[0]); for (ii = 1; ii < num_vtx; ii++) { SET_VERTEX(vtx[idx], indices[ii]) @@ -413,7 +413,7 @@ int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const num_primitives = num_vtx; break; }; - case ALLEGRO_PRIM_TRIANGLE_LIST: { + case A5O_PRIM_TRIANGLE_LIST: { if (use_cache) { int ii; for (ii = 0; ii < num_vtx - 2; ii += 3) { @@ -429,7 +429,7 @@ int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const int idx2 = indices[ii + 1]; int idx3 = indices[ii + 2]; - ALLEGRO_VERTEX v1, v2, v3; + A5O_VERTEX v1, v2, v3; SET_VERTEX(v1, idx1); SET_VERTEX(v2, idx2); SET_VERTEX(v3, idx3); @@ -440,7 +440,7 @@ int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const num_primitives = num_vtx / 3; break; }; - case ALLEGRO_PRIM_TRIANGLE_STRIP: { + case A5O_PRIM_TRIANGLE_STRIP: { if (use_cache) { int ii; for (ii = 2; ii < num_vtx; ii++) { @@ -452,7 +452,7 @@ int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const } else { int ii; int idx = 2; - ALLEGRO_VERTEX vtx[3]; + A5O_VERTEX vtx[3]; SET_VERTEX(vtx[0], indices[0]); SET_VERTEX(vtx[1], indices[1]); for (ii = 2; ii < num_vtx; ii ++) { @@ -465,7 +465,7 @@ int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const num_primitives = num_vtx - 2; break; }; - case ALLEGRO_PRIM_TRIANGLE_FAN: { + case A5O_PRIM_TRIANGLE_FAN: { if (use_cache) { int ii; int idx0 = indices[0] - min_idx; @@ -477,8 +477,8 @@ int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const } else { int ii; int idx = 1; - ALLEGRO_VERTEX v0; - ALLEGRO_VERTEX vtx[2]; + A5O_VERTEX v0; + A5O_VERTEX vtx[2]; SET_VERTEX(v0, indices[0]); SET_VERTEX(vtx[0], indices[1]); for (ii = 2; ii < num_vtx; ii ++) { @@ -490,7 +490,7 @@ int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const num_primitives = num_vtx - 2; break; }; - case ALLEGRO_PRIM_POINT_LIST: { + case A5O_PRIM_POINT_LIST: { if (use_cache) { int ii; for (ii = 0; ii < num_vtx; ii++) { @@ -500,7 +500,7 @@ int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const } else { int ii; for (ii = 0; ii < num_vtx; ii++) { - ALLEGRO_VERTEX v; + A5O_VERTEX v; SET_VERTEX(v, indices[ii]); _al_point_2d(texture, &v); @@ -521,8 +521,8 @@ int _al_draw_prim_indexed_soft(ALLEGRO_BITMAP* texture, const void* vtxs, const /* Function: al_draw_soft_triangle */ void al_draw_soft_triangle( - ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, ALLEGRO_VERTEX* v3, uintptr_t state, - void (*init)(uintptr_t, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*), + A5O_VERTEX* v1, A5O_VERTEX* v2, A5O_VERTEX* v3, uintptr_t state, + void (*init)(uintptr_t, A5O_VERTEX*, A5O_VERTEX*, A5O_VERTEX*), void (*first)(uintptr_t, int, int, int, int), void (*step)(uintptr_t, int), void (*draw)(uintptr_t, int, int, int)) diff --git a/addons/primitives/prim_util.c b/addons/primitives/prim_util.c index 869a853a3c..b6c19fea91 100644 --- a/addons/primitives/prim_util.c +++ b/addons/primitives/prim_util.c @@ -23,7 +23,7 @@ #include #include -#ifdef ALLEGRO_MSVC +#ifdef A5O_MSVC #define hypotf(x, y) _hypotf((x), (y)) #endif @@ -35,7 +35,7 @@ */ float _al_prim_get_scale(void) { - const ALLEGRO_TRANSFORM* t = al_get_current_transform(); + const A5O_TRANSFORM* t = al_get_current_transform(); return (hypotf(t->m[0][0], t->m[0][1]) + hypotf(t->m[1][0], t->m[1][1])) / 2; } @@ -163,12 +163,12 @@ bool _al_prim_are_points_equal(const float* point_a, const float* point_b) /* * */ -void _al_prim_cache_init(ALLEGRO_PRIM_VERTEX_CACHE* cache, int prim_type, ALLEGRO_COLOR color) +void _al_prim_cache_init(A5O_PRIM_VERTEX_CACHE* cache, int prim_type, A5O_COLOR color) { _al_prim_cache_init_ex(cache, prim_type, color, NULL); } -void _al_prim_cache_init_ex(ALLEGRO_PRIM_VERTEX_CACHE* cache, int prim_type, ALLEGRO_COLOR color, void* user_data) +void _al_prim_cache_init_ex(A5O_PRIM_VERTEX_CACHE* cache, int prim_type, A5O_COLOR color, void* user_data) { cache->size = 0; cache->current = cache->buffer; @@ -177,22 +177,22 @@ void _al_prim_cache_init_ex(ALLEGRO_PRIM_VERTEX_CACHE* cache, int prim_type, ALL cache->user_data = user_data; } -void _al_prim_cache_term(ALLEGRO_PRIM_VERTEX_CACHE* cache) +void _al_prim_cache_term(A5O_PRIM_VERTEX_CACHE* cache) { _al_prim_cache_flush(cache); } -void _al_prim_cache_flush(ALLEGRO_PRIM_VERTEX_CACHE* cache) +void _al_prim_cache_flush(A5O_PRIM_VERTEX_CACHE* cache) { if (cache->size == 0) return; - if (cache->prim_type == ALLEGRO_PRIM_VERTEX_CACHE_TRIANGLE) - al_draw_prim(cache->buffer, NULL, NULL, 0, cache->size, ALLEGRO_PRIM_TRIANGLE_LIST); - else if (cache->prim_type == ALLEGRO_PRIM_VERTEX_CACHE_LINE_STRIP) - al_draw_prim(cache->buffer, NULL, NULL, 0, cache->size, ALLEGRO_PRIM_LINE_STRIP); + if (cache->prim_type == A5O_PRIM_VERTEX_CACHE_TRIANGLE) + al_draw_prim(cache->buffer, NULL, NULL, 0, cache->size, A5O_PRIM_TRIANGLE_LIST); + else if (cache->prim_type == A5O_PRIM_VERTEX_CACHE_LINE_STRIP) + al_draw_prim(cache->buffer, NULL, NULL, 0, cache->size, A5O_PRIM_LINE_STRIP); - if (cache->prim_type == ALLEGRO_PRIM_VERTEX_CACHE_LINE_STRIP) + if (cache->prim_type == A5O_PRIM_VERTEX_CACHE_LINE_STRIP) { cache->buffer[0] = *(cache->current - 1); cache->current = cache->buffer + 1; @@ -205,9 +205,9 @@ void _al_prim_cache_flush(ALLEGRO_PRIM_VERTEX_CACHE* cache) } } -void _al_prim_cache_push_triangle(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* v0, const float* v1, const float* v2) +void _al_prim_cache_push_triangle(A5O_PRIM_VERTEX_CACHE* cache, const float* v0, const float* v1, const float* v2) { - if (cache->size >= (ALLEGRO_VERTEX_CACHE_SIZE - 3)) + if (cache->size >= (A5O_VERTEX_CACHE_SIZE - 3)) _al_prim_cache_flush(cache); cache->current->x = v0[0]; @@ -236,9 +236,9 @@ void _al_prim_cache_push_triangle(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* //al_draw_triangle(v0[0], v0[1], v1[0], v1[1], v2[0], v2[1], cache->color, 1.0f); } -void _al_prim_cache_push_point(ALLEGRO_PRIM_VERTEX_CACHE* cache, const float* v) +void _al_prim_cache_push_point(A5O_PRIM_VERTEX_CACHE* cache, const float* v) { - if (cache->size >= (ALLEGRO_VERTEX_CACHE_SIZE - 1)) + if (cache->size >= (A5O_VERTEX_CACHE_SIZE - 1)) _al_prim_cache_flush(cache); cache->current->x = v[0]; diff --git a/addons/primitives/primitives.c b/addons/primitives/primitives.c index 7aaeb4dda4..e63c48cb2e 100644 --- a/addons/primitives/primitives.c +++ b/addons/primitives/primitives.c @@ -16,7 +16,7 @@ * See readme.txt for copyright information. */ -#define ALLEGRO_INTERNAL_UNSTABLE +#define A5O_INTERNAL_UNSTABLE #include "allegro5/allegro.h" #include "allegro5/allegro_primitives.h" @@ -31,15 +31,15 @@ #include "allegro5/internal/aintern_prim_soft.h" #include -#ifdef ALLEGRO_CFG_OPENGL +#ifdef A5O_CFG_OPENGL #include "allegro5/allegro_opengl.h" #endif -#ifndef ALLEGRO_DIRECT3D -#define ALLEGRO_DIRECT3D ALLEGRO_DIRECT3D_INTERNAL +#ifndef A5O_DIRECT3D +#define A5O_DIRECT3D A5O_DIRECT3D_INTERNAL #endif -ALLEGRO_DEBUG_CHANNEL("primitives") +A5O_DEBUG_CHANNEL("primitives") static bool addon_initialized = false; @@ -74,17 +74,17 @@ void al_shutdown_primitives_addon(void) /* Function: al_draw_prim */ -int al_draw_prim(const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, - ALLEGRO_BITMAP* texture, int start, int end, int type) +int al_draw_prim(const void* vtxs, const A5O_VERTEX_DECL* decl, + A5O_BITMAP* texture, int start, int end, int type) { - ALLEGRO_BITMAP *target; + A5O_BITMAP *target; int ret = 0; ASSERT(addon_initialized); ASSERT(vtxs); ASSERT(end >= start); ASSERT(start >= 0); - ASSERT(type >= 0 && type < ALLEGRO_PRIM_NUM_TYPES); + ASSERT(type >= 0 && type < A5O_PRIM_NUM_TYPES); target = al_get_target_bitmap(); @@ -92,15 +92,15 @@ int al_draw_prim(const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, * view space should occur here */ - if (al_get_bitmap_flags(target) & ALLEGRO_MEMORY_BITMAP || - (texture && al_get_bitmap_flags(texture) & ALLEGRO_MEMORY_BITMAP) || + if (al_get_bitmap_flags(target) & A5O_MEMORY_BITMAP || + (texture && al_get_bitmap_flags(texture) & A5O_MEMORY_BITMAP) || _al_pixel_format_is_compressed(al_get_bitmap_format(target))) { ret = _al_draw_prim_soft(texture, vtxs, decl, start, end, type); } else { int flags = al_get_display_flags(_al_get_bitmap_display(target)); - if (flags & ALLEGRO_OPENGL) { + if (flags & A5O_OPENGL) { ret = _al_draw_prim_opengl(target, texture, vtxs, decl, start, end, type); - } else if (flags & ALLEGRO_DIRECT3D) { + } else if (flags & A5O_DIRECT3D) { ret = _al_draw_prim_directx(target, texture, vtxs, decl, start, end, type); } } @@ -110,17 +110,17 @@ int al_draw_prim(const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, /* Function: al_draw_indexed_prim */ -int al_draw_indexed_prim(const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, - ALLEGRO_BITMAP* texture, const int* indices, int num_vtx, int type) +int al_draw_indexed_prim(const void* vtxs, const A5O_VERTEX_DECL* decl, + A5O_BITMAP* texture, const int* indices, int num_vtx, int type) { - ALLEGRO_BITMAP *target; + A5O_BITMAP *target; int ret = 0; ASSERT(addon_initialized); ASSERT(vtxs); ASSERT(indices); ASSERT(num_vtx > 0); - ASSERT(type >= 0 && type < ALLEGRO_PRIM_NUM_TYPES); + ASSERT(type >= 0 && type < A5O_PRIM_NUM_TYPES); target = al_get_target_bitmap(); @@ -128,15 +128,15 @@ int al_draw_indexed_prim(const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, * view space should occur here */ - if (al_get_bitmap_flags(target) & ALLEGRO_MEMORY_BITMAP || - (texture && al_get_bitmap_flags(texture) & ALLEGRO_MEMORY_BITMAP) || + if (al_get_bitmap_flags(target) & A5O_MEMORY_BITMAP || + (texture && al_get_bitmap_flags(texture) & A5O_MEMORY_BITMAP) || _al_pixel_format_is_compressed(al_get_bitmap_format(target))) { ret = _al_draw_prim_indexed_soft(texture, vtxs, decl, indices, num_vtx, type); } else { int flags = al_get_display_flags(_al_get_bitmap_display(target)); - if (flags & ALLEGRO_OPENGL) { + if (flags & A5O_OPENGL) { ret = _al_draw_prim_indexed_opengl(target, texture, vtxs, decl, indices, num_vtx, type); - } else if (flags & ALLEGRO_DIRECT3D) { + } else if (flags & A5O_DIRECT3D) { ret = _al_draw_prim_indexed_directx(target, texture, vtxs, decl, indices, num_vtx, type); } } @@ -144,7 +144,7 @@ int al_draw_indexed_prim(const void* vtxs, const ALLEGRO_VERTEX_DECL* decl, return ret; } -int _al_bitmap_region_is_locked(ALLEGRO_BITMAP* bmp, int x1, int y1, int w, int h) +int _al_bitmap_region_is_locked(A5O_BITMAP* bmp, int x1, int y1, int w, int h) { ASSERT(bmp); @@ -159,27 +159,27 @@ int _al_bitmap_region_is_locked(ALLEGRO_BITMAP* bmp, int x1, int y1, int w, int */ uint32_t al_get_allegro_primitives_version(void) { - return ALLEGRO_VERSION_INT; + return A5O_VERSION_INT; } /* Function: al_create_vertex_decl */ -ALLEGRO_VERTEX_DECL* al_create_vertex_decl(const ALLEGRO_VERTEX_ELEMENT* elements, int stride) +A5O_VERTEX_DECL* al_create_vertex_decl(const A5O_VERTEX_ELEMENT* elements, int stride) { - ALLEGRO_VERTEX_DECL* ret; - ALLEGRO_DISPLAY* display; - ALLEGRO_VERTEX_ELEMENT* e; + A5O_VERTEX_DECL* ret; + A5O_DISPLAY* display; + A5O_VERTEX_ELEMENT* e; int flags; ASSERT(addon_initialized); - ret = al_malloc(sizeof(ALLEGRO_VERTEX_DECL)); - ret->elements = al_calloc(1, sizeof(ALLEGRO_VERTEX_ELEMENT) * ALLEGRO_PRIM_ATTR_NUM); + ret = al_malloc(sizeof(A5O_VERTEX_DECL)); + ret->elements = al_calloc(1, sizeof(A5O_VERTEX_ELEMENT) * A5O_PRIM_ATTR_NUM); while(elements->attribute) { -#ifdef ALLEGRO_CFG_OPENGLES - if (elements->storage == ALLEGRO_PRIM_HALF_FLOAT_2 || - elements->storage == ALLEGRO_PRIM_HALF_FLOAT_4) { - ALLEGRO_WARN("This platform does not support ALLEGRO_PRIM_HALF_FLOAT_2 or ALLEGRO_PRIM_HALF_FLOAT_4.\n"); +#ifdef A5O_CFG_OPENGLES + if (elements->storage == A5O_PRIM_HALF_FLOAT_2 || + elements->storage == A5O_PRIM_HALF_FLOAT_4) { + A5O_WARN("This platform does not support A5O_PRIM_HALF_FLOAT_2 or A5O_PRIM_HALF_FLOAT_4.\n"); goto fail; } #endif @@ -187,30 +187,30 @@ ALLEGRO_VERTEX_DECL* al_create_vertex_decl(const ALLEGRO_VERTEX_ELEMENT* element elements++; } - e = &ret->elements[ALLEGRO_PRIM_POSITION]; + e = &ret->elements[A5O_PRIM_POSITION]; if (e->attribute) { - if (e->storage != ALLEGRO_PRIM_FLOAT_2 && - e->storage != ALLEGRO_PRIM_FLOAT_3 && - e->storage != ALLEGRO_PRIM_SHORT_2) { - ALLEGRO_WARN("Invalid storage for ALLEGRO_PRIM_POSITION.\n"); + if (e->storage != A5O_PRIM_FLOAT_2 && + e->storage != A5O_PRIM_FLOAT_3 && + e->storage != A5O_PRIM_SHORT_2) { + A5O_WARN("Invalid storage for A5O_PRIM_POSITION.\n"); goto fail; } } - e = &ret->elements[ALLEGRO_PRIM_TEX_COORD]; + e = &ret->elements[A5O_PRIM_TEX_COORD]; if(!e->attribute) - e = &ret->elements[ALLEGRO_PRIM_TEX_COORD_PIXEL]; + e = &ret->elements[A5O_PRIM_TEX_COORD_PIXEL]; if (e->attribute) { - if (e->storage != ALLEGRO_PRIM_FLOAT_2 && - e->storage != ALLEGRO_PRIM_SHORT_2) { - ALLEGRO_WARN("Invalid storage for %s.\n", ret->elements[ALLEGRO_PRIM_TEX_COORD].attribute ? "ALLEGRO_PRIM_TEX_COORD" : "ALLEGRO_PRIM_TEX_COORD_PIXEL"); + if (e->storage != A5O_PRIM_FLOAT_2 && + e->storage != A5O_PRIM_SHORT_2) { + A5O_WARN("Invalid storage for %s.\n", ret->elements[A5O_PRIM_TEX_COORD].attribute ? "A5O_PRIM_TEX_COORD" : "A5O_PRIM_TEX_COORD_PIXEL"); goto fail; } } display = al_get_current_display(); flags = al_get_display_flags(display); - if (flags & ALLEGRO_DIRECT3D) { + if (flags & A5O_DIRECT3D) { _al_set_d3d_decl(display, ret); } @@ -224,7 +224,7 @@ ALLEGRO_VERTEX_DECL* al_create_vertex_decl(const ALLEGRO_VERTEX_ELEMENT* element /* Function: al_destroy_vertex_decl */ -void al_destroy_vertex_decl(ALLEGRO_VERTEX_DECL* decl) +void al_destroy_vertex_decl(A5O_VERTEX_DECL* decl) { if (!decl) return; @@ -237,27 +237,27 @@ void al_destroy_vertex_decl(ALLEGRO_VERTEX_DECL* decl) /* Function: al_create_vertex_buffer */ -ALLEGRO_VERTEX_BUFFER* al_create_vertex_buffer(ALLEGRO_VERTEX_DECL* decl, +A5O_VERTEX_BUFFER* al_create_vertex_buffer(A5O_VERTEX_DECL* decl, const void* initial_data, int num_vertices, int flags) { - ALLEGRO_VERTEX_BUFFER* ret; + A5O_VERTEX_BUFFER* ret; int display_flags = al_get_display_flags(al_get_current_display()); ASSERT(addon_initialized); - ret = al_calloc(1, sizeof(ALLEGRO_VERTEX_BUFFER)); + ret = al_calloc(1, sizeof(A5O_VERTEX_BUFFER)); ret->common.size = num_vertices; - ret->common.write_only = !(flags & ALLEGRO_PRIM_BUFFER_READWRITE); + ret->common.write_only = !(flags & A5O_PRIM_BUFFER_READWRITE); ret->decl = decl; -#if defined ALLEGRO_IPHONE || defined ALLEGRO_ANDROID - if (flags & ALLEGRO_PRIM_BUFFER_READWRITE) +#if defined A5O_IPHONE || defined A5O_ANDROID + if (flags & A5O_PRIM_BUFFER_READWRITE) goto fail; #endif - if (display_flags & ALLEGRO_OPENGL) { + if (display_flags & A5O_OPENGL) { if (_al_create_vertex_buffer_opengl(ret, initial_data, num_vertices, flags)) return ret; } - else if (display_flags & ALLEGRO_DIRECT3D) { + else if (display_flags & A5O_DIRECT3D) { if (_al_create_vertex_buffer_directx(ret, initial_data, num_vertices, flags)) return ret; } @@ -271,33 +271,33 @@ ALLEGRO_VERTEX_BUFFER* al_create_vertex_buffer(ALLEGRO_VERTEX_DECL* decl, /* Function: al_create_index_buffer */ -ALLEGRO_INDEX_BUFFER* al_create_index_buffer(int index_size, +A5O_INDEX_BUFFER* al_create_index_buffer(int index_size, const void* initial_data, int num_indices, int flags) { - ALLEGRO_INDEX_BUFFER* ret; + A5O_INDEX_BUFFER* ret; int display_flags = al_get_display_flags(al_get_current_display()); ASSERT(addon_initialized); ASSERT(index_size == 2 || index_size == 4); - ret = al_calloc(1, sizeof(ALLEGRO_INDEX_BUFFER)); + ret = al_calloc(1, sizeof(A5O_INDEX_BUFFER)); ret->common.size = num_indices; - ret->common.write_only = !(flags & ALLEGRO_PRIM_BUFFER_READWRITE); + ret->common.write_only = !(flags & A5O_PRIM_BUFFER_READWRITE); ret->index_size = index_size; -#if defined ALLEGRO_IPHONE || defined ALLEGRO_ANDROID - if (flags & ALLEGRO_PRIM_BUFFER_READWRITE) +#if defined A5O_IPHONE || defined A5O_ANDROID + if (flags & A5O_PRIM_BUFFER_READWRITE) goto fail; #endif -#if defined ALLEGRO_IPHONE +#if defined A5O_IPHONE if (index_size == 4) goto fail; #endif - if (display_flags & ALLEGRO_OPENGL) { + if (display_flags & A5O_OPENGL) { if (_al_create_index_buffer_opengl(ret, initial_data, num_indices, flags)) return ret; } - else if (display_flags & ALLEGRO_DIRECT3D) { + else if (display_flags & A5O_DIRECT3D) { if (_al_create_index_buffer_directx(ret, initial_data, num_indices, flags)) return ret; } @@ -311,7 +311,7 @@ ALLEGRO_INDEX_BUFFER* al_create_index_buffer(int index_size, /* Function: al_destroy_vertex_buffer */ -void al_destroy_vertex_buffer(ALLEGRO_VERTEX_BUFFER* buffer) +void al_destroy_vertex_buffer(A5O_VERTEX_BUFFER* buffer) { if (buffer == 0) return; @@ -321,10 +321,10 @@ void al_destroy_vertex_buffer(ALLEGRO_VERTEX_BUFFER* buffer) al_unlock_vertex_buffer(buffer); - if (flags & ALLEGRO_OPENGL) { + if (flags & A5O_OPENGL) { _al_destroy_vertex_buffer_opengl(buffer); } - else if (flags & ALLEGRO_DIRECT3D) { + else if (flags & A5O_DIRECT3D) { _al_destroy_vertex_buffer_directx(buffer); } @@ -333,7 +333,7 @@ void al_destroy_vertex_buffer(ALLEGRO_VERTEX_BUFFER* buffer) /* Function: al_destroy_index_buffer */ -void al_destroy_index_buffer(ALLEGRO_INDEX_BUFFER* buffer) +void al_destroy_index_buffer(A5O_INDEX_BUFFER* buffer) { if (buffer == 0) return; @@ -343,10 +343,10 @@ void al_destroy_index_buffer(ALLEGRO_INDEX_BUFFER* buffer) al_unlock_index_buffer(buffer); - if (flags & ALLEGRO_OPENGL) { + if (flags & A5O_OPENGL) { _al_destroy_index_buffer_opengl(buffer); } - else if (flags & ALLEGRO_DIRECT3D) { + else if (flags & A5O_DIRECT3D) { _al_destroy_index_buffer_directx(buffer); } @@ -354,9 +354,9 @@ void al_destroy_index_buffer(ALLEGRO_INDEX_BUFFER* buffer) } /* The sizes are in bytes here */ -static bool lock_buffer_common(ALLEGRO_BUFFER_COMMON* common, int offset, int length, int flags) +static bool lock_buffer_common(A5O_BUFFER_COMMON* common, int offset, int length, int flags) { - if (common->is_locked || (common->write_only && flags != ALLEGRO_LOCK_WRITEONLY)) + if (common->is_locked || (common->write_only && flags != A5O_LOCK_WRITEONLY)) return false; common->lock_offset = offset; @@ -368,7 +368,7 @@ static bool lock_buffer_common(ALLEGRO_BUFFER_COMMON* common, int offset, int le /* Function: al_lock_vertex_buffer */ -void* al_lock_vertex_buffer(ALLEGRO_VERTEX_BUFFER* buffer, int offset, +void* al_lock_vertex_buffer(A5O_VERTEX_BUFFER* buffer, int offset, int length, int flags) { int stride; @@ -379,15 +379,15 @@ void* al_lock_vertex_buffer(ALLEGRO_VERTEX_BUFFER* buffer, int offset, if (offset + length > buffer->common.size) return NULL; - stride = buffer->decl ? buffer->decl->stride : (int)sizeof(ALLEGRO_VERTEX); + stride = buffer->decl ? buffer->decl->stride : (int)sizeof(A5O_VERTEX); if (!lock_buffer_common(&buffer->common, offset * stride, length * stride, flags)) return NULL; - if (disp_flags & ALLEGRO_OPENGL) { + if (disp_flags & A5O_OPENGL) { return _al_lock_vertex_buffer_opengl(buffer); } - else if (disp_flags & ALLEGRO_DIRECT3D) { + else if (disp_flags & A5O_DIRECT3D) { return _al_lock_vertex_buffer_directx(buffer); } else { @@ -397,7 +397,7 @@ void* al_lock_vertex_buffer(ALLEGRO_VERTEX_BUFFER* buffer, int offset, /* Function: al_lock_index_buffer */ -void* al_lock_index_buffer(ALLEGRO_INDEX_BUFFER* buffer, int offset, +void* al_lock_index_buffer(A5O_INDEX_BUFFER* buffer, int offset, int length, int flags) { int disp_flags = al_get_display_flags(al_get_current_display()); @@ -410,10 +410,10 @@ void* al_lock_index_buffer(ALLEGRO_INDEX_BUFFER* buffer, int offset, if (!lock_buffer_common(&buffer->common, offset * buffer->index_size, length * buffer->index_size, flags)) return NULL; - if (disp_flags & ALLEGRO_OPENGL) { + if (disp_flags & A5O_OPENGL) { return _al_lock_index_buffer_opengl(buffer); } - else if (disp_flags & ALLEGRO_DIRECT3D) { + else if (disp_flags & A5O_DIRECT3D) { return _al_lock_index_buffer_directx(buffer); } else { @@ -423,7 +423,7 @@ void* al_lock_index_buffer(ALLEGRO_INDEX_BUFFER* buffer, int offset, /* Function: al_unlock_vertex_buffer */ -void al_unlock_vertex_buffer(ALLEGRO_VERTEX_BUFFER* buffer) +void al_unlock_vertex_buffer(A5O_VERTEX_BUFFER* buffer) { int flags = al_get_display_flags(al_get_current_display()); ASSERT(buffer); @@ -434,17 +434,17 @@ void al_unlock_vertex_buffer(ALLEGRO_VERTEX_BUFFER* buffer) buffer->common.is_locked = false; - if (flags & ALLEGRO_OPENGL) { + if (flags & A5O_OPENGL) { _al_unlock_vertex_buffer_opengl(buffer); } - else if (flags & ALLEGRO_DIRECT3D) { + else if (flags & A5O_DIRECT3D) { _al_unlock_vertex_buffer_directx(buffer); } } /* Function: al_unlock_index_buffer */ -void al_unlock_index_buffer(ALLEGRO_INDEX_BUFFER* buffer) +void al_unlock_index_buffer(A5O_INDEX_BUFFER* buffer) { int flags = al_get_display_flags(al_get_current_display()); ASSERT(buffer); @@ -455,16 +455,16 @@ void al_unlock_index_buffer(ALLEGRO_INDEX_BUFFER* buffer) buffer->common.is_locked = false; - if (flags & ALLEGRO_OPENGL) { + if (flags & A5O_OPENGL) { _al_unlock_index_buffer_opengl(buffer); } - else if (flags & ALLEGRO_DIRECT3D) { + else if (flags & A5O_DIRECT3D) { _al_unlock_index_buffer_directx(buffer); } } /* Software fallback for buffer drawing */ -int _al_draw_buffer_common_soft(ALLEGRO_VERTEX_BUFFER* vertex_buffer, ALLEGRO_BITMAP* texture, ALLEGRO_INDEX_BUFFER* index_buffer, int start, int end, int type) +int _al_draw_buffer_common_soft(A5O_VERTEX_BUFFER* vertex_buffer, A5O_BITMAP* texture, A5O_INDEX_BUFFER* index_buffer, int start, int end, int type) { void* vtx; int num_primitives = 0; @@ -475,7 +475,7 @@ int _al_draw_buffer_common_soft(ALLEGRO_VERTEX_BUFFER* vertex_buffer, ALLEGRO_BI return 0; } - vtx = al_lock_vertex_buffer(vertex_buffer, vtx_lock_start, vtx_lock_len, ALLEGRO_LOCK_READONLY); + vtx = al_lock_vertex_buffer(vertex_buffer, vtx_lock_start, vtx_lock_len, A5O_LOCK_READONLY); ASSERT(vtx); if (index_buffer) { @@ -483,7 +483,7 @@ int _al_draw_buffer_common_soft(ALLEGRO_VERTEX_BUFFER* vertex_buffer, ALLEGRO_BI int* int_idx = NULL; int ii; - idx = al_lock_index_buffer(index_buffer, start, num_vtx, ALLEGRO_LOCK_READONLY); + idx = al_lock_index_buffer(index_buffer, start, num_vtx, A5O_LOCK_READONLY); ASSERT(idx); if (index_buffer->index_size != 4) { @@ -509,32 +509,32 @@ int _al_draw_buffer_common_soft(ALLEGRO_VERTEX_BUFFER* vertex_buffer, ALLEGRO_BI /* Function: al_draw_vertex_buffer */ -int al_draw_vertex_buffer(ALLEGRO_VERTEX_BUFFER* vertex_buffer, - ALLEGRO_BITMAP* texture, int start, int end, int type) +int al_draw_vertex_buffer(A5O_VERTEX_BUFFER* vertex_buffer, + A5O_BITMAP* texture, int start, int end, int type) { - ALLEGRO_BITMAP *target; + A5O_BITMAP *target; int ret = 0; ASSERT(addon_initialized); ASSERT(end >= start); ASSERT(start >= 0); ASSERT(end <= al_get_vertex_buffer_size(vertex_buffer)); - ASSERT(type >= 0 && type < ALLEGRO_PRIM_NUM_TYPES); + ASSERT(type >= 0 && type < A5O_PRIM_NUM_TYPES); ASSERT(vertex_buffer); ASSERT(!vertex_buffer->common.is_locked); target = al_get_target_bitmap(); - if (al_get_bitmap_flags(target) & ALLEGRO_MEMORY_BITMAP || - (texture && al_get_bitmap_flags(texture) & ALLEGRO_MEMORY_BITMAP) || + if (al_get_bitmap_flags(target) & A5O_MEMORY_BITMAP || + (texture && al_get_bitmap_flags(texture) & A5O_MEMORY_BITMAP) || _al_pixel_format_is_compressed(al_get_bitmap_format(target))) { ret = _al_draw_buffer_common_soft(vertex_buffer, texture, NULL, start, end, type); } else { int flags = al_get_display_flags(al_get_current_display()); - if (flags & ALLEGRO_OPENGL) { + if (flags & A5O_OPENGL) { ret = _al_draw_vertex_buffer_opengl(target, texture, vertex_buffer, start, end, type); } - else if (flags & ALLEGRO_DIRECT3D) { + else if (flags & A5O_DIRECT3D) { ret = _al_draw_vertex_buffer_directx(target, texture, vertex_buffer, start, end, type); } } @@ -544,18 +544,18 @@ int al_draw_vertex_buffer(ALLEGRO_VERTEX_BUFFER* vertex_buffer, /* Function: al_draw_indexed_buffer */ -int al_draw_indexed_buffer(ALLEGRO_VERTEX_BUFFER* vertex_buffer, - ALLEGRO_BITMAP* texture, ALLEGRO_INDEX_BUFFER* index_buffer, +int al_draw_indexed_buffer(A5O_VERTEX_BUFFER* vertex_buffer, + A5O_BITMAP* texture, A5O_INDEX_BUFFER* index_buffer, int start, int end, int type) { - ALLEGRO_BITMAP *target; + A5O_BITMAP *target; int ret = 0; ASSERT(addon_initialized); ASSERT(end >= start); ASSERT(start >= 0); ASSERT(end <= al_get_index_buffer_size(index_buffer)); - ASSERT(type >= 0 && type < ALLEGRO_PRIM_NUM_TYPES); + ASSERT(type >= 0 && type < A5O_PRIM_NUM_TYPES); ASSERT(vertex_buffer); ASSERT(!vertex_buffer->common.is_locked); ASSERT(index_buffer); @@ -563,16 +563,16 @@ int al_draw_indexed_buffer(ALLEGRO_VERTEX_BUFFER* vertex_buffer, target = al_get_target_bitmap(); - if (al_get_bitmap_flags(target) & ALLEGRO_MEMORY_BITMAP || - (texture && al_get_bitmap_flags(texture) & ALLEGRO_MEMORY_BITMAP) || + if (al_get_bitmap_flags(target) & A5O_MEMORY_BITMAP || + (texture && al_get_bitmap_flags(texture) & A5O_MEMORY_BITMAP) || _al_pixel_format_is_compressed(al_get_bitmap_format(target))) { ret = _al_draw_buffer_common_soft(vertex_buffer, texture, index_buffer, start, end, type); } else { int flags = al_get_display_flags(al_get_current_display()); - if (flags & ALLEGRO_OPENGL) { + if (flags & A5O_OPENGL) { ret = _al_draw_indexed_buffer_opengl(target, texture, vertex_buffer, index_buffer, start, end, type); } - else if (flags & ALLEGRO_DIRECT3D) { + else if (flags & A5O_DIRECT3D) { ret = _al_draw_indexed_buffer_directx(target, texture, vertex_buffer, index_buffer, start, end, type); } } @@ -582,7 +582,7 @@ int al_draw_indexed_buffer(ALLEGRO_VERTEX_BUFFER* vertex_buffer, /* Function: al_get_vertex_buffer_size */ -int al_get_vertex_buffer_size(ALLEGRO_VERTEX_BUFFER* buffer) +int al_get_vertex_buffer_size(A5O_VERTEX_BUFFER* buffer) { ASSERT(buffer); return buffer->common.size; @@ -590,7 +590,7 @@ int al_get_vertex_buffer_size(ALLEGRO_VERTEX_BUFFER* buffer) /* Function: al_get_index_buffer_size */ -int al_get_index_buffer_size(ALLEGRO_INDEX_BUFFER* buffer) +int al_get_index_buffer_size(A5O_INDEX_BUFFER* buffer) { ASSERT(buffer); return buffer->common.size; diff --git a/addons/primitives/triangulator.c b/addons/primitives/triangulator.c index 6fcb1e948e..73ef6248e9 100644 --- a/addons/primitives/triangulator.c +++ b/addons/primitives/triangulator.c @@ -754,7 +754,7 @@ static void poly_do_triangulate(POLY* polygon) # if POLY_DEBUG if (g_poly_debug_step == g_poly_debug_step_current) { _AL_LIST_ITEM* item; - ALLEGRO_COLOR color; + A5O_COLOR color; int second = 0; al_draw_filled_triangle(v0[0], v0[1], v1[0], v1[1], v2[0], v2[1], al_map_rgba(0, 0, 255, 64)); diff --git a/addons/ttf/CMakeLists.txt b/addons/ttf/CMakeLists.txt index 43974e5812..ee48c9ccae 100644 --- a/addons/ttf/CMakeLists.txt +++ b/addons/ttf/CMakeLists.txt @@ -13,9 +13,9 @@ configure_file( ) add_our_addon_library(allegro_ttf - AllegroTTF-${ALLEGRO_SOVERSION} + AllegroTTF-${A5O_SOVERSION} "${TTF_SOURCES};${TTF_INCLUDE_FILES}" - "-DALLEGRO_TTF_SRC" + "-DA5O_TTF_SRC" "${FONT_LINK_WITH};${TTF_LIBRARIES}" ) diff --git a/addons/ttf/allegro5/allegro_ttf.h b/addons/ttf/allegro5/allegro_ttf.h index ce8a710637..eea1ea50f0 100644 --- a/addons/ttf/allegro5/allegro_ttf.h +++ b/addons/ttf/allegro5/allegro_ttf.h @@ -8,40 +8,40 @@ extern "C" { #endif -#define ALLEGRO_TTF_NO_KERNING 1 -#define ALLEGRO_TTF_MONOCHROME 2 -#define ALLEGRO_TTF_NO_AUTOHINT 4 - -#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32) - #ifndef ALLEGRO_STATICLINK - #ifdef ALLEGRO_TTF_SRC - #define _ALLEGRO_TTF_DLL __declspec(dllexport) +#define A5O_TTF_NO_KERNING 1 +#define A5O_TTF_MONOCHROME 2 +#define A5O_TTF_NO_AUTOHINT 4 + +#if (defined A5O_MINGW32) || (defined A5O_MSVC) || (defined A5O_BCC32) + #ifndef A5O_STATICLINK + #ifdef A5O_TTF_SRC + #define _A5O_TTF_DLL __declspec(dllexport) #else - #define _ALLEGRO_TTF_DLL __declspec(dllimport) + #define _A5O_TTF_DLL __declspec(dllimport) #endif #else - #define _ALLEGRO_TTF_DLL + #define _A5O_TTF_DLL #endif #endif -#if defined ALLEGRO_MSVC - #define ALLEGRO_TTF_FUNC(type, name, args) _ALLEGRO_TTF_DLL type __cdecl name args -#elif defined ALLEGRO_MINGW32 - #define ALLEGRO_TTF_FUNC(type, name, args) extern type name args -#elif defined ALLEGRO_BCC32 - #define ALLEGRO_TTF_FUNC(type, name, args) extern _ALLEGRO_TTF_DLL type name args +#if defined A5O_MSVC + #define A5O_TTF_FUNC(type, name, args) _A5O_TTF_DLL type __cdecl name args +#elif defined A5O_MINGW32 + #define A5O_TTF_FUNC(type, name, args) extern type name args +#elif defined A5O_BCC32 + #define A5O_TTF_FUNC(type, name, args) extern _A5O_TTF_DLL type name args #else - #define ALLEGRO_TTF_FUNC AL_FUNC + #define A5O_TTF_FUNC AL_FUNC #endif -ALLEGRO_TTF_FUNC(ALLEGRO_FONT *, al_load_ttf_font, (char const *filename, int size, int flags)); -ALLEGRO_TTF_FUNC(ALLEGRO_FONT *, al_load_ttf_font_f, (ALLEGRO_FILE *file, char const *filename, int size, int flags)); -ALLEGRO_TTF_FUNC(ALLEGRO_FONT *, al_load_ttf_font_stretch, (char const *filename, int w, int h, int flags)); -ALLEGRO_TTF_FUNC(ALLEGRO_FONT *, al_load_ttf_font_stretch_f, (ALLEGRO_FILE *file, char const *filename, int w, int h, int flags)); -ALLEGRO_TTF_FUNC(bool, al_init_ttf_addon, (void)); -ALLEGRO_TTF_FUNC(bool, al_is_ttf_addon_initialized, (void)); -ALLEGRO_TTF_FUNC(void, al_shutdown_ttf_addon, (void)); -ALLEGRO_TTF_FUNC(uint32_t, al_get_allegro_ttf_version, (void)); +A5O_TTF_FUNC(A5O_FONT *, al_load_ttf_font, (char const *filename, int size, int flags)); +A5O_TTF_FUNC(A5O_FONT *, al_load_ttf_font_f, (A5O_FILE *file, char const *filename, int size, int flags)); +A5O_TTF_FUNC(A5O_FONT *, al_load_ttf_font_stretch, (char const *filename, int w, int h, int flags)); +A5O_TTF_FUNC(A5O_FONT *, al_load_ttf_font_stretch_f, (A5O_FILE *file, char const *filename, int w, int h, int flags)); +A5O_TTF_FUNC(bool, al_init_ttf_addon, (void)); +A5O_TTF_FUNC(bool, al_is_ttf_addon_initialized, (void)); +A5O_TTF_FUNC(void, al_shutdown_ttf_addon, (void)); +A5O_TTF_FUNC(uint32_t, al_get_allegro_ttf_version, (void)); #ifdef __cplusplus } diff --git a/addons/ttf/allegro5/internal/aintern_ttf_cfg.h.cmake b/addons/ttf/allegro5/internal/aintern_ttf_cfg.h.cmake index 48072f234f..f5b1d3fd6c 100644 --- a/addons/ttf/allegro5/internal/aintern_ttf_cfg.h.cmake +++ b/addons/ttf/allegro5/internal/aintern_ttf_cfg.h.cmake @@ -1 +1 @@ -#cmakedefine ALLEGRO_CFG_TTF_FREETYPE +#cmakedefine A5O_CFG_TTF_FREETYPE diff --git a/addons/ttf/ttf.c b/addons/ttf/ttf.c index 7a690e71f8..84366e9c9d 100644 --- a/addons/ttf/ttf.c +++ b/addons/ttf/ttf.c @@ -1,7 +1,7 @@ -#define ALLEGRO_INTERNAL_UNSTABLE +#define A5O_INTERNAL_UNSTABLE #include "allegro5/allegro.h" -#ifdef ALLEGRO_CFG_OPENGL +#ifdef A5O_CFG_OPENGL #include "allegro5/allegro_opengl.h" #endif #include "allegro5/internal/aintern.h" @@ -19,7 +19,7 @@ #include -ALLEGRO_DEBUG_CHANNEL("font") +A5O_DEBUG_CHANNEL("font") /* Some low-end drivers enable automatic S3TC compression, which @@ -47,37 +47,37 @@ typedef struct REGION } REGION; -typedef struct ALLEGRO_TTF_GLYPH_DATA +typedef struct A5O_TTF_GLYPH_DATA { - ALLEGRO_BITMAP *page_bitmap; + A5O_BITMAP *page_bitmap; REGION region; short offset_x; short offset_y; short advance; -} ALLEGRO_TTF_GLYPH_DATA; +} A5O_TTF_GLYPH_DATA; -typedef struct ALLEGRO_TTF_GLYPH_RANGE +typedef struct A5O_TTF_GLYPH_RANGE { int32_t range_start; - ALLEGRO_TTF_GLYPH_DATA *glyphs; /* [RANGE_SIZE] */ -} ALLEGRO_TTF_GLYPH_RANGE; + A5O_TTF_GLYPH_DATA *glyphs; /* [RANGE_SIZE] */ +} A5O_TTF_GLYPH_RANGE; -typedef struct ALLEGRO_TTF_FONT_DATA +typedef struct A5O_TTF_FONT_DATA { FT_Face face; int flags; - _AL_VECTOR glyph_ranges; /* sorted array of of ALLEGRO_TTF_GLYPH_RANGE */ + _AL_VECTOR glyph_ranges; /* sorted array of of A5O_TTF_GLYPH_RANGE */ - _AL_VECTOR page_bitmaps; /* of ALLEGRO_BITMAP pointers */ + _AL_VECTOR page_bitmaps; /* of A5O_BITMAP pointers */ int page_pos_x; int page_pos_y; int page_line_height; - ALLEGRO_LOCKED_REGION *page_lr; + A5O_LOCKED_REGION *page_lr; FT_StreamRec stream; - ALLEGRO_FILE *file; + A5O_FILE *file; unsigned long base_offset; unsigned long offset; @@ -88,13 +88,13 @@ typedef struct ALLEGRO_TTF_FONT_DATA int max_page_size; bool skip_cache_misses; -} ALLEGRO_TTF_FONT_DATA; +} A5O_TTF_FONT_DATA; /* globals */ static bool ttf_inited; static FT_Library ft; -static ALLEGRO_FONT_VTABLE vt; +static A5O_FONT_VTABLE vt; static INLINE int align4(int x) @@ -109,10 +109,10 @@ static INLINE int align4(int x) /* Returns false if the glyph is invalid. */ -static bool get_glyph(ALLEGRO_TTF_FONT_DATA *data, - int ft_index, ALLEGRO_TTF_GLYPH_DATA **glyph) +static bool get_glyph(A5O_TTF_FONT_DATA *data, + int ft_index, A5O_TTF_GLYPH_DATA **glyph) { - ALLEGRO_TTF_GLYPH_RANGE *range; + A5O_TTF_GLYPH_RANGE *range; int32_t range_start; int lo, hi, mid; ASSERT(glyph); @@ -126,7 +126,7 @@ static bool get_glyph(ALLEGRO_TTF_FONT_DATA *data, range = NULL; while (lo < hi) { - ALLEGRO_TTF_GLYPH_RANGE *r = _al_vector_ref(&data->glyph_ranges, mid); + A5O_TTF_GLYPH_RANGE *r = _al_vector_ref(&data->glyph_ranges, mid); if (r->range_start == range_start) { range = r; break; @@ -143,7 +143,7 @@ static bool get_glyph(ALLEGRO_TTF_FONT_DATA *data, if (!range) { range = _al_vector_alloc_mid(&data->glyph_ranges, mid); range->range_start = range_start; - range->glyphs = al_calloc(RANGE_SIZE, sizeof(ALLEGRO_TTF_GLYPH_DATA)); + range->glyphs = al_calloc(RANGE_SIZE, sizeof(A5O_TTF_GLYPH_DATA)); } *glyph = &range->glyphs[ft_index - range_start]; @@ -157,23 +157,23 @@ static bool get_glyph(ALLEGRO_TTF_FONT_DATA *data, } -static void unlock_current_page(ALLEGRO_TTF_FONT_DATA *data) +static void unlock_current_page(A5O_TTF_FONT_DATA *data) { if (data->page_lr) { - ALLEGRO_BITMAP **back = _al_vector_ref_back(&data->page_bitmaps); + A5O_BITMAP **back = _al_vector_ref_back(&data->page_bitmaps); ASSERT(al_is_bitmap_locked(*back)); al_unlock_bitmap(*back); data->page_lr = NULL; - ALLEGRO_DEBUG("Unlocking page: %p\n", *back); + A5O_DEBUG("Unlocking page: %p\n", *back); } } -static ALLEGRO_BITMAP *push_new_page(ALLEGRO_TTF_FONT_DATA *data, int glyph_size) +static A5O_BITMAP *push_new_page(A5O_TTF_FONT_DATA *data, int glyph_size) { - ALLEGRO_BITMAP **back; - ALLEGRO_BITMAP *page; - ALLEGRO_STATE state; + A5O_BITMAP **back; + A5O_BITMAP *page; + A5O_STATE state; int page_size = 1; /* 16 seems to work well. A particular problem are fixed width fonts which * take an inordinate amount of space. */ @@ -187,7 +187,7 @@ static ALLEGRO_BITMAP *push_new_page(ALLEGRO_TTF_FONT_DATA *data, int glyph_size page_size = data->max_page_size; } if (glyph_size > page_size) { - ALLEGRO_ERROR("Unable create new page, glyph too large: %d > %d\n", + A5O_ERROR("Unable create new page, glyph too large: %d > %d\n", glyph_size, page_size); return NULL; } @@ -198,7 +198,7 @@ static ALLEGRO_BITMAP *push_new_page(ALLEGRO_TTF_FONT_DATA *data, int glyph_size * it is not safe to register a destructor for it. */ _al_push_destructor_owner(); - al_store_state(&state, ALLEGRO_STATE_NEW_BITMAP_PARAMETERS); + al_store_state(&state, A5O_STATE_NEW_BITMAP_PARAMETERS); al_set_new_bitmap_format(data->bitmap_format); al_set_new_bitmap_flags(data->bitmap_flags); page = al_create_bitmap(page_size, page_size); @@ -218,11 +218,11 @@ static ALLEGRO_BITMAP *push_new_page(ALLEGRO_TTF_FONT_DATA *data, int glyph_size } -static unsigned char *alloc_glyph_region(ALLEGRO_TTF_FONT_DATA *data, - int ft_index, int w, int h, bool new, ALLEGRO_TTF_GLYPH_DATA *glyph, +static unsigned char *alloc_glyph_region(A5O_TTF_FONT_DATA *data, + int ft_index, int w, int h, bool new, A5O_TTF_GLYPH_DATA *glyph, bool lock_whole_page) { - ALLEGRO_BITMAP *page; + A5O_BITMAP *page; int w4 = align4(w); int h4 = align4(h); int glyph_size = w4 > h4 ? w4 : h4; @@ -231,16 +231,16 @@ static unsigned char *alloc_glyph_region(ALLEGRO_TTF_FONT_DATA *data, if (_al_vector_is_empty(&data->page_bitmaps) || new) { page = push_new_page(data, glyph_size); if (!page) { - ALLEGRO_ERROR("Failed to create a new page for glyph %d.\n", ft_index); + A5O_ERROR("Failed to create a new page for glyph %d.\n", ft_index); return NULL; } } else { - ALLEGRO_BITMAP **back = _al_vector_ref_back(&data->page_bitmaps); + A5O_BITMAP **back = _al_vector_ref_back(&data->page_bitmaps); page = *back; } - ALLEGRO_DEBUG("Glyph %d: %dx%d (%dx%d)%s\n", + A5O_DEBUG("Glyph %d: %dx%d (%dx%d)%s\n", ft_index, w, h, w4, h4, new ? " new" : ""); if (data->page_pos_x + w4 > al_get_bitmap_width(page)) { @@ -273,7 +273,7 @@ static unsigned char *alloc_glyph_region(ALLEGRO_TTF_FONT_DATA *data, lock_rect.h = al_get_bitmap_height(page); if (!data->page_lr) { lock = true; - ALLEGRO_DEBUG("Locking whole page: %p\n", page); + A5O_DEBUG("Locking whole page: %p\n", page); } } else { @@ -284,7 +284,7 @@ static unsigned char *alloc_glyph_region(ALLEGRO_TTF_FONT_DATA *data, lock_rect.w = w4; lock_rect.h = h4; lock = true; - ALLEGRO_DEBUG("Locking glyph region: %p %d %d %d %d\n", page, + A5O_DEBUG("Locking glyph region: %p %d %d %d %d\n", page, lock_rect.x, lock_rect.y, lock_rect.w, lock_rect.h); } @@ -294,14 +294,14 @@ static unsigned char *alloc_glyph_region(ALLEGRO_TTF_FONT_DATA *data, data->page_lr = al_lock_bitmap_region(page, lock_rect.x, lock_rect.y, lock_rect.w, lock_rect.h, - ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, ALLEGRO_LOCK_WRITEONLY); + A5O_PIXEL_FORMAT_ABGR_8888_LE, A5O_LOCK_WRITEONLY); if (!data->page_lr) { - ALLEGRO_ERROR("Failed to lock page.\n"); + A5O_ERROR("Failed to lock page.\n"); return NULL; } - if (data->flags & ALLEGRO_NO_PREMULTIPLIED_ALPHA) { + if (data->flags & A5O_NO_PREMULTIPLIED_ALPHA) { /* Fill in border with "transparent white" * to make anti-aliasing work well when rotation * and/or scaling transforms are in effect @@ -339,7 +339,7 @@ static unsigned char *alloc_glyph_region(ALLEGRO_TTF_FONT_DATA *data, } -static void copy_glyph_mono(ALLEGRO_TTF_FONT_DATA *font_data, FT_Face face, +static void copy_glyph_mono(A5O_TTF_FONT_DATA *font_data, FT_Face face, unsigned char *glyph_data) { int pitch = font_data->page_lr->pitch; @@ -350,7 +350,7 @@ static void copy_glyph_mono(ALLEGRO_TTF_FONT_DATA *font_data, FT_Face face, unsigned char *dptr = glyph_data + pitch * y; int bit = 0; - if (font_data->flags & ALLEGRO_NO_PREMULTIPLIED_ALPHA) { + if (font_data->flags & A5O_NO_PREMULTIPLIED_ALPHA) { /* FIXME We could just set the alpha byte since the * region was cleared above when allocated */ @@ -383,7 +383,7 @@ static void copy_glyph_mono(ALLEGRO_TTF_FONT_DATA *font_data, FT_Face face, } -static void copy_glyph_color(ALLEGRO_TTF_FONT_DATA *font_data, FT_Face face, +static void copy_glyph_color(A5O_TTF_FONT_DATA *font_data, FT_Face face, unsigned char *glyph_data) { int pitch = font_data->page_lr->pitch; @@ -393,7 +393,7 @@ static void copy_glyph_color(ALLEGRO_TTF_FONT_DATA *font_data, FT_Face face, unsigned char const *ptr = face->glyph->bitmap.buffer + face->glyph->bitmap.pitch * y; unsigned char *dptr = glyph_data + pitch * y; - if (font_data->flags & ALLEGRO_NO_PREMULTIPLIED_ALPHA) { + if (font_data->flags & A5O_NO_PREMULTIPLIED_ALPHA) { /* FIXME We could just set the alpha byte since the * region was cleared above when allocated */ @@ -426,8 +426,8 @@ static void copy_glyph_color(ALLEGRO_TTF_FONT_DATA *font_data, FT_Face face, * NOTE: We have previously tried to be more clever about caching multiple * glyphs during incidental cache misses, but found that approach to be slower. */ -static void cache_glyph(ALLEGRO_TTF_FONT_DATA *font_data, FT_Face face, - int ft_index, ALLEGRO_TTF_GLYPH_DATA *glyph, bool lock_whole_page) +static void cache_glyph(A5O_TTF_FONT_DATA *font_data, FT_Face face, + int ft_index, A5O_TTF_GLYPH_DATA *glyph, bool lock_whole_page) { FT_Int32 ft_load_flags; FT_Error e; @@ -447,14 +447,14 @@ static void cache_glyph(ALLEGRO_TTF_FONT_DATA *font_data, FT_Face face, // NO_BITMAP flags. Supposedly using that flag makes small sizes // look bad so ideally we would not used it. ft_load_flags = FT_LOAD_RENDER | FT_LOAD_NO_BITMAP; - if (font_data->flags & ALLEGRO_TTF_MONOCHROME) + if (font_data->flags & A5O_TTF_MONOCHROME) ft_load_flags |= FT_LOAD_TARGET_MONO; - if (font_data->flags & ALLEGRO_TTF_NO_AUTOHINT) + if (font_data->flags & A5O_TTF_NO_AUTOHINT) ft_load_flags |= FT_LOAD_NO_AUTOHINT; e = FT_Load_Glyph(face, ft_index, ft_load_flags); if (e) { - ALLEGRO_WARN("Failed loading glyph %d from.\n", ft_index); + A5O_WARN("Failed loading glyph %d from.\n", ft_index); } glyph->offset_x = face->glyph->bitmap_left; @@ -472,7 +472,7 @@ static void cache_glyph(ALLEGRO_TTF_FONT_DATA *font_data, FT_Face face, /* Even though this glyph has no "region", include the 2-pixel border in the size */ glyph->region.w = w + 4; glyph->region.h = h + 4; - ALLEGRO_DEBUG("Glyph %d has zero size.\n", ft_index); + A5O_DEBUG("Glyph %d has zero size.\n", ft_index); return; } @@ -486,7 +486,7 @@ static void cache_glyph(ALLEGRO_TTF_FONT_DATA *font_data, FT_Face face, return; } - if (font_data->flags & ALLEGRO_TTF_MONOCHROME) + if (font_data->flags & A5O_TTF_MONOCHROME) copy_glyph_mono(font_data, face, glyph_data); else copy_glyph_color(font_data, face, glyph_data); @@ -501,16 +501,16 @@ static void cache_glyph(ALLEGRO_TTF_FONT_DATA *font_data, FT_Face face, * * This leaves the current page unlocked. */ -static void cache_glyphs(ALLEGRO_TTF_FONT_DATA *data, const char *text, size_t text_size) +static void cache_glyphs(A5O_TTF_FONT_DATA *data, const char *text, size_t text_size) { - ALLEGRO_USTR_INFO info; - const ALLEGRO_USTR* ustr = al_ref_buffer(&info, text, text_size); + A5O_USTR_INFO info; + const A5O_USTR* ustr = al_ref_buffer(&info, text, text_size); FT_Face face = data->face; int pos = 0; int32_t ch; while ((ch = al_ustr_get_next(ustr, &pos)) >= 0) { - ALLEGRO_TTF_GLYPH_DATA *glyph; + A5O_TTF_GLYPH_DATA *glyph; int ft_index = FT_Get_Char_Index(face, ch); get_glyph(data, ft_index, &glyph); cache_glyph(data, face, ft_index, glyph, true); @@ -518,11 +518,11 @@ static void cache_glyphs(ALLEGRO_TTF_FONT_DATA *data, const char *text, size_t t } -static int get_kerning(ALLEGRO_TTF_FONT_DATA const *data, FT_Face face, +static int get_kerning(A5O_TTF_FONT_DATA const *data, FT_Face face, int prev_ft_index, int ft_index) { /* Do kerning? */ - if (!(data->flags & ALLEGRO_TTF_NO_KERNING) && prev_ft_index != -1) { + if (!(data->flags & A5O_TTF_NO_KERNING) && prev_ft_index != -1) { FT_Vector delta; FT_Get_Kerning(face, prev_ft_index, ft_index, FT_KERNING_DEFAULT, &delta); @@ -533,11 +533,11 @@ static int get_kerning(ALLEGRO_TTF_FONT_DATA const *data, FT_Face face, } -static bool ttf_get_glyph_worker(ALLEGRO_FONT const *f, int prev_ft_index, int ft_index, int prev_codepoint, int codepoint, ALLEGRO_GLYPH *info) +static bool ttf_get_glyph_worker(A5O_FONT const *f, int prev_ft_index, int ft_index, int prev_codepoint, int codepoint, A5O_GLYPH *info) { - ALLEGRO_TTF_FONT_DATA *data = f->data; + A5O_TTF_FONT_DATA *data = f->data; FT_Face face = data->face; - ALLEGRO_TTF_GLYPH_DATA *glyph; + A5O_TTF_GLYPH_DATA *glyph; int advance = 0; if (!get_glyph(data, ft_index, &glyph)) { @@ -574,9 +574,9 @@ static bool ttf_get_glyph_worker(ALLEGRO_FONT const *f, int prev_ft_index, int f } -static bool ttf_get_glyph(ALLEGRO_FONT const *f, int prev_codepoint, int codepoint, ALLEGRO_GLYPH *glyph) +static bool ttf_get_glyph(A5O_FONT const *f, int prev_codepoint, int codepoint, A5O_GLYPH *glyph) { - ALLEGRO_TTF_FONT_DATA *data = f->data; + A5O_TTF_FONT_DATA *data = f->data; FT_Face face = data->face; int prev_ft_index = (prev_codepoint == -1) ? -1 : (int)FT_Get_Char_Index(face, prev_codepoint); int ft_index = FT_Get_Char_Index(face, codepoint); @@ -584,10 +584,10 @@ static bool ttf_get_glyph(ALLEGRO_FONT const *f, int prev_codepoint, int codepoi } -static int render_glyph(ALLEGRO_FONT const *f, ALLEGRO_COLOR color, +static int render_glyph(A5O_FONT const *f, A5O_COLOR color, int prev_ft_index, int ft_index, int32_t prev_ch, int32_t ch, float xpos, float ypos) { - ALLEGRO_GLYPH glyph; + A5O_GLYPH glyph; if (ttf_get_glyph_worker(f, prev_ft_index, ft_index, prev_ch, ch, &glyph) == false) return 0; @@ -610,16 +610,16 @@ static int render_glyph(ALLEGRO_FONT const *f, ALLEGRO_COLOR color, } -static int ttf_font_height(ALLEGRO_FONT const *f) +static int ttf_font_height(A5O_FONT const *f) { ASSERT(f); return f->height; } -static int ttf_font_ascent(ALLEGRO_FONT const *f) +static int ttf_font_ascent(A5O_FONT const *f) { - ALLEGRO_TTF_FONT_DATA *data; + A5O_TTF_FONT_DATA *data; FT_Face face; ASSERT(f); @@ -631,9 +631,9 @@ static int ttf_font_ascent(ALLEGRO_FONT const *f) } -static int ttf_font_descent(ALLEGRO_FONT const *f) +static int ttf_font_descent(A5O_FONT const *f) { - ALLEGRO_TTF_FONT_DATA *data; + A5O_TTF_FONT_DATA *data; FT_Face face; ASSERT(f); @@ -645,10 +645,10 @@ static int ttf_font_descent(ALLEGRO_FONT const *f) } -static int ttf_render_char(ALLEGRO_FONT const *f, ALLEGRO_COLOR color, +static int ttf_render_char(A5O_FONT const *f, A5O_COLOR color, int ch, float xpos, float ypos) { - ALLEGRO_TTF_FONT_DATA *data = f->data; + A5O_TTF_FONT_DATA *data = f->data; FT_Face face = data->face; int advance = 0; int32_t ch32 = (int32_t) ch; @@ -660,11 +660,11 @@ static int ttf_render_char(ALLEGRO_FONT const *f, ALLEGRO_COLOR color, } -static int ttf_char_length(ALLEGRO_FONT const *f, int ch) +static int ttf_char_length(A5O_FONT const *f, int ch) { int result; - ALLEGRO_TTF_FONT_DATA *data = f->data; - ALLEGRO_TTF_GLYPH_DATA *glyph; + A5O_TTF_FONT_DATA *data = f->data; + A5O_TTF_GLYPH_DATA *glyph; FT_Face face = data->face; int ft_index = FT_Get_Char_Index(face, ch); if (!get_glyph(data, ft_index, &glyph)) { @@ -683,10 +683,10 @@ static int ttf_char_length(ALLEGRO_FONT const *f, int ch) } -static int ttf_render(ALLEGRO_FONT const *f, ALLEGRO_COLOR color, - const ALLEGRO_USTR *text, float x, float y) +static int ttf_render(A5O_FONT const *f, A5O_COLOR color, + const A5O_USTR *text, float x, float y) { - ALLEGRO_TTF_FONT_DATA *data = f->data; + A5O_TTF_FONT_DATA *data = f->data; FT_Face face = data->face; int pos = 0; int advance = 0; @@ -712,7 +712,7 @@ static int ttf_render(ALLEGRO_FONT const *f, ALLEGRO_COLOR color, } -static int ttf_text_length(ALLEGRO_FONT const *f, const ALLEGRO_USTR *text) +static int ttf_text_length(A5O_FONT const *f, const A5O_USTR *text) { int pos = 0; int x = 0; @@ -724,15 +724,15 @@ static int ttf_text_length(ALLEGRO_FONT const *f, const ALLEGRO_USTR *text) nch = al_ustr_get_next(text, &pos); x += al_get_glyph_advance(f, ch, nch < 0 ? - ALLEGRO_NO_KERNING : nch); + A5O_NO_KERNING : nch); } return x; } -static void ttf_get_text_dimensions(ALLEGRO_FONT const *f, - ALLEGRO_USTR const *text, +static void ttf_get_text_dimensions(A5O_FONT const *f, + A5O_USTR const *text, int *bbx, int *bby, int *bbw, int *bbh) { int pos = 0; @@ -781,9 +781,9 @@ static void ttf_get_text_dimensions(ALLEGRO_FONT const *f, #ifdef DEBUG_CACHE #include "allegro5/allegro_image.h" -static void debug_cache(ALLEGRO_FONT *f) +static void debug_cache(A5O_FONT *f) { - ALLEGRO_TTF_FONT_DATA *data = f->data; + A5O_TTF_FONT_DATA *data = f->data; _AL_VECTOR *v = &data->page_bitmaps; static int j = 0; int i; @@ -791,8 +791,8 @@ static void debug_cache(ALLEGRO_FONT *f) al_init_image_addon(); for (i = 0; i < (int)_al_vector_size(v); i++) { - ALLEGRO_BITMAP **bmp = _al_vector_ref(v, i); - ALLEGRO_USTR *u = al_ustr_newf("font%d_%d.png", j, i); + A5O_BITMAP **bmp = _al_vector_ref(v, i); + A5O_USTR *u = al_ustr_newf("font%d_%d.png", j, i); al_save_bitmap(al_cstr(u), *bmp); al_ustr_free(u); } @@ -801,9 +801,9 @@ static void debug_cache(ALLEGRO_FONT *f) #endif -static void ttf_destroy(ALLEGRO_FONT *f) +static void ttf_destroy(A5O_FONT *f) { - ALLEGRO_TTF_FONT_DATA *data = f->data; + A5O_TTF_FONT_DATA *data = f->data; int i; unlock_current_page(data); @@ -814,12 +814,12 @@ static void ttf_destroy(ALLEGRO_FONT *f) FT_Done_Face(data->face); for (i = _al_vector_size(&data->glyph_ranges) - 1; i >= 0; i--) { - ALLEGRO_TTF_GLYPH_RANGE *range = _al_vector_ref(&data->glyph_ranges, i); + A5O_TTF_GLYPH_RANGE *range = _al_vector_ref(&data->glyph_ranges, i); al_free(range->glyphs); } _al_vector_free(&data->glyph_ranges); for (i = _al_vector_size(&data->page_bitmaps) - 1; i >= 0; i--) { - ALLEGRO_BITMAP **bmp = _al_vector_ref(&data->page_bitmaps, i); + A5O_BITMAP **bmp = _al_vector_ref(&data->page_bitmaps, i); al_destroy_bitmap(*bmp); } _al_vector_free(&data->page_bitmaps); @@ -831,14 +831,14 @@ static void ttf_destroy(ALLEGRO_FONT *f) static unsigned long ftread(FT_Stream stream, unsigned long offset, unsigned char *buffer, unsigned long count) { - ALLEGRO_TTF_FONT_DATA *data = stream->pathname.pointer; + A5O_TTF_FONT_DATA *data = stream->pathname.pointer; unsigned long bytes; if (count == 0) return 0; if (offset != data->offset) - al_fseek(data->file, data->base_offset + offset, ALLEGRO_SEEK_SET); + al_fseek(data->file, data->base_offset + offset, A5O_SEEK_SET); bytes = al_fread(data->file, buffer, count); data->offset = offset + bytes; return bytes; @@ -847,14 +847,14 @@ static unsigned long ftread(FT_Stream stream, unsigned long offset, static void ftclose(FT_Stream stream) { - ALLEGRO_TTF_FONT_DATA *data = stream->pathname.pointer; + A5O_TTF_FONT_DATA *data = stream->pathname.pointer; al_fclose(data->file); data->file = NULL; } /* Function: al_load_ttf_font_f */ -ALLEGRO_FONT *al_load_ttf_font_f(ALLEGRO_FILE *file, +A5O_FONT *al_load_ttf_font_f(A5O_FILE *file, char const *filename, int size, int flags) { return al_load_ttf_font_stretch_f(file, filename, 0, size, flags); @@ -863,16 +863,16 @@ ALLEGRO_FONT *al_load_ttf_font_f(ALLEGRO_FILE *file, /* Function: al_load_ttf_font_stretch_f */ -ALLEGRO_FONT *al_load_ttf_font_stretch_f(ALLEGRO_FILE *file, +A5O_FONT *al_load_ttf_font_stretch_f(A5O_FILE *file, char const *filename, int w, int h, int flags) { FT_Face face; - ALLEGRO_TTF_FONT_DATA *data; - ALLEGRO_FONT *f; - ALLEGRO_PATH *path; + A5O_TTF_FONT_DATA *data; + A5O_FONT *f; + A5O_PATH *path; FT_Open_Args args; int result; - ALLEGRO_CONFIG* system_cfg = al_get_system_config(); + A5O_CONFIG* system_cfg = al_get_system_config(); const char* min_page_size_str = al_get_config_value(system_cfg, "ttf", "min_page_size"); const char* max_page_size_str = @@ -883,7 +883,7 @@ ALLEGRO_FONT *al_load_ttf_font_stretch_f(ALLEGRO_FILE *file, al_get_config_value(system_cfg, "ttf", "skip_cache_misses"); if ((h > 0 && w < 0) || (h < 0 && w > 0)) { - ALLEGRO_ERROR("Height/width have opposite signs (w = %d, h = %d).\n", w, h); + A5O_ERROR("Height/width have opposite signs (w = %d, h = %d).\n", w, h); return NULL; } @@ -922,7 +922,7 @@ ALLEGRO_FONT *al_load_ttf_font_stretch_f(ALLEGRO_FILE *file, args.stream = &data->stream; if ((result = FT_Open_Face(ft, &args, 0, &face)) != 0) { - ALLEGRO_ERROR("Reading %s failed. Freetype error code %d\n", filename, + A5O_ERROR("Reading %s failed. Freetype error code %d\n", filename, result); // Note: Freetype already closed the file for us. al_free(data); @@ -936,17 +936,17 @@ ALLEGRO_FONT *al_load_ttf_font_stretch_f(ALLEGRO_FILE *file, path = al_create_path(filename); if (!strcmp(al_get_path_extension(path), ".pfa")) { const char *helper; - ALLEGRO_DEBUG("Type1 font assumed for %s.\n", filename); + A5O_DEBUG("Type1 font assumed for %s.\n", filename); al_set_path_extension(path, ".afm"); helper = al_path_cstr(path, '/'); FT_Attach_File(face, helper); - ALLEGRO_DEBUG("Guessed afm file %s.\n", helper); + A5O_DEBUG("Guessed afm file %s.\n", helper); al_set_path_extension(path, ".tfm"); helper = al_path_cstr(path, '/'); FT_Attach_File(face, helper); - ALLEGRO_DEBUG("Guessed tfm file %s.\n", helper); + A5O_DEBUG("Guessed tfm file %s.\n", helper); } al_destroy_path(path); @@ -968,9 +968,9 @@ ALLEGRO_FONT *al_load_ttf_font_stretch_f(ALLEGRO_FILE *file, FT_Request_Size(face, &req); } - ALLEGRO_DEBUG("Font %s loaded with pixel size %d x %d.\n", filename, + A5O_DEBUG("Font %s loaded with pixel size %d x %d.\n", filename, w, h); - ALLEGRO_DEBUG(" ascent=%.1f, descent=%.1f, height=%.1f\n", + A5O_DEBUG(" ascent=%.1f, descent=%.1f, height=%.1f\n", face->size->metrics.ascender / 64.0, face->size->metrics.descender / 64.0, face->size->metrics.height / 64.0); @@ -978,8 +978,8 @@ ALLEGRO_FONT *al_load_ttf_font_stretch_f(ALLEGRO_FILE *file, data->face = face; data->flags = flags; - _al_vector_init(&data->glyph_ranges, sizeof(ALLEGRO_TTF_GLYPH_RANGE)); - _al_vector_init(&data->page_bitmaps, sizeof(ALLEGRO_BITMAP*)); + _al_vector_init(&data->glyph_ranges, sizeof(A5O_TTF_GLYPH_RANGE)); + _al_vector_init(&data->page_bitmaps, sizeof(A5O_BITMAP*)); if (data->skip_cache_misses) { cache_glyphs(data, "\0", 1); @@ -1003,7 +1003,7 @@ ALLEGRO_FONT *al_load_ttf_font_stretch_f(ALLEGRO_FILE *file, /* Function: al_load_ttf_font */ -ALLEGRO_FONT *al_load_ttf_font(char const *filename, int size, int flags) +A5O_FONT *al_load_ttf_font(char const *filename, int size, int flags) { return al_load_ttf_font_stretch(filename, 0, size, flags); } @@ -1011,16 +1011,16 @@ ALLEGRO_FONT *al_load_ttf_font(char const *filename, int size, int flags) /* Function: al_load_ttf_font_stretch */ -ALLEGRO_FONT *al_load_ttf_font_stretch(char const *filename, int w, int h, +A5O_FONT *al_load_ttf_font_stretch(char const *filename, int w, int h, int flags) { - ALLEGRO_FILE *f; - ALLEGRO_FONT *font; + A5O_FILE *f; + A5O_FONT *font; ASSERT(filename); f = al_fopen(filename, "rb"); if (!f) { - ALLEGRO_ERROR("Unable to open file for reading: %s\n", filename); + A5O_ERROR("Unable to open file for reading: %s\n", filename); return NULL; } @@ -1034,10 +1034,10 @@ ALLEGRO_FONT *al_load_ttf_font_stretch(char const *filename, int w, int h, } -static int ttf_get_font_ranges(ALLEGRO_FONT *font, int ranges_count, +static int ttf_get_font_ranges(A5O_FONT *font, int ranges_count, int *ranges) { - ALLEGRO_TTF_FONT_DATA *data = font->data; + A5O_TTF_FONT_DATA *data = font->data; FT_UInt g; FT_ULong unicode = FT_Get_First_Char(data->face, &g); int i = 0; @@ -1064,12 +1064,12 @@ static int ttf_get_font_ranges(ALLEGRO_FONT *font, int ranges_count, return i; } -static bool ttf_get_glyph_dimensions(ALLEGRO_FONT const *f, +static bool ttf_get_glyph_dimensions(A5O_FONT const *f, int codepoint, int *bbx, int *bby, int *bbw, int *bbh) { - ALLEGRO_TTF_FONT_DATA *data = f->data; - ALLEGRO_TTF_GLYPH_DATA *glyph; + A5O_TTF_FONT_DATA *data = f->data; + A5O_TTF_GLYPH_DATA *glyph; FT_Face face = data->face; int ft_index = FT_Get_Char_Index(face, codepoint); if (!get_glyph(data, ft_index, &glyph)) { @@ -1091,17 +1091,17 @@ static bool ttf_get_glyph_dimensions(ALLEGRO_FONT const *f, return true; } -static int ttf_get_glyph_advance(ALLEGRO_FONT const *f, int codepoint1, +static int ttf_get_glyph_advance(A5O_FONT const *f, int codepoint1, int codepoint2) { - ALLEGRO_TTF_FONT_DATA *data = f->data; + A5O_TTF_FONT_DATA *data = f->data; FT_Face face = data->face; int ft_index = FT_Get_Char_Index(face, codepoint1); - ALLEGRO_TTF_GLYPH_DATA *glyph; + A5O_TTF_GLYPH_DATA *glyph; int kerning = 0; int advance = 0; - if (codepoint1 == ALLEGRO_NO_KERNING) { + if (codepoint1 == A5O_NO_KERNING) { return 0; } @@ -1116,7 +1116,7 @@ static int ttf_get_glyph_advance(ALLEGRO_FONT const *f, int codepoint1, } cache_glyph(data, face, ft_index, glyph, false); - if (codepoint2 != ALLEGRO_NO_KERNING) { + if (codepoint2 != A5O_NO_KERNING) { int ft_index1 = FT_Get_Char_Index(face, codepoint1); int ft_index2 = FT_Get_Char_Index(face, codepoint2); kerning = get_kerning(data, face, ft_index1, ft_index2); @@ -1133,7 +1133,7 @@ static int ttf_get_glyph_advance(ALLEGRO_FONT const *f, int codepoint1, bool al_init_ttf_addon(void) { if (ttf_inited) { - ALLEGRO_WARN("TTF addon already initialised.\n"); + A5O_WARN("TTF addon already initialised.\n"); return true; } @@ -1178,7 +1178,7 @@ bool al_is_ttf_addon_initialized(void) void al_shutdown_ttf_addon(void) { if (!ttf_inited) { - ALLEGRO_ERROR("TTF addon not initialised.\n"); + A5O_ERROR("TTF addon not initialised.\n"); return; } @@ -1194,7 +1194,7 @@ void al_shutdown_ttf_addon(void) */ uint32_t al_get_allegro_ttf_version(void) { - return ALLEGRO_VERSION_INT; + return A5O_VERSION_INT; } /* vim: set sts=3 sw=3 et: */ diff --git a/addons/video/CMakeLists.txt b/addons/video/CMakeLists.txt index 61a322bae3..7a0c87c496 100644 --- a/addons/video/CMakeLists.txt +++ b/addons/video/CMakeLists.txt @@ -29,7 +29,7 @@ if(SUPPORT_OGG_VIDEO) ) list(APPEND VIDEO_SOURCES ogv.c) set(SUPPORT_VIDEO 1) - set(ALLEGRO_CFG_VIDEO_HAVE_OGV 1) + set(A5O_CFG_VIDEO_HAVE_OGV 1) set(VIDEO_LIBRARIES ${VIDEO_LIBRARIES} ${THEORA_LIBRARIES} ${VORBIS_LIBRARIES}) endif(SUPPORT_OGG_VIDEO) @@ -46,10 +46,10 @@ configure_file( ) add_our_addon_library(allegro_video - AllegroVideo-${ALLEGRO_SOVERSION} + AllegroVideo-${A5O_SOVERSION} "${VIDEO_SOURCES};${VIDEO_INCLUDE_FILES}" - "-DALLEGRO_VIDEO_SRC" - "${ALLEGRO_LINK_WITH};${AUDIO_LINK_WITH};${VIDEO_LIBRARIES}" + "-DA5O_VIDEO_SRC" + "${A5O_LINK_WITH};${AUDIO_LINK_WITH};${VIDEO_LIBRARIES}" ) install_our_headers(${VIDEO_INCLUDE_FILES}) diff --git a/addons/video/allegro5/allegro_video.h b/addons/video/allegro5/allegro_video.h index f1c9ee3d4b..f5f4111438 100644 --- a/addons/video/allegro5/allegro_video.h +++ b/addons/video/allegro5/allegro_video.h @@ -8,71 +8,71 @@ #include "allegro5/allegro5.h" #include "allegro5/allegro_audio.h" -#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32) - #ifndef ALLEGRO_STATICLINK - #ifdef ALLEGRO_VIDEO_SRC - #define _ALLEGRO_VIDEO_DLL __declspec(dllexport) +#if (defined A5O_MINGW32) || (defined A5O_MSVC) || (defined A5O_BCC32) + #ifndef A5O_STATICLINK + #ifdef A5O_VIDEO_SRC + #define _A5O_VIDEO_DLL __declspec(dllexport) #else - #define _ALLEGRO_VIDEO_DLL __declspec(dllimport) + #define _A5O_VIDEO_DLL __declspec(dllimport) #endif #else - #define _ALLEGRO_VIDEO_DLL + #define _A5O_VIDEO_DLL #endif #endif -#if defined ALLEGRO_MSVC - #define ALLEGRO_VIDEO_FUNC(type, name, args) _ALLEGRO_VIDEO_DLL type __cdecl name args -#elif defined ALLEGRO_MINGW32 - #define ALLEGRO_VIDEO_FUNC(type, name, args) extern type name args -#elif defined ALLEGRO_BCC32 - #define ALLEGRO_VIDEO_FUNC(type, name, args) extern _ALLEGRO_VIDEO_DLL type name args +#if defined A5O_MSVC + #define A5O_VIDEO_FUNC(type, name, args) _A5O_VIDEO_DLL type __cdecl name args +#elif defined A5O_MINGW32 + #define A5O_VIDEO_FUNC(type, name, args) extern type name args +#elif defined A5O_BCC32 + #define A5O_VIDEO_FUNC(type, name, args) extern _A5O_VIDEO_DLL type name args #else - #define ALLEGRO_VIDEO_FUNC AL_FUNC + #define A5O_VIDEO_FUNC AL_FUNC #endif -/* Enum: ALLEGRO_VIDEO_EVENT_TYPE +/* Enum: A5O_VIDEO_EVENT_TYPE */ -enum ALLEGRO_VIDEO_EVENT_TYPE +enum A5O_VIDEO_EVENT_TYPE { - ALLEGRO_EVENT_VIDEO_FRAME_SHOW = 550, - ALLEGRO_EVENT_VIDEO_FINISHED = 551, - _ALLEGRO_EVENT_VIDEO_SEEK = 552 /* internal */ + A5O_EVENT_VIDEO_FRAME_SHOW = 550, + A5O_EVENT_VIDEO_FINISHED = 551, + _A5O_EVENT_VIDEO_SEEK = 552 /* internal */ }; -enum ALLEGRO_VIDEO_POSITION_TYPE +enum A5O_VIDEO_POSITION_TYPE { - ALLEGRO_VIDEO_POSITION_ACTUAL = 0, - ALLEGRO_VIDEO_POSITION_VIDEO_DECODE = 1, - ALLEGRO_VIDEO_POSITION_AUDIO_DECODE = 2 + A5O_VIDEO_POSITION_ACTUAL = 0, + A5O_VIDEO_POSITION_VIDEO_DECODE = 1, + A5O_VIDEO_POSITION_AUDIO_DECODE = 2 }; -/* Enum: ALLEGRO_VIDEO_POSITION_TYPE +/* Enum: A5O_VIDEO_POSITION_TYPE */ -typedef enum ALLEGRO_VIDEO_POSITION_TYPE ALLEGRO_VIDEO_POSITION_TYPE; +typedef enum A5O_VIDEO_POSITION_TYPE A5O_VIDEO_POSITION_TYPE; -typedef struct ALLEGRO_VIDEO ALLEGRO_VIDEO; +typedef struct A5O_VIDEO A5O_VIDEO; -ALLEGRO_VIDEO_FUNC(ALLEGRO_VIDEO *, al_open_video, (char const *filename)); -ALLEGRO_VIDEO_FUNC(void, al_close_video, (ALLEGRO_VIDEO *video)); -ALLEGRO_VIDEO_FUNC(void, al_start_video, (ALLEGRO_VIDEO *video, ALLEGRO_MIXER *mixer)); -ALLEGRO_VIDEO_FUNC(void, al_start_video_with_voice, (ALLEGRO_VIDEO *video, ALLEGRO_VOICE *voice)); -ALLEGRO_VIDEO_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_video_event_source, (ALLEGRO_VIDEO *video)); -ALLEGRO_VIDEO_FUNC(void, al_set_video_playing, (ALLEGRO_VIDEO *video, bool playing)); -ALLEGRO_VIDEO_FUNC(bool, al_is_video_playing, (ALLEGRO_VIDEO *video)); -ALLEGRO_VIDEO_FUNC(double, al_get_video_audio_rate, (ALLEGRO_VIDEO *video)); -ALLEGRO_VIDEO_FUNC(double, al_get_video_fps, (ALLEGRO_VIDEO *video)); -ALLEGRO_VIDEO_FUNC(float, al_get_video_scaled_width, (ALLEGRO_VIDEO *video)); -ALLEGRO_VIDEO_FUNC(float, al_get_video_scaled_height, (ALLEGRO_VIDEO *video)); -ALLEGRO_VIDEO_FUNC(ALLEGRO_BITMAP *, al_get_video_frame, (ALLEGRO_VIDEO *video)); -ALLEGRO_VIDEO_FUNC(double, al_get_video_position, (ALLEGRO_VIDEO *video, ALLEGRO_VIDEO_POSITION_TYPE which)); -ALLEGRO_VIDEO_FUNC(bool, al_seek_video, (ALLEGRO_VIDEO *video, double pos_in_seconds)); -ALLEGRO_VIDEO_FUNC(bool, al_init_video_addon, (void)); -ALLEGRO_VIDEO_FUNC(bool, al_is_video_addon_initialized, (void)); -ALLEGRO_VIDEO_FUNC(void, al_shutdown_video_addon, (void)); -ALLEGRO_VIDEO_FUNC(uint32_t, al_get_allegro_video_version, (void)); +A5O_VIDEO_FUNC(A5O_VIDEO *, al_open_video, (char const *filename)); +A5O_VIDEO_FUNC(void, al_close_video, (A5O_VIDEO *video)); +A5O_VIDEO_FUNC(void, al_start_video, (A5O_VIDEO *video, A5O_MIXER *mixer)); +A5O_VIDEO_FUNC(void, al_start_video_with_voice, (A5O_VIDEO *video, A5O_VOICE *voice)); +A5O_VIDEO_FUNC(A5O_EVENT_SOURCE *, al_get_video_event_source, (A5O_VIDEO *video)); +A5O_VIDEO_FUNC(void, al_set_video_playing, (A5O_VIDEO *video, bool playing)); +A5O_VIDEO_FUNC(bool, al_is_video_playing, (A5O_VIDEO *video)); +A5O_VIDEO_FUNC(double, al_get_video_audio_rate, (A5O_VIDEO *video)); +A5O_VIDEO_FUNC(double, al_get_video_fps, (A5O_VIDEO *video)); +A5O_VIDEO_FUNC(float, al_get_video_scaled_width, (A5O_VIDEO *video)); +A5O_VIDEO_FUNC(float, al_get_video_scaled_height, (A5O_VIDEO *video)); +A5O_VIDEO_FUNC(A5O_BITMAP *, al_get_video_frame, (A5O_VIDEO *video)); +A5O_VIDEO_FUNC(double, al_get_video_position, (A5O_VIDEO *video, A5O_VIDEO_POSITION_TYPE which)); +A5O_VIDEO_FUNC(bool, al_seek_video, (A5O_VIDEO *video, double pos_in_seconds)); +A5O_VIDEO_FUNC(bool, al_init_video_addon, (void)); +A5O_VIDEO_FUNC(bool, al_is_video_addon_initialized, (void)); +A5O_VIDEO_FUNC(void, al_shutdown_video_addon, (void)); +A5O_VIDEO_FUNC(uint32_t, al_get_allegro_video_version, (void)); -ALLEGRO_VIDEO_FUNC(char const *, al_identify_video_f, (ALLEGRO_FILE *fp)); -ALLEGRO_VIDEO_FUNC(char const *, al_identify_video, (char const *filename)); +A5O_VIDEO_FUNC(char const *, al_identify_video_f, (A5O_FILE *fp)); +A5O_VIDEO_FUNC(char const *, al_identify_video, (char const *filename)); #ifdef __cplusplus } diff --git a/addons/video/allegro5/internal/aintern_video.h b/addons/video/allegro5/internal/aintern_video.h index 3f8d24bc45..4764651659 100644 --- a/addons/video/allegro5/internal/aintern_video.h +++ b/addons/video/allegro5/internal/aintern_video.h @@ -1,34 +1,34 @@ -typedef struct ALLEGRO_VIDEO_INTERFACE { - bool (*open_video)(ALLEGRO_VIDEO *video); - bool (*close_video)(ALLEGRO_VIDEO *video); - bool (*start_video)(ALLEGRO_VIDEO *video); - bool (*set_video_playing)(ALLEGRO_VIDEO *video); - bool (*seek_video)(ALLEGRO_VIDEO *video, double seek_to); - bool (*update_video)(ALLEGRO_VIDEO *video); -} ALLEGRO_VIDEO_INTERFACE; - -struct ALLEGRO_VIDEO { - ALLEGRO_VIDEO_INTERFACE *vtable; +typedef struct A5O_VIDEO_INTERFACE { + bool (*open_video)(A5O_VIDEO *video); + bool (*close_video)(A5O_VIDEO *video); + bool (*start_video)(A5O_VIDEO *video); + bool (*set_video_playing)(A5O_VIDEO *video); + bool (*seek_video)(A5O_VIDEO *video, double seek_to); + bool (*update_video)(A5O_VIDEO *video); +} A5O_VIDEO_INTERFACE; + +struct A5O_VIDEO { + A5O_VIDEO_INTERFACE *vtable; /* video */ - ALLEGRO_BITMAP *current_frame; + A5O_BITMAP *current_frame; double video_position; double fps; float scaled_width; float scaled_height; /* audio */ - ALLEGRO_MIXER *mixer; - ALLEGRO_VOICE *voice; - ALLEGRO_AUDIO_STREAM *audio; + A5O_MIXER *mixer; + A5O_VOICE *voice; + A5O_AUDIO_STREAM *audio; double audio_position; double audio_rate; /* general */ bool es_inited; - ALLEGRO_EVENT_SOURCE es; - ALLEGRO_PATH *filename; + A5O_EVENT_SOURCE es; + A5O_PATH *filename; bool playing; double position; @@ -36,9 +36,9 @@ struct ALLEGRO_VIDEO { void *data; }; -typedef bool (*ALLEGRO_VIDEO_IDENTIFIER_FUNCTION)(ALLEGRO_FILE *f); +typedef bool (*A5O_VIDEO_IDENTIFIER_FUNCTION)(A5O_FILE *f); void _al_compute_scaled_dimensions(int frame_w, int frame_h, float aspect_ratio, float *scaled_w, float *scaled_h); -ALLEGRO_VIDEO_INTERFACE *_al_video_ogv_vtable(void); -bool _al_video_identify_ogv(ALLEGRO_FILE *f); +A5O_VIDEO_INTERFACE *_al_video_ogv_vtable(void); +bool _al_video_identify_ogv(A5O_FILE *f); diff --git a/addons/video/allegro5/internal/aintern_video_cfg.h.cmake b/addons/video/allegro5/internal/aintern_video_cfg.h.cmake index 449a97ec7d..3f20925936 100644 --- a/addons/video/allegro5/internal/aintern_video_cfg.h.cmake +++ b/addons/video/allegro5/internal/aintern_video_cfg.h.cmake @@ -1 +1 @@ -#cmakedefine ALLEGRO_CFG_VIDEO_HAVE_OGV +#cmakedefine A5O_CFG_VIDEO_HAVE_OGV diff --git a/addons/video/ogv.c b/addons/video/ogv.c index 66021cf37a..5242260d89 100644 --- a/addons/video/ogv.c +++ b/addons/video/ogv.c @@ -25,13 +25,13 @@ #include #include -ALLEGRO_DEBUG_CHANNEL("video") +A5O_DEBUG_CHANNEL("video") /* XXX probably should be based on stream parameters */ static const int NUM_FRAGS = 2; static const int FRAG_SAMPLES = 4096; -static const int RGB_PIXEL_FORMAT = ALLEGRO_PIXEL_FORMAT_ABGR_8888; +static const int RGB_PIXEL_FORMAT = A5O_PIXEL_FORMAT_ABGR_8888; typedef struct OGG_VIDEO OGG_VIDEO; @@ -84,7 +84,7 @@ struct STREAM { }; struct OGG_VIDEO { - ALLEGRO_FILE *fp; + A5O_FILE *fp; bool reached_eof; ogg_sync_state sync_state; _AL_VECTOR streams; /* vector of STREAM pointers */ @@ -97,19 +97,19 @@ struct OGG_VIDEO { th_ycbcr_buffer buffer; bool buffer_dirty; unsigned char* rgb_data; - ALLEGRO_BITMAP *frame_bmp; - ALLEGRO_BITMAP *pic_bmp; /* frame_bmp, or subbitmap thereof */ - - ALLEGRO_EVENT_SOURCE evtsrc; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_MUTEX *mutex; - ALLEGRO_COND *cond; - ALLEGRO_THREAD *thread; + A5O_BITMAP *frame_bmp; + A5O_BITMAP *pic_bmp; /* frame_bmp, or subbitmap thereof */ + + A5O_EVENT_SOURCE evtsrc; + A5O_EVENT_QUEUE *queue; + A5O_MUTEX *mutex; + A5O_COND *cond; + A5O_THREAD *thread; }; /* forward declarations */ -static bool ogv_close_video(ALLEGRO_VIDEO *video); +static bool ogv_close_video(A5O_VIDEO *video); /* Packet queue. */ @@ -249,7 +249,7 @@ static void free_stream(STREAM *stream) { THEORA_STREAM *tstream = &stream->u.theora; - ALLEGRO_DEBUG("Clean up Theora.\n"); + A5O_DEBUG("Clean up Theora.\n"); th_info_clear(&tstream->info); th_comment_clear(&tstream->comment); if (tstream->setup) { @@ -265,7 +265,7 @@ static void free_stream(STREAM *stream) { VORBIS_STREAM *vstream = &stream->u.vorbis; - ALLEGRO_DEBUG("Clean up Vorbis.\n"); + A5O_DEBUG("Clean up Vorbis.\n"); vorbis_info_clear(&vstream->info); vorbis_comment_clear(&vstream->comment); if (vstream->inited_for_data) { @@ -298,7 +298,7 @@ static bool read_page(OGG_VIDEO *ogv, ogg_page *page) buffer = ogg_sync_buffer(&ogv->sync_state, buffer_size); bytes = al_fread(ogv->fp, buffer, buffer_size); if (bytes == 0) { - ALLEGRO_DEBUG("End of file.\n"); + A5O_DEBUG("End of file.\n"); return false; } @@ -365,7 +365,7 @@ static bool try_decode_theora_header(STREAM *stream, ogg_packet *packet) if (rc > 0) { /* Successfully parsed a Theora header. */ if (stream->stream_type == STREAM_TYPE_UNKNOWN) { - ALLEGRO_DEBUG("Found Theora stream.\n"); + A5O_DEBUG("Found Theora stream.\n"); stream->stream_type = STREAM_TYPE_THEORA; } return true; @@ -404,7 +404,7 @@ static int try_decode_vorbis_header(STREAM *stream, ogg_packet *packet) if (rc == 0) { /* Successfully parsed a Vorbis header. */ if (stream->stream_type == STREAM_TYPE_UNKNOWN) { - ALLEGRO_INFO("Found Vorbis stream.\n"); + A5O_INFO("Found Vorbis stream.\n"); stream->stream_type = STREAM_TYPE_VORBIS; stream->u.vorbis.inited_for_data = false; } @@ -455,7 +455,7 @@ static void read_headers(OGG_VIDEO *ogv) int serial; int rc; - ALLEGRO_DEBUG("Begin reading headers.\n"); + A5O_DEBUG("Begin reading headers.\n"); do { /* Read a page of data. */ @@ -475,7 +475,7 @@ static void read_headers(OGG_VIDEO *ogv) } if (!stream) { - ALLEGRO_WARN("No stream for serial: %x\n", serial); + A5O_WARN("No stream for serial: %x\n", serial); continue; } @@ -493,14 +493,14 @@ static void read_headers(OGG_VIDEO *ogv) continue; } if (rc == -1) { - ALLEGRO_WARN("No packet due to lost sync or hole in data.\n"); + A5O_WARN("No packet due to lost sync or hole in data.\n"); continue; } /* Try to decode the packet as a Theora or Vorbis header. */ if (!try_decode_theora_header(stream, &packet)) { if (!try_decode_vorbis_header(stream, &packet)) { - ALLEGRO_DEBUG("Unknown packet type ignored.\n"); + A5O_DEBUG("Unknown packet type ignored.\n"); } } @@ -510,13 +510,13 @@ static void read_headers(OGG_VIDEO *ogv) } while (!all_headers_done(ogv)); - ALLEGRO_DEBUG("End reading headers.\n"); + A5O_DEBUG("End reading headers.\n"); } /* Vorbis streams. */ -static void setup_vorbis_stream_decode(ALLEGRO_VIDEO *video, STREAM *stream) +static void setup_vorbis_stream_decode(A5O_VIDEO *video, STREAM *stream) { VORBIS_STREAM * const vstream = &stream->u.vorbis; int rc; @@ -535,8 +535,8 @@ static void setup_vorbis_stream_decode(ALLEGRO_VIDEO *video, STREAM *stream) vstream->next_fragment = al_calloc(vstream->channels * FRAG_SAMPLES, sizeof(float)); - ALLEGRO_INFO("Audio rate: %f\n", video->audio_rate); - ALLEGRO_INFO("Audio channels: %d\n", vstream->channels); + A5O_INFO("Audio rate: %f\n", video->audio_rate); + A5O_INFO("Audio channels: %d\n", vstream->channels); } static void handle_vorbis_data(VORBIS_STREAM *vstream, ogg_packet *packet) @@ -545,13 +545,13 @@ static void handle_vorbis_data(VORBIS_STREAM *vstream, ogg_packet *packet) rc = vorbis_synthesis(&vstream->block, packet); if (rc != 0) { - ALLEGRO_ERROR("vorbis_synthesis returned %d\n", rc); + A5O_ERROR("vorbis_synthesis returned %d\n", rc); return; } rc = vorbis_synthesis_blockin(&vstream->dsp, &vstream->block); if (rc != 0) { - ALLEGRO_ERROR("vorbis_synthesis_blockin returned %d\n", rc); + A5O_ERROR("vorbis_synthesis_blockin returned %d\n", rc); return; } } @@ -632,32 +632,32 @@ static void poll_vorbis_decode(OGG_VIDEO *ogv, STREAM *vstream_outer) } } -static ALLEGRO_AUDIO_STREAM *create_audio_stream(const ALLEGRO_VIDEO *video, +static A5O_AUDIO_STREAM *create_audio_stream(const A5O_VIDEO *video, const STREAM *vstream_outer) { const VORBIS_STREAM *vstream = &vstream_outer->u.vorbis; - ALLEGRO_AUDIO_STREAM *audio; + A5O_AUDIO_STREAM *audio; int chanconf; int rc; switch (vstream->channels) { - case 1: chanconf = ALLEGRO_CHANNEL_CONF_1; break; - case 2: chanconf = ALLEGRO_CHANNEL_CONF_2; break; - case 3: chanconf = ALLEGRO_CHANNEL_CONF_3; break; - case 4: chanconf = ALLEGRO_CHANNEL_CONF_4; break; - case 6: chanconf = ALLEGRO_CHANNEL_CONF_5_1; break; - case 7: chanconf = ALLEGRO_CHANNEL_CONF_6_1; break; - case 8: chanconf = ALLEGRO_CHANNEL_CONF_7_1; break; + case 1: chanconf = A5O_CHANNEL_CONF_1; break; + case 2: chanconf = A5O_CHANNEL_CONF_2; break; + case 3: chanconf = A5O_CHANNEL_CONF_3; break; + case 4: chanconf = A5O_CHANNEL_CONF_4; break; + case 6: chanconf = A5O_CHANNEL_CONF_5_1; break; + case 7: chanconf = A5O_CHANNEL_CONF_6_1; break; + case 8: chanconf = A5O_CHANNEL_CONF_7_1; break; default: - ALLEGRO_WARN("Unsupported number of channels: %d\n", + A5O_WARN("Unsupported number of channels: %d\n", vstream->channels); return NULL; } audio = al_create_audio_stream(NUM_FRAGS, FRAG_SAMPLES, - vstream->info.rate, ALLEGRO_AUDIO_DEPTH_FLOAT32, chanconf); + vstream->info.rate, A5O_AUDIO_DEPTH_FLOAT32, chanconf); if (!audio) { - ALLEGRO_ERROR("Could not create audio stream.\n"); + A5O_ERROR("Could not create audio stream.\n"); return NULL; } @@ -672,10 +672,10 @@ static ALLEGRO_AUDIO_STREAM *create_audio_stream(const ALLEGRO_VIDEO *video, } if (rc) { - ALLEGRO_DEBUG("Audio stream ready.\n"); + A5O_DEBUG("Audio stream ready.\n"); } else { - ALLEGRO_ERROR("Could not attach audio stream.\n"); + A5O_ERROR("Could not attach audio stream.\n"); al_destroy_audio_stream(audio); audio = NULL; } @@ -683,7 +683,7 @@ static ALLEGRO_AUDIO_STREAM *create_audio_stream(const ALLEGRO_VIDEO *video, return audio; } -static void update_audio_fragment(ALLEGRO_AUDIO_STREAM *audio_stream, +static void update_audio_fragment(A5O_AUDIO_STREAM *audio_stream, VORBIS_STREAM *vstream, bool paused, bool reached_eof) { float *frag; @@ -694,7 +694,7 @@ static void update_audio_fragment(ALLEGRO_AUDIO_STREAM *audio_stream, if (paused || vstream->next_fragment_pos < FRAG_SAMPLES) { if (!paused && !reached_eof) { - ALLEGRO_WARN("Next fragment not ready.\n"); + A5O_WARN("Next fragment not ready.\n"); } memset(frag, 0, vstream->channels * FRAG_SAMPLES * sizeof(float)); } @@ -710,7 +710,7 @@ static void update_audio_fragment(ALLEGRO_AUDIO_STREAM *audio_stream, /* Theora streams. */ -static void setup_theora_stream_decode(ALLEGRO_VIDEO *video, OGG_VIDEO *ogv, +static void setup_theora_stream_decode(A5O_VIDEO *video, OGG_VIDEO *ogv, STREAM *tstream_outer) { THEORA_STREAM * const tstream = &tstream_outer->u.theora; @@ -757,11 +757,11 @@ static void setup_theora_stream_decode(ALLEGRO_VIDEO *video, OGG_VIDEO *ogv, tstream->prev_framenum = -1; - ALLEGRO_INFO("Frame size: %dx%d\n", frame_w, frame_h); - ALLEGRO_INFO("Picture size: %dx%d\n", pic_w, pic_h); - ALLEGRO_INFO("Scaled size: %fx%f\n", video->scaled_width, video->scaled_height); - ALLEGRO_INFO("FPS: %f\n", video->fps); - ALLEGRO_INFO("Frame_duration: %f\n", tstream->frame_duration); + A5O_INFO("Frame size: %dx%d\n", frame_w, frame_h); + A5O_INFO("Picture size: %dx%d\n", pic_w, pic_h); + A5O_INFO("Scaled size: %fx%f\n", video->scaled_width, video->scaled_height); + A5O_INFO("FPS: %f\n", video->fps); + A5O_INFO("Frame_duration: %f\n", tstream->frame_duration); } static int64_t get_theora_framenum(THEORA_STREAM *tstream, ogg_packet *packet) @@ -773,7 +773,7 @@ static int64_t get_theora_framenum(THEORA_STREAM *tstream, ogg_packet *packet) return tstream->prev_framenum + 1; } -static bool handle_theora_data(ALLEGRO_VIDEO *video, THEORA_STREAM *tstream, +static bool handle_theora_data(A5O_VIDEO *video, THEORA_STREAM *tstream, ogg_packet *packet, bool *ret_new_frame) { int64_t expected_framenum; @@ -785,7 +785,7 @@ static bool handle_theora_data(ALLEGRO_VIDEO *video, THEORA_STREAM *tstream, if (framenum > expected_framenum) { /* Packet is for a later frame, don't decode it yet. */ - ALLEGRO_DEBUG("Expected frame %ld, got %ld\n", + A5O_DEBUG("Expected frame %ld, got %ld\n", (long)expected_framenum, (long)framenum); video->video_position += tstream->frame_duration; tstream->prev_framenum++; @@ -793,7 +793,7 @@ static bool handle_theora_data(ALLEGRO_VIDEO *video, THEORA_STREAM *tstream, } if (framenum < expected_framenum) { - ALLEGRO_DEBUG("Expected frame %ld, got %ld (decoding anyway)\n", + A5O_DEBUG("Expected frame %ld, got %ld (decoding anyway)\n", (long)expected_framenum, (long)framenum); } @@ -870,12 +870,12 @@ static void convert_buffer_to_rgba(OGG_VIDEO *ogv) ycbcr_to_rgb(ogv->buffer, ogv->rgb_data, pixel_size, pitch, 0, 0); break; default: - ALLEGRO_ERROR("Unsupported pixel format.\n"); + A5O_ERROR("Unsupported pixel format.\n"); break; } } -static int poll_theora_decode(ALLEGRO_VIDEO *video, STREAM *tstream_outer) +static int poll_theora_decode(A5O_VIDEO *video, STREAM *tstream_outer) { OGG_VIDEO * const ogv = video->data; THEORA_STREAM * const tstream = &tstream_outer->u.theora; @@ -920,7 +920,7 @@ static int poll_theora_decode(ALLEGRO_VIDEO *video, STREAM *tstream_outer) } if (new_frame) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_lock_mutex(ogv->mutex); rc = th_decode_ycbcr_out(tstream->ctx, ogv->buffer); @@ -930,7 +930,7 @@ static int poll_theora_decode(ALLEGRO_VIDEO *video, STREAM *tstream_outer) ogv->buffer_dirty = true; - event.type = ALLEGRO_EVENT_VIDEO_FRAME_SHOW; + event.type = A5O_EVENT_VIDEO_FRAME_SHOW; event.user.data1 = (intptr_t)video; al_emit_user_event(&video->es, &event, NULL); @@ -943,7 +943,7 @@ static int poll_theora_decode(ALLEGRO_VIDEO *video, STREAM *tstream_outer) /* Seeking. */ -static void seek_to_beginning(ALLEGRO_VIDEO *video, OGG_VIDEO *ogv, +static void seek_to_beginning(A5O_VIDEO *video, OGG_VIDEO *ogv, THEORA_STREAM *tstream) { unsigned i; @@ -985,19 +985,19 @@ static void seek_to_beginning(ALLEGRO_VIDEO *video, OGG_VIDEO *ogv, /* Decode thread. */ -static void *decode_thread_func(ALLEGRO_THREAD *thread, void *_video) +static void *decode_thread_func(A5O_THREAD *thread, void *_video) { - ALLEGRO_VIDEO * const video = _video; + A5O_VIDEO * const video = _video; OGG_VIDEO * const ogv = video->data; STREAM *tstream_outer; THEORA_STREAM *tstream = NULL; STREAM *vstream_outer; VORBIS_STREAM *vstream = NULL; - ALLEGRO_TIMER *timer; + A5O_TIMER *timer; double audio_pos_step = 0.0; double timer_dur; - ALLEGRO_DEBUG("Thread started.\n"); + A5O_DEBUG("Thread started.\n"); tstream_outer = ogv->selected_video_stream; if (tstream_outer) { @@ -1021,7 +1021,7 @@ static void *decode_thread_func(ALLEGRO_THREAD *thread, void *_video) } if (!tstream_outer && !vstream_outer) { - ALLEGRO_WARN("No audio or video stream found.\n"); + A5O_WARN("No audio or video stream found.\n"); return NULL; } @@ -1040,16 +1040,16 @@ static void *decode_thread_func(ALLEGRO_THREAD *thread, void *_video) al_get_audio_stream_event_source(video->audio)); } - ALLEGRO_DEBUG("Begin decode loop.\n"); + A5O_DEBUG("Begin decode loop.\n"); al_start_timer(timer); while (!al_get_thread_should_stop(thread)) { - ALLEGRO_EVENT ev; + A5O_EVENT ev; al_wait_for_event(ogv->queue, &ev); - if (ev.type == _ALLEGRO_EVENT_VIDEO_SEEK) { + if (ev.type == _A5O_EVENT_VIDEO_SEEK) { double seek_to = ev.user.data1 / 1.0e6; /* XXX we only know how to seek to start of video */ ASSERT(seek_to <= 0.0); @@ -1061,7 +1061,7 @@ static void *decode_thread_func(ALLEGRO_THREAD *thread, void *_video) continue; } - if (ev.type == ALLEGRO_EVENT_TIMER) { + if (ev.type == A5O_EVENT_TIMER) { if (vstream_outer && video->playing) { poll_vorbis_decode(ogv, vstream_outer); } @@ -1076,16 +1076,16 @@ static void *decode_thread_func(ALLEGRO_THREAD *thread, void *_video) } if (video->playing && ogv->reached_eof) { - ALLEGRO_EVENT event; + A5O_EVENT event; video->playing = false; - event.type = ALLEGRO_EVENT_VIDEO_FINISHED; + event.type = A5O_EVENT_VIDEO_FINISHED; event.user.data1 = (intptr_t)video; al_emit_user_event(&video->es, &event, NULL); } } - if (ev.type == ALLEGRO_EVENT_AUDIO_STREAM_FRAGMENT) { + if (ev.type == A5O_EVENT_AUDIO_STREAM_FRAGMENT) { /* Audio clock is master when it exists. */ /* XXX This doesn't work well when the process is paused then resumed, * due to a problem with the audio addon. We get a flood of @@ -1101,7 +1101,7 @@ static void *decode_thread_func(ALLEGRO_THREAD *thread, void *_video) } } - ALLEGRO_DEBUG("End decode loop.\n"); + A5O_DEBUG("End decode loop.\n"); if (video->audio) { al_drain_audio_stream(video->audio); @@ -1110,7 +1110,7 @@ static void *decode_thread_func(ALLEGRO_THREAD *thread, void *_video) } al_destroy_timer(timer); - ALLEGRO_DEBUG("Thread exit.\n"); + A5O_DEBUG("Thread exit.\n"); return NULL; } @@ -1118,14 +1118,14 @@ static void *decode_thread_func(ALLEGRO_THREAD *thread, void *_video) static bool update_frame_bmp(OGG_VIDEO *ogv) { - ALLEGRO_LOCKED_REGION *lr; + A5O_LOCKED_REGION *lr; int y; int pitch = al_get_pixel_size(RGB_PIXEL_FORMAT) * al_get_bitmap_width(ogv->frame_bmp); lr = al_lock_bitmap(ogv->frame_bmp, RGB_PIXEL_FORMAT, - ALLEGRO_LOCK_WRITEONLY); + A5O_LOCK_WRITEONLY); if (!lr) { - ALLEGRO_ERROR("Failed to lock bitmap.\n"); + A5O_ERROR("Failed to lock bitmap.\n"); return false; } @@ -1140,7 +1140,7 @@ static bool update_frame_bmp(OGG_VIDEO *ogv) /* Video interface. */ -static bool do_open_video(ALLEGRO_VIDEO *video, OGG_VIDEO *ogv) +static bool do_open_video(A5O_VIDEO *video, OGG_VIDEO *ogv) { unsigned i; @@ -1171,23 +1171,23 @@ static bool do_open_video(ALLEGRO_VIDEO *video, OGG_VIDEO *ogv) return ogv->selected_video_stream || ogv->selected_audio_stream; } -static bool ogv_open_video(ALLEGRO_VIDEO *video) +static bool ogv_open_video(A5O_VIDEO *video) { const char *filename; - ALLEGRO_FILE *fp; + A5O_FILE *fp; OGG_VIDEO *ogv; int rc; - filename = al_path_cstr(video->filename, ALLEGRO_NATIVE_PATH_SEP); + filename = al_path_cstr(video->filename, A5O_NATIVE_PATH_SEP); fp = al_fopen(filename, "rb"); if (!fp) { - ALLEGRO_WARN("Failed to open %s.\n", filename); + A5O_WARN("Failed to open %s.\n", filename); return false; } ogv = al_calloc(1, sizeof(OGG_VIDEO)); if (!ogv) { - ALLEGRO_ERROR("Out of memory.\n"); + A5O_ERROR("Out of memory.\n"); al_fclose(fp); return false; } @@ -1197,7 +1197,7 @@ static bool ogv_open_video(ALLEGRO_VIDEO *video) _al_vector_init(&ogv->streams, sizeof(STREAM *)); if (!do_open_video(video, ogv)) { - ALLEGRO_ERROR("No audio or video stream found.\n"); + A5O_ERROR("No audio or video stream found.\n"); ogv_close_video(video); return false; } @@ -1208,7 +1208,7 @@ static bool ogv_open_video(ALLEGRO_VIDEO *video) return true; } -static bool ogv_close_video(ALLEGRO_VIDEO *video) +static bool ogv_close_video(A5O_VIDEO *video) { OGG_VIDEO *ogv; unsigned i; @@ -1246,18 +1246,18 @@ static bool ogv_close_video(ALLEGRO_VIDEO *video) return true; } -static bool ogv_start_video(ALLEGRO_VIDEO *video) +static bool ogv_start_video(A5O_VIDEO *video) { OGG_VIDEO *ogv = video->data; if (ogv->thread != NULL) { - ALLEGRO_ERROR("Thread already created.\n"); + A5O_ERROR("Thread already created.\n"); return false; } ogv->thread = al_create_thread(decode_thread_func, video); if (!ogv->thread) { - ALLEGRO_ERROR("Could not create thread.\n"); + A5O_ERROR("Could not create thread.\n"); return false; } @@ -1272,7 +1272,7 @@ static bool ogv_start_video(ALLEGRO_VIDEO *video) return true; } -static bool ogv_set_video_playing(ALLEGRO_VIDEO *video) +static bool ogv_set_video_playing(A5O_VIDEO *video) { OGG_VIDEO * const ogv = video->data; if (ogv->reached_eof) { @@ -1281,10 +1281,10 @@ static bool ogv_set_video_playing(ALLEGRO_VIDEO *video) return true; } -static bool ogv_seek_video(ALLEGRO_VIDEO *video, double seek_to) +static bool ogv_seek_video(A5O_VIDEO *video, double seek_to) { OGG_VIDEO *ogv = video->data; - ALLEGRO_EVENT ev; + A5O_EVENT ev; int seek_counter; /* XXX we only know how to seek to beginning */ @@ -1296,7 +1296,7 @@ static bool ogv_seek_video(ALLEGRO_VIDEO *video, double seek_to) seek_counter = ogv->seek_counter; - ev.user.type = _ALLEGRO_EVENT_VIDEO_SEEK; + ev.user.type = _A5O_EVENT_VIDEO_SEEK; ev.user.data1 = seek_to * 1.0e6; ev.user.data2 = 0; ev.user.data3 = 0; @@ -1312,7 +1312,7 @@ static bool ogv_seek_video(ALLEGRO_VIDEO *video, double seek_to) return true; } -static bool ogv_update_video(ALLEGRO_VIDEO *video) +static bool ogv_update_video(A5O_VIDEO *video) { OGG_VIDEO *ogv = video->data; int w, h; @@ -1347,7 +1347,7 @@ static bool ogv_update_video(ALLEGRO_VIDEO *video) return ret; } -static ALLEGRO_VIDEO_INTERFACE ogv_vtable = { +static A5O_VIDEO_INTERFACE ogv_vtable = { ogv_open_video, ogv_close_video, ogv_start_video, @@ -1356,12 +1356,12 @@ static ALLEGRO_VIDEO_INTERFACE ogv_vtable = { ogv_update_video, }; -ALLEGRO_VIDEO_INTERFACE *_al_video_ogv_vtable(void) +A5O_VIDEO_INTERFACE *_al_video_ogv_vtable(void) { return &ogv_vtable; } -bool _al_video_identify_ogv(ALLEGRO_FILE *f) +bool _al_video_identify_ogv(A5O_FILE *f) { uint8_t x[4]; if (al_fread(f, x, 4) < 4) diff --git a/addons/video/video.c b/addons/video/video.c index 34c9eae897..28ac817411 100644 --- a/addons/video/video.c +++ b/addons/video/video.c @@ -18,7 +18,7 @@ * audio streams or subtitle overlay streams. * * - Non audio/video streams. For example something like: - * ALLEGRO_USTR *al_get_video_subtitle(float *x, float *y); + * A5O_USTR *al_get_video_subtitle(float *x, float *y); * * - Buffering. Right now buffering is hardcoded to a fixed size which * seemed enough for streaming 720p from disk in my tests. Obviously @@ -46,7 +46,7 @@ #include "allegro5/internal/aintern_exitfunc.h" #include "allegro5/internal/aintern_vector.h" -ALLEGRO_DEBUG_CHANNEL("video") +A5O_DEBUG_CHANNEL("video") /* globals */ @@ -54,13 +54,13 @@ static bool video_inited = false; typedef struct VideoHandler { const char *extension; - ALLEGRO_VIDEO_INTERFACE *vtable; - ALLEGRO_VIDEO_IDENTIFIER_FUNCTION identifier; + A5O_VIDEO_INTERFACE *vtable; + A5O_VIDEO_IDENTIFIER_FUNCTION identifier; } VideoHandler; static _AL_VECTOR handlers = _AL_VECTOR_INITIALIZER(VideoHandler); -static const char* identify_video(ALLEGRO_FILE *f) +static const char* identify_video(A5O_FILE *f) { size_t i; for (i = 0; i < _al_vector_size(&handlers); i++) { @@ -72,7 +72,7 @@ static const char* identify_video(ALLEGRO_FILE *f) return NULL; } -static ALLEGRO_VIDEO_INTERFACE *find_handler(const char *extension) +static A5O_VIDEO_INTERFACE *find_handler(const char *extension) { size_t i; for (i = 0; i < _al_vector_size(&handlers); i++) { @@ -84,8 +84,8 @@ static ALLEGRO_VIDEO_INTERFACE *find_handler(const char *extension) return NULL; } -static void add_handler(const char *extension, ALLEGRO_VIDEO_INTERFACE *vtable, - ALLEGRO_VIDEO_IDENTIFIER_FUNCTION identifier) +static void add_handler(const char *extension, A5O_VIDEO_INTERFACE *vtable, + A5O_VIDEO_IDENTIFIER_FUNCTION identifier) { VideoHandler *v = _al_vector_alloc_back(&handlers); v->extension = extension; @@ -95,9 +95,9 @@ static void add_handler(const char *extension, ALLEGRO_VIDEO_INTERFACE *vtable, /* Function: al_open_video */ -ALLEGRO_VIDEO *al_open_video(char const *filename) +A5O_VIDEO *al_open_video(char const *filename) { - ALLEGRO_VIDEO *video; + A5O_VIDEO *video; const char *ext; video = al_calloc(1, sizeof *video); @@ -106,13 +106,13 @@ ALLEGRO_VIDEO *al_open_video(char const *filename) if (!ext) { ext = strrchr(filename, '.'); if (!ext) { - ALLEGRO_ERROR("Could not identify video %s!\n", filename); + A5O_ERROR("Could not identify video %s!\n", filename); } } video->vtable = find_handler(ext); if (video->vtable == NULL) { - ALLEGRO_ERROR("No handler for video extension %s - " + A5O_ERROR("No handler for video extension %s - " "therefore not trying to load %s.\n", ext, filename); al_free(video); return NULL; @@ -122,7 +122,7 @@ ALLEGRO_VIDEO *al_open_video(char const *filename) video->playing = true; if (!video->vtable->open_video(video)) { - ALLEGRO_ERROR("Could not open %s.\n", filename); + A5O_ERROR("Could not open %s.\n", filename); al_destroy_path(video->filename); al_free(video); return NULL; @@ -136,7 +136,7 @@ ALLEGRO_VIDEO *al_open_video(char const *filename) /* Function: al_close_video */ -void al_close_video(ALLEGRO_VIDEO *video) +void al_close_video(A5O_VIDEO *video) { if (video) { video->vtable->close_video(video); @@ -150,7 +150,7 @@ void al_close_video(ALLEGRO_VIDEO *video) /* Function: al_get_video_event_source */ -ALLEGRO_EVENT_SOURCE *al_get_video_event_source(ALLEGRO_VIDEO *video) +A5O_EVENT_SOURCE *al_get_video_event_source(A5O_VIDEO *video) { ASSERT(video); return &video->es; @@ -158,7 +158,7 @@ ALLEGRO_EVENT_SOURCE *al_get_video_event_source(ALLEGRO_VIDEO *video) /* Function: al_start_video */ -void al_start_video(ALLEGRO_VIDEO *video, ALLEGRO_MIXER *mixer) +void al_start_video(A5O_VIDEO *video, A5O_MIXER *mixer) { ASSERT(video); @@ -169,7 +169,7 @@ void al_start_video(ALLEGRO_VIDEO *video, ALLEGRO_MIXER *mixer) /* Function: al_start_video_with_voice */ -void al_start_video_with_voice(ALLEGRO_VIDEO *video, ALLEGRO_VOICE *voice) +void al_start_video_with_voice(A5O_VIDEO *video, A5O_VOICE *voice) { ASSERT(video); @@ -180,7 +180,7 @@ void al_start_video_with_voice(ALLEGRO_VIDEO *video, ALLEGRO_VOICE *voice) /* Function: al_set_video_playing */ -void al_set_video_playing(ALLEGRO_VIDEO *video, bool play) +void al_set_video_playing(A5O_VIDEO *video, bool play) { ASSERT(video); @@ -192,7 +192,7 @@ void al_set_video_playing(ALLEGRO_VIDEO *video, bool play) /* Function: al_is_video_playing */ -bool al_is_video_playing(ALLEGRO_VIDEO *video) +bool al_is_video_playing(A5O_VIDEO *video) { ASSERT(video); @@ -201,7 +201,7 @@ bool al_is_video_playing(ALLEGRO_VIDEO *video) /* Function: al_get_video_frame */ -ALLEGRO_BITMAP *al_get_video_frame(ALLEGRO_VIDEO *video) +A5O_BITMAP *al_get_video_frame(A5O_VIDEO *video) { ASSERT(video); @@ -211,20 +211,20 @@ ALLEGRO_BITMAP *al_get_video_frame(ALLEGRO_VIDEO *video) /* Function: al_get_video_position */ -double al_get_video_position(ALLEGRO_VIDEO *video, ALLEGRO_VIDEO_POSITION_TYPE which) +double al_get_video_position(A5O_VIDEO *video, A5O_VIDEO_POSITION_TYPE which) { ASSERT(video); - if (which == ALLEGRO_VIDEO_POSITION_VIDEO_DECODE) + if (which == A5O_VIDEO_POSITION_VIDEO_DECODE) return video->video_position; - if (which == ALLEGRO_VIDEO_POSITION_AUDIO_DECODE) + if (which == A5O_VIDEO_POSITION_AUDIO_DECODE) return video->audio_position; return video->position; } /* Function: al_seek_video */ -bool al_seek_video(ALLEGRO_VIDEO *video, double pos_in_seconds) +bool al_seek_video(A5O_VIDEO *video, double pos_in_seconds) { ASSERT(video); @@ -233,7 +233,7 @@ bool al_seek_video(ALLEGRO_VIDEO *video, double pos_in_seconds) /* Function: al_get_video_audio_rate */ -double al_get_video_audio_rate(ALLEGRO_VIDEO *video) +double al_get_video_audio_rate(A5O_VIDEO *video) { ASSERT(video); return video->audio_rate; @@ -241,7 +241,7 @@ double al_get_video_audio_rate(ALLEGRO_VIDEO *video) /* Function: al_get_video_fps */ -double al_get_video_fps(ALLEGRO_VIDEO *video) +double al_get_video_fps(A5O_VIDEO *video) { ASSERT(video); return video->fps; @@ -249,7 +249,7 @@ double al_get_video_fps(ALLEGRO_VIDEO *video) /* Function: al_get_video_scaled_width */ -float al_get_video_scaled_width(ALLEGRO_VIDEO *video) +float al_get_video_scaled_width(A5O_VIDEO *video) { ASSERT(video); return video->scaled_width; @@ -257,7 +257,7 @@ float al_get_video_scaled_width(ALLEGRO_VIDEO *video) /* Function: al_get_video_scaled_height */ -float al_get_video_scaled_height(ALLEGRO_VIDEO *video) +float al_get_video_scaled_height(A5O_VIDEO *video) { ASSERT(video); return video->scaled_height; @@ -270,12 +270,12 @@ bool al_init_video_addon(void) if (video_inited) return true; -#ifdef ALLEGRO_CFG_VIDEO_HAVE_OGV +#ifdef A5O_CFG_VIDEO_HAVE_OGV add_handler(".ogv", _al_video_ogv_vtable(), _al_video_identify_ogv); #endif if (_al_vector_size(&handlers) == 0) { - ALLEGRO_WARN("No video handlers available!\n"); + A5O_WARN("No video handlers available!\n"); return false; } @@ -310,13 +310,13 @@ void al_shutdown_video_addon(void) */ uint32_t al_get_allegro_video_version(void) { - return ALLEGRO_VERSION_INT; + return A5O_VERSION_INT; } /* Function: al_identify_video_f */ -char const *al_identify_video_f(ALLEGRO_FILE *fp) +char const *al_identify_video_f(A5O_FILE *fp) { return identify_video(fp); } @@ -327,7 +327,7 @@ char const *al_identify_video_f(ALLEGRO_FILE *fp) char const *al_identify_video(char const *filename) { char const *ext; - ALLEGRO_FILE *fp = al_fopen(filename, "rb"); + A5O_FILE *fp = al_fopen(filename, "rb"); if (!fp) return NULL; ext = identify_video(fp); diff --git a/allegro5.cfg b/allegro5.cfg index 50a00a95c6..b318da0189 100644 --- a/allegro5.cfg +++ b/allegro5.cfg @@ -187,9 +187,9 @@ channels=all # In debug builds if it is empty or unset, then the level is set to debug. # In release builds if it is empty or unset, then the level is set to none. # If not none, Allegro will write out the logs to an allegro.log file next to -# the binary. Use ALLEGRO_TRACE environment variable to control that file +# the binary. Use A5O_TRACE environment variable to control that file # location. A special filename of - (dash) means logging to stdout. -# You can override this value via the ALLEGRO_TRACE_LEVEL environment variable. +# You can override this value via the A5O_TRACE_LEVEL environment variable. level= # Set to 0 to disable line numbers in log files. @@ -234,8 +234,8 @@ max_page_size = 0 [osx] -# If set to false, then Allegro will send ALLEGRO_EVENT_DISPLAY_HALT_DRAWING -# and ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING events when the user resizes a +# If set to false, then Allegro will send A5O_EVENT_DISPLAY_HALT_DRAWING +# and A5O_EVENT_DISPLAY_RESUME_DRAWING events when the user resizes a # window. Drawing while resizing ("live resizing") has historically been buggy, # so setting this to false allows you to opt out of this behavior and detect # when the resize happens. diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt index f2b9ae5342..2c8cd1efbe 100644 --- a/android/CMakeLists.txt +++ b/android/CMakeLists.txt @@ -7,8 +7,8 @@ else() set(AAR_NAME allegro-release.aar) set(ASSEMBLE assembleRelease) endif() -set(ALLEGRO_AAR ${LIBRARY_OUTPUT_PATH}/${AAR_NAME}) -set(ALLEGRO_AAR ${ALLEGRO_AAR} PARENT_SCOPE) +set(A5O_AAR ${LIBRARY_OUTPUT_PATH}/${AAR_NAME}) +set(A5O_AAR ${A5O_AAR} PARENT_SCOPE) if (NOT EXISTS "$ENV{ANDROID_HOME}") set(ENV{ANDROID_HOME} "$ENV{HOME}/Android/Sdk") @@ -62,12 +62,12 @@ foreach(copy ${COPY_FILES}) endforeach() add_custom_command( - OUTPUT ${ALLEGRO_AAR} + OUTPUT ${A5O_AAR} DEPENDS ${COPIED_FILES} WORKING_DIRECTORY ${PROJECT} COMMAND ./gradlew ${ASSEMBLE} - COMMAND ${CMAKE_COMMAND} -E copy allegro/build/outputs/aar/${AAR_NAME} ${ALLEGRO_AAR} + COMMAND ${CMAKE_COMMAND} -E copy allegro/build/outputs/aar/${AAR_NAME} ${A5O_AAR} ) add_custom_target(aar ALL - DEPENDS ${ALLEGRO_AAR}) + DEPENDS ${A5O_AAR}) diff --git a/android/gradle_project/allegro/src/main/java/org/liballeg/android/AllegroActivity.java b/android/gradle_project/allegro/src/main/java/org/liballeg/android/AllegroActivity.java index 9b24286a14..f89caf3253 100644 --- a/android/gradle_project/allegro/src/main/java/org/liballeg/android/AllegroActivity.java +++ b/android/gradle_project/allegro/src/main/java/org/liballeg/android/AllegroActivity.java @@ -384,7 +384,7 @@ public void onCreate(Bundle savedInstanceState) OnBackInvokedDispatcher.PRIORITY_DEFAULT, new OnBackInvokedCallback() { @Override public void onBackInvoked() { - // these will be mapped to ALLEGRO_KEY_BACK + // these will be mapped to A5O_KEY_BACK KeyEvent keyDown = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK); KeyEvent keyUp = new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK); dispatchKeyEvent(keyDown); diff --git a/android/gradle_project/allegro/src/main/java/org/liballeg/android/AllegroDialog.java b/android/gradle_project/allegro/src/main/java/org/liballeg/android/AllegroDialog.java index 31a3f12be1..962d2426ff 100644 --- a/android/gradle_project/allegro/src/main/java/org/liballeg/android/AllegroDialog.java +++ b/android/gradle_project/allegro/src/main/java/org/liballeg/android/AllegroDialog.java @@ -126,11 +126,11 @@ private AlertDialog createAlertDialog(Activity activity, String title, String me builder.setMessage(message); builder.setCancelable(true); - if (0 != (flags & AllegroDialogConst.ALLEGRO_MESSAGEBOX_WARN)) + if (0 != (flags & AllegroDialogConst.A5O_MESSAGEBOX_WARN)) builder.setIcon(android.R.drawable.ic_dialog_alert); - else if (0 != (flags & AllegroDialogConst.ALLEGRO_MESSAGEBOX_ERROR)) + else if (0 != (flags & AllegroDialogConst.A5O_MESSAGEBOX_ERROR)) builder.setIcon(android.R.drawable.ic_dialog_alert); // ic_delete - else if (0 != (flags & AllegroDialogConst.ALLEGRO_MESSAGEBOX_QUESTION)) + else if (0 != (flags & AllegroDialogConst.A5O_MESSAGEBOX_QUESTION)) builder.setIcon(android.R.drawable.ic_dialog_info); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { @@ -157,7 +157,7 @@ public void onDismiss(DialogInterface dialog) { if (!wantCustomButtons) { builder.setPositiveButton(android.R.string.ok, resultSetter.generate(POSITIVE_BUTTON)); - if (0 != (flags & (AllegroDialogConst.ALLEGRO_MESSAGEBOX_OK_CANCEL | AllegroDialogConst.ALLEGRO_MESSAGEBOX_YES_NO))) { + if (0 != (flags & (AllegroDialogConst.A5O_MESSAGEBOX_OK_CANCEL | AllegroDialogConst.A5O_MESSAGEBOX_YES_NO))) { // unfortunately, android.R.string.yes and android.R.string.no // are deprecated and resolve to android.R.string.ok and // android.R.string.cancel, respectively. @@ -266,7 +266,7 @@ private class ImmersiveDialogWrapper mode in a special way. Message boxes have a blocking interface. When the app is in immersive - mode (i.e., the ALLEGRO_FRAMELESS display flag is on), a deadlock may + mode (i.e., the A5O_FRAMELESS display flag is on), a deadlock may occur as soon as a message box is invoked. That will happen if the thread that calls al_acknowledge_resize() is the same thread that invokes the message box. @@ -276,7 +276,7 @@ thread that calls al_acknowledge_resize() is the same thread that as soon as the message box is called forth. This, in turn, triggers a display resize event. In summary, here is what happens: - - Allegro will block the UI thread until ALLEGRO_EVENT_DISPLAY_RESIZE + - Allegro will block the UI thread until A5O_EVENT_DISPLAY_RESIZE is acknowledged. - The thread that invoked the message box from native code will remain @@ -385,7 +385,7 @@ public String open(Activity activity, int flags, String patterns, String initial The Allegro API specifies that al_show_native_file_dialog() blocks the calling thread until it returns. Since there is a need to - handle ALLEGRO_EVENT_DISPLAY_HALT_DRAWING before this function + handle A5O_EVENT_DISPLAY_HALT_DRAWING before this function returns, this must be called from a different thread. If al_show_native_file_dialog() is not called from a different @@ -503,7 +503,7 @@ private void reallyOpen(Activity activity, int flags, String[] mimeTypes, Uri in String action = selectAction(flags); Intent intent = new Intent(action); - if (0 != (flags & AllegroDialogConst.ALLEGRO_FILECHOOSER_SAVE)) { + if (0 != (flags & AllegroDialogConst.A5O_FILECHOOSER_SAVE)) { // "Save file" if (mimeTypes.length != 1) { intent.setType("*/*"); @@ -513,23 +513,23 @@ private void reallyOpen(Activity activity, int flags, String[] mimeTypes, Uri in else intent.setType(mimeTypes[0]); } - else if (0 == (flags & AllegroDialogConst.ALLEGRO_FILECHOOSER_FOLDER)) { + else if (0 == (flags & AllegroDialogConst.A5O_FILECHOOSER_FOLDER)) { // "Load file" if (mimeTypes.length != 1) { intent.setType("*/*"); if (mimeTypes.length > 0) intent.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes); - else if (0 != (flags & AllegroDialogConst.ALLEGRO_FILECHOOSER_PICTURES)) + else if (0 != (flags & AllegroDialogConst.A5O_FILECHOOSER_PICTURES)) intent.setType("image/*"); } else intent.setType(mimeTypes[0]); } - if (0 == (flags & AllegroDialogConst.ALLEGRO_FILECHOOSER_FOLDER)) + if (0 == (flags & AllegroDialogConst.A5O_FILECHOOSER_FOLDER)) intent.addCategory(Intent.CATEGORY_OPENABLE); - if (0 != (flags & AllegroDialogConst.ALLEGRO_FILECHOOSER_MULTIPLE)) + if (0 != (flags & AllegroDialogConst.A5O_FILECHOOSER_MULTIPLE)) intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); if (Build.VERSION.SDK_INT >= 26) { @@ -554,14 +554,14 @@ else if (0 != (flags & AllegroDialogConst.ALLEGRO_FILECHOOSER_PICTURES)) private String selectAction(int flags) throws UnsupportedOperationException { - if (0 != (flags & AllegroDialogConst.ALLEGRO_FILECHOOSER_FOLDER)) { + if (0 != (flags & AllegroDialogConst.A5O_FILECHOOSER_FOLDER)) { if (Build.VERSION.SDK_INT < 21) throw new UnsupportedOperationException("Unsupported operation in API level " + Build.VERSION.SDK_INT); return Intent.ACTION_OPEN_DOCUMENT_TREE; } - if (0 != (flags & AllegroDialogConst.ALLEGRO_FILECHOOSER_SAVE)) { + if (0 != (flags & AllegroDialogConst.A5O_FILECHOOSER_SAVE)) { /* "ACTION_CREATE_DOCUMENT cannot overwrite an existing file. If your @@ -644,18 +644,18 @@ public void append(String tag, String message) class AllegroDialogConst { // allegro_native_dialog.h - public static final int ALLEGRO_FILECHOOSER_FILE_MUST_EXIST = 1; - public static final int ALLEGRO_FILECHOOSER_SAVE = 2; - public static final int ALLEGRO_FILECHOOSER_FOLDER = 4; - public static final int ALLEGRO_FILECHOOSER_PICTURES = 8; - public static final int ALLEGRO_FILECHOOSER_SHOW_HIDDEN = 16; - public static final int ALLEGRO_FILECHOOSER_MULTIPLE = 32; - - public static final int ALLEGRO_MESSAGEBOX_WARN = 1; - public static final int ALLEGRO_MESSAGEBOX_ERROR = 2; - public static final int ALLEGRO_MESSAGEBOX_OK_CANCEL = 4; - public static final int ALLEGRO_MESSAGEBOX_YES_NO = 8; - public static final int ALLEGRO_MESSAGEBOX_QUESTION = 16; + public static final int A5O_FILECHOOSER_FILE_MUST_EXIST = 1; + public static final int A5O_FILECHOOSER_SAVE = 2; + public static final int A5O_FILECHOOSER_FOLDER = 4; + public static final int A5O_FILECHOOSER_PICTURES = 8; + public static final int A5O_FILECHOOSER_SHOW_HIDDEN = 16; + public static final int A5O_FILECHOOSER_MULTIPLE = 32; + + public static final int A5O_MESSAGEBOX_WARN = 1; + public static final int A5O_MESSAGEBOX_ERROR = 2; + public static final int A5O_MESSAGEBOX_OK_CANCEL = 4; + public static final int A5O_MESSAGEBOX_YES_NO = 8; + public static final int A5O_MESSAGEBOX_QUESTION = 16; } diff --git a/android/gradle_project/allegro/src/main/java/org/liballeg/android/AllegroEGL.java b/android/gradle_project/allegro/src/main/java/org/liballeg/android/AllegroEGL.java index 1aa998f0a5..a699aabfe7 100644 --- a/android/gradle_project/allegro/src/main/java/org/liballeg/android/AllegroEGL.java +++ b/android/gradle_project/allegro/src/main/java/org/liballeg/android/AllegroEGL.java @@ -110,15 +110,15 @@ private int eglAttrib(int al_attr) private final int[] attribMapping(EGL10 egl) { return new int[] { - egl.EGL_RED_SIZE, Const.ALLEGRO_RED_SIZE, - egl.EGL_GREEN_SIZE, Const.ALLEGRO_GREEN_SIZE, - egl.EGL_BLUE_SIZE, Const.ALLEGRO_BLUE_SIZE, - egl.EGL_ALPHA_SIZE, Const.ALLEGRO_ALPHA_SIZE, - egl.EGL_BUFFER_SIZE, Const.ALLEGRO_COLOR_SIZE, - egl.EGL_DEPTH_SIZE, Const.ALLEGRO_DEPTH_SIZE, - egl.EGL_STENCIL_SIZE, Const.ALLEGRO_STENCIL_SIZE, - egl.EGL_SAMPLE_BUFFERS, Const.ALLEGRO_SAMPLE_BUFFERS, - egl.EGL_SAMPLES, Const.ALLEGRO_SAMPLES + egl.EGL_RED_SIZE, Const.A5O_RED_SIZE, + egl.EGL_GREEN_SIZE, Const.A5O_GREEN_SIZE, + egl.EGL_BLUE_SIZE, Const.A5O_BLUE_SIZE, + egl.EGL_ALPHA_SIZE, Const.A5O_ALPHA_SIZE, + egl.EGL_BUFFER_SIZE, Const.A5O_COLOR_SIZE, + egl.EGL_DEPTH_SIZE, Const.A5O_DEPTH_SIZE, + egl.EGL_STENCIL_SIZE, Const.A5O_STENCIL_SIZE, + egl.EGL_SAMPLE_BUFFERS, Const.A5O_SAMPLE_BUFFERS, + egl.EGL_SAMPLES, Const.A5O_SAMPLES }; } diff --git a/android/gradle_project/allegro/src/main/java/org/liballeg/android/Const.java b/android/gradle_project/allegro/src/main/java/org/liballeg/android/Const.java index 784d8e6273..199db82b2c 100644 --- a/android/gradle_project/allegro/src/main/java/org/liballeg/android/Const.java +++ b/android/gradle_project/allegro/src/main/java/org/liballeg/android/Const.java @@ -6,62 +6,62 @@ final class Const { /* color.h */ - static final int ALLEGRO_PIXEL_FORMAT_ABGR_8888 = 17; - static final int ALLEGRO_PIXEL_FORMAT_BGR_565 = 20; - static final int ALLEGRO_PIXEL_FORMAT_RGBA_4444 = 26; - static final int ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8 = 27; + static final int A5O_PIXEL_FORMAT_ABGR_8888 = 17; + static final int A5O_PIXEL_FORMAT_BGR_565 = 20; + static final int A5O_PIXEL_FORMAT_RGBA_4444 = 26; + static final int A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8 = 27; /* display.h */ - static final int ALLEGRO_RED_SIZE = 0; - static final int ALLEGRO_GREEN_SIZE = 1; - static final int ALLEGRO_BLUE_SIZE = 2; - static final int ALLEGRO_ALPHA_SIZE = 3; - static final int ALLEGRO_COLOR_SIZE = 14; - static final int ALLEGRO_DEPTH_SIZE = 15; - static final int ALLEGRO_STENCIL_SIZE = 16; - static final int ALLEGRO_SAMPLE_BUFFERS = 17; - static final int ALLEGRO_SAMPLES = 18; - - static final int ALLEGRO_DISPLAY_ORIENTATION_UNKNOWN = 0; - static final int ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES = 1; - static final int ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES = 2; - static final int ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES = 4; - static final int ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES = 8; - static final int ALLEGRO_DISPLAY_ORIENTATION_PORTRAIT = 5; - static final int ALLEGRO_DISPLAY_ORIENTATION_LANDSCAPE = 10; - static final int ALLEGRO_DISPLAY_ORIENTATION_ALL = 15; - static final int ALLEGRO_DISPLAY_ORIENTATION_FACE_UP = 16; - static final int ALLEGRO_DISPLAY_ORIENTATION_FACE_DOWN = 32; + static final int A5O_RED_SIZE = 0; + static final int A5O_GREEN_SIZE = 1; + static final int A5O_BLUE_SIZE = 2; + static final int A5O_ALPHA_SIZE = 3; + static final int A5O_COLOR_SIZE = 14; + static final int A5O_DEPTH_SIZE = 15; + static final int A5O_STENCIL_SIZE = 16; + static final int A5O_SAMPLE_BUFFERS = 17; + static final int A5O_SAMPLES = 18; + + static final int A5O_DISPLAY_ORIENTATION_UNKNOWN = 0; + static final int A5O_DISPLAY_ORIENTATION_0_DEGREES = 1; + static final int A5O_DISPLAY_ORIENTATION_90_DEGREES = 2; + static final int A5O_DISPLAY_ORIENTATION_180_DEGREES = 4; + static final int A5O_DISPLAY_ORIENTATION_270_DEGREES = 8; + static final int A5O_DISPLAY_ORIENTATION_PORTRAIT = 5; + static final int A5O_DISPLAY_ORIENTATION_LANDSCAPE = 10; + static final int A5O_DISPLAY_ORIENTATION_ALL = 15; + static final int A5O_DISPLAY_ORIENTATION_FACE_UP = 16; + static final int A5O_DISPLAY_ORIENTATION_FACE_DOWN = 32; /* events.h */ - static final int ALLEGRO_EVENT_TOUCH_BEGIN = 50; - static final int ALLEGRO_EVENT_TOUCH_END = 51; - static final int ALLEGRO_EVENT_TOUCH_MOVE = 52; - static final int ALLEGRO_EVENT_TOUCH_CANCEL = 53; + static final int A5O_EVENT_TOUCH_BEGIN = 50; + static final int A5O_EVENT_TOUCH_END = 51; + static final int A5O_EVENT_TOUCH_MOVE = 52; + static final int A5O_EVENT_TOUCH_CANCEL = 53; static int toAndroidOrientation(int alleg_orientation) { switch (alleg_orientation) { - case ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES: + case A5O_DISPLAY_ORIENTATION_0_DEGREES: return ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; - case ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES: + case A5O_DISPLAY_ORIENTATION_90_DEGREES: return ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE; - case ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES: + case A5O_DISPLAY_ORIENTATION_180_DEGREES: return ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; - case ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES: + case A5O_DISPLAY_ORIENTATION_270_DEGREES: return ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; - case ALLEGRO_DISPLAY_ORIENTATION_PORTRAIT: + case A5O_DISPLAY_ORIENTATION_PORTRAIT: return ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT; - case ALLEGRO_DISPLAY_ORIENTATION_LANDSCAPE: + case A5O_DISPLAY_ORIENTATION_LANDSCAPE: return ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE; - case ALLEGRO_DISPLAY_ORIENTATION_ALL: + case A5O_DISPLAY_ORIENTATION_ALL: return ActivityInfo.SCREEN_ORIENTATION_SENSOR; } @@ -72,10 +72,10 @@ static int toAllegroOrientation(int rotation) { switch (rotation) { case Surface.ROTATION_0: - return ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES; + return A5O_DISPLAY_ORIENTATION_0_DEGREES; case Surface.ROTATION_180: - return ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES; + return A5O_DISPLAY_ORIENTATION_180_DEGREES; /* Android device orientations are the opposite of Allegro ones. * Allegro orientations are the orientation of the device, with 0 @@ -87,13 +87,13 @@ static int toAllegroOrientation(int rotation) */ case Surface.ROTATION_90: - return ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES; + return A5O_DISPLAY_ORIENTATION_270_DEGREES; case Surface.ROTATION_270: - return ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES; + return A5O_DISPLAY_ORIENTATION_90_DEGREES; } - return ALLEGRO_DISPLAY_ORIENTATION_UNKNOWN; + return A5O_DISPLAY_ORIENTATION_UNKNOWN; } } diff --git a/android/gradle_project/allegro/src/main/java/org/liballeg/android/ImageLoader.java b/android/gradle_project/allegro/src/main/java/org/liballeg/android/ImageLoader.java index b53f631926..87a1999896 100644 --- a/android/gradle_project/allegro/src/main/java/org/liballeg/android/ImageLoader.java +++ b/android/gradle_project/allegro/src/main/java/org/liballeg/android/ImageLoader.java @@ -77,13 +77,13 @@ static int getBitmapFormat(Bitmap bitmap) { switch (bitmap.getConfig()) { case ALPHA_8: - return Const.ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8; // not really + return Const.A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8; // not really case ARGB_4444: - return Const.ALLEGRO_PIXEL_FORMAT_RGBA_4444; + return Const.A5O_PIXEL_FORMAT_RGBA_4444; case ARGB_8888: - return Const.ALLEGRO_PIXEL_FORMAT_ABGR_8888; + return Const.A5O_PIXEL_FORMAT_ABGR_8888; case RGB_565: - return Const.ALLEGRO_PIXEL_FORMAT_BGR_565; // untested + return Const.A5O_PIXEL_FORMAT_BGR_565; // untested default: assert(false); return -1; diff --git a/android/gradle_project/allegro/src/main/java/org/liballeg/android/Key.java b/android/gradle_project/allegro/src/main/java/org/liballeg/android/Key.java index ef276cf771..2d11dde05d 100644 --- a/android/gradle_project/allegro/src/main/java/org/liballeg/android/Key.java +++ b/android/gradle_project/allegro/src/main/java/org/liballeg/android/Key.java @@ -3,428 +3,428 @@ final class Key { /* keycodes.h */ - static final int ALLEGRO_KEY_A = 1; - static final int ALLEGRO_KEY_B = 2; - static final int ALLEGRO_KEY_C = 3; - static final int ALLEGRO_KEY_D = 4; - static final int ALLEGRO_KEY_E = 5; - static final int ALLEGRO_KEY_F = 6; - static final int ALLEGRO_KEY_G = 7; - static final int ALLEGRO_KEY_H = 8; - static final int ALLEGRO_KEY_I = 9; - static final int ALLEGRO_KEY_J = 10; - static final int ALLEGRO_KEY_K = 11; - static final int ALLEGRO_KEY_L = 12; - static final int ALLEGRO_KEY_M = 13; - static final int ALLEGRO_KEY_N = 14; - static final int ALLEGRO_KEY_O = 15; - static final int ALLEGRO_KEY_P = 16; - static final int ALLEGRO_KEY_Q = 17; - static final int ALLEGRO_KEY_R = 18; - static final int ALLEGRO_KEY_S = 19; - static final int ALLEGRO_KEY_T = 20; - static final int ALLEGRO_KEY_U = 21; - static final int ALLEGRO_KEY_V = 22; - static final int ALLEGRO_KEY_W = 23; - static final int ALLEGRO_KEY_X = 24; - static final int ALLEGRO_KEY_Y = 25; - static final int ALLEGRO_KEY_Z = 26; + static final int A5O_KEY_A = 1; + static final int A5O_KEY_B = 2; + static final int A5O_KEY_C = 3; + static final int A5O_KEY_D = 4; + static final int A5O_KEY_E = 5; + static final int A5O_KEY_F = 6; + static final int A5O_KEY_G = 7; + static final int A5O_KEY_H = 8; + static final int A5O_KEY_I = 9; + static final int A5O_KEY_J = 10; + static final int A5O_KEY_K = 11; + static final int A5O_KEY_L = 12; + static final int A5O_KEY_M = 13; + static final int A5O_KEY_N = 14; + static final int A5O_KEY_O = 15; + static final int A5O_KEY_P = 16; + static final int A5O_KEY_Q = 17; + static final int A5O_KEY_R = 18; + static final int A5O_KEY_S = 19; + static final int A5O_KEY_T = 20; + static final int A5O_KEY_U = 21; + static final int A5O_KEY_V = 22; + static final int A5O_KEY_W = 23; + static final int A5O_KEY_X = 24; + static final int A5O_KEY_Y = 25; + static final int A5O_KEY_Z = 26; - static final int ALLEGRO_KEY_0 = 27; - static final int ALLEGRO_KEY_1 = 28; - static final int ALLEGRO_KEY_2 = 29; - static final int ALLEGRO_KEY_3 = 30; - static final int ALLEGRO_KEY_4 = 31; - static final int ALLEGRO_KEY_5 = 32; - static final int ALLEGRO_KEY_6 = 33; - static final int ALLEGRO_KEY_7 = 34; - static final int ALLEGRO_KEY_8 = 35; - static final int ALLEGRO_KEY_9 = 36; + static final int A5O_KEY_0 = 27; + static final int A5O_KEY_1 = 28; + static final int A5O_KEY_2 = 29; + static final int A5O_KEY_3 = 30; + static final int A5O_KEY_4 = 31; + static final int A5O_KEY_5 = 32; + static final int A5O_KEY_6 = 33; + static final int A5O_KEY_7 = 34; + static final int A5O_KEY_8 = 35; + static final int A5O_KEY_9 = 36; - static final int ALLEGRO_KEY_PAD_0 = 37; - static final int ALLEGRO_KEY_PAD_1 = 38; - static final int ALLEGRO_KEY_PAD_2 = 39; - static final int ALLEGRO_KEY_PAD_3 = 40; - static final int ALLEGRO_KEY_PAD_4 = 41; - static final int ALLEGRO_KEY_PAD_5 = 42; - static final int ALLEGRO_KEY_PAD_6 = 43; - static final int ALLEGRO_KEY_PAD_7 = 44; - static final int ALLEGRO_KEY_PAD_8 = 45; - static final int ALLEGRO_KEY_PAD_9 = 46; + static final int A5O_KEY_PAD_0 = 37; + static final int A5O_KEY_PAD_1 = 38; + static final int A5O_KEY_PAD_2 = 39; + static final int A5O_KEY_PAD_3 = 40; + static final int A5O_KEY_PAD_4 = 41; + static final int A5O_KEY_PAD_5 = 42; + static final int A5O_KEY_PAD_6 = 43; + static final int A5O_KEY_PAD_7 = 44; + static final int A5O_KEY_PAD_8 = 45; + static final int A5O_KEY_PAD_9 = 46; - static final int ALLEGRO_KEY_F1 = 47; - static final int ALLEGRO_KEY_F2 = 48; - static final int ALLEGRO_KEY_F3 = 49; - static final int ALLEGRO_KEY_F4 = 50; - static final int ALLEGRO_KEY_F5 = 51; - static final int ALLEGRO_KEY_F6 = 52; - static final int ALLEGRO_KEY_F7 = 53; - static final int ALLEGRO_KEY_F8 = 54; - static final int ALLEGRO_KEY_F9 = 55; - static final int ALLEGRO_KEY_F10 = 56; - static final int ALLEGRO_KEY_F11 = 57; - static final int ALLEGRO_KEY_F12 = 58; + static final int A5O_KEY_F1 = 47; + static final int A5O_KEY_F2 = 48; + static final int A5O_KEY_F3 = 49; + static final int A5O_KEY_F4 = 50; + static final int A5O_KEY_F5 = 51; + static final int A5O_KEY_F6 = 52; + static final int A5O_KEY_F7 = 53; + static final int A5O_KEY_F8 = 54; + static final int A5O_KEY_F9 = 55; + static final int A5O_KEY_F10 = 56; + static final int A5O_KEY_F11 = 57; + static final int A5O_KEY_F12 = 58; - static final int ALLEGRO_KEY_ESCAPE = 59; - static final int ALLEGRO_KEY_TILDE = 60; - static final int ALLEGRO_KEY_MINUS = 61; - static final int ALLEGRO_KEY_EQUALS = 62; - static final int ALLEGRO_KEY_BACKSPACE = 63; - static final int ALLEGRO_KEY_TAB = 64; - static final int ALLEGRO_KEY_OPENBRACE = 65; - static final int ALLEGRO_KEY_CLOSEBRACE = 66; - static final int ALLEGRO_KEY_ENTER = 67; - static final int ALLEGRO_KEY_SEMICOLON = 68; - static final int ALLEGRO_KEY_QUOTE = 69; - static final int ALLEGRO_KEY_BACKSLASH = 70; - static final int ALLEGRO_KEY_BACKSLASH2 = 71; /* DirectInput calls this DIK_OEM_102: "< > | on UK/Germany keyboards" */ - static final int ALLEGRO_KEY_COMMA = 72; - static final int ALLEGRO_KEY_FULLSTOP = 73; - static final int ALLEGRO_KEY_SLASH = 74; - static final int ALLEGRO_KEY_SPACE = 75; + static final int A5O_KEY_ESCAPE = 59; + static final int A5O_KEY_TILDE = 60; + static final int A5O_KEY_MINUS = 61; + static final int A5O_KEY_EQUALS = 62; + static final int A5O_KEY_BACKSPACE = 63; + static final int A5O_KEY_TAB = 64; + static final int A5O_KEY_OPENBRACE = 65; + static final int A5O_KEY_CLOSEBRACE = 66; + static final int A5O_KEY_ENTER = 67; + static final int A5O_KEY_SEMICOLON = 68; + static final int A5O_KEY_QUOTE = 69; + static final int A5O_KEY_BACKSLASH = 70; + static final int A5O_KEY_BACKSLASH2 = 71; /* DirectInput calls this DIK_OEM_102: "< > | on UK/Germany keyboards" */ + static final int A5O_KEY_COMMA = 72; + static final int A5O_KEY_FULLSTOP = 73; + static final int A5O_KEY_SLASH = 74; + static final int A5O_KEY_SPACE = 75; - static final int ALLEGRO_KEY_INSERT = 76; - static final int ALLEGRO_KEY_DELETE = 77; - static final int ALLEGRO_KEY_HOME = 78; - static final int ALLEGRO_KEY_END = 79; - static final int ALLEGRO_KEY_PGUP = 80; - static final int ALLEGRO_KEY_PGDN = 81; - static final int ALLEGRO_KEY_LEFT = 82; - static final int ALLEGRO_KEY_RIGHT = 83; - static final int ALLEGRO_KEY_UP = 84; - static final int ALLEGRO_KEY_DOWN = 85; + static final int A5O_KEY_INSERT = 76; + static final int A5O_KEY_DELETE = 77; + static final int A5O_KEY_HOME = 78; + static final int A5O_KEY_END = 79; + static final int A5O_KEY_PGUP = 80; + static final int A5O_KEY_PGDN = 81; + static final int A5O_KEY_LEFT = 82; + static final int A5O_KEY_RIGHT = 83; + static final int A5O_KEY_UP = 84; + static final int A5O_KEY_DOWN = 85; - static final int ALLEGRO_KEY_PAD_SLASH = 86; - static final int ALLEGRO_KEY_PAD_ASTERISK= 87; - static final int ALLEGRO_KEY_PAD_MINUS = 88; - static final int ALLEGRO_KEY_PAD_PLUS = 89; - static final int ALLEGRO_KEY_PAD_DELETE = 90; - static final int ALLEGRO_KEY_PAD_ENTER = 91; + static final int A5O_KEY_PAD_SLASH = 86; + static final int A5O_KEY_PAD_ASTERISK= 87; + static final int A5O_KEY_PAD_MINUS = 88; + static final int A5O_KEY_PAD_PLUS = 89; + static final int A5O_KEY_PAD_DELETE = 90; + static final int A5O_KEY_PAD_ENTER = 91; - static final int ALLEGRO_KEY_PRINTSCREEN = 92; - static final int ALLEGRO_KEY_PAUSE = 93; + static final int A5O_KEY_PRINTSCREEN = 92; + static final int A5O_KEY_PAUSE = 93; - static final int ALLEGRO_KEY_ABNT_C1 = 94; - static final int ALLEGRO_KEY_YEN = 95; - static final int ALLEGRO_KEY_KANA = 96; - static final int ALLEGRO_KEY_CONVERT = 97; - static final int ALLEGRO_KEY_NOCONVERT = 98; - static final int ALLEGRO_KEY_AT = 99; - static final int ALLEGRO_KEY_CIRCUMFLEX = 100; - static final int ALLEGRO_KEY_COLON2 = 101; - static final int ALLEGRO_KEY_KANJI = 102; + static final int A5O_KEY_ABNT_C1 = 94; + static final int A5O_KEY_YEN = 95; + static final int A5O_KEY_KANA = 96; + static final int A5O_KEY_CONVERT = 97; + static final int A5O_KEY_NOCONVERT = 98; + static final int A5O_KEY_AT = 99; + static final int A5O_KEY_CIRCUMFLEX = 100; + static final int A5O_KEY_COLON2 = 101; + static final int A5O_KEY_KANJI = 102; - static final int ALLEGRO_KEY_PAD_EQUALS = 103; /* MacOS X */ - static final int ALLEGRO_KEY_BACKQUOTE = 104; /* MacOS X */ - static final int ALLEGRO_KEY_SEMICOLON2 = 105; /* MacOS X -- TODO: ask lillo what this should be */ - static final int ALLEGRO_KEY_COMMAND = 106; /* MacOS X */ - static final int ALLEGRO_KEY_BACK = 107; - static final int ALLEGRO_KEY_VOLUME_UP = 108; - static final int ALLEGRO_KEY_VOLUME_DOWN = 109; + static final int A5O_KEY_PAD_EQUALS = 103; /* MacOS X */ + static final int A5O_KEY_BACKQUOTE = 104; /* MacOS X */ + static final int A5O_KEY_SEMICOLON2 = 105; /* MacOS X -- TODO: ask lillo what this should be */ + static final int A5O_KEY_COMMAND = 106; /* MacOS X */ + static final int A5O_KEY_BACK = 107; + static final int A5O_KEY_VOLUME_UP = 108; + static final int A5O_KEY_VOLUME_DOWN = 109; /* Some more standard Android keys. * These happen to be the ones used by the Xperia Play. */ - static final int ALLEGRO_KEY_SEARCH = 110; - static final int ALLEGRO_KEY_DPAD_CENTER = 111; - static final int ALLEGRO_KEY_BUTTON_X = 112; - static final int ALLEGRO_KEY_BUTTON_Y = 113; - static final int ALLEGRO_KEY_DPAD_UP = 114; - static final int ALLEGRO_KEY_DPAD_DOWN = 115; - static final int ALLEGRO_KEY_DPAD_LEFT = 116; - static final int ALLEGRO_KEY_DPAD_RIGHT = 117; - static final int ALLEGRO_KEY_SELECT = 118; - static final int ALLEGRO_KEY_START = 119; - static final int ALLEGRO_KEY_BUTTON_L1 = 120; - static final int ALLEGRO_KEY_BUTTON_R1 = 121; - static final int ALLEGRO_KEY_BUTTON_L2 = 122; - static final int ALLEGRO_KEY_BUTTON_R2 = 123; - static final int ALLEGRO_KEY_BUTTON_A = 124; - static final int ALLEGRO_KEY_BUTTON_B = 125; - static final int ALLEGRO_KEY_THUMBL = 126; - static final int ALLEGRO_KEY_THUMBR = 127; + static final int A5O_KEY_SEARCH = 110; + static final int A5O_KEY_DPAD_CENTER = 111; + static final int A5O_KEY_BUTTON_X = 112; + static final int A5O_KEY_BUTTON_Y = 113; + static final int A5O_KEY_DPAD_UP = 114; + static final int A5O_KEY_DPAD_DOWN = 115; + static final int A5O_KEY_DPAD_LEFT = 116; + static final int A5O_KEY_DPAD_RIGHT = 117; + static final int A5O_KEY_SELECT = 118; + static final int A5O_KEY_START = 119; + static final int A5O_KEY_BUTTON_L1 = 120; + static final int A5O_KEY_BUTTON_R1 = 121; + static final int A5O_KEY_BUTTON_L2 = 122; + static final int A5O_KEY_BUTTON_R2 = 123; + static final int A5O_KEY_BUTTON_A = 124; + static final int A5O_KEY_BUTTON_B = 125; + static final int A5O_KEY_THUMBL = 126; + static final int A5O_KEY_THUMBR = 127; - static final int ALLEGRO_KEY_UNKNOWN = 128; + static final int A5O_KEY_UNKNOWN = 128; - /* All codes up to before ALLEGRO_KEY_MODIFIERS can be freely + /* All codes up to before A5O_KEY_MODIFIERS can be freely * assigned as additional unknown keys, like various multimedia * and application keys keyboards may have. */ - static final int ALLEGRO_KEY_MODIFIERS = 215; + static final int A5O_KEY_MODIFIERS = 215; - static final int ALLEGRO_KEY_LSHIFT = 215; - static final int ALLEGRO_KEY_RSHIFT = 216; - static final int ALLEGRO_KEY_LCTRL = 217; - static final int ALLEGRO_KEY_RCTRL = 218; - static final int ALLEGRO_KEY_ALT = 219; - static final int ALLEGRO_KEY_ALTGR = 220; - static final int ALLEGRO_KEY_LWIN = 221; - static final int ALLEGRO_KEY_RWIN = 222; - static final int ALLEGRO_KEY_MENU = 223; - static final int ALLEGRO_KEY_SCROLLLOCK = 224; - static final int ALLEGRO_KEY_NUMLOCK = 225; - static final int ALLEGRO_KEY_CAPSLOCK = 226; + static final int A5O_KEY_LSHIFT = 215; + static final int A5O_KEY_RSHIFT = 216; + static final int A5O_KEY_LCTRL = 217; + static final int A5O_KEY_RCTRL = 218; + static final int A5O_KEY_ALT = 219; + static final int A5O_KEY_ALTGR = 220; + static final int A5O_KEY_LWIN = 221; + static final int A5O_KEY_RWIN = 222; + static final int A5O_KEY_MENU = 223; + static final int A5O_KEY_SCROLLLOCK = 224; + static final int A5O_KEY_NUMLOCK = 225; + static final int A5O_KEY_CAPSLOCK = 226; - static final int ALLEGRO_KEY_MAX = 227; + static final int A5O_KEY_MAX = 227; protected static int[] keyMap = { - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_UNKNOWN - ALLEGRO_KEY_LEFT, // KeyEvent.KEYCODE_SOFT_LEFT - ALLEGRO_KEY_RIGHT, // KeyEvent.KEYCODE_SOFT_RIGHT - ALLEGRO_KEY_HOME, // KeyEvent.KEYCODE_HOME - ALLEGRO_KEY_BACK, // KeyEvent.KEYCODE_BACK - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_CALL - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ENDCALL - ALLEGRO_KEY_0, // KeyEvent.KEYCODE_0 - ALLEGRO_KEY_1, // KeyEvent.KEYCODE_1 - ALLEGRO_KEY_2, // KeyEvent.KEYCODE_2 - ALLEGRO_KEY_3, // KeyEvent.KEYCODE_3 - ALLEGRO_KEY_4, // KeyEvent.KEYCODE_4 - ALLEGRO_KEY_5, // KeyEvent.KEYCODE_5 - ALLEGRO_KEY_6, // KeyEvent.KEYCODE_6 - ALLEGRO_KEY_7, // KeyEvent.KEYCODE_7 - ALLEGRO_KEY_8, // KeyEvent.KEYCODE_8 - ALLEGRO_KEY_9, // KeyEvent.KEYCODE_9 - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_STAR - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_POUND - ALLEGRO_KEY_UP, // KeyEvent.KEYCODE_DPAD_UP - ALLEGRO_KEY_DOWN, // KeyEvent.KEYCODE_DPAD_DOWN - ALLEGRO_KEY_LEFT, // KeyEvent.KEYCODE_DPAD_LEFT - ALLEGRO_KEY_RIGHT, // KeyEvent.KEYCODE_DPAD_RIGHT - ALLEGRO_KEY_ENTER, // KeyEvent.KEYCODE_DPAD_CENTER - ALLEGRO_KEY_VOLUME_UP, // KeyEvent.KEYCODE_VOLUME_UP - ALLEGRO_KEY_VOLUME_DOWN, // KeyEvent.KEYCODE_VOLUME_DOWN - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_POWER - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_CAMERA - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_CLEAR - ALLEGRO_KEY_A, // KeyEvent.KEYCODE_A - ALLEGRO_KEY_B, // KeyEvent.KEYCODE_B - ALLEGRO_KEY_C, // KeyEvent.KEYCODE_B - ALLEGRO_KEY_D, // KeyEvent.KEYCODE_D - ALLEGRO_KEY_E, // KeyEvent.KEYCODE_E - ALLEGRO_KEY_F, // KeyEvent.KEYCODE_F - ALLEGRO_KEY_G, // KeyEvent.KEYCODE_G - ALLEGRO_KEY_H, // KeyEvent.KEYCODE_H - ALLEGRO_KEY_I, // KeyEvent.KEYCODE_I - ALLEGRO_KEY_J, // KeyEvent.KEYCODE_J - ALLEGRO_KEY_K, // KeyEvent.KEYCODE_K - ALLEGRO_KEY_L, // KeyEvent.KEYCODE_L - ALLEGRO_KEY_M, // KeyEvent.KEYCODE_M - ALLEGRO_KEY_N, // KeyEvent.KEYCODE_N - ALLEGRO_KEY_O, // KeyEvent.KEYCODE_O - ALLEGRO_KEY_P, // KeyEvent.KEYCODE_P - ALLEGRO_KEY_Q, // KeyEvent.KEYCODE_Q - ALLEGRO_KEY_R, // KeyEvent.KEYCODE_R - ALLEGRO_KEY_S, // KeyEvent.KEYCODE_S - ALLEGRO_KEY_T, // KeyEvent.KEYCODE_T - ALLEGRO_KEY_U, // KeyEvent.KEYCODE_U - ALLEGRO_KEY_V, // KeyEvent.KEYCODE_V - ALLEGRO_KEY_W, // KeyEvent.KEYCODE_W - ALLEGRO_KEY_X, // KeyEvent.KEYCODE_X - ALLEGRO_KEY_Y, // KeyEvent.KEYCODE_Y - ALLEGRO_KEY_Z, // KeyEvent.KEYCODE_Z - ALLEGRO_KEY_COMMA, // KeyEvent.KEYCODE_COMMA - ALLEGRO_KEY_FULLSTOP, // KeyEvent.KEYCODE_PERIOD - ALLEGRO_KEY_ALT, // KeyEvent.KEYCODE_ALT_LEFT - ALLEGRO_KEY_ALTGR, // KeyEvent.KEYCODE_ALT_RIGHT - ALLEGRO_KEY_LSHIFT, // KeyEvent.KEYCODE_SHIFT_LEFT - ALLEGRO_KEY_RSHIFT, // KeyEvent.KEYCODE_SHIFT_RIGHT - ALLEGRO_KEY_TAB, // KeyEvent.KEYCODE_TAB - ALLEGRO_KEY_SPACE, // KeyEvent.KEYCODE_SPACE - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_SYM - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_EXPLORER - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ENVELOPE - ALLEGRO_KEY_ENTER, // KeyEvent.KEYCODE_ENTER - ALLEGRO_KEY_BACKSPACE, // KeyEvent.KEYCODE_DEL - ALLEGRO_KEY_TILDE, // KeyEvent.KEYCODE_GRAVE - ALLEGRO_KEY_MINUS, // KeyEvent.KEYCODE_MINUS - ALLEGRO_KEY_EQUALS, // KeyEvent.KEYCODE_EQUALS - ALLEGRO_KEY_OPENBRACE, // KeyEvent.KEYCODE_LEFT_BRACKET - ALLEGRO_KEY_CLOSEBRACE, // KeyEvent.KEYCODE_RIGHT_BRACKET - ALLEGRO_KEY_BACKSLASH, // KeyEvent.KEYCODE_BACKSLASH - ALLEGRO_KEY_SEMICOLON, // KeyEvent.KEYCODE_SEMICOLON - ALLEGRO_KEY_QUOTE, // KeyEvent.KEYCODE_APOSTROPHY - ALLEGRO_KEY_SLASH, // KeyEvent.KEYCODE_SLASH - ALLEGRO_KEY_AT, // KeyEvent.KEYCODE_AT - ALLEGRO_KEY_NUMLOCK, // KeyEvent.KEYCODE_NUM - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_HEADSETHOOK - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_FOCUS - ALLEGRO_KEY_PAD_PLUS, // KeyEvent.KEYCODE_PLUS - ALLEGRO_KEY_MENU, // KeyEvent.KEYCODE_MENU - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_NOTIFICATION - ALLEGRO_KEY_SEARCH, // KeyEvent.KEYCODE_SEARCH - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_MEDIA_STOP - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_MEDIA_NEXT - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_MEDIA_PREVIOUS - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_MEDIA_REWIND - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_MEDIA_FAST_FORWARD - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_MUTE - ALLEGRO_KEY_PGUP, // KeyEvent.KEYCODE_PAGE_UP - ALLEGRO_KEY_PGDN, // KeyEvent.KEYCODE_PAGE_DOWN - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_PICTSYMBOLS - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_SWITCH_CHARSET - ALLEGRO_KEY_BUTTON_A, // KeyEvent.KEYCODE_BUTTON_A - ALLEGRO_KEY_BUTTON_B, // KeyEvent.KEYCODE_BUTTON_B - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_BUTTON_C - ALLEGRO_KEY_BUTTON_X, // KeyEvent.KEYCODE_BUTTON_X - ALLEGRO_KEY_BUTTON_Y, // KeyEvent.KEYCODE_BUTTON_Y - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_BUTTON_Z - ALLEGRO_KEY_BUTTON_L1, // KeyEvent.KEYCODE_BUTTON_L1 - ALLEGRO_KEY_BUTTON_R1, // KeyEvent.KEYCODE_BUTTON_R1 - ALLEGRO_KEY_BUTTON_L2, // KeyEvent.KEYCODE_BUTTON_L2 - ALLEGRO_KEY_BUTTON_R2, // KeyEvent.KEYCODE_BUTTON_R2 - ALLEGRO_KEY_THUMBL, // KeyEvent.KEYCODE_BUTTON_THUMBL - ALLEGRO_KEY_THUMBR, // KeyEvent.KEYCODE_BUTTON_THUMBR - ALLEGRO_KEY_START, // KeyEvent.KEYCODE_BUTTON_START - ALLEGRO_KEY_SELECT, // KeyEvent.KEYCODE_BUTTON_SELECT - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_BUTTON_MODE - ALLEGRO_KEY_ESCAPE, // KeyEvent.KEYCODE_ESCAPE (111) - ALLEGRO_KEY_DELETE, // KeyEvent.KEYCODE_FORWARD_DELETE (112) - ALLEGRO_KEY_LCTRL, // KeyEvent.KEYCODE_CTRL_LEFT (113) - ALLEGRO_KEY_RCTRL, // KeyEvent.KEYCODE_CONTROL_RIGHT (114) - ALLEGRO_KEY_CAPSLOCK, // KeyEvent.KEYCODE_CAPS_LOCK (115) - ALLEGRO_KEY_SCROLLLOCK, // KeyEvent.KEYCODE_SCROLL_LOCK (116) - ALLEGRO_KEY_LWIN, // KeyEvent.KEYCODE_META_LEFT (117) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (118) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (119) - ALLEGRO_KEY_PRINTSCREEN, // KeyEvent.KEYCODE_SYSRQ (120) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (121) - ALLEGRO_KEY_HOME, // KeyEvent.KEYCODE_MOVE_HOME (122) - ALLEGRO_KEY_END, // KeyEvent.KEYCODE_MOVE_END (123) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (124) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (125) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (126) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (127) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (128) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (129) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (130) - ALLEGRO_KEY_F1, // KeyEvent.KEYCODE_ (131) - ALLEGRO_KEY_F2, // KeyEvent.KEYCODE_ (132) - ALLEGRO_KEY_F3, // KeyEvent.KEYCODE_ (133) - ALLEGRO_KEY_F4, // KeyEvent.KEYCODE_ (134) - ALLEGRO_KEY_F5, // KeyEvent.KEYCODE_ (135) - ALLEGRO_KEY_F6, // KeyEvent.KEYCODE_ (136) - ALLEGRO_KEY_F7, // KeyEvent.KEYCODE_ (137) - ALLEGRO_KEY_F8, // KeyEvent.KEYCODE_ (138) - ALLEGRO_KEY_F9, // KeyEvent.KEYCODE_ (139) - ALLEGRO_KEY_F10, // KeyEvent.KEYCODE_ (140) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (141) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (142) - ALLEGRO_KEY_NUMLOCK, // KeyEvent.KEYCODE_NUM_LOCK (143) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (144) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (145) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (146) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (147) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (148) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (149) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (150) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (151) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (152) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (153) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (154) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (155) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (156) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (157) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (158) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (159) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (160) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (161) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (162) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (163) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (164) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (165) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (166) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (167) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (168) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (169) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (170) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (171) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (172) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (173) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (174) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (175) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (176) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (177) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (178) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (179) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (180) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (181) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (182) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (183) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (184) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (185) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (186) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (187) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (188) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (189) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (190) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (191) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (192) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (193) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (194) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (195) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (196) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (197) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (198) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (199) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (200) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (201) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (202) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (203) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (204) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (205) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (206) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (207) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (208) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (209) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (210) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (211) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (212) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (213) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (214) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (215) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (216) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (217) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (218) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (219) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (220) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (221) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (222) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (223) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (224) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (225) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (226) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (227) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (228) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (229) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (230) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (231) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (232) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (233) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (234) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (235) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (236) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (237) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (238) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (239) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (240) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (241) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (242) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (243) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (244) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (245) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (246) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (247) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (248) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (249) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (250) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (251) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (252) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (253) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (254) - ALLEGRO_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (255) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_UNKNOWN + A5O_KEY_LEFT, // KeyEvent.KEYCODE_SOFT_LEFT + A5O_KEY_RIGHT, // KeyEvent.KEYCODE_SOFT_RIGHT + A5O_KEY_HOME, // KeyEvent.KEYCODE_HOME + A5O_KEY_BACK, // KeyEvent.KEYCODE_BACK + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_CALL + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ENDCALL + A5O_KEY_0, // KeyEvent.KEYCODE_0 + A5O_KEY_1, // KeyEvent.KEYCODE_1 + A5O_KEY_2, // KeyEvent.KEYCODE_2 + A5O_KEY_3, // KeyEvent.KEYCODE_3 + A5O_KEY_4, // KeyEvent.KEYCODE_4 + A5O_KEY_5, // KeyEvent.KEYCODE_5 + A5O_KEY_6, // KeyEvent.KEYCODE_6 + A5O_KEY_7, // KeyEvent.KEYCODE_7 + A5O_KEY_8, // KeyEvent.KEYCODE_8 + A5O_KEY_9, // KeyEvent.KEYCODE_9 + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_STAR + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_POUND + A5O_KEY_UP, // KeyEvent.KEYCODE_DPAD_UP + A5O_KEY_DOWN, // KeyEvent.KEYCODE_DPAD_DOWN + A5O_KEY_LEFT, // KeyEvent.KEYCODE_DPAD_LEFT + A5O_KEY_RIGHT, // KeyEvent.KEYCODE_DPAD_RIGHT + A5O_KEY_ENTER, // KeyEvent.KEYCODE_DPAD_CENTER + A5O_KEY_VOLUME_UP, // KeyEvent.KEYCODE_VOLUME_UP + A5O_KEY_VOLUME_DOWN, // KeyEvent.KEYCODE_VOLUME_DOWN + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_POWER + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_CAMERA + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_CLEAR + A5O_KEY_A, // KeyEvent.KEYCODE_A + A5O_KEY_B, // KeyEvent.KEYCODE_B + A5O_KEY_C, // KeyEvent.KEYCODE_B + A5O_KEY_D, // KeyEvent.KEYCODE_D + A5O_KEY_E, // KeyEvent.KEYCODE_E + A5O_KEY_F, // KeyEvent.KEYCODE_F + A5O_KEY_G, // KeyEvent.KEYCODE_G + A5O_KEY_H, // KeyEvent.KEYCODE_H + A5O_KEY_I, // KeyEvent.KEYCODE_I + A5O_KEY_J, // KeyEvent.KEYCODE_J + A5O_KEY_K, // KeyEvent.KEYCODE_K + A5O_KEY_L, // KeyEvent.KEYCODE_L + A5O_KEY_M, // KeyEvent.KEYCODE_M + A5O_KEY_N, // KeyEvent.KEYCODE_N + A5O_KEY_O, // KeyEvent.KEYCODE_O + A5O_KEY_P, // KeyEvent.KEYCODE_P + A5O_KEY_Q, // KeyEvent.KEYCODE_Q + A5O_KEY_R, // KeyEvent.KEYCODE_R + A5O_KEY_S, // KeyEvent.KEYCODE_S + A5O_KEY_T, // KeyEvent.KEYCODE_T + A5O_KEY_U, // KeyEvent.KEYCODE_U + A5O_KEY_V, // KeyEvent.KEYCODE_V + A5O_KEY_W, // KeyEvent.KEYCODE_W + A5O_KEY_X, // KeyEvent.KEYCODE_X + A5O_KEY_Y, // KeyEvent.KEYCODE_Y + A5O_KEY_Z, // KeyEvent.KEYCODE_Z + A5O_KEY_COMMA, // KeyEvent.KEYCODE_COMMA + A5O_KEY_FULLSTOP, // KeyEvent.KEYCODE_PERIOD + A5O_KEY_ALT, // KeyEvent.KEYCODE_ALT_LEFT + A5O_KEY_ALTGR, // KeyEvent.KEYCODE_ALT_RIGHT + A5O_KEY_LSHIFT, // KeyEvent.KEYCODE_SHIFT_LEFT + A5O_KEY_RSHIFT, // KeyEvent.KEYCODE_SHIFT_RIGHT + A5O_KEY_TAB, // KeyEvent.KEYCODE_TAB + A5O_KEY_SPACE, // KeyEvent.KEYCODE_SPACE + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_SYM + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_EXPLORER + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ENVELOPE + A5O_KEY_ENTER, // KeyEvent.KEYCODE_ENTER + A5O_KEY_BACKSPACE, // KeyEvent.KEYCODE_DEL + A5O_KEY_TILDE, // KeyEvent.KEYCODE_GRAVE + A5O_KEY_MINUS, // KeyEvent.KEYCODE_MINUS + A5O_KEY_EQUALS, // KeyEvent.KEYCODE_EQUALS + A5O_KEY_OPENBRACE, // KeyEvent.KEYCODE_LEFT_BRACKET + A5O_KEY_CLOSEBRACE, // KeyEvent.KEYCODE_RIGHT_BRACKET + A5O_KEY_BACKSLASH, // KeyEvent.KEYCODE_BACKSLASH + A5O_KEY_SEMICOLON, // KeyEvent.KEYCODE_SEMICOLON + A5O_KEY_QUOTE, // KeyEvent.KEYCODE_APOSTROPHY + A5O_KEY_SLASH, // KeyEvent.KEYCODE_SLASH + A5O_KEY_AT, // KeyEvent.KEYCODE_AT + A5O_KEY_NUMLOCK, // KeyEvent.KEYCODE_NUM + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_HEADSETHOOK + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_FOCUS + A5O_KEY_PAD_PLUS, // KeyEvent.KEYCODE_PLUS + A5O_KEY_MENU, // KeyEvent.KEYCODE_MENU + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_NOTIFICATION + A5O_KEY_SEARCH, // KeyEvent.KEYCODE_SEARCH + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_MEDIA_STOP + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_MEDIA_NEXT + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_MEDIA_PREVIOUS + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_MEDIA_REWIND + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_MEDIA_FAST_FORWARD + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_MUTE + A5O_KEY_PGUP, // KeyEvent.KEYCODE_PAGE_UP + A5O_KEY_PGDN, // KeyEvent.KEYCODE_PAGE_DOWN + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_PICTSYMBOLS + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_SWITCH_CHARSET + A5O_KEY_BUTTON_A, // KeyEvent.KEYCODE_BUTTON_A + A5O_KEY_BUTTON_B, // KeyEvent.KEYCODE_BUTTON_B + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_BUTTON_C + A5O_KEY_BUTTON_X, // KeyEvent.KEYCODE_BUTTON_X + A5O_KEY_BUTTON_Y, // KeyEvent.KEYCODE_BUTTON_Y + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_BUTTON_Z + A5O_KEY_BUTTON_L1, // KeyEvent.KEYCODE_BUTTON_L1 + A5O_KEY_BUTTON_R1, // KeyEvent.KEYCODE_BUTTON_R1 + A5O_KEY_BUTTON_L2, // KeyEvent.KEYCODE_BUTTON_L2 + A5O_KEY_BUTTON_R2, // KeyEvent.KEYCODE_BUTTON_R2 + A5O_KEY_THUMBL, // KeyEvent.KEYCODE_BUTTON_THUMBL + A5O_KEY_THUMBR, // KeyEvent.KEYCODE_BUTTON_THUMBR + A5O_KEY_START, // KeyEvent.KEYCODE_BUTTON_START + A5O_KEY_SELECT, // KeyEvent.KEYCODE_BUTTON_SELECT + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_BUTTON_MODE + A5O_KEY_ESCAPE, // KeyEvent.KEYCODE_ESCAPE (111) + A5O_KEY_DELETE, // KeyEvent.KEYCODE_FORWARD_DELETE (112) + A5O_KEY_LCTRL, // KeyEvent.KEYCODE_CTRL_LEFT (113) + A5O_KEY_RCTRL, // KeyEvent.KEYCODE_CONTROL_RIGHT (114) + A5O_KEY_CAPSLOCK, // KeyEvent.KEYCODE_CAPS_LOCK (115) + A5O_KEY_SCROLLLOCK, // KeyEvent.KEYCODE_SCROLL_LOCK (116) + A5O_KEY_LWIN, // KeyEvent.KEYCODE_META_LEFT (117) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (118) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (119) + A5O_KEY_PRINTSCREEN, // KeyEvent.KEYCODE_SYSRQ (120) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (121) + A5O_KEY_HOME, // KeyEvent.KEYCODE_MOVE_HOME (122) + A5O_KEY_END, // KeyEvent.KEYCODE_MOVE_END (123) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (124) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (125) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (126) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (127) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (128) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (129) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (130) + A5O_KEY_F1, // KeyEvent.KEYCODE_ (131) + A5O_KEY_F2, // KeyEvent.KEYCODE_ (132) + A5O_KEY_F3, // KeyEvent.KEYCODE_ (133) + A5O_KEY_F4, // KeyEvent.KEYCODE_ (134) + A5O_KEY_F5, // KeyEvent.KEYCODE_ (135) + A5O_KEY_F6, // KeyEvent.KEYCODE_ (136) + A5O_KEY_F7, // KeyEvent.KEYCODE_ (137) + A5O_KEY_F8, // KeyEvent.KEYCODE_ (138) + A5O_KEY_F9, // KeyEvent.KEYCODE_ (139) + A5O_KEY_F10, // KeyEvent.KEYCODE_ (140) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (141) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (142) + A5O_KEY_NUMLOCK, // KeyEvent.KEYCODE_NUM_LOCK (143) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (144) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (145) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (146) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (147) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (148) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (149) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (150) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (151) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (152) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (153) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (154) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (155) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (156) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (157) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (158) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (159) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (160) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (161) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (162) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (163) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (164) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (165) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (166) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (167) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (168) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (169) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (170) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (171) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (172) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (173) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (174) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (175) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (176) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (177) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (178) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (179) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (180) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (181) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (182) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (183) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (184) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (185) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (186) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (187) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (188) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (189) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (190) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (191) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (192) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (193) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (194) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (195) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (196) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (197) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (198) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (199) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (200) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (201) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (202) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (203) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (204) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (205) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (206) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (207) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (208) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (209) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (210) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (211) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (212) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (213) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (214) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (215) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (216) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (217) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (218) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (219) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (220) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (221) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (222) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (223) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (224) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (225) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (226) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (227) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (228) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (229) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (230) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (231) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (232) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (233) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (234) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (235) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (236) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (237) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (238) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (239) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (240) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (241) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (242) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (243) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (244) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (245) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (246) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (247) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (248) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (249) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (250) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (251) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (252) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (253) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (254) + A5O_KEY_UNKNOWN, // KeyEvent.KEYCODE_ (255) }; /* Return Allegro key code for Android key code. */ @@ -432,7 +432,7 @@ static int alKey(int keyCode) { if (keyCode < keyMap.length) return keyMap[keyCode]; else - return ALLEGRO_KEY_UNKNOWN; + return A5O_KEY_UNKNOWN; } } diff --git a/android/gradle_project/allegro/src/main/java/org/liballeg/android/KeyListener.java b/android/gradle_project/allegro/src/main/java/org/liballeg/android/KeyListener.java index 78daf6b667..0d981ba1ef 100644 --- a/android/gradle_project/allegro/src/main/java/org/liballeg/android/KeyListener.java +++ b/android/gradle_project/allegro/src/main/java/org/liballeg/android/KeyListener.java @@ -42,10 +42,10 @@ else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) { return true; } } - if (Key.alKey(keyCode) == Key.ALLEGRO_KEY_BACKSPACE) { + if (Key.alKey(keyCode) == Key.A5O_KEY_BACKSPACE) { unichar = '\b'; } - else if (Key.alKey(keyCode) == Key.ALLEGRO_KEY_ENTER) { + else if (Key.alKey(keyCode) == Key.A5O_KEY_ENTER) { unichar = '\r'; } else { diff --git a/android/gradle_project/allegro/src/main/java/org/liballeg/android/TouchListener.java b/android/gradle_project/allegro/src/main/java/org/liballeg/android/TouchListener.java index c6f061b968..98056ad829 100644 --- a/android/gradle_project/allegro/src/main/java/org/liballeg/android/TouchListener.java +++ b/android/gradle_project/allegro/src/main/java/org/liballeg/android/TouchListener.java @@ -54,28 +54,28 @@ public boolean onTouch(View v, MotionEvent event) if (action == MotionEvent.ACTION_DOWN) { primary = true; - action = Const.ALLEGRO_EVENT_TOUCH_BEGIN; + action = Const.A5O_EVENT_TOUCH_BEGIN; } else if (action == MotionEvent.ACTION_UP) { primary = true; - action = Const.ALLEGRO_EVENT_TOUCH_END; + action = Const.A5O_EVENT_TOUCH_END; } else if (action == MotionEvent.ACTION_MOVE) { - action = Const.ALLEGRO_EVENT_TOUCH_MOVE; + action = Const.A5O_EVENT_TOUCH_MOVE; } else if (action == MotionEvent.ACTION_CANCEL) { - action = Const.ALLEGRO_EVENT_TOUCH_CANCEL; + action = Const.A5O_EVENT_TOUCH_CANCEL; } // android-5 / 2.0 else if (Reflect.fieldExists(event, "ACTION_POINTER_DOWN") && action == Reflect.getField(event, "ACTION_POINTER_DOWN")) { - action = Const.ALLEGRO_EVENT_TOUCH_BEGIN; + action = Const.A5O_EVENT_TOUCH_BEGIN; } else if (Reflect.fieldExists(event, "ACTION_POINTER_UP") && action == Reflect.getField(event, "ACTION_POINTER_UP")) { - action = Const.ALLEGRO_EVENT_TOUCH_END; + action = Const.A5O_EVENT_TOUCH_END; } else { Log.v(TAG, "unknown MotionEvent type: " + action); @@ -99,7 +99,7 @@ else if (Reflect.fieldExists(event, "ACTION_POINTER_UP") && if (id == pointer_id) { nativeOnTouch(id, action, x, y, primary); } else { - nativeOnTouch(id, Const.ALLEGRO_EVENT_TOUCH_MOVE, x, y, + nativeOnTouch(id, Const.A5O_EVENT_TOUCH_MOVE, x, y, primary); } } diff --git a/cmake/AllegroConfig.cmake.in b/cmake/AllegroConfig.cmake.in index 162f330caf..985e18ce95 100644 --- a/cmake/AllegroConfig.cmake.in +++ b/cmake/AllegroConfig.cmake.in @@ -3,22 +3,22 @@ # @PACKAGE_INIT@ -set(ALLEGRO_PKG_BUGREPORT "@PROJECT_HOMEPAGE_URL@/issues") +set(A5O_PKG_BUGREPORT "@PROJECT_HOMEPAGE_URL@/issues") # Allegro Targets -set(ALLEGRO_PKG_TARGETS "@ALLEGRO_TARGETS@") +set(A5O_PKG_TARGETS "@A5O_TARGETS@") # Allegro Package Version -set(ALLEGRO_PKG_VERSION_MAJOR @PROJECT_VERSION_MAJOR@) -set(ALLEGRO_PKG_VERSION_MINOR @PROJECT_VERSION_MINOR@) -set(ALLEGRO_PKG_VERSION_PATCH @PROJECT_VERSION_PATCH@) -set(ALLEGRO_PKG_VERSION @PROJECT_VERSION@) +set(A5O_PKG_VERSION_MAJOR @PROJECT_VERSION_MAJOR@) +set(A5O_PKG_VERSION_MINOR @PROJECT_VERSION_MINOR@) +set(A5O_PKG_VERSION_PATCH @PROJECT_VERSION_PATCH@) +set(A5O_PKG_VERSION @PROJECT_VERSION@) # Architecture, compiler and other low level flags -set(ALLEGRO_PKG_LIBRARY_ARCHITECTURE "@CMAKE_LIBRARY_ARCHITECTURE@") -set(ALLEGRO_PKG_COMPILER "@CMAKE_C_COMPILER_ID@") -set(ALLEGRO_PKG_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@") -set(ALLEGRO_PKG_HOST_SYSTEM "@CMAKE_HOST_SYSTEM@") +set(A5O_PKG_LIBRARY_ARCHITECTURE "@CMAKE_LIBRARY_ARCHITECTURE@") +set(A5O_PKG_COMPILER "@CMAKE_C_COMPILER_ID@") +set(A5O_PKG_COMPILER_VERSION "@CMAKE_C_COMPILER_VERSION@") +set(A5O_PKG_HOST_SYSTEM "@CMAKE_HOST_SYSTEM@") # Targets include("${CMAKE_CURRENT_LIST_DIR}/@PKG_TARGETS_NAME@.cmake") diff --git a/cmake/AllegroFindFFMPEG.cmake b/cmake/AllegroFindFFMPEG.cmake index 948b8da262..120298d172 100644 --- a/cmake/AllegroFindFFMPEG.cmake +++ b/cmake/AllegroFindFFMPEG.cmake @@ -6,7 +6,7 @@ # -lavcodec -lavformat -lswscale -if(ALLEGRO_UNIX) +if(A5O_UNIX) pkg_check_modules(FFMPEG libavcodec libavformat libswscale libavutil) endif() diff --git a/cmake/AllegroFindOSS.cmake b/cmake/AllegroFindOSS.cmake index e86af534eb..2c5afa2e41 100644 --- a/cmake/AllegroFindOSS.cmake +++ b/cmake/AllegroFindOSS.cmake @@ -4,10 +4,10 @@ # This file is Allegro-specific and requires the following variables to be # set elsewhere: -# ALLEGRO_HAVE_MACHINE_SOUNDCARD_H -# ALLEGRO_HAVE_LINUX_SOUNDCARD_H -# ALLEGRO_HAVE_SYS_SOUNDCARD_H -# ALLEGRO_HAVE_SOUNDCARD_H +# A5O_HAVE_MACHINE_SOUNDCARD_H +# A5O_HAVE_LINUX_SOUNDCARD_H +# A5O_HAVE_SYS_SOUNDCARD_H +# A5O_HAVE_SOUNDCARD_H if(OSS_INCLUDE_DIR) @@ -17,39 +17,39 @@ endif(OSS_INCLUDE_DIR) set(CMAKE_REQUIRED_DEFINITIONS) -if(ALLEGRO_HAVE_SOUNDCARD_H OR ALLEGRO_HAVE_SYS_SOUNDCARD_H OR - ALLEGRO_HAVE_MACHINE_SOUNDCARD_H OR ALLEGRO_LINUX_SYS_SOUNDCARD_H) +if(A5O_HAVE_SOUNDCARD_H OR A5O_HAVE_SYS_SOUNDCARD_H OR + A5O_HAVE_MACHINE_SOUNDCARD_H OR A5O_LINUX_SYS_SOUNDCARD_H) - if(ALLEGRO_HAVE_MACHINE_SOUNDCARD_H) - set(CMAKE_REQUIRED_DEFINITIONS -DALLEGRO_HAVE_MACHINE_SOUNDCARD_H) - endif(ALLEGRO_HAVE_MACHINE_SOUNDCARD_H) + if(A5O_HAVE_MACHINE_SOUNDCARD_H) + set(CMAKE_REQUIRED_DEFINITIONS -DA5O_HAVE_MACHINE_SOUNDCARD_H) + endif(A5O_HAVE_MACHINE_SOUNDCARD_H) - if(ALLEGRO_HAVE_LINUX_SOUNDCARD_H) + if(A5O_HAVE_LINUX_SOUNDCARD_H) set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} - -DALLEGRO_HAVE_LINUX_SOUNDCARD_H) - endif(ALLEGRO_HAVE_LINUX_SOUNDCARD_H) + -DA5O_HAVE_LINUX_SOUNDCARD_H) + endif(A5O_HAVE_LINUX_SOUNDCARD_H) - if(ALLEGRO_HAVE_SYS_SOUNDCARD_H) + if(A5O_HAVE_SYS_SOUNDCARD_H) set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} - -DALLEGRO_HAVE_SYS_SOUNDCARD_H) - endif(ALLEGRO_HAVE_SYS_SOUNDCARD_H) + -DA5O_HAVE_SYS_SOUNDCARD_H) + endif(A5O_HAVE_SYS_SOUNDCARD_H) - if(ALLEGRO_HAVE_SOUNDCARD_H) + if(A5O_HAVE_SOUNDCARD_H) set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} - -DALLEGRO_HAVE_SOUNDCARD_H) - endif(ALLEGRO_HAVE_SOUNDCARD_H) + -DA5O_HAVE_SOUNDCARD_H) + endif(A5O_HAVE_SOUNDCARD_H) run_c_compile_test(" - #ifdef ALLEGRO_HAVE_SOUNDCARD_H + #ifdef A5O_HAVE_SOUNDCARD_H #include #endif - #ifdef ALLEGRO_HAVE_SYS_SOUNDCARD_H + #ifdef A5O_HAVE_SYS_SOUNDCARD_H #include #endif - #ifdef ALLEGRO_HAVE_LINUX_SOUNDCARD_H + #ifdef A5O_HAVE_LINUX_SOUNDCARD_H #include #endif - #ifdef ALLEGRO_HAVE_MACHINE_SOUNDCARD_H + #ifdef A5O_HAVE_MACHINE_SOUNDCARD_H #include #endif int main(void) { @@ -61,8 +61,8 @@ if(ALLEGRO_HAVE_SOUNDCARD_H OR ALLEGRO_HAVE_SYS_SOUNDCARD_H OR set(CMAKE_REQUIRED_DEFINITIONS) -endif(ALLEGRO_HAVE_SOUNDCARD_H OR ALLEGRO_HAVE_SYS_SOUNDCARD_H OR - ALLEGRO_HAVE_MACHINE_SOUNDCARD_H OR ALLEGRO_LINUX_SYS_SOUNDCARD_H) +endif(A5O_HAVE_SOUNDCARD_H OR A5O_HAVE_SYS_SOUNDCARD_H OR + A5O_HAVE_MACHINE_SOUNDCARD_H OR A5O_LINUX_SYS_SOUNDCARD_H) # Handle the QUIETLY and REQUIRED arguments and set OSS_FOUND to TRUE if # all listed variables are TRUE. diff --git a/cmake/AndroidApp.cmake b/cmake/AndroidApp.cmake index 5b25f1b42e..5381fc1b4f 100644 --- a/cmake/AndroidApp.cmake +++ b/cmake/AndroidApp.cmake @@ -82,8 +82,8 @@ function(add_android_app prog sources) add_custom_command( OUTPUT ${AAR} - DEPENDS ${ALLEGRO_AAR} - COMMAND ${CMAKE_COMMAND} -E copy ${ALLEGRO_AAR} ${AAR} + DEPENDS ${A5O_AAR} + COMMAND ${CMAKE_COMMAND} -E copy ${A5O_AAR} ${AAR} ) # How to make the APK. diff --git a/cmake/Common.cmake b/cmake/Common.cmake index fdbe28ff0f..46ad69eb7e 100644 --- a/cmake/Common.cmake +++ b/cmake/Common.cmake @@ -86,9 +86,9 @@ function(add_our_library target framework_name sources extra_flags link_with) # BUILD_SHARED_LIBS controls whether this is a shared or static library. add_library(${target} ${sources}) target_include_directories(${target} INTERFACE $) - list(APPEND ALLEGRO_TARGETS "${target}") - list(REMOVE_DUPLICATES ALLEGRO_TARGETS) - set(ALLEGRO_TARGETS "${ALLEGRO_TARGETS}" CACHE INTERNAL "internal") + list(APPEND A5O_TARGETS "${target}") + list(REMOVE_DUPLICATES A5O_TARGETS) + set(A5O_TARGETS "${A5O_TARGETS}" CACHE INTERNAL "internal") if(MSVC) # Compile with multiple processors @@ -119,21 +119,21 @@ function(add_our_library target framework_name sources extra_flags link_with) endif() if(NOT BUILD_SHARED_LIBS) - set(static_flag "-DALLEGRO_STATICLINK") + set(static_flag "-DA5O_STATICLINK") endif(NOT BUILD_SHARED_LIBS) if(NOT ANDROID) set_target_properties(${target} PROPERTIES - COMPILE_FLAGS "${extra_flags} ${static_flag} -DALLEGRO_LIB_BUILD" + COMPILE_FLAGS "${extra_flags} ${static_flag} -DA5O_LIB_BUILD" LINK_FLAGS "${extra_link_flags}" - VERSION ${ALLEGRO_VERSION} - SOVERSION ${ALLEGRO_SOVERSION} + VERSION ${A5O_VERSION} + SOVERSION ${A5O_SOVERSION} ) else(NOT ANDROID) set_target_properties(${target} PROPERTIES - COMPILE_FLAGS "${extra_flags} ${static_flag} -DALLEGRO_LIB_BUILD" + COMPILE_FLAGS "${extra_flags} ${static_flag} -DA5O_LIB_BUILD" ) set_property(GLOBAL APPEND PROPERTY JNI_LIBS ${target}) endif(NOT ANDROID) @@ -153,7 +153,7 @@ function(add_our_library target framework_name sources extra_flags link_with) set_target_properties(${target} PROPERTIES PREFIX "" - SUFFIX -${ALLEGRO_SOVERSION}.dll + SUFFIX -${A5O_SOVERSION}.dll IMPORT_SUFFIX ${CMAKE_IMPORT_LIBRARY_SUFFIX} ) endif() @@ -302,10 +302,10 @@ function(add_our_executable nm) add_executable(${nm} ${EXECUTABLE_TYPE} ${OPTS_SRCS}) target_link_libraries(${nm} ${OPTS_LIBS}) if(WANT_POPUP_EXAMPLES AND SUPPORT_NATIVE_DIALOG) - list(APPEND OPTS_DEFINES ALLEGRO_POPUP_EXAMPLES) + list(APPEND OPTS_DEFINES A5O_POPUP_EXAMPLES) endif() if(NOT BUILD_SHARED_LIBS) - list(APPEND OPTS_DEFINES ALLEGRO_STATICLINK) + list(APPEND OPTS_DEFINES A5O_STATICLINK) endif() foreach(d ${OPTS_DEFINES}) diff --git a/cmake/FileList.cmake b/cmake/FileList.cmake index beed6cafd7..7177ece5bf 100644 --- a/cmake/FileList.cmake +++ b/cmake/FileList.cmake @@ -1,4 +1,4 @@ -set(ALLEGRO_SRC_FILES +set(A5O_SRC_FILES src/allegro.c src/bitmap.c src/bitmap_draw.c @@ -54,7 +54,7 @@ set(ALLEGRO_SRC_FILES src/misc/vector.c ) -set(ALLEGRO_SRC_WIN_FILES +set(A5O_SRC_WIN_FILES src/win/wclipboard.c src/win/whapall.c src/win/whapdrv.c @@ -76,7 +76,7 @@ set(ALLEGRO_SRC_WIN_FILES src/win/wxthread.c ) -set(ALLEGRO_SRC_D3D_FILES +set(A5O_SRC_D3D_FILES src/win/d3d_bmp.cpp src/win/d3d_disp.cpp src/win/d3d_display_formats.cpp @@ -85,7 +85,7 @@ set(ALLEGRO_SRC_D3D_FILES src/win/d3d_d3dx9.cpp ) -set(ALLEGRO_SRC_OPENGL_FILES +set(A5O_SRC_OPENGL_FILES src/opengl/extensions.c src/opengl/ogl_bitmap.c src/opengl/ogl_display.c @@ -97,11 +97,11 @@ set(ALLEGRO_SRC_OPENGL_FILES src/opengl/ogl_shader.c ) -set(ALLEGRO_SRC_WGL_FILES +set(A5O_SRC_WGL_FILES src/win/wgl_disp.c ) -set(ALLEGRO_SRC_UNIX_FILES +set(A5O_SRC_UNIX_FILES src/unix/udrvlist.c src/unix/ufdwatch.c src/unix/ugfxdrv.c @@ -114,7 +114,7 @@ set(ALLEGRO_SRC_UNIX_FILES src/unix/uxthread.c ) -set(ALLEGRO_SRC_X_FILES +set(A5O_SRC_X_FILES src/x/xclipboard.c src/x/xcursor.c src/x/xdisplay.c @@ -132,7 +132,7 @@ set(ALLEGRO_SRC_X_FILES src/linux/ljoynu.c ) -set(ALLEGRO_SRC_MACOSX_FILES +set(A5O_SRC_MACOSX_FILES src/macosx/hidjoy.m src/macosx/hidjoy-10.4.m src/macosx/hidman.m @@ -146,7 +146,7 @@ set(ALLEGRO_SRC_MACOSX_FILES src/unix/uxthread.c ) -set(ALLEGRO_SRC_IPHONE_FILES +set(A5O_SRC_IPHONE_FILES src/iphone/allegroAppDelegate.m src/iphone/EAGLView.m src/iphone/ViewController.m @@ -163,7 +163,7 @@ set(ALLEGRO_SRC_IPHONE_FILES src/unix/uxthread.c ) -set(ALLEGRO_SRC_ANDROID_FILES +set(A5O_SRC_ANDROID_FILES src/unix/ufdwatch.c src/unix/utime.c src/unix/uxthread.c @@ -183,7 +183,7 @@ set(ALLEGRO_SRC_ANDROID_FILES src/android/android_apk_fs.c ) -set(ALLEGRO_SRC_RASPBERRYPI_FILES +set(A5O_SRC_RASPBERRYPI_FILES src/unix/utime.c src/unix/uxthread.c src/linux/lkeybdnu.c @@ -199,7 +199,7 @@ set(ALLEGRO_SRC_RASPBERRYPI_FILES src/raspberrypi/pidisplay.c ) -set(ALLEGRO_SRC_SDL_FILES +set(A5O_SRC_SDL_FILES src/sdl/sdl_system.c src/sdl/sdl_time.c src/sdl/sdl_thread.c @@ -211,7 +211,7 @@ set(ALLEGRO_SRC_SDL_FILES src/sdl/sdl_event_hack.c ) -set(ALLEGRO_INCLUDE_ALLEGRO_FILES +set(A5O_INCLUDE_A5O_FILES include/allegro5/allegro5.h include/allegro5/allegro.h include/allegro5/alcompat.h @@ -258,20 +258,20 @@ set(ALLEGRO_INCLUDE_ALLEGRO_FILES include/allegro5/allegro_opengl.h ) -set(ALLEGRO_INCLUDE_ALLEGRO_INLINE_FILES +set(A5O_INCLUDE_A5O_INLINE_FILES include/allegro5/inline/fmaths.inl ) -set(ALLEGRO_INCLUDE_ALLEGRO_INTERNAL_FILES +set(A5O_INCLUDE_A5O_INTERNAL_FILES # Only files which need to be installed. include/allegro5/internal/alconfig.h ) -set(ALLEGRO_INCLUDE_ALLEGRO_OPENGL_FILES +set(A5O_INCLUDE_A5O_OPENGL_FILES include/allegro5/opengl/gl_ext.h ) -set(ALLEGRO_INCLUDE_ALLEGRO_OPENGL_GLEXT_FILES +set(A5O_INCLUDE_A5O_OPENGL_GLEXT_FILES include/allegro5/opengl/GLext/gl_ext_alias.h include/allegro5/opengl/GLext/gl_ext_defs.h include/allegro5/opengl/GLext/glx_ext_alias.h @@ -286,7 +286,7 @@ set(ALLEGRO_INCLUDE_ALLEGRO_OPENGL_GLEXT_FILES include/allegro5/opengl/GLext/wgl_ext_list.h ) -set(ALLEGRO_INCLUDE_ALLEGRO_PLATFORM_FILES +set(A5O_INCLUDE_A5O_PLATFORM_FILES # Only files which need to be installed. include/allegro5/platform/alandroid.h include/allegro5/platform/alandroidcfg.h @@ -308,26 +308,26 @@ set(ALLEGRO_INCLUDE_ALLEGRO_PLATFORM_FILES include/allegro5/platform/allegro_sdl_config.h ) -set(ALLEGRO_INCLUDE_ALLEGRO_WINDOWS_FILES +set(A5O_INCLUDE_A5O_WINDOWS_FILES include/allegro5/allegro_windows.h ) -set(ALLEGRO_INCLUDE_ALLEGRO_MACOSX_FILES +set(A5O_INCLUDE_A5O_MACOSX_FILES include/allegro5/allegro_osx.h ) -set(ALLEGRO_INCLUDE_ALLEGRO_IPHONE_FILES +set(A5O_INCLUDE_A5O_IPHONE_FILES include/allegro5/allegro_iphone.h ) -set(ALLEGRO_INCLUDE_ALLEGRO_ANDROID_FILES +set(A5O_INCLUDE_A5O_ANDROID_FILES include/allegro5/allegro_android.h ) -set(ALLEGRO_INCLUDE_ALLEGRO_PLATFORM_FILES_GENERATED +set(A5O_INCLUDE_A5O_PLATFORM_FILES_GENERATED include/allegro5/platform/alplatf.h ) -set(ALLEGRO_INCLUDE_ALLEGRO_X_FILES +set(A5O_INCLUDE_A5O_X_FILES include/allegro5/allegro_x.h ) diff --git a/cmake/FindOpenGLES2.cmake b/cmake/FindOpenGLES2.cmake index 70d7ece67c..eaffea5137 100644 --- a/cmake/FindOpenGLES2.cmake +++ b/cmake/FindOpenGLES2.cmake @@ -24,13 +24,13 @@ find_package_handle_standard_args(OPENGLES2 DEFAULT_MSG set(OPENGLES2_LIBRARIES ${OPENGLES2_gl_LIBRARY} ${OPENGLES2_egl_LIBRARY}) -if(ALLEGRO_RASPBERRYPI) +if(A5O_RASPBERRYPI) if(EXISTS "/opt/vc/lib/libbrcmGLESv2.so") set(OPENGLES2_LIBRARIES "/opt/vc/lib/libbrcmGLESv2.so;/opt/vc/lib/libbrcmEGL.so;/opt/vc/lib/libbcm_host.so") else() set(OPENGLES2_LIBRARIES "/opt/vc/lib/libGLESv2.so;/opt/vc/lib/libEGL.so;/opt/vc/lib/libbcm_host.so") endif() -endif(ALLEGRO_RASPBERRYPI) +endif(A5O_RASPBERRYPI) mark_as_advanced(OPENGLES2_INCLUDE_DIR) mark_as_advanced(OPENGLES2_gl_LIBRARY) diff --git a/cmake/Toolchain-iphone.cmake b/cmake/Toolchain-iphone.cmake index 1a53439095..14fb431ac3 100644 --- a/cmake/Toolchain-iphone.cmake +++ b/cmake/Toolchain-iphone.cmake @@ -1,5 +1,5 @@ set (IPHONE 1) -set (ALLEGRO_CFG_OPENGLES 1) +set (A5O_CFG_OPENGLES 1) set (IOS_PLATFORM "iphoneos" CACHE STRING "iOS platform (iphoneos or iphonesimulator)") mark_as_advanced(IOS_PLATFORM) set (CMAKE_OSX_SYSROOT "${IOS_PLATFORM}") diff --git a/cmake/Toolchain-raspberrypi.cmake b/cmake/Toolchain-raspberrypi.cmake index 17fedbc471..42593dd2e0 100644 --- a/cmake/Toolchain-raspberrypi.cmake +++ b/cmake/Toolchain-raspberrypi.cmake @@ -1,4 +1,4 @@ -SET(ALLEGRO_RASPBERRYPI 1) +SET(A5O_RASPBERRYPI 1) SET(CMAKE_SYSTEM_NAME Linux) IF("${TOOLCHAIN_ROOT}" STREQUAL "") diff --git a/contrib/luajit/CMakeLists.txt b/contrib/luajit/CMakeLists.txt index a6f422e383..ee6ff105c6 100644 --- a/contrib/luajit/CMakeLists.txt +++ b/contrib/luajit/CMakeLists.txt @@ -2,7 +2,7 @@ include(FindPythonInterp) # Construct list of files whose modification should trigger a rebuild of # the Python API. -foreach(x ${MONOLITH_SOURCES} ${MONOLITH_HEADERS} ${ALLEGRO_PUBLIC_HEADERS}) +foreach(x ${MONOLITH_SOURCES} ${MONOLITH_HEADERS} ${A5O_PUBLIC_HEADERS}) if(NOT ${x} MATCHES "^/.*") file(RELATIVE_PATH xrel ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/${x}) list(APPEND SOURCES ${xrel}) @@ -34,7 +34,7 @@ endif(WIN32) SET(release "") append_lib_type_suffix(release) append_lib_linkage_suffix(release) -SET(version "${ALLEGRO_SOVERSION}") +SET(version "${A5O_SOVERSION}") add_custom_target(luajit ALL diff --git a/contrib/luajit/generate_luajit_ffi.py b/contrib/luajit/generate_luajit_ffi.py index 59297e1312..e5cb87efb3 100755 --- a/contrib/luajit/generate_luajit_ffi.py +++ b/contrib/luajit/generate_luajit_ffi.py @@ -30,9 +30,9 @@ def parse_protos(self, filename): self.functions.append(proto) continue # anonymous structs have no name at all - if name and not name.startswith("ALLEGRO_"): + if name and not name.startswith("A5O_"): continue - if name == "ALLEGRO_OGL_EXT_API": + if name == "A5O_OGL_EXT_API": continue if pwords[0] in ('union', 'struct'): @@ -108,9 +108,9 @@ def typeorder(decls, declared): ordered = [] todo = decls[:] - seen.add('ALLEGRO_EVENT_TYPE') - seen.add('ALLEGRO_KEY_MAX') - seen.add('ALLEGRO_USER_EVENT_DESCRIPTOR') + seen.add('A5O_EVENT_TYPE') + seen.add('A5O_KEY_MAX') + seen.add('A5O_USER_EVENT_DESCRIPTOR') def info(t): brk, brk2 = t.find('{'), t.rfind('}') @@ -129,8 +129,8 @@ def info(t): if name: decl.add(name) - reall = re.compile('(ALLEGRO_\w+\s*\*?)') - retname = re.compile('(ALLEGRO_\w+)') + reall = re.compile('(A5O_\w+\s*\*?)') + retname = re.compile('(A5O_\w+)') c = 0 while True: lb = len(todo) @@ -141,7 +141,7 @@ def info(t): # print aldeps for rdep in aldeps: dep = retname.match(rdep).group(1) - if dep.startswith('ALLEGRO_GL_'): + if dep.startswith('A5O_GL_'): continue # ignore if dep in decl and rdep[-1] == '*': continue # ok, seen type and ptr @@ -216,8 +216,8 @@ def main(): typedef void* va_list; typedef int al_fixed; typedef unsigned int GLuint; -typedef unsigned int ALLEGRO_EVENT_TYPE; -enum { ALLEGRO_KEY_MAX = 227 }; +typedef unsigned int A5O_EVENT_TYPE; +enum { A5O_KEY_MAX = 227 }; """) # enums diff --git a/demos/cosmic_protector/CMakeLists.txt b/demos/cosmic_protector/CMakeLists.txt index 8063b63524..e701ef3502 100644 --- a/demos/cosmic_protector/CMakeLists.txt +++ b/demos/cosmic_protector/CMakeLists.txt @@ -92,11 +92,11 @@ fix_executable(cosmic_protector) if(WANT_MONOLITH) target_link_libraries(cosmic_protector - ${ALLEGRO_MONOLITH_LINK_WITH} + ${A5O_MONOLITH_LINK_WITH} ) else(WANT_MONOLITH) target_link_libraries(cosmic_protector - ${ALLEGRO_MAIN_LINK_WITH} + ${A5O_MAIN_LINK_WITH} ${FONT_LINK_WITH} ${IMAGE_LINK_WITH} ${AUDIO_LINK_WITH} @@ -106,7 +106,7 @@ else(WANT_MONOLITH) endif(WANT_MONOLITH) if(NOT BUILD_SHARED_LIBS) - set_target_properties(cosmic_protector PROPERTIES COMPILE_FLAGS "-DALLEGRO_STATICLINK") + set_target_properties(cosmic_protector PROPERTIES COMPILE_FLAGS "-DA5O_STATICLINK") endif(NOT BUILD_SHARED_LIBS) # Mac OS X bundle support. diff --git a/demos/cosmic_protector/include/Asteroid.hpp b/demos/cosmic_protector/include/Asteroid.hpp index dc228d4335..0f4c516486 100644 --- a/demos/cosmic_protector/include/Asteroid.hpp +++ b/demos/cosmic_protector/include/Asteroid.hpp @@ -16,7 +16,7 @@ class Asteroid : public Entity float angle; float speed_x; float speed_y; - ALLEGRO_BITMAP *bitmap; + A5O_BITMAP *bitmap; }; #endif // ASTEROID_HPP diff --git a/demos/cosmic_protector/include/BitmapResource.hpp b/demos/cosmic_protector/include/BitmapResource.hpp index 635daff78f..5d8e5b66ac 100644 --- a/demos/cosmic_protector/include/BitmapResource.hpp +++ b/demos/cosmic_protector/include/BitmapResource.hpp @@ -10,7 +10,7 @@ class BitmapResource : public Resource { void* get(void); BitmapResource(const char* filename); private: - ALLEGRO_BITMAP *bitmap; + A5O_BITMAP *bitmap; std::string filename; }; diff --git a/demos/cosmic_protector/include/Bullet.hpp b/demos/cosmic_protector/include/Bullet.hpp index 3e4019fab1..62314e6b32 100644 --- a/demos/cosmic_protector/include/Bullet.hpp +++ b/demos/cosmic_protector/include/Bullet.hpp @@ -10,7 +10,7 @@ class Bullet : public Entity int lifetime, int damage, int bitmapID, Entity *shooter); ~Bullet(void); protected: - ALLEGRO_BITMAP *bitmap; + A5O_BITMAP *bitmap; float speed; float angle; int lifetime; diff --git a/demos/cosmic_protector/include/DisplayResource.hpp b/demos/cosmic_protector/include/DisplayResource.hpp index 826b3413b0..bd98186998 100644 --- a/demos/cosmic_protector/include/DisplayResource.hpp +++ b/demos/cosmic_protector/include/DisplayResource.hpp @@ -8,11 +8,11 @@ class DisplayResource : public Resource { void destroy(void); bool load(void); void* get(void); - ALLEGRO_EVENT_QUEUE *getEventQueue(void); + A5O_EVENT_QUEUE *getEventQueue(void); DisplayResource(void); private: - ALLEGRO_DISPLAY *display; - ALLEGRO_EVENT_QUEUE *events; + A5O_DISPLAY *display; + A5O_EVENT_QUEUE *events; }; extern bool useFullScreenMode; diff --git a/demos/cosmic_protector/include/Entity.hpp b/demos/cosmic_protector/include/Entity.hpp index ecdaccc361..d37b8fa506 100644 --- a/demos/cosmic_protector/include/Entity.hpp +++ b/demos/cosmic_protector/include/Entity.hpp @@ -8,7 +8,7 @@ class Entity { public: virtual bool logic(int step); virtual void render(int offx = 0, int offy = 0) = 0; - virtual void render(int x, int y, ALLEGRO_COLOR c); + virtual void render(int x, int y, A5O_COLOR c); virtual void spawn(void); virtual bool hit(int damage); @@ -29,7 +29,7 @@ class Entity { Entity *getAllCollision(void); void explode(void); - void render_four(ALLEGRO_COLOR tint); + void render_four(A5O_COLOR tint); Entity(void); virtual ~Entity(void) {}; diff --git a/demos/cosmic_protector/include/FontResource.hpp b/demos/cosmic_protector/include/FontResource.hpp index 88f9ca55f5..39e3b2b64a 100644 --- a/demos/cosmic_protector/include/FontResource.hpp +++ b/demos/cosmic_protector/include/FontResource.hpp @@ -9,7 +9,7 @@ class FontResource : public Resource void* get(void); FontResource(const char *filename); private: - ALLEGRO_FONT *font; + A5O_FONT *font; std::string filename; }; diff --git a/demos/cosmic_protector/include/Game.hpp b/demos/cosmic_protector/include/Game.hpp index b3be8684a3..a037cd0ba9 100644 --- a/demos/cosmic_protector/include/Game.hpp +++ b/demos/cosmic_protector/include/Game.hpp @@ -3,7 +3,7 @@ #include "cosmic_protector.hpp" -#ifdef ALLEGRO_MSVC +#ifdef A5O_MSVC /* MSVC (up to ver. 9 at least) ignores exception specifications */ #pragma warning( disable : 4290 ) #endif diff --git a/demos/cosmic_protector/include/Input.hpp b/demos/cosmic_protector/include/Input.hpp index 76bc82cc13..b0869c5103 100644 --- a/demos/cosmic_protector/include/Input.hpp +++ b/demos/cosmic_protector/include/Input.hpp @@ -9,7 +9,7 @@ class Input : public Resource Input(); ~Input(); -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE void draw(void); bool button_pressed(int x, int y, int w, int h, bool check_if_controls_at_top = true); #endif @@ -25,15 +25,15 @@ class Input : public Resource bool load(void); void* get(void); private: - ALLEGRO_KEYBOARD_STATE kbdstate; - ALLEGRO_JOYSTICK_STATE joystate; - ALLEGRO_JOYSTICK *joystick; + A5O_KEYBOARD_STATE kbdstate; + A5O_JOYSTICK_STATE joystate; + A5O_JOYSTICK *joystick; - ALLEGRO_EVENT_QUEUE *input_queue; + A5O_EVENT_QUEUE *input_queue; bool joypad_u, joypad_d, joypad_l, joypad_r, joypad_b, joypad_esc; -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE struct Touch { int id; int x; diff --git a/demos/cosmic_protector/include/Player.hpp b/demos/cosmic_protector/include/Player.hpp index c8349eec0b..42e8f5f7a4 100644 --- a/demos/cosmic_protector/include/Player.hpp +++ b/demos/cosmic_protector/include/Player.hpp @@ -11,7 +11,7 @@ class Player : public Entity, public Resource { bool logic(int step); void render_extra(void); void render(int offx, int offy); - void render(int offx, int offy, ALLEGRO_COLOR tint); + void render(int offx, int offy, A5O_COLOR tint); bool hit(int damage); void destroy(void); @@ -41,11 +41,11 @@ class Player : public Entity, public Resource { int invincibleCount; int score; - ALLEGRO_BITMAP *bitmap; - ALLEGRO_BITMAP *trans_bitmap; - ALLEGRO_BITMAP *trail_bitmap; - ALLEGRO_BITMAP *icon; - ALLEGRO_BITMAP *highscoreBitmap; + A5O_BITMAP *bitmap; + A5O_BITMAP *trans_bitmap; + A5O_BITMAP *trail_bitmap; + A5O_BITMAP *icon; + A5O_BITMAP *highscoreBitmap; }; #endif // PLAYER_HPP diff --git a/demos/cosmic_protector/include/PowerUp.hpp b/demos/cosmic_protector/include/PowerUp.hpp index da7dcb6246..e5f738e4db 100644 --- a/demos/cosmic_protector/include/PowerUp.hpp +++ b/demos/cosmic_protector/include/PowerUp.hpp @@ -15,7 +15,7 @@ class PowerUp : public Entity PowerUp(float x, float y, int type); private: int type; - ALLEGRO_BITMAP *bitmap; + A5O_BITMAP *bitmap; float angle; float da; }; diff --git a/demos/cosmic_protector/include/SampleResource.hpp b/demos/cosmic_protector/include/SampleResource.hpp index 88dedfaa69..db5b03b9e4 100644 --- a/demos/cosmic_protector/include/SampleResource.hpp +++ b/demos/cosmic_protector/include/SampleResource.hpp @@ -10,7 +10,7 @@ class SampleResource : public Resource { void* get(void); SampleResource(const char* filename); private: - ALLEGRO_SAMPLE *sample_data; + A5O_SAMPLE *sample_data; std::string filename; }; diff --git a/demos/cosmic_protector/include/StreamResource.hpp b/demos/cosmic_protector/include/StreamResource.hpp index 7c72751a60..b0297ffbb5 100644 --- a/demos/cosmic_protector/include/StreamResource.hpp +++ b/demos/cosmic_protector/include/StreamResource.hpp @@ -10,7 +10,7 @@ class StreamResource : public Resource { void* get(void); StreamResource(const char* filename); private: - ALLEGRO_AUDIO_STREAM *stream; + A5O_AUDIO_STREAM *stream; std::string filename; }; diff --git a/demos/cosmic_protector/include/UFO.hpp b/demos/cosmic_protector/include/UFO.hpp index 2ca4d3c3d6..5a9ea84a2f 100644 --- a/demos/cosmic_protector/include/UFO.hpp +++ b/demos/cosmic_protector/include/UFO.hpp @@ -9,12 +9,12 @@ class UFO : public Entity bool logic(int step); void render(int offx, int offy); - void render(int offx, int offy, ALLEGRO_COLOR tint); + void render(int offx, int offy, A5O_COLOR tint); UFO(float x, float y, float dx, float dy); ~UFO(); protected: - ALLEGRO_BITMAP *bitmaps[3]; + A5O_BITMAP *bitmaps[3]; int nextShot; int bitmapFrame; int bitmapFrameCount; diff --git a/demos/cosmic_protector/include/cosmic_protector.hpp b/demos/cosmic_protector/include/cosmic_protector.hpp index fca1d6b34b..491d4be424 100644 --- a/demos/cosmic_protector/include/cosmic_protector.hpp +++ b/demos/cosmic_protector/include/cosmic_protector.hpp @@ -8,7 +8,7 @@ #include "allegro5/allegro_acodec.h" #include "allegro5/allegro_primitives.h" -#ifdef ALLEGRO_UNIX +#ifdef A5O_UNIX #define MAX_PATH 5000 #endif @@ -58,7 +58,7 @@ extern int BB_W; extern int BB_H; -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE extern bool switched_out; void switch_game_out(bool halt); void switch_game_in(void); diff --git a/demos/cosmic_protector/src/Asteroid.cpp b/demos/cosmic_protector/src/Asteroid.cpp index 09ea3a3d8e..55555cf0b9 100644 --- a/demos/cosmic_protector/src/Asteroid.cpp +++ b/demos/cosmic_protector/src/Asteroid.cpp @@ -41,10 +41,10 @@ Asteroid::Asteroid(float radius, int bitmapID) { this->radius = radius; - angle = randf(0.0f, ALLEGRO_PI*2.0f); + angle = randf(0.0f, A5O_PI*2.0f); ResourceManager& rm = ResourceManager::getInstance(); - bitmap = (ALLEGRO_BITMAP *)rm.getData(bitmapID); + bitmap = (A5O_BITMAP *)rm.getData(bitmapID); } Asteroid::~Asteroid() diff --git a/demos/cosmic_protector/src/BitmapResource.cpp b/demos/cosmic_protector/src/BitmapResource.cpp index e8a3a6f659..daefe9e9bd 100644 --- a/demos/cosmic_protector/src/BitmapResource.cpp +++ b/demos/cosmic_protector/src/BitmapResource.cpp @@ -10,8 +10,8 @@ void BitmapResource::destroy(void) bool BitmapResource::load(void) { - al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA); - al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR); + al_set_new_bitmap_format(A5O_PIXEL_FORMAT_ANY_WITH_ALPHA); + al_set_new_bitmap_flags(A5O_MIN_LINEAR | A5O_MAG_LINEAR); bitmap = al_load_bitmap(filename.c_str()); if (!bitmap) debug_message("Error loading bitmap %s\n", filename.c_str()); diff --git a/demos/cosmic_protector/src/Bullet.cpp b/demos/cosmic_protector/src/Bullet.cpp index 0ef5793afc..67a56aa282 100644 --- a/demos/cosmic_protector/src/Bullet.cpp +++ b/demos/cosmic_protector/src/Bullet.cpp @@ -45,7 +45,7 @@ Bullet::Bullet(float x, float y, float radius, float speed, float angle, sina = sin(angle); ResourceManager& rm = ResourceManager::getInstance(); - bitmap = (ALLEGRO_BITMAP *)rm.getData(bitmapID); + bitmap = (A5O_BITMAP *)rm.getData(bitmapID); isDestructable = false; } diff --git a/demos/cosmic_protector/src/ButtonWidget.cpp b/demos/cosmic_protector/src/ButtonWidget.cpp index b15f7fa355..d98cca8040 100644 --- a/demos/cosmic_protector/src/ButtonWidget.cpp +++ b/demos/cosmic_protector/src/ButtonWidget.cpp @@ -7,17 +7,17 @@ bool ButtonWidget::activate(void) void ButtonWidget::render(bool selected) { - ALLEGRO_FONT *myfont; + A5O_FONT *myfont; ResourceManager& rm = ResourceManager::getInstance(); if (center) { if (selected) { - myfont = (ALLEGRO_FONT *)rm.getData(RES_LARGEFONT); + myfont = (A5O_FONT *)rm.getData(RES_LARGEFONT); } else { - myfont = (ALLEGRO_FONT *)rm.getData(RES_SMALLFONT); + myfont = (A5O_FONT *)rm.getData(RES_SMALLFONT); } - al_draw_textf(myfont, al_map_rgb(255, 255, 255), x, y-al_get_font_line_height(myfont)/2, ALLEGRO_ALIGN_CENTRE, "%s", text); + al_draw_textf(myfont, al_map_rgb(255, 255, 255), x, y-al_get_font_line_height(myfont)/2, A5O_ALIGN_CENTRE, "%s", text); } } diff --git a/demos/cosmic_protector/src/DisplayResource.cpp b/demos/cosmic_protector/src/DisplayResource.cpp index 58b0fb1394..da1bfb3339 100644 --- a/demos/cosmic_protector/src/DisplayResource.cpp +++ b/demos/cosmic_protector/src/DisplayResource.cpp @@ -2,7 +2,7 @@ bool useFullScreenMode = false; -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE int BB_W; int BB_H; #else @@ -21,19 +21,19 @@ void DisplayResource::destroy(void) bool DisplayResource::load(void) { -#ifdef ALLEGRO_IPHONE - int flags = ALLEGRO_FULLSCREEN_WINDOW; - al_set_new_display_option(ALLEGRO_SUPPORTED_ORIENTATIONS, ALLEGRO_DISPLAY_ORIENTATION_LANDSCAPE, ALLEGRO_REQUIRE); +#ifdef A5O_IPHONE + int flags = A5O_FULLSCREEN_WINDOW; + al_set_new_display_option(A5O_SUPPORTED_ORIENTATIONS, A5O_DISPLAY_ORIENTATION_LANDSCAPE, A5O_REQUIRE); #else - int flags = useFullScreenMode ? ALLEGRO_FULLSCREEN : ALLEGRO_WINDOWED; + int flags = useFullScreenMode ? A5O_FULLSCREEN : A5O_WINDOWED; #endif al_set_new_display_flags(flags); display = al_create_display(BB_W, BB_H); if (!display) return false; -#ifndef ALLEGRO_IPHONE - ALLEGRO_BITMAP *bmp = al_load_bitmap(getResource("gfx/icon48.png")); +#ifndef A5O_IPHONE + A5O_BITMAP *bmp = al_load_bitmap(getResource("gfx/icon48.png")); al_set_display_icon(display, bmp); al_destroy_bitmap(bmp); #endif @@ -41,11 +41,11 @@ bool DisplayResource::load(void) BB_W = al_get_display_width(display); BB_H = al_get_display_height(display); -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE if (BB_W < 960) { BB_W *= 2; BB_H *= 2; - ALLEGRO_TRANSFORM t; + A5O_TRANSFORM t; al_identity_transform(&t); al_scale_transform(&t, 0.5, 0.5); al_use_transform(&t); @@ -63,7 +63,7 @@ void* DisplayResource::get(void) return display; } -ALLEGRO_EVENT_QUEUE *DisplayResource::getEventQueue(void) +A5O_EVENT_QUEUE *DisplayResource::getEventQueue(void) { return events; } diff --git a/demos/cosmic_protector/src/Entity.cpp b/demos/cosmic_protector/src/Entity.cpp index a6e4d8050a..5fcc443b07 100644 --- a/demos/cosmic_protector/src/Entity.cpp +++ b/demos/cosmic_protector/src/Entity.cpp @@ -66,7 +66,7 @@ void Entity::wrap(void) y -= BB_H; } -void Entity::render_four(ALLEGRO_COLOR tint) +void Entity::render_four(A5O_COLOR tint) { int ox = 0; render(0, 0, tint); @@ -88,7 +88,7 @@ void Entity::render_four(ALLEGRO_COLOR tint) } } -void Entity::render(int x, int y, ALLEGRO_COLOR c) +void Entity::render(int x, int y, A5O_COLOR c) { (void)c; // To use c must override this in a sub-class. render(x, y); diff --git a/demos/cosmic_protector/src/Explosion.cpp b/demos/cosmic_protector/src/Explosion.cpp index de9a8fac2b..9b9ae142e9 100644 --- a/demos/cosmic_protector/src/Explosion.cpp +++ b/demos/cosmic_protector/src/Explosion.cpp @@ -16,7 +16,7 @@ bool Explosion::logic(int step) void Explosion::render(int offx, int offy) { ResourceManager& rm = ResourceManager::getInstance(); - ALLEGRO_BITMAP *bitmap; + A5O_BITMAP *bitmap; int bitmapIndex; if (big) @@ -24,7 +24,7 @@ void Explosion::render(int offx, int offy) else bitmapIndex = RES_SMALLEXPLOSION0 + currFrame; - bitmap = (ALLEGRO_BITMAP *)rm.getData(bitmapIndex); + bitmap = (A5O_BITMAP *)rm.getData(bitmapIndex); al_draw_rotated_bitmap(bitmap, radius, radius, offx + x, offy + y, 0, 0); } diff --git a/demos/cosmic_protector/src/GUI.cpp b/demos/cosmic_protector/src/GUI.cpp index 8ca3640c40..389afc3535 100644 --- a/demos/cosmic_protector/src/GUI.cpp +++ b/demos/cosmic_protector/src/GUI.cpp @@ -4,45 +4,45 @@ #include #include -#ifdef ALLEGRO_MSVC +#ifdef A5O_MSVC #define snprintf _snprintf #endif static int do_gui(const std::vector& widgets, unsigned int selected) { ResourceManager& rm = ResourceManager::getInstance(); - ALLEGRO_BITMAP *bg = (ALLEGRO_BITMAP *)rm.getData(RES_BACKGROUND); + A5O_BITMAP *bg = (A5O_BITMAP *)rm.getData(RES_BACKGROUND); Input *input = (Input *)rm.getData(RES_INPUT); - ALLEGRO_BITMAP *logo = (ALLEGRO_BITMAP *)rm.getData(RES_LOGO); + A5O_BITMAP *logo = (A5O_BITMAP *)rm.getData(RES_LOGO); int lw = al_get_bitmap_width(logo); int lh = al_get_bitmap_height(logo); -#ifndef ALLEGRO_IPHONE - ALLEGRO_FONT *myfont = (ALLEGRO_FONT *)rm.getData(RES_SMALLFONT); +#ifndef A5O_IPHONE + A5O_FONT *myfont = (A5O_FONT *)rm.getData(RES_SMALLFONT); #endif bool redraw = true; for (;;) { /* Catch close button presses */ - ALLEGRO_EVENT_QUEUE *events = ((DisplayResource *)rm.getResource(RES_DISPLAY))->getEventQueue(); + A5O_EVENT_QUEUE *events = ((DisplayResource *)rm.getResource(RES_DISPLAY))->getEventQueue(); while (!al_is_event_queue_empty(events)) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_get_next_event(events, &event); -#ifdef ALLEGRO_IPHONE - if (event.type == ALLEGRO_EVENT_DISPLAY_HALT_DRAWING || event.type == ALLEGRO_EVENT_DISPLAY_SWITCH_OUT) { - switch_game_out(event.type == ALLEGRO_EVENT_DISPLAY_HALT_DRAWING); +#ifdef A5O_IPHONE + if (event.type == A5O_EVENT_DISPLAY_HALT_DRAWING || event.type == A5O_EVENT_DISPLAY_SWITCH_OUT) { + switch_game_out(event.type == A5O_EVENT_DISPLAY_HALT_DRAWING); } - else if (event.type == ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING || event.type == ALLEGRO_EVENT_DISPLAY_SWITCH_IN) { + else if (event.type == A5O_EVENT_DISPLAY_RESUME_DRAWING || event.type == A5O_EVENT_DISPLAY_SWITCH_IN) { switch_game_in(); } #else - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) + if (event.type == A5O_EVENT_DISPLAY_CLOSE) exit(0); #endif } input->poll(); -#if defined ALLEGRO_IPHONE +#if defined A5O_IPHONE float ud; if (is_joypad_connected()) { ud = input->ud(); @@ -67,14 +67,14 @@ static int do_gui(const std::vector& widgets, unsigned int selected) if (!widgets[selected]->activate()) return selected; } -#ifndef ALLEGRO_IPHONE +#ifndef A5O_IPHONE if (input->esc()) return -1; #endif redraw = true; -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE if (switched_out) { redraw = false; } @@ -95,17 +95,17 @@ static int do_gui(const std::vector& widgets, unsigned int selected) al_draw_bitmap(logo, (BB_W-lw)/2, (BB_H-lh)/4, 0); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); -#ifndef ALLEGRO_IPHONE - al_draw_textf(myfont, al_map_rgb(255, 255, 0), BB_W/2, BB_H/2, ALLEGRO_ALIGN_CENTRE, "z/y to start"); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); +#ifndef A5O_IPHONE + al_draw_textf(myfont, al_map_rgb(255, 255, 0), BB_W/2, BB_H/2, A5O_ALIGN_CENTRE, "z/y to start"); #endif - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); for (unsigned int i = 0; i < widgets.size(); i++) { widgets[i]->render(i == selected); } -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE input->draw(); #endif @@ -162,22 +162,22 @@ static void insert_score(char *name, int score) highScores[i].score = score; } -static ALLEGRO_PATH *userResourcePath() +static A5O_PATH *userResourcePath() { -#ifdef ALLEGRO_IPHONE - return al_get_standard_path(ALLEGRO_USER_DOCUMENTS_PATH); +#ifdef A5O_IPHONE + return al_get_standard_path(A5O_USER_DOCUMENTS_PATH); #else - return al_get_standard_path(ALLEGRO_USER_SETTINGS_PATH); + return al_get_standard_path(A5O_USER_SETTINGS_PATH); #endif } static void read_scores(void) { - ALLEGRO_PATH *fn = userResourcePath(); + A5O_PATH *fn = userResourcePath(); - if (al_make_directory(al_path_cstr(fn, ALLEGRO_NATIVE_PATH_SEP))) { + if (al_make_directory(al_path_cstr(fn, A5O_NATIVE_PATH_SEP))) { al_set_path_filename(fn, "scores.cfg"); - ALLEGRO_CONFIG *cfg = al_load_config_file(al_path_cstr(fn, ALLEGRO_NATIVE_PATH_SEP)); + A5O_CONFIG *cfg = al_load_config_file(al_path_cstr(fn, A5O_NATIVE_PATH_SEP)); if (cfg) { for (int i = 0; i < NUM_SCORES; i++) { char name[] = {'n', (char)('0'+i), '\0'}; @@ -203,7 +203,7 @@ static void read_scores(void) static void write_scores(void) { - ALLEGRO_CONFIG *cfg = al_create_config(); + A5O_CONFIG *cfg = al_create_config(); for (int i = 0; i < NUM_SCORES; i++) { char name[] = {'n', (char)('0'+i), '\0'}; char score[] = {'s', (char)('0'+i), '\0'}; @@ -214,9 +214,9 @@ static void write_scores(void) al_set_config_value(cfg, "scores", score, sc); } - ALLEGRO_PATH *fn = userResourcePath(); + A5O_PATH *fn = userResourcePath(); al_set_path_filename(fn, "scores.cfg"); - al_save_config_file(al_path_cstr(fn, ALLEGRO_NATIVE_PATH_SEP), cfg); + al_save_config_file(al_path_cstr(fn, A5O_NATIVE_PATH_SEP), cfg); al_destroy_path(fn); al_destroy_config(cfg); @@ -228,8 +228,8 @@ void do_highscores(int score) ResourceManager& rm = ResourceManager::getInstance(); Input *input = (Input *)rm.getData(RES_INPUT); - ALLEGRO_FONT *sm_font = (ALLEGRO_FONT *)rm.getData(RES_SMALLFONT); - ALLEGRO_FONT *big_font = (ALLEGRO_FONT *)rm.getData(RES_LARGEFONT); + A5O_FONT *sm_font = (A5O_FONT *)rm.getData(RES_SMALLFONT); + A5O_FONT *big_font = (A5O_FONT *)rm.getData(RES_LARGEFONT); bool is_high = score >= highScores[NUM_SCORES-1].score; bool entering = is_high; @@ -243,19 +243,19 @@ void do_highscores(int score) for (;;) { /* Catch close button presses */ - ALLEGRO_EVENT_QUEUE *events = ((DisplayResource *)rm.getResource(RES_DISPLAY))->getEventQueue(); + A5O_EVENT_QUEUE *events = ((DisplayResource *)rm.getResource(RES_DISPLAY))->getEventQueue(); while (!al_is_event_queue_empty(events)) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_get_next_event(events, &event); -#ifdef ALLEGRO_IPHONE - if (event.type == ALLEGRO_EVENT_DISPLAY_HALT_DRAWING || event.type == ALLEGRO_EVENT_DISPLAY_SWITCH_OUT) { - switch_game_out(event.type == ALLEGRO_EVENT_DISPLAY_HALT_DRAWING); +#ifdef A5O_IPHONE + if (event.type == A5O_EVENT_DISPLAY_HALT_DRAWING || event.type == A5O_EVENT_DISPLAY_SWITCH_OUT) { + switch_game_out(event.type == A5O_EVENT_DISPLAY_HALT_DRAWING); } - else if (event.type == ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING || event.type == ALLEGRO_EVENT_DISPLAY_SWITCH_IN) { + else if (event.type == A5O_EVENT_DISPLAY_RESUME_DRAWING || event.type == A5O_EVENT_DISPLAY_SWITCH_IN) { switch_game_in(); } #else - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) + if (event.type == A5O_EVENT_DISPLAY_CLOSE) exit(0); #endif } @@ -308,7 +308,7 @@ void do_highscores(int score) al_rest(0.010); -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE if (switched_out) { continue; } @@ -317,8 +317,8 @@ void do_highscores(int score) al_clear_to_color(al_map_rgb(0, 0, 0)); if (entering) { - float a = ALLEGRO_PI*3/2; - float ainc = ALLEGRO_PI*2 / 26; + float a = A5O_PI*3/2; + float ainc = A5O_PI*2 / 26; double elapsed = al_get_time() - spin_start; if (elapsed < 0.1) { a += (elapsed / 0.1) * ainc * spin_dir; @@ -341,19 +341,19 @@ void do_highscores(int score) for (int i = 0; i < 3 && name[i] != ' '; i++) { tmp[i] = name[i]; } - al_draw_textf(big_font, al_map_rgb(0, 255, 0), BB_W/2, BB_H/2-20, ALLEGRO_ALIGN_CENTRE, "%s", tmp); - al_draw_text(sm_font, al_map_rgb(200, 200, 200), BB_W/2, BB_H/2-20+5+al_get_font_line_height(big_font), ALLEGRO_ALIGN_CENTRE, "high score!"); + al_draw_textf(big_font, al_map_rgb(0, 255, 0), BB_W/2, BB_H/2-20, A5O_ALIGN_CENTRE, "%s", tmp); + al_draw_text(sm_font, al_map_rgb(200, 200, 200), BB_W/2, BB_H/2-20+5+al_get_font_line_height(big_font), A5O_ALIGN_CENTRE, "high score!"); } else { int yy = BB_H/2 - al_get_font_line_height(big_font)*NUM_SCORES/2; for (int i = 0; i < NUM_SCORES; i++) { - al_draw_textf(big_font, al_map_rgb(255, 255, 255), BB_W/2-10, yy, ALLEGRO_ALIGN_RIGHT, "%s", highScores[i].name); - al_draw_textf(big_font, al_map_rgb(255, 255, 0), BB_W/2+10, yy, ALLEGRO_ALIGN_LEFT, "%d", highScores[i].score); + al_draw_textf(big_font, al_map_rgb(255, 255, 255), BB_W/2-10, yy, A5O_ALIGN_RIGHT, "%s", highScores[i].name); + al_draw_textf(big_font, al_map_rgb(255, 255, 0), BB_W/2+10, yy, A5O_ALIGN_LEFT, "%d", highScores[i].score); yy += al_get_font_line_height(big_font); } } -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE input->draw(); #endif diff --git a/demos/cosmic_protector/src/Game.cpp b/demos/cosmic_protector/src/Game.cpp index c0c1edbfc2..75cc790120 100644 --- a/demos/cosmic_protector/src/Game.cpp +++ b/demos/cosmic_protector/src/Game.cpp @@ -2,11 +2,11 @@ #include "cosmic_protector.hpp" #include "joypad_c.h" -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID #include "allegro5/allegro_android.h" #define IS_ANDROID (true) #define IS_MSVC (false) -#elif defined(ALLEGRO_MSVC) +#elif defined(A5O_MSVC) #define IS_ANDROID (false) #define IS_MSVC (true) #define snprintf _snprintf @@ -22,16 +22,16 @@ bool joy_installed = false; * Return the path to user resources (save states, configuration) */ -static ALLEGRO_PATH* getDir() +static A5O_PATH* getDir() { - ALLEGRO_PATH *dir; + A5O_PATH *dir; if (IS_ANDROID) { /* Path within the APK, not normal filesystem. */ dir = al_create_path_for_directory("data"); } else { - dir = al_get_standard_path(ALLEGRO_RESOURCES_PATH); + dir = al_get_standard_path(A5O_RESOURCES_PATH); if (IS_MSVC) { /* Hack to cope automatically with MSVC workspaces. */ const char *last = al_get_path_component(dir, -1); @@ -51,8 +51,8 @@ const char* getResource(const char* fmt, ...) { va_list ap; static char res[512]; - static ALLEGRO_PATH *dir; - static ALLEGRO_PATH *path; + static A5O_PATH *dir; + static A5O_PATH *path; va_start(ap, fmt); memset(res, 0, 512); @@ -139,7 +139,7 @@ bool init(void) al_init_font_addon(); al_init_acodec_addon(); al_init_primitives_addon(); -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID al_android_set_apk_file_interface(); #endif @@ -157,7 +157,7 @@ void done(void) al_stop_samples(); ResourceManager& rm = ResourceManager::getInstance(); for (int i = RES_STREAM_START; i < RES_STREAM_END; i++) { - ALLEGRO_AUDIO_STREAM *s = (ALLEGRO_AUDIO_STREAM *)rm.getData(i); + A5O_AUDIO_STREAM *s = (A5O_AUDIO_STREAM *)rm.getData(i); if (s) al_set_audio_stream_playing(s, false); } diff --git a/demos/cosmic_protector/src/Input.cpp b/demos/cosmic_protector/src/Input.cpp index 71e6573328..2068ab9fcd 100644 --- a/demos/cosmic_protector/src/Input.cpp +++ b/demos/cosmic_protector/src/Input.cpp @@ -1,11 +1,11 @@ #include "cosmic_protector.hpp" #include "joypad_c.h" -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE #include #endif -#ifdef ALLEGRO_MSVC +#ifdef A5O_MSVC /* "forcing value to bool 'true' or 'false' (performance warning)" */ #pragma warning( disable : 4800 ) #endif @@ -13,9 +13,9 @@ Input::Input() : joystick(0) { - memset(&kbdstate, 0, sizeof(ALLEGRO_KEYBOARD_STATE)); - memset(&joystate, 0, sizeof(ALLEGRO_JOYSTICK_STATE)); -#ifdef ALLEGRO_IPHONE + memset(&kbdstate, 0, sizeof(A5O_KEYBOARD_STATE)); + memset(&joystate, 0, sizeof(A5O_JOYSTICK_STATE)); +#ifdef A5O_IPHONE joyaxis0 = 0.0f; joyaxis1 = 0.0f; joyaxis2 = 0.0f; @@ -26,7 +26,7 @@ Input::~Input() { } -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE void Input::draw(void) { if (is_joypad_connected()) @@ -37,8 +37,8 @@ void Input::draw(void) int ybot = y + size; int thick = 35; - ALLEGRO_COLOR tri_color = al_map_rgba_f(0.4, 0.4, 0.4, 0.4); - ALLEGRO_COLOR fire_color = al_map_rgba_f(0.4, 0.1, 0.1, 0.4); + A5O_COLOR tri_color = al_map_rgba_f(0.4, 0.4, 0.4, 0.4); + A5O_COLOR fire_color = al_map_rgba_f(0.4, 0.1, 0.1, 0.4); al_draw_triangle(thick, ymid, size-thick, y+thick, size-thick, ybot-thick, tri_color, thick/4); al_draw_triangle(size*2-thick, ymid, size+thick, y+thick, size+thick, ybot-thick, tri_color, thick/4); @@ -49,7 +49,7 @@ void Input::draw(void) bool Input::button_pressed(int x, int y, int w, int h, bool check_if_controls_at_top) { ResourceManager& rm = ResourceManager::getInstance(); - ALLEGRO_DISPLAY *display = (ALLEGRO_DISPLAY *)rm.getData(RES_DISPLAY); + A5O_DISPLAY *display = (A5O_DISPLAY *)rm.getData(RES_DISPLAY); if (al_get_display_width(display) < 960) { x /= 2; @@ -83,11 +83,11 @@ void Input::poll(void) return; } -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE while (!al_event_queue_is_empty(input_queue)) { - ALLEGRO_EVENT e; + A5O_EVENT e; al_get_next_event(input_queue, &e); - if (e.type == ALLEGRO_EVENT_TOUCH_BEGIN) { + if (e.type == A5O_EVENT_TOUCH_BEGIN) { Touch t; t.id = e.touch.id; t.x = e.touch.x; @@ -95,7 +95,7 @@ void Input::poll(void) int xx = t.x; int yy = t.y; ResourceManager& rm = ResourceManager::getInstance(); - ALLEGRO_DISPLAY *display = (ALLEGRO_DISPLAY *)rm.getData(RES_DISPLAY); + A5O_DISPLAY *display = (A5O_DISPLAY *)rm.getData(RES_DISPLAY); if (al_get_display_width(display) < 960) { xx *= 2; yy *= 2; @@ -110,7 +110,7 @@ void Input::poll(void) } touches.push_back(t); } - else if (e.type == ALLEGRO_EVENT_TOUCH_END) { + else if (e.type == A5O_EVENT_TOUCH_END) { for (size_t i = 0; i < touches.size(); i++) { if (touches[i].id == e.touch.id) { touches.erase(touches.begin() + i); @@ -118,7 +118,7 @@ void Input::poll(void) } } } - else if (e.type == ALLEGRO_EVENT_TOUCH_MOVE) { + else if (e.type == A5O_EVENT_TOUCH_MOVE) { for (size_t i = 0; i < touches.size(); i++) { if (touches[i].id == e.touch.id) { touches[i].x = e.touch.x; @@ -127,7 +127,7 @@ void Input::poll(void) } } } - else if (e.type == ALLEGRO_EVENT_JOYSTICK_AXIS) { + else if (e.type == A5O_EVENT_JOYSTICK_AXIS) { if (e.joystick.axis == 0) { joyaxis0 = e.joystick.pos; } @@ -141,9 +141,9 @@ void Input::poll(void) } #else while (!al_event_queue_is_empty(input_queue)) { - ALLEGRO_EVENT e; + A5O_EVENT e; al_get_next_event(input_queue, &e); - if (e.type == ALLEGRO_EVENT_JOYSTICK_CONFIGURATION) { + if (e.type == A5O_EVENT_JOYSTICK_CONFIGURATION) { al_reconfigure_joysticks(); if (al_get_num_joysticks() <= 0) { joystick = NULL; @@ -168,14 +168,14 @@ float Input::lr(void) return 0; } -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE if (button_pressed(0, BB_H-size, size, size)) return -1; return button_pressed(size, BB_H-size, size, size) ? 1 : 0; #else - if (al_key_down(&kbdstate, ALLEGRO_KEY_LEFT)) + if (al_key_down(&kbdstate, A5O_KEY_LEFT)) return -1.0f; - else if (al_key_down(&kbdstate, ALLEGRO_KEY_RIGHT)) + else if (al_key_down(&kbdstate, A5O_KEY_RIGHT)) return 1.0f; else if (joystick) { float pos = joystate.stick[0].axis[0]; @@ -194,48 +194,48 @@ float Input::ud(void) return 0; } -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE float magnitude = fabs(joyaxis0) + fabs(joyaxis1); if (magnitude < 0.3) return 0; ResourceManager& rm = ResourceManager::getInstance(); Player *player = (Player *)rm.getData(RES_PLAYER); float player_a = player->getAngle(); - ALLEGRO_DISPLAY *display = (ALLEGRO_DISPLAY *)rm.getData(RES_DISPLAY); - if (al_get_display_orientation(display) == ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES) - player_a = player_a - ALLEGRO_PI; + A5O_DISPLAY *display = (A5O_DISPLAY *)rm.getData(RES_DISPLAY); + if (al_get_display_orientation(display) == A5O_DISPLAY_ORIENTATION_90_DEGREES) + player_a = player_a - A5O_PI; - while (player_a < 0) player_a += ALLEGRO_PI*2; - while (player_a > ALLEGRO_PI*2) player_a -= ALLEGRO_PI*2; + while (player_a < 0) player_a += A5O_PI*2; + while (player_a > A5O_PI*2) player_a -= A5O_PI*2; float device_a = atan2(-joyaxis0, -joyaxis1); - if (device_a < 0) device_a += ALLEGRO_PI*2; + if (device_a < 0) device_a += A5O_PI*2; float ab = fabs(player_a - device_a); - if (ab < ALLEGRO_PI/4) + if (ab < A5O_PI/4) return -1; // brake against velocity vector float vel_a, dx, dy; player->getSpeed(&dx, &dy); vel_a = atan2(dy, dx); - vel_a -= ALLEGRO_PI; - if (al_get_display_orientation(display) == ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES) - vel_a = vel_a - ALLEGRO_PI; + vel_a -= A5O_PI; + if (al_get_display_orientation(display) == A5O_DISPLAY_ORIENTATION_90_DEGREES) + vel_a = vel_a - A5O_PI; - while (vel_a < 0) vel_a += ALLEGRO_PI*2; - while (vel_a > ALLEGRO_PI*2) vel_a -= ALLEGRO_PI*2; + while (vel_a < 0) vel_a += A5O_PI*2; + while (vel_a > A5O_PI*2) vel_a -= A5O_PI*2; ab = fabs(vel_a - device_a); - if (ab < ALLEGRO_PI/4) + if (ab < A5O_PI/4) return 1; return 0; #else - if (al_key_down(&kbdstate, ALLEGRO_KEY_UP)) + if (al_key_down(&kbdstate, A5O_KEY_UP)) return -1.0f; - else if (al_key_down(&kbdstate, ALLEGRO_KEY_DOWN)) + else if (al_key_down(&kbdstate, A5O_KEY_DOWN)) return 1.0f; else if (joystick) { float pos = joystate.stick[0].axis[1]; @@ -252,7 +252,7 @@ bool Input::esc(void) return joypad_esc; } - if (al_key_down(&kbdstate, ALLEGRO_KEY_ESCAPE)) + if (al_key_down(&kbdstate, A5O_KEY_ESCAPE)) return true; else if (joystick) return joystate.button[1]; @@ -266,10 +266,10 @@ bool Input::b1(void) return joypad_b; } -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE return button_pressed(BB_W-size, BB_H-size, size, size) ? 1 : 0; #else - if (al_key_down(&kbdstate, ALLEGRO_KEY_Z) || al_key_down(&kbdstate, ALLEGRO_KEY_Y)) + if (al_key_down(&kbdstate, A5O_KEY_Z) || al_key_down(&kbdstate, A5O_KEY_Y)) return true; else if (joystick) return joystate.button[0]; @@ -280,8 +280,8 @@ bool Input::b1(void) bool Input::cheat(void) { - if (al_key_down(&kbdstate, ALLEGRO_KEY_LSHIFT) - && al_key_down(&kbdstate, ALLEGRO_KEY_EQUALS)) + if (al_key_down(&kbdstate, A5O_KEY_LSHIFT) + && al_key_down(&kbdstate, A5O_KEY_EQUALS)) return true; else return false; @@ -294,7 +294,7 @@ void Input::destroy(void) bool Input::load(void) { input_queue = al_create_event_queue(); -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE al_install_touch_input(); al_register_event_source(input_queue, al_get_touch_input_event_source()); controls_at_top = false; @@ -317,7 +317,7 @@ bool Input::load(void) if (joystick) al_register_event_source(input_queue, al_get_joystick_event_source()); -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE return true; #else return kb_installed || joystick; diff --git a/demos/cosmic_protector/src/LargeBullet.cpp b/demos/cosmic_protector/src/LargeBullet.cpp index 316eba3316..6f7cdaf25f 100644 --- a/demos/cosmic_protector/src/LargeBullet.cpp +++ b/demos/cosmic_protector/src/LargeBullet.cpp @@ -3,7 +3,7 @@ void LargeBullet::render(int offx, int offy) { al_draw_rotated_bitmap(bitmap, radius, radius, offx + x, offy + y, - angle+(ALLEGRO_PI/2), 0); + angle+(A5O_PI/2), 0); } LargeBullet::LargeBullet(float x, float y, float angle, Entity *shooter) : diff --git a/demos/cosmic_protector/src/Player.cpp b/demos/cosmic_protector/src/Player.cpp index ed536b729a..ead1cb8fdf 100644 --- a/demos/cosmic_protector/src/Player.cpp +++ b/demos/cosmic_protector/src/Player.cpp @@ -139,17 +139,17 @@ void Player::render_extra(void) return; } - ALLEGRO_STATE st; - al_store_state(&st, ALLEGRO_STATE_BLENDER); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + A5O_STATE st; + al_store_state(&st, A5O_STATE_BLENDER); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE); al_draw_bitmap(icon, 1, 2, 0); al_restore_state(&st); - ALLEGRO_FONT *small_font = (ALLEGRO_FONT *)rm.getData(RES_SMALLFONT); + A5O_FONT *small_font = (A5O_FONT *)rm.getData(RES_SMALLFONT); al_draw_textf(small_font, al_map_rgb(255, 255, 255), 20, 2, 0, "x%d", lives); al_draw_textf(small_font, al_map_rgb(255, 255, 255), 2, 18, 0, "%d", score); } -void Player::render(int offx, int offy, ALLEGRO_COLOR tint) +void Player::render(int offx, int offy, A5O_COLOR tint) { if (lives <= 0) return; @@ -159,23 +159,23 @@ void Player::render(int offx, int offy, ALLEGRO_COLOR tint) if (!isDestructable) { al_draw_tinted_rotated_bitmap(trans_bitmap, tint, draw_radius, draw_radius, rx, ry, - angle+(ALLEGRO_PI/2.0f), 0); + angle+(A5O_PI/2.0f), 0); } else { al_draw_tinted_rotated_bitmap(bitmap, tint, draw_radius, draw_radius, rx, ry, - angle+(ALLEGRO_PI/2.0f), 0); + angle+(A5O_PI/2.0f), 0); } if (draw_trail) { int tw = al_get_bitmap_width(trail_bitmap); int th = al_get_bitmap_height(trail_bitmap); - float ca = (ALLEGRO_PI*2)+angle; - float a = ca + ((210.0f / 180.0f) * ALLEGRO_PI); + float ca = (A5O_PI*2)+angle; + float a = ca + ((210.0f / 180.0f) * A5O_PI); float tx = rx + 42.0f * cos(a); float ty = ry + 42.0f * sin(a); al_draw_tinted_rotated_bitmap(trail_bitmap, tint, tw, th/2, tx, ty, a, 0); - a = ca + ((150.0f / 180.0f) * ALLEGRO_PI); + a = ca + ((150.0f / 180.0f) * A5O_PI); tx = rx + 42.0f * cos(a); ty = ry + 42.0f * sin(a); al_draw_tinted_rotated_bitmap(trail_bitmap, tint, tw, th/2, @@ -227,8 +227,8 @@ void Player::destroy(void) bool Player::load(void) { - ALLEGRO_STATE state; - al_store_state(&state, ALLEGRO_STATE_TARGET_BITMAP | ALLEGRO_STATE_BLENDER); + A5O_STATE state; + al_store_state(&state, A5O_STATE_TARGET_BITMAP | A5O_STATE_BLENDER); bitmap = al_load_bitmap(getResource("gfx/ship.png")); if (!bitmap) { @@ -246,7 +246,7 @@ bool Player::load(void) /* Make a translucent copy of the ship */ al_set_target_bitmap(trans_bitmap); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_draw_tinted_bitmap(bitmap, al_map_rgba(255, 255, 255, 160), 0, 0, 0); al_restore_state(&state); @@ -302,7 +302,7 @@ void Player::reset(void) y = BB_H/2; dx = 0; dy = 0; - angle = -ALLEGRO_PI/2; + angle = -A5O_PI/2; draw_trail = false; weapon = WEAPON_SMALL; } @@ -317,15 +317,15 @@ void Player::die(void) // game over isDestructable = false; invincibleCount = 8000; - ALLEGRO_BITMAP *old_target = al_get_target_bitmap(); + A5O_BITMAP *old_target = al_get_target_bitmap(); al_set_target_bitmap(highscoreBitmap); int w = al_get_bitmap_width(highscoreBitmap); int h = al_get_bitmap_height(highscoreBitmap); ResourceManager& rm = ResourceManager::getInstance(); - ALLEGRO_FONT *large_font = (ALLEGRO_FONT *)rm.getData(RES_LARGEFONT); - ALLEGRO_FONT *small_font = (ALLEGRO_FONT *)rm.getData(RES_SMALLFONT); - al_draw_textf(large_font, al_map_rgb(255, 255, 255), w/2, h/2-16, ALLEGRO_ALIGN_CENTRE, "GAME OVER"); - al_draw_textf(small_font, al_map_rgb(255, 255, 255), w/2, h/2+16, ALLEGRO_ALIGN_CENTRE, "%d Points", score); + A5O_FONT *large_font = (A5O_FONT *)rm.getData(RES_LARGEFONT); + A5O_FONT *small_font = (A5O_FONT *)rm.getData(RES_SMALLFONT); + al_draw_textf(large_font, al_map_rgb(255, 255, 255), w/2, h/2-16, A5O_ALIGN_CENTRE, "GAME OVER"); + al_draw_textf(small_font, al_map_rgb(255, 255, 255), w/2, h/2+16, A5O_ALIGN_CENTRE, "%d Points", score); al_set_target_bitmap(old_target); } else { diff --git a/demos/cosmic_protector/src/PowerUp.cpp b/demos/cosmic_protector/src/PowerUp.cpp index 683b612529..a007f5508d 100644 --- a/demos/cosmic_protector/src/PowerUp.cpp +++ b/demos/cosmic_protector/src/PowerUp.cpp @@ -48,11 +48,11 @@ PowerUp::PowerUp(float x, float y, int type) : switch (type) { case POWERUP_LIFE: - bitmap = (ALLEGRO_BITMAP *)rm.getData(RES_LIFEPOWERUP); + bitmap = (A5O_BITMAP *)rm.getData(RES_LIFEPOWERUP); break; default: type = POWERUP_WEAPON; - bitmap = (ALLEGRO_BITMAP *)rm.getData(RES_WEAPONPOWERUP); + bitmap = (A5O_BITMAP *)rm.getData(RES_WEAPONPOWERUP); break; } } diff --git a/demos/cosmic_protector/src/StreamResource.cpp b/demos/cosmic_protector/src/StreamResource.cpp index c5f45f7d32..ca0ce397a9 100644 --- a/demos/cosmic_protector/src/StreamResource.cpp +++ b/demos/cosmic_protector/src/StreamResource.cpp @@ -22,7 +22,7 @@ bool StreamResource::load(void) } al_set_audio_stream_playing(stream, false); - al_set_audio_stream_playmode(stream, ALLEGRO_PLAYMODE_LOOP); + al_set_audio_stream_playmode(stream, A5O_PLAYMODE_LOOP); al_attach_audio_stream_to_mixer(stream, al_get_default_mixer()); return true; diff --git a/demos/cosmic_protector/src/UFO.cpp b/demos/cosmic_protector/src/UFO.cpp index d756353599..d72745c725 100644 --- a/demos/cosmic_protector/src/UFO.cpp +++ b/demos/cosmic_protector/src/UFO.cpp @@ -47,7 +47,7 @@ void UFO::render(int offx, int offy) render(offx, offy, al_map_rgb(255, 255, 255)); } -void UFO::render(int offx, int offy, ALLEGRO_COLOR tint) +void UFO::render(int offx, int offy, A5O_COLOR tint) { al_draw_tinted_rotated_bitmap(bitmaps[bitmapFrame], tint, radius, radius, offx + x, offy + y, 0.0f, 0); @@ -70,9 +70,9 @@ UFO::UFO(float x, float y, float speed_x, float speed_y) : nextShot = (int)(al_get_time() * 1000.0) + SHOT_SPEED; ResourceManager& rm = ResourceManager::getInstance(); - bitmaps[0] = (ALLEGRO_BITMAP *)rm.getData(RES_UFO0); - bitmaps[1] = (ALLEGRO_BITMAP *)rm.getData(RES_UFO1); - bitmaps[2] = (ALLEGRO_BITMAP *)rm.getData(RES_UFO2); + bitmaps[0] = (A5O_BITMAP *)rm.getData(RES_UFO0); + bitmaps[1] = (A5O_BITMAP *)rm.getData(RES_UFO1); + bitmaps[2] = (A5O_BITMAP *)rm.getData(RES_UFO2); bitmapFrame = 0; bitmapFrameCount = ANIMATION_SPEED; } diff --git a/demos/cosmic_protector/src/cosmic_protector.cpp b/demos/cosmic_protector/src/cosmic_protector.cpp index 5715a6aaf4..69222d1ad7 100644 --- a/demos/cosmic_protector/src/cosmic_protector.cpp +++ b/demos/cosmic_protector/src/cosmic_protector.cpp @@ -1,10 +1,10 @@ #include "cosmic_protector.hpp" #include "joypad_c.h" -ALLEGRO_VOICE *voice; -ALLEGRO_MIXER *mixer; +A5O_VOICE *voice; +A5O_MIXER *mixer; -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE #include "cosmic_protector_objc.h" #endif @@ -68,8 +68,8 @@ int main(int argc, char **argv) ResourceManager& rm = ResourceManager::getInstance(); Player *player = (Player *)rm.getData(RES_PLAYER); - ALLEGRO_AUDIO_STREAM *title_music = (ALLEGRO_AUDIO_STREAM *)rm.getData(RES_TITLE_MUSIC); - ALLEGRO_AUDIO_STREAM *game_music = (ALLEGRO_AUDIO_STREAM *)rm.getData(RES_GAME_MUSIC); + A5O_AUDIO_STREAM *title_music = (A5O_AUDIO_STREAM *)rm.getData(RES_TITLE_MUSIC); + A5O_AUDIO_STREAM *game_music = (A5O_AUDIO_STREAM *)rm.getData(RES_GAME_MUSIC); for (;;) { if (title_music) { @@ -99,9 +99,9 @@ int main(int argc, char **argv) joypad_stop_finding(); - ALLEGRO_DISPLAY *display = (ALLEGRO_DISPLAY *)rm.getData(RES_DISPLAY); + A5O_DISPLAY *display = (A5O_DISPLAY *)rm.getData(RES_DISPLAY); int o = al_get_display_orientation(display); - al_set_display_option(display, ALLEGRO_SUPPORTED_ORIENTATIONS, o); + al_set_display_option(display, A5O_SUPPORTED_ORIENTATIONS, o); if (game_music) { al_set_audio_stream_playing(game_music, true); @@ -117,14 +117,14 @@ int main(int argc, char **argv) al_rewind_audio_stream(game_music); } - al_set_display_option(display, ALLEGRO_SUPPORTED_ORIENTATIONS, ALLEGRO_DISPLAY_ORIENTATION_LANDSCAPE); + al_set_display_option(display, A5O_SUPPORTED_ORIENTATIONS, A5O_DISPLAY_ORIENTATION_LANDSCAPE); } return 0; } -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE void switch_game_out(bool halt) { if (!isMultitaskingSupported()) { @@ -132,7 +132,7 @@ void switch_game_out(bool halt) } if (halt) { ResourceManager& rm = ResourceManager::getInstance(); - ALLEGRO_DISPLAY *display = (ALLEGRO_DISPLAY *)rm.getData(RES_DISPLAY); + A5O_DISPLAY *display = (A5O_DISPLAY *)rm.getData(RES_DISPLAY); al_acknowledge_drawing_halt(display); } switched_out = true; diff --git a/demos/cosmic_protector/src/cosmic_protector_objc.m b/demos/cosmic_protector/src/cosmic_protector_objc.m index cc01725ddc..ccf8099463 100644 --- a/demos/cosmic_protector/src/cosmic_protector_objc.m +++ b/demos/cosmic_protector/src/cosmic_protector_objc.m @@ -1,6 +1,6 @@ #include -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE #import #import diff --git a/demos/cosmic_protector/src/logic.cpp b/demos/cosmic_protector/src/logic.cpp index 6c420d1a36..f10d37a503 100644 --- a/demos/cosmic_protector/src/logic.cpp +++ b/demos/cosmic_protector/src/logic.cpp @@ -49,19 +49,19 @@ bool logic(int step) return false; /* Catch close button presses */ - ALLEGRO_EVENT_QUEUE *events = ((DisplayResource *)rm.getResource(RES_DISPLAY))->getEventQueue(); + A5O_EVENT_QUEUE *events = ((DisplayResource *)rm.getResource(RES_DISPLAY))->getEventQueue(); while (!al_is_event_queue_empty(events)) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_get_next_event(events, &event); -#ifdef ALLEGRO_IPHONE - if (event.type == ALLEGRO_EVENT_DISPLAY_HALT_DRAWING || event.type == ALLEGRO_EVENT_DISPLAY_SWITCH_OUT) { - switch_game_out(event.type == ALLEGRO_EVENT_DISPLAY_HALT_DRAWING); +#ifdef A5O_IPHONE + if (event.type == A5O_EVENT_DISPLAY_HALT_DRAWING || event.type == A5O_EVENT_DISPLAY_SWITCH_OUT) { + switch_game_out(event.type == A5O_EVENT_DISPLAY_HALT_DRAWING); } - else if (event.type == ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING || event.type == ALLEGRO_EVENT_DISPLAY_SWITCH_IN) { + else if (event.type == A5O_EVENT_DISPLAY_RESUME_DRAWING || event.type == A5O_EVENT_DISPLAY_SWITCH_IN) { switch_game_in(); } #else - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) + if (event.type == A5O_EVENT_DISPLAY_CLOSE) exit(0); #endif } diff --git a/demos/cosmic_protector/src/render.cpp b/demos/cosmic_protector/src/render.cpp index b0d74e2c23..9094236c95 100644 --- a/demos/cosmic_protector/src/render.cpp +++ b/demos/cosmic_protector/src/render.cpp @@ -3,7 +3,7 @@ #include static float waveAngle = 0.0f; -static ALLEGRO_BITMAP *waveBitmap = 0; +static A5O_BITMAP *waveBitmap = 0; static float bgx = 0; static float bgy = 0; static int shakeUpdateCount = 0; @@ -16,7 +16,7 @@ static void renderWave(void) int w = al_get_bitmap_width(waveBitmap); int h = al_get_bitmap_height(waveBitmap); - float a = waveAngle + ALLEGRO_PI/2; + float a = waveAngle + A5O_PI/2; int x = (int)(BB_W/2 + 64*cos(a)); int y = (int)(BB_H/2 + 64*sin(a)); @@ -39,7 +39,7 @@ void showWave(int num) ResourceManager& rm = ResourceManager::getInstance(); - ALLEGRO_FONT *myfont = (ALLEGRO_FONT *)rm.getData(RES_LARGEFONT); + A5O_FONT *myfont = (A5O_FONT *)rm.getData(RES_LARGEFONT); char text[20]; sprintf(text, "WAVE %d", num); @@ -48,13 +48,13 @@ void showWave(int num) int h = al_get_font_line_height(myfont); waveBitmap = al_create_bitmap(w, h); - ALLEGRO_BITMAP *old_target = al_get_target_bitmap(); + A5O_BITMAP *old_target = al_get_target_bitmap(); al_set_target_bitmap(waveBitmap); al_clear_to_color(al_map_rgba(0, 0, 0, 0)); al_draw_textf(myfont, al_map_rgb(255, 255, 255), 0, 0, 0, "%s", text); al_set_target_bitmap(old_target); - waveAngle = (ALLEGRO_PI*2); + waveAngle = (A5O_PI*2); } void shake(void) @@ -68,14 +68,14 @@ void shake(void) void render(int step) { -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE if (switched_out) return; #endif ResourceManager& rm = ResourceManager::getInstance(); - ALLEGRO_BITMAP *bg = (ALLEGRO_BITMAP *)rm.getData(RES_BACKGROUND); + A5O_BITMAP *bg = (A5O_BITMAP *)rm.getData(RES_BACKGROUND); if (shakeUpdateCount > 0) { shakeUpdateCount -= step; @@ -107,9 +107,9 @@ void render(int step) Entity *e = *it; e->render_four(al_map_rgb(255, 255, 255)); if (e->isHighlighted()) { - al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ALPHA, A5O_ONE); e->render_four(al_map_rgb(150, 150, 150)); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); } } @@ -125,7 +125,7 @@ void render(int step) } } -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE Input *input = (Input *)rm.getData(RES_INPUT); input->draw(); diff --git a/demos/cosmic_protector/src/sound.cpp b/demos/cosmic_protector/src/sound.cpp index 9f510ec4a2..055d46b01a 100644 --- a/demos/cosmic_protector/src/sound.cpp +++ b/demos/cosmic_protector/src/sound.cpp @@ -4,9 +4,9 @@ void my_play_sample(int resourceID) { ResourceManager &rm = ResourceManager::getInstance(); - ALLEGRO_SAMPLE *s = (ALLEGRO_SAMPLE *)rm.getData(resourceID); + A5O_SAMPLE *s = (A5O_SAMPLE *)rm.getData(resourceID); if (s) { - al_play_sample(s, 1.0, 0.0, 1.0, ALLEGRO_PLAYMODE_ONCE, NULL); + al_play_sample(s, 1.0, 0.0, 1.0, A5O_PLAYMODE_ONCE, NULL); } } diff --git a/demos/shooter/CMakeLists.txt b/demos/shooter/CMakeLists.txt index 8c6e1a22b6..9bd7aa5707 100644 --- a/demos/shooter/CMakeLists.txt +++ b/demos/shooter/CMakeLists.txt @@ -83,7 +83,7 @@ fix_executable(shooter) if(WANT_MONOLITH) target_link_libraries(shooter - ${ALLEGRO_MONOLITH_LINK_WITH} + ${A5O_MONOLITH_LINK_WITH} ) else(WANT_MONOLITH) target_link_libraries(shooter @@ -91,14 +91,14 @@ else(WANT_MONOLITH) ${AUDIO_LINK_WITH} ${FONT_LINK_WITH} ${IMAGE_LINK_WITH} - ${ALLEGRO_MAIN_LINK_WITH} + ${A5O_MAIN_LINK_WITH} ${PRIMITIVES_LINK_WITH} ${TTF_LINK_WITH} ) endif(WANT_MONOLITH) if(NOT BUILD_SHARED_LIBS) - set_target_properties(shooter PROPERTIES COMPILE_FLAGS "-DALLEGRO_STATICLINK") + set_target_properties(shooter PROPERTIES COMPILE_FLAGS "-DA5O_STATICLINK") endif(NOT BUILD_SHARED_LIBS) # Mac OS X bundle support. diff --git a/demos/shooter/data.c b/demos/shooter/data.c index af07006e03..e24a19c5d0 100644 --- a/demos/shooter/data.c +++ b/demos/shooter/data.c @@ -86,7 +86,7 @@ char const *names[] = { int title_pal[]; int game_pal[]; -ALLEGRO_BITMAP *ast; +A5O_BITMAP *ast; static PALETTE *_make_pal(int *pal) { PALETTE *p = al_calloc(1, sizeof *p); diff --git a/demos/shooter/data/text.ini b/demos/shooter/data/text.ini index 8f04449a38..812f547b93 100644 --- a/demos/shooter/data/text.ini +++ b/demos/shooter/data/text.ini @@ -1035,7 +1035,7 @@ 137=Daniel Nilsson 137_0=Enlarged the starfield in exstars, and fixed an incorrect range in exlights. 138=Daniel Schlyder -138_0=Fixed problems with get_executable_name() under Windows, another one with set_window_title() under BeOS, potentially unsafe constructs in the Windows code, the installall makefile target under Windows, added set_allegro_resource_path(), fixed make uninstall with mingw make, added ALLEGRO_LIB_BUILD flag for gcc variants not using configure, fixed a bunch of warnings in MinGW and did plenty of other things too. +138_0=Fixed problems with get_executable_name() under Windows, another one with set_window_title() under BeOS, potentially unsafe constructs in the Windows code, the installall makefile target under Windows, added set_allegro_resource_path(), fixed make uninstall with mingw make, added A5O_LIB_BUILD flag for gcc variants not using configure, fixed a bunch of warnings in MinGW and did plenty of other things too. 139=Dark Nation 139_0=Restored support for old-style encrypted packfiles, which had been removed in 4.1.18. 140=David A. Capello diff --git a/demos/shooter/demo.c b/demos/shooter/demo.c index 0c6985b8ae..e879db33d4 100644 --- a/demos/shooter/demo.c +++ b/demos/shooter/demo.c @@ -12,7 +12,7 @@ int jumpstart = FALSE; int max_fps = FALSE; PALETTE *palette; -ALLEGRO_COLOR get_palette(int p) { +A5O_COLOR get_palette(int p) { if (!palette) return makecol(0, 0, 0); return palette->rgb[p]; } @@ -25,7 +25,7 @@ void set_palette(PALETTE *p) { void fade_out(int skip) { - ALLEGRO_BITMAP *capture = al_create_bitmap(SCREEN_W, SCREEN_H); + A5O_BITMAP *capture = al_create_bitmap(SCREEN_W, SCREEN_H); al_set_target_bitmap(capture); al_draw_bitmap(al_get_backbuffer(screen), 0, 0, 0); al_set_target_backbuffer(screen); @@ -35,7 +35,7 @@ void fade_out(int skip) double t0 = al_get_time(); for (int i = 0; i < steps; i++) { al_rest(t0 + (i + 1) / 120.0 - al_get_time()); - ALLEGRO_COLOR fade = al_map_rgba_f(0, 0, 0, 1.0 * (i + 1) / steps); + A5O_COLOR fade = al_map_rgba_f(0, 0, 0, 1.0 * (i + 1) / steps); al_draw_bitmap(capture, 0, 0, 0); al_draw_filled_rectangle(0, 0, SCREEN_W, SCREEN_H, fade); al_flip_display(); @@ -83,12 +83,12 @@ int main(int argc, char *argv[]) if (!allegro_init()) return 1; - ALLEGRO_MONITOR_INFO info; + A5O_MONITOR_INFO info; al_get_monitor_info(0, &info); w = (info.x2 - info.x1) * 0.75; h = (info.y2 - info.y1) * 0.75; - al_set_new_display_flags(ALLEGRO_RESIZABLE); + al_set_new_display_flags(A5O_RESIZABLE); screen = al_create_display(w, h); if (!screen) { allegro_message("Error setting graphics mode\n"); diff --git a/demos/shooter/demo.h b/demos/shooter/demo.h index 986ebeaf3e..6bc57d1c02 100644 --- a/demos/shooter/demo.h +++ b/demos/shooter/demo.h @@ -1,7 +1,7 @@ #ifndef DEMO_H_INCLUDED #define DEMO_H_INCLUDED -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include #include @@ -20,15 +20,15 @@ extern int cheat; typedef struct PALETTE PALETTE; #define PAL_SIZE 256 struct PALETTE { - ALLEGRO_COLOR rgb[PAL_SIZE]; + A5O_COLOR rgb[PAL_SIZE]; }; -typedef ALLEGRO_FONT FONT; -typedef ALLEGRO_SAMPLE SAMPLE; +typedef A5O_FONT FONT; +typedef A5O_SAMPLE SAMPLE; #define SCREEN_W (al_get_display_width(al_get_current_display())) #define SCREEN_H (al_get_display_height(al_get_current_display())) -ALLEGRO_COLOR get_palette(int p); +A5O_COLOR get_palette(int p); void set_palette(PALETTE *p); void fade_out(int divider); diff --git a/demos/shooter/expl.c b/demos/shooter/expl.c index e5153dfb27..b3302963e5 100644 --- a/demos/shooter/expl.c +++ b/demos/shooter/expl.c @@ -49,7 +49,7 @@ void generate_explosions(void) } explosion[c] = al_create_bitmap(EXPLODE_SIZE, EXPLODE_SIZE); - ALLEGRO_LOCKED_REGION *locked = al_lock_bitmap(explosion[c], ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, ALLEGRO_LOCK_WRITEONLY); + A5O_LOCKED_REGION *locked = al_lock_bitmap(explosion[c], A5O_PIXEL_FORMAT_ABGR_8888_LE, A5O_LOCK_WRITEONLY); PALETTE *pal = data[GAME_PAL].dat; for (x = 0; x < EXPLODE_SIZE; x++) { diff --git a/demos/shooter/game.c b/demos/shooter/game.c index 0e3ce21e8c..1893f1c4cc 100644 --- a/demos/shooter/game.c +++ b/demos/shooter/game.c @@ -26,7 +26,7 @@ static volatile unsigned int game_time; static unsigned int prev_bullet_time; static int new_asteroid_time; static int score_pos; -static ALLEGRO_SAMPLE_ID engine; +static A5O_SAMPLE_ID engine; #define MAX_SPEED 32 @@ -86,12 +86,12 @@ static void move_everyone(void) } else { if (skip_count <= 0) { - if ((key[ALLEGRO_KEY_LEFT])) { // || (joy[0].stick[0].axis[0].d1)) { + if ((key[A5O_KEY_LEFT])) { // || (joy[0].stick[0].axis[0].d1)) { /* moving left */ if (xspeed > -MAX_SPEED) xspeed -= 2; } - else if ((key[ALLEGRO_KEY_RIGHT])) { // || (joy[0].stick[0].axis[0].d2)) { + else if ((key[A5O_KEY_RIGHT])) { // || (joy[0].stick[0].axis[0].d2)) { /* moving right */ if (xspeed < MAX_SPEED) xspeed += 2; @@ -129,17 +129,17 @@ static void move_everyone(void) } if (skip_count <= 0) { - if ((key[ALLEGRO_KEY_UP])) { // || (joy[0].stick[0].axis[1].d1)) { + if ((key[A5O_KEY_UP])) { // || (joy[0].stick[0].axis[1].d1)) { /* firing thrusters */ if (yspeed < MAX_SPEED) { if (yspeed == 0) { al_stop_sample(&engine); al_play_sample(data[ENGINE_SPL].dat, 0.9, -1 + 2 * PAN(player_x_pos >> SPEED_SHIFT) / 255.0, - 1.0, ALLEGRO_PLAYMODE_LOOP, &engine); + 1.0, A5O_PLAYMODE_LOOP, &engine); } else { /* fade in sample while speeding up */ - ALLEGRO_SAMPLE_INSTANCE *si = al_lock_sample_id(&engine); + A5O_SAMPLE_INSTANCE *si = al_lock_sample_id(&engine); al_set_sample_instance_gain(si, yspeed * 64 / MAX_SPEED / 255.0); al_set_sample_instance_pan(si, -1 + 2 * PAN(player_x_pos >> SPEED_SHIFT) / 255.0); al_unlock_sample_id(&engine); @@ -148,7 +148,7 @@ static void move_everyone(void) } else { /* adjust pan while the sample is looping */ - ALLEGRO_SAMPLE_INSTANCE *si = al_lock_sample_id(&engine); + A5O_SAMPLE_INSTANCE *si = al_lock_sample_id(&engine); al_set_sample_instance_gain(si, 64 / 255.0); al_set_sample_instance_pan(si, -1 + 2 * PAN(player_x_pos >> SPEED_SHIFT) / 255.0); al_unlock_sample_id(&engine); @@ -166,7 +166,7 @@ static void move_everyone(void) } else { /* fade out and reduce frequency when slowing down */ - ALLEGRO_SAMPLE_INSTANCE *si = al_lock_sample_id(&engine); + A5O_SAMPLE_INSTANCE *si = al_lock_sample_id(&engine); al_set_sample_instance_gain(si, yspeed * 64 / MAX_SPEED / 255.0); al_set_sample_instance_pan(si, -1 + 2 * PAN(player_x_pos >> SPEED_SHIFT) / 255.0); al_set_sample_instance_speed(si, (500 + yspeed * 500 / MAX_SPEED) / 1000.0); @@ -201,7 +201,7 @@ static void move_everyone(void) /* fire bullet? */ if (!player_hit) { - if ((key[ALLEGRO_KEY_SPACE] || key[ALLEGRO_KEY_ENTER] || key[ALLEGRO_KEY_LCTRL] || key[ALLEGRO_KEY_RCTRL])) { + if ((key[A5O_KEY_SPACE] || key[A5O_KEY_ENTER] || key[A5O_KEY_LCTRL] || key[A5O_KEY_RCTRL])) { // ||(joy[0].button[0].b) || (joy[0].button[1].b)) { if (prev_bullet_time + BULLET_DELAY < game_time) { bullet = add_bullet((player_x_pos >> SPEED_SHIFT) - 2, SCREEN_H - 64); @@ -293,9 +293,9 @@ static void move_score(void) static void draw_score(void) { - ALLEGRO_TRANSFORM tr; + A5O_TRANSFORM tr; al_identity_transform(&tr); - al_rotate_transform(&tr, score_pos * ALLEGRO_PI / 300); + al_rotate_transform(&tr, score_pos * A5O_PI / 300); al_translate_transform(&tr, score_pos, score_pos); al_use_transform(&tr); textout_centre(data[END_FONT].dat, "GAME OVER", 0, -24, get_palette(2)); @@ -441,7 +441,7 @@ void play_game(void) poll_input(); - if (key[ALLEGRO_KEY_ESCAPE] || (dead && ( + if (key[A5O_KEY_ESCAPE] || (dead && ( keypressed()))) // || joy[0].button[0].b || joy[0].button[1].b))) esc = TRUE; } @@ -455,7 +455,7 @@ void play_game(void) if (esc) { do { poll_input(); - } while (key[ALLEGRO_KEY_ESCAPE]); + } while (key[A5O_KEY_ESCAPE]); fade_out(5); return; diff --git a/demos/shooter/title.c b/demos/shooter/title.c index 5125e72b44..6a784ee6bb 100644 --- a/demos/shooter/title.c +++ b/demos/shooter/title.c @@ -46,7 +46,7 @@ static int text_width; CREDIT_NAME *credit_name = NULL; static CREDIT_NAME *credits = NULL; -static ALLEGRO_CONFIG *text; +static A5O_CONFIG *text; /* reads credit info from various places */ diff --git a/demos/skater/CMakeLists.txt b/demos/skater/CMakeLists.txt index bf1115da33..a47b974c4f 100644 --- a/demos/skater/CMakeLists.txt +++ b/demos/skater/CMakeLists.txt @@ -96,7 +96,7 @@ fix_executable(skater) if(WANT_MONOLITH) target_link_libraries(skater - ${ALLEGRO_MONOLITH_LINK_WITH} + ${A5O_MONOLITH_LINK_WITH} ) else(WANT_MONOLITH) target_link_libraries(skater @@ -104,13 +104,13 @@ else(WANT_MONOLITH) ${AUDIO_LINK_WITH} ${FONT_LINK_WITH} ${IMAGE_LINK_WITH} - ${ALLEGRO_MAIN_LINK_WITH} + ${A5O_MAIN_LINK_WITH} ${PRIMITIVES_LINK_WITH} ) endif(WANT_MONOLITH) if(NOT BUILD_SHARED_LIBS) - set_target_properties(skater PROPERTIES COMPILE_FLAGS "-DALLEGRO_STATICLINK") + set_target_properties(skater PROPERTIES COMPILE_FLAGS "-DA5O_STATICLINK") endif(NOT BUILD_SHARED_LIBS) # Mac OS X bundle support. diff --git a/demos/skater/data/thanks.txt b/demos/skater/data/thanks.txt index fabac8fdd8..0adf1d677c 100644 --- a/demos/skater/data/thanks.txt +++ b/demos/skater/data/thanks.txt @@ -207,7 +207,7 @@ Contributors set_window_title() under BeOS, potentially unsafe constructs in the Windows code, the installall makefile target under Windows, added set_allegro_resource_path(), fixed make uninstall with mingw make, - added ALLEGRO_LIB_BUILD flag for gcc variants not using configure, + added A5O_LIB_BUILD flag for gcc variants not using configure, fixed a bunch of warnings in MinGW and did plenty of other things too. Daniel Verkamp (i_am_drv@users.sourceforge.net).
diff --git a/demos/skater/src/anim.c b/demos/skater/src/anim.c index 2ff483ea72..29a18f338f 100644 --- a/demos/skater/src/anim.c +++ b/demos/skater/src/anim.c @@ -8,7 +8,7 @@ double LastSpeedStore = 0, LastSpeed; int OnLand; -ALLEGRO_BITMAP *GetCurrentBitmap(struct Animation *Anim) +A5O_BITMAP *GetCurrentBitmap(struct Animation *Anim) { LastSpeedStore = LastSpeed; if (Anim->SkateVoice) { @@ -45,7 +45,7 @@ struct Animation *SeedPlayerAnimation(void) { struct Animation *Anim = (struct Animation *)malloc(sizeof(struct Animation)); - ALLEGRO_SAMPLE *Sound; + A5O_SAMPLE *Sound; Anim->Animation[0] = ObtainBitmap("skater2"); Anim->Animation[1] = ObtainBitmap("skater3"); @@ -58,7 +58,7 @@ struct Animation *SeedPlayerAnimation(void) if ((Sound = ObtainSample("skating"))) { Anim->SkateVoice = al_create_sample_instance(Sound); - al_set_sample_instance_playmode(Anim->SkateVoice, ALLEGRO_PLAYMODE_BIDIR); + al_set_sample_instance_playmode(Anim->SkateVoice, A5O_PLAYMODE_BIDIR); } else Anim->SkateVoice = NULL; @@ -93,7 +93,7 @@ void UnpauseAnimation(struct Animation *Anim) } /* -ALLEGRO_BITMAP *GetCurrentBitmap(struct Animation *Anim) +A5O_BITMAP *GetCurrentBitmap(struct Animation *Anim) { return Anim->bmps[((int)Anim->TimeCount)&3]; } @@ -106,7 +106,7 @@ void AdvanceAnimation(struct Animation *Anim, double Distance, int OnPlatform, i struct Animation *SeedPlayerAnimation(void) { struct Animation *Anim = (struct Animation *)malloc(sizeof(struct Animation)); - Anim->bmps = (ALLEGRO_BITMAP **)malloc(sizeof(ALLEGRO_BITMAP *)*4); + Anim->bmps = (A5O_BITMAP **)malloc(sizeof(A5O_BITMAP *)*4); Anim->bmps[0] = load_bitmap("man-frame1.bmp", NULL); Anim->bmps[1] = load_bitmap("man-frame2.bmp", NULL); Anim->bmps[2] = load_bitmap("man-frame3.bmp", NULL); diff --git a/demos/skater/src/anim.h b/demos/skater/src/anim.h index f0aea45bf8..b6f99b70cb 100644 --- a/demos/skater/src/anim.h +++ b/demos/skater/src/anim.h @@ -4,12 +4,12 @@ #include "global.h" struct Animation { - ALLEGRO_BITMAP *Animation[3], *Still, *Slow, *Medium, *Fast, *CBitmap; - ALLEGRO_SAMPLE_INSTANCE *SkateVoice; + A5O_BITMAP *Animation[3], *Still, *Slow, *Medium, *Fast, *CBitmap; + A5O_SAMPLE_INSTANCE *SkateVoice; double TimeCount; }; -extern ALLEGRO_BITMAP *GetCurrentBitmap(struct Animation *); +extern A5O_BITMAP *GetCurrentBitmap(struct Animation *); extern void AdvanceAnimation(struct Animation *, double Distance, int OnPlatform); extern struct Animation *SeedPlayerAnimation(void); diff --git a/demos/skater/src/background_scroller.c b/demos/skater/src/background_scroller.c index 375d0639c3..9ee7488746 100644 --- a/demos/skater/src/background_scroller.c +++ b/demos/skater/src/background_scroller.c @@ -10,7 +10,7 @@ static int offy; static double current_time; static double dt; -static ALLEGRO_BITMAP *tile; +static A5O_BITMAP *tile; void draw_background(void) { diff --git a/demos/skater/src/credits.c b/demos/skater/src/credits.c index a96765d8a2..f593a1787f 100644 --- a/demos/skater/src/credits.c +++ b/demos/skater/src/credits.c @@ -112,11 +112,11 @@ static void load_text(void) char buf[256]; README_SECTION *sec = NULL; TEXT_LIST *l, *p; - ALLEGRO_FILE *f; + A5O_FILE *f; int inblank = true; char *s; int i; - ALLEGRO_USTR *u = al_ustr_newf("%s/readme.txt", data_path); + A5O_USTR *u = al_ustr_newf("%s/readme.txt", data_path); f = al_fopen(al_cstr(u), "r"); al_ustr_free(u); if (!f) { @@ -253,10 +253,10 @@ static void sort_credit_list(void) /* helper to open thanks._tx */ -static ALLEGRO_FILE *open_thanks(const char *s) +static A5O_FILE *open_thanks(const char *s) { - ALLEGRO_FILE *f; - ALLEGRO_USTR *u = al_ustr_newf("%s/%s", data_path, s); + A5O_FILE *f; + A5O_USTR *u = al_ustr_newf("%s/%s", data_path, s); f = al_fopen(al_cstr(u), "r"); al_ustr_free(u); return f; @@ -268,7 +268,7 @@ static void load_credits(void) { char buf[256], *p, *p2; CREDIT_NAME *c = NULL; - ALLEGRO_FILE *f; + A5O_FILE *f; /* parse thanks._tx, guessing at the relative location */ if ((f = open_thanks("thanks.txt")) == NULL) { @@ -414,7 +414,7 @@ void draw_credits(void) { int c, c2; int y2; - ALLEGRO_COLOR col_back, col_font; + A5O_COLOR col_back, col_font; /* for the text scroller */ char buf[2] = " "; diff --git a/demos/skater/src/defines.h b/demos/skater/src/defines.h index 725c9a4ede..9db2fafdf3 100644 --- a/demos/skater/src/defines.h +++ b/demos/skater/src/defines.h @@ -56,8 +56,8 @@ /* Skater can use both AllegroGL and plain Allegro fonts. AllegroGL fonts require somewhat more code but are much faster that Allegro fonts. */ /* By defualt, use AllegroGL fonts if building in AllegroGL mode. */ -#ifdef DEMO_USE_ALLEGRO_GL - #define DEMO_USE_ALLEGRO_GL_FONT +#ifdef DEMO_USE_A5O_GL + #define DEMO_USE_A5O_GL_FONT #endif #endif /* __DEMO_DEFINES_H__ */ diff --git a/demos/skater/src/fps.c b/demos/skater/src/fps.c index 9c640a09ef..277897a4fc 100644 --- a/demos/skater/src/fps.c +++ b/demos/skater/src/fps.c @@ -58,7 +58,7 @@ int get_fps(FPS * fps) } -void draw_fps(FPS * fps, ALLEGRO_FONT *font, int x, int y, ALLEGRO_COLOR fg, +void draw_fps(FPS * fps, A5O_FONT *font, int x, int y, A5O_COLOR fg, char *format) { demo_textprintf_right(font, x, y, fg, format, diff --git a/demos/skater/src/fps.h b/demos/skater/src/fps.h index 22ba6768d8..f9a63dcc12 100644 --- a/demos/skater/src/fps.h +++ b/demos/skater/src/fps.h @@ -96,7 +96,7 @@ extern "C" { Parameters: FPS *fps - a pointer to an FPS object - ALLEGRO_BITMAP *bmp - destination bitmap + A5O_BITMAP *bmp - destination bitmap FONT *font - the font used for printing the fps int x, y - position of the fps text on the destination bitmap int color - the color of the fps text @@ -110,8 +110,8 @@ extern "C" { Example: draw_fps(fps, screen, font, 100, 50, makecol(123,234,213), "FPS = %d"); */ - void draw_fps(FPS * fps, ALLEGRO_FONT * font, int x, int y, - ALLEGRO_COLOR color, char *format); + void draw_fps(FPS * fps, A5O_FONT * font, int x, int y, + A5O_COLOR color, char *format); #ifdef __cplusplus diff --git a/demos/skater/src/framework.c b/demos/skater/src/framework.c index 1a01c8c65b..58bbe037a0 100644 --- a/demos/skater/src/framework.c +++ b/demos/skater/src/framework.c @@ -1,5 +1,5 @@ #include -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID #include #endif #include "global.h" @@ -41,7 +41,7 @@ static GAMESTATE state[DEMO_MAX_GAMESTATES]; static int current_state = 0, last_state; static int state_count = 0; -ALLEGRO_EVENT_QUEUE *event_queue; +A5O_EVENT_QUEUE *event_queue; /* Module for performing smooth state transition animations. @@ -50,7 +50,7 @@ static TRANSITION *transition = NULL; -static void drop_build_config_dir(ALLEGRO_PATH *path) +static void drop_build_config_dir(A5O_PATH *path) { const char *s = al_get_path_tail(path); if (s) { @@ -69,7 +69,7 @@ int init_framework(void) { int error = DEMO_OK; int c; - ALLEGRO_PATH *path; + A5O_PATH *path; /* Attempt to initialize Allegro. */ if (!al_init()) { @@ -83,19 +83,19 @@ int init_framework(void) /* Construct aboslute path for the configuration file. */ al_set_app_name("Allegro Skater Demo"); al_set_org_name(""); - path = al_get_standard_path(ALLEGRO_USER_SETTINGS_PATH); + path = al_get_standard_path(A5O_USER_SETTINGS_PATH); al_make_directory(al_path_cstr(path, '/')); al_set_path_filename(path, DEMO_CFG); strncpy(config_path, al_path_cstr(path, '/'), DEMO_PATH_LENGTH); al_destroy_path(path); /* Construct absolute path for the datafile containing game menu data. */ -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID al_android_set_apk_file_interface(); strncpy(data_path, "/data", DEMO_PATH_LENGTH); (void)drop_build_config_dir; #else - path = al_get_standard_path(ALLEGRO_RESOURCES_PATH); + path = al_get_standard_path(A5O_RESOURCES_PATH); al_set_path_filename(path, ""); drop_build_config_dir(path); al_append_path_component(path, "data"); @@ -148,7 +148,7 @@ int init_framework(void) /* Create a timer. */ { - ALLEGRO_TIMER *t = al_create_timer(1.0 / logic_framerate); + A5O_TIMER *t = al_create_timer(1.0 / logic_framerate); al_register_event_source(event_queue, al_get_timer_event_source(t)); al_start_timer(t); } @@ -256,70 +256,70 @@ void run_framework(void) /* Do the main loop; until we're not done. */ while (!done) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(event_queue, &event); switch (event.type) { - case ALLEGRO_EVENT_MOUSE_AXES: + case A5O_EVENT_MOUSE_AXES: mouse_handle_event(&event); break; - case ALLEGRO_EVENT_MOUSE_BUTTON_DOWN: + case A5O_EVENT_MOUSE_BUTTON_DOWN: mouse_handle_event(&event); break; - case ALLEGRO_EVENT_MOUSE_BUTTON_UP: + case A5O_EVENT_MOUSE_BUTTON_UP: mouse_handle_event(&event); break; - case ALLEGRO_EVENT_KEY_DOWN: + case A5O_EVENT_KEY_DOWN: keyboard_event(&event); break; - case ALLEGRO_EVENT_KEY_CHAR: + case A5O_EVENT_KEY_CHAR: keyboard_event(&event); break; - case ALLEGRO_EVENT_KEY_UP: + case A5O_EVENT_KEY_UP: keyboard_event(&event); break; - case ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN: + case A5O_EVENT_JOYSTICK_BUTTON_DOWN: gamepad_event(&event); break; - case ALLEGRO_EVENT_JOYSTICK_BUTTON_UP: + case A5O_EVENT_JOYSTICK_BUTTON_UP: gamepad_event(&event); break; - case ALLEGRO_EVENT_JOYSTICK_AXIS: + case A5O_EVENT_JOYSTICK_AXIS: gamepad_event(&event); break; - case ALLEGRO_EVENT_TOUCH_BEGIN: + case A5O_EVENT_TOUCH_BEGIN: gamepad_event(&event); break; - case ALLEGRO_EVENT_TOUCH_END: + case A5O_EVENT_TOUCH_END: gamepad_event(&event); break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: closed = true; break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: if (!paused) timer++; break; - case ALLEGRO_EVENT_DISPLAY_ORIENTATION: - if (event.display.orientation == ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES || - event.display.orientation == ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES) + case A5O_EVENT_DISPLAY_ORIENTATION: + if (event.display.orientation == A5O_DISPLAY_ORIENTATION_90_DEGREES || + event.display.orientation == A5O_DISPLAY_ORIENTATION_270_DEGREES) screen_orientation = event.display.orientation; break; - case ALLEGRO_EVENT_DISPLAY_RESIZE: + case A5O_EVENT_DISPLAY_RESIZE: al_acknowledge_resize(screen); screen_width = al_get_display_width(screen); screen_height = al_get_display_height(screen); @@ -329,21 +329,21 @@ void run_framework(void) } break; - case ALLEGRO_EVENT_DISPLAY_HALT_DRAWING: + case A5O_EVENT_DISPLAY_HALT_DRAWING: background_mode = true; al_acknowledge_drawing_halt(screen); break; - case ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING: + case A5O_EVENT_DISPLAY_RESUME_DRAWING: background_mode = false; al_acknowledge_drawing_resume(screen); break; - case ALLEGRO_EVENT_DISPLAY_SWITCH_OUT: + case A5O_EVENT_DISPLAY_SWITCH_OUT: paused = true; break; - case ALLEGRO_EVENT_DISPLAY_SWITCH_IN: + case A5O_EVENT_DISPLAY_SWITCH_IN: paused = false; break; @@ -357,7 +357,7 @@ void run_framework(void) /* See if the user pressed F12 to see if the user wants to take a screenshot. */ - if (key_pressed(ALLEGRO_KEY_F12)) { + if (key_pressed(A5O_KEY_F12)) { /* See if the F12 key was already pressed before. */ if (F12 == 0) { /* The user just pressed F12 (it wasn't pressed before), so diff --git a/demos/skater/src/framework.h b/demos/skater/src/framework.h index a0cb8f914c..b298a8a7cb 100644 --- a/demos/skater/src/framework.h +++ b/demos/skater/src/framework.h @@ -4,7 +4,7 @@ #include #include "defines.h" -extern ALLEGRO_EVENT_QUEUE *event_queue; +extern A5O_EVENT_QUEUE *event_queue; /* Initializes Allegro, loads configuration settings, installs all diff --git a/demos/skater/src/game.c b/demos/skater/src/game.c index f77c47907a..7cc7d01e2b 100644 --- a/demos/skater/src/game.c +++ b/demos/skater/src/game.c @@ -25,7 +25,7 @@ struct Level *Lvl = NULL; struct LevelState *LvlState = NULL; double LeftWindow = -120, RightWindow = 120; double Pusher = 0; -static ALLEGRO_COLOR cloud_color; +static A5O_COLOR cloud_color; #define PLAYER_STRENGTH 0.14f @@ -49,11 +49,11 @@ static int continueid(void) int CurrentID; /* background stuff */ -ALLEGRO_BITMAP *water; -ALLEGRO_SAMPLE_INSTANCE *WaterVoice, *WaterVoice2; -ALLEGRO_SAMPLE *WaveNoise = NULL; +A5O_BITMAP *water; +A5O_SAMPLE_INSTANCE *WaterVoice, *WaterVoice2; +A5O_SAMPLE *WaveNoise = NULL; -ALLEGRO_BITMAP *cloud; +A5O_BITMAP *cloud; al_fixed *TanTable = NULL; int CalibRes = 0; @@ -68,7 +68,7 @@ double CloudX; char *load_game_resources(const char *data_path) { int c; - ALLEGRO_PATH *path; + A5O_PATH *path; printf("load_game_resources\n"); path = al_create_path_for_directory(data_path); @@ -148,14 +148,14 @@ static void GenericInit(void) } WaterVoice = al_create_sample_instance(WaveNoise); - al_set_sample_instance_playmode(WaterVoice, ALLEGRO_PLAYMODE_BIDIR); + al_set_sample_instance_playmode(WaterVoice, A5O_PLAYMODE_BIDIR); al_set_sample_instance_gain(WaterVoice, 0.5); al_attach_sample_instance_to_mixer(WaterVoice, al_get_default_mixer()); al_play_sample_instance(WaterVoice); WaterVoice2 = al_create_sample_instance(WaveNoise); al_set_sample_instance_playmode(WaterVoice2, - ALLEGRO_PLAYMODE_BIDIR); + A5O_PLAYMODE_BIDIR); al_set_sample_instance_gain(WaterVoice2, 0.25); al_attach_sample_instance_to_mixer(WaterVoice2, al_get_default_mixer()); al_play_sample_instance(WaterVoice2); @@ -213,7 +213,7 @@ static void DrawClouds(void) } } -static void set_v(ALLEGRO_VERTEX *vt, double x, double y, double u, double v) +static void set_v(A5O_VERTEX *vt, double x, double y, double u, double v) { vt->x = x; vt->y = y; @@ -225,10 +225,10 @@ static void set_v(ALLEGRO_VERTEX *vt, double x, double y, double u, double v) static void GameDraw(void) { - ALLEGRO_BITMAP *ch; + A5O_BITMAP *ch; double depth; - ALLEGRO_VERTEX Points[4]; - ALLEGRO_TRANSFORM transform; + A5O_VERTEX Points[4]; + A5O_TRANSFORM transform; int chw, chh; float w; @@ -251,7 +251,7 @@ static void GameDraw(void) if (depth > -261 && depth < -5.0f) { int d = ((int)(depth * 65536)) & (256 * 65536 - 1); y1 = lowy; - index = (d / 65536.0 - 1.0) * ALLEGRO_PI * 2 * 8 / 128.0f; + index = (d / 65536.0 - 1.0) * A5O_PI * 2 * 8 / 128.0f; y2 = c / 4.0 - 125.0f * sin(index + WaveY) / depth; @@ -264,7 +264,7 @@ static void GameDraw(void) set_v(Points + 2, w, y1, u - depth * 4, depth + 5); set_v(Points + 3, 0, y1, u + depth * 4, depth + 5); - al_draw_prim(Points, NULL, water, 0, 4, ALLEGRO_PRIM_TRIANGLE_FAN); + al_draw_prim(Points, NULL, water, 0, 4, A5O_PRIM_TRIANGLE_FAN); } } c--; @@ -320,7 +320,7 @@ static void GameDraw(void) (PlayerPos[0] - ScrollPos[0]) + w / 2, (PlayerPos[1] - ScrollPos[1]) + 480.0 / 2, 1, 1, PlayerPos[2], - KeyFlags & KEYFLAG_FLIP ? ALLEGRO_FLIP_HORIZONTAL : 0); + KeyFlags & KEYFLAG_FLIP ? A5O_FLIP_HORIZONTAL : 0); DrawLevelForeground(Lvl); @@ -362,9 +362,9 @@ static int GameUpdate(void) if ((PlayerPos[1] - ScrollPos[1]) > 80) ScrollPos[1] = PlayerPos[1] - 80; - if ((KeyFlags & KEYFLAG_FLIP) ^ (((PlayerPos[2] < ALLEGRO_PI * 0.5f) + if ((KeyFlags & KEYFLAG_FLIP) ^ (((PlayerPos[2] < A5O_PI * 0.5f) && (PlayerPos[2] > - -ALLEGRO_PI * 0.5f)) ? 0 : KEYFLAG_FLIP) + -A5O_PI * 0.5f)) ? 0 : KEYFLAG_FLIP) ) { if (LeftWindow < 0) LeftWindow++; @@ -454,7 +454,7 @@ static int GameUpdate(void) EPtr = EPtr->Next; } - return key_pressed(ALLEGRO_KEY_ESCAPE) ? DEMO_STATE_MAIN_MENU : CurrentID; + return key_pressed(A5O_KEY_ESCAPE) ? DEMO_STATE_MAIN_MENU : CurrentID; } void destroy_game() diff --git a/demos/skater/src/gamepad.c b/demos/skater/src/gamepad.c index 473a5c4d39..28fd70bead 100644 --- a/demos/skater/src/gamepad.c +++ b/demos/skater/src/gamepad.c @@ -12,7 +12,7 @@ static void read_config(VCONTROLLER * this, const char *config_path) int i; char tmp[64]; - ALLEGRO_CONFIG *c = al_load_config_file(config_path); + A5O_CONFIG *c = al_load_config_file(config_path); if (!c) c = al_create_config(); for (i = 0; i < 3; i++) { @@ -32,7 +32,7 @@ static void write_config(VCONTROLLER * this, const char *config_path) int i; char tmp[64]; - ALLEGRO_CONFIG *c = al_load_config_file(config_path); + A5O_CONFIG *c = al_load_config_file(config_path); if (!c) c = al_create_config(); for (i = 0; i < 3; i++) { @@ -49,11 +49,11 @@ static void poll(VCONTROLLER * this) { //printf("%f %f %f\n", axis[0], axis[1], axis[2]); float a = axis[0]; - if (screen_orientation == ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES) + if (screen_orientation == A5O_DISPLAY_ORIENTATION_90_DEGREES) a = axis[1]; - if (screen_orientation == ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES) + if (screen_orientation == A5O_DISPLAY_ORIENTATION_180_DEGREES) a = -axis[0]; - if (screen_orientation == ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES) + if (screen_orientation == A5O_DISPLAY_ORIENTATION_270_DEGREES) a = -axis[1]; this->button[0] = a < -threshold; this->button[1] = a > threshold; @@ -149,18 +149,18 @@ VCONTROLLER *create_gamepad_controller(const char *config_path) return ret; } -void gamepad_event(ALLEGRO_EVENT *event) +void gamepad_event(A5O_EVENT *event) { switch (event->type) { - case ALLEGRO_EVENT_TOUCH_BEGIN: + case A5O_EVENT_TOUCH_BEGIN: button_down = true; break; - case ALLEGRO_EVENT_TOUCH_END: + case A5O_EVENT_TOUCH_END: button_down = false; break; - case ALLEGRO_EVENT_JOYSTICK_AXIS: + case A5O_EVENT_JOYSTICK_AXIS: if (event->joystick.axis < 3) axis[event->joystick.axis] = event->joystick.pos; break; diff --git a/demos/skater/src/gamepad.h b/demos/skater/src/gamepad.h index 823223ed10..e044359971 100644 --- a/demos/skater/src/gamepad.h +++ b/demos/skater/src/gamepad.h @@ -5,7 +5,7 @@ #include "vcontroller.h" VCONTROLLER *create_gamepad_controller(const char *config_path); -void gamepad_event(ALLEGRO_EVENT *event); +void gamepad_event(A5O_EVENT *event); bool gamepad_button(void); #endif /* __DEMO_GAMEPAD_H__ */ diff --git a/demos/skater/src/global.c b/demos/skater/src/global.c index 1afed2fb48..8293c974bd 100644 --- a/demos/skater/src/global.c +++ b/demos/skater/src/global.c @@ -9,7 +9,7 @@ #include "framework.h" /* Default values of some config varables */ -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE int fullscreen = 1; int controller_id = 1; #else @@ -19,7 +19,7 @@ int controller_id = 0; int bit_depth = 32; int screen_width = 640; int screen_height = 480; -int screen_orientation = ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES; +int screen_orientation = A5O_DISPLAY_ORIENTATION_0_DEGREES; int window_width = 640; int window_height = 480; int screen_samples = 1; @@ -40,7 +40,7 @@ char config_path[DEMO_PATH_LENGTH + 1]; char data_path[DEMO_PATH_LENGTH + 1]; DATA_ENTRY *demo_data; -ALLEGRO_DISPLAY *screen; +A5O_DISPLAY *screen; char *GameError; @@ -71,7 +71,7 @@ const char *demo_error(int id) } -int get_config_int(const ALLEGRO_CONFIG *cfg, const char *section, +int get_config_int(const A5O_CONFIG *cfg, const char *section, const char *name, int def) { const char *v = al_get_config_value(cfg, section, name); @@ -80,7 +80,7 @@ int get_config_int(const ALLEGRO_CONFIG *cfg, const char *section, } -void set_config_int(ALLEGRO_CONFIG *cfg, const char *section, const char *name, +void set_config_int(A5O_CONFIG *cfg, const char *section, const char *name, int val) { char buf[32]; @@ -95,7 +95,7 @@ void set_config_int(ALLEGRO_CONFIG *cfg, const char *section, const char *name, */ void read_global_config(const char *config) { - ALLEGRO_CONFIG *c = al_load_config_file(config); + A5O_CONFIG *c = al_load_config_file(config); if (!c) c = al_create_config(); fullscreen = get_config_int(c, "GFX", "fullscreen", fullscreen); @@ -132,7 +132,7 @@ void read_global_config(const char *config) void write_global_config(const char *config) { - ALLEGRO_CONFIG *c = al_load_config_file(config); + A5O_CONFIG *c = al_load_config_file(config); if (!c) c = al_create_config(); set_config_int(c, "GFX", "fullscreen", fullscreen); @@ -188,13 +188,13 @@ int change_gfx_mode(void) /* Select appropriate (fullscreen or windowed) gfx mode driver. */ if (fullscreen == 0) { - flags |= ALLEGRO_WINDOWED | ALLEGRO_RESIZABLE; + flags |= A5O_WINDOWED | A5O_RESIZABLE; screen_width = window_width; screen_height = window_height; } else if (fullscreen == 1) { - flags |= ALLEGRO_FULLSCREEN_WINDOW; + flags |= A5O_FULLSCREEN_WINDOW; } else { - flags |= ALLEGRO_FULLSCREEN; + flags |= A5O_FULLSCREEN; } if (screen) { @@ -204,19 +204,19 @@ int change_gfx_mode(void) al_set_new_display_flags(flags); // May be a good idea, but need to add a border to textures for it. - // al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR); + // al_set_new_bitmap_flags(A5O_MIN_LINEAR | A5O_MAG_LINEAR); if (screen_samples > 1) { - al_set_new_display_option(ALLEGRO_SAMPLE_BUFFERS, 1, ALLEGRO_SUGGEST); - al_set_new_display_option(ALLEGRO_SAMPLES, screen_samples, ALLEGRO_SUGGEST); + al_set_new_display_option(A5O_SAMPLE_BUFFERS, 1, A5O_SUGGEST); + al_set_new_display_option(A5O_SAMPLES, screen_samples, A5O_SUGGEST); } else { - al_set_new_display_option(ALLEGRO_SAMPLE_BUFFERS, 0, ALLEGRO_SUGGEST); - al_set_new_display_option(ALLEGRO_SAMPLES, 0, ALLEGRO_SUGGEST); + al_set_new_display_option(A5O_SAMPLE_BUFFERS, 0, A5O_SUGGEST); + al_set_new_display_option(A5O_SAMPLES, 0, A5O_SUGGEST); } - al_set_new_display_option(ALLEGRO_SUPPORTED_ORIENTATIONS, - ALLEGRO_DISPLAY_ORIENTATION_LANDSCAPE, ALLEGRO_SUGGEST); + al_set_new_display_option(A5O_SUPPORTED_ORIENTATIONS, + A5O_DISPLAY_ORIENTATION_LANDSCAPE, A5O_SUGGEST); /* Attempt to set the selected colour depth and gfx mode. */ screen = al_create_display(screen_width, screen_height); @@ -227,7 +227,7 @@ int change_gfx_mode(void) screen_width = al_get_display_width(screen); screen_height = al_get_display_height(screen); - screen_orientation = ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES; + screen_orientation = A5O_DISPLAY_ORIENTATION_90_DEGREES; al_register_event_source(event_queue, al_get_display_event_source(screen)); @@ -328,29 +328,29 @@ void unload_data(void) } -void demo_textout(const ALLEGRO_FONT *f, const char *s, int x, int y, - ALLEGRO_COLOR color) +void demo_textout(const A5O_FONT *f, const char *s, int x, int y, + A5O_COLOR color) { demo_textprintf(f, x, y, color, "%s", s); } -void demo_textout_right(const ALLEGRO_FONT *f, const char *s, int x, int y, - ALLEGRO_COLOR color) +void demo_textout_right(const A5O_FONT *f, const char *s, int x, int y, + A5O_COLOR color) { demo_textprintf_right(f, x, y, color, "%s", s); } -void demo_textout_centre(const ALLEGRO_FONT *f, const char *s, int x, int y, - ALLEGRO_COLOR color) +void demo_textout_centre(const A5O_FONT *f, const char *s, int x, int y, + A5O_COLOR color) { demo_textprintf_centre(f, x, y, color, "%s", s); } -void demo_textprintf_centre(const ALLEGRO_FONT *font, int x, int y, - ALLEGRO_COLOR col, const char *format, ...) +void demo_textprintf_centre(const A5O_FONT *font, int x, int y, + A5O_COLOR col, const char *format, ...) { char buf[512]; @@ -364,8 +364,8 @@ void demo_textprintf_centre(const ALLEGRO_FONT *font, int x, int y, } -void demo_textprintf_right(const ALLEGRO_FONT *font, int x, int y, - ALLEGRO_COLOR col, const char *format, ...) +void demo_textprintf_right(const A5O_FONT *font, int x, int y, + A5O_COLOR col, const char *format, ...) { char buf[512]; @@ -379,8 +379,8 @@ void demo_textprintf_right(const ALLEGRO_FONT *font, int x, int y, } -void demo_textprintf(const ALLEGRO_FONT *font, int x, int y, - ALLEGRO_COLOR col, const char *format, ...) +void demo_textprintf(const A5O_FONT *font, int x, int y, + A5O_COLOR col, const char *format, ...) { char buf[512]; @@ -393,8 +393,8 @@ void demo_textprintf(const ALLEGRO_FONT *font, int x, int y, demo_textprintf_ex(font, x, y, col, 0, "%s", buf); } -void demo_textprintf_ex(const ALLEGRO_FONT *font, int x, int y, - ALLEGRO_COLOR col, int align, const char *format, ...) +void demo_textprintf_ex(const A5O_FONT *font, int x, int y, + A5O_COLOR col, int align, const char *format, ...) { char buf[512]; @@ -406,21 +406,21 @@ void demo_textprintf_ex(const ALLEGRO_FONT *font, int x, int y, switch (align) { case 0: - al_draw_textf(font, col, x, y, ALLEGRO_ALIGN_LEFT, "%s", buf); + al_draw_textf(font, col, x, y, A5O_ALIGN_LEFT, "%s", buf); break; case 1: - al_draw_textf(font, col, x, y, ALLEGRO_ALIGN_RIGHT, "%s", buf); + al_draw_textf(font, col, x, y, A5O_ALIGN_RIGHT, "%s", buf); break; case 2: - al_draw_textf(font, col, x, y, ALLEGRO_ALIGN_CENTRE, "%s", buf); + al_draw_textf(font, col, x, y, A5O_ALIGN_CENTRE, "%s", buf); break; }; } -void shadow_textprintf(ALLEGRO_FONT *font, int x, int y, - ALLEGRO_COLOR col, int align, const char *format, ...) +void shadow_textprintf(A5O_FONT *font, int x, int y, + A5O_COLOR col, int align, const char *format, ...) { char buf[512]; diff --git a/demos/skater/src/global.h b/demos/skater/src/global.h index 90aa4635ea..5a9cea5b2d 100644 --- a/demos/skater/src/global.h +++ b/demos/skater/src/global.h @@ -15,7 +15,7 @@ #include "defines.h" #include "keyboard.h" -#ifdef ALLEGRO_MSVC +#ifdef A5O_MSVC #define snprintf _snprintf #define vsnprintf _vsnprintf #endif @@ -59,15 +59,15 @@ extern char config_path[DEMO_PATH_LENGTH + 1]; extern char data_path[DEMO_PATH_LENGTH + 1]; /* The main menu font (monochrome). */ -#define demo_font ((ALLEGRO_FONT *)demo_data[DEMO_FONT].dat) +#define demo_font ((A5O_FONT *)demo_data[DEMO_FONT].dat) /* The big title font (coloured). */ -#define demo_font_logo ((ALLEGRO_FONT *)demo_data[DEMO_FONT_LOGO].dat) +#define demo_font_logo ((A5O_FONT *)demo_data[DEMO_FONT_LOGO].dat) /* Font made of default allegro font (monochrome). */ #define plain_font demo_font -extern ALLEGRO_DISPLAY *screen; +extern A5O_DISPLAY *screen; /* @@ -140,7 +140,7 @@ extern void unload_data(void); Text alignment is selected with a parameter. Parameters: - ALLEGRO_BITMAP *canvas, int x, int y, int col and char *format have + A5O_BITMAP *canvas, int x, int y, int col and char *format have exactly the same meaning as in the equivalent Allegro built-in text output functions. FONT *font can be either plain Allegro font or a font converted with @@ -150,20 +150,20 @@ extern void unload_data(void); Returns: nothing */ -extern void demo_textprintf_ex(const ALLEGRO_FONT * font, int x, int y, - ALLEGRO_COLOR col, int align, const char *format, ...); -extern void demo_textprintf(const ALLEGRO_FONT * font, int x, int y, - ALLEGRO_COLOR col, const char *format, ...); -extern void demo_textprintf_right(const ALLEGRO_FONT * font, int x, int y, - ALLEGRO_COLOR col, const char *format, ...); -extern void demo_textprintf_centre(const ALLEGRO_FONT * font, int x, int y, - ALLEGRO_COLOR col, const char *format, ...); -extern void demo_textout(const ALLEGRO_FONT *f, const char *s, int x, - int y, ALLEGRO_COLOR color); -extern void demo_textout_right(const ALLEGRO_FONT *f, const char *s, - int x, int y, ALLEGRO_COLOR color); -extern void demo_textout_centre(const ALLEGRO_FONT *f, const char *s, - int x, int y, ALLEGRO_COLOR color); +extern void demo_textprintf_ex(const A5O_FONT * font, int x, int y, + A5O_COLOR col, int align, const char *format, ...); +extern void demo_textprintf(const A5O_FONT * font, int x, int y, + A5O_COLOR col, const char *format, ...); +extern void demo_textprintf_right(const A5O_FONT * font, int x, int y, + A5O_COLOR col, const char *format, ...); +extern void demo_textprintf_centre(const A5O_FONT * font, int x, int y, + A5O_COLOR col, const char *format, ...); +extern void demo_textout(const A5O_FONT *f, const char *s, int x, + int y, A5O_COLOR color); +extern void demo_textout_right(const A5O_FONT *f, const char *s, + int x, int y, A5O_COLOR color); +extern void demo_textout_centre(const A5O_FONT *f, const char *s, + int x, int y, A5O_COLOR color); /* Custom text output function. Similar to the Allegro's built-in functions @@ -172,7 +172,7 @@ extern void demo_textout_centre(const ALLEGRO_FONT *f, const char *s, shadow_offset variable. Parameters: - ALLEGRO_BITMAP *canvas, FONT *font, int x, int y, int col and char *text have + A5O_BITMAP *canvas, FONT *font, int x, int y, int col and char *text have exactly the same meaning as in the equivalent Allegro built-in text output functions. int align - defines alignemnt: 0 = left, 1 = right, 2 = centre @@ -180,8 +180,8 @@ extern void demo_textout_centre(const ALLEGRO_FONT *f, const char *s, Returns: nothing */ -extern void shadow_textprintf(ALLEGRO_FONT * font, int x, int y, - ALLEGRO_COLOR col, int align, const char *text, ...); +extern void shadow_textprintf(A5O_FONT * font, int x, int y, + A5O_COLOR col, int align, const char *text, ...); typedef struct DATA_ENTRY { int id; @@ -198,10 +198,10 @@ extern DATA_ENTRY *demo_data; void unload_data_entries(DATA_ENTRY *data); -int get_config_int(const ALLEGRO_CONFIG *cfg, const char *section, +int get_config_int(const A5O_CONFIG *cfg, const char *section, const char *name, int def); -void set_config_int(ALLEGRO_CONFIG *cfg, const char *section, const char *name, +void set_config_int(A5O_CONFIG *cfg, const char *section, const char *name, int val); int my_stricmp(const char *s1, const char *s2); diff --git a/demos/skater/src/intro.c b/demos/skater/src/intro.c index e1d76a3dd4..1f852a4946 100644 --- a/demos/skater/src/intro.c +++ b/demos/skater/src/intro.c @@ -32,9 +32,9 @@ static int update(void) return DEMO_STATE_MAIN_MENU; } - if (key_pressed(ALLEGRO_KEY_ESCAPE)) return DEMO_STATE_MAIN_MENU; - if (key_pressed(ALLEGRO_KEY_SPACE)) return DEMO_STATE_MAIN_MENU; - if (key_pressed(ALLEGRO_KEY_ENTER)) return DEMO_STATE_MAIN_MENU; + if (key_pressed(A5O_KEY_ESCAPE)) return DEMO_STATE_MAIN_MENU; + if (key_pressed(A5O_KEY_SPACE)) return DEMO_STATE_MAIN_MENU; + if (key_pressed(A5O_KEY_ENTER)) return DEMO_STATE_MAIN_MENU; if (mouse_button_pressed(1)) return DEMO_STATE_MAIN_MENU; return id(); diff --git a/demos/skater/src/keyboard.c b/demos/skater/src/keyboard.c index 6b97b501f8..a5d1fcb4f3 100644 --- a/demos/skater/src/keyboard.c +++ b/demos/skater/src/keyboard.c @@ -10,7 +10,7 @@ * bit 1: key was pressed * bit 2: key was released */ -static int key_array[ALLEGRO_KEY_MAX]; +static int key_array[A5O_KEY_MAX]; static int unicode_array[KEYBUF_SIZE]; static int unicode_count; @@ -36,21 +36,21 @@ int unicode_char(bool remove) return u; } -void keyboard_event(ALLEGRO_EVENT *event) +void keyboard_event(A5O_EVENT *event) { switch (event->type) { - case ALLEGRO_EVENT_KEY_DOWN: + case A5O_EVENT_KEY_DOWN: key_array[event->keyboard.keycode] |= (1 << 0); key_array[event->keyboard.keycode] |= (1 << 1); break; - case ALLEGRO_EVENT_KEY_CHAR: + case A5O_EVENT_KEY_CHAR: if (event->keyboard.unichar && unicode_count < KEYBUF_SIZE) { unicode_array[unicode_count++] = event->keyboard.unichar; } break; - case ALLEGRO_EVENT_KEY_UP: + case A5O_EVENT_KEY_UP: key_array[event->keyboard.keycode] &= ~(1 << 0); key_array[event->keyboard.keycode] |= (1 << 2); break; @@ -61,7 +61,7 @@ void keyboard_tick(void) { /* clear pressed/released bits */ int i; - for (i = 0; i < ALLEGRO_KEY_MAX; i++) { + for (i = 0; i < A5O_KEY_MAX; i++) { key_array[i] &= ~(1 << 1); key_array[i] &= ~(1 << 2); } @@ -74,12 +74,12 @@ static void read_config(VCONTROLLER * this, const char *config_path) int i; char tmp[64]; int def[] = { - ALLEGRO_KEY_LEFT, - ALLEGRO_KEY_RIGHT, - ALLEGRO_KEY_SPACE + A5O_KEY_LEFT, + A5O_KEY_RIGHT, + A5O_KEY_SPACE }; - ALLEGRO_CONFIG *c = al_load_config_file(config_path); + A5O_CONFIG *c = al_load_config_file(config_path); if (!c) c = al_create_config(); for (i = 0; i < 3; i++) { @@ -98,7 +98,7 @@ static void write_config(VCONTROLLER * this, const char *config_path) int i; char tmp[64]; - ALLEGRO_CONFIG *c = al_load_config_file(config_path); + A5O_CONFIG *c = al_load_config_file(config_path); if (!c) c = al_create_config(); for (i = 0; i < 3; i++) { @@ -133,11 +133,11 @@ static int calibrate_button(VCONTROLLER * this, int i) { int c; - if (key_down(ALLEGRO_KEY_ESCAPE)) { + if (key_down(A5O_KEY_ESCAPE)) { return 0; } - for (c = 1; c < ALLEGRO_KEY_MAX; c++) { + for (c = 1; c < A5O_KEY_MAX; c++) { if (key_pressed(c)) { ((int *)(this->private_data))[i] = c; return 1; diff --git a/demos/skater/src/keyboard.h b/demos/skater/src/keyboard.h index b81a5f4eff..63706e2ebf 100644 --- a/demos/skater/src/keyboard.h +++ b/demos/skater/src/keyboard.h @@ -8,7 +8,7 @@ VCONTROLLER *create_keyboard_controller(const char *config_path); bool key_down(int k); bool key_pressed(int k); -void keyboard_event(ALLEGRO_EVENT *event); +void keyboard_event(A5O_EVENT *event); void keyboard_tick(void); int unicode_char(bool remove); diff --git a/demos/skater/src/level.c b/demos/skater/src/level.c index f239f8c532..fab351465c 100644 --- a/demos/skater/src/level.c +++ b/demos/skater/src/level.c @@ -69,7 +69,7 @@ void DrawLevelForeground(struct Level *lev) } -ALLEGRO_BITMAP *ObtainBitmap(const char *name) +A5O_BITMAP *ObtainBitmap(const char *name) { DATA_ENTRY *data = demo_data; while (data && data->name) { @@ -80,7 +80,7 @@ ALLEGRO_BITMAP *ObtainBitmap(const char *name) return NULL; } -ALLEGRO_SAMPLE *ObtainSample(const char *name) +A5O_SAMPLE *ObtainSample(const char *name) { DATA_ENTRY *data = demo_data; while (data && data->name) { @@ -427,7 +427,7 @@ char *GetLevelError(void) */ struct Level *LoadLevel(char const *name, int radius) { - ALLEGRO_FILE *file; + A5O_FILE *file; struct Level *NewLev = NULL; ErrorText[0] = '\0'; /* set ErrorText to be a zero length string diff --git a/demos/skater/src/level.h b/demos/skater/src/level.h index d2f35ef7a0..b2f9e70be8 100644 --- a/demos/skater/src/level.h +++ b/demos/skater/src/level.h @@ -26,7 +26,7 @@ extern struct LevelState *BorrowState(struct Level *); extern void ReturnState(struct Level *, struct LevelState *); extern void FreeState(struct LevelState *); -extern ALLEGRO_BITMAP *ObtainBitmap(const char *name); -extern ALLEGRO_SAMPLE *ObtainSample(const char *name); +extern A5O_BITMAP *ObtainBitmap(const char *name); +extern A5O_SAMPLE *ObtainSample(const char *name); #endif diff --git a/demos/skater/src/level_file.c b/demos/skater/src/level_file.c index 8105854679..c93fdb9436 100644 --- a/demos/skater/src/level_file.c +++ b/demos/skater/src/level_file.c @@ -30,8 +30,8 @@ void LoadMaterials(struct Level *NewLev) { struct Material **NewMatPtr = &NewLev->AllMats; -#ifdef DEMO_USE_ALLEGRO_GL - ALLEGRO_BITMAP *TmpEdge; +#ifdef DEMO_USE_A5O_GL + A5O_BITMAP *TmpEdge; #endif ExpectToken(TK_OPENBRACE); @@ -55,7 +55,7 @@ void LoadMaterials(struct Level *NewLev) ExpectToken(TK_COMMA); ExpectToken(TK_STRING); -#ifdef DEMO_USE_ALLEGRO_GL +#ifdef DEMO_USE_A5O_GL if (!(TmpEdge = ObtainBitmap(Token.Text))) { #else if (!((*NewMatPtr)->Edge = ObtainBitmap(Token.Text))) { diff --git a/demos/skater/src/menu.c b/demos/skater/src/menu.c index c5748b377c..e72ec08958 100644 --- a/demos/skater/src/menu.c +++ b/demos/skater/src/menu.c @@ -72,7 +72,7 @@ int update_demo_menu(DEMO_MENU * menu) return DEMO_MENU_CONTINUE; } - if (key_pressed(ALLEGRO_KEY_ESCAPE)) { + if (key_pressed(A5O_KEY_ESCAPE)) { return DEMO_MENU_BACK; } @@ -99,7 +99,7 @@ int update_demo_menu(DEMO_MENU * menu) } } - if (key_pressed(ALLEGRO_KEY_UP)) { + if (key_pressed(A5O_KEY_UP)) { if (selected_item != -1) { tmp = selected_item; @@ -123,7 +123,7 @@ int update_demo_menu(DEMO_MENU * menu) } } - if (key_pressed(ALLEGRO_KEY_DOWN)) { + if (key_pressed(A5O_KEY_DOWN)) { if (selected_item != -1) { tmp = selected_item; @@ -240,7 +240,7 @@ int demo_text_proc(DEMO_MENU * item, int msg, int extra) int demo_edit_proc(DEMO_MENU * item, int msg, int extra) { - ALLEGRO_COLOR col; + A5O_COLOR col; int w, h, x; int l, c; @@ -307,7 +307,7 @@ int demo_edit_proc(DEMO_MENU * item, int msg, int extra) int demo_button_proc(DEMO_MENU * item, int msg, int extra) { - ALLEGRO_COLOR col; + A5O_COLOR col; if (msg == DEMO_MENU_MSG_DRAW) { if (item->flags & DEMO_MENU_SELECTED) { @@ -344,7 +344,7 @@ int demo_choice_proc(DEMO_MENU * item, int msg, int extra) int choice_count = 0; int slider_width = screen_width / 6; int i, tmp; - ALLEGRO_COLOR col; + A5O_COLOR col; /* count number of choices */ for (; item->data[choice_count] != 0; choice_count++); @@ -398,7 +398,7 @@ int demo_choice_proc(DEMO_MENU * item, int msg, int extra) shadow_textprintf(demo_font, x + 8, extra, col, 0, (char *)(item->data)[item->extra]); } else if (msg == DEMO_MENU_MSG_KEY) { - if (key_pressed(ALLEGRO_KEY_LEFT)) { + if (key_pressed(A5O_KEY_LEFT)) { if (item->extra > 0) { --item->extra; play_sound_id(DEMO_SAMPLE_BUTTON, 255, 128, -freq_variation, 0); @@ -409,7 +409,7 @@ int demo_choice_proc(DEMO_MENU * item, int msg, int extra) } } - if (key_pressed(ALLEGRO_KEY_RIGHT)) { + if (key_pressed(A5O_KEY_RIGHT)) { if (item->extra < choice_count - 1) { ++item->extra; play_sound_id(DEMO_SAMPLE_BUTTON, 255, 128, -freq_variation, 0); @@ -450,7 +450,7 @@ int demo_choice_proc(DEMO_MENU * item, int msg, int extra) int demo_key_proc(DEMO_MENU * item, int msg, int extra) { - ALLEGRO_COLOR col; + A5O_COLOR col; if (msg == DEMO_MENU_MSG_DRAW) { if (item->flags & DEMO_MENU_SELECTED) { @@ -492,7 +492,7 @@ int demo_key_proc(DEMO_MENU * item, int msg, int extra) item->on_activate(item); } return DEMO_MENU_LOCK; - } else if (key_pressed(ALLEGRO_KEY_ESCAPE)) { + } else if (key_pressed(A5O_KEY_ESCAPE)) { item->flags &= ~DEMO_MENU_EXTRA; return DEMO_MENU_LOCK; } @@ -518,7 +518,7 @@ int demo_key_proc(DEMO_MENU * item, int msg, int extra) int demo_color_proc(DEMO_MENU * item, int msg, int extra) { int x, h, cw, cx, i, c; - ALLEGRO_COLOR col1, col2; + A5O_COLOR col1, col2; int rgb[3]; static char buf[64]; int changed = 0; @@ -576,9 +576,9 @@ int demo_color_proc(DEMO_MENU * item, int msg, int extra) - if (key_pressed(ALLEGRO_KEY_LEFT)) { + if (key_pressed(A5O_KEY_LEFT)) { if (rgb[item->extra] > 0) { - if (key_down(ALLEGRO_KEY_LSHIFT) || key_down(ALLEGRO_KEY_RSHIFT)) { + if (key_down(A5O_KEY_LSHIFT) || key_down(A5O_KEY_RSHIFT)) { --rgb[item->extra]; } else { rgb[item->extra] -= 16; @@ -589,9 +589,9 @@ int demo_color_proc(DEMO_MENU * item, int msg, int extra) } } - if (key_pressed(ALLEGRO_KEY_RIGHT)) { + if (key_pressed(A5O_KEY_RIGHT)) { if (rgb[item->extra] < 255) { - if (key_down(ALLEGRO_KEY_LSHIFT) || key_down(ALLEGRO_KEY_RSHIFT)) { + if (key_down(A5O_KEY_LSHIFT) || key_down(A5O_KEY_RSHIFT)) { ++rgb[item->extra]; } else { rgb[item->extra] += 16; @@ -602,8 +602,8 @@ int demo_color_proc(DEMO_MENU * item, int msg, int extra) } } - if (key_pressed(ALLEGRO_KEY_TAB)) { - if (key_down(ALLEGRO_KEY_LSHIFT) || key_down(ALLEGRO_KEY_RSHIFT)) { + if (key_pressed(A5O_KEY_TAB)) { + if (key_down(A5O_KEY_LSHIFT) || key_down(A5O_KEY_RSHIFT)) { --item->extra; if (item->extra < 0) { item->extra += 3; diff --git a/demos/skater/src/menu.h b/demos/skater/src/menu.h index 91fd3dc2ab..6f831070c4 100644 --- a/demos/skater/src/menu.h +++ b/demos/skater/src/menu.h @@ -21,7 +21,7 @@ #define DEMO_MENU_MSG_HEIGHT 5 #define DEMO_MENU_MSG_TICK 6 -extern ALLEGRO_BITMAP *demo_menu_canvas; +extern A5O_BITMAP *demo_menu_canvas; typedef struct DEMO_MENU DEMO_MENU; diff --git a/demos/skater/src/menu_graphics.c b/demos/skater/src/menu_graphics.c index df90110616..42dc7c06c9 100644 --- a/demos/skater/src/menu_graphics.c +++ b/demos/skater/src/menu_graphics.c @@ -65,7 +65,7 @@ static void init(void) choice_res = calloc(n + 1, sizeof *choice_res); menu[3].data = (void *)choice_res; for (i = 0; i < n; i++) { - ALLEGRO_DISPLAY_MODE m; + A5O_DISPLAY_MODE m; char str[100]; al_get_display_mode(i, &m); sprintf(str, "%dx%d", m.width, m.height); diff --git a/demos/skater/src/mouse.c b/demos/skater/src/mouse.c index e89182651c..4076d58680 100644 --- a/demos/skater/src/mouse.c +++ b/demos/skater/src/mouse.c @@ -30,20 +30,20 @@ int mouse_y(void) return my; } -void mouse_handle_event(ALLEGRO_EVENT *event) +void mouse_handle_event(A5O_EVENT *event) { switch (event->type) { - case ALLEGRO_EVENT_MOUSE_BUTTON_DOWN: + case A5O_EVENT_MOUSE_BUTTON_DOWN: mouse_array[event->mouse.button] |= (1 << 0); mouse_array[event->mouse.button] |= (1 << 1); break; - case ALLEGRO_EVENT_MOUSE_BUTTON_UP: + case A5O_EVENT_MOUSE_BUTTON_UP: mouse_array[event->mouse.button] &= ~(1 << 0); mouse_array[event->mouse.button] |= (1 << 2); break; - case ALLEGRO_EVENT_MOUSE_AXES: + case A5O_EVENT_MOUSE_AXES: mx = event->mouse.x; my = event->mouse.y; break; diff --git a/demos/skater/src/mouse.h b/demos/skater/src/mouse.h index fbf0e187e9..a78ae94614 100644 --- a/demos/skater/src/mouse.h +++ b/demos/skater/src/mouse.h @@ -5,5 +5,5 @@ bool mouse_button_pressed(int b); int mouse_x(void); int mouse_y(void); /* 'mouse_event' conflicts with winuser.h */ -void mouse_handle_event(ALLEGRO_EVENT *event); +void mouse_handle_event(A5O_EVENT *event); void mouse_tick(void); diff --git a/demos/skater/src/music.c b/demos/skater/src/music.c index 8309db8c7d..d0f41c457e 100644 --- a/demos/skater/src/music.c +++ b/demos/skater/src/music.c @@ -29,7 +29,7 @@ void play_music(int id, int loop) stop_music(); al_set_audio_stream_playmode(demo_data[id].dat, - loop ? ALLEGRO_PLAYMODE_LOOP : ALLEGRO_PLAYMODE_ONCE); + loop ? A5O_PLAYMODE_LOOP : A5O_PLAYMODE_ONCE); al_set_audio_stream_gain(demo_data[id].dat, volume_music); @@ -49,9 +49,9 @@ void stop_music(void) } -void play_sound(ALLEGRO_SAMPLE *s, int vol, int pan, int freq, int loop) +void play_sound(A5O_SAMPLE *s, int vol, int pan, int freq, int loop) { - int playmode = loop ? ALLEGRO_PLAYMODE_LOOP : ALLEGRO_PLAYMODE_ONCE; + int playmode = loop ? A5O_PLAYMODE_LOOP : A5O_PLAYMODE_ONCE; if (!s) return; if (freq < 0) { diff --git a/demos/skater/src/music.h b/demos/skater/src/music.h index d88a9d656a..70e877d3d8 100644 --- a/demos/skater/src/music.h +++ b/demos/skater/src/music.h @@ -5,7 +5,7 @@ void play_music(int id, int loop); void stop_music(void); -void play_sound(ALLEGRO_SAMPLE *s, int vol, int pan, int freq, int loop); +void play_sound(A5O_SAMPLE *s, int vol, int pan, int freq, int loop); void play_sound_id(int id, int vol, int pan, int freq, int loop); void set_music_volume(double v); void set_sound_volume(double v); diff --git a/demos/skater/src/physics.c b/demos/skater/src/physics.c index 29ab2c409b..9e663bb17c 100644 --- a/demos/skater/src/physics.c +++ b/demos/skater/src/physics.c @@ -62,9 +62,9 @@ static void SetAngle(double normalx, double normaly, double *a, int JustDoIt) { double NewAng = atan2(normalx, -normaly); - if (JustDoIt || ((NewAng < (ALLEGRO_PI * 0.25f)) && (NewAng >= 0)) || - ((NewAng > (-ALLEGRO_PI * 0.25f)) && (NewAng <= 0)) || - fabs(NewAng - *a) < (ALLEGRO_PI * 0.25f) + if (JustDoIt || ((NewAng < (A5O_PI * 0.25f)) && (NewAng >= 0)) || + ((NewAng > (-A5O_PI * 0.25f)) && (NewAng <= 0)) || + fabs(NewAng - *a) < (A5O_PI * 0.25f) ) *a = NewAng; } diff --git a/demos/skater/src/quadtree.c b/demos/skater/src/quadtree.c index 066b562165..6035564ecc 100644 --- a/demos/skater/src/quadtree.c +++ b/demos/skater/src/quadtree.c @@ -371,7 +371,7 @@ struct QuadTreeNode *GetCollisionNode(struct Level *lvl, double *pos, */ -static void set_v(ALLEGRO_VERTEX *vt, double x, double y, double u, double v) +static void set_v(A5O_VERTEX *vt, double x, double y, double u, double v) { vt->x = x; vt->y = y; @@ -388,7 +388,7 @@ static void set_v(ALLEGRO_VERTEX *vt, double x, double y, double u, double v) */ static void DrawTriEdge(struct Triangle *tri, struct BoundingBox *ScrBounder) { - ALLEGRO_VERTEX PolyEdges[4]; + A5O_VERTEX PolyEdges[4]; int c, c2; double x, y, w; @@ -417,12 +417,12 @@ static void DrawTriEdge(struct Triangle *tri, struct BoundingBox *ScrBounder) set_v(PolyEdges + 1, x, y - w, tri->Edges[c2]->Pos[0], 0); set_v(PolyEdges + 2, x, y + w, tri->Edges[c2]->Pos[0], al_get_bitmap_height(tri->Material->Edge)); - al_draw_prim(PolyEdges, NULL, tri->Material->Edge, 0, 4, ALLEGRO_PRIM_TRIANGLE_FAN); + al_draw_prim(PolyEdges, NULL, tri->Material->Edge, 0, 4, A5O_PRIM_TRIANGLE_FAN); } } } -static void setuv(ALLEGRO_VERTEX *v, struct BoundingBox *ScrBounder) +static void setuv(A5O_VERTEX *v, struct BoundingBox *ScrBounder) { v->u = v->x + ScrBounder->TL.Pos[0]; v->v = v->y + ScrBounder->TL.Pos[1]; @@ -440,7 +440,7 @@ static void setuv(ALLEGRO_VERTEX *v, struct BoundingBox *ScrBounder) static void DrawTriangle(struct Triangle *tri, struct BoundingBox *ScrBounder) { - ALLEGRO_VERTEX v[3]; + A5O_VERTEX v[3]; /* quick bounding box check - if the triangle isn't on screen then we can forget about it */ @@ -457,7 +457,7 @@ static void DrawTriangle(struct Triangle *tri, v[2].y = tri->Edges[2]->Pos[1] - ScrBounder->TL.Pos[1]; setuv(&v[2], ScrBounder); - al_draw_prim(v, NULL, tri->Material->Fill, 0, 3, ALLEGRO_PRIM_TRIANGLE_STRIP); + al_draw_prim(v, NULL, tri->Material->Fill, 0, 3, A5O_PRIM_TRIANGLE_STRIP); } /* diff --git a/demos/skater/src/quadtree.h b/demos/skater/src/quadtree.h index a164ad6492..460f977be7 100644 --- a/demos/skater/src/quadtree.h +++ b/demos/skater/src/quadtree.h @@ -13,7 +13,7 @@ #define FLAGS_FOREGROUND 0x200 struct Material { - ALLEGRO_BITMAP *Edge, *Fill; + A5O_BITMAP *Edge, *Fill; double Friction; struct Material *Next; }; @@ -45,8 +45,8 @@ struct Triangle { }; struct ObjectType { - ALLEGRO_BITMAP *Image; - ALLEGRO_SAMPLE *CollectNoise; + A5O_BITMAP *Image; + A5O_SAMPLE *CollectNoise; int Radius; struct ObjectType *Next; @@ -119,7 +119,7 @@ struct Level { struct Triangle *AllTris; struct Object *AllObjects; - ALLEGRO_BITMAP *DoorOpen, *DoorShut; + A5O_BITMAP *DoorOpen, *DoorShut; }; diff --git a/demos/skater/src/screenshot.c b/demos/skater/src/screenshot.c index 4928ac5731..303a4a9b7e 100644 --- a/demos/skater/src/screenshot.c +++ b/demos/skater/src/screenshot.c @@ -51,7 +51,7 @@ void destroy_screenshot(SCREENSHOT * ss) void take_screenshot(SCREENSHOT * ss) { char buf[64]; - ALLEGRO_BITMAP *bmp2 = NULL; + A5O_BITMAP *bmp2 = NULL; snprintf(buf, sizeof(buf), "%s%04d.%s", ss->name, ss->counter, ss->ext); diff --git a/demos/skater/src/screenshot.h b/demos/skater/src/screenshot.h index d2c5ad6d27..0fd4ee8659 100644 --- a/demos/skater/src/screenshot.h +++ b/demos/skater/src/screenshot.h @@ -63,7 +63,7 @@ extern "C" { Parameters: SCREENSHOT *ss - a pointer to an SCREENSHOT object - ALLEGRO_BITMAP *buffer - the bitmap from which we take a screenshot; this can be + A5O_BITMAP *buffer - the bitmap from which we take a screenshot; this can be the screen bitmap but taking screenshots from video bitmaps like the screen is a bit slower so if you use a memory double buferring system you should pass your diff --git a/demos/skater/src/token.c b/demos/skater/src/token.c index 1307a3ad19..4f4f0f8061 100644 --- a/demos/skater/src/token.c +++ b/demos/skater/src/token.c @@ -7,7 +7,7 @@ int Error, Lines; char ErrorText[1024]; struct Tok Token; -ALLEGRO_FILE *input = NULL; +A5O_FILE *input = NULL; static int my_ungetc_c = -1; @@ -85,7 +85,7 @@ static int my_ungetc_c = -1; \r\r - 2 line endings */ -static int my_fgetc(ALLEGRO_FILE * f) +static int my_fgetc(A5O_FILE * f) { static int LastChar = '\0'; int r; diff --git a/demos/skater/src/token.h b/demos/skater/src/token.h index c9dba1a7ed..db4178b308 100644 --- a/demos/skater/src/token.h +++ b/demos/skater/src/token.h @@ -79,7 +79,7 @@ struct Tok { }; extern struct Tok Token; -extern ALLEGRO_FILE *input; /* the file from which level input is read */ +extern A5O_FILE *input; /* the file from which level input is read */ extern void GetToken(void); extern void ExpectToken(enum TokenTypes Type); diff --git a/demos/skater/src/transition.h b/demos/skater/src/transition.h index 17e8e2135a..d726a63f06 100644 --- a/demos/skater/src/transition.h +++ b/demos/skater/src/transition.h @@ -10,8 +10,8 @@ typedef struct TRANSITION { GAMESTATE *to; double duration; double progress; - ALLEGRO_BITMAP *from_bmp; - ALLEGRO_BITMAP *to_bmp; + A5O_BITMAP *from_bmp; + A5O_BITMAP *to_bmp; } TRANSITION; diff --git a/demos/speed/CMakeLists.txt b/demos/speed/CMakeLists.txt index bf1850c4e7..e5443bc0f1 100644 --- a/demos/speed/CMakeLists.txt +++ b/demos/speed/CMakeLists.txt @@ -49,11 +49,11 @@ fix_executable(speed) if(WANT_MONOLITH) target_link_libraries(speed - ${ALLEGRO_MONOLITH_LINK_WITH} + ${A5O_MONOLITH_LINK_WITH} ) else(WANT_MONOLITH) target_link_libraries(speed - ${ALLEGRO_MAIN_LINK_WITH} + ${A5O_MAIN_LINK_WITH} ${AUDIO_LINK_WITH} ${PRIMITIVES_LINK_WITH} ${FONT_LINK_WITH} @@ -61,7 +61,7 @@ else(WANT_MONOLITH) endif(WANT_MONOLITH) if(NOT BUILD_SHARED_LIBS) - set_target_properties(speed PROPERTIES COMPILE_FLAGS "-DALLEGRO_STATICLINK") + set_target_properties(speed PROPERTIES COMPILE_FLAGS "-DA5O_STATICLINK") endif(NOT BUILD_SHARED_LIBS) #-----------------------------------------------------------------------------# diff --git a/demos/speed/a4_aux.c b/demos/speed/a4_aux.c index 7251ae9dbe..3c08905be6 100644 --- a/demos/speed/a4_aux.c +++ b/demos/speed/a4_aux.c @@ -16,7 +16,7 @@ #include "a4_aux.h" -ALLEGRO_AUDIO_STREAM *_midi_stream; +A5O_AUDIO_STREAM *_midi_stream; /* @@ -26,7 +26,7 @@ ALLEGRO_AUDIO_STREAM *_midi_stream; /* emulate get_config_string() */ -const char *get_config_string(const ALLEGRO_CONFIG *cfg, const char *section, +const char *get_config_string(const A5O_CONFIG *cfg, const char *section, const char *name, const char *def) { const char *v = al_get_config_value(cfg, section, name); @@ -37,7 +37,7 @@ const char *get_config_string(const ALLEGRO_CONFIG *cfg, const char *section, /* emulate get_config_int() */ -int get_config_int(const ALLEGRO_CONFIG *cfg, const char *section, +int get_config_int(const A5O_CONFIG *cfg, const char *section, const char *name, int def) { const char *v = al_get_config_value(cfg, section, name); @@ -48,7 +48,7 @@ int get_config_int(const ALLEGRO_CONFIG *cfg, const char *section, /* emulate set_config_int() */ -void set_config_int(ALLEGRO_CONFIG *cfg, const char *section, const char *name, +void set_config_int(A5O_CONFIG *cfg, const char *section, const char *name, int val) { char buf[32]; @@ -67,7 +67,7 @@ void set_config_int(ALLEGRO_CONFIG *cfg, const char *section, const char *name, #define MAX_KEYBUF 16 -int key[ALLEGRO_KEY_MAX]; +int key[A5O_KEY_MAX]; int joy_left; int joy_right; @@ -75,16 +75,16 @@ int joy_b1; static int keybuf[MAX_KEYBUF]; static int keybuf_len = 0; -static ALLEGRO_MUTEX *keybuf_mutex; +static A5O_MUTEX *keybuf_mutex; -static ALLEGRO_EVENT_QUEUE *input_queue; +static A5O_EVENT_QUEUE *input_queue; /* initialises the input emulation */ void init_input() { - ALLEGRO_JOYSTICK *joy; + A5O_JOYSTICK *joy; keybuf_len = 0; keybuf_mutex = al_create_mutex(); @@ -115,7 +115,7 @@ void shutdown_input() /* helper function to add a keypress to a buffer */ -static void add_key(ALLEGRO_KEYBOARD_EVENT *event) +static void add_key(A5O_KEYBOARD_EVENT *event) { if ((event->unichar == 0) || (event->unichar > 255)) return; @@ -135,39 +135,39 @@ static void add_key(ALLEGRO_KEYBOARD_EVENT *event) /* emulate poll_keyboard() and poll_joystick() combined */ void poll_input() { - ALLEGRO_EVENT event; + A5O_EVENT event; while (al_get_next_event(input_queue, &event)) { switch (event.type) { - case ALLEGRO_EVENT_DISPLAY_RESIZE: + case A5O_EVENT_DISPLAY_RESIZE: al_acknowledge_resize(event.display.source); break; - case ALLEGRO_EVENT_KEY_DOWN: + case A5O_EVENT_KEY_DOWN: key[event.keyboard.keycode] = 1; break; - case ALLEGRO_EVENT_KEY_UP: + case A5O_EVENT_KEY_UP: key[event.keyboard.keycode] = 0; break; - case ALLEGRO_EVENT_KEY_CHAR: + case A5O_EVENT_KEY_CHAR: add_key(&event.keyboard); break; - case ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN: + case A5O_EVENT_JOYSTICK_BUTTON_DOWN: if (event.joystick.button == 0) joy_b1 = 1; break; - case ALLEGRO_EVENT_JOYSTICK_BUTTON_UP: + case A5O_EVENT_JOYSTICK_BUTTON_UP: if (event.joystick.button == 0) joy_b1 = 0; break; - case ALLEGRO_EVENT_JOYSTICK_AXIS: + case A5O_EVENT_JOYSTICK_AXIS: if (event.joystick.stick == 0 && event.joystick.axis == 0) { float pos = event.joystick.pos; joy_left = (pos < 0.0); @@ -175,11 +175,11 @@ void poll_input() } break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: /* retrace_count incremented */ break; - case ALLEGRO_EVENT_DISPLAY_EXPOSE: + case A5O_EVENT_DISPLAY_EXPOSE: break; } } @@ -248,21 +248,21 @@ void clear_keybuf() #define MAX_POLYGON_VERTICES 6 -ALLEGRO_DISPLAY *screen; -ALLEGRO_FONT *font; -ALLEGRO_FONT *font_video; +A5O_DISPLAY *screen; +A5O_FONT *font; +A5O_FONT *font_video; /* like create_bitmap() */ -ALLEGRO_BITMAP *create_memory_bitmap(int w, int h) +A5O_BITMAP *create_memory_bitmap(int w, int h) { int oldflags; int newflags; - ALLEGRO_BITMAP *bmp; + A5O_BITMAP *bmp; oldflags = al_get_new_bitmap_flags(); - newflags = (oldflags &~ ALLEGRO_VIDEO_BITMAP) | ALLEGRO_MEMORY_BITMAP; + newflags = (oldflags &~ A5O_VIDEO_BITMAP) | A5O_MEMORY_BITMAP; al_set_new_bitmap_flags(newflags); bmp = al_create_bitmap(w, h); al_set_new_bitmap_flags(oldflags); @@ -272,9 +272,9 @@ ALLEGRO_BITMAP *create_memory_bitmap(int w, int h) /* used to clone a video bitmap from a memory bitmap; no such function in A4 */ -ALLEGRO_BITMAP *replace_bitmap(ALLEGRO_BITMAP *bmp) +A5O_BITMAP *replace_bitmap(A5O_BITMAP *bmp) { - ALLEGRO_BITMAP *tmp = al_clone_bitmap(bmp); + A5O_BITMAP *tmp = al_clone_bitmap(bmp); al_destroy_bitmap(bmp); return tmp; } @@ -310,13 +310,13 @@ void rotate_sprite(BITMAP *bitmap, int x, int y, int angle) { */ void solid_mode() { - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); } /* emulate makecol() */ -ALLEGRO_COLOR makecol(int r, int g, int b) +A5O_COLOR makecol(int r, int g, int b) { return al_map_rgb(r, g, b); } @@ -324,7 +324,7 @@ ALLEGRO_COLOR makecol(int r, int g, int b) /* emulate hline() */ -void hline(int x1, int y, int x2, ALLEGRO_COLOR c) +void hline(int x1, int y, int x2, A5O_COLOR c) { al_draw_line(x1+0.5, y+0.5, x2+0.5, y+0.5, c, 1); } @@ -332,7 +332,7 @@ void hline(int x1, int y, int x2, ALLEGRO_COLOR c) /* emulate vline() */ -void vline(int x, int y1, int y2, ALLEGRO_COLOR c) +void vline(int x, int y1, int y2, A5O_COLOR c) { al_draw_line(x+0.5, y1+0.5, x+0.5, y2+0.5, c, 1); } @@ -340,7 +340,7 @@ void vline(int x, int y1, int y2, ALLEGRO_COLOR c) /* emulate line() */ -void line(int x1, int y1, int x2, int y2, ALLEGRO_COLOR color) +void line(int x1, int y1, int x2, int y2, A5O_COLOR color) { al_draw_line(x1+0.5, y1+0.5, x2+0.5, y2+0.5, color, 1); } @@ -348,7 +348,7 @@ void line(int x1, int y1, int x2, int y2, ALLEGRO_COLOR color) /* emulate rectfill() */ -void rectfill(int x1, int y1, int x2, int y2, ALLEGRO_COLOR color) +void rectfill(int x1, int y1, int x2, int y2, A5O_COLOR color) { al_draw_filled_rectangle(x1, y1, x2+1, y2+1, color); } @@ -356,7 +356,7 @@ void rectfill(int x1, int y1, int x2, int y2, ALLEGRO_COLOR color) /* emulate circle() */ -void circle(int x, int y, int radius, ALLEGRO_COLOR color) +void circle(int x, int y, int radius, A5O_COLOR color) { al_draw_circle(x+0.5, y+0.5, radius, color, 1); } @@ -364,7 +364,7 @@ void circle(int x, int y, int radius, ALLEGRO_COLOR color) /* emulate circlefill() */ -void circlefill(int x, int y, int radius, ALLEGRO_COLOR color) +void circlefill(int x, int y, int radius, A5O_COLOR color) { al_draw_filled_circle(x+0.5, y+0.5, radius, color); } @@ -372,12 +372,12 @@ void circlefill(int x, int y, int radius, ALLEGRO_COLOR color) /* emulate stretch_sprite() */ -void stretch_sprite(ALLEGRO_BITMAP *bmp, ALLEGRO_BITMAP *sprite, +void stretch_sprite(A5O_BITMAP *bmp, A5O_BITMAP *sprite, int x, int y, int w, int h) { - ALLEGRO_STATE state; + A5O_STATE state; - al_store_state(&state, ALLEGRO_STATE_TARGET_BITMAP); + al_store_state(&state, A5O_STATE_TARGET_BITMAP); al_set_target_bitmap(bmp); al_draw_scaled_bitmap(sprite, @@ -390,9 +390,9 @@ void stretch_sprite(ALLEGRO_BITMAP *bmp, ALLEGRO_BITMAP *sprite, /* emulate polygon() for convex polygons only */ -void polygon(int vertices, const int *points, ALLEGRO_COLOR color) +void polygon(int vertices, const int *points, A5O_COLOR color) { - ALLEGRO_VERTEX vtxs[MAX_POLYGON_VERTICES + 2]; + A5O_VERTEX vtxs[MAX_POLYGON_VERTICES + 2]; int i; assert(vertices <= MAX_POLYGON_VERTICES); @@ -424,29 +424,29 @@ void polygon(int vertices, const int *points, ALLEGRO_COLOR color) vtxs[vertices + 1] = vtxs[1]; - al_draw_prim(vtxs, NULL, NULL, 0, vertices + 2, ALLEGRO_PRIM_TRIANGLE_FAN); + al_draw_prim(vtxs, NULL, NULL, 0, vertices + 2, A5O_PRIM_TRIANGLE_FAN); } /* emulate textout() */ -void textout(const ALLEGRO_FONT *font, const char *s, int x, int y, ALLEGRO_COLOR c) +void textout(const A5O_FONT *font, const char *s, int x, int y, A5O_COLOR c) { - al_draw_text(font, c, x, y, ALLEGRO_ALIGN_LEFT, s); + al_draw_text(font, c, x, y, A5O_ALIGN_LEFT, s); } /* emulate textout_centre() */ -void textout_centre(const ALLEGRO_FONT *font, const char *s, int x, int y, ALLEGRO_COLOR c) +void textout_centre(const A5O_FONT *font, const char *s, int x, int y, A5O_COLOR c) { - al_draw_text(font, c, x, y, ALLEGRO_ALIGN_CENTRE, s); + al_draw_text(font, c, x, y, A5O_ALIGN_CENTRE, s); } /* emulate textprintf() */ -void textprintf(const ALLEGRO_FONT *f, int x, int y, ALLEGRO_COLOR color, const char *fmt, ...) +void textprintf(const A5O_FONT *f, int x, int y, A5O_COLOR color, const char *fmt, ...) { va_list ap; char buf[256]; @@ -507,8 +507,8 @@ void get_z_rotate_matrix_f(MATRIX_f *m, float r) { float c, s; - s = sin(r * ALLEGRO_PI / 128.0); - c = cos(r * ALLEGRO_PI / 128.0); + s = sin(r * A5O_PI / 128.0); + c = cos(r * A5O_PI / 128.0); *m = identity_matrix_f; m->v[0][0] = c; @@ -585,7 +585,7 @@ void apply_matrix_f(const MATRIX_f *m, float x, float y, float z, */ -static ALLEGRO_TIMER *retrace_counter = NULL; +static A5O_TIMER *retrace_counter = NULL; @@ -639,20 +639,20 @@ void install_timer() /* emulate create_sample(), for unsigned 8-bit mono samples */ -ALLEGRO_SAMPLE *create_sample_u8(int freq, int len) +A5O_SAMPLE *create_sample_u8(int freq, int len) { char *buf = al_malloc(freq * len); - return al_create_sample(buf, len, freq, ALLEGRO_AUDIO_DEPTH_UINT8, - ALLEGRO_CHANNEL_CONF_1, true); + return al_create_sample(buf, len, freq, A5O_AUDIO_DEPTH_UINT8, + A5O_CHANNEL_CONF_1, true); } /* emulate play_sample() */ -void play_sample(ALLEGRO_SAMPLE *spl, int vol, int pan, int freq, int loop) +void play_sample(A5O_SAMPLE *spl, int vol, int pan, int freq, int loop) { - int playmode = loop ? ALLEGRO_PLAYMODE_LOOP : ALLEGRO_PLAYMODE_ONCE; + int playmode = loop ? A5O_PLAYMODE_LOOP : A5O_PLAYMODE_ONCE; al_play_sample(spl, vol/255.0, (pan - 128)/128.0, freq/1000.0, playmode, NULL); @@ -676,7 +676,7 @@ void play_midi(char const *midi, int loop) _midi_stream = al_load_audio_stream(midi, 2, 4096); al_attach_audio_stream_to_mixer(_midi_stream, al_get_default_mixer()); if (loop) { - al_set_audio_stream_playmode(_midi_stream, ALLEGRO_PLAYMODE_LOOP); + al_set_audio_stream_playmode(_midi_stream, A5O_PLAYMODE_LOOP); } } diff --git a/demos/speed/a4_aux.h b/demos/speed/a4_aux.h index fc3dba0604..0369c0f500 100644 --- a/demos/speed/a4_aux.h +++ b/demos/speed/a4_aux.h @@ -29,23 +29,23 @@ typedef struct MATRIX_f /* transformation matrix (floating point) */ /* global variables */ -extern int key[ALLEGRO_KEY_MAX]; +extern int key[A5O_KEY_MAX]; extern int joy_left; extern int joy_right; extern int joy_b1; -extern struct ALLEGRO_DISPLAY *screen; -extern struct ALLEGRO_FONT *font; -extern struct ALLEGRO_FONT *font_video; +extern struct A5O_DISPLAY *screen; +extern struct A5O_FONT *font; +extern struct A5O_FONT *font_video; typedef struct DATAFILE DATAFILE; struct DATAFILE { void* dat; }; -typedef ALLEGRO_BITMAP RLE_SPRITE; -typedef ALLEGRO_BITMAP BITMAP; -typedef ALLEGRO_COLOR RGB; -typedef ALLEGRO_FILE PACKFILE; +typedef A5O_BITMAP RLE_SPRITE; +typedef A5O_BITMAP BITMAP; +typedef A5O_COLOR RGB; +typedef A5O_FILE PACKFILE; #define allegro_init al_init #define install_keyboard al_install_keyboard @@ -65,9 +65,9 @@ typedef ALLEGRO_FILE PACKFILE; #define stricmp strcmp #define create_bitmap al_create_bitmap -const char *get_config_string(const ALLEGRO_CONFIG *cfg, const char *section, const char *name, const char *def); -int get_config_int(const ALLEGRO_CONFIG *cfg, const char *section, const char *name, int def); -void set_config_int(ALLEGRO_CONFIG *cfg, const char *section, const char *name, int val); +const char *get_config_string(const A5O_CONFIG *cfg, const char *section, const char *name, const char *def); +int get_config_int(const A5O_CONFIG *cfg, const char *section, const char *name, int def); +void set_config_int(A5O_CONFIG *cfg, const char *section, const char *name, int val); void init_input(void); void shutdown_input(void); @@ -77,25 +77,25 @@ int keypressed(void); int readkey(void); void clear_keybuf(void); -ALLEGRO_BITMAP *create_memory_bitmap(int w, int h); -ALLEGRO_BITMAP *replace_bitmap(ALLEGRO_BITMAP *bmp); +A5O_BITMAP *create_memory_bitmap(int w, int h); +A5O_BITMAP *replace_bitmap(A5O_BITMAP *bmp); void stretch_blit(BITMAP *bitmap, int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2); void blit(BITMAP *bitmap, int x1, int y1, int x2, int y2, int w, int h); void draw_sprite(BITMAP *bitmap, int x, int y); void rotate_sprite(BITMAP *bitmap, int x, int y, int angle); void solid_mode(void); -ALLEGRO_COLOR makecol(int r, int g, int b); -void hline(int x1, int y, int x2, ALLEGRO_COLOR c); -void vline(int x, int y1, int y2, ALLEGRO_COLOR c); -void line(int x1, int y1, int x2, int y2, ALLEGRO_COLOR color); -void rectfill(int x1, int y1, int x2, int y2, ALLEGRO_COLOR color); -void circle(int x, int y, int radius, ALLEGRO_COLOR color); -void circlefill(int x, int y, int radius, ALLEGRO_COLOR color); -void stretch_sprite(ALLEGRO_BITMAP *bmp, ALLEGRO_BITMAP *sprite, int x, int y, int w, int h); -void polygon(int vertices, const int *points, ALLEGRO_COLOR color); -void textout(struct ALLEGRO_FONT const *font, const char *s, int x, int y, ALLEGRO_COLOR c); -void textout_centre(struct ALLEGRO_FONT const *font, const char *s, int x, int y, ALLEGRO_COLOR c); -void textprintf(struct ALLEGRO_FONT const *f, int x, int y, ALLEGRO_COLOR color, const char *fmt, ...); +A5O_COLOR makecol(int r, int g, int b); +void hline(int x1, int y, int x2, A5O_COLOR c); +void vline(int x, int y1, int y2, A5O_COLOR c); +void line(int x1, int y1, int x2, int y2, A5O_COLOR color); +void rectfill(int x1, int y1, int x2, int y2, A5O_COLOR color); +void circle(int x, int y, int radius, A5O_COLOR color); +void circlefill(int x, int y, int radius, A5O_COLOR color); +void stretch_sprite(A5O_BITMAP *bmp, A5O_BITMAP *sprite, int x, int y, int w, int h); +void polygon(int vertices, const int *points, A5O_COLOR color); +void textout(struct A5O_FONT const *font, const char *s, int x, int y, A5O_COLOR c); +void textout_centre(struct A5O_FONT const *font, const char *s, int x, int y, A5O_COLOR c); +void textprintf(struct A5O_FONT const *f, int x, int y, A5O_COLOR color, const char *fmt, ...); void get_scaling_matrix_f(MATRIX_f *m, float x, float y, float z); void get_z_rotate_matrix_f(MATRIX_f *m, float r); @@ -109,8 +109,8 @@ int64_t retrace_count(void); void rest(unsigned int time); void install_timer(void); -struct ALLEGRO_SAMPLE *create_sample_u8(int freq, int len); -void play_sample(struct ALLEGRO_SAMPLE *spl, int vol, int pan, int freq, int loop); +struct A5O_SAMPLE *create_sample_u8(int freq, int len); +void play_sample(struct A5O_SAMPLE *spl, int vol, int pan, int freq, int loop); void play_midi(char const *filename, int loop); void stop_midi(void); int install_sound(void); diff --git a/demos/speed/badguys.c b/demos/speed/badguys.c index fc3649776d..652ac2b4ba 100644 --- a/demos/speed/badguys.c +++ b/demos/speed/badguys.c @@ -243,11 +243,11 @@ int update_badguys() int dead; /* testcode: enter clears the level */ - if ((cheat) && (key[ALLEGRO_KEY_ENTER])) { + if ((cheat) && (key[A5O_KEY_ENTER])) { shutdown_badguys(); b = NULL; - while (key[ALLEGRO_KEY_ENTER]) + while (key[A5O_KEY_ENTER]) poll_input_wait(); } @@ -396,7 +396,7 @@ int update_badguys() void draw_badguys(int r, int g, int b, int (*project)(float *f, int *i, int c)) { BADGUY *bad = evildudes; - ALLEGRO_COLOR c = makecol(r, g, b); + A5O_COLOR c = makecol(r, g, b); float shape[12]; int ishape[12]; diff --git a/demos/speed/bullets.c b/demos/speed/bullets.c index 0135cff78f..eb7909a81d 100644 --- a/demos/speed/bullets.c +++ b/demos/speed/bullets.c @@ -130,8 +130,8 @@ void update_bullets() void draw_bullets(int r, int g, int b, int (*project)(float *f, int *i, int c)) { BULLET *bul = bullets; - ALLEGRO_COLOR c1 = makecol(128+r/2, 128+g/2, 128+b/2); - ALLEGRO_COLOR c2 = (g) ? makecol(r/5, g/5, b/5) : makecol(r/4, g/4, b/4); + A5O_COLOR c1 = makecol(128+r/2, 128+g/2, 128+b/2); + A5O_COLOR c2 = (g) ? makecol(r/5, g/5, b/5) : makecol(r/4, g/4, b/4); float shape[6]; int ishape[6]; int i; diff --git a/demos/speed/explode.c b/demos/speed/explode.c index dadcd04963..f00223801d 100644 --- a/demos/speed/explode.c +++ b/demos/speed/explode.c @@ -99,7 +99,7 @@ void draw_explode(int r, int g, int b, int (*project)(float *f, int *i, int c)) float pos[2]; int ipos[2]; int rr, gg, bb, c, s; - ALLEGRO_COLOR col; + A5O_COLOR col; while (e) { pos[0] = e->x; diff --git a/demos/speed/hiscore.c b/demos/speed/hiscore.c index a67edd4b69..d4a2959aba 100644 --- a/demos/speed/hiscore.c +++ b/demos/speed/hiscore.c @@ -33,18 +33,18 @@ static char yourname[MAX_NAME_LEN+1] = ""; /* initialises the hiscore system */ void init_hiscore() { - ALLEGRO_PATH *path; - ALLEGRO_CONFIG *cfg; + A5O_PATH *path; + A5O_CONFIG *cfg; char buf1[256]; int i; - path = al_get_standard_path(ALLEGRO_USER_DATA_PATH); + path = al_get_standard_path(A5O_USER_DATA_PATH); if (!path) return; - al_make_directory(al_path_cstr(path, ALLEGRO_NATIVE_PATH_SEP)); + al_make_directory(al_path_cstr(path, A5O_NATIVE_PATH_SEP)); al_set_path_filename(path, "speed.rec"); - cfg = al_load_config_file(al_path_cstr(path, ALLEGRO_NATIVE_PATH_SEP)); + cfg = al_load_config_file(al_path_cstr(path, A5O_NATIVE_PATH_SEP)); if (!cfg) cfg = al_create_config(); @@ -66,14 +66,14 @@ void init_hiscore() /* shuts down the hiscore system */ void shutdown_hiscore() { - ALLEGRO_PATH *path; - ALLEGRO_CONFIG *cfg; + A5O_PATH *path; + A5O_CONFIG *cfg; char buf1[256]; int i; - path = al_get_standard_path(ALLEGRO_USER_DATA_PATH); + path = al_get_standard_path(A5O_USER_DATA_PATH); if (!path) return; - al_make_directory(al_path_cstr(path, ALLEGRO_NATIVE_PATH_SEP)); + al_make_directory(al_path_cstr(path, A5O_NATIVE_PATH_SEP)); al_set_path_filename(path, "speed.rec"); @@ -87,7 +87,7 @@ void shutdown_hiscore() al_set_config_value(cfg, "hiscore", buf1, names[i]); } - al_save_config_file(al_path_cstr(path, ALLEGRO_NATIVE_PATH_SEP), cfg); + al_save_config_file(al_path_cstr(path, A5O_NATIVE_PATH_SEP), cfg); al_destroy_config(cfg); al_destroy_path(path); @@ -100,8 +100,8 @@ static void draw_entry_box(int which, int64_t retrace_count) { const int w = MAX_NAME_LEN*8+16; const int h = 16; - ALLEGRO_BITMAP *b; - ALLEGRO_BITMAP *screen; + A5O_BITMAP *b; + A5O_BITMAP *screen; int SCREEN_W, SCREEN_H; int x; @@ -136,8 +136,8 @@ void score_table() { int SCREEN_W = al_get_display_width(screen); int SCREEN_H = al_get_display_height(screen); - ALLEGRO_BITMAP *bmp, *b; - ALLEGRO_COLOR col; + A5O_BITMAP *bmp, *b; + A5O_COLOR col; int c, i, j, x, y; int myscore = -1; @@ -221,7 +221,7 @@ void score_table() } while (retrace_count() < i*512/SCREEN_W); } - while (joy_b1 || key[ALLEGRO_KEY_SPACE] || key[ALLEGRO_KEY_ENTER] || key[ALLEGRO_KEY_ESCAPE]) + while (joy_b1 || key[A5O_KEY_SPACE] || key[A5O_KEY_ENTER] || key[A5O_KEY_ESCAPE]) poll_input_wait(); if (myscore >= 0) { @@ -238,17 +238,17 @@ void score_table() if (keypressed()) { c = readkey(); - if (((c >> 8) == ALLEGRO_KEY_ENTER) && (yourname[0])) { + if (((c >> 8) == A5O_KEY_ENTER) && (yourname[0])) { strcpy(names[myscore], yourname); sfx_explode_player(); break; } - else if (((c >> 8) == ALLEGRO_KEY_ESCAPE) && (names[myscore][0])) { + else if (((c >> 8) == A5O_KEY_ESCAPE) && (names[myscore][0])) { strcpy(yourname, names[myscore]); sfx_ping(2); break; } - else if (((c >> 8) == ALLEGRO_KEY_BACKSPACE) && (strlen(yourname) > 0)) { + else if (((c >> 8) == A5O_KEY_BACKSPACE) && (strlen(yourname) > 0)) { yourname[strlen(yourname)-1] = 0; sfx_shoot(); } @@ -265,7 +265,7 @@ void score_table() } } else { - while (!key[ALLEGRO_KEY_SPACE] && !key[ALLEGRO_KEY_ENTER] && !key[ALLEGRO_KEY_ESCAPE] && !joy_b1) { + while (!key[A5O_KEY_SPACE] && !key[A5O_KEY_ENTER] && !key[A5O_KEY_ESCAPE] && !joy_b1) { poll_input_wait(); al_draw_bitmap(bmp, 0, 0, 0); al_flip_display(); diff --git a/demos/speed/main.c b/demos/speed/main.c index c0c095d983..7cf546bf3f 100644 --- a/demos/speed/main.c +++ b/demos/speed/main.c @@ -44,7 +44,7 @@ int score; /* the main game function */ static int play_game() { - ALLEGRO_TIMER *inc_counter; + A5O_TIMER *inc_counter; int gameover = 0; int cyclenum = 0; int redraw = 1; @@ -59,7 +59,7 @@ static int play_game() init_explode(); init_message(); - #define TIMER_SPEED ALLEGRO_BPS_TO_SECS(30*(cyclenum+2)) + #define TIMER_SPEED A5O_BPS_TO_SECS(30*(cyclenum+2)) inc_counter = al_create_timer(TIMER_SPEED); al_start_timer(inc_counter); @@ -93,7 +93,7 @@ static int play_game() } /* take a screenshot? */ - if (key[ALLEGRO_KEY_PRINTSCREEN]) { + if (key[A5O_KEY_PRINTSCREEN]) { static int ss_count = 0; char fname[80]; @@ -102,19 +102,19 @@ static int play_game() al_save_bitmap(fname, al_get_backbuffer(screen)); - while (key[ALLEGRO_KEY_PRINTSCREEN]) + while (key[A5O_KEY_PRINTSCREEN]) poll_input_wait(); al_set_timer_count(inc_counter, 0); } /* toggle fullscreen window */ - if (key[ALLEGRO_KEY_F]) { + if (key[A5O_KEY_F]) { int flags = al_get_display_flags(screen); - al_set_display_flag(screen, ALLEGRO_FULLSCREEN_WINDOW, - !(flags & ALLEGRO_FULLSCREEN_WINDOW)); + al_set_display_flag(screen, A5O_FULLSCREEN_WINDOW, + !(flags & A5O_FULLSCREEN_WINDOW)); - while (key[ALLEGRO_KEY_F]) + while (key[A5O_KEY_F]) poll_input_wait(); } @@ -186,7 +186,7 @@ int main(int argc, char *argv[]) int w = 0, h = 0; int www = FALSE; int i, n; - int display_flags = ALLEGRO_GENERATE_EXPOSE_EVENTS; + int display_flags = A5O_GENERATE_EXPOSE_EVENTS; srand(time(NULL)); @@ -218,7 +218,7 @@ int main(int argc, char *argv[]) } else if (strcmp(argv[i], "-fullscreen") == 0) { /* if no width is specified, assume fullscreen_window */ - display_flags |= w ? ALLEGRO_FULLSCREEN : ALLEGRO_FULLSCREEN_WINDOW; + display_flags |= w ? A5O_FULLSCREEN : A5O_FULLSCREEN_WINDOW; } else { n = atoi(argv[i]); @@ -230,10 +230,10 @@ int main(int argc, char *argv[]) if (!w) { w = n; - if (display_flags & ALLEGRO_FULLSCREEN_WINDOW) { + if (display_flags & A5O_FULLSCREEN_WINDOW) { /* toggle from fullscreen_window to fullscreen */ - display_flags &= ~ALLEGRO_FULLSCREEN_WINDOW; - display_flags |= ALLEGRO_FULLSCREEN; + display_flags &= ~A5O_FULLSCREEN_WINDOW; + display_flags |= A5O_FULLSCREEN; } } else if (!h) { @@ -267,7 +267,7 @@ int main(int argc, char *argv[]) } if (!w || !h) { - if (argc == 1 || (display_flags & ALLEGRO_FULLSCREEN_WINDOW)) { + if (argc == 1 || (display_flags & A5O_FULLSCREEN_WINDOW)) { w = 640; h = 480; } @@ -278,8 +278,8 @@ int main(int argc, char *argv[]) } /* set the screen mode */ - al_set_new_display_option(ALLEGRO_SAMPLE_BUFFERS, 1, ALLEGRO_SUGGEST); - al_set_new_display_option(ALLEGRO_SAMPLES, 4, ALLEGRO_SUGGEST); + al_set_new_display_option(A5O_SAMPLE_BUFFERS, 1, A5O_SUGGEST); + al_set_new_display_option(A5O_SAMPLES, 4, A5O_SUGGEST); al_set_new_display_flags(display_flags); screen = al_create_display(w, h); @@ -294,14 +294,14 @@ int main(int argc, char *argv[]) * loaded into a video bitmap for the game view. Blech! */ al_init_font_addon(); - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); font = al_create_builtin_font(); if (!font) { fprintf(stderr, "Error creating builtin font\n"); return 1; } - al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP); + al_set_new_bitmap_flags(A5O_VIDEO_BITMAP); font_video = al_create_builtin_font(); if (!font_video) { fprintf(stderr, "Error creating builtin font\n"); diff --git a/demos/speed/player.c b/demos/speed/player.c index 34fb4f3971..0905420f24 100644 --- a/demos/speed/player.c +++ b/demos/speed/player.c @@ -208,7 +208,7 @@ int update_player() poll_input(); /* quit game? */ - if (key[ALLEGRO_KEY_ESCAPE]) + if (key[A5O_KEY_ESCAPE]) return -1; /* safe period while initing */ @@ -237,10 +237,10 @@ int update_player() /* handle user left/right input */ if (!die_time) { - if ((joy_left) || (key[ALLEGRO_KEY_LEFT])) + if ((joy_left) || (key[A5O_KEY_LEFT])) vel -= 0.005; - if ((joy_right) || (key[ALLEGRO_KEY_RIGHT])) + if ((joy_right) || (key[A5O_KEY_RIGHT])) vel += 0.005; } @@ -257,7 +257,7 @@ int update_player() /* fire bullets */ if ((!die_time) && (!init_time) && (!fire_time)) { - if ((key[ALLEGRO_KEY_SPACE]) || (joy_b1)) { + if ((key[A5O_KEY_SPACE]) || (joy_b1)) { fire_bullet(); fire_time = 24; } diff --git a/demos/speed/sound.c b/demos/speed/sound.c index cf92664932..c5d1830982 100644 --- a/demos/speed/sound.c +++ b/demos/speed/sound.c @@ -21,16 +21,16 @@ /* generated sample waveforms */ -static ALLEGRO_SAMPLE *zap; -static ALLEGRO_SAMPLE *bang; -static ALLEGRO_SAMPLE *bigbang; -static ALLEGRO_SAMPLE *ping; -static ALLEGRO_SAMPLE *sine; -static ALLEGRO_SAMPLE *square; -static ALLEGRO_SAMPLE *saw; -static ALLEGRO_SAMPLE *bd; -static ALLEGRO_SAMPLE *snare; -static ALLEGRO_SAMPLE *hihat; +static A5O_SAMPLE *zap; +static A5O_SAMPLE *bang; +static A5O_SAMPLE *bigbang; +static A5O_SAMPLE *ping; +static A5O_SAMPLE *sine; +static A5O_SAMPLE *square; +static A5O_SAMPLE *saw; +static A5O_SAMPLE *bd; +static A5O_SAMPLE *snare; +static A5O_SAMPLE *hihat; @@ -576,9 +576,9 @@ static int part_time[NUM_PARTS]; static int freq_table[256]; -static ALLEGRO_SAMPLE_INSTANCE *part_voice[NUM_PARTS]; +static A5O_SAMPLE_INSTANCE *part_voice[NUM_PARTS]; -static ALLEGRO_TIMER *music_timer; +static A5O_TIMER *music_timer; #define PAN(x) (((x) - 128)/128.0) @@ -719,10 +719,10 @@ static void init_music() al_attach_sample_instance_to_mixer(part_voice[2], al_get_default_mixer()); al_attach_sample_instance_to_mixer(part_voice[3], al_get_default_mixer()); - al_set_sample_instance_playmode(part_voice[0], ALLEGRO_PLAYMODE_LOOP); - al_set_sample_instance_playmode(part_voice[1], ALLEGRO_PLAYMODE_LOOP); - al_set_sample_instance_playmode(part_voice[2], ALLEGRO_PLAYMODE_LOOP); - al_set_sample_instance_playmode(part_voice[3], ALLEGRO_PLAYMODE_ONCE); + al_set_sample_instance_playmode(part_voice[0], A5O_PLAYMODE_LOOP); + al_set_sample_instance_playmode(part_voice[1], A5O_PLAYMODE_LOOP); + al_set_sample_instance_playmode(part_voice[2], A5O_PLAYMODE_LOOP); + al_set_sample_instance_playmode(part_voice[3], A5O_PLAYMODE_ONCE); al_set_sample_instance_gain(part_voice[0], 192/255.0); al_set_sample_instance_gain(part_voice[1], 192/255.0); @@ -734,7 +734,7 @@ static void init_music() al_set_sample_instance_pan(part_voice[2], PAN(32)); al_set_sample_instance_pan(part_voice[3], PAN(128)); - music_timer = al_create_timer(ALLEGRO_BPS_TO_SECS(22)); + music_timer = al_create_timer(A5O_BPS_TO_SECS(22)); } @@ -743,7 +743,7 @@ static void init_music() static int ping_vol; static int ping_freq; static int ping_count; -static ALLEGRO_TIMER *ping_timer; +static A5O_TIMER *ping_timer; static int ping_proc(void) @@ -761,14 +761,14 @@ static int ping_proc(void) /* thread to keep the music playing and the pings pinging */ -static ALLEGRO_THREAD *sound_update_thread; +static A5O_THREAD *sound_update_thread; -static void *sound_update_proc(ALLEGRO_THREAD *thread, void *arg) +static void *sound_update_proc(A5O_THREAD *thread, void *arg) { - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; (void)arg; queue = al_create_event_queue(); diff --git a/demos/speed/title.c b/demos/speed/title.c index db9cb0a593..c7f6afce82 100644 --- a/demos/speed/title.c +++ b/demos/speed/title.c @@ -16,7 +16,7 @@ /* draws text with a dropshadow */ -static void textout_shadow(char *msg, int x, int y, ALLEGRO_COLOR c) +static void textout_shadow(char *msg, int x, int y, A5O_COLOR c) { textout_centre(font, msg, x+1, y+1, makecol(0, 0, 0)); textout_centre(font, msg, x, y, c); @@ -29,13 +29,13 @@ int title_screen() { int SCREEN_W = al_get_display_width(screen); int SCREEN_H = al_get_display_height(screen); - ALLEGRO_BITMAP *bmp, *b; - ALLEGRO_COLOR white = makecol(255, 255, 255); + A5O_BITMAP *bmp, *b; + A5O_COLOR white = makecol(255, 255, 255); int i, j, y; bmp = create_memory_bitmap(SCREEN_W, SCREEN_H); al_set_target_bitmap(bmp); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); for (i=0; irefresh_rate variable for fullscreen modes under D3D. +- Set the A5O_DISPLAY->refresh_rate variable for fullscreen modes under D3D. - Make d3d_clear return immediately if the display is in a lost state. @@ -2071,9 +2071,9 @@ Graphics: - Added subtractive blending. al_set_blender() takes another parameter. -- Added ALLEGRO_FULLSCREEN_WINDOW display flag (X11 and D3D for now). +- Added A5O_FULLSCREEN_WINDOW display flag (X11 and D3D for now). -- Allow changing ALLEGRO_FULLSCREEN_WINDOW with al_toggle_display_flag. +- Allow changing A5O_FULLSCREEN_WINDOW with al_toggle_display_flag. - Figured out how to switch display modes using Carbon on OS X 10.6. @@ -2207,7 +2207,7 @@ Examples: alongside Allegro (currently GLX only). Commented out in the build system for now. -- ex_fs_window: New example to test ALLEGRO_FULLSCREEN_WINDOW flag and +- ex_fs_window: New example to test A5O_FULLSCREEN_WINDOW flag and al_toggle_display_flag. - ex_blend2: Updated to test subtractive blending, including scaled/rotated @@ -2250,7 +2250,7 @@ Core: should be "int main(int, char **)", or the code will not compile on OS X. For C, either of the normal ANSI forms is fine. - \#define ALLEGRO_NO_MAGIC_MAIN disables the \#pragma or name mangling, so + \#define A5O_NO_MAGIC_MAIN disables the \#pragma or name mangling, so you can write a WinMain() or use al_run_main() yourself. Graphics: @@ -2411,7 +2411,7 @@ Graphics: - Fixed a strange bug with textured primitives (u/v repeat flags were being ignored on occasion). -- Added ALLEGRO_VIDEO_BITMAP for consistency. +- Added A5O_VIDEO_BITMAP for consistency. Input: @@ -2485,7 +2485,7 @@ Audio addon: - Add al_uninstall_audio exit function. -- Added ALLEGRO_EVENT_AUDIO_STREAM_FINISHED event to signify when non-looping +- Added A5O_EVENT_AUDIO_STREAM_FINISHED event to signify when non-looping streams made with al_load_audio_stream reach the end of the file. - Fixed a deadlock when destroying voices. @@ -2526,7 +2526,7 @@ Graphics: - Make al_set_current_display(NULL); unset the current display. -- Added ALLEGRO_LOCK_READWRITE flag for al_lock_bitmap (in place of 0). +- Added A5O_LOCK_READWRITE flag for al_lock_bitmap (in place of 0). - Fixed window titles which contain non-ASCII characters in X11. @@ -2548,7 +2548,7 @@ Filesystem: - Renamed the filesystem entry functions, mainly to include "fs_entry" in their names instead of just "entry". -- Reordered and renamed ALLEGRO_FS_INTERFACE members. +- Reordered and renamed A5O_FS_INTERFACE members. - Make al_read_directory() not return . and .. directory entries. @@ -2558,7 +2558,7 @@ Filesystem: Events: -- Exported ALLEGRO_EVENT_TYPE_IS_USER. +- Exported A5O_EVENT_TYPE_IS_USER. Threads: @@ -2588,7 +2588,7 @@ Image addon: - Renamed the IIO addon to "allegro_image". -- Renamed \*\_entry functions that take ALLEGRO_FILE * arguments to *_stream. +- Renamed \*\_entry functions that take A5O_FILE * arguments to *_stream. - Fixed off-by-one error in greyscale JPEG loader. @@ -2596,7 +2596,7 @@ Audio addons: - Renamed the kcm_audio addon to "allegro_audio". -- Renamed ALLEGRO_STREAM and stream functions to ALLEGRO\_AUDIO\_STREAM +- Renamed A5O_STREAM and stream functions to ALLEGRO\_AUDIO\_STREAM and al\_\*audio_stream\*. - Renamed al_stream_from_file to al_load_audio_stream @@ -2643,7 +2643,7 @@ Primitives addon: correspond to (x=0, y=0) on the texture bitmap. - Added a way to use texture coordinates measured in pixels. Changed - ALLEGRO_VERTEX to use them by default. + A5O_VERTEX to use them by default. PhysicsFS: @@ -2700,19 +2700,19 @@ Graphics: - Made is_wgl_extension_supported() fail gracefuly. -- Added ALLEGRO_ALPHA_TEST bitmap flag. +- Added A5O_ALPHA_TEST bitmap flag. - Minor optimizations in some memory blitting routines. Input: -- Replaced (ALLEGRO_EVENT_SOURCE *) casting with type-safe functions, namely +- Replaced (A5O_EVENT_SOURCE *) casting with type-safe functions, namely al_get_keyboard_event_source, al_get_mouse_event_source, al_get_joystick_event_source, al_get_display_event_source, al_get_timer_event_source, etc. - Made it so that users can derive their own structures from - ALLEGRO_EVENT_SOURCE. al_create_user_event_source() is replaced by + A5O_EVENT_SOURCE. al_create_user_event_source() is replaced by al_init_user_event_source(). - Fixed a problem on Windows where the joystick never regains focus when @@ -2720,8 +2720,8 @@ Input: - Fixed a problem with missing key repeat with broken X.Org drivers. -- Implemented ALLEGRO_EVENT_MOUSE_ENTER_DISPLAY, - ALLEGRO_EVENT_MOUSE_LEAVE_DISPLAY for X11. +- Implemented A5O_EVENT_MOUSE_ENTER_DISPLAY, + A5O_EVENT_MOUSE_LEAVE_DISPLAY for X11. Image I/O addon: @@ -2757,7 +2757,7 @@ Audio addons: - Renamed a few streaming functions to refer to fragments/buffers as fragments consistently. -- Added missing getters for ALLEGRO_SAMPLE fields. +- Added missing getters for A5O_SAMPLE fields. - Fixed mutex locking problems with kcm_audio objects. @@ -2793,7 +2793,7 @@ Changes from 4.9.11 to 4.9.12 (July 2009) - Fixed bugs in Windows keyboard driver (Todd Cope). -- Fixed problems with ALLEGRO_MOUSE_STATE buttons on Windows (Milan Mimica). +- Fixed problems with A5O_MOUSE_STATE buttons on Windows (Milan Mimica). - Fixed problems with PhysicsFS addon DLL on MSVC (Peter Wang). @@ -2853,16 +2853,16 @@ Input: Filesystem: -- Merged ALLEGRO_FS_HOOK_ENTRY_INTERFACE into ALLEGRO_FS_INTERFACE - and made ALLEGRO_FS_INTERFACE public. +- Merged A5O_FS_HOOK_ENTRY_INTERFACE into A5O_FS_INTERFACE + and made A5O_FS_INTERFACE public. - Added al_set_fs_interface and al_get_fs_interface. -- Made al_opendir take an ALLEGRO_FS_ENTRY. +- Made al_opendir take an A5O_FS_ENTRY. - Removed functions which are obsolete or probably have no use. -- Made al_get_standard_path(ALLEGRO_PROGRAM_PATH) return a path +- Made al_get_standard_path(A5O_PROGRAM_PATH) return a path with an empty filename. Path routines: @@ -2877,7 +2877,7 @@ Primitives addon: - Added support for textured primitives in software. -- Introduced ALLEGRO_PRIM_COLOR, removed ALLEGRO_VBUFFER. +- Introduced A5O_PRIM_COLOR, removed A5O_VBUFFER. - Exposed the software line and triangle drawers to the user. @@ -2941,10 +2941,10 @@ Graphics: - Changed the direction of rotation for al_draw_rotated* from counter-clockwise to clockwise. -- Added new pixel format ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE which guanrantees +- Added new pixel format A5O_PIXEL_FORMAT_ABGR_8888_LE which guanrantees component ordering. -- Added ALLEGRO_NO_PRESERVE_TEXTURE flag. +- Added A5O_NO_PRESERVE_TEXTURE flag. - Fixed horizontal flipping in plain software blitting routines. @@ -2990,21 +2990,21 @@ File I/O: - Change al_fputs() not to do its own CR insertion. -- Add al_fopen_fd() to create an ALLEGRO_FILE from an existing file +- Add al_fopen_fd() to create an A5O_FILE from an existing file descriptor. Filesystem: -- Changed al_getcwd, al_get_entry_name to return ALLEGRO_PATHs. +- Changed al_getcwd, al_get_entry_name to return A5O_PATHs. -- Renamed al_get_path to al_get_standard_path, and to return an ALLEGRO_PATH. +- Renamed al_get_path to al_get_standard_path, and to return an A5O_PATH. -- Changed al_readdir to return an ALLEGRO_FS_ENTRY. +- Changed al_readdir to return an A5O_FS_ENTRY. - Added al_path_create_dir. - Removed some filesystem querying functions which take string paths - (ALLEGRO_FS_ENTRY versions will do). + (A5O_FS_ENTRY versions will do). Config routines: @@ -3041,9 +3041,9 @@ Font addons: - functions are called "draw_text" instead of "textout" - centre/right alignment handled by a flag instead of functions - - functions accepting ALLEGRO_USTR arguments provided + - functions accepting A5O_USTR arguments provided - substring support is removed so 'count' arguments not needed in usual - case, however ALLEGRO_USTR functions provide similar thing. + case, however A5O_USTR functions provide similar thing. - Removed al_font_is_compatible_font. @@ -3078,7 +3078,7 @@ Primitives addon: - Removed global state flags. -- Removed normals from ALLEGRO_VERTEX. +- Removed normals from A5O_VERTEX. - Removed read/write flags from vertex buffers. @@ -3148,13 +3148,13 @@ Graphics: - Fixed bugs in software scaled/rotated blit routines. -- Added a new pixel format ALLEGRO_PIXEL_FORMAT_ABGR_F32. - Removed ALLEGRO_PIXEL_FORMAT_ANY_15_WITH_ALPHA, - ALLEGRO_PIXEL_FORMAT_ANY_24_WITH_ALPHA. +- Added a new pixel format A5O_PIXEL_FORMAT_ABGR_F32. + Removed A5O_PIXEL_FORMAT_ANY_15_WITH_ALPHA, + A5O_PIXEL_FORMAT_ANY_24_WITH_ALPHA. - Added support for creating OpenGL 3.0 contexts (untested; only WGL/GLX for - now). Relevant display flags are ALLEGRO_OPENGL_3_0 and - ALLEGRO_OPENGL_FORWARD_COMPATIBLE. + now). Relevant display flags are A5O_OPENGL_3_0 and + A5O_OPENGL_FORWARD_COMPATIBLE. - Allow disabling any OpenGL extensions from allegro.cfg to test alternative rendering paths. @@ -3167,7 +3167,7 @@ Input: - Implemented al_set_mouse_xy under X11. -- Added ALLEGRO_EVENT_MOUSE_WARPED event for al_set_mouse_xy(). +- Added A5O_EVENT_MOUSE_WARPED event for al_set_mouse_xy(). Path routines: @@ -3182,19 +3182,19 @@ Path routines: Unicode: -- Changed type of ALLEGRO_USTR; now you should use pointers to ALLEGRO_USTRs. +- Changed type of A5O_USTR; now you should use pointers to A5O_USTRs. - Added UTF-16 conversion routines. Other core: -- Added ALLEGRO_GET_EVENT_TYPE for constructing integers for event type IDs. +- Added A5O_GET_EVENT_TYPE for constructing integers for event type IDs. - Renamed configuration function names to conform to conventions. - Removed public MIN/MAX/ABS/MID/SGN/CLAMP/TRUE/FALSE macros. -- Replaced AL_PI by ALLEGRO_PI and documented it as part of public API. +- Replaced AL_PI by A5O_PI and documented it as part of public API. Audio addons: @@ -3212,7 +3212,7 @@ Font addons: Image I/O addon: -- Made the capability to load/save images from/to ALLEGRO_FS_ENTRYs public. +- Made the capability to load/save images from/to A5O_FS_ENTRYs public. - Added missing locking to .png save function. @@ -3305,7 +3305,7 @@ Graphics: - Added separate alpha blending. -- Added ALLEGRO_PIXEL_FORMAT_ANY. +- Added A5O_PIXEL_FORMAT_ANY. - Honour al_set_new_window_position() in X11 port. @@ -3322,7 +3322,7 @@ Input: - Fixed a bug in wmouse.c where y was not changed in al_set_mouse_xy. -- Support ALLEGRO_EVENT_MOUSE_ENTER/LEAVE_DISPLAY events in Windows. +- Support A5O_EVENT_MOUSE_ENTER/LEAVE_DISPLAY events in Windows. Addons: @@ -3450,7 +3450,7 @@ Addons: Examples: -- Add an example to test the ALLEGRO_KEYBOARD_STATE `display' field. +- Add an example to test the A5O_KEYBOARD_STATE `display' field. - Add an example for testing config routines. @@ -3480,7 +3480,7 @@ General: Graphics: - Added allegro5/a5_opengl.h, which has to be included by programs - to use OpenGL specifics. ALLEGRO_EXCLUDE_GLX and ALLEGRO_EXCLUDE_WGL can + to use OpenGL specifics. A5O_EXCLUDE_GLX and A5O_EXCLUDE_WGL can be #defined to exclude GLX and WGL OpenGL extensions respectively. - Added allegro/a5_direct3d.h, which has to be included by programs @@ -3581,14 +3581,14 @@ Events: Audio addons: -- Made ALLEGRO_STREAM objects emit events for empty fragments that need +- Made A5O_STREAM objects emit events for empty fragments that need to be refilled. - Added a possiblity to drain a stream created by al_stream_from_file(). - Added a function to rewind a stream. -- Added gain support to ALLEGRO_STREAM and ALLEGRO_SAMPLE objects. +- Added gain support to A5O_STREAM and A5O_SAMPLE objects. - Made it possible to attach a sample to a mixer that isn't already attached to something. @@ -3625,7 +3625,7 @@ Examples: - Split ex_events into smaller examples. -- Made the demo use ALLEGRO_STREAM to play music. +- Made the demo use A5O_STREAM to play music. - Build an app bundle from the demo, on Mac OS X. @@ -3891,7 +3891,7 @@ Changes from 4.9.1 to 4.9.2 (November 2007) - Jon Rafkind fixed up allegro-config. -- Trent Gamblin added some documentation on ALLEGRO_MSESTATE. +- Trent Gamblin added some documentation on A5O_MSESTATE. - Trent Gamblin listed the examples in readme_a5.txt. @@ -3926,14 +3926,14 @@ Changes from 4.9.1 to 4.9.2 (November 2007) - Elias Pschernig added a script to automatically upload the naturaldocs generated documentation to the website. -- Peter Wang fixed missed renamings from AL_ to ALLEGRO_ in the +- Peter Wang fixed missed renamings from AL_ to A5O_ in the Linux and X code. - Elias Pschernig merged 4.9-newgfx back to 4.9. -- Peter Wang fixed a "ALLEGRO__JOYSTICK" typo. +- Peter Wang fixed a "A5O__JOYSTICK" typo. -- Trent Gamblin renamed AL_ to ALLEGRO_ in input, events, and timer +- Trent Gamblin renamed AL_ to A5O_ in input, events, and timer code. - Elias Pschernig implemented outline flag and blending for @@ -3955,7 +3955,7 @@ Changes from 4.9.1 to 4.9.2 (November 2007) - Peter Wang mergedd changes in r7948:10859 on 4.9 branch to 4.9-newgfx branch. -- Peter Wang enabled WANT_D3D by default. Only set ALLEGRO_D3D +- Peter Wang enabled WANT_D3D by default. Only set A5O_D3D on Windows. - Trent Gamblin made al_acknowledge_resize take the display as a @@ -3964,7 +3964,7 @@ Changes from 4.9.1 to 4.9.2 (November 2007) - Trent Gamblin fixed some warnings and made the MinGW build compilable statically with gcc 4.2.1. -- Peter Wang fixed a bug in ALLEGRO_CONVERT_BGR_565_TO_ARGB_4444. +- Peter Wang fixed a bug in A5O_CONVERT_BGR_565_TO_ARGB_4444. - Peter Wang renamed al_memory_management_functions() to al_set_memory_management_functions() and added some extra @@ -4008,7 +4008,7 @@ Changes from 4.9.1 to 4.9.2 (November 2007) - Trent Gamblin made 60hz the default refresh rate of the D3D driver. - Trent Gamblin changed al_create_mouse_cursor to accept - ALLEGRO_BITMAP structures. + A5O_BITMAP structures. - Trent Gamblin renamed __al_unmap_rgba to al_unmap_rgba_ex in the glx driver. @@ -4102,20 +4102,20 @@ Changes from 4.9.1 to 4.9.2 (November 2007) - Elias Pschernig removed masking from the GLX driver. - Trent Gamblin implemented blending for memory bitmaps - (very slow unless the blend mode is ALLEGRO_ONE,ALLEGRO_ZERO with a + (very slow unless the blend mode is A5O_ONE,A5O_ZERO with a pure white blend color). - Trent Gamblin implemented blending for the D3D driver. - Trent Gamblin added - ALLEGRO_PIXEL_FORMAT_ANY_(15|16|24|32)_(WITH_ALPHA|NO_ALPHA) - formats, used ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA in locking + A5O_PIXEL_FORMAT_ANY_(15|16|24|32)_(WITH_ALPHA|NO_ALPHA) + formats, used A5O_PIXEL_FORMAT_ANY_32_NO_ALPHA in locking examples, and ixed some formatting. - Trent Gamblin added al_clone_bitmap which makes an exact copy of the color-data of a bitmap. -- Trent Gamblin added a ALLEGRO_KEEP_BITMAP_FORMAT flag that forces +- Trent Gamblin added a A5O_KEEP_BITMAP_FORMAT flag that forces Allegro to use the same format as the disk file when loading bitmaps. - Elias Pschernig implemented video bitmap masking for the GLX driver (by @@ -4123,16 +4123,16 @@ Changes from 4.9.1 to 4.9.2 (November 2007) - Elias Pschernig fixed clipping in the GLX driver. -- Trent Gamblin removed ALLEGRO_MASK_SOURCE flag in favor of - ALLEGRO_USE_MASKING. Mask color is now a bitmap property. Removed - ALLEGRO_NO_ALPHA flag and changed the meaning of - ALLEGRO_USE_ALPHA to mean do alpha blending or not. Added +- Trent Gamblin removed A5O_MASK_SOURCE flag in favor of + A5O_USE_MASKING. Mask color is now a bitmap property. Removed + A5O_NO_ALPHA flag and changed the meaning of + A5O_USE_ALPHA to mean do alpha blending or not. Added al_set/get_bitmap_mask_color and removed al_set/get_mask_color. New masking example added (exnew_masking). - Trent Gamblin added proper clipping to al_put_pixel. -- Trent Gamblin renamed graphics stuff from AL_ to ALLEGRO_ and removed +- Trent Gamblin renamed graphics stuff from AL_ to A5O_ and removed patterned drawing. - Elias Pschernig implemented clipping for the X11 GLX driver (only for @@ -4428,7 +4428,7 @@ Changes from 4.9.1 to 4.9.2 (November 2007) - Matthew Leverton submitted a fix for MSVC 6 regarding MSVC's lack of a \_\_FUNCTION\_\_ macro. -- orz, Matthew Leverton, and Peter Wang made the ALLEGRO_USE_C=1 +- orz, Matthew Leverton, and Peter Wang made the A5O_USE_C=1 option to work under MinGW and MSVC. - Anthony Cassidy fixed a typo. diff --git a/docs/src/changes-5.1.txt b/docs/src/changes-5.1.txt index e6eabc000f..ae9cacbae4 100644 --- a/docs/src/changes-5.1.txt +++ b/docs/src/changes-5.1.txt @@ -37,7 +37,7 @@ Android port: - Fix Android crash on file access. - - Implement ALLEGRO_FULLSCREEN_WINDOW on Android. + - Implement A5O_FULLSCREEN_WINDOW on Android. - Fix crash if display is destroyed while the app is switched out. @@ -95,7 +95,7 @@ Python: - Fix ordering issue for HAPTIC* structs. - - Fix missing ALLEGRO_PRIM_ATTR_NUM. + - Fix missing A5O_PRIM_ATTR_NUM. Other: @@ -149,12 +149,12 @@ Graphics: - Add `al_set_blend_color` and `al_set_blender`, for additional blending modes. - - Add `ALLEGRO_MAXIMIZED` display flag. + - Add `A5O_MAXIMIZED` display flag. - Add `al_reparent_bitmap`, `al_get_bitmap_x/y`. This allows changing the offset of a sub-bitmap. - - Make `ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA` actually pick a format without an + - Make `A5O_PIXEL_FORMAT_ANY_NO_ALPHA` actually pick a format without an alpha channel. - Add `al_premul_rgba` and `al_premul_rgba_f` convenience functions for @@ -246,16 +246,16 @@ Video addon: - Reduce latency of `al_get_video_frame` for the Theora backend. - - Make the Theora backend send the `ALLEGRO_VIDEO_FRAME_SHOW` events. + - Make the Theora backend send the `A5O_VIDEO_FRAME_SHOW` events. - Rename `al_get_video_width/height` to `al_get_video_scaled_width/height` which now return the aspect corrected size of the video frame. - Rename `al_pause_video/al_is_video_paused` to `al_get/set_video_playing`. - - Add `ALLEGRO_EVENT_VIDEO_FINISHED` event. + - Add `A5O_EVENT_VIDEO_FINISHED` event. - - Remove `ALLEGRO_EVENT_VIDEO_FRAME_ALLOC` event. + - Remove `A5O_EVENT_VIDEO_FRAME_ALLOC` event. - Remove `al_get_video_aspect_ratio`. @@ -400,7 +400,7 @@ iOS port: - Hack around iOS not creating mipmaps (jmasterx). - - If the supported orientation is `ALLEGRO_DISPLAY_ORIENTATION_UNKNOWN`, + - If the supported orientation is `A5O_DISPLAY_ORIENTATION_UNKNOWN`, default to supporting all orientations. - Get Cosmic Protector to compile again. @@ -443,7 +443,7 @@ Audio addon: - Disable processing of the XM zero-speed event. - - Disable processing of module loop points if `ALLEGRO_PLAYMODE_ONCE` is set. + - Disable processing of module loop points if `A5O_PLAYMODE_ONCE` is set. - Fix a buffer overflow bug. @@ -519,7 +519,7 @@ Input: Graphics: - Add block compression pixel formats - (ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1/DXT3/DXT5) for compressed video + (A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1/DXT3/DXT5) for compressed video bitmaps. This includes an API to fetch compressed block size (`al_get_pixel_block_width/height/size`) as well as API to load and unload compressed bitmap data without paying a runtime compression cost @@ -625,11 +625,11 @@ Core: Graphics: - - Spell ALLEGRO_DST_COLOR, ALLEGRO_INVERSE_DST_COLOR with "DEST" + - Spell A5O_DST_COLOR, A5O_INVERSE_DST_COLOR with "DEST" (with compatibility defines). - - Fix bug which meant ALLEGRO_INVERSE_SRC_COLOR and - ALLEGRO_INVERSE_DEST_COLOR never actually worked on D3D. + - Fix bug which meant A5O_INVERSE_SRC_COLOR and + A5O_INVERSE_DEST_COLOR never actually worked on D3D. - Fix horizontal and vertical shears which were not composing with translations correctly. @@ -651,13 +651,13 @@ Graphics: - Fix al_get_d3d_texture_size returning zeros. - - Remove ALLEGRO_FORCE_LOCKING flag. + - Remove A5O_FORCE_LOCKING flag. - Setup GL viewport and projection in al_acknowledge_resize on Android. - Improve implementation of display options on Android: use the same display setting scoring code as other ports; handle SUGGEST display options - properly; map ALLEGRO_COLOR_SIZE to EGL_BUFFER_SIZE attributes. + properly; map A5O_COLOR_SIZE to EGL_BUFFER_SIZE attributes. Filesystem: @@ -752,7 +752,7 @@ Audio codec addon: Image addon: - Fix many problems in Android native image loader, including: - supporting ALLEGRO_NO_PREMULTIPLIED_ALPHA, respecting the new bitmap + supporting A5O_NO_PREMULTIPLIED_ALPHA, respecting the new bitmap format, working for non-APK assets, not crashing on failure. Native dialogs addon: @@ -772,7 +772,7 @@ Primitives addon: - Add indexed buffer API. - - Polylines with ALLEGRO_LINE_CAP_CLOSED cap style did not draw correctly + - Polylines with A5O_LINE_CAP_CLOSED cap style did not draw correctly with thickness == 0. - Take into account the projection matrix when computing the scale of the @@ -963,7 +963,7 @@ Shaders: - Shader variable setters operate on the shader of the target bitmap. - - Rename ALLEGRO_USE_PROGRAMMABLE_PIPELINE to ALLEGRO_PROGRAMMABLE_PIPELINE. + - Rename A5O_USE_PROGRAMMABLE_PIPELINE to A5O_PROGRAMMABLE_PIPELINE. - Rename al_link_shader to al_build_shader. @@ -1011,7 +1011,7 @@ Displays: - Switch to new NSTrackingArea API (OS X). - - Set ALLEGRO_NO_PRESERVE_TEXTURE on backbuffer (OpenGL). + - Set A5O_NO_PRESERVE_TEXTURE on backbuffer (OpenGL). Graphics: @@ -1079,9 +1079,9 @@ Primitives addon: - Fix a few incorrect usages of al_lock_vertex_buffer - - Disallow 3 component vectors for ALLEGRO_PRIM_TEX_COORD. + - Disallow 3 component vectors for A5O_PRIM_TEX_COORD. - - Add a whole bunch of new ALLEGRO_PRIM_STORAGE values. + - Add a whole bunch of new A5O_PRIM_STORAGE values. - Primitives addon was ignoring the filter settings of textures in the D3D backend. @@ -1160,7 +1160,7 @@ Displays: - Fix windows not having a minimise button when set to windowed state from fullscreen window state. -- Respect ALLEGRO_FRAMELESS flag properly when toggling from +- Respect A5O_FRAMELESS flag properly when toggling from fullscreen window state to windowed state (Windows). - Don't generate DISPLAY_LOST events when resizing a fullscreen display. @@ -1173,7 +1173,7 @@ Displays: - Add al_set_display_icons (plural), implemented for X11 and Windows. -- Add ALLEGRO_GTK_TOPLEVEL display flag for X11. +- Add A5O_GTK_TOPLEVEL display flag for X11. - Fix window resizing when using shaders (X11). @@ -1203,10 +1203,10 @@ File I/O: Filesystem: -- Keep absolute path in ALLEGRO_FS_ENTRYs so that later changes to the +- Keep absolute path in A5O_FS_ENTRYs so that later changes to the current working directory do not affect the interpretation of the path. -- Set ALLEGRO_FILEMODE_HIDDEN properly on Unix. +- Set A5O_FILEMODE_HIDDEN properly on Unix. - Make sure stat mode bits are cleared in default implementation of al_update_fs_entry. @@ -1226,9 +1226,9 @@ Audio addons: Font addon: -- Avoid making x offset non-integral for ALLEGRO_ALIGN_CENTRE. +- Avoid making x offset non-integral for A5O_ALIGN_CENTRE. -- Make al_draw_justified_* respect ALLEGRO_ALIGN_INTEGER. +- Make al_draw_justified_* respect A5O_ALIGN_INTEGER. TTF addon: @@ -1258,7 +1258,7 @@ Native dialogs addon: - Add al_shutdown_native_dialog_addon. -- Add native menu support on X11 (requires ALLEGRO_GTK_TOPLEVEL). +- Add native menu support on X11 (requires A5O_GTK_TOPLEVEL). - Add native menu support on OS X. @@ -1360,7 +1360,7 @@ Image addon: Font addons: -- Added ALLEGRO_ALIGN_INTEGER text drawing flag (Todd Cope). +- Added A5O_ALIGN_INTEGER text drawing flag (Todd Cope). - Added a new al_get_font_ranges function. @@ -1387,7 +1387,7 @@ Audio addon: Android port: -- Support ALLEGRO_KEYBOARD_STATE. +- Support A5O_KEYBOARD_STATE. - Fix return type of APK_tell (Todd Cope). @@ -1442,7 +1442,7 @@ Displays: - Fixed missing/incorrect resize events under Windows. -- Fixed ALLEGRO_FULLSCREEN_WINDOW under OS X. +- Fixed A5O_FULLSCREEN_WINDOW under OS X. - Fix al_set_new_display_adapter on OS X. @@ -1543,7 +1543,7 @@ Core: - Add userdata to Windows window callbacks and rename the functions (Matthew Leverton). -- Fix ALLEGRO_STATIC_ASSERT collisions from different files included in the +- Fix A5O_STATIC_ASSERT collisions from different files included in the same translation unit. Reported by tobing. - Make al_ustr_empty_string const correct. @@ -1554,7 +1554,7 @@ Filesystem: - Make stdio al_fopen implementation set proper errno on failure. -- Make al_get_standard_path(ALLEGRO_TEMP_PATH) treat environment values +- Make al_get_standard_path(A5O_TEMP_PATH) treat environment values as directory names even without a trailing slash on Unix. - Fix typo preventing get_executable_name from using System V procfs @@ -1565,17 +1565,17 @@ Displays: - Fixed bug on Windows where two SWITCH_IN events were fired when window was minimized/restored (Michael Swiger). -- Fixed inverted al_toggle_display_flag(ALLEGRO_NOFRAME) logic under Windows +- Fixed inverted al_toggle_display_flag(A5O_NOFRAME) logic under Windows as well as a bug where repeatedly setting the flag to on would make the window grow bigger and bigger (Michael Swiger). -- Fixed inverted al_toggle_display_flag(ALLEGRO_NOFRAME) logic in X11. +- Fixed inverted al_toggle_display_flag(A5O_NOFRAME) logic in X11. - Rename al_toggle_display_flag to al_set_display_flag, retaining the older name for compatibility. -- Add ALLEGRO_FRAMELESS as a preferred synonym for the confusing - ALLEGRO_NOFRAME flag. +- Add A5O_FRAMELESS as a preferred synonym for the confusing + A5O_NOFRAME flag. - Set WM_NAME for some window managers (X11). @@ -1583,7 +1583,7 @@ Displays: - Make al_destroy_display handle display disconnection properly. The user will need to clean up then call al_destroy_display after receiving - ALLEGRO_EVENT_DISPLAY_DISCONNECTED (iOS). + A5O_EVENT_DISPLAY_DISCONNECTED (iOS). Graphics: @@ -1598,9 +1598,9 @@ Graphics: - Added al_create_custom_bitmap. -- Remove ALLEGRO_PRESERVE_TEXTURE flag. The idea is to always preserve +- Remove A5O_PRESERVE_TEXTURE flag. The idea is to always preserve textures unless directed otherwise by the user with - ALLEGRO_NO_PRESERVE_TEXTURE. + A5O_NO_PRESERVE_TEXTURE. - Added al_clear_depth_buffer and al_set_render_state functions. @@ -1614,7 +1614,7 @@ OpenGL: - Fix null pointer dereference if backbuffer creation fails. Reported by Max Savenkov. -- Made the ALLEGRO_OPENGL_FORWARD_COMPATIBLE flag work with al_draw_bitmap. +- Made the A5O_OPENGL_FORWARD_COMPATIBLE flag work with al_draw_bitmap. - Texture should be 'complete' (min/mag and wrap set) before glTexImage2D. @@ -1664,7 +1664,7 @@ Input: - Do not permanently change the locale for the X11 keyboard driver. Set LC_CTYPE only, not LC_ALL. -- Update ALLEGRO_MOUSE_STATE even if mouse emulation event source isn't +- Update A5O_MOUSE_STATE even if mouse emulation event source isn't attached to an event queue (Android and iOS). - Don't report shakes at program start accidentally (iOS). @@ -1679,7 +1679,7 @@ Android port: - Go fullscreen (no title/status bar). -- Generate ALLEGRO_EVENT_DISPLAY_HALT_DRAWING, RESUME_DRAWING events instead +- Generate A5O_EVENT_DISPLAY_HALT_DRAWING, RESUME_DRAWING events instead of SWITCH_IN/OUT. - Add an APK file driver for reading assets directly from Android app bundles. @@ -1728,7 +1728,7 @@ Font addon: TTF addon: -- Added ALLEGRO_TTF_NO_AUTOHINT font loading flag to disable the Auto Hinter +- Added A5O_TTF_NO_AUTOHINT font loading flag to disable the Auto Hinter which is enabled by default in newer version of FreeType (Michaล‚ Cichoล„). - Unlock glyph cache page at end of text_length and get_text_dimensions @@ -1808,8 +1808,8 @@ Ports: Core: -- Make al_ref_cstr, al_ref_ustr and al_ref_buffer return const ALLEGRO_USTR* - instead of just an ALLEGRO_USTR* (Paul Suntsov). +- Make al_ref_cstr, al_ref_ustr and al_ref_buffer return const A5O_USTR* + instead of just an A5O_USTR* (Paul Suntsov). Graphics: @@ -1821,7 +1821,7 @@ Displays: - Fixed a problem with wrong window size when restoring a minimised window, in code that was added to support window constraints (jmasterx). -- Set ALLEGRO_MINIMIZED display flag on Windows (Zac Evans). +- Set A5O_MINIMIZED display flag on Windows (Zac Evans). - Prevent a deadlock during display creation on X. @@ -1906,22 +1906,22 @@ Core: Graphics: - Added bitmap conversion API: al_convert_bitmap, al_convert_bitmaps, with - bitmap flag ALLEGRO_CONVERT_BITMAP and display option - ALLEGRO_AUTO_CONVERT_BITMAPS. Automatic bitmap conversion is enabled by + bitmap flag A5O_CONVERT_BITMAP and display option + A5O_AUTO_CONVERT_BITMAPS. Automatic bitmap conversion is enabled by default. - Added al_draw_tinted_scaled_rotated_bitmap_region. -- Added new ALLEGRO_PIXEL_FORMAT_LUMINANCE_8 format. +- Added new A5O_PIXEL_FORMAT_LUMINANCE_8 format. -- Added a new bitmap flag ALLEGRO_KEEP_INDEX. +- Added a new bitmap flag A5O_KEEP_INDEX. - Separate bitmap loader flags from bitmap flags. This adds three functions: al_load_bitmap_flags, al_load_bitmap_flags_f and al_load_bitmap_font_flags. -- Add ALLEGRO_SRC_COLOR, ALLEGRO_DST_COLOR blending modes (Jon Rafkind). +- Add A5O_SRC_COLOR, A5O_DST_COLOR blending modes (Jon Rafkind). -- Add ALLEGRO_INVERSE_SRC_COLOR and ALLEGRO_INVERSE_DST_COLOR blending modes. +- Add A5O_INVERSE_SRC_COLOR and A5O_INVERSE_DST_COLOR blending modes. - Made al_compose_transform do a full 3d multiply. @@ -1939,15 +1939,15 @@ Displays: - Added al_get_display_orientation. -- Added a new display option ALLEGRO_SUPPORTED_ORIENTATIONS to specify the +- Added a new display option A5O_SUPPORTED_ORIENTATIONS to specify the supported orientations (default is just portrait as before). - Added al_change_display_option function, initially only for - ALLEGRO_SUPPORTED_ORIENTATIONS. + A5O_SUPPORTED_ORIENTATIONS. - Add two new display events (only implemented on iOS right now). - ALLEGRO_EVENT_DISPLAY_HALT_DRAWING tells the app to stop all drawing and - ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING tells it it can start drawing again. + A5O_EVENT_DISPLAY_HALT_DRAWING tells the app to stop all drawing and + A5O_EVENT_DISPLAY_RESUME_DRAWING tells it it can start drawing again. SWITCH_OUT/IN on iOS were redefined from "going into/out of background" to "going active/inactive". diff --git a/docs/src/changes-5.2.txt b/docs/src/changes-5.2.txt index 3848356532..6985259442 100644 --- a/docs/src/changes-5.2.txt +++ b/docs/src/changes-5.2.txt @@ -51,7 +51,7 @@ Core: - Add `al_can_set_keyboard_leds` and `al_can_get_mouse_cursor_position` (TRDario) -- Allow outputting logs to STDOUT via ALLEGRO_TRACE environment variable +- Allow outputting logs to STDOUT via A5O_TRACE environment variable (SiegeLord) - Add `al_get_current_shader` (TRDario) @@ -83,7 +83,7 @@ MacOS: - Add a workaround for live resizing not working. Enable it via `[osx] allow_live_resize = false` in `allegro5.cfg` and then listen and respect - `ALLEGRO_EVENT_DISPLAY_HALT/RESUME_DRAWING` events (#1350) (SiegeLord + Elias + `A5O_EVENT_DISPLAY_HALT/RESUME_DRAWING` events (#1350) (SiegeLord + Elias Pschernig) Linux: @@ -105,7 +105,7 @@ Linux: - Fix popup menu (#1280) (SiegeLord) -- Make AltGr (right Alt) toggle the `ALLEGRO_KEYMOD_ALTGR` modifier (SiegeLord) +- Make AltGr (right Alt) toggle the `A5O_KEYMOD_ALTGR` modifier (SiegeLord) Windows: @@ -116,7 +116,7 @@ Windows: - Work on improving Window positioning (SiegeLord) - Make native file dialog respect the initial directory when - `ALLEGRO_FILECHOOSER_FOLDER` is set (Josรฉ Carlos HR) + `A5O_FILECHOOSER_FOLDER` is set (Josรฉ Carlos HR) - Fix the client area changing size on Windows when restoring a window (#1433) (SiegeLord) @@ -217,7 +217,7 @@ Android: Audio addon: -- Add `ALLEGRO_PLAYMODE_LOOP_ONCE` (Issue #1309). +- Add `A5O_PLAYMODE_LOOP_ONCE` (Issue #1309). - Add `al_play_audio_stream`, a 'simple' API endpoint for audio stream playback. @@ -320,7 +320,7 @@ Core: - Avoid some undefined behavior errors. -- Return key modifiers in `ALLEGRO_EVENT_KEY_UP` and `ALLEGRO_EVENT_KEY_DOWN`. +- Return key modifiers in `A5O_EVENT_KEY_UP` and `A5O_EVENT_KEY_DOWN`. - Allow calling `al_map_*` color functions before Allegro is initialized. @@ -331,9 +331,9 @@ Core: Graphics: -- Fix `ALLEGRO_KEEP_INDEX` flag for bitmaps. +- Fix `A5O_KEEP_INDEX` flag for bitmaps. -- Add `ALLEGRO_OPENGL_CORE_PROFILE` display flag. +- Add `A5O_OPENGL_CORE_PROFILE` display flag. Emscripten: @@ -457,7 +457,7 @@ Graphics: - Fix creation of the bitmap depth buffer for non-square bitmaps (Kevin Wellwood). - - Fix `ALLEGRO_ALPHA_TEST_VALUE` not being interpreted correctly. + - Fix `A5O_ALPHA_TEST_VALUE` not being interpreted correctly. - Fix reported bitshifts for `ARGB_4444` and `RGBA_4444` pixel formats. @@ -473,7 +473,7 @@ Android: - Use DisplayListener to listen to orientation changes. - - Implement `ALLEGRO_FRAMELESS` on Android. This hides the navigation buttons + - Implement `A5O_FRAMELESS` on Android. This hides the navigation buttons and the bar on top. Linux: @@ -618,7 +618,7 @@ Windows: - Fix `al_draw_indexed_primitive` while using Direct3D. - Fix crash when passing `NULL` display to `al_show_native_file_dialog` while - using `ALLEGRO_FILECHOOSER_FOLDER`. + using `A5O_FILECHOOSER_FOLDER`. - Fix OpenGL version reporting after display creation (Edgar Reynaldo). @@ -690,7 +690,7 @@ Android port: - Remove limit on the working directory length. - - Fix `ALLEGRO_MAXIMIZED` flag. + - Fix `A5O_MAXIMIZED` flag. - Fix build with older Android NDKs. @@ -771,7 +771,7 @@ Core: - Fix `fs_stdio_read_directory` appending an extra slash. - - Fix `al_set_window_constraints` when the flag ALLEGRO_MAXIMIZED is set. + - Fix `al_set_window_constraints` when the flag A5O_MAXIMIZED is set. - Fix `al_set_clipping_rectangle` when out-of-bounds (Bruce Pascoe). @@ -799,7 +799,7 @@ Linux port: - Fix KEY_CHAR events under X11 with compose key enabled. - - Fix clearing the `ALLEGRO_MAXIMIZED` flag under X11. + - Fix clearing the `A5O_MAXIMIZED` flag under X11. - Add `al_x_set_initial_icon`. @@ -834,7 +834,7 @@ Audio addon: - Allow setting the buffer size for ALSA. - Don't apply gain twice for sample instances and streams when pan is not - `ALLEGRO_PAN_NONE`. + `A5O_PAN_NONE`. - Disallow attaching mixers with different channel configurations. @@ -868,7 +868,7 @@ Native dialog addon: - Improved path behavior in GTK native file dialog ([bk]door.maus). - - Enable `ALLEGRO_FILECHOOSER_FOLDER` On Linux (Todd Cope). + - Enable `A5O_FILECHOOSER_FOLDER` On Linux (Todd Cope). - Use unique ids to identify menu items internally, fixing their event sources. @@ -1003,7 +1003,7 @@ Core: - Enforce backwards compatibility in the version check, rather than erroneously allowing forwards compatiblity. - - Temporarily remove new extensions in ALLEGRO_OGL_EXT_LIST as that broke ABI + - Temporarily remove new extensions in A5O_OGL_EXT_LIST as that broke ABI compatibility. OSX port: @@ -1059,7 +1059,7 @@ OSX port: - Fix mouse warping behavior. - - Exit fullscreen mode if ALLEGRO_FULLSCREEN_WINDOW is set when destroying a + - Exit fullscreen mode if A5O_FULLSCREEN_WINDOW is set when destroying a display (otherwise if you destroy and recreate display without terminating the program, a white window kicks around). @@ -1138,7 +1138,7 @@ Font addon: - Make `al_get_text_dimensions` and `al_get_glyph_dimensions` return exact bounding boxes (koro). - - Add `ALLEGRO_GLYPH` structure and `al_get_glyph`, allowing for some + - Add `A5O_GLYPH` structure and `al_get_glyph`, allowing for some additional optimization when drawing fonts. Examples: @@ -1180,7 +1180,7 @@ OSX port: - Fix other various scaling issues. - - Make toggling ALLEGRO_FRAMELESS work. + - Make toggling A5O_FRAMELESS work. - Fix an issue where fullscreen windows would occasionally leave empty space for the titlebar. @@ -1219,7 +1219,7 @@ Documentation: Other: - Add a stability system where some unstable APIs need to be opted into by - defining `ALLEGRO_UNSTABLE` before including Allegro headers. + defining `A5O_UNSTABLE` before including Allegro headers. Audio addon: diff --git a/docs/src/refman/allegro_version.tex.cmake b/docs/src/refman/allegro_version.tex.cmake index 339bb2c1c9..91b48bca92 100644 --- a/docs/src/refman/allegro_version.tex.cmake +++ b/docs/src/refman/allegro_version.tex.cmake @@ -1 +1 @@ -@ALLEGRO_VERSION@ +@A5O_VERSION@ diff --git a/docs/src/refman/audio.txt b/docs/src/refman/audio.txt index abce66b52b..98fc164cd1 100644 --- a/docs/src/refman/audio.txt +++ b/docs/src/refman/audio.txt @@ -16,18 +16,18 @@ simultaneously (don't forget to call [al_install_audio] beforehand). If these succeed, you can now call [al_play_sample], with data obtained by [al_load_sample], for example (don't forget to [initialize the acodec addon][al_init_acodec_addon]). In order to stop samples, you can use the -[ALLEGRO_SAMPLE_ID] that al_play_sample returns. +[A5O_SAMPLE_ID] that al_play_sample returns. If you want to play large audio files (e.g. background music) without loading the whole file at once you can use [al_play_audio_stream] (after calling -[al_reserve_samples]). This will load and play an `ALLEGRO_AUDIO_STREAM`. Note +[al_reserve_samples]). This will load and play an `A5O_AUDIO_STREAM`. Note that the basic API only supports one such audio stream playing at once. -### API: ALLEGRO_SAMPLE_ID +### API: A5O_SAMPLE_ID -An ALLEGRO_SAMPLE_ID represents a sample being played via [al_play_sample]. +An A5O_SAMPLE_ID represents a sample being played via [al_play_sample]. It can be used to later stop the sample with [al_stop_sample]. The underlying -ALLEGRO_SAMPLE_INSTANCE can be extracted using [al_lock_sample_id]. +A5O_SAMPLE_INSTANCE can be extracted using [al_lock_sample_id]. ### API: al_install_audio @@ -85,16 +85,16 @@ Playback may fail because all the reserved sample instances are currently used. Parameters: * gain - relative volume at which the sample is played; 1.0 is normal. -* pan - 0.0 is centred, -1.0 is left, 1.0 is right, or ALLEGRO_AUDIO_PAN_NONE. +* pan - 0.0 is centred, -1.0 is left, 1.0 is right, or A5O_AUDIO_PAN_NONE. * speed - relative speed at which the sample is played; 1.0 is normal. -* loop - ALLEGRO_PLAYMODE_ONCE, ALLEGRO_PLAYMODE_LOOP, or ALLEGRO_PLAYMODE_BIDIR +* loop - A5O_PLAYMODE_ONCE, A5O_PLAYMODE_LOOP, or A5O_PLAYMODE_BIDIR * ret_id - if non-NULL the variable which this points to will be assigned an id representing the sample being played. If [al_play_sample] returns `false`, then the contents of ret_id are invalid and must not be used as argument to other functions. -See also: [al_load_sample], [ALLEGRO_PLAYMODE], [ALLEGRO_AUDIO_PAN_NONE], -[ALLEGRO_SAMPLE_ID], [al_stop_sample], [al_stop_samples], [al_lock_sample_id]. +See also: [al_load_sample], [A5O_PLAYMODE], [A5O_AUDIO_PAN_NONE], +[A5O_SAMPLE_ID], [al_stop_sample], [al_stop_samples], [al_lock_sample_id]. ### API: al_stop_sample @@ -110,16 +110,16 @@ See also: [al_stop_sample] ### API: al_lock_sample_id -Locks a [ALLEGRO_SAMPLE_ID], returning the underlying [ALLEGRO_SAMPLE_INSTANCE]. +Locks a [A5O_SAMPLE_ID], returning the underlying [A5O_SAMPLE_INSTANCE]. This allows you to adjust the various properties of the instance (such as volume, pan, etc) while the sound is playing. This function will return `NULL` if the sound corresponding to the id is no longer playing. -While locked, `ALLEGRO_SAMPLE_ID` will be unavailable to additional calls to +While locked, `A5O_SAMPLE_ID` will be unavailable to additional calls to [al_play_sample], even if the sound stops while locked. To put the -`ALLEGRO_SAMPLE_ID` back into the pool for reuse, make sure to call +`A5O_SAMPLE_ID` back into the pool for reuse, make sure to call `al_unlock_sample_id` when you're done with the instance. See also: [al_play_sample], [al_unlock_sample_id] @@ -130,9 +130,9 @@ Since: 5.2.3 ### API: al_unlock_sample_id -Unlocks a [ALLEGRO_SAMPLE_ID], allowing future calls to [al_play_sample] to +Unlocks a [A5O_SAMPLE_ID], allowing future calls to [al_play_sample] to reuse it if possible. Note that after the id is unlocked, the -[ALLEGRO_SAMPLE_INSTANCE] that was previously returned by [al_lock_sample_id] +[A5O_SAMPLE_INSTANCE] that was previously returned by [al_lock_sample_id] will possibly be playing a different sound, so you should only use it after locking the id again. @@ -165,7 +165,7 @@ Since: 5.2.8 ### API: al_play_audio_stream_f -Loads and plays an audio file from [ALLEGRO_FILE] stream, streaming it is +Loads and plays an audio file from [A5O_FILE] stream, streaming it is needed. This API can only play one audio stream at a time. This requires a default mixer to be set, which is typically done via [al_reserve_samples], but can also be done via [al_set_default_mixer]. @@ -193,14 +193,14 @@ Since: 5.2.8 ## Samples -### API: ALLEGRO_SAMPLE +### API: A5O_SAMPLE -An ALLEGRO_SAMPLE object stores the data necessary for playing pre-defined +An A5O_SAMPLE object stores the data necessary for playing pre-defined digital audio. It holds a user-specified PCM data buffer and information about its format (data length, depth, frequency, channel configuration). You can have -the same ALLEGRO_SAMPLE playing multiple times simultaneously. +the same A5O_SAMPLE playing multiple times simultaneously. -See also: [ALLEGRO_SAMPLE_INSTANCE] +See also: [A5O_SAMPLE_INSTANCE] ### API: al_create_sample @@ -230,7 +230,7 @@ int bytes = samples * sample_size; void *buffer = al_malloc(bytes); ~~~~ -See also: [al_destroy_sample], [ALLEGRO_AUDIO_DEPTH], [ALLEGRO_CHANNEL_CONF] +See also: [al_destroy_sample], [A5O_AUDIO_DEPTH], [A5O_CHANNEL_CONF] ### API: al_load_sample @@ -250,7 +250,7 @@ See also: [al_register_sample_loader], [al_init_acodec_addon] ### API: al_load_sample_f -Loads an audio file from an [ALLEGRO_FILE] stream into an [ALLEGRO_SAMPLE]. +Loads an audio file from an [A5O_FILE] stream into an [A5O_SAMPLE]. The file type is determined by the passed 'ident' parameter, which is a file name extension including the leading dot. @@ -284,7 +284,7 @@ See also: [al_save_sample_f], [al_register_sample_saver], ### API: al_save_sample_f -Writes a sample into a [ALLEGRO_FILE] filestream. Currently, wav is +Writes a sample into a [A5O_FILE] filestream. Currently, wav is the only supported format, and the extension must be ".wav". @@ -304,7 +304,7 @@ Free the sample data structure. If it was created with the `free_buf` parameter set to true, then the buffer will be freed with [al_free]. This function will stop any sample instances which may be playing the -buffer referenced by the [ALLEGRO_SAMPLE]. +buffer referenced by the [A5O_SAMPLE]. See also: [al_destroy_sample_instance], [al_stop_sample], [al_stop_samples] @@ -312,14 +312,14 @@ See also: [al_destroy_sample_instance], [al_stop_sample], [al_stop_samples] Return the channel configuration of the sample. -See also: [ALLEGRO_CHANNEL_CONF], [al_get_sample_depth], +See also: [A5O_CHANNEL_CONF], [al_get_sample_depth], [al_get_sample_frequency], [al_get_sample_length], [al_get_sample_data] ### API: al_get_sample_depth Return the audio depth of the sample. -See also: [ALLEGRO_AUDIO_DEPTH], [al_get_sample_channels], +See also: [A5O_AUDIO_DEPTH], [al_get_sample_channels], [al_get_sample_frequency], [al_get_sample_length], [al_get_sample_data] ### API: al_get_sample_frequency @@ -369,37 +369,37 @@ is not (indirectly) attached to a voice will remain silent. For most use cases, one (default) mixer attached to a single voice will be sufficient. You may attach mixers to other mixers in order to create complex audio chains. -Samples ([ALLEGRO_SAMPLE]) just represent "passive" buffers for sample data in -memory. In order to play a sample, a sample instance ([ALLEGRO_SAMPLE_INSTANCE]) +Samples ([A5O_SAMPLE]) just represent "passive" buffers for sample data in +memory. In order to play a sample, a sample instance ([A5O_SAMPLE_INSTANCE]) needs to be created and attached to a mixer (or voice). Sample instances control *how* the underlying samples are played. Several playback parameters (position, speed, gain, pan, playmode, playing/paused) can be adjusted. Particularly, multiple instances may be created from the same sample, e.g. with different parameters. -Audio streams ([ALLEGRO_AUDIO_STREAM]) are similar to sample instances insofar +Audio streams ([A5O_AUDIO_STREAM]) are similar to sample instances insofar as they respond to the same playback parameters and have to be attached to mixers or voices. A single audio stream can only be played once simultaneously. For example, consider the following configuration of the audio system. ~~~~c -ALLEGRO_VOICE* voice = al_create_voice(44100, ALLEGRO_AUDIO_DEPTH_INT16, - ALLEGRO_CHANNEL_CONF_2); +A5O_VOICE* voice = al_create_voice(44100, A5O_AUDIO_DEPTH_INT16, + A5O_CHANNEL_CONF_2); -ALLEGRO_MIXER* mixer_1 = al_create_mixer(44100, ALLEGRO_AUDIO_DEPTH_FLOAT32, - ALLEGRO_CHANNEL_CONF_2); -ALLEGRO_MIXER* mixer_2 = al_create_mixer(44100, ALLEGRO_AUDIO_DEPTH_FLOAT32, - ALLEGRO_CHANNEL_CONF_2); +A5O_MIXER* mixer_1 = al_create_mixer(44100, A5O_AUDIO_DEPTH_FLOAT32, + A5O_CHANNEL_CONF_2); +A5O_MIXER* mixer_2 = al_create_mixer(44100, A5O_AUDIO_DEPTH_FLOAT32, + A5O_CHANNEL_CONF_2); /* Load a stream, the stream starts in a playing state and just needs * to be attached to actually output sound. */ -ALLEGRO_AUDIO_STREAM* stream = al_load_audio_stream("music.ogg", 4, 2048); +A5O_AUDIO_STREAM* stream = al_load_audio_stream("music.ogg", 4, 2048); /* The sample needs sample instances to output sound. */ -ALLEGRO_SAMPLE* sample = al_load_sample("sound.wav") -ALLEGRO_SAMPLE_INSTANCE* instance_1 = al_create_sample_instance(sample); -ALLEGRO_SAMPLE_INSTANCE* instance_2 = al_create_sample_instance(sample); +A5O_SAMPLE* sample = al_load_sample("sound.wav") +A5O_SAMPLE_INSTANCE* instance_1 = al_create_sample_instance(sample); +A5O_SAMPLE_INSTANCE* instance_2 = al_create_sample_instance(sample); /* Attach everything up (see diagram). */ al_attach_mixer_to_voice(mixer_1, voice); @@ -433,23 +433,23 @@ instances will be attached to the default mixer, which can be changed via ## Sample instances -### API: ALLEGRO_SAMPLE_INSTANCE +### API: A5O_SAMPLE_INSTANCE -An ALLEGRO_SAMPLE_INSTANCE object represents a playable instance of a predefined +An A5O_SAMPLE_INSTANCE object represents a playable instance of a predefined sound effect. It holds information about how the effect should be played: These playback parameters consist of the looping mode, loop start/end points, playing position, speed, gain, pan and the playmode. Whether a sample instance is currently playing or paused is also one of its properties. -An instance uses the data from an [ALLEGRO_SAMPLE] object. Multiple instances may -be created from the same ALLEGRO_SAMPLE. An ALLEGRO_SAMPLE must not be +An instance uses the data from an [A5O_SAMPLE] object. Multiple instances may +be created from the same A5O_SAMPLE. An A5O_SAMPLE must not be destroyed while there are instances which reference it. -To actually produce audio output, an ALLEGRO_SAMPLE_INSTANCE must be attached to an -[ALLEGRO_MIXER] which eventually reaches an [ALLEGRO_VOICE] object. +To actually produce audio output, an A5O_SAMPLE_INSTANCE must be attached to an +[A5O_MIXER] which eventually reaches an [A5O_VOICE] object. -See also: [ALLEGRO_SAMPLE] +See also: [A5O_SAMPLE] ### API: al_create_sample_instance @@ -464,7 +464,7 @@ See also: [al_destroy_sample_instance] ### API: al_destroy_sample_instance Detaches the sample instance from anything it may be attached to and frees -it (the sample data, i.e. its ALLEGRO_SAMPLE, is *not* freed!). +it (the sample data, i.e. its A5O_SAMPLE, is *not* freed!). See also: [al_create_sample_instance] @@ -485,13 +485,13 @@ See also: [al_play_sample_instance] Return the channel configuration of the sample instance's sample data. -See also: [ALLEGRO_CHANNEL_CONF]. +See also: [A5O_CHANNEL_CONF]. ### API: al_get_sample_instance_depth Return the audio depth of the sample instance's sample data. -See also: [ALLEGRO_AUDIO_DEPTH]. +See also: [A5O_AUDIO_DEPTH]. ### API: al_get_sample_instance_frequency @@ -570,7 +570,7 @@ See also: [al_set_sample_instance_pan]. Set the pan value on a sample instance. A value of -1.0 means to play the sample only through the left speaker; +1.0 means only through the right speaker; 0.0 means the sample is centre balanced. -A special value [ALLEGRO_AUDIO_PAN_NONE] disables panning and plays the +A special value [A5O_AUDIO_PAN_NONE] disables panning and plays the sample at its original level. This will be louder than a pan value of 0.0. > Note: panning samples with more than two channels doesn't work yet. @@ -578,7 +578,7 @@ sample at its original level. This will be louder than a pan value of 0.0. Returns true on success, false on failure. Will fail if the sample instance is attached directly to a voice. -See also: [al_get_sample_instance_pan], [ALLEGRO_AUDIO_PAN_NONE] +See also: [al_get_sample_instance_pan], [A5O_AUDIO_PAN_NONE] ### API: al_get_sample_instance_time @@ -591,7 +591,7 @@ See also: [al_get_sample_instance_length] Return the playback mode of the sample instance. -See also: [ALLEGRO_PLAYMODE], [al_set_sample_instance_playmode] +See also: [A5O_PLAYMODE], [al_set_sample_instance_playmode] ### API: al_set_sample_instance_playmode @@ -599,7 +599,7 @@ Set the playback mode of the sample instance. Returns true on success, false on failure. -See also: [ALLEGRO_PLAYMODE], [al_get_sample_instance_playmode] +See also: [A5O_PLAYMODE], [al_get_sample_instance_playmode] ### API: al_get_sample_instance_playing @@ -640,8 +640,8 @@ See also: [al_attach_sample_instance_to_mixer], Return the sample data that the sample instance plays. Note this returns a pointer to an internal structure, *not* the -[ALLEGRO_SAMPLE] that you may have passed to [al_set_sample]. -However, the sample buffer of the returned ALLEGRO_SAMPLE will be the same as +[A5O_SAMPLE] that you may have passed to [al_set_sample]. +However, the sample buffer of the returned A5O_SAMPLE will be the same as the one that was used to create the sample (passed to [al_create_sample]). You can use [al_get_sample_data] on the return value to retrieve and compare it. @@ -707,17 +707,17 @@ Since: 5.2.3 ## Audio streams -### API: ALLEGRO_AUDIO_STREAM +### API: A5O_AUDIO_STREAM -An ALLEGRO_AUDIO_STREAM object is used to stream generated audio to the sound +An A5O_AUDIO_STREAM object is used to stream generated audio to the sound device, in real-time. This is done by reading from a buffer, which is split into a number of fragments. Whenever a fragment has finished playing, the user can refill it with new data. -As with [ALLEGRO_SAMPLE_INSTANCE] objects, streams store information necessary +As with [A5O_SAMPLE_INSTANCE] objects, streams store information necessary for playback, so you may not play the same stream multiple times simultaneously. -Streams also need to be attached to an [ALLEGRO_MIXER], which, eventually, reaches -an [ALLEGRO_VOICE] object. +Streams also need to be attached to an [A5O_MIXER], which, eventually, reaches +an [A5O_VOICE] object. While playing, you must periodically fill fragments with new audio data. To know when a new fragment is ready to be filled, you can either directly check @@ -725,7 +725,7 @@ with [al_get_available_audio_stream_fragments], or listen to events from the stream. You can register an audio stream event source to an event queue; see -[al_get_audio_stream_event_source]. An [ALLEGRO_EVENT_AUDIO_STREAM_FRAGMENT] +[al_get_audio_stream_event_source]. An [A5O_EVENT_AUDIO_STREAM_FRAGMENT] event is generated whenever a new fragment is ready. When you receive an event, use [al_get_audio_stream_fragment] to obtain a pointer to the fragment to be filled. The size and format are determined by the parameters passed to @@ -736,11 +736,11 @@ is provided. You must call [al_drain_audio_stream] when you're finished with supplying data to the stream. It is often a good idea to prefill the audio stream with data before -[ALLEGRO_EVENT_AUDIO_STREAM_FRAGMENT] events arrive. Here is a snippet that will +[A5O_EVENT_AUDIO_STREAM_FRAGMENT] events arrive. Here is a snippet that will fill the stream buffers with silence: ~~~~c -ALLEGRO_AUDIO_STREAM *stream = al_create_audio_stream(num_buffers, +A5O_AUDIO_STREAM *stream = al_create_audio_stream(num_buffers, samples_per_buffer, freq, depth, channel_conf); void *buf; while ((buf = al_get_audio_stream_fragment(stream))) { @@ -750,12 +750,12 @@ while ((buf = al_get_audio_stream_fragment(stream))) { ~~~~ If the stream is created by [al_load_audio_stream] or [al_play_audio_stream] -then it will also generate an [ALLEGRO_EVENT_AUDIO_STREAM_FINISHED] event if it +then it will also generate an [A5O_EVENT_AUDIO_STREAM_FINISHED] event if it reaches the end of the file and is not set to loop. ### API: al_create_audio_stream -Creates an [ALLEGRO_AUDIO_STREAM]. The stream will be set to play by default. +Creates an [A5O_AUDIO_STREAM]. The stream will be set to play by default. It will feed audio data from a buffer, which is split into a number of fragments. @@ -773,9 +773,9 @@ Parameters: * freq - The frequency, in Hertz. -* depth - Must be one of the values listed for [ALLEGRO_AUDIO_DEPTH]. +* depth - Must be one of the values listed for [A5O_AUDIO_DEPTH]. -* chan_conf - Must be one of the values listed for [ALLEGRO_CHANNEL_CONF]. +* chan_conf - Must be one of the values listed for [A5O_CHANNEL_CONF]. A sample that is referred to by the *frag_samples* parameter refers to a sequence channel intensities. E.g. if you're making a stereo stream with the @@ -821,7 +821,7 @@ contain *buffer_count* buffers with *samples* samples. The audio stream will start in the playing state. It should be attached to a voice or mixer to generate any output. -See [ALLEGRO_AUDIO_STREAM] for more details. +See [A5O_AUDIO_STREAM] for more details. Returns the stream on success, NULL on failure. @@ -834,7 +834,7 @@ See also: [al_load_audio_stream_f], [al_register_audio_stream_loader], ### API: al_load_audio_stream_f -Loads an audio file from [ALLEGRO_FILE] stream as it is needed. +Loads an audio file from [A5O_FILE] stream as it is needed. Unlike regular streams, the one returned by this function need not be fed by the user; the library will automatically @@ -846,7 +846,7 @@ name extension including the leading dot. The audio stream will start in the playing state. It should be attached to a voice or mixer to generate any output. -See [ALLEGRO_AUDIO_STREAM] for more details. +See [A5O_AUDIO_STREAM] for more details. Returns the stream on success, NULL on failure. On success the file should be considered owned by the audio stream, @@ -875,7 +875,7 @@ See also: [al_drain_audio_stream]. Retrieve the associated event source. See [al_get_audio_stream_fragment] for a description of the -[ALLEGRO_EVENT_AUDIO_STREAM_FRAGMENT] event that audio streams emit. +[A5O_EVENT_AUDIO_STREAM_FRAGMENT] event that audio streams emit. ### API: al_drain_audio_stream @@ -900,13 +900,13 @@ Return the stream frequency (in Hz). Return the stream channel configuration. -See also: [ALLEGRO_CHANNEL_CONF]. +See also: [A5O_CHANNEL_CONF]. ### API: al_get_audio_stream_depth Return the stream audio depth. -See also: [ALLEGRO_AUDIO_DEPTH]. +See also: [A5O_AUDIO_DEPTH]. ### API: al_get_audio_stream_length @@ -953,13 +953,13 @@ See also: [al_set_audio_stream_pan]. Set the pan value on an audio stream. A value of -1.0 means to play the stream only through the left speaker; +1.0 means only through the right speaker; 0.0 means the sample is centre balanced. -A special value [ALLEGRO_AUDIO_PAN_NONE] disables panning and plays the +A special value [A5O_AUDIO_PAN_NONE] disables panning and plays the stream at its original level. This will be louder than a pan value of 0.0. Returns true on success, false on failure. Will fail if the audio stream is attached directly to a voice. -See also: [al_get_audio_stream_pan], [ALLEGRO_AUDIO_PAN_NONE] +See also: [al_get_audio_stream_pan], [A5O_AUDIO_PAN_NONE] ### API: al_get_audio_stream_playing @@ -979,7 +979,7 @@ See also: [al_get_audio_stream_playing] Return the playback mode of the stream. -See also: [ALLEGRO_PLAYMODE], [al_set_audio_stream_playmode]. +See also: [A5O_PLAYMODE], [al_set_audio_stream_playmode]. ### API: al_set_audio_stream_playmode @@ -987,7 +987,7 @@ Set the playback mode of the stream. Returns true on success, false on failure. -See also: [ALLEGRO_PLAYMODE], [al_get_audio_stream_playmode]. +See also: [A5O_PLAYMODE], [al_get_audio_stream_playmode]. ### API: al_get_audio_stream_attached @@ -1026,7 +1026,7 @@ buffer to [al_set_audio_stream_fragment]. If the stream is not ready for new data, the function will return NULL. > *Note:* If you listen to events from the stream, an -[ALLEGRO_EVENT_AUDIO_STREAM_FRAGMENT] event will be generated whenever a new +[A5O_EVENT_AUDIO_STREAM_FRAGMENT] event will be generated whenever a new fragment is ready. However, getting an event is *not* a guarantee that [al_get_audio_stream_fragment] will not return NULL, so you still must check for it. @@ -1200,7 +1200,7 @@ See also: [al_register_audio_stream_loader] Register an identify handler for [al_identify_sample]. The given function will be used to detect files for the given extension. It will -be called with a single argument of type [ALLEGRO_FILE] which is a +be called with a single argument of type [A5O_FILE] which is a file handle opened for reading and located at the first byte of the file. The handler should try to read as few bytes as possible to safely determine if the given file contents correspond to the type @@ -1230,7 +1230,7 @@ See also: [al_init_acodec_addon], [al_identify_sample_f], [al_register_sample_id ### API: al_identify_sample_f -Tries to guess the audio file type of the open ALLEGRO_FILE by +Tries to guess the audio file type of the open A5O_FILE by reading the first few bytes. By default Allegro cannot recognize any file types, but calling [al_init_acodec_addon] will add detection of the types it can read. You can also use [al_register_sample_identifier] to add @@ -1257,7 +1257,7 @@ Recording is supported by the ALSA, AudioQueue, DirectSound8, and PulseAudio drivers. Enumerating or choosing other recording devices is not yet supported. -### API: ALLEGRO_AUDIO_RECORDER +### API: A5O_AUDIO_RECORDER An opaque datatype that represents a recording device. @@ -1265,7 +1265,7 @@ Since: 5.1.1 > *[Unstable API]:* The API may need a slight redesign. -### API: ALLEGRO_AUDIO_RECORDER_EVENT +### API: A5O_AUDIO_RECORDER_EVENT Structure that holds the audio recorder event data. Every event type will contain: @@ -1308,8 +1308,8 @@ frequency is the number of samples per second to record. Common values are: * 22050 * 44100 - CD quality music (if 16-bit, stereo) -For maximum compatibility, use a depth of ALLEGRO_AUDIO_DEPTH_UINT8 or -ALLEGRO_AUDIO_DEPTH_INT16, and a single (mono) channel. +For maximum compatibility, use a depth of A5O_AUDIO_DEPTH_UINT8 or +A5O_AUDIO_DEPTH_INT16, and a single (mono) channel. The recorder will not record until you start it with [al_start_audio_recorder]. @@ -1323,7 +1323,7 @@ Since: 5.1.1 Begin recording into the fragment buffer. Once a complete fragment has been captured (as specified in [al_create_audio_recorder]), an -[ALLEGRO_EVENT_AUDIO_RECORDER_FRAGMENT] event will be triggered. +[A5O_EVENT_AUDIO_RECORDER_FRAGMENT] event will be triggered. Returns true if it was able to begin recording. @@ -1358,7 +1358,7 @@ Since: 5.1.1 ### API: al_get_audio_recorder_event -Returns the event as an [ALLEGRO_AUDIO_RECORDER_EVENT]. +Returns the event as an [A5O_AUDIO_RECORDER_EVENT]. Since: 5.1.1 @@ -1388,7 +1388,7 @@ Since: 5.1.1 ## Audio devices -### API: ALLEGRO_AUDIO_DEVICE +### API: A5O_AUDIO_DEVICE An opaque datatype that represents an audio device. @@ -1416,14 +1416,14 @@ Since: 5.2.8 ## Voices -### API: ALLEGRO_VOICE +### API: A5O_VOICE A voice represents an audio device on the system, which may be a real device, or an abstract device provided by the operating system. To play back audio, you would attach a mixer, sample instance or audio stream to a voice. -See also: [ALLEGRO_MIXER], [ALLEGRO_SAMPLE], [ALLEGRO_AUDIO_STREAM] +See also: [A5O_MIXER], [A5O_SAMPLE], [A5O_AUDIO_STREAM] ### API: al_create_voice @@ -1442,7 +1442,7 @@ the actual settings. Reasonable default arguments are: ~~~~c -al_create_voice(44100, ALLEGRO_AUDIO_DEPTH_INT16, ALLEGRO_CHANNEL_CONF_2) +al_create_voice(44100, A5O_AUDIO_DEPTH_INT16, A5O_CHANNEL_CONF_2) ~~~~ See also: [al_destroy_voice] @@ -1507,13 +1507,13 @@ Return the frequency of the voice (in Hz), e.g. 44100. Return the channel configuration of the voice. -See also: [ALLEGRO_CHANNEL_CONF]. +See also: [A5O_CHANNEL_CONF]. ### API: al_get_voice_depth Return the audio depth of the voice. -See also: [ALLEGRO_AUDIO_DEPTH]. +See also: [A5O_AUDIO_DEPTH]. ### API: al_get_voice_playing @@ -1560,31 +1560,31 @@ Since: 5.2.9 ## Mixers -### API: ALLEGRO_MIXER +### API: A5O_MIXER A mixer mixes together attached streams into a single buffer. In the process, it converts channel configurations, sample frequencies and audio depths of the attached sample instances and audio streams accordingly. You can control the -quality of this conversion using ALLEGRO_MIXER_QUALITY. +quality of this conversion using A5O_MIXER_QUALITY. When going from mono to stereo (and above), the mixer reduces the volume of both channels by `sqrt(2)`. When going from stereo (and above) to mono, the mixer reduces the volume of the left and right channels by `sqrt(2)` before adding them to the center channel (if present). -### API: ALLEGRO_MIXER_QUALITY +### API: A5O_MIXER_QUALITY -* ALLEGRO_MIXER_QUALITY_POINT - point sampling -* ALLEGRO_MIXER_QUALITY_LINEAR - linear interpolation -* ALLEGRO_MIXER_QUALITY_CUBIC - cubic interpolation (since: 5.0.8, 5.1.4) +* A5O_MIXER_QUALITY_POINT - point sampling +* A5O_MIXER_QUALITY_LINEAR - linear interpolation +* A5O_MIXER_QUALITY_CUBIC - cubic interpolation (since: 5.0.8, 5.1.4) ### API: al_create_mixer Creates a mixer to attach sample instances, audio streams, or other mixers to. It will mix into a buffer at the requested frequency (in Hz) and channel count. -The only supported audio depths are ALLEGRO_AUDIO_DEPTH_FLOAT32 -and ALLEGRO_AUDIO_DEPTH_INT16 (not yet complete). +The only supported audio depths are A5O_AUDIO_DEPTH_FLOAT32 +and A5O_AUDIO_DEPTH_INT16 (not yet complete). To actually produce any output, the mixer will have to be attached to a voice using [al_attach_mixer_to_voice]. @@ -1592,12 +1592,12 @@ using [al_attach_mixer_to_voice]. Reasonable default arguments are: ~~~~c -al_create_mixer(44100, ALLEGRO_AUDIO_DEPTH_FLOAT32, ALLEGRO_CHANNEL_CONF_2) +al_create_mixer(44100, A5O_AUDIO_DEPTH_FLOAT32, A5O_CHANNEL_CONF_2) ~~~~ Returns true on success, false on error. -See also: [al_destroy_mixer], [ALLEGRO_AUDIO_DEPTH], [ALLEGRO_CHANNEL_CONF] +See also: [al_destroy_mixer], [A5O_AUDIO_DEPTH], [A5O_CHANNEL_CONF] ### API: al_destroy_mixer @@ -1707,13 +1707,13 @@ See also: [al_get_mixer_frequency] Return the mixer channel configuration. -See also: [ALLEGRO_CHANNEL_CONF]. +See also: [A5O_CHANNEL_CONF]. ### API: al_get_mixer_depth Return the mixer audio depth. -See also: [ALLEGRO_AUDIO_DEPTH]. +See also: [A5O_AUDIO_DEPTH]. ### API: al_get_mixer_gain @@ -1737,7 +1737,7 @@ See also: [al_get_mixer_gain] Return the mixer quality. -See also: [ALLEGRO_MIXER_QUALITY], [al_set_mixer_quality] +See also: [A5O_MIXER_QUALITY], [al_set_mixer_quality] ### API: al_set_mixer_quality @@ -1746,7 +1746,7 @@ anything attached to it. Returns true on success, false on failure. -See also: [ALLEGRO_MIXER_QUALITY], [al_get_mixer_quality] +See also: [A5O_MIXER_QUALITY], [al_get_mixer_quality] ### API: al_get_mixer_playing @@ -1796,31 +1796,31 @@ was created with. The sample count and user-data pointer is also passed. ## Miscelaneous -### API: ALLEGRO_AUDIO_DEPTH +### API: A5O_AUDIO_DEPTH Sample depth and type as well as signedness. Mixers only use 32-bit signed float (-1..+1), or 16-bit signed integers. Signedness is determined by an "unsigned" bit-flag applied to the depth value. -* ALLEGRO_AUDIO_DEPTH_INT8 -* ALLEGRO_AUDIO_DEPTH_INT16 -* ALLEGRO_AUDIO_DEPTH_INT24 -* ALLEGRO_AUDIO_DEPTH_FLOAT32 -* ALLEGRO_AUDIO_DEPTH_UNSIGNED +* A5O_AUDIO_DEPTH_INT8 +* A5O_AUDIO_DEPTH_INT16 +* A5O_AUDIO_DEPTH_INT24 +* A5O_AUDIO_DEPTH_FLOAT32 +* A5O_AUDIO_DEPTH_UNSIGNED For convenience: -* ALLEGRO_AUDIO_DEPTH_UINT8 -* ALLEGRO_AUDIO_DEPTH_UINT16 -* ALLEGRO_AUDIO_DEPTH_UINT24 +* A5O_AUDIO_DEPTH_UINT8 +* A5O_AUDIO_DEPTH_UINT16 +* A5O_AUDIO_DEPTH_UINT24 -### API: ALLEGRO_AUDIO_PAN_NONE +### API: A5O_AUDIO_PAN_NONE A special value for the pan property of sample instances and audio streams. Use this value to disable panning on sample instances and audio streams, and play them without attentuation implied by panning support. -ALLEGRO_AUDIO_PAN_NONE is different from a pan value of 0.0 (centered) because, +A5O_AUDIO_PAN_NONE is different from a pan value of 0.0 (centered) because, when panning is enabled, we try to maintain a constant sound power level as a sample is panned from left to right. A sound coming out of one speaker should sound as loud as it does when split over two speakers. @@ -1829,51 +1829,51 @@ original level. (Please correct us if this is wrong.) -### API: ALLEGRO_CHANNEL_CONF +### API: A5O_CHANNEL_CONF Speaker configuration (mono, stereo, 2.1, etc). -* ALLEGRO_CHANNEL_CONF_1 -* ALLEGRO_CHANNEL_CONF_2 -* ALLEGRO_CHANNEL_CONF_3 -* ALLEGRO_CHANNEL_CONF_4 -* ALLEGRO_CHANNEL_CONF_5_1 -* ALLEGRO_CHANNEL_CONF_6_1 -* ALLEGRO_CHANNEL_CONF_7_1 +* A5O_CHANNEL_CONF_1 +* A5O_CHANNEL_CONF_2 +* A5O_CHANNEL_CONF_3 +* A5O_CHANNEL_CONF_4 +* A5O_CHANNEL_CONF_5_1 +* A5O_CHANNEL_CONF_6_1 +* A5O_CHANNEL_CONF_7_1 -### API: ALLEGRO_PLAYMODE +### API: A5O_PLAYMODE Sample and stream playback mode. -* ALLEGRO_PLAYMODE_ONCE - the sample/stream is played from start to finish an +* A5O_PLAYMODE_ONCE - the sample/stream is played from start to finish an then it stops. -* ALLEGRO_PLAYMODE_LOOP - the sample/stream is played from start to finish (or +* A5O_PLAYMODE_LOOP - the sample/stream is played from start to finish (or between the two loop points). When it reaches the end, it restarts from the beginning. -* ALLEGRO_PLAYMODE_LOOP_ONCE - just like ALLEGRO_PLAYMODE_ONCE, but +* A5O_PLAYMODE_LOOP_ONCE - just like A5O_PLAYMODE_ONCE, but respects the loop end point. -* ALLEGRO_PLAYMODE_BIDIR - the sample is played from start to finish (or +* A5O_PLAYMODE_BIDIR - the sample is played from start to finish (or between the two loop points). When it reaches the end, it reverses the playback direction and plays until it reaches the beginning when it reverses the direction back to normal. This is mode is rarely supported for streams. -### API: ALLEGRO_AUDIO_EVENT_TYPE +### API: A5O_AUDIO_EVENT_TYPE Events sent by [al_get_audio_stream_event_source] or [al_get_audio_recorder_event_source]. -#### ALLEGRO_EVENT_AUDIO_STREAM_FRAGMENT +#### A5O_EVENT_AUDIO_STREAM_FRAGMENT Sent when a stream fragment is ready to be filled in. See [al_get_audio_stream_fragment]. -#### ALLEGRO_EVENT_AUDIO_STREAM_FINISHED +#### A5O_EVENT_AUDIO_STREAM_FINISHED Sent when a stream is finished. -#### ALLEGRO_EVENT_AUDIO_RECORDER_FRAGMENT +#### A5O_EVENT_AUDIO_RECORDER_FRAGMENT Sent after a user-specified number of samples have been recorded. Convert this to -[ALLEGRO_AUDIO_RECORDER_EVENT] via [al_get_audio_recorder_event]. +[A5O_AUDIO_RECORDER_EVENT] via [al_get_audio_recorder_event]. You must always check the values for the buffer and samples as they are not guaranteed to be exactly what was originally specified. @@ -1890,12 +1890,12 @@ Returns the (compiled) version of the addon, in the same format as ### API: al_get_audio_depth_size Return the size of a sample, in bytes, for the given format. The format is one -of the values listed under [ALLEGRO_AUDIO_DEPTH]. +of the values listed under [A5O_AUDIO_DEPTH]. ### API: al_get_channel_count Return the number of channels for the given channel configuration, which is one -of the values listed under [ALLEGRO_CHANNEL_CONF]. +of the values listed under [A5O_CHANNEL_CONF]. ### API: al_fill_silence diff --git a/docs/src/refman/color.txt b/docs/src/refman/color.txt index 2af9e1e323..acd47ef2bc 100644 --- a/docs/src/refman/color.txt +++ b/docs/src/refman/color.txt @@ -32,7 +32,7 @@ brightness output of the monitor will be less than half). ## API: al_color_cmyk -Return an [ALLEGRO_COLOR] structure from CMYK values (cyan, magenta, yellow, +Return an [A5O_COLOR] structure from CMYK values (cyan, magenta, yellow, black). See also: [al_color_cmyk_to_rgb], [al_color_rgb_to_cmyk] @@ -47,7 +47,7 @@ See also: [al_color_cmyk], [al_color_rgb_to_cmyk] ## API: al_color_hsl -Return an [ALLEGRO_COLOR] structure from HSL (hue, saturation, lightness) +Return an [A5O_COLOR] structure from HSL (hue, saturation, lightness) values. Parameters: @@ -75,7 +75,7 @@ See also: [al_color_rgb_to_hsl], [al_color_hsl], [al_color_hsv_to_rgb] ## API: al_color_hsv -Return an [ALLEGRO_COLOR] structure from HSV (hue, saturation, value) +Return an [A5O_COLOR] structure from HSV (hue, saturation, value) values. Parameters: @@ -130,7 +130,7 @@ See also: [al_color_html], [al_color_rgb_to_html] ## API: al_color_rgb_to_html -Create an HTML-style string representation of an [ALLEGRO_COLOR], +Create an HTML-style string representation of an [A5O_COLOR], e.g. #00faff. Parameters: @@ -153,7 +153,7 @@ See also: [al_color_html], [al_color_html_to_rgb] ## API: al_color_name -Return an [ALLEGRO_COLOR] with the given name. If the color is not found then +Return an [A5O_COLOR] with the given name. If the color is not found then black is returned. See [al_color_name_to_rgb] for the list of names. @@ -261,7 +261,7 @@ See also: [al_color_xyz], [al_color_xyz_to_rgb] ## API: al_color_xyz -Return an [ALLEGRO_COLOR] structure from XYZ values. The CIE 1931 XYZ +Return an [A5O_COLOR] structure from XYZ values. The CIE 1931 XYZ color space consists of three components in the range 0..1. The Y component corresponds to luminance and the X and Z components define the color. @@ -300,7 +300,7 @@ See also: [al_color_xyy], [al_color_xyy_to_rgb] ## API: al_color_xyy -Return an [ALLEGRO_COLOR] structure from xyY values. The Y component +Return an [A5O_COLOR] structure from xyY values. The Y component in the xyY color space is the same as the Y in XYZ. However the x and y values are computed from XYZ like this: @@ -335,7 +335,7 @@ See also: [al_color_lab], [al_color_lab_to_rgb] ## API: al_color_lab -Return an [ALLEGRO_COLOR] structure from CIE L\*a\*b\* values. The L\* +Return an [A5O_COLOR] structure from CIE L\*a\*b\* values. The L\* component corresponds to luminance from 0..1. The a\* and b\* components are in the range -1..+1. @@ -377,7 +377,7 @@ See also: [al_color_lch], [al_color_lch_to_rgb] ## API: al_color_lch -Return an [ALLEGRO_COLOR] structure from CIE LCH values. LCH colors are +Return an [A5O_COLOR] structure from CIE LCH values. LCH colors are very similar to HSL, with the same meaning of L and H and C corresponding to S. However LCH is more visually uniform. Furthermore, this function expects the angle for H in radians and not in degree. @@ -438,7 +438,7 @@ See also: [al_color_yuv], [al_color_yuv_to_rgb] ## API: al_color_yuv -Return an [ALLEGRO_COLOR] structure from YUV values. +Return an [A5O_COLOR] structure from YUV values. See also: [al_color_yuv_to_rgb], [al_color_rgb_to_yuv] @@ -476,7 +476,7 @@ See also: [al_color_oklab], [al_color_oklab_to_rgb] ## API: al_color_oklab -Return an [ALLEGRO_COLOR] structure from Oklab values. The L component +Return an [A5O_COLOR] structure from Oklab values. The L component corresponds to luminance from 0..1. The a and b components are in the range -1..+1. @@ -512,7 +512,7 @@ See also: [al_color_linear], [al_color_linear_to_rgb] ## API: al_color_linear -Return an [ALLEGRO_COLOR] structure from linear sRGB values. Allegro +Return an [A5O_COLOR] structure from linear sRGB values. Allegro RGB values are assumed to be sRGB. The sRGB standard is in wide use by various display devices. It accounts for a standard gamma correction applied to RGB colors before they get displayed. @@ -528,7 +528,7 @@ For some applications it may be useful to specify a color in linear sRGB components, in which case you can use this function. For example: ~~~~c -ALLEGRO_COLOR gray = al_color_linear(0.216, 0.216, 0.216); +A5O_COLOR gray = al_color_linear(0.216, 0.216, 0.216); char html[8]; al_color_rgb_to_html(gray.r, gray.g, gray.b, html); // "#808080" ~~~~ diff --git a/docs/src/refman/config.txt b/docs/src/refman/config.txt index bf8d12795e..28a1b9c4f7 100644 --- a/docs/src/refman/config.txt +++ b/docs/src/refman/config.txt @@ -46,25 +46,25 @@ It can then be accessed like this (make sure to check for errors in an actual program): ~~~~c -ALLEGRO_CONFIG* cfg = al_load_config_file("test.cfg"); +A5O_CONFIG* cfg = al_load_config_file("test.cfg"); printf("%s\n", al_get_config_value(cfg, "", "monster name")); /* Prints: Allegro Developer */ printf("%s\n", al_get_config_value(cfg, "weapon 0", "damage")); /* Prints: 443 */ printf("%s\n", al_get_config_value(cfg, "weapon 1", "damage")); /* Prints: 503 */ al_destroy_config(cfg); ~~~~ -## API: ALLEGRO_CONFIG +## API: A5O_CONFIG An abstract configuration structure. -## API: ALLEGRO_CONFIG_SECTION +## API: A5O_CONFIG_SECTION An opaque structure used for iterating across sections in a configuration structure. See also: [al_get_first_config_section], [al_get_next_config_section] -## API: ALLEGRO_CONFIG_ENTRY +## API: A5O_CONFIG_ENTRY An opaque structure used for iterating across entries in a configuration section. @@ -145,7 +145,7 @@ See also: [al_add_config_section] ## API: al_get_config_value Gets a pointer to an internal character buffer that will only remain valid -as long as the ALLEGRO_CONFIG structure is not destroyed. Copy the value +as long as the A5O_CONFIG structure is not destroyed. Copy the value if you need a copy. The section can be NULL or "" for the global section. Returns NULL if the section or key do not exist. @@ -182,7 +182,7 @@ values. The `iterator` parameter will receive an opaque iterator which is used by [al_get_next_config_section] to iterate over the remaining sections. The returned string and the iterator are only valid as long as no -change is made to the passed ALLEGRO_CONFIG. +change is made to the passed A5O_CONFIG. See also: [al_get_next_config_section] @@ -201,7 +201,7 @@ config or NULL if the section is empty. The `iterator` works like the one for [al_get_first_config_section]. The returned string and the iterator are only valid as long as no -change is made to the passed [ALLEGRO_CONFIG]. +change is made to the passed [A5O_CONFIG]. See also: [al_get_next_config_entry] diff --git a/docs/src/refman/direct3d.txt b/docs/src/refman/direct3d.txt index d13a2ab6e8..b223d7c85d 100644 --- a/docs/src/refman/direct3d.txt +++ b/docs/src/refman/direct3d.txt @@ -64,7 +64,7 @@ used texture, in pixels. *Parameters:* -* bitmap - ALLEGRO_BITMAP to examine +* bitmap - A5O_BITMAP to examine * u - Will hold the returned u coordinate * v - Will hold the returned v coordinate diff --git a/docs/src/refman/display.txt b/docs/src/refman/display.txt index 9daacf0ebd..fc8bc00e71 100644 --- a/docs/src/refman/display.txt +++ b/docs/src/refman/display.txt @@ -32,15 +32,15 @@ You don't have to use Allegro's drawing routines, however: since creating a disp implies the creation of an OpenGL context or Direct3D device respectively, you can use these APIs directly if you prefer to do so. Allegro provides integration for both (see the OpenGL / Direct3D sections), so you can retrieve the underlying -textures of [ALLEGRO_BITMAP]s, for example. +textures of [A5O_BITMAP]s, for example. In order to write a well-behaved application, it is necessary to remember that -displays will also inform you about important [events][ALLEGRO_EVENT_DISPLAY_EXPOSE] +displays will also inform you about important [events][A5O_EVENT_DISPLAY_EXPOSE] via their [event sources][al_get_display_event_source]. ## Display creation -### API: ALLEGRO_DISPLAY +### API: A5O_DISPLAY An opaque type representing an open display or window. @@ -88,15 +88,15 @@ See also: [al_set_new_display_flags], [al_set_display_flag] Sets various flags to be used when creating new displays on the calling thread. flags is a bitfield containing any reasonable combination of the following: -ALLEGRO_WINDOWED +A5O_WINDOWED : Prefer a windowed mode. Under multi-head X (not XRandR/TwinView), the use of more than one adapter is impossible due to bugs in X and GLX. [al_create_display] will fail if more than one adapter is attempted to be used. -ALLEGRO_FULLSCREEN_WINDOW -: Make the window span the entire screen. Unlike ALLEGRO_FULLSCREEN this +A5O_FULLSCREEN_WINDOW +: Make the window span the entire screen. Unlike A5O_FULLSCREEN this will never attempt to modify the screen resolution. Instead the pixel dimensions of the created display will be the same as the desktop. @@ -104,8 +104,8 @@ ALLEGRO_FULLSCREEN_WINDOW out of fullscreen mode later but will be ignored initially. Under Windows and X11 a fullscreen display created with this flag - will behave differently from one created with the ALLEGRO_FULLSCREEN - flag - even if the ALLEGRO_FULLSCREEN display is passed the desktop + will behave differently from one created with the A5O_FULLSCREEN + flag - even if the A5O_FULLSCREEN display is passed the desktop dimensions. The exact difference is platform dependent, but some things which may be different is how alt-tab works, how fast you can toggle between fullscreen/windowed mode or how additional monitors @@ -115,90 +115,90 @@ ALLEGRO_FULLSCREEN_WINDOW or with true Xinerama enabled is impossible due to bugs in X/GLX, creation will fail if more than one adapter is attempted to be used. -ALLEGRO_FULLSCREEN +A5O_FULLSCREEN : Prefer a fullscreen mode. Under X the use of more than one FULLSCREEN display when using multi-head X, or true Xinerama is not possible due to bugs in X and GLX, display creation will fail if more than one adapter is attempted to be used. - > *Note:* Prefer using ALLEGRO_FULLSCREEN_WINDOW as it typically provides a + > *Note:* Prefer using A5O_FULLSCREEN_WINDOW as it typically provides a better user experience as the monitor doesn't change resolution and switching away from your game via Alt-Tab works smoothly. - ALLEGRO_FULLSCREEN is typically less well supported compared to - ALLEGRO_FULLSCREEN_WINDOW. + A5O_FULLSCREEN is typically less well supported compared to + A5O_FULLSCREEN_WINDOW. -ALLEGRO_RESIZABLE +A5O_RESIZABLE : The display is resizable (only applicable if combined with - ALLEGRO_WINDOWED). + A5O_WINDOWED). -ALLEGRO_MAXIMIZED +A5O_MAXIMIZED : The display window will be maximized (only applicable if combined - with ALLEGRO_RESIZABLE). + with A5O_RESIZABLE). Since: 5.1.12 -ALLEGRO_OPENGL +A5O_OPENGL : Require the driver to provide an initialized OpenGL context after returning successfully. -ALLEGRO_OPENGL_3_0 +A5O_OPENGL_3_0 : Require the driver to provide an initialized OpenGL context compatible with OpenGL version 3.0. -ALLEGRO_OPENGL_FORWARD_COMPATIBLE +A5O_OPENGL_FORWARD_COMPATIBLE : If this flag is set, the OpenGL - context created with ALLEGRO_OPENGL_3_0 will be forward compatible *only*, + context created with A5O_OPENGL_3_0 will be forward compatible *only*, meaning that all of the OpenGL API declared deprecated in OpenGL 3.0 will not be supported. Currently, a display created with this flag will *not* be compatible with Allegro drawing routines; the display option - ALLEGRO_COMPATIBLE_DISPLAY will be set to false. + A5O_COMPATIBLE_DISPLAY will be set to false. -ALLEGRO_OPENGL_ES_PROFILE -: Used together with ALLEGRO_OPENGL, requests that the OpenGL context +A5O_OPENGL_ES_PROFILE +: Used together with A5O_OPENGL, requests that the OpenGL context uses the OpenGL ES profile. A specific version can be requested with [al_set_new_display_option]. Note: Currently this is only supported by the X11/GLX driver. Since: 5.1.13 -ALLEGRO_OPENGL_CORE_PROFILE -: Used together with ALLEGRO_OPENGL, requests that the OpenGL context +A5O_OPENGL_CORE_PROFILE +: Used together with A5O_OPENGL, requests that the OpenGL context uses the OpenGL Core profile. A specific version can be requested with [al_set_new_display_option]. Note: Currently this is only supported by the X11/GLX driver. Since: 5.2.7 -ALLEGRO_DIRECT3D +A5O_DIRECT3D : Require the driver to do rendering with Direct3D and provide a Direct3D device. -ALLEGRO_PROGRAMMABLE_PIPELINE +A5O_PROGRAMMABLE_PIPELINE : Require a programmable graphics pipeline. - This flag is required to use [ALLEGRO_SHADER] objects. + This flag is required to use [A5O_SHADER] objects. Since: 5.1.6 -ALLEGRO_FRAMELESS +A5O_FRAMELESS : Try to create a window without a frame (i.e. no border or titlebar). This usually does nothing for fullscreen modes, and even in windowed modes it depends on the underlying platform whether it is supported or not. Since: 5.0.7, 5.1.2 -ALLEGRO_NOFRAME -: Original name for ALLEGRO_FRAMELESS. +A5O_NOFRAME +: Original name for A5O_FRAMELESS. This works with older versions of Allegro. -ALLEGRO_GENERATE_EXPOSE_EVENTS +A5O_GENERATE_EXPOSE_EVENTS : Let the display generate expose events. -ALLEGRO_GTK_TOPLEVEL +A5O_GTK_TOPLEVEL : Create a GTK toplevel window for the display, on X. This flag is conditionally defined by the native dialog addon. You must call [al_init_native_dialog_addon] for it to succeed. - ALLEGRO_GTK_TOPLEVEL is incompatible with ALLEGRO_FULLSCREEN. + A5O_GTK_TOPLEVEL is incompatible with A5O_FULLSCREEN. Since: 5.1.5 -ALLEGRO_DRAG_AND_DROP -: If a display is created with the ALLEGRO_DRAG_AND_DROP flag it will - generate ALLEGRO_EVENT_DROP events when files or text are dropped over +A5O_DRAG_AND_DROP +: If a display is created with the A5O_DRAG_AND_DROP flag it will + generate A5O_EVENT_DROP events when files or text are dropped over the display. > *[Unstable API]:* This is an experimental feature and currently only works for @@ -226,84 +226,84 @@ them, for example if you want to use multisampling. The 'importance' parameter can be either: -* ALLEGRO_REQUIRE - The display will not be created if the setting can +* A5O_REQUIRE - The display will not be created if the setting can not be met. -* ALLEGRO_SUGGEST - If the setting is not available, the display will +* A5O_SUGGEST - If the setting is not available, the display will be created anyway with a setting as close as possible to the requested one. You can query the actual value used in that case by calling [al_get_display_option] after the display has been created. -* ALLEGRO_DONTCARE - If you added a display option with one of the above +* A5O_DONTCARE - If you added a display option with one of the above two settings before, it will be removed again. Else this does nothing. The supported options are: -ALLEGRO_COLOR_SIZE +A5O_COLOR_SIZE : This can be used to ask for a specific bit depth. For example to force a 16-bit framebuffer set this to 16. -ALLEGRO_RED_SIZE, ALLEGRO_GREEN_SIZE, ALLEGRO_BLUE_SIZE, ALLEGRO_ALPHA_SIZE +A5O_RED_SIZE, A5O_GREEN_SIZE, A5O_BLUE_SIZE, A5O_ALPHA_SIZE : Individual color component size in bits. -ALLEGRO_RED_SHIFT, ALLEGRO_GREEN_SHIFT, ALLEGRO_BLUE_SHIFT, ALLEGRO_ALPHA_SHIFT +A5O_RED_SHIFT, A5O_GREEN_SHIFT, A5O_BLUE_SHIFT, A5O_ALPHA_SHIFT : Together with the previous settings these can be used to specify the exact pixel layout the display should use. Normally there is no reason to use these. -ALLEGRO_ACC_RED_SIZE, ALLEGRO_ACC_GREEN_SIZE, ALLEGRO_ACC_BLUE_SIZE, ALLEGRO_ACC_ALPHA_SIZE +A5O_ACC_RED_SIZE, A5O_ACC_GREEN_SIZE, A5O_ACC_BLUE_SIZE, A5O_ACC_ALPHA_SIZE : This can be used to define the required accumulation buffer size. -ALLEGRO_STEREO +A5O_STEREO : Whether the display is a stereo display. -ALLEGRO_AUX_BUFFERS +A5O_AUX_BUFFERS : Number of auxiliary buffers the display should have. -ALLEGRO_DEPTH_SIZE +A5O_DEPTH_SIZE : How many depth buffer (z-buffer) bits to use. -ALLEGRO_STENCIL_SIZE +A5O_STENCIL_SIZE : How many bits to use for the stencil buffer. -ALLEGRO_SAMPLE_BUFFERS +A5O_SAMPLE_BUFFERS : Whether to use multisampling (1) or not (0). -ALLEGRO_SAMPLES +A5O_SAMPLES : If the above is 1, the number of samples to use per pixel. Else 0. -ALLEGRO_RENDER_METHOD: +A5O_RENDER_METHOD: : 0 if hardware acceleration is not used with this display. -ALLEGRO_FLOAT_COLOR +A5O_FLOAT_COLOR : Whether to use floating point color components. -ALLEGRO_FLOAT_DEPTH +A5O_FLOAT_DEPTH : Whether to use a floating point depth buffer. -ALLEGRO_SINGLE_BUFFER +A5O_SINGLE_BUFFER : Whether the display uses a single buffer (1) or another update method (0). -ALLEGRO_SWAP_METHOD +A5O_SWAP_METHOD : If the above is 0, this is set to 1 to indicate the display is using a copying method to make the next buffer in the flip chain available, or to 2 to indicate a flipping or other method. -ALLEGRO_COMPATIBLE_DISPLAY +A5O_COMPATIBLE_DISPLAY : Indicates if Allegro's graphics functions can use this display. If you request a display not useable by Allegro, you can still use for example OpenGL to draw graphics. -ALLEGRO_UPDATE_DISPLAY_REGION +A5O_UPDATE_DISPLAY_REGION : Set to 1 if the display is capable of updating just a region, and 0 if calling [al_update_display_region] is equivalent to [al_flip_display]. -ALLEGRO_VSYNC +A5O_VSYNC : Set to 1 to tell the driver to wait for vsync in [al_flip_display], or to 2 to force vsync off. The default of 0 means that Allegro does not try to modify the vsync behavior so @@ -312,7 +312,7 @@ ALLEGRO_VSYNC the vsync behavior in the graphics driver so you should not rely on it. -ALLEGRO_MAX_BITMAP_SIZE +A5O_MAX_BITMAP_SIZE : When queried this returns the maximum size (width as well as height) a bitmap can have for this display. Calls to [al_create_bitmap] or [al_load_bitmap] for @@ -320,64 +320,64 @@ ALLEGRO_MAX_BITMAP_SIZE bitmaps which always can have arbitrary size (but are slow for drawing). -ALLEGRO_SUPPORT_NPOT_BITMAP +A5O_SUPPORT_NPOT_BITMAP : Set to 1 if textures used for bitmaps on this display can have a size which is not a power of two. This is mostly useful if you use Allegro to load textures as otherwise only power-of-two textures will be used internally as bitmap storage. -ALLEGRO_CAN_DRAW_INTO_BITMAP +A5O_CAN_DRAW_INTO_BITMAP : Set to 1 if you can use [al_set_target_bitmap] on bitmaps of this display to draw into them. If this is not the case software emulation will be used when drawing into display bitmaps (which can be very slow). -ALLEGRO_SUPPORT_SEPARATE_ALPHA +A5O_SUPPORT_SEPARATE_ALPHA : This is set to 1 if the [al_set_separate_blender] function is supported. Otherwise the alpha parameters will be ignored. -ALLEGRO_AUTO_CONVERT_BITMAPS +A5O_AUTO_CONVERT_BITMAPS : This is on by default. It causes any - existing memory bitmaps with the ALLEGRO_CONVERT_BITMAP flag to be + existing memory bitmaps with the A5O_CONVERT_BITMAP flag to be converted to a display bitmap of the newly created display with the option set. Since: 5.1.0 -ALLEGRO_SUPPORTED_ORIENTATIONS +A5O_SUPPORTED_ORIENTATIONS : This is a bit-combination of the orientations supported by the application. The orientations are the same as for [al_get_display_orientation] with the additional possibilities: - * ALLEGRO_DISPLAY_ORIENTATION_PORTRAIT - * ALLEGRO_DISPLAY_ORIENTATION_LANDSCAPE - * ALLEGRO_DISPLAY_ORIENTATION_ALL + * A5O_DISPLAY_ORIENTATION_PORTRAIT + * A5O_DISPLAY_ORIENTATION_LANDSCAPE + * A5O_DISPLAY_ORIENTATION_ALL PORTRAIT means only the two portrait orientations are supported, LANDSCAPE means only the two landscape orientations and ALL allows all four orientations. When the orientation changes between a portrait and a landscape orientation the display needs to be - resized. This is done by sending an [ALLEGRO_EVENT_DISPLAY_RESIZE] + resized. This is done by sending an [A5O_EVENT_DISPLAY_RESIZE] message which should be handled by calling [al_acknowledge_resize]. Since: 5.1.0 -ALLEGRO_OPENGL_MAJOR_VERSION +A5O_OPENGL_MAJOR_VERSION : Request a specific OpenGL major version. Since: 5.1.13 -ALLEGRO_OPENGL_MINOR_VERSION +A5O_OPENGL_MINOR_VERSION : Request a specific OpenGL minor version. Since: 5.1.13 -ALLEGRO_DEFAULT_SHADER_PLATFORM +A5O_DEFAULT_SHADER_PLATFORM : Specify the shader platform to use for the default shader. See - [ALLEGRO_SHADER_PLATFORM]. The default is ALLEGRO_SHADER_AUTO. + [A5O_SHADER_PLATFORM]. The default is A5O_SHADER_AUTO. Since: 5.2.8 @@ -432,7 +432,7 @@ See also: [al_get_new_display_refresh_rate] ### API: al_get_display_event_source Retrieve the associated event source. See the -[documentation on events][ALLEGRO_EVENT_DISPLAY_EXPOSE] +[documentation on events][A5O_EVENT_DISPLAY_EXPOSE] for a list of the events displays will generate. ### API: al_get_backbuffer @@ -460,23 +460,23 @@ visible on screen. Pointers to the special back buffer bitmap remain valid and retain their semantics as the back buffer, although the contents may have changed. -> *Note:* If not using the ALLEGRO_SINGLE_BUFFER option, you typically want to +> *Note:* If not using the A5O_SINGLE_BUFFER option, you typically want to redraw every pixel of the backbuffer bitmap to avoid uninitialized memory artifacts. Several display options change how this function behaves: -- With ALLEGRO_SINGLE_BUFFER, no flipping is done. You still have to +- With A5O_SINGLE_BUFFER, no flipping is done. You still have to call this function to display graphics, depending on how the used graphics system works. -- The ALLEGRO_SWAP_METHOD option may have additional information about what +- The A5O_SWAP_METHOD option may have additional information about what kind of operation is used internally to flip the front and back buffers. -- If ALLEGRO_VSYNC is 1, this function will force waiting for vsync. If -ALLEGRO_VSYNC is 2, this function will not wait for vsync. With many +- If A5O_VSYNC is 1, this function will force waiting for vsync. If +A5O_VSYNC is 2, this function will not wait for vsync. With many drivers the vsync behavior is controlled by the user and not the -application, and ALLEGRO_VSYNC will not be set; in this case +application, and A5O_VSYNC will not be set; in this case [al_flip_display] will wait for vsync depending on the settings set in the system's graphics preferences. @@ -488,7 +488,7 @@ Does the same as [al_flip_display], but tries to update only the specified region. With many drivers this is not possible, but for some it can improve performance. If this is not supported, this function falls back to the behavior of [al_flip_display]. You can query the support for this -function using `al_get_display_option(display, ALLEGRO_UPDATE_DISPLAY_REGION)`. +function using `al_get_display_option(display, A5O_UPDATE_DISPLAY_REGION)`. See also: [al_flip_display], [al_get_display_option] @@ -526,7 +526,7 @@ See also: [al_get_display_width] Resize the display. Returns true on success, or false on error. This works on both fullscreen and windowed displays, regardless of the -ALLEGRO_RESIZABLE flag. +A5O_RESIZABLE flag. Adjusts the clipping rectangle to the full size of the backbuffer. @@ -534,7 +534,7 @@ See also: [al_acknowledge_resize] ### API: al_acknowledge_resize -When the user receives a [resize event][ALLEGRO_EVENT_DISPLAY_RESIZE] +When the user receives a [resize event][A5O_EVENT_DISPLAY_RESIZE] from a resizable display, if they wish the display to be resized they must call this function to let the graphics driver know that it can now resize the display. Returns true on success. @@ -546,7 +546,7 @@ resets the backbuffers projection transform to default orthographic transform Note that a resize event may be outdated by the time you acknowledge it; there could be further resize events generated in the meantime. -See also: [al_resize_display], [ALLEGRO_EVENT] +See also: [al_resize_display], [A5O_EVENT] ### API: al_get_window_position @@ -635,7 +635,7 @@ See also: [al_get_window_constraints], [al_set_window_constraints] Gets the flags of the display. In addition to the flags set for the display at creation time with -[al_set_new_display_flags] it can also have the ALLEGRO_MINIMIZED flag +[al_set_new_display_flags] it can also have the A5O_MINIMIZED flag set, indicating that the window is currently minimized. This flag is very platform-dependent as even a minimized application may still render a preview version so normally you should not care whether it @@ -649,9 +649,9 @@ Enable or disable one of the display flags. The flags are the same as for [al_set_new_display_flags]. The only flags that can be changed after creation are: -- ALLEGRO_FULLSCREEN_WINDOW -- ALLEGRO_FRAMELESS -- ALLEGRO_MAXIMIZED +- A5O_FULLSCREEN_WINDOW +- A5O_FRAMELESS +- A5O_MAXIMIZED Returns true if the driver supports toggling the specified flag else false. You can use [al_get_display_flags] to query whether the given @@ -677,7 +677,7 @@ displays, and doesn't touch the options of already created displays. display options can be changed or changing them will have no effect. Changing options other than those listed below is undefined. -* ALLEGRO_SUPPORTED_ORIENTATIONS - This can be changed to allow new or restrict +* A5O_SUPPORTED_ORIENTATIONS - This can be changed to allow new or restrict previously enabled orientations of the screen/device. See [al_set_new_display_option] for more information on this option. @@ -689,19 +689,19 @@ See also: [al_set_new_display_option] Gets the pixel format of the display. -See also: [ALLEGRO_PIXEL_FORMAT] +See also: [A5O_PIXEL_FORMAT] ### API: al_get_display_orientation Return the display orientation, which can be one of the following: -- ALLEGRO_DISPLAY_ORIENTATION_UNKNOWN -- ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES -- ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES -- ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES -- ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES -- ALLEGRO_DISPLAY_ORIENTATION_FACE_UP -- ALLEGRO_DISPLAY_ORIENTATION_FACE_DOWN +- A5O_DISPLAY_ORIENTATION_UNKNOWN +- A5O_DISPLAY_ORIENTATION_0_DEGREES +- A5O_DISPLAY_ORIENTATION_90_DEGREES +- A5O_DISPLAY_ORIENTATION_180_DEGREES +- A5O_DISPLAY_ORIENTATION_270_DEGREES +- A5O_DISPLAY_ORIENTATION_FACE_UP +- A5O_DISPLAY_ORIENTATION_FACE_DOWN Since: 5.1.0 @@ -721,15 +721,15 @@ See also: [al_set_display_icon], [al_set_display_icons] ### API: al_set_new_window_title Set the title that will be used when a new display is created. -Allegro uses a static buffer of [ALLEGRO_NEW_WINDOW_TITLE_MAX_SIZE] to +Allegro uses a static buffer of [A5O_NEW_WINDOW_TITLE_MAX_SIZE] to store this, so the length of the titme you set must be less than this. See also: [al_set_window_title], [al_get_new_window_title], [al_create_display], - [ALLEGRO_NEW_WINDOW_TITLE_MAX_SIZE] + [A5O_NEW_WINDOW_TITLE_MAX_SIZE] Since: 5.1.12 -### API: ALLEGRO_NEW_WINDOW_TITLE_MAX_SIZE +### API: A5O_NEW_WINDOW_TITLE_MAX_SIZE This is the maximum size of the title that can be set with [al_set_new_window_title]. @@ -778,7 +778,7 @@ See also: [al_set_display_icon], [al_set_window_title] ### API: al_acknowledge_drawing_halt -Call this in response to the [ALLEGRO_EVENT_DISPLAY_HALT_DRAWING] event. +Call this in response to the [A5O_EVENT_DISPLAY_HALT_DRAWING] event. This is currently necessary for Android and iOS as you are not allowed to draw to your display while it is not being shown. If you do not call this function to let the operating system know that you have stopped @@ -787,15 +787,15 @@ considered misbehaving and get terminated. Since: 5.1.0 -See also: [ALLEGRO_EVENT_DISPLAY_HALT_DRAWING] +See also: [A5O_EVENT_DISPLAY_HALT_DRAWING] ### API: al_acknowledge_drawing_resume -Call this in response to the [ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING] event. +Call this in response to the [A5O_EVENT_DISPLAY_RESUME_DRAWING] event. Since: 5.1.1 -See also: [ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING] +See also: [A5O_EVENT_DISPLAY_RESUME_DRAWING] ## Screensaver diff --git a/docs/src/refman/events.txt b/docs/src/refman/events.txt index a948b3e9f1..c7e40f248b 100644 --- a/docs/src/refman/events.txt +++ b/docs/src/refman/events.txt @@ -16,28 +16,28 @@ event queues. Event queues can then be queried for events. In particular, it is possible to wait until events become available in order to save CPU time. You can combine -this with [timers][ALLEGRO_TIMER] to make your main-loop run at a specific speed +this with [timers][A5O_TIMER] to make your main-loop run at a specific speed without wasting CPU time or missing events. In addition to the predefined event types, Allegro also allows for user-defined events that can be generated by user-defined event sources. The appropriate reaction to an event is determined by examining the fields of -the [ALLEGRO_EVENT] union according to the event type. +the [A5O_EVENT] union according to the event type. In addition to the events sent by Allegro core, there's also events send by the addons, -see [ALLEGRO_AUDIO_EVENT_TYPE] and [ALLEGRO_VIDEO_EVENT_TYPE]. +see [A5O_AUDIO_EVENT_TYPE] and [A5O_VIDEO_EVENT_TYPE]. -## API: ALLEGRO_EVENT +## API: A5O_EVENT -An ALLEGRO_EVENT is a union of all builtin event structures, i.e. it is an +An A5O_EVENT is a union of all builtin event structures, i.e. it is an object large enough to hold the data of any event type. All events have the following fields in common: -type (ALLEGRO_EVENT_TYPE) +type (A5O_EVENT_TYPE) : Indicates the type of event. -any.source (ALLEGRO_EVENT_SOURCE *) +any.source (A5O_EVENT_SOURCE *) : The event source which generated the event. any.timestamp (double) @@ -50,11 +50,11 @@ time is referenced to the same starting point as [al_get_time]. Each event is of one of the following types, with the usable fields given. -### ALLEGRO_EVENT_JOYSTICK_AXIS +### A5O_EVENT_JOYSTICK_AXIS A joystick axis value changed. -joystick.id (ALLEGRO_JOYSTICK *) +joystick.id (A5O_JOYSTICK *) : The joystick which generated the event. This is not the same as the event source `joystick.source`. @@ -68,32 +68,32 @@ joystick.axis (int) joystick.pos (float) : The axis position, from -1.0 to +1.0. -### ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN +### A5O_EVENT_JOYSTICK_BUTTON_DOWN A joystick button was pressed. -joystick.id (ALLEGRO_JOYSTICK *) +joystick.id (A5O_JOYSTICK *) : The joystick which generated the event. joystick.button (int) : The button which was pressed, counting from zero. -### ALLEGRO_EVENT_JOYSTICK_BUTTON_UP +### A5O_EVENT_JOYSTICK_BUTTON_UP A joystick button was released. -joystick.id (ALLEGRO_JOYSTICK *) +joystick.id (A5O_JOYSTICK *) : The joystick which generated the event. joystick.button (int) : The button which was released, counting from zero. -### ALLEGRO_EVENT_JOYSTICK_CONFIGURATION +### A5O_EVENT_JOYSTICK_CONFIGURATION A joystick was plugged in or unplugged. See [al_reconfigure_joysticks] for details. -### ALLEGRO_EVENT_KEY_DOWN +### A5O_EVENT_KEY_DOWN A keyboard key was pressed. @@ -101,13 +101,13 @@ keyboard.keycode (int) : The code corresponding to the physical key which was pressed. See the [Key codes] section for the list of ALLEGRO\_KEY\_\* constants. -keyboard.display (ALLEGRO_DISPLAY *) +keyboard.display (A5O_DISPLAY *) : The display which had keyboard focus when the event occurred. > *Note:* this event is about the physical keys being pressed on the keyboard. -Look for ALLEGRO_EVENT_KEY_CHAR events for character input. +Look for A5O_EVENT_KEY_CHAR events for character input. -### ALLEGRO_EVENT_KEY_UP +### A5O_EVENT_KEY_UP A keyboard key was released. @@ -115,10 +115,10 @@ keyboard.keycode (int) : The code corresponding to the physical key which was released. See the [Key codes] section for the list of ALLEGRO\_KEY\_\* constants. -keyboard.display (ALLEGRO_DISPLAY *) +keyboard.display (A5O_DISPLAY *) : The display which had keyboard focus when the event occurred. -### ALLEGRO_EVENT_KEY_CHAR +### A5O_EVENT_KEY_CHAR A character was typed on the keyboard, or a character was auto-repeated. @@ -147,7 +147,7 @@ keyboard.modifiers (unsigned) keyboard.repeat (bool) : Indicates if this is a repeated character. -keyboard.display (ALLEGRO_DISPLAY *) +keyboard.display (A5O_DISPLAY *) : The display which had keyboard focus when the event occurred. > *Note*: in many input methods, characters are *not* entered one-for-one with @@ -155,7 +155,7 @@ physical key presses. Multiple key presses can combine to generate a single character, e.g. apostrophe + e may produce 'รฉ'. Fewer key presses can also generate more characters, e.g. macro sequences expanding to common phrases. -### ALLEGRO_EVENT_MOUSE_AXES +### A5O_EVENT_MOUSE_AXES One or more mouse axis values changed. @@ -174,34 +174,34 @@ mouse.w (int) mouse.dx (int) : Change in the x-coordinate value since the previous - ALLEGRO_EVENT_MOUSE_AXES event. + A5O_EVENT_MOUSE_AXES event. mouse.dy (int) : Change in the y-coordinate value since the previous - ALLEGRO_EVENT_MOUSE_AXES event. + A5O_EVENT_MOUSE_AXES event. mouse.dz (int) : Change in the z-coordinate value since the previous - ALLEGRO_EVENT_MOUSE_AXES event. + A5O_EVENT_MOUSE_AXES event. mouse.dw (int) : Change in the w-coordinate value since the previous - ALLEGRO_EVENT_MOUSE_AXES event. + A5O_EVENT_MOUSE_AXES event. mouse.pressure (float) : Pressure, ranging from `0.0` to `1.0`. -mouse.display (ALLEGRO_DISPLAY *) +mouse.display (A5O_DISPLAY *) : The display which had mouse focus. > *Note:* Calling [al_set_mouse_xy] also will result in a change of axis -values, but such a change is reported with [ALLEGRO_EVENT_MOUSE_WARPED] +values, but such a change is reported with [A5O_EVENT_MOUSE_WARPED] events instead which are identical except for their type. > *Note:* currently mouse.display may be NULL if an event is generated in response to [al_set_mouse_axis]. -### ALLEGRO_EVENT_MOUSE_BUTTON_DOWN +### A5O_EVENT_MOUSE_BUTTON_DOWN A mouse button was pressed. @@ -223,10 +223,10 @@ mouse.button (unsigned) mouse.pressure (float) : Pressure, ranging from `0.0` to `1.0`. -mouse.display (ALLEGRO_DISPLAY *) +mouse.display (A5O_DISPLAY *) : The display which had mouse focus. -### ALLEGRO_EVENT_MOUSE_BUTTON_UP +### A5O_EVENT_MOUSE_BUTTON_UP A mouse button was released. @@ -248,15 +248,15 @@ mouse.button (unsigned) mouse.pressure (float) : Pressure, ranging from `0.0` to `1.0`. -mouse.display (ALLEGRO_DISPLAY *) +mouse.display (A5O_DISPLAY *) : The display which had mouse focus. -### ALLEGRO_EVENT_MOUSE_WARPED +### A5O_EVENT_MOUSE_WARPED [al_set_mouse_xy] was called to move the mouse. -This event is identical to ALLEGRO_EVENT_MOUSE_AXES otherwise. +This event is identical to A5O_EVENT_MOUSE_AXES otherwise. -### ALLEGRO_EVENT_MOUSE_ENTER_DISPLAY +### A5O_EVENT_MOUSE_ENTER_DISPLAY The mouse cursor entered a window opened by the program. @@ -272,10 +272,10 @@ mouse.z (int) mouse.w (int) : w-coordinate -mouse.display (ALLEGRO_DISPLAY *) +mouse.display (A5O_DISPLAY *) : The display which had mouse focus. -### ALLEGRO_EVENT_MOUSE_LEAVE_DISPLAY +### A5O_EVENT_MOUSE_LEAVE_DISPLAY The mouse cursor left the boundaries of a window opened by the program. @@ -291,14 +291,14 @@ mouse.z (int) mouse.w (int) : w-coordinate -mouse.display (ALLEGRO_DISPLAY *) +mouse.display (A5O_DISPLAY *) : The display which had mouse focus. -### ALLEGRO_EVENT_TOUCH_BEGIN +### A5O_EVENT_TOUCH_BEGIN The touch input device registered a new touch. -touch.display (ALLEGRO_DISPLAY) +touch.display (A5O_DISPLAY) : The display which was touched. touch.id (int) @@ -323,47 +323,47 @@ touch.primary (bool) Since: 5.1.0 -### ALLEGRO_EVENT_TOUCH_END +### A5O_EVENT_TOUCH_END A touch ended. -Has the same fields as [ALLEGRO_EVENT_TOUCH_BEGIN]. +Has the same fields as [A5O_EVENT_TOUCH_BEGIN]. Since: 5.1.0 -### ALLEGRO_EVENT_TOUCH_MOVE +### A5O_EVENT_TOUCH_MOVE The position of a touch changed. -Has the same fields as [ALLEGRO_EVENT_TOUCH_BEGIN]. +Has the same fields as [A5O_EVENT_TOUCH_BEGIN]. Since: 5.1.0 -### ALLEGRO_EVENT_TOUCH_CANCEL +### A5O_EVENT_TOUCH_CANCEL A touch was cancelled. This is device specific but could for example mean that a finger moved off the border of the device or moved so fast that it could not be tracked any longer. -Has the same fields as [ALLEGRO_EVENT_TOUCH_BEGIN]. +Has the same fields as [A5O_EVENT_TOUCH_BEGIN]. Since: 5.1.0 -### ALLEGRO_EVENT_TIMER +### A5O_EVENT_TIMER -A [timer][ALLEGRO_TIMER] counter incremented. +A [timer][A5O_TIMER] counter incremented. -timer.source (ALLEGRO_TIMER *) +timer.source (A5O_TIMER *) : The timer which generated the event. timer.count (int64_t) : The timer count value. -### ALLEGRO_EVENT_DISPLAY_EXPOSE +### A5O_EVENT_DISPLAY_EXPOSE The display (or a portion thereof) has become visible. -display.source (ALLEGRO_DISPLAY *) +display.source (A5O_DISPLAY *) : The display which was exposed. display.x (int) @@ -378,14 +378,14 @@ display.width (int) display.height (int) : The height of the rectangle which was exposed. -> *Note:* The display needs to be created with ALLEGRO_GENERATE_EXPOSE_EVENTS +> *Note:* The display needs to be created with A5O_GENERATE_EXPOSE_EVENTS flag for these events to be generated. -### ALLEGRO_EVENT_DISPLAY_RESIZE +### A5O_EVENT_DISPLAY_RESIZE The window has been resized. -display.source (ALLEGRO_DISPLAY *) +display.source (A5O_DISPLAY *) : The display which was resized. display.x (int) @@ -404,21 +404,21 @@ You should normally respond to these events by calling [al_acknowledge_resize]. Note that further resize events may be generated by the time you process the event, so these fields may hold outdated information. -### ALLEGRO_EVENT_DISPLAY_CLOSE +### A5O_EVENT_DISPLAY_CLOSE The close button of the window has been pressed. -display.source (ALLEGRO_DISPLAY *) +display.source (A5O_DISPLAY *) : The display which was closed. -### ALLEGRO_EVENT_DISPLAY_LOST +### A5O_EVENT_DISPLAY_LOST When using Direct3D, displays can enter a "lost" state. In that state, drawing calls are ignored, and upon entering the state, bitmap's pixel data can become undefined. Allegro does its best to preserve the correct contents of bitmaps (see the -ALLEGRO_NO_PRESERVE_TEXTURE flag) and restore them when the device is -"found" (see [ALLEGRO_EVENT_DISPLAY_FOUND]). However, this is not 100% +A5O_NO_PRESERVE_TEXTURE flag) and restore them when the device is +"found" (see [A5O_EVENT_DISPLAY_FOUND]). However, this is not 100% fool proof (see discussion in [al_create_bitmap]'s documentation). > *Note:* This event merely means that the display was lost, that is, @@ -427,18 +427,18 @@ you can keep calling drawing functions -- they just most likely won't do anything. If Allegro's restoration of the bitmaps works well for you then no further action is required when you receive this event. -display.source (ALLEGRO_DISPLAY *) +display.source (A5O_DISPLAY *) : The display which was lost. -### ALLEGRO_EVENT_DISPLAY_FOUND +### A5O_EVENT_DISPLAY_FOUND Generated when a lost device is restored to operating state. -See [ALLEGRO_EVENT_DISPLAY_LOST]. +See [A5O_EVENT_DISPLAY_LOST]. -display.source (ALLEGRO_DISPLAY *) +display.source (A5O_DISPLAY *) : The display which was found. -### ALLEGRO_EVENT_DISPLAY_SWITCH_OUT +### A5O_EVENT_DISPLAY_SWITCH_OUT The window is no longer active, that is the user might have clicked into another window or "tabbed" away. In response to this event you @@ -446,41 +446,41 @@ might want to call [al_clear_keyboard_state] (possibly passing display.source as its argument) in order to prevent Allegro's keyboard state from getting out of sync. -display.source (ALLEGRO_DISPLAY *) +display.source (A5O_DISPLAY *) : The display which was switched out of. -### ALLEGRO_EVENT_DISPLAY_SWITCH_IN +### A5O_EVENT_DISPLAY_SWITCH_IN The window is the active one again. -display.source (ALLEGRO_DISPLAY *) +display.source (A5O_DISPLAY *) : The display which was switched into. -### ALLEGRO_EVENT_DISPLAY_ORIENTATION +### A5O_EVENT_DISPLAY_ORIENTATION Generated when the rotation or orientation of a display changes. -display.source (ALLEGRO_DISPLAY *) +display.source (A5O_DISPLAY *) : The display which generated the event. event.display.orientation : Contains one of the following values: - - ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES - - ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES - - ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES - - ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES - - ALLEGRO_DISPLAY_ORIENTATION_FACE_UP - - ALLEGRO_DISPLAY_ORIENTATION_FACE_DOWN + - A5O_DISPLAY_ORIENTATION_0_DEGREES + - A5O_DISPLAY_ORIENTATION_90_DEGREES + - A5O_DISPLAY_ORIENTATION_180_DEGREES + - A5O_DISPLAY_ORIENTATION_270_DEGREES + - A5O_DISPLAY_ORIENTATION_FACE_UP + - A5O_DISPLAY_ORIENTATION_FACE_DOWN -### ALLEGRO_EVENT_DISPLAY_HALT_DRAWING +### A5O_EVENT_DISPLAY_HALT_DRAWING When a display receives this event it should stop doing any drawing and then call [al_acknowledge_drawing_halt] immediately. This is currently only relevant for Android and iOS. It will be sent when the application is switched to background mode, in addition to -[ALLEGRO_EVENT_DISPLAY_SWITCH_OUT]. The latter may also be sent in +[A5O_EVENT_DISPLAY_SWITCH_OUT]. The latter may also be sent in situations where the application is not active but still should continue drawing, for example when a popup is displayed in front of it. @@ -501,50 +501,50 @@ voice even if the stream or mixer are stopped or detached. Since: 5.1.0 -See also: [ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING] +See also: [A5O_EVENT_DISPLAY_RESUME_DRAWING] -### ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING +### A5O_EVENT_DISPLAY_RESUME_DRAWING When a display receives this event, it may resume drawing again, and it must call [al_acknowledge_drawing_resume] immediately. This is currently only relevant for Android and iOS. The event will be sent when an application returns from background mode and is allowed to draw to the -display again, in addition to [ALLEGRO_EVENT_DISPLAY_SWITCH_IN]. The latter +display again, in addition to [A5O_EVENT_DISPLAY_SWITCH_IN]. The latter event may also be sent in a situation where the application is already active, for example when a popup in front of it closes. -> *Note:* Unlike [ALLEGRO_EVENT_DISPLAY_FOUND] it is not necessary to reload +> *Note:* Unlike [A5O_EVENT_DISPLAY_FOUND] it is not necessary to reload any bitmaps when you receive this event. Since: 5.1.0 -See also: [ALLEGRO_EVENT_DISPLAY_HALT_DRAWING] +See also: [A5O_EVENT_DISPLAY_HALT_DRAWING] -### ALLEGRO_EVENT_DISPLAY_CONNECTED +### A5O_EVENT_DISPLAY_CONNECTED This event is sent when a physical display is connected to the device Allegro runs on. Currently, on most platforms, Allegro supports only a single physical display. However, on iOS, a secondary physical display is supported. -display.source (ALLEGRO_DISPLAY *) +display.source (A5O_DISPLAY *) : The display which was connected. Since: 5.1.1 -### ALLEGRO_EVENT_DISPLAY_DISCONNECTED +### A5O_EVENT_DISPLAY_DISCONNECTED This event is sent when a physical display is disconnected from the device Allegro runs on. Currently, on most platforms, Allegro supports only a single physical display. However, on iOS, a secondary physical display is supported. -display.source (ALLEGRO_DISPLAY *) +display.source (A5O_DISPLAY *) : The display which was disconnected. -### ALLEGRO_EVENT_DROP +### A5O_EVENT_DROP -If a display is created with the ALLEGRO_DRAG_AND_DROP flag it will -generate ALLEGRO_EVENT_DROP events when files or text are dropped over +If a display is created with the A5O_DRAG_AND_DROP flag it will +generate A5O_EVENT_DROP events when files or text are dropped over the display. drop.x (int) @@ -578,19 +578,19 @@ Since: 5.2.9 > *[Unstable API]:* This is an experimental feature and currently only works for the X11 backend. -## API: ALLEGRO_USER_EVENT +## API: A5O_USER_EVENT An event structure that can be emitted by user event sources. These are the public fields: -- ALLEGRO_EVENT_SOURCE *source; +- A5O_EVENT_SOURCE *source; - intptr_t data1; - intptr_t data2; - intptr_t data3; - intptr_t data4; -Like all other event types this structure is a part of the ALLEGRO_EVENT union. -To access the fields in an ALLEGRO_EVENT variable `ev`, you would use: +Like all other event types this structure is a part of the A5O_EVENT union. +To access the fields in an A5O_EVENT variable `ev`, you would use: - ev.user.source - ev.user.data1 @@ -601,13 +601,13 @@ To access the fields in an ALLEGRO_EVENT variable `ev`, you would use: To create a new user event you would do this: ~~~~c -ALLEGRO_EVENT_SOURCE my_event_source; -ALLEGRO_EVENT my_event; +A5O_EVENT_SOURCE my_event_source; +A5O_EVENT my_event; float some_var; al_init_user_event_source(&my_event_source); -my_event.user.type = ALLEGRO_GET_EVENT_TYPE('M','I','N','E'); +my_event.user.type = A5O_GET_EVENT_TYPE('M','I','N','E'); my_event.user.data1 = 1; my_event.user.data2 = &some_var; @@ -615,12 +615,12 @@ al_emit_user_event(&my_event_source, &my_event, NULL); ~~~~ Event type identifiers for user events are assigned by the user. -Please see the documentation for [ALLEGRO_GET_EVENT_TYPE] for the rules you +Please see the documentation for [A5O_GET_EVENT_TYPE] for the rules you should follow when assigning identifiers. -See also: [al_emit_user_event], [ALLEGRO_GET_EVENT_TYPE], [al_init_user_event_source] +See also: [al_emit_user_event], [A5O_GET_EVENT_TYPE], [al_init_user_event_source] -## API: ALLEGRO_EVENT_QUEUE +## API: A5O_EVENT_QUEUE An event queue holds events that have been generated by event sources that are registered with the queue. Events are stored in the order @@ -628,36 +628,36 @@ they are generated. Access is in a strictly FIFO (first-in-first-out) order. See also: [al_create_event_queue], [al_destroy_event_queue] -## API: ALLEGRO_EVENT_SOURCE +## API: A5O_EVENT_SOURCE An event source is any object which can generate events. -For example, an ALLEGRO_DISPLAY can generate events, and you can get the -ALLEGRO_EVENT_SOURCE pointer from an ALLEGRO_DISPLAY with +For example, an A5O_DISPLAY can generate events, and you can get the +A5O_EVENT_SOURCE pointer from an A5O_DISPLAY with [al_get_display_event_source]. You may create your own "user" event sources that emit custom events. -See also: [ALLEGRO_EVENT], [al_init_user_event_source], [al_emit_user_event] +See also: [A5O_EVENT], [al_init_user_event_source], [al_emit_user_event] -## API: ALLEGRO_EVENT_TYPE +## API: A5O_EVENT_TYPE An integer used to distinguish between different types of events. -See also: [ALLEGRO_EVENT], [ALLEGRO_GET_EVENT_TYPE], -[ALLEGRO_EVENT_TYPE_IS_USER] +See also: [A5O_EVENT], [A5O_GET_EVENT_TYPE], +[A5O_EVENT_TYPE_IS_USER] -## API: ALLEGRO_GET_EVENT_TYPE +## API: A5O_GET_EVENT_TYPE Make an event type identifier, which is a 32-bit integer. Usually, but not necessarily, this will be made from four 8-bit character codes, for example: ~~~~c -#define MY_EVENT_TYPE ALLEGRO_GET_EVENT_TYPE('M','I','N','E') +#define MY_EVENT_TYPE A5O_GET_EVENT_TYPE('M','I','N','E') ~~~~ IDs less than 1024 are reserved for Allegro or its addons. -Don't use anything lower than `ALLEGRO_GET_EVENT_TYPE(0, 0, 4, 0)`. +Don't use anything lower than `A5O_GET_EVENT_TYPE(0, 0, 4, 0)`. You should try to make your IDs unique so they don't clash with any 3rd party code you may be using. Be creative. Numbering from 1024 is not creative. @@ -665,25 +665,25 @@ code you may be using. Be creative. Numbering from 1024 is not creative. If you need multiple identifiers, you could define them like this: ~~~~c -#define BASE_EVENT ALLEGRO_GET_EVENT_TYPE('M','I','N','E') +#define BASE_EVENT A5O_GET_EVENT_TYPE('M','I','N','E') #define BARK_EVENT (BASE_EVENT + 0) #define MEOW_EVENT (BASE_EVENT + 1) #define SQUAWK_EVENT (BASE_EVENT + 2) /* Alternatively */ enum { - BARK_EVENT = ALLEGRO_GET_EVENT_TYPE('M','I','N','E'), + BARK_EVENT = A5O_GET_EVENT_TYPE('M','I','N','E'), MEOW_EVENT, SQUAWK_EVENT }; ~~~~ -See also: [ALLEGRO_EVENT], [ALLEGRO_USER_EVENT], [ALLEGRO_EVENT_TYPE_IS_USER] +See also: [A5O_EVENT], [A5O_USER_EVENT], [A5O_EVENT_TYPE_IS_USER] -## API: ALLEGRO_EVENT_TYPE_IS_USER +## API: A5O_EVENT_TYPE_IS_USER A macro which evaluates to true if the event type is not a builtin event -type, i.e. one of those described in [ALLEGRO_EVENT_TYPE]. +type, i.e. one of those described in [A5O_EVENT_TYPE]. ## API: al_create_event_queue @@ -691,7 +691,7 @@ Create a new, empty event queue, returning a pointer to the newly created object if successful. Returns NULL on error. See also: [al_register_event_source], [al_destroy_event_queue], -[ALLEGRO_EVENT_QUEUE] +[A5O_EVENT_QUEUE] ## API: al_destroy_event_queue @@ -701,7 +701,7 @@ the queue is destroyed. This function does nothing if `queue` is NULL. (since 5.2.9) -See also: [al_create_event_queue], [ALLEGRO_EVENT_QUEUE] +See also: [al_create_event_queue], [A5O_EVENT_QUEUE] ## API: al_register_event_source @@ -710,7 +710,7 @@ event source may be registered with any number of event queues simultaneously, or none. Trying to register an event source with the same event queue more than once does nothing. -See also: [al_unregister_event_source], [ALLEGRO_EVENT_SOURCE] +See also: [al_unregister_event_source], [A5O_EVENT_SOURCE] ## API: al_unregister_event_source @@ -767,7 +767,7 @@ copy the contents into `ret_event`, returning true. The original event will be removed from the queue. If the event queue is empty, return false and the contents of `ret_event` are unspecified. -See also: [ALLEGRO_EVENT], [al_peek_next_event], [al_wait_for_event] +See also: [A5O_EVENT], [al_peek_next_event], [al_wait_for_event] ## API: al_peek_next_event @@ -777,7 +777,7 @@ packet will remain at the head of the queue. If the event queue is actually empty, this function returns false and the contents of `ret_event` are unspecified. -See also: [ALLEGRO_EVENT], [al_get_next_event], [al_drop_next_event] +See also: [A5O_EVENT], [al_get_next_event], [al_drop_next_event] ## API: al_drop_next_event @@ -800,7 +800,7 @@ is not NULL, the first event in the queue will be copied into `ret_event` and removed from the queue. If `ret_event` is NULL the first event is left at the head of the queue. -See also: [ALLEGRO_EVENT], [al_wait_for_event_timed], +See also: [A5O_EVENT], [al_wait_for_event_timed], [al_wait_for_event_until], [al_get_next_event] ## API: al_wait_for_event_timed @@ -815,7 +815,7 @@ out, false is returned. Otherwise, if an event ocurred, true is returned. For compatibility with all platforms, `secs` must be 2,147,483.647 seconds or less. -See also: [ALLEGRO_EVENT], [al_wait_for_event], [al_wait_for_event_until] +See also: [A5O_EVENT], [al_wait_for_event], [al_wait_for_event_until] ## API: al_wait_for_event_until @@ -829,7 +829,7 @@ returned. Otherwise, if an event ocurred, true is returned. For compatibility with all platforms, `timeout` must be 2,147,483.647 seconds or less. -See also: [ALLEGRO_EVENT], [ALLEGRO_TIMEOUT], [al_init_timeout], +See also: [A5O_EVENT], [A5O_TIMEOUT], [al_init_timeout], [al_wait_for_event], [al_wait_for_event_timed] @@ -840,13 +840,13 @@ Initialise an event source for emitting user events. The space for the event source must already have been allocated. One possible way of creating custom event sources is to derive other -structures with ALLEGRO_EVENT_SOURCE at the head, e.g. +structures with A5O_EVENT_SOURCE at the head, e.g. ~~~~c typedef struct THING THING; struct THING { - ALLEGRO_EVENT_SOURCE event_source; + A5O_EVENT_SOURCE event_source; int field1; int field2; /* etc. */ @@ -867,7 +867,7 @@ THING *create_thing(void) ~~~~ The advantage here is that the THING pointer will be the same as the -ALLEGRO_EVENT_SOURCE pointer. Events emitted by the event source will have the +A5O_EVENT_SOURCE pointer. Events emitted by the event source will have the event source pointer as the `source` field, from which you can get a pointer to a THING by a simple cast (after ensuring checking the event is of the correct type). @@ -877,8 +877,8 @@ However, it is only one technique and you are not obliged to use it. The user event source will never be destroyed automatically. You must destroy it manually with [al_destroy_user_event_source]. -See also: [ALLEGRO_EVENT_SOURCE], [al_destroy_user_event_source], -[al_emit_user_event], [ALLEGRO_USER_EVENT] +See also: [A5O_EVENT_SOURCE], [al_destroy_user_event_source], +[al_emit_user_event], [A5O_USER_EVENT] ## API: al_destroy_user_event_source @@ -886,7 +886,7 @@ Destroy an event source initialised with [al_init_user_event_source]. This does not free the memory, as that was user allocated to begin with. -See also: [ALLEGRO_EVENT_SOURCE] +See also: [A5O_EVENT_SOURCE] ## API: al_emit_user_event @@ -916,10 +916,10 @@ counted user events. You can use al_emit_user_event to emit both user and non-user events from your user event source. Note that emitting input events will not update the corresponding input device states. For example, you may emit an event of type -[ALLEGRO_EVENT_KEY_DOWN], but it will not update the [ALLEGRO_KEYBOARD_STATE] +[A5O_EVENT_KEY_DOWN], but it will not update the [A5O_KEYBOARD_STATE] returned by [al_get_keyboard_state]. -See also: [ALLEGRO_USER_EVENT], [al_unref_user_event] +See also: [A5O_USER_EVENT], [al_unref_user_event] ## API: al_unref_user_event @@ -929,7 +929,7 @@ that you get from [al_get_next_event], [al_peek_next_event], [al_wait_for_event], etc. which is reference counted. This function does nothing if the event is not reference counted. -See also: [al_emit_user_event], [ALLEGRO_USER_EVENT] +See also: [al_emit_user_event], [A5O_USER_EVENT] diff --git a/docs/src/refman/file.txt b/docs/src/refman/file.txt index 0e7e4f468c..da695cd530 100644 --- a/docs/src/refman/file.txt +++ b/docs/src/refman/file.txt @@ -6,12 +6,12 @@ These functions are declared in the main Allegro header file: #include ~~~~ -## API: ALLEGRO_FILE +## API: A5O_FILE An opaque object representing an open file. This could be a real file on disk or a virtual file. -## API: ALLEGRO_FILE_INTERFACE +## API: A5O_FILE_INTERFACE A structure containing function pointers to handle a type of "file", real or virtual. See the full discussion in [al_set_new_file_interface]. @@ -20,18 +20,18 @@ The fields are: ~~~~c void* (*fi_fopen)(const char *path, const char *mode); -bool (*fi_fclose)(ALLEGRO_FILE *f); -size_t (*fi_fread)(ALLEGRO_FILE *f, void *ptr, size_t size); -size_t (*fi_fwrite)(ALLEGRO_FILE *f, const void *ptr, size_t size); -bool (*fi_fflush)(ALLEGRO_FILE *f); -int64_t (*fi_ftell)(ALLEGRO_FILE *f); -bool (*fi_fseek)(ALLEGRO_FILE *f, int64_t offset, int whence); -bool (*fi_feof)(ALLEGRO_FILE *f); -int (*fi_ferror)(ALLEGRO_FILE *f); -const char * (*fi_ferrmsg)(ALLEGRO_FILE *f); -void (*fi_fclearerr)(ALLEGRO_FILE *f); -int (*fi_fungetc)(ALLEGRO_FILE *f, int c); -off_t (*fi_fsize)(ALLEGRO_FILE *f); +bool (*fi_fclose)(A5O_FILE *f); +size_t (*fi_fread)(A5O_FILE *f, void *ptr, size_t size); +size_t (*fi_fwrite)(A5O_FILE *f, const void *ptr, size_t size); +bool (*fi_fflush)(A5O_FILE *f); +int64_t (*fi_ftell)(A5O_FILE *f); +bool (*fi_fseek)(A5O_FILE *f, int64_t offset, int whence); +bool (*fi_feof)(A5O_FILE *f); +int (*fi_ferror)(A5O_FILE *f); +const char * (*fi_ferrmsg)(A5O_FILE *f); +void (*fi_fclearerr)(A5O_FILE *f); +int (*fi_fungetc)(A5O_FILE *f, int c); +off_t (*fi_fsize)(A5O_FILE *f); ~~~~ The fi_open function must allocate memory for whatever userdata structure it needs. @@ -40,16 +40,16 @@ file. The other functions can access that data by calling [al_get_file_userdata] on the file handle. If fi_open returns NULL then [al_fopen] will also return NULL. The fi_fclose function must clean up and free the userdata, but Allegro will -free the [ALLEGRO_FILE] handle. +free the [A5O_FILE] handle. If fi_fungetc is NULL, then Allegro's default implementation of a 16 char long buffer will be used. -## API: ALLEGRO_SEEK +## API: A5O_SEEK -* ALLEGRO_SEEK_SET - seek relative to beginning of file -* ALLEGRO_SEEK_CUR - seek relative to current file position -* ALLEGRO_SEEK_END - seek relative to end of file +* A5O_SEEK_SET - seek relative to beginning of file +* A5O_SEEK_CUR - seek relative to current file position +* A5O_SEEK_END - seek relative to end of file See also: [al_fseek] @@ -96,8 +96,8 @@ The slice is opened at the current location of the parent file, up through `initial_size` bytes. The `initial_size` may be any non-negative integer that will not exceed the bounds of the parent file. -Seeking with `ALLEGRO_SEEK_SET` will be relative to this starting location. -`ALLEGRO_SEEK_END` will be relative to the starting location plus the +Seeking with `A5O_SEEK_SET` will be relative to this starting location. +`A5O_SEEK_END` will be relative to the starting location plus the size of the slice. The mode can be any combination of: @@ -181,9 +181,9 @@ to that specified by 'whence', plus 'offset' number of bytes. 'whence' can be: -* ALLEGRO_SEEK_SET - seek relative to beginning of file -* ALLEGRO_SEEK_CUR - seek relative to current file position -* ALLEGRO_SEEK_END - seek relative to end of file +* A5O_SEEK_SET - seek relative to beginning of file +* A5O_SEEK_CUR - seek relative to current file position +* A5O_SEEK_END - seek relative to end of file Returns true on success, false on failure. errno is set to indicate the error. @@ -396,7 +396,7 @@ See also: [al_fget_ustr] Read a string of bytes terminated with a newline or end-of-file. The line terminator(s), if any, are included in the returned string. -On success returns a pointer to a new ALLEGRO_USTR structure. +On success returns a pointer to a new A5O_USTR structure. This must be freed eventually with [al_ustr_free]. Returns NULL if an error occurred or if the end of file was reached without reading any bytes. @@ -431,11 +431,11 @@ See also: [al_fwrite] ### API: al_fopen_fd -Create an [ALLEGRO_FILE] object that operates on an open file descriptor using +Create an [A5O_FILE] object that operates on an open file descriptor using stdio routines. See the documentation of fdopen() for a description of the 'mode' argument. -Returns an ALLEGRO_FILE object on success or NULL on an error. +Returns an A5O_FILE object on success or NULL on an error. On an error, the Allegro errno will be set and the file descriptor will not be closed. @@ -456,7 +456,7 @@ number generator only. There should be no path separators. If 'ret_path' is not NULL, the address it points to will be set to point to a new path structure with the name of the temporary file. -Returns the opened [ALLEGRO_FILE] on success, NULL on failure. +Returns the opened [A5O_FILE] on success, NULL on failure. ## Alternative file streams @@ -465,8 +465,8 @@ hence work with files on the local filesystem, but can be overridden so that you can read and write to other streams. For example, you can work with blocks of memory or sub-files inside .zip files. -There are two ways to get an [ALLEGRO_FILE] that doesn't use stdio. -An addon library may provide a function that returns a new ALLEGRO_FILE +There are two ways to get an [A5O_FILE] that doesn't use stdio. +An addon library may provide a function that returns a new A5O_FILE directly, after which, all al_f* calls on that object will use overridden functions for that type of stream. Alternatively, [al_set_new_file_interface] changes which function will handle @@ -474,7 +474,7 @@ the following [al_fopen] calls for the current thread. ### API: al_set_new_file_interface -Set the [ALLEGRO_FILE_INTERFACE] table for the calling thread. +Set the [A5O_FILE_INTERFACE] table for the calling thread. This will change the handler for later calls to [al_fopen]. See also: [al_set_standard_file_interface], [al_store_state], @@ -482,14 +482,14 @@ See also: [al_set_standard_file_interface], [al_store_state], ### API: al_set_standard_file_interface -Set the [ALLEGRO_FILE_INTERFACE] table to the default, for the calling thread. +Set the [A5O_FILE_INTERFACE] table to the default, for the calling thread. This will change the handler for later calls to [al_fopen]. See also: [al_set_new_file_interface] ### API: al_get_new_file_interface -Return a pointer to the [ALLEGRO_FILE_INTERFACE] table in effect +Return a pointer to the [A5O_FILE_INTERFACE] table in effect for the calling thread. See also: [al_store_state], [al_restore_state]. @@ -497,7 +497,7 @@ See also: [al_store_state], [al_restore_state]. ### API: al_create_file_handle Creates an empty, opened file handle with some abstract user data. -This allows custom interfaces to extend the [ALLEGRO_FILE] struct +This allows custom interfaces to extend the [A5O_FILE] struct with their own data. You should close the handle with the standard [al_fclose] function when you are finished with it. @@ -507,5 +507,5 @@ See also: [al_fopen], [al_fclose], [al_set_new_file_interface] Returns a pointer to the custom userdata that is attached to the file handle. This is intended to be used by functions that extend -[ALLEGRO_FILE_INTERFACE]. +[A5O_FILE_INTERFACE]. diff --git a/docs/src/refman/font.txt b/docs/src/refman/font.txt index 9b46ed867a..5a5ca2b385 100644 --- a/docs/src/refman/font.txt +++ b/docs/src/refman/font.txt @@ -9,7 +9,7 @@ Link with allegro_font. ## General font routines -### API: ALLEGRO_FONT +### API: A5O_FONT A handle identifying any kind of font. Usually you will create it with [al_load_font] which supports loading all kinds of TrueType fonts supported by @@ -17,13 +17,13 @@ the FreeType library. If you instead pass the filename of a bitmap file, it will be loaded with [al_load_bitmap] and a font in Allegro's bitmap font format will be created from it with [al_grab_font_from_bitmap]. -### API: ALLEGRO_GLYPH +### API: A5O_GLYPH A structure containing the properties of a character in a font. ~~~~c -typedef struct ALLEGRO_GLYPH { - ALLEGRO_BITMAP *bitmap; // the bitmap the character is on +typedef struct A5O_GLYPH { + A5O_BITMAP *bitmap; // the bitmap the character is on int x; // the x position of the glyph on bitmap int y; // the y position of the glyph on bitmap int w; // the width of the glyph in pixels @@ -32,7 +32,7 @@ typedef struct ALLEGRO_GLYPH { int offset_x; // x offset to draw the glyph at int offset_y; // y offset to draw the glyph at int advance; // number of pixels to advance after this character -} ALLEGRO_GLYPH; +} A5O_GLYPH; ~~~~ bitmap may be a sub-bitmap in the case of color fonts. Bitmap can also be NULL @@ -165,7 +165,7 @@ See also: [al_get_ustr_width], [al_get_font_line_height], ### API: al_get_ustr_width -Like [al_get_text_width] but expects an ALLEGRO_USTR. +Like [al_get_text_width] but expects an A5O_USTR. See also: [al_get_text_width], [al_get_ustr_dimensions] @@ -176,13 +176,13 @@ Writes the NUL-terminated string `text` onto the target bitmap at position `x`, The `flags` parameter can be 0 or one of the following flags: -- ALLEGRO_ALIGN_LEFT - Draw the text left-aligned (same as 0). -- ALLEGRO_ALIGN_CENTRE - Draw the text centered around the given position. -- ALLEGRO_ALIGN_RIGHT - Draw the text right-aligned to the given position. +- A5O_ALIGN_LEFT - Draw the text left-aligned (same as 0). +- A5O_ALIGN_CENTRE - Draw the text centered around the given position. +- A5O_ALIGN_RIGHT - Draw the text right-aligned to the given position. It can also be combined with this flag: -- ALLEGRO_ALIGN_INTEGER - Always draw text aligned to an integer pixel +- A5O_ALIGN_INTEGER - Always draw text aligned to an integer pixel position. This was formerly the default behaviour. Since: 5.0.8, 5.1.4 This function does not support newline characters (`\n`), @@ -193,7 +193,7 @@ See also: [al_draw_ustr], [al_draw_textf], [al_draw_justified_text], ### API: al_draw_ustr -Like [al_draw_text], except the text is passed as an ALLEGRO_USTR instead of +Like [al_draw_text], except the text is passed as an A5O_USTR instead of a NUL-terminated char array. See also: [al_draw_text], [al_draw_justified_ustr], [al_draw_multiline_ustr] @@ -209,14 +209,14 @@ left aligned. The `flags` parameter can be 0 or one of the following flags: -- ALLEGRO_ALIGN_INTEGER - Draw text aligned to integer pixel positions. +- A5O_ALIGN_INTEGER - Draw text aligned to integer pixel positions. Since: 5.0.8, 5.1.5 See also: [al_draw_justified_textf], [al_draw_justified_ustr] ### API: al_draw_justified_ustr -Like [al_draw_justified_text], except the text is passed as an ALLEGRO_USTR +Like [al_draw_justified_text], except the text is passed as an A5O_USTR instead of a NUL-terminated char array. See also: [al_draw_justified_text], [al_draw_justified_textf]. @@ -255,7 +255,7 @@ See also: [al_get_text_width], [al_get_font_line_height], ### API: al_get_ustr_dimensions -Like [al_get_text_dimensions], except the text is passed as an ALLEGRO_USTR +Like [al_get_text_dimensions], except the text is passed as an A5O_USTR instead of a NUL-terminated char array. See also: [al_get_text_dimensions] @@ -417,11 +417,11 @@ Kerning is the process of adjusting the spacing between glyphs in a font, to obtain a more visually pleasing result. Kerning adjusts the space between two individual glyphs with an offset determined by the author of the font. -If you pass ALLEGRO_NO_KERNING as codepoint1 then al_get_glyph_advance +If you pass A5O_NO_KERNING as codepoint1 then al_get_glyph_advance will return 0. this can be useful when drawing the first character of a string in a loop. -Pass ALLEGRO_NO_KERNING as codepoint2 to get the horizontal advance width +Pass A5O_NO_KERNING as codepoint2 to get the horizontal advance width of the glyph that corresponds to codepoint1 without taking any kerning into consideration. This can be used, for example, when drawing the last character of a string in a loop. @@ -444,7 +444,7 @@ or effect. In the figure below is an example of what the result of al_get_glyph_advance may be like for two glypphs `A` and `l` of the same font that has kerning for -the "Al" pair, without and with the ALLEGRO_NO_KERNING flag. +the "Al" pair, without and with the A5O_NO_KERNING flag. al_get_glyph_advance(font, 'A', 'l') @@ -459,7 +459,7 @@ the "Al" pair, without and with the ALLEGRO_NO_KERNING flag. ------------- - al_get_glyph_advance(font, 'A', ALLEGRO_NO_KERNING) + al_get_glyph_advance(font, 'A', A5O_NO_KERNING) ____|____ / \ --------------- @@ -507,8 +507,8 @@ and `flags` parameters, vertically starting at `y` and with a distance of `line_height` between them. If `line_height` is zero (`0`), the value returned by calling [al_get_font_line_height] on `font` will be used as a default instead. -The `flags` ALLEGRO_ALIGN_LEFT, ALLEGRO_ALIGN_CENTRE, ALLEGRO_ALIGN_RIGHT -and ALLEGRO_ALIGN_INTEGER will be honoured by this function. +The `flags` A5O_ALIGN_LEFT, A5O_ALIGN_CENTRE, A5O_ALIGN_RIGHT +and A5O_ALIGN_INTEGER will be honoured by this function. If you want to calculate the size of what this function will draw without actually drawing it, or if you need a complex and/or custom layout, you can use [al_do_multiline_text]. @@ -520,7 +520,7 @@ See also: [al_do_multiline_text], [al_draw_multiline_ustr], ### API: al_draw_multiline_ustr -Like [al_draw_multiline_text], except the text is passed as an ALLEGRO_USTR +Like [al_draw_multiline_text], except the text is passed as an A5O_USTR instead of a NUL-terminated char array. Since: 5.1.9 @@ -571,7 +571,7 @@ See also: [al_draw_multiline_text] ### API: al_do_multiline_ustr -Like [al_do_multiline_text], but using ALLEGRO_USTR instead of a +Like [al_do_multiline_text], but using A5O_USTR instead of a NUL-terminated char array for text. Since: 5.1.9 @@ -659,7 +659,7 @@ See also: [al_load_bitmap_font_flags], [al_load_font], [al_load_bitmap_flags] Like [al_load_bitmap_font] but additionally takes a flags parameter which is a bitfield containing a combination of the following: -ALLEGRO_NO_PREMULTIPLIED_ALPHA +A5O_NO_PREMULTIPLIED_ALPHA : The same meaning as for [al_load_bitmap_flags]. See also: [al_load_bitmap_font], [al_load_bitmap_flags] @@ -735,13 +735,13 @@ multiple times with different size parameters. The following flags are supported: -* ALLEGRO_TTF_NO_KERNING - Do not use any kerning even if the font file +* A5O_TTF_NO_KERNING - Do not use any kerning even if the font file supports it. -* ALLEGRO_TTF_MONOCHROME - Load as a monochrome font (which means no +* A5O_TTF_MONOCHROME - Load as a monochrome font (which means no anti-aliasing of the font is done). -* ALLEGRO_TTF_NO_AUTOHINT - Disable the Auto Hinter which is enabled by default +* A5O_TTF_NO_AUTOHINT - Disable the Auto Hinter which is enabled by default in newer versions of FreeType. Since: 5.0.6, 5.1.2 See also: [al_init_ttf_addon], [al_load_ttf_font_f] @@ -751,7 +751,7 @@ See also: [al_init_ttf_addon], [al_load_ttf_font_f] Like [al_load_ttf_font], but the font is read from the file handle. The filename is only used to find possible additional files next to a font file. -> *Note:* The file handle is owned by the returned ALLEGRO_FONT object and must not +> *Note:* The file handle is owned by the returned A5O_FONT object and must not be freed by the caller, as FreeType expects to be able to read from it at a later time. @@ -780,7 +780,7 @@ See also: [al_load_ttf_font], [al_load_ttf_font_stretch_f] Like [al_load_ttf_font_stretch], but the font is read from the file handle. The filename is only used to find possible additional files next to a font file. -> *Note:* The file handle is owned by the returned ALLEGRO_FONT object and must not +> *Note:* The file handle is owned by the returned A5O_FONT object and must not be freed by the caller, as FreeType expects to be able to read from it at a later time. @@ -805,4 +805,4 @@ Since: 5.2.1 > *[Unstable API]:* This API is new and subject to refinement. -See also: [ALLEGRO_GLYPH] +See also: [A5O_GLYPH] diff --git a/docs/src/refman/fshook.txt b/docs/src/refman/fshook.txt index e1415909a6..4ccfc8e925 100644 --- a/docs/src/refman/fshook.txt +++ b/docs/src/refman/fshook.txt @@ -10,26 +10,26 @@ These functions allow access to the filesystem. This can either be the real filesystem like your harddrive, or a virtual filesystem like a .zip archive (or whatever else you or an addon makes it do). -## API: ALLEGRO_FS_ENTRY +## API: A5O_FS_ENTRY Opaque filesystem entry object. Represents a file or a directory (check with [al_get_fs_entry_mode]). There are no user accessible member variables. -## API: ALLEGRO_FILE_MODE +## API: A5O_FILE_MODE Filesystem modes/types -* ALLEGRO_FILEMODE_READ - Readable -* ALLEGRO_FILEMODE_WRITE - Writable -* ALLEGRO_FILEMODE_EXECUTE - Executable -* ALLEGRO_FILEMODE_HIDDEN - Hidden -* ALLEGRO_FILEMODE_ISFILE - Regular file -* ALLEGRO_FILEMODE_ISDIR - Directory +* A5O_FILEMODE_READ - Readable +* A5O_FILEMODE_WRITE - Writable +* A5O_FILEMODE_EXECUTE - Executable +* A5O_FILEMODE_HIDDEN - Hidden +* A5O_FILEMODE_ISFILE - Regular file +* A5O_FILEMODE_ISDIR - Directory ## API: al_create_fs_entry -Creates an [ALLEGRO_FS_ENTRY] object pointing to path on the filesystem. +Creates an [A5O_FS_ENTRY] object pointing to path on the filesystem. 'path' can be a file or a directory and must not be NULL. ## API: al_destroy_fs_entry @@ -44,7 +44,7 @@ Does nothing if passed NULL. Returns the entry's filename path. Note that the filesystem encoding may not be known and the conversion to UTF-8 could in very rare cases cause this to return an invalid path. Therefore it's -always safest to access the file over its [ALLEGRO_FS_ENTRY] and not the path. +always safest to access the file over its [A5O_FS_ENTRY] and not the path. On success returns a read only string which you must not modify or destroy. Returns NULL on failure. @@ -70,7 +70,7 @@ See also: [al_get_errno], [al_get_fs_entry_atime], [al_get_fs_entry_ctime], Returns the entry's mode flags, i.e. permissions and whether the entry refers to a file or directory. -See also: [al_get_errno], [ALLEGRO_FILE_MODE] +See also: [al_get_errno], [A5O_FILE_MODE] ## API: al_get_fs_entry_atime @@ -128,7 +128,7 @@ See also: [al_filename_exists] ## API: al_filename_exists Check if the path exists on the filesystem, without creating an -[ALLEGRO_FS_ENTRY] object explicitly. +[A5O_FS_ENTRY] object explicitly. See also: [al_fs_entry_exists] @@ -204,7 +204,7 @@ See also: [al_get_errno] ### API: al_open_fs_entry -Open an [ALLEGRO_FILE] handle to a filesystem entry, for the given access mode. +Open an [A5O_FILE] handle to a filesystem entry, for the given access mode. This is like calling [al_fopen] with the name of the filesystem entry, but uses the appropriate file interface, not whatever was set with the latest call to [al_set_new_file_interface]. @@ -213,15 +213,15 @@ Returns the handle on success, NULL on error. See also: [al_fopen] -### API: ALLEGRO_FOR_EACH_FS_ENTRY_RESULT +### API: A5O_FOR_EACH_FS_ENTRY_RESULT Return values for the callbacks of [al_for_each_fs_entry] and for that function itself. -* ALLEGRO_FOR_EACH_FS_ENTRY_ERROR - An error ocurred. -* ALLEGRO_FOR_EACH_FS_ENTRY_OK - Continue normally and recurse into directories. -* ALLEGRO_FOR_EACH_FS_ENTRY_SKIP - Continue but do NOT recusively descend. -* ALLEGRO_FOR_EACH_FS_ENTRY_STOP - Stop iterating and return. +* A5O_FOR_EACH_FS_ENTRY_ERROR - An error ocurred. +* A5O_FOR_EACH_FS_ENTRY_OK - Continue normally and recurse into directories. +* A5O_FOR_EACH_FS_ENTRY_SKIP - Continue but do NOT recusively descend. +* A5O_FOR_EACH_FS_ENTRY_STOP - Stop iterating and return. See also: [al_for_each_fs_entry] @@ -229,43 +229,43 @@ Since: 5.1.9 ### API: al_for_each_fs_entry -This function takes the [ALLEGRO_FS_ENTRY] `dir`, which should +This function takes the [A5O_FS_ENTRY] `dir`, which should represent a directory, and looks for any other file system entries that are in it. This function will then call the callback function `callback` once for every filesystem entry in the directory `dir`. -The callback `callback` must be of type `int callback(ALLEGRO_FS_ENTRY * +The callback `callback` must be of type `int callback(A5O_FS_ENTRY * entry, void * extra)`. The `callback` will be called with a pointer -to an [ALLEGRO_FS_ENTRY] that matches one file or directory in `dir`, +to an [A5O_FS_ENTRY] that matches one file or directory in `dir`, and the pointer passed in the `extra` parameter to [al_for_each_fs_entry]. -When `callback` returns `ALLEGRO_FOR_EACH_FS_ENTRY_STOP` or -`ALLEGRO_FOR_EACH_FS_ENTRY_ERROR`, iteration will stop immediately +When `callback` returns `A5O_FOR_EACH_FS_ENTRY_STOP` or +`A5O_FOR_EACH_FS_ENTRY_ERROR`, iteration will stop immediately and [al_for_each_fs_entry] will return the value the `callback` returned. -When `callback` returns `ALLEGRO_FOR_EACH_FS_ENTRY_OK` iteration will continue -normally, and if the [ALLEGRO_FS_ENTRY] parameter of `callback` +When `callback` returns `A5O_FOR_EACH_FS_ENTRY_OK` iteration will continue +normally, and if the [A5O_FS_ENTRY] parameter of `callback` is a directory, [al_for_each_fs_entry] will call itself on that directory. Therefore the function will recusively descend into that directory. -However, when `callback` returns `ALLEGRO_FOR_EACH_FS_ENTRY_SKIP` iteration +However, when `callback` returns `A5O_FOR_EACH_FS_ENTRY_SKIP` iteration will continue, but [al_for_each_fs_entry] will NOT recurse into the -[ALLEGRO_FS_ENTRY] parameter of `callback` even if it is a directory. +[A5O_FS_ENTRY] parameter of `callback` even if it is a directory. This function will skip any files or directories named `.` or `..` which may exist on certain platforms and may signify the current and the parent directory. The `callback` will not be called for files or directories with such a name. -Returns ALLEGRO_FOR_EACH_FS_ENTRY_OK if successful, or -ALLEGRO_FOR_EACH_FS_ENTRY_ERROR if something went wrong in +Returns A5O_FOR_EACH_FS_ENTRY_OK if successful, or +A5O_FOR_EACH_FS_ENTRY_ERROR if something went wrong in processing the directory. In that case it will use [al_set_errno] to indicate the type of error which occurred. This function returns -ALLEGRO_FOR_EACH_FS_ENTRY_STOP in case iteration was stopped by making +A5O_FOR_EACH_FS_ENTRY_STOP in case iteration was stopped by making `callback` return that value. In this case, [al_set_errno] will not be used. -See also: [ALLEGRO_FOR_EACH_FS_ENTRY_RESULT] +See also: [A5O_FOR_EACH_FS_ENTRY_RESULT] Since: 5.1.9 @@ -277,26 +277,26 @@ the local filesystem but inside some file archive, you can provide your own set of functions (or use an addon which does this for you, for example our physfs addon allows access to the most common archive formats). -### API: ALLEGRO_FS_INTERFACE +### API: A5O_FS_INTERFACE The available functions you can provide for a filesystem. They are: ~~~ - ALLEGRO_FS_ENTRY * fs_create_entry (const char *path); - void fs_destroy_entry (ALLEGRO_FS_ENTRY *e); - const char * fs_entry_name (ALLEGRO_FS_ENTRY *e); - bool fs_update_entry (ALLEGRO_FS_ENTRY *e); - uint32_t fs_entry_mode (ALLEGRO_FS_ENTRY *e); - time_t fs_entry_atime (ALLEGRO_FS_ENTRY *e); - time_t fs_entry_mtime (ALLEGRO_FS_ENTRY *e); - time_t fs_entry_ctime (ALLEGRO_FS_ENTRY *e); - off_t fs_entry_size (ALLEGRO_FS_ENTRY *e); - bool fs_entry_exists (ALLEGRO_FS_ENTRY *e); - bool fs_remove_entry (ALLEGRO_FS_ENTRY *e); - - bool fs_open_directory (ALLEGRO_FS_ENTRY *e); - ALLEGRO_FS_ENTRY * fs_read_directory (ALLEGRO_FS_ENTRY *e); - bool fs_close_directory(ALLEGRO_FS_ENTRY *e); + A5O_FS_ENTRY * fs_create_entry (const char *path); + void fs_destroy_entry (A5O_FS_ENTRY *e); + const char * fs_entry_name (A5O_FS_ENTRY *e); + bool fs_update_entry (A5O_FS_ENTRY *e); + uint32_t fs_entry_mode (A5O_FS_ENTRY *e); + time_t fs_entry_atime (A5O_FS_ENTRY *e); + time_t fs_entry_mtime (A5O_FS_ENTRY *e); + time_t fs_entry_ctime (A5O_FS_ENTRY *e); + off_t fs_entry_size (A5O_FS_ENTRY *e); + bool fs_entry_exists (A5O_FS_ENTRY *e); + bool fs_remove_entry (A5O_FS_ENTRY *e); + + bool fs_open_directory (A5O_FS_ENTRY *e); + A5O_FS_ENTRY * fs_read_directory (A5O_FS_ENTRY *e); + bool fs_close_directory(A5O_FS_ENTRY *e); bool fs_filename_exists(const char *path); bool fs_remove_filename(const char *path); @@ -304,26 +304,26 @@ The available functions you can provide for a filesystem. They are: bool fs_change_directory(const char *path); bool fs_make_directory(const char *path); - ALLEGRO_FILE * fs_open_file(ALLEGRO_FS_ENTRY *e); + A5O_FILE * fs_open_file(A5O_FS_ENTRY *e); ~~~ ### API: al_set_fs_interface -Set the [ALLEGRO_FS_INTERFACE] table for the calling thread. +Set the [A5O_FS_INTERFACE] table for the calling thread. See also: [al_set_standard_fs_interface], [al_store_state], [al_restore_state]. ### API: al_set_standard_fs_interface -Return the [ALLEGRO_FS_INTERFACE] table to the default, for the calling +Return the [A5O_FS_INTERFACE] table to the default, for the calling thread. See also: [al_set_fs_interface]. ### API: al_get_fs_interface -Return a pointer to the [ALLEGRO_FS_INTERFACE] table in effect +Return a pointer to the [A5O_FS_INTERFACE] table in effect for the calling thread. See also: [al_store_state], [al_restore_state]. diff --git a/docs/src/refman/fullscreen_mode.txt b/docs/src/refman/fullscreen_mode.txt index 9a0d7dd011..87e9246688 100644 --- a/docs/src/refman/fullscreen_mode.txt +++ b/docs/src/refman/fullscreen_mode.txt @@ -6,23 +6,23 @@ These functions are declared in the main Allegro header file: #include ~~~~ -## API: ALLEGRO_DISPLAY_MODE +## API: A5O_DISPLAY_MODE Used for fullscreen mode queries. Contains information about a supported fullscreen modes. ~~~~c -typedef struct ALLEGRO_DISPLAY_MODE { +typedef struct A5O_DISPLAY_MODE { int width; // Screen width int height; // Screen height int format; // The pixel format of the mode int refresh_rate; // The refresh rate of the mode -} ALLEGRO_DISPLAY_MODE; +} A5O_DISPLAY_MODE; ~~~~ The `refresh_rate` may be zero if unknown. -For an explanation of what `format` means, see [ALLEGRO_PIXEL_FORMAT]. +For an explanation of what `format` means, see [A5O_PIXEL_FORMAT]. See also: [al_get_display_mode] @@ -32,11 +32,11 @@ Retrieves a fullscreen mode. Display parameters should not be changed between a call of [al_get_num_display_modes] and [al_get_display_mode]. index must be between 0 and the number returned from al_get_num_display_modes-1. mode must be an -allocated ALLEGRO_DISPLAY_MODE structure. This function will +allocated A5O_DISPLAY_MODE structure. This function will return NULL on failure, and the mode parameter that was passed in on success. -See also: [ALLEGRO_DISPLAY_MODE], [al_get_num_display_modes] +See also: [A5O_DISPLAY_MODE], [al_get_num_display_modes] ## API: al_get_num_display_modes diff --git a/docs/src/refman/getting_started.txt b/docs/src/refman/getting_started.txt index 59db7aa8c9..f623c1f3d2 100644 --- a/docs/src/refman/getting_started.txt +++ b/docs/src/refman/getting_started.txt @@ -66,10 +66,10 @@ To receive input, you need to initialise some subsystems like ## Opening a window -[al_create_display] will open a window and return an [ALLEGRO_DISPLAY]. +[al_create_display] will open a window and return an [A5O_DISPLAY]. To clear the display, call [al_clear_to_color]. Use [al_map_rgba] or -[al_map_rgba_f] to obtain an [ALLEGRO_COLOR] parameter. +[al_map_rgba_f] to obtain an [A5O_COLOR] parameter. Drawing operations are performed on a backbuffer. To make the operations visible, call [al_flip_display]. @@ -78,7 +78,7 @@ visible, call [al_flip_display]. To load an image from disk, you need to have initialised the image I/O addon with [al_init_image_addon]. Then use [al_load_bitmap], which returns an -[ALLEGRO_BITMAP]. +[A5O_BITMAP]. Use [al_draw_bitmap], [al_draw_scaled_bitmap] or [al_draw_scaled_rotated_bitmap] to draw the image to the backbuffer. @@ -109,11 +109,11 @@ usual input event sources can be retrieved with [al_get_keyboard_event_source], [al_get_mouse_event_source] and [al_get_joystick_event_source]. Events can be retrieved with [al_wait_for_event] or [al_get_next_event]. -Check the event type and other fields of [ALLEGRO_EVENT] to react to the +Check the event type and other fields of [A5O_EVENT] to react to the input. Displays are also event sources, which emit events when they are resized. -You'll need to set the ALLEGRO_RESIZABLE flag with [al_set_new_display_flags] +You'll need to set the A5O_RESIZABLE flag with [al_set_new_display_flags] before creating the display, then register the display with an event queue. When you get a resize event, call [al_acknowledge_resize]. @@ -166,20 +166,20 @@ mentioned above only sets up a default mixer and a number of sample instances but you don't need to use it. Instead, to get a "direct connection" to the sound system you would use an -[ALLEGRO_VOICE] (but depending on the platform only one such voice is guaranteed +[A5O_VOICE] (but depending on the platform only one such voice is guaranteed to be available and it might require a specific format of audio data). Therefore -all sound can be first routed through an [ALLEGRO_MIXER] which is connected to +all sound can be first routed through an [A5O_MIXER] which is connected to such a voice (or another mixer) and will mix together all sample data fed to it. You can then directly stream real-time sample data to a mixer or a voice using -an [ALLEGRO_AUDIO_STREAM] or play complete sounds using an [ALLEGRO_SAMPLE_INSTANCE]. -The latter simply points to an [ALLEGRO_SAMPLE] and will stream it for you. +an [A5O_AUDIO_STREAM] or play complete sounds using an [A5O_SAMPLE_INSTANCE]. +The latter simply points to an [A5O_SAMPLE] and will stream it for you. ## Unstable API Some of Allegro's API is marked as unstable, which means that in future versions of Allegro it may change or even be removed entirely! If you want to experiment -with the unstable API, define `ALLEGRO_UNSTABLE` macro before including Allegro's +with the unstable API, define `A5O_UNSTABLE` macro before including Allegro's headers. Note that when you define that macro, the version check performed by diff --git a/docs/src/refman/graphics.txt b/docs/src/refman/graphics.txt index b9ba1abd41..ddd4de73c8 100644 --- a/docs/src/refman/graphics.txt +++ b/docs/src/refman/graphics.txt @@ -8,15 +8,15 @@ These functions are declared in the main Allegro header file: ## Colors -### API: ALLEGRO_COLOR +### API: A5O_COLOR -An ALLEGRO_COLOR structure describes a color in a device +An A5O_COLOR structure describes a color in a device independent way. Use [al_map_rgb] et al. and [al_unmap_rgb] et al. to translate from and to various color representations. ### API: al_map_rgb -Convert r, g, b (ranging from 0-255) into an [ALLEGRO_COLOR], +Convert r, g, b (ranging from 0-255) into an [A5O_COLOR], using 255 for alpha. This function can be called before Allegro is initialized. @@ -25,7 +25,7 @@ See also: [al_map_rgba], [al_map_rgba_f], [al_map_rgb_f] ### API: al_map_rgb_f -Convert r, g, b, (ranging from 0.0f-1.0f) into an [ALLEGRO_COLOR], +Convert r, g, b, (ranging from 0.0f-1.0f) into an [A5O_COLOR], using 1.0f for alpha. This function can be called before Allegro is initialized. @@ -34,7 +34,7 @@ See also: [al_map_rgba], [al_map_rgb], [al_map_rgba_f] ### API: al_map_rgba -Convert r, g, b, a (ranging from 0-255) into an [ALLEGRO_COLOR]. +Convert r, g, b, a (ranging from 0-255) into an [A5O_COLOR]. This function can be called before Allegro is initialized. @@ -55,7 +55,7 @@ int r = 255; int g = 0; int b = 0; int a = 127; -ALLEGRO_COLOR c = al_premul_rgba(r, g, b, a); +A5O_COLOR c = al_premul_rgba(r, g, b, a); /* Draw the bitmap tinted red and half-transparent. */ al_draw_tinted_bitmap(bmp, c, 0, 0, 0); ~~~~ @@ -68,7 +68,7 @@ See also: [al_map_rgba], [al_premul_rgba_f] ### API: al_map_rgba_f -Convert r, g, b, a (ranging from 0.0f-1.0f) into an [ALLEGRO_COLOR]. +Convert r, g, b, a (ranging from 0.0f-1.0f) into an [A5O_COLOR]. This function can be called before Allegro is initialized. @@ -89,7 +89,7 @@ float r = 1; float g = 0; float b = 0; float a = 0.5; -ALLEGRO_COLOR c = al_premul_rgba_f(r, g, b, a); +A5O_COLOR c = al_premul_rgba_f(r, g, b, a); /* Draw the bitmap tinted red and half-transparent. */ al_draw_tinted_bitmap(bmp, c, 0, 0, 0); ~~~~ @@ -102,7 +102,7 @@ See also: [al_map_rgba_f], [al_premul_rgba] ### API: al_unmap_rgb -Retrieves components of an ALLEGRO_COLOR, ignoring alpha. +Retrieves components of an A5O_COLOR, ignoring alpha. Components will range from 0-255. This function can be called before Allegro is initialized. @@ -111,7 +111,7 @@ See also: [al_unmap_rgba], [al_unmap_rgba_f], [al_unmap_rgb_f] ### API: al_unmap_rgb_f -Retrieves components of an [ALLEGRO_COLOR], ignoring alpha. +Retrieves components of an [A5O_COLOR], ignoring alpha. Components will range from 0.0f-1.0f. This function can be called before Allegro is initialized. @@ -120,7 +120,7 @@ See also: [al_unmap_rgba], [al_unmap_rgb], [al_unmap_rgba_f] ### API: al_unmap_rgba -Retrieves components of an [ALLEGRO_COLOR]. +Retrieves components of an [A5O_COLOR]. Components will range from 0-255. This function can be called before Allegro is initialized. @@ -129,7 +129,7 @@ See also: [al_unmap_rgb], [al_unmap_rgba_f], [al_unmap_rgb_f] ### API: al_unmap_rgba_f -Retrieves components of an [ALLEGRO_COLOR]. +Retrieves components of an [A5O_COLOR]. Components will range from 0.0f-1.0f. This function can be called before Allegro is initialized. @@ -140,20 +140,20 @@ See also: [al_unmap_rgba], [al_unmap_rgb], [al_unmap_rgb_f] ## Locking and pixel formats -### API: ALLEGRO_LOCKED_REGION +### API: A5O_LOCKED_REGION Users who wish to manually edit or read from a bitmap -are required to lock it first. The ALLEGRO_LOCKED_REGION +are required to lock it first. The A5O_LOCKED_REGION structure represents the locked region of the bitmap. This call will work with any bitmap, including memory bitmaps. ~~~~c -typedef struct ALLEGRO_LOCKED_REGION { +typedef struct A5O_LOCKED_REGION { void *data; int format; int pitch; int pixel_size; -} ALLEGRO_LOCKED_REGION; +} A5O_LOCKED_REGION; ~~~~ - *data* points to the leftmost pixel of the first row (row 0) of the locked @@ -174,9 +174,9 @@ typedef struct ALLEGRO_LOCKED_REGION { a single pixel, but for blocked pixel formats this value is different. See also: [al_lock_bitmap], [al_lock_bitmap_region], [al_unlock_bitmap], -[ALLEGRO_PIXEL_FORMAT] +[A5O_PIXEL_FORMAT] -### API: ALLEGRO_PIXEL_FORMAT +### API: A5O_PIXEL_FORMAT Pixel formats. Each pixel format specifies the exact size and bit layout of a pixel in memory. Components are specified from high bits @@ -204,11 +204,11 @@ is 0xFFFF0000. Also note that Allegro's naming is different from OpenGL naming here, where a format of GL_RGBA8 merely defines the component order and the exact layout including endianness treatment is specified separately. -Usually GL_RGBA8 will correspond to ALLEGRO_PIXEL_ABGR_8888 though on +Usually GL_RGBA8 will correspond to A5O_PIXEL_ABGR_8888 though on little endian systems, so care must be taken (note the reversal of RGBA <-> ABGR). -The only exception to this ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE which will always +The only exception to this A5O_PIXEL_FORMAT_ABGR_8888_LE which will always have the components as 4 bytes corresponding to red, green, blue and alpha, in this order, independent of the endianness. @@ -236,46 +236,46 @@ It is not recommended to use compressed bitmaps as target bitmaps, as that operation cannot be hardware accelerated. Due to proprietary algorithms used, it is typically impossible to create compressed memory bitmaps. -* ALLEGRO_PIXEL_FORMAT_ANY - +* A5O_PIXEL_FORMAT_ANY - Let the driver choose a format. This is the default format at program start. -* ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA - +* A5O_PIXEL_FORMAT_ANY_NO_ALPHA - Let the driver choose a format without alpha. -* ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA - +* A5O_PIXEL_FORMAT_ANY_WITH_ALPHA - Let the driver choose a format with alpha. -* ALLEGRO_PIXEL_FORMAT_ANY_15_NO_ALPHA - +* A5O_PIXEL_FORMAT_ANY_15_NO_ALPHA - Let the driver choose a 15 bit format without alpha. -* ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA - +* A5O_PIXEL_FORMAT_ANY_16_NO_ALPHA - Let the driver choose a 16 bit format without alpha. -* ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA - +* A5O_PIXEL_FORMAT_ANY_16_WITH_ALPHA - Let the driver choose a 16 bit format with alpha. -* ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA - +* A5O_PIXEL_FORMAT_ANY_24_NO_ALPHA - Let the driver choose a 24 bit format without alpha. -* ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA - +* A5O_PIXEL_FORMAT_ANY_32_NO_ALPHA - Let the driver choose a 32 bit format without alpha. -* ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA - +* A5O_PIXEL_FORMAT_ANY_32_WITH_ALPHA - Let the driver choose a 32 bit format with alpha. -* ALLEGRO_PIXEL_FORMAT_ARGB_8888 - 32 bit -* ALLEGRO_PIXEL_FORMAT_RGBA_8888 - 32 bit -* ALLEGRO_PIXEL_FORMAT_ARGB_4444 - 16 bit -* ALLEGRO_PIXEL_FORMAT_RGB_888 - 24 bit -* ALLEGRO_PIXEL_FORMAT_RGB_565 - 16 bit -* ALLEGRO_PIXEL_FORMAT_RGB_555 - 15 bit -* ALLEGRO_PIXEL_FORMAT_RGBA_5551 - 16 bit -* ALLEGRO_PIXEL_FORMAT_ARGB_1555 - 16 bit -* ALLEGRO_PIXEL_FORMAT_ABGR_8888 - 32 bit -* ALLEGRO_PIXEL_FORMAT_XBGR_8888 - 32 bit -* ALLEGRO_PIXEL_FORMAT_BGR_888 - 24 bit -* ALLEGRO_PIXEL_FORMAT_BGR_565 - 16 bit -* ALLEGRO_PIXEL_FORMAT_BGR_555 - 15 bit -* ALLEGRO_PIXEL_FORMAT_RGBX_8888 - 32 bit -* ALLEGRO_PIXEL_FORMAT_XRGB_8888 - 32 bit -* ALLEGRO_PIXEL_FORMAT_ABGR_F32 - 128 bit -* ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE - +* A5O_PIXEL_FORMAT_ARGB_8888 - 32 bit +* A5O_PIXEL_FORMAT_RGBA_8888 - 32 bit +* A5O_PIXEL_FORMAT_ARGB_4444 - 16 bit +* A5O_PIXEL_FORMAT_RGB_888 - 24 bit +* A5O_PIXEL_FORMAT_RGB_565 - 16 bit +* A5O_PIXEL_FORMAT_RGB_555 - 15 bit +* A5O_PIXEL_FORMAT_RGBA_5551 - 16 bit +* A5O_PIXEL_FORMAT_ARGB_1555 - 16 bit +* A5O_PIXEL_FORMAT_ABGR_8888 - 32 bit +* A5O_PIXEL_FORMAT_XBGR_8888 - 32 bit +* A5O_PIXEL_FORMAT_BGR_888 - 24 bit +* A5O_PIXEL_FORMAT_BGR_565 - 16 bit +* A5O_PIXEL_FORMAT_BGR_555 - 15 bit +* A5O_PIXEL_FORMAT_RGBX_8888 - 32 bit +* A5O_PIXEL_FORMAT_XRGB_8888 - 32 bit +* A5O_PIXEL_FORMAT_ABGR_F32 - 128 bit +* A5O_PIXEL_FORMAT_ABGR_8888_LE - Like the version without _LE, but the component order is guaranteed to be red, green, blue, alpha. This only makes a difference on big endian systems, on little endian it is just an alias. -* ALLEGRO_PIXEL_FORMAT_RGBA_4444 - 16bit -* ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8 - +* A5O_PIXEL_FORMAT_RGBA_4444 - 16bit +* A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8 - A single 8-bit channel. A pixel value maps onto the red channel when displayed, but it is undefined how it maps onto green, blue and alpha channels. When drawing to bitmaps of this format, only the red channel is @@ -283,15 +283,15 @@ is typically impossible to create compressed memory bitmaps. bitmaps of this format. This pixel format is mainly intended for storing the color indices of an indexed (paletted) image, usually in conjunction with a pixel shader that maps indices to RGBA values. Since 5.1.2. -* ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1 - +* A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1 - Compressed using the DXT1 compression algorithm. Each 4x4 pixel block is encoded in 64 bytes, resulting in 6-8x compression ratio. Only a single bit of alpha per pixel is supported. Since 5.1.9. -* ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3 - +* A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3 - Compressed using the DXT3 compression algorithm. Each 4x4 pixel block is encoded in 128 bytes, resulting in 4x compression ratio. This format supports sharp alpha transitions. Since 5.1.9. -* ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5 - +* A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5 - Compressed using the DXT5 compression algorithm. Each 4x4 pixel block is encoded in 128 bytes, resulting in 4x compression ratio. This format supports smooth alpha transitions. Since 5.1.9. @@ -303,14 +303,14 @@ See also: [al_set_new_bitmap_format], [al_get_bitmap_format] Return the number of bytes that a pixel of the given format occupies. For blocked pixel formats (e.g. compressed formats), this returns 0. -See also: [ALLEGRO_PIXEL_FORMAT], [al_get_pixel_format_bits] +See also: [A5O_PIXEL_FORMAT], [al_get_pixel_format_bits] ### API: al_get_pixel_format_bits Return the number of bits that a pixel of the given format occupies. For blocked pixel formats (e.g. compressed formats), this returns 0. -See also: [ALLEGRO_PIXEL_FORMAT], [al_get_pixel_size] +See also: [A5O_PIXEL_FORMAT], [al_get_pixel_size] ### API: al_get_pixel_block_size @@ -318,7 +318,7 @@ Return the number of bytes that a block of pixels with this format occupies. Since: 5.1.9. -See also: [ALLEGRO_PIXEL_FORMAT], [al_get_pixel_block_width], [al_get_pixel_block_height] +See also: [A5O_PIXEL_FORMAT], [al_get_pixel_block_width], [al_get_pixel_block_height] ### API: al_get_pixel_block_width @@ -326,7 +326,7 @@ Return the width of the the pixel block for this format. Since: 5.1.9. -See also: [ALLEGRO_PIXEL_FORMAT], [al_get_pixel_block_size], [al_get_pixel_block_height] +See also: [A5O_PIXEL_FORMAT], [al_get_pixel_block_size], [al_get_pixel_block_height] ### API: al_get_pixel_block_height @@ -334,7 +334,7 @@ Return the height of the the pixel block for this format. Since: 5.1.9. -See also: [ALLEGRO_PIXEL_FORMAT], [al_get_pixel_block_size], [al_get_pixel_block_width] +See also: [A5O_PIXEL_FORMAT], [al_get_pixel_block_size], [al_get_pixel_block_width] ### API: al_lock_bitmap @@ -346,37 +346,37 @@ function also returns NULL if the `format` is a compressed format. Flags are: -* ALLEGRO_LOCK_READONLY - The locked region will not be written to. This can +* A5O_LOCK_READONLY - The locked region will not be written to. This can be faster if the bitmap is a video texture, as it can be discarded after the lock instead of uploaded back to the card. -* ALLEGRO_LOCK_WRITEONLY - The locked region will not be read from. This can +* A5O_LOCK_WRITEONLY - The locked region will not be read from. This can be faster if the bitmap is a video texture, as no data need to be read from the video card. You are required to fill in all pixels before unlocking the bitmap again, so be careful when using this flag. -* ALLEGRO_LOCK_READWRITE - The locked region can be written to and read from. +* A5O_LOCK_READWRITE - The locked region can be written to and read from. Use this flag if a partial number of pixels need to be written to, even if reading is not needed. `format` indicates the pixel format that the returned buffer will be in. To lock in the same format as the bitmap stores its data internally, call with `al_get_bitmap_format(bitmap)` as the format or use -ALLEGRO_PIXEL_FORMAT_ANY. Locking in the native format will usually be faster. -If the bitmap format is compressed, using ALLEGRO_PIXEL_FORMAT_ANY will choose +A5O_PIXEL_FORMAT_ANY. Locking in the native format will usually be faster. +If the bitmap format is compressed, using A5O_PIXEL_FORMAT_ANY will choose an implementation defined non-compressed format. On some platforms, Allegro automatically backs up the contents of video bitmaps because they may be occasionally lost (see discussion in [al_create_bitmap]'s documentation). If you're completely recreating the bitmap contents often (e.g. every frame) then you will get much better performance by creating the target -bitmap with ALLEGRO_NO_PRESERVE_TEXTURE flag. +bitmap with A5O_NO_PRESERVE_TEXTURE flag. > *Note:* While a bitmap is locked, you can not use any drawing operations on it (with the sole exception of [al_put_pixel] and [al_put_blended_pixel]). -See also: [ALLEGRO_LOCKED_REGION], [ALLEGRO_PIXEL_FORMAT], +See also: [A5O_LOCKED_REGION], [A5O_PIXEL_FORMAT], [al_unlock_bitmap], [al_lock_bitmap_region], [al_lock_bitmap_blocked], [al_lock_bitmap_region_blocked] @@ -387,15 +387,15 @@ If the bitmap is a video bitmap, only that area of the texture will be updated when it is unlocked. Locking only the region you indend to modify will be faster than locking the whole bitmap. -> *Note:* Using the ALLEGRO_LOCK_WRITEONLY with a blocked pixel format +> *Note:* Using the A5O_LOCK_WRITEONLY with a blocked pixel format (i.e. formats for which [al_get_pixel_block_width] or [al_get_pixel_block_height] do not return 1) requires you to have the region be aligned to the block width for optimal performance. If it is not, then the function will have to lock the region with the -ALLEGRO_LOCK_READWRITE instead in order to pad this region with valid +A5O_LOCK_READWRITE instead in order to pad this region with valid data. -See also: [ALLEGRO_LOCKED_REGION], [ALLEGRO_PIXEL_FORMAT], [al_unlock_bitmap] +See also: [A5O_LOCKED_REGION], [A5O_PIXEL_FORMAT], [al_unlock_bitmap] ### API: al_unlock_bitmap @@ -434,7 +434,7 @@ See also: [al_lock_bitmap_region], [al_lock_bitmap_blocked] ## Bitmap creation -### API: ALLEGRO_BITMAP +### API: A5O_BITMAP Abstract type representing a bitmap (2D image). @@ -444,7 +444,7 @@ Creates a new bitmap using the bitmap format and flags for the current thread. Blitting between bitmaps of differing formats, or blitting between memory bitmaps and display bitmaps may be slow. -Unless you set the ALLEGRO_MEMORY_BITMAP flag, the bitmap is created +Unless you set the A5O_MEMORY_BITMAP flag, the bitmap is created for the current display. Blitting to another display may be slow. If a display bitmap is created, there may be limitations on the @@ -467,7 +467,7 @@ of that bitmap with the dimensions you requested. This can be relevant if you plan to use this bitmap with the primitives addon but shouldn't be an issue otherwise. -If you create a bitmap without ALLEGRO_MEMORY_BITMAP set but there is +If you create a bitmap without A5O_MEMORY_BITMAP set but there is no current display, a temporary memory bitmap will be created instead. You can later convert all such bitmap to video bitmap and assign to a display by calling [al_convert_memory_bitmaps]. @@ -479,10 +479,10 @@ contents can get lost permanently) and has performance implications. If you are using a bitmap as an intermediate buffer this mechanism may be wasteful. In this case, if you do not want Allegro to manage the bitmap contents for you, you can disable this mechanism by creating the bitmap with the -ALLEGRO_NO_PRESERVE_TEXTURE flag. The bitmap contents are lost when you get the -ALLEGRO_EVENT_DISPLAY_LOST and ALLEGRO_EVENT_DISPLAY_HALT_DRAWING and a should -be restored when you get the ALLEGRO_EVENT_DISPLAY_FOUND and when you call -[al_acknowledge_drawing_resume] (after ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING +A5O_NO_PRESERVE_TEXTURE flag. The bitmap contents are lost when you get the +A5O_EVENT_DISPLAY_LOST and A5O_EVENT_DISPLAY_HALT_DRAWING and a should +be restored when you get the A5O_EVENT_DISPLAY_FOUND and when you call +[al_acknowledge_drawing_resume] (after A5O_EVENT_DISPLAY_RESUME_DRAWING event). You can use those events to implement your own bitmap content restoration mechanism if Allegro's does not work well enough for you (for example, you can reload them all from disk). @@ -555,7 +555,7 @@ See also: [al_create_bitmap], [al_set_new_bitmap_format], If you create a bitmap when there is no current display (for example because you have not called [al_create_display] in the current -thread) and are using the ALLEGRO_CONVERT_BITMAP bitmap flag (which is +thread) and are using the A5O_CONVERT_BITMAP bitmap flag (which is set by default) then the bitmap will be created successfully, but as a memory bitmap. This function converts all such bitmaps to proper video bitmaps belonging to the current display. @@ -563,8 +563,8 @@ bitmaps belonging to the current display. Note that video bitmaps get automatically converted back to memory bitmaps when the last display is destroyed. -This operation will preserve all bitmap flags except ALLEGRO_VIDEO_BITMAP and -ALLEGRO_MEMORY_BITMAP. +This operation will preserve all bitmap flags except A5O_VIDEO_BITMAP and +A5O_MEMORY_BITMAP. Since: 5.2.0 @@ -594,14 +594,14 @@ See also: [al_set_new_bitmap_flags] Returns the format used for newly created bitmaps. -See also: [ALLEGRO_PIXEL_FORMAT], [al_set_new_bitmap_format] +See also: [A5O_PIXEL_FORMAT], [al_set_new_bitmap_format] ### API: al_set_new_bitmap_flags Sets the flags to use for newly created bitmaps. Valid flags are: -ALLEGRO_MEMORY_BITMAP +A5O_MEMORY_BITMAP : Create a bitmap residing in system memory. Operations on, and with, memory bitmaps will not be hardware accelerated. However, direct pixel access can be relatively quick compared to video bitmaps, @@ -610,10 +610,10 @@ ALLEGRO_MEMORY_BITMAP *Note*: Allegro's software rendering routines are currently somewhat unoptimised. - *Note:* Combining ALLEGRO_VIDEO_BITMAP and ALLEGRO_MEMORY_BITMAP flags is + *Note:* Combining A5O_VIDEO_BITMAP and A5O_MEMORY_BITMAP flags is invalid. -ALLEGRO_VIDEO_BITMAP +A5O_VIDEO_BITMAP : Creates a bitmap that resides in the video card memory. These types of bitmaps receive the greatest benefit from hardware acceleration. @@ -624,12 +624,12 @@ ALLEGRO_VIDEO_BITMAP *Note:* Bitmaps created with this flag will be converted to memory bitmaps when the last display is destroyed. In most cases it is - therefore easier to use the ALLEGRO_CONVERT_BITMAP flag instead. + therefore easier to use the A5O_CONVERT_BITMAP flag instead. - *Note:* Combining ALLEGRO_VIDEO_BITMAP and ALLEGRO_MEMORY_BITMAP flags is + *Note:* Combining A5O_VIDEO_BITMAP and A5O_MEMORY_BITMAP flags is invalid. -ALLEGRO_CONVERT_BITMAP +A5O_CONVERT_BITMAP : This is the default. It will try to create a video bitmap and if that fails create a memory bitmap. Bitmaps created with this flag when there is no active display will be converted to video bitmaps @@ -637,25 +637,25 @@ ALLEGRO_CONVERT_BITMAP if the last display is destroyed and then another is created again. Since 5.1.0. - *Note:* You can combine this flag with ALLEGRO_MEMORY_BITMAP or - ALLEGRO_VIDEO_BITMAP to force the initial type (and fail in the + *Note:* You can combine this flag with A5O_MEMORY_BITMAP or + A5O_VIDEO_BITMAP to force the initial type (and fail in the latter case if no video bitmap can be created) - but usually neither of those combinations is very useful. - You can use the display option ALLEGRO_AUTO_CONVERT_BITMAPS to + You can use the display option A5O_AUTO_CONVERT_BITMAPS to control which displays will try to auto-convert bitmaps. -ALLEGRO_FORCE_LOCKING +A5O_FORCE_LOCKING : Does nothing since 5.1.8. Kept for backwards compatibility only. -ALLEGRO_NO_PRESERVE_TEXTURE +A5O_NO_PRESERVE_TEXTURE : Normally, every effort is taken to preserve the contents of bitmaps, since some platforms may forget them. This can take extra processing time. If you know it doesn't matter if a bitmap keeps its pixel data, for example when it's a temporary buffer, use this flag to tell Allegro not to attempt to preserve its contents. -ALLEGRO_ALPHA_TEST +A5O_ALPHA_TEST : This is a driver hint only. It tells the graphics driver to do alpha testing instead of alpha blending on bitmaps created with this flag. Alpha testing is usually faster and @@ -663,19 +663,19 @@ ALLEGRO_ALPHA_TEST flag is currently not widely implemented (i.e., only for memory bitmaps). -ALLEGRO_MIN_LINEAR +A5O_MIN_LINEAR : When drawing a scaled down version of the bitmap, use linear filtering. This usually looks better. You can also combine it with the MIPMAP flag for even better quality. -ALLEGRO_MAG_LINEAR +A5O_MAG_LINEAR : When drawing a magnified version of a bitmap, use linear filtering. This will cause the picture to get blurry instead of creating a big rectangle for each pixel. It depends on how you want things to look like whether you want to use this or not. -ALLEGRO_MIPMAP +A5O_MIPMAP : This can only be used for bitmaps whose width and height is a power of two. In that case, it will generate mipmaps and use them when @@ -697,11 +697,11 @@ See also: [al_set_new_bitmap_flags], [al_get_new_bitmap_flags], [al_get_bitmap_f ### API: al_set_new_bitmap_format -Sets the pixel format ([ALLEGRO_PIXEL_FORMAT]) for newly created bitmaps. +Sets the pixel format ([A5O_PIXEL_FORMAT]) for newly created bitmaps. The default format is 0 and means the display driver will choose the best format. -See also: [ALLEGRO_PIXEL_FORMAT], [al_get_new_bitmap_format], +See also: [A5O_PIXEL_FORMAT], [al_get_new_bitmap_format], [al_get_bitmap_format] ### API: al_set_new_bitmap_depth @@ -771,20 +771,20 @@ the OpenGL backend. Sets the texture wrapping settings for newly created bitmaps (on the current thread). Typically you take advantage of this feature either via the primitives addon (see [al_draw_prim] and others) or via custom shaders (see -[ALLEGRO_SHADER]). +[A5O_SHADER]). > *Note:* In the context of custom shaders, Direct3D and OpenGL have different granularities for controlling this setting. Direct3D sets wrapping setting for each sampler separately, while OpenGL sets it per-texture. This interacts particularly poorly with the primitives addon which (for backwards compatibility) alters the wrapping setting. To minimize this issue, use a -wrapping setting that's not ALLEGRO_BITMAP_WRAP_DEFAULT. +wrapping setting that's not A5O_BITMAP_WRAP_DEFAULT. Since: 5.2.8 > *[Unstable API]:* This is an experimental feature. -See also: [ALLEGRO_BITMAP_WRAP] +See also: [A5O_BITMAP_WRAP] ### API: al_get_new_bitmap_wrap @@ -795,22 +795,22 @@ Since: 5.2.8 > *[Unstable API]:* This is an experimental feature. -See also: [ALLEGRO_BITMAP_WRAP] +See also: [A5O_BITMAP_WRAP] -### API: ALLEGRO_BITMAP_WRAP +### API: A5O_BITMAP_WRAP Controls the how the pixel color is determined from a texture querying the texture coordinates are outside the usual bounds. -* ALLEGRO_BITMAP_WRAP_DEFAULT - The default behavior. This corresponds to - ALLEGRO_BITMAP_WRAP_REPEAT when using the primitives addon and - ALLEGRO_BITMAP_WRAP_CLAMP otherwise. +* A5O_BITMAP_WRAP_DEFAULT - The default behavior. This corresponds to + A5O_BITMAP_WRAP_REPEAT when using the primitives addon and + A5O_BITMAP_WRAP_CLAMP otherwise. -* ALLEGRO_BITMAP_WRAP_REPEAT - The texture coordinates get shifted to the +* A5O_BITMAP_WRAP_REPEAT - The texture coordinates get shifted to the opposite edge that they go past. -* ALLEGRO_BITMAP_WRAP_CLAMP - The texture coordinates get clamped to the edges +* A5O_BITMAP_WRAP_CLAMP - The texture coordinates get clamped to the edges that they go past. -* ALLEGRO_BITMAP_WRAP_MIRROR - The texture coordinates get mirrored across the +* A5O_BITMAP_WRAP_MIRROR - The texture coordinates get mirrored across the edges that they go past. ## Bitmap properties @@ -825,7 +825,7 @@ See also: [al_set_new_bitmap_flags] Returns the pixel format of a bitmap. -See also: [ALLEGRO_PIXEL_FORMAT], [al_set_new_bitmap_flags] +See also: [A5O_PIXEL_FORMAT], [al_set_new_bitmap_flags] ### API: al_get_bitmap_height @@ -861,7 +861,7 @@ Get a pixel's color value from the specified bitmap. This operation is slow on non-memory bitmaps. Consider locking the bitmap if you are going to use this function multiple times on the same bitmap. -See also: [ALLEGRO_COLOR], [al_put_pixel], [al_lock_bitmap] +See also: [A5O_COLOR], [al_put_pixel], [al_lock_bitmap] ### API: al_is_bitmap_locked @@ -872,8 +872,8 @@ See also: [al_lock_bitmap], [al_lock_bitmap_region], [al_unlock_bitmap] ### API: al_is_compatible_bitmap D3D and OpenGL allow sharing a texture in a way so it can be used for -multiple windows. Each [ALLEGRO_BITMAP] created with [al_create_bitmap] -however is usually tied to a single ALLEGRO_DISPLAY. This function can +multiple windows. Each [A5O_BITMAP] created with [al_create_bitmap] +however is usually tied to a single A5O_DISPLAY. This function can be used to know if the bitmap is compatible with the given display, even if it is a different display to the one it was created with. It returns true if the bitmap is compatible (things like a cached texture @@ -901,9 +901,9 @@ and never a sub-bitmap. This might NOT match what was passed to [al_create_sub_bitmap]. Consider this code, for instance: ~~~~c -ALLEGRO_BITMAP* a = al_create_bitmap(512, 512); -ALLEGRO_BITMAP* b = al_create_sub_bitmap(a, 128, 128, 256, 256); -ALLEGRO_BITMAP* c = al_create_sub_bitmap(b, 64, 64, 128, 128); +A5O_BITMAP* a = al_create_bitmap(512, 512); +A5O_BITMAP* b = al_create_sub_bitmap(a, 128, 128, 256, 256); +A5O_BITMAP* c = al_create_sub_bitmap(b, 64, 64, 128, 128); ASSERT(al_get_parent_bitmap(b) == a && al_get_parent_bitmap(c) == a); ~~~~ @@ -1010,7 +1010,7 @@ See also: [al_set_bitmap_blender], [al_reset_bitmap_blender] ### API: al_set_bitmap_blend_color -Sets the color to use for `ALLEGRO_CONST_COLOR` or `ALLEGRO_INVERSE_CONST_COLOR` +Sets the color to use for `A5O_CONST_COLOR` or `A5O_INVERSE_CONST_COLOR` blend operations. Since: 5.2.5 @@ -1041,7 +1041,7 @@ the last display created in a thread. Clear the complete target bitmap, but confined by the clipping rectangle. -See also: [ALLEGRO_COLOR], [al_set_clipping_rectangle], [al_clear_depth_buffer] +See also: [A5O_COLOR], [al_set_clipping_rectangle], [al_clear_depth_buffer] ### API: al_clear_depth_buffer @@ -1051,7 +1051,7 @@ value. A depth buffer is only available if it was requested with [al_create_display] call creating the current display. Operations involving the depth buffer are also affected by [al_set_render_state]. -For example, if `ALLEGRO_DEPTH_FUNCTION` is set to `ALLEGRO_RENDER_LESS` then +For example, if `A5O_DEPTH_FUNCTION` is set to `A5O_RENDER_LESS` then depth buffer value of 1 represents infinite distance, and thus is a good value to use when clearing the depth buffer. @@ -1067,8 +1067,8 @@ to the current target bitmap (see [al_set_target_bitmap]). `flags` can be a combination of: -* ALLEGRO_FLIP_HORIZONTAL - flip the bitmap about the y-axis -* ALLEGRO_FLIP_VERTICAL - flip the bitmap about the x-axis +* A5O_FLIP_HORIZONTAL - flip the bitmap about the y-axis +* A5O_FLIP_VERTICAL - flip the bitmap about the x-axis > *Note:* The current target bitmap must be a different bitmap. Drawing a bitmap to itself (or to a sub-bitmap of itself) or @@ -1143,7 +1143,7 @@ Draws a single pixel at x, y. This function, unlike [al_put_pixel], does blending and, unlike [al_put_blended_pixel], respects the transformations (that is, the pixel's position is transformed, but its size is unaffected - it remains a pixel). This function can be slow if called often; if you need to -draw a lot of pixels consider using [al_draw_prim] with ALLEGRO_PRIM_POINT_LIST +draw a lot of pixels consider using [al_draw_prim] with A5O_PRIM_POINT_LIST from the primitives addon. * x - destination x @@ -1155,7 +1155,7 @@ from the primitives addon. primitives addon documentation for details on how to control exactly where the pixel is drawn. -See also: [ALLEGRO_COLOR], [al_put_pixel] +See also: [A5O_COLOR], [al_put_pixel] ### API: al_draw_rotated_bitmap @@ -1177,7 +1177,7 @@ Example ~~~~c float w = al_get_bitmap_width(bitmap); float h = al_get_bitmap_height(bitmap); -al_draw_rotated_bitmap(bitmap, w / 2, h / 2, x, y, ALLEGRO_PI / 2, 0); +al_draw_rotated_bitmap(bitmap, w / 2, h / 2, x, y, A5O_PI / 2, 0); ~~~~ The above code draws the bitmap centered on x/y and rotates it 90ยฐ clockwise. @@ -1297,14 +1297,14 @@ bitmaps. Consider locking the bitmap if you are going to use this function multiple times on the same bitmap. This function is not affected by the transformations or the color blenders. -See also: [ALLEGRO_COLOR], [al_get_pixel], [al_put_blended_pixel], [al_lock_bitmap] +See also: [A5O_COLOR], [al_get_pixel], [al_put_blended_pixel], [al_lock_bitmap] ### API: al_put_blended_pixel Like [al_put_pixel], but the pixel color is blended using the current blenders before being drawn. -See also: [ALLEGRO_COLOR], [al_put_pixel] +See also: [A5O_COLOR], [al_put_pixel] ## Target bitmap @@ -1337,7 +1337,7 @@ On some platforms, Allegro automatically backs up the contents of video bitmaps because they may be occasionally lost (see discussion in [al_create_bitmap]'s documentation). If you're completely recreating the bitmap contents often (e.g. every frame) then you will get much better performance by creating the target -bitmap with ALLEGRO_NO_PRESERVE_TEXTURE flag. +bitmap with A5O_NO_PRESERVE_TEXTURE flag. OpenGL note: @@ -1437,21 +1437,21 @@ And this color is drawn to a destination, which already has a color: The conceptional formula used by Allegro to draw any pixel then depends on the `op` parameter: -* ALLEGRO_ADD +* A5O_ADD r = d.r * df.r + s.r * sf.r g = d.g * df.g + s.g * sf.g b = d.b * df.b + s.b * sf.b a = d.a * df.a + s.a * sf.a -* ALLEGRO_DEST_MINUS_SRC +* A5O_DEST_MINUS_SRC r = d.r * df.r - s.r * sf.r g = d.g * df.g - s.g * sf.g b = d.b * df.b - s.b * sf.b a = d.a * df.a - s.a * sf.a -* ALLEGRO_SRC_MINUS_DEST +* A5O_SRC_MINUS_DEST r = s.r * sf.r - d.r * df.r g = s.g * sf.g - d.g * df.g @@ -1462,43 +1462,43 @@ Valid values for the factors `sf` and `df` passed to this function are as follows, where `s` is the source color, `d` the destination color and `cc` the color set with [al_set_blend_color] (white by default) -* ALLEGRO_ZERO +* A5O_ZERO f = 0, 0, 0, 0 -* ALLEGRO_ONE +* A5O_ONE f = 1, 1, 1, 1 -* ALLEGRO_ALPHA +* A5O_ALPHA f = s.a, s.a, s.a, s.a -* ALLEGRO_INVERSE_ALPHA +* A5O_INVERSE_ALPHA f = 1 - s.a, 1 - s.a, 1 - s.a, 1 - s.a -* ALLEGRO_SRC_COLOR (since: 5.0.10, 5.1.0) +* A5O_SRC_COLOR (since: 5.0.10, 5.1.0) f = s.r, s.g, s.b, s.a -* ALLEGRO_DEST_COLOR (since: 5.0.10, 5.1.8) +* A5O_DEST_COLOR (since: 5.0.10, 5.1.8) f = d.r, d.g, d.b, d.a -* ALLEGRO_INVERSE_SRC_COLOR (since: 5.0.10, 5.1.0) +* A5O_INVERSE_SRC_COLOR (since: 5.0.10, 5.1.0) f = 1 - s.r, 1 - s.g, 1 - s.b, 1 - s.a -* ALLEGRO_INVERSE_DEST_COLOR (since: 5.0.10, 5.1.8) +* A5O_INVERSE_DEST_COLOR (since: 5.0.10, 5.1.8) f = 1 - d.r, 1 - d.g, 1 - d.b, 1 - d.a -* ALLEGRO_CONST_COLOR (since: 5.1.12, not supported on OpenGLES 1.0) +* A5O_CONST_COLOR (since: 5.1.12, not supported on OpenGLES 1.0) f = cc.r, cc.g, cc.b, cc.a -* ALLEGRO_INVERSE_CONST_COLOR (since: 5.1.12, not supported on OpenGLES 1.0) +* A5O_INVERSE_CONST_COLOR (since: 5.1.12, not supported on OpenGLES 1.0) f = 1 - cc.r, 1 - cc.g, 1 - cc.b, 1 - cc.a @@ -1508,7 +1508,7 @@ So for example, to restore the default of using premultiplied alpha blending, you would use: ~~~~c -al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); +al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); ~~~~ As formula: @@ -1521,38 +1521,38 @@ As formula: If you are using non-pre-multiplied alpha, you could use ~~~~c -al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA); +al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA); ~~~~ Additive blending would be achieved with ~~~~c -al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); +al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE); ~~~~ Copying the source to the destination (including alpha) unmodified ~~~~c -al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); +al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); ~~~~ Multiplying source and destination components ~~~~c -al_set_blender(ALLEGRO_ADD, ALLEGRO_DEST_COLOR, ALLEGRO_ZERO) +al_set_blender(A5O_ADD, A5O_DEST_COLOR, A5O_ZERO) ~~~~ Tinting the source (like [al_draw_tinted_bitmap]) ~~~~c -al_set_blender(ALLEGRO_ADD, ALLEGRO_CONST_COLOR, ALLEGRO_ONE); +al_set_blender(A5O_ADD, A5O_CONST_COLOR, A5O_ONE); al_set_blend_color(al_map_rgb(0, 96, 255)); /* nice Chrysler blue */ ~~~~ Averaging source and destination pixels ~~~~c -al_set_blender(ALLEGRO_ADD, ALLEGRO_CONST_COLOR, ALLEGRO_CONST_COLOR); +al_set_blender(A5O_ADD, A5O_CONST_COLOR, A5O_CONST_COLOR); al_set_blend_color(al_map_rgba_f(0.5, 0.5, 0.5, 0.5)); ~~~~ @@ -1576,8 +1576,8 @@ See also: [al_set_blender], [al_get_blender], [al_get_separate_blender] ### API: al_set_blend_color -Sets the color to use for blending when using the ALLEGRO_CONST_COLOR -or ALLEGRO_INVERSE_CONST_COLOR blend functions. See [al_set_blender] for +Sets the color to use for blending when using the A5O_CONST_COLOR +or A5O_INVERSE_CONST_COLOR blend functions. See [al_set_blender] for more information. See also: [al_set_blender], [al_get_blend_color] @@ -1623,7 +1623,7 @@ Convert the given mask color to an alpha channel in the bitmap. Can be used to convert older 4.2-style bitmaps with magic pink to alpha-ready bitmaps. -See also: [ALLEGRO_COLOR] +See also: [A5O_COLOR] ## Deferred drawing @@ -1721,7 +1721,7 @@ See also: [al_register_bitmap_saver] ### API: al_load_bitmap -Loads an image file into a new [ALLEGRO_BITMAP]. +Loads an image file into a new [A5O_BITMAP]. The file type is determined by [al_identify_bitmap], using the extension as a fallback in case identification is not possible. @@ -1739,7 +1739,7 @@ See also: [al_load_bitmap_flags], [al_load_bitmap_f], ### API: al_load_bitmap_flags -Loads an image file into a new [ALLEGRO_BITMAP]. +Loads an image file into a new [A5O_BITMAP]. The file type is determined by [al_identify_bitmap], using the extension as a fallback in case identification is not possible. @@ -1747,7 +1747,7 @@ Returns NULL on error. The flags parameter may be a combination of the following constants: -ALLEGRO_NO_PREMULTIPLIED_ALPHA +A5O_NO_PREMULTIPLIED_ALPHA : By default, Allegro pre-multiplies the alpha channel of an image with the images color data when it loads it. Typically that would look something like this: @@ -1769,10 +1769,10 @@ ALLEGRO_NO_PREMULTIPLIED_ALPHA ex_premulalpha, ie, using pre-multiplied alpha gives more accurate color results in some cases. To use alpha blending with images loaded with pre-multiplied alpha, you would use the default blending mode, - which is set with al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, - ALLEGRO_INVERSE_ALPHA). + which is set with al_set_blender(A5O_ADD, A5O_ONE, + A5O_INVERSE_ALPHA). - The ALLEGRO_NO_PREMULTIPLIED_ALPHA flag being set will ensure that + The A5O_NO_PREMULTIPLIED_ALPHA flag being set will ensure that images are not loaded with alpha pre-multiplied, but are loaded with color values direct from the image. That looks like this: @@ -1786,7 +1786,7 @@ ALLEGRO_NO_PREMULTIPLIED_ALPHA ~~~~ To draw such an image using regular alpha blending, you would use - al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) + al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) to set the correct blender. This has some caveats. First, as mentioned above, drawing such an image can result in less accurate color blending (when drawing an image with linear filtering on, the edges will @@ -1795,7 +1795,7 @@ ALLEGRO_NO_PREMULTIPLIED_ALPHA ~~~~c // Load and create bitmaps with an alpha channel - al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA); + al_set_new_bitmap_format(A5O_PIXEL_FORMAT_ANY_32_WITH_ALPHA); // Load some bitmap with alpha in it bmp = al_load_bitmap("some_alpha_bitmap.png"); // We will draw to this buffer and then draw this buffer to the screen @@ -1813,7 +1813,7 @@ ALLEGRO_NO_PREMULTIPLIED_ALPHA ~~~~ To explain further, if you have a pixel with 0.5 alpha, and you're using - (ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) for blending, the + (A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) for blending, the formula is: a = da * dst + sa * src @@ -1826,12 +1826,12 @@ ALLEGRO_NO_PREMULTIPLIED_ALPHA in 0.75 alpha, then drawn again to the screen, blended in the same way, resulting in a pixel has 0.1875 as an alpha value. -ALLEGRO_KEEP_INDEX +A5O_KEEP_INDEX : Load the palette indices of 8-bit .bmp and .pcx files instead of the rgb colors. Since 5.1.0. -ALLEGRO_KEEP_BITMAP_FORMAT -: Force the resulting [ALLEGRO_BITMAP] to use the same format as the file. +A5O_KEEP_BITMAP_FORMAT +: Force the resulting [A5O_BITMAP] to use the same format as the file. *This is not yet honoured.* @@ -1845,7 +1845,7 @@ See also: [al_load_bitmap] ### API: al_load_bitmap_f -Loads an image from an [ALLEGRO_FILE] stream into a new [ALLEGRO_BITMAP]. +Loads an image from an [A5O_FILE] stream into a new [A5O_BITMAP]. The file type is determined by [al_identify_bitmap_f]. If identification is not possible, the passed 'ident' parameter, which is a file name extension including the leading dot, is used as a fallback, if it is not NULL. @@ -1865,7 +1865,7 @@ See also: [al_load_bitmap_flags_f], [al_load_bitmap], ### API: al_load_bitmap_flags_f -Loads an image from an [ALLEGRO_FILE] stream into a new [ALLEGRO_BITMAP]. +Loads an image from an [A5O_FILE] stream into a new [A5O_BITMAP]. The file type is determined by [al_identify_bitmap_f]. If identification is not possible, the passed 'ident' parameter, which is a file name extension including the leading dot, is used as a fallback, if it is not NULL. @@ -1885,7 +1885,7 @@ See also: [al_load_bitmap_f], [al_load_bitmap_flags] ### API: al_save_bitmap -Saves an [ALLEGRO_BITMAP] to an image file. +Saves an [A5O_BITMAP] to an image file. The file type is determined by the extension. Returns true on success, false on error. @@ -1898,7 +1898,7 @@ See also: [al_save_bitmap_f], [al_register_bitmap_saver], [al_init_image_addon] ### API: al_save_bitmap_f -Saves an [ALLEGRO_BITMAP] to an [ALLEGRO_FILE] stream. +Saves an [A5O_BITMAP] to an [A5O_FILE] stream. The file type is determined by the passed 'ident' parameter, which is a file name extension including the leading dot. @@ -1915,7 +1915,7 @@ See also: [al_save_bitmap], [al_register_bitmap_saver_f], [al_init_image_addon] Register an identify handler for [al_identify_bitmap]. The given function will be used to detect files for the given extension. It will -be called with a single argument of type [ALLEGRO_FILE] which is a +be called with a single argument of type [A5O_FILE] which is a file handle opened for reading and located at the first byte of the file. The handler should try to read as few bytes as possible to safely determine if the given file contents correspond to the type @@ -1949,7 +1949,7 @@ See also: [al_init_image_addon], [al_identify_bitmap_f], ### API: al_identify_bitmap_f -Tries to guess the bitmap file type of the open ALLEGRO_FILE by +Tries to guess the bitmap file type of the open A5O_FILE by reading the first few bytes. By default Allegro cannot recognize any file types, but calling [al_init_image_addon] will add detection of (some of) the types it can read. You can also use @@ -1967,74 +1967,74 @@ See also: [al_init_image_addon], [al_identify_bitmap], ## Render State -### API: ALLEGRO_RENDER_STATE +### API: A5O_RENDER_STATE Possible render states which can be set with [al_set_render_state]: -ALLEGRO_ALPHA_TEST -: If this is set to 1, the values of ALLEGRO_ALPHA_FUNCTION and - ALLEGRO_ALPHA_TEST_VALUE define a comparison function which is performed +A5O_ALPHA_TEST +: If this is set to 1, the values of A5O_ALPHA_FUNCTION and + A5O_ALPHA_TEST_VALUE define a comparison function which is performed on the alpha component of each pixel. Only if it evaluates to true the pixel is written. Otherwise no subsequent processing (like depth test or blending) is performed. This can be very useful, for example if a depth buffer is used but you do not want fully transparent pixels to modify it. -ALLEGRO_ALPHA_FUNCTION -: One of [ALLEGRO_RENDER_FUNCTION], only used when ALLEGRO_ALPHA_TEST is 1. +A5O_ALPHA_FUNCTION +: One of [A5O_RENDER_FUNCTION], only used when A5O_ALPHA_TEST is 1. -ALLEGRO_ALPHA_TEST_VALUE -: Only used when ALLEGRO_ALPHA_TEST is 1. Should be a value of 0 - 255. +A5O_ALPHA_TEST_VALUE +: Only used when A5O_ALPHA_TEST is 1. Should be a value of 0 - 255. -ALLEGRO_WRITE_MASK +A5O_WRITE_MASK : This determines how the framebuffer and depthbuffer are updated whenever a pixel is written (in case alpha and/or depth testing is enabled: after all such enabled tests succeed). Depth values are only written if - ALLEGRO_DEPTH_TEST is 1, in addition to the write mask flag being set. + A5O_DEPTH_TEST is 1, in addition to the write mask flag being set. -ALLEGRO_DEPTH_TEST +A5O_DEPTH_TEST : If this is set to 1, compare the depth value of any newly written pixels with - the depth value already in the buffer, according to ALLEGRO_DEPTH_FUNCTION. + the depth value already in the buffer, according to A5O_DEPTH_FUNCTION. Allegro primitives with no explicit z coordinate will write a value of 0 into the depth buffer. -ALLEGRO_DEPTH_FUNCTION -: One of [ALLEGRO_RENDER_FUNCTION], only used when ALLEGRO_DEPTH_TEST is 1. +A5O_DEPTH_FUNCTION +: One of [A5O_RENDER_FUNCTION], only used when A5O_DEPTH_TEST is 1. Since: 5.1.2 -See also: [al_set_render_state], [ALLEGRO_RENDER_FUNCTION], -[ALLEGRO_WRITE_MASK_FLAGS] +See also: [al_set_render_state], [A5O_RENDER_FUNCTION], +[A5O_WRITE_MASK_FLAGS] -### API: ALLEGRO_RENDER_FUNCTION +### API: A5O_RENDER_FUNCTION Possible functions are: -- ALLEGRO_RENDER_NEVER -- ALLEGRO_RENDER_ALWAYS -- ALLEGRO_RENDER_LESS -- ALLEGRO_RENDER_EQUAL -- ALLEGRO_RENDER_LESS_EQUAL -- ALLEGRO_RENDER_GREATER -- ALLEGRO_RENDER_NOT_EQUAL -- ALLEGRO_RENDER_GREATER_EQUAL +- A5O_RENDER_NEVER +- A5O_RENDER_ALWAYS +- A5O_RENDER_LESS +- A5O_RENDER_EQUAL +- A5O_RENDER_LESS_EQUAL +- A5O_RENDER_GREATER +- A5O_RENDER_NOT_EQUAL +- A5O_RENDER_GREATER_EQUAL Since: 5.1.2 See also: [al_set_render_state] -### API: ALLEGRO_WRITE_MASK_FLAGS +### API: A5O_WRITE_MASK_FLAGS Each enabled bit means the corresponding value is written, a disabled bit means it is not. -- ALLEGRO_MASK_RED -- ALLEGRO_MASK_GREEN -- ALLEGRO_MASK_BLUE -- ALLEGRO_MASK_ALPHA -- ALLEGRO_MASK_DEPTH -- ALLEGRO_MASK_RGB - Same as RED | GREEN | BLUE. -- ALLEGRO_MASK_RGBA - Same as RGB | ALPHA. +- A5O_MASK_RED +- A5O_MASK_GREEN +- A5O_MASK_BLUE +- A5O_MASK_ALPHA +- A5O_MASK_DEPTH +- A5O_MASK_RGB - Same as RED | GREEN | BLUE. +- A5O_MASK_RGBA - Same as RGB | ALPHA. Since: 5.1.2 @@ -2042,22 +2042,22 @@ See also: [al_set_render_state] ### API: al_set_render_state -Set one of several render attributes; see [ALLEGRO_RENDER_STATE] +Set one of several render attributes; see [A5O_RENDER_STATE] for details. This function does nothing if the target bitmap is a memory bitmap. Since: 5.1.2 -See also: [ALLEGRO_RENDER_STATE], [ALLEGRO_RENDER_FUNCTION], -[ALLEGRO_WRITE_MASK_FLAGS] +See also: [A5O_RENDER_STATE], [A5O_RENDER_FUNCTION], +[A5O_WRITE_MASK_FLAGS] ### API: al_backup_dirty_bitmap On some platforms, notably Windows Direct3D and Android, textures may be lost at any time for events such as display resize or switching out of the -app. On those platforms, bitmaps created without the ALLEGRO_NO_PRESERVE_TEXTURE +app. On those platforms, bitmaps created without the A5O_NO_PRESERVE_TEXTURE flag automatically get backed up to system memory every time al_flip_display is called. diff --git a/docs/src/refman/haptic.txt b/docs/src/refman/haptic.txt index f96f4e103e..e625d1f6e0 100644 --- a/docs/src/refman/haptic.txt +++ b/docs/src/refman/haptic.txt @@ -12,7 +12,7 @@ DirectInput compatible devices. There is also minimal support for Android. It is not yet supported on OSX, iOS, or on Windows for XInput compatible devices. -## API: ALLEGRO_HAPTIC +## API: A5O_HAPTIC This is an abstract data type representing a haptic device that supports force feedback or vibration. @@ -24,42 +24,42 @@ exposed features across all of the platforms. Awaiting feedback from users. See also: [al_get_haptic_from_joystick] -## API: ALLEGRO_HAPTIC_CONSTANTS +## API: A5O_HAPTIC_CONSTANTS This enum contains flags that are used to define haptic effects and capabilities. If the flag is set in the return value of [al_get_haptic_capabilities], it means the device supports the given effect. -The value of these flags should be set into a [ALLEGRO_HAPTIC_EFFECT] struct +The value of these flags should be set into a [A5O_HAPTIC_EFFECT] struct to determine what kind of haptic effect should be played. -* ALLEGRO_HAPTIC_RUMBLE - simple vibration effects -* ALLEGRO_HAPTIC_PERIODIC - periodic, wave-form effects -* ALLEGRO_HAPTIC_CONSTANT - constant effects -* ALLEGRO_HAPTIC_SPRING - spring effects -* ALLEGRO_HAPTIC_FRICTION - friction effects -* ALLEGRO_HAPTIC_DAMPER - damper effects -* ALLEGRO_HAPTIC_INERTIA - inertia effects -* ALLEGRO_HAPTIC_RAMP - ramp effects -* ALLEGRO_HAPTIC_SQUARE - square wave periodic effect -* ALLEGRO_HAPTIC_TRIANGLE - triangle wave periodic effect -* ALLEGRO_HAPTIC_SINE - sine wave periodic effect -* ALLEGRO_HAPTIC_SAW_UP - upwards saw wave periodic effect -* ALLEGRO_HAPTIC_SAW_DOWN - downwards saw wave periodic effect -* ALLEGRO_HAPTIC_CUSTOM - custom wave periodic effect -* ALLEGRO_HAPTIC_GAIN - the haptic device supports gain setting -* ALLEGRO_HAPTIC_ANGLE - the haptic device supports angle coordinates -* ALLEGRO_HAPTIC_RADIUS - the haptic device supports radius coordinates -* ALLEGRO_HAPTIC_AZIMUTH - the haptic device supports azimuth coordinates -* ALLEGRO_HAPTIC_AUTOCENTER +* A5O_HAPTIC_RUMBLE - simple vibration effects +* A5O_HAPTIC_PERIODIC - periodic, wave-form effects +* A5O_HAPTIC_CONSTANT - constant effects +* A5O_HAPTIC_SPRING - spring effects +* A5O_HAPTIC_FRICTION - friction effects +* A5O_HAPTIC_DAMPER - damper effects +* A5O_HAPTIC_INERTIA - inertia effects +* A5O_HAPTIC_RAMP - ramp effects +* A5O_HAPTIC_SQUARE - square wave periodic effect +* A5O_HAPTIC_TRIANGLE - triangle wave periodic effect +* A5O_HAPTIC_SINE - sine wave periodic effect +* A5O_HAPTIC_SAW_UP - upwards saw wave periodic effect +* A5O_HAPTIC_SAW_DOWN - downwards saw wave periodic effect +* A5O_HAPTIC_CUSTOM - custom wave periodic effect +* A5O_HAPTIC_GAIN - the haptic device supports gain setting +* A5O_HAPTIC_ANGLE - the haptic device supports angle coordinates +* A5O_HAPTIC_RADIUS - the haptic device supports radius coordinates +* A5O_HAPTIC_AZIMUTH - the haptic device supports azimuth coordinates +* A5O_HAPTIC_AUTOCENTER Since: 5.1.8 > *[Unstable API]:* Perhaps could be simplified due to limited support for all the exposed features across all of the platforms. Awaiting feedback from users. -See also: [al_get_haptic_capabilities], [ALLEGRO_HAPTIC_EFFECT] +See also: [al_get_haptic_capabilities], [A5O_HAPTIC_EFFECT] -## API: ALLEGRO_HAPTIC_EFFECT +## API: A5O_HAPTIC_EFFECT This struct models a particular haptic or vibration effect. It needs to be filled in correctly and uploaded to a haptic device before the device can @@ -68,34 +68,34 @@ play it back. *Fields:* type -: The type of the haptic effect. May be one of the ALLEGRO_HAPTIC_CONSTANTS - constants between or equal to ALLEGRO_HAPTIC_RUMBLE and - ALLEGRO_HAPTIC_RAMP. +: The type of the haptic effect. May be one of the A5O_HAPTIC_CONSTANTS + constants between or equal to A5O_HAPTIC_RUMBLE and + A5O_HAPTIC_RAMP. - * If `type` is set to ALLEGRO_HAPTIC_RUMBLE, then the effect is a simple + * If `type` is set to A5O_HAPTIC_RUMBLE, then the effect is a simple "rumble" or vibration effect that shakes the device. In some cases, such as on a mobile platform, the whole device may shake. - * If `type` is set to ALLEGRO_HAPTIC_PERIODIC, the effect is a shake or + * If `type` is set to A5O_HAPTIC_PERIODIC, the effect is a shake or vibration of which the intensity is a periodic wave form. - * If `type` is set to ALLEGRO_HAPTIC_CONSTANT, the effect is a constant + * If `type` is set to A5O_HAPTIC_CONSTANT, the effect is a constant pressure, motion or push-back in a certain direction of the axes of the device. - * If `type` is set to ALLEGRO_HAPTIC_SPRING, the effect is a springy kind + * If `type` is set to A5O_HAPTIC_SPRING, the effect is a springy kind of resistance against motion of the axes of the haptic device. - * If `type` is set to ALLEGRO_HAPTIC_FRICTION, the effect is a friction + * If `type` is set to A5O_HAPTIC_FRICTION, the effect is a friction kind of resistance against motion of the axes of the haptic device. - * If `type` is set to ALLEGRO_HAPTIC_DAMPER, the effect is a damper kind + * If `type` is set to A5O_HAPTIC_DAMPER, the effect is a damper kind of resistance against motion of the axes of the haptic device. - * If `type` is set to ALLEGRO_HAPTIC_INERTIA, the effect causes inertia + * If `type` is set to A5O_HAPTIC_INERTIA, the effect causes inertia or slowness of motions on the axes of the haptic device. - * If `type` is set to ALLEGRO_HAPTIC_RAMP, the effect causes a pressure + * If `type` is set to A5O_HAPTIC_RAMP, the effect causes a pressure or push-back that ramps up or down depending on the position of the axis. @@ -113,7 +113,7 @@ direction to the left of the user, an angle of ฯ€ means the direction away from the user, and an angle of 3ฯ€/2 means to the right of the user. - If [al_get_haptic_capabilities] has the flag ALLEGRO_HAPTIC_ANGLE set, + If [al_get_haptic_capabilities] has the flag A5O_HAPTIC_ANGLE set, then setting `direction.angle` is supported. Otherwise, it is unsupported, and you should set it to 0. @@ -124,7 +124,7 @@ direction that the effect should play back away from the center as far as is possible. - If [al_get_haptic_capabilities] has the flag ALLEGRO_HAPTIC_RADIUS set, + If [al_get_haptic_capabilities] has the flag A5O_HAPTIC_RADIUS set, then setting `direction.radius` is supported. Otherwise, it is unsupported, and you should set it to 0. @@ -135,7 +135,7 @@ direction the effect plays back vertically above the user plane, and an azimuth -ฯ€/2 means the effect plays back vertically below the user plane. - If [al_get_haptic_capabilities] has the flag ALLEGRO_HAPTIC_AZIMUTH set, + If [al_get_haptic_capabilities] has the flag A5O_HAPTIC_AZIMUTH set, then setting `direction.azimuth` is supported. Otherwise, it is unsupported, and you should set it to 0. @@ -148,7 +148,7 @@ replay data : Determines in detail the parameters of the haptic effect to play back. - If `type` is set to ALLEGRO_HAPTIC_RUMBLE, then + If `type` is set to A5O_HAPTIC_RUMBLE, then `data.rumble.strong_magnitude` must be set to a relative magnitude between 0.0 and 1.0 to determine how intensely the "large" rumble motor of the haptic device will vibrate, and `data.rumble.weak_magnitude` must @@ -157,10 +157,10 @@ data Not all devices have a "weak" motor, in which case the value set in `data.rumble.weak_magnitude` will be ignored. - If `type` is set to ALLEGRO_HAPTIC_PERIODIC, then - data.periodic.waveform must be set to one of ALLEGRO_HAPTIC_SQUARE, - ALLEGRO_HAPTIC_TRIANGLE, ALLEGRO_HAPTIC_SINE, ALLEGRO_HAPTIC_SAW_UP, - ALLEGRO_HAPTIC_SAW_DOWN, ALLEGRO_HAPTIC_CUSTOM. This will then determine + If `type` is set to A5O_HAPTIC_PERIODIC, then + data.periodic.waveform must be set to one of A5O_HAPTIC_SQUARE, + A5O_HAPTIC_TRIANGLE, A5O_HAPTIC_SINE, A5O_HAPTIC_SAW_UP, + A5O_HAPTIC_SAW_DOWN, A5O_HAPTIC_CUSTOM. This will then determine the wave form of the vibration effect that will be played on the haptic device. @@ -173,21 +173,21 @@ data `data.periodic.phase` is the phase of the wave form of vibration in seconds. - If `data.periodic.waveform` is set to ALLEGRO_HAPTIC_CUSTOM, then + If `data.periodic.waveform` is set to A5O_HAPTIC_CUSTOM, then `data.periodic.custom_data` must point to an array of `data.periodic.custom_len` doubles, each with values between -1.0 and 1.0. This value array will determine the shape of the wave form of the - haptic effect. ALLEGRO_HAPTIC_CUSTOM is not supported on some platforms, + haptic effect. A5O_HAPTIC_CUSTOM is not supported on some platforms, so use [al_get_haptic_capabilities] to check if it's available. If it isn't, you may want to play back a non-custom wave effect as a substitute instead. - If `type` is set to ALLEGRO_HAPTIC_CONSTANT, then `data.constant.level` + If `type` is set to A5O_HAPTIC_CONSTANT, then `data.constant.level` must be set to a relative intensity value between 0.0 and 1.0 to determine the intensity of the effect. - If `type` is set to any of ALLEGRO_HAPTIC_SPRING, - ALLEGRO_HAPTIC_FRICTION, ALLEGRO_HAPTIC_DAMPER, ALLEGRO_HAPTIC_INERTIA, - ALLEGRO_HAPTIC_RAMP, then the `data.condition` struct should be filled in. + If `type` is set to any of A5O_HAPTIC_SPRING, + A5O_HAPTIC_FRICTION, A5O_HAPTIC_DAMPER, A5O_HAPTIC_INERTIA, + A5O_HAPTIC_RAMP, then the `data.condition` struct should be filled in. To explain this better, it's best to keep in mind that these kinds of effects are most useful for steering-wheel kind of devices, where resistance or inertia should be applied when turning the device's wheel a @@ -219,15 +219,15 @@ data at full intensity when outside of the dead band. If set to 0.0 the effect will not be felt at all. - If `type` is set to ALLEGRO_HAPTIC_RAMP, then `data.ramp.start_level` + If `type` is set to A5O_HAPTIC_RAMP, then `data.ramp.start_level` should be set to a relative magnitude value between -1.0 and 1.0 to determine the initial intensity of the haptic effect. The field `data.ramp.end_level` should be set to a relative magnitude value between -1.0 and 1.0 to determine the final intensity of the haptic effect at the end of playback. - If `type` is set to any of ALLEGRO_HAPTIC_PERIODIC, - ALLEGRO_HAPTIC_CONSTANT, ALLEGRO_HAPTIC_RAMP, then `data.envelope` + If `type` is set to any of A5O_HAPTIC_PERIODIC, + A5O_HAPTIC_CONSTANT, A5O_HAPTIC_RAMP, then `data.envelope` determines the "envelope" of the effect. That is, it determines the duration and intensity for the ramp-up attack or "fade in" and the ramp-down or "fade out" of the effect. @@ -258,7 +258,7 @@ Since: 5.1.8 > *[Unstable API]:* Perhaps could be simplified due to limited support for all the exposed features across all of the platforms. Awaiting feedback from users. -## API: ALLEGRO_HAPTIC_EFFECT_ID +## API: A5O_HAPTIC_EFFECT_ID This struct is used as a handle to control playback of a haptic effect and should be considered opaque. Its implementation is visible merely to allow allocation @@ -440,7 +440,7 @@ exposed features across all of the platforms. Awaiting feedback from users. ## API: al_get_haptic_capabilities -Returns an integer with or'ed values from [ALLEGRO_HAPTIC_CONSTANTS], which, +Returns an integer with or'ed values from [A5O_HAPTIC_CONSTANTS], which, if set, indicate that the haptic device supports the given feature. Since: 5.1.8 @@ -452,7 +452,7 @@ exposed features across all of the platforms. Awaiting feedback from users. Returns true if the haptic device supports the feature indicated by the query parameter, false if the feature is not supported. -The query parameter must be one of the values of [ALLEGRO_HAPTIC_CONSTANTS]. +The query parameter must be one of the values of [A5O_HAPTIC_CONSTANTS]. Since: 5.1.9 @@ -467,7 +467,7 @@ Sets the gain of the haptic device if supported. Gain is much like volume for sound, it is as if every effect's intensity is multiplied by it. Gain is a value between 0.0 and 1.0. Returns true if set successfully, false if not. Only works if [al_get_haptic_capabilities] returns a value that has -[ALLEGRO_HAPTIC_GAIN][ALLEGRO_HAPTIC_CONSTANTS] set. If not, this +[A5O_HAPTIC_GAIN][A5O_HAPTIC_CONSTANTS] set. If not, this function returns false, and all effects will be played without any gain influence. @@ -481,7 +481,7 @@ exposed features across all of the platforms. Awaiting feedback from users. Returns the current gain of the device. Gain is much like volume for sound, it is as if every effect's intensity is multiplied by it. Gain is a value between 0.0 and 1.0. Only works correctly if [al_get_haptic_capabilities] -returns a value that has [ALLEGRO_HAPTIC_GAIN][ALLEGRO_HAPTIC_CONSTANTS] +returns a value that has [A5O_HAPTIC_GAIN][A5O_HAPTIC_CONSTANTS] set. If this is not set, this function will simply return 1.0 and all effects will be played without any gain influence. @@ -505,7 +505,7 @@ centering. If that is the case, a value of less than 0.5 will turn it off, while a value equal to or higher to 0.5 will turn it on. Returns true if set successfully, false if not. Can only work if [al_get_haptic_capabilities] returns a value that has -[ALLEGRO_HAPTIC_AUTOCENTER][ALLEGRO_HAPTIC_CONSTANTS] set. If not, this +[A5O_HAPTIC_AUTOCENTER][A5O_HAPTIC_CONSTANTS] set. If not, this function returns false. Since: 5.1.9 @@ -526,7 +526,7 @@ centering is enabled. Some platforms do not support partial automatic centering. If that is the case, a value of less than 0.5 means it is turned off, while a value equal to or higher to 0.5 means it is turned on. Can only work if [al_get_haptic_capabilities] returns a -value that has [ALLEGRO_HAPTIC_AUTOCENTER][ALLEGRO_HAPTIC_CONSTANTS] +value that has [A5O_HAPTIC_AUTOCENTER][A5O_HAPTIC_CONSTANTS] set. If not, this function returns 0.0. Since: 5.1.9 @@ -559,7 +559,7 @@ exposed features across all of the platforms. Awaiting feedback from users. Uploads the haptic effect to the device. The haptic effect must have been filled in completely and correctly. You must also pass in a pointer to a -user allocated [ALLEGRO_HAPTIC_EFFECT_ID]. This `id` can be used to control +user allocated [A5O_HAPTIC_EFFECT_ID]. This `id` can be used to control playback of the effect. Returns true if the effect was successfully uploaded, false if not. @@ -567,7 +567,7 @@ The function [al_get_max_haptic_effects] returns how many effects can be uploaded to the device at the same time. The same haptic effect can be uploaded several times, as long as care is -taken to pass in a different [ALLEGRO_HAPTIC_EFFECT_ID]. +taken to pass in a different [A5O_HAPTIC_EFFECT_ID]. Since: 5.1.8 @@ -577,7 +577,7 @@ exposed features across all of the platforms. Awaiting feedback from users. ## API: al_play_haptic_effect Plays back a previously uploaded haptic effect. The play_id must be a valid -[ALLEGRO_HAPTIC_EFFECT_ID] obtained from [al_upload_haptic_effect], +[A5O_HAPTIC_EFFECT_ID] obtained from [al_upload_haptic_effect], [al_upload_and_play_haptic_effect] or [al_rumble_haptic]. The haptic effect will be played back loop times in sequence. If loop is less @@ -614,7 +614,7 @@ See also: [al_upload_haptic_effect], [al_play_haptic_effect] ## API: al_stop_haptic_effect Stops playing a previously uploaded haptic effect. The play_id must be a -valid [ALLEGRO_HAPTIC_EFFECT_ID] obtained from [al_upload_haptic_effect], +valid [A5O_HAPTIC_EFFECT_ID] obtained from [al_upload_haptic_effect], [al_upload_and_play_haptic_effect] or [al_rumble_haptic]. Since: 5.1.8 @@ -626,7 +626,7 @@ exposed features across all of the platforms. Awaiting feedback from users. Returns true if the haptic effect is currently playing. Returns false if the effect has been stopped or if it has already finished playing, or if it has not been -played yet. The play_id must be a valid [ALLEGRO_HAPTIC_EFFECT_ID] obtained +played yet. The play_id must be a valid [A5O_HAPTIC_EFFECT_ID] obtained from [al_upload_haptic_effect], [al_upload_and_play_haptic_effect] or [al_rumble_haptic]. @@ -650,11 +650,11 @@ exposed features across all of the platforms. Awaiting feedback from users. Releases a previously uploaded haptic effect from the device it has been uploaded to, allowing for other effects to be uploaded. The play_id must be -a valid [ALLEGRO_HAPTIC_EFFECT_ID] obtained from [al_upload_haptic_effect], +a valid [A5O_HAPTIC_EFFECT_ID] obtained from [al_upload_haptic_effect], [al_upload_and_play_haptic_effect] or [al_rumble_haptic]. This function is called automatically when you call [al_release_haptic] -on a [ALLEGRO_HAPTIC] for all effects that are still uploaded to the device. +on a [A5O_HAPTIC] for all effects that are still uploaded to the device. Therefore this function is most useful if you want to upload and release haptic effects dynamically, for example as a way to circumvent the limit imposed by [al_get_max_haptic_effects]. @@ -676,7 +676,7 @@ and 1.0 that determines the intensity of the rumble effect. The `duration` determines the duration of the effect in seconds. You must also pass in a pointer to a user allocated -[ALLEGRO_HAPTIC_EFFECT_ID]. It it is stored a reference to be used to +[A5O_HAPTIC_EFFECT_ID]. It it is stored a reference to be used to control playback of the effect. Returns true if the rumble effect was successfully uploaded and started, false if not. diff --git a/docs/src/refman/images/audio.svg b/docs/src/refman/images/audio.svg index 9bc7d3cadb..fc968f41fd 100644 --- a/docs/src/refman/images/audio.svg +++ b/docs/src/refman/images/audio.svg @@ -424,7 +424,7 @@ y="468.36221" x="40" id="tspan5608" - sodipodi:role="line">ALLEGRO_AUDIO_STREAM + sodipodi:role="line">A5O_AUDIO_STREAM ALLEGRO_MIXER + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;text-align:center;text-anchor:middle">A5O_MIXER ALLEGRO_MIXER + sodipodi:role="line">A5O_MIXER ALLEGRO_VOICE + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial;text-align:center;text-anchor:middle">A5O_VOICE ALLEGRO_SAMPLE_INSTANCE + sodipodi:role="line">A5O_SAMPLE_INSTANCE ALLEGRO_SAMPLE + sodipodi:role="line">A5O_SAMPLE ALLEGRO_SAMPLE_INSTANCE + sodipodi:role="line">A5O_SAMPLE_INSTANCE ~~~~ -## API: ALLEGRO_KEYBOARD_STATE +## API: A5O_KEYBOARD_STATE This is a structure that is used to hold a "snapshot" of a keyboard's state at a particular instant. It contains the following publically @@ -21,127 +21,127 @@ You cannot read the state of keys directly. Use the function ## Key codes -The constant ALLEGRO_KEY_MAX is always one higher than +The constant A5O_KEY_MAX is always one higher than the highest key code. So if you want to use the key code as array index you can do something like this: ~~~~c -bool pressed_keys[ALLEGRO_KEY_MAX]; +bool pressed_keys[A5O_KEY_MAX]; //... pressed_keys[key_code] = true; ~~~~ These are the list of key codes used by Allegro, which are returned in -the event.keyboard.keycode field of the ALLEGRO_KEY_DOWN and -ALLEGRO_KEY_UP events and which you can pass to [al_key_down]: - - ALLEGRO_KEY_A ... ALLEGRO_KEY_Z - ALLEGRO_KEY_0 ... ALLEGRO_KEY_9 - ALLEGRO_KEY_PAD_0 ... ALLEGRO_KEY_PAD_9 - ALLEGRO_KEY_F1 ... ALLEGRO_KEY_F12 - ALLEGRO_KEY_ESCAPE - ALLEGRO_KEY_TILDE - ALLEGRO_KEY_MINUS - ALLEGRO_KEY_EQUALS - ALLEGRO_KEY_BACKSPACE - ALLEGRO_KEY_TAB - ALLEGRO_KEY_OPENBRACE - ALLEGRO_KEY_CLOSEBRACE - ALLEGRO_KEY_ENTER - ALLEGRO_KEY_SEMICOLON - ALLEGRO_KEY_QUOTE - ALLEGRO_KEY_BACKSLASH - ALLEGRO_KEY_BACKSLASH2 - ALLEGRO_KEY_COMMA - ALLEGRO_KEY_FULLSTOP - ALLEGRO_KEY_SLASH - ALLEGRO_KEY_SPACE - ALLEGRO_KEY_INSERT - ALLEGRO_KEY_DELETE - ALLEGRO_KEY_HOME - ALLEGRO_KEY_END - ALLEGRO_KEY_PGUP - ALLEGRO_KEY_PGDN - ALLEGRO_KEY_LEFT - ALLEGRO_KEY_RIGHT - ALLEGRO_KEY_UP - ALLEGRO_KEY_DOWN - ALLEGRO_KEY_PAD_SLASH - ALLEGRO_KEY_PAD_ASTERISK - ALLEGRO_KEY_PAD_MINUS - ALLEGRO_KEY_PAD_PLUS - ALLEGRO_KEY_PAD_DELETE - ALLEGRO_KEY_PAD_ENTER - ALLEGRO_KEY_PRINTSCREEN - ALLEGRO_KEY_PAUSE - ALLEGRO_KEY_ABNT_C1 - ALLEGRO_KEY_YEN - ALLEGRO_KEY_KANA - ALLEGRO_KEY_CONVERT - ALLEGRO_KEY_NOCONVERT - ALLEGRO_KEY_AT - ALLEGRO_KEY_CIRCUMFLEX - ALLEGRO_KEY_COLON2 - ALLEGRO_KEY_KANJI - ALLEGRO_KEY_LSHIFT - ALLEGRO_KEY_RSHIFT - ALLEGRO_KEY_LCTRL - ALLEGRO_KEY_RCTRL - ALLEGRO_KEY_ALT - ALLEGRO_KEY_ALTGR - ALLEGRO_KEY_LWIN - ALLEGRO_KEY_RWIN - ALLEGRO_KEY_MENU - ALLEGRO_KEY_SCROLLLOCK - ALLEGRO_KEY_NUMLOCK - ALLEGRO_KEY_CAPSLOCK - ALLEGRO_KEY_PAD_EQUALS - ALLEGRO_KEY_BACKQUOTE - ALLEGRO_KEY_SEMICOLON2 - ALLEGRO_KEY_COMMAND +the event.keyboard.keycode field of the A5O_KEY_DOWN and +A5O_KEY_UP events and which you can pass to [al_key_down]: + + A5O_KEY_A ... A5O_KEY_Z + A5O_KEY_0 ... A5O_KEY_9 + A5O_KEY_PAD_0 ... A5O_KEY_PAD_9 + A5O_KEY_F1 ... A5O_KEY_F12 + A5O_KEY_ESCAPE + A5O_KEY_TILDE + A5O_KEY_MINUS + A5O_KEY_EQUALS + A5O_KEY_BACKSPACE + A5O_KEY_TAB + A5O_KEY_OPENBRACE + A5O_KEY_CLOSEBRACE + A5O_KEY_ENTER + A5O_KEY_SEMICOLON + A5O_KEY_QUOTE + A5O_KEY_BACKSLASH + A5O_KEY_BACKSLASH2 + A5O_KEY_COMMA + A5O_KEY_FULLSTOP + A5O_KEY_SLASH + A5O_KEY_SPACE + A5O_KEY_INSERT + A5O_KEY_DELETE + A5O_KEY_HOME + A5O_KEY_END + A5O_KEY_PGUP + A5O_KEY_PGDN + A5O_KEY_LEFT + A5O_KEY_RIGHT + A5O_KEY_UP + A5O_KEY_DOWN + A5O_KEY_PAD_SLASH + A5O_KEY_PAD_ASTERISK + A5O_KEY_PAD_MINUS + A5O_KEY_PAD_PLUS + A5O_KEY_PAD_DELETE + A5O_KEY_PAD_ENTER + A5O_KEY_PRINTSCREEN + A5O_KEY_PAUSE + A5O_KEY_ABNT_C1 + A5O_KEY_YEN + A5O_KEY_KANA + A5O_KEY_CONVERT + A5O_KEY_NOCONVERT + A5O_KEY_AT + A5O_KEY_CIRCUMFLEX + A5O_KEY_COLON2 + A5O_KEY_KANJI + A5O_KEY_LSHIFT + A5O_KEY_RSHIFT + A5O_KEY_LCTRL + A5O_KEY_RCTRL + A5O_KEY_ALT + A5O_KEY_ALTGR + A5O_KEY_LWIN + A5O_KEY_RWIN + A5O_KEY_MENU + A5O_KEY_SCROLLLOCK + A5O_KEY_NUMLOCK + A5O_KEY_CAPSLOCK + A5O_KEY_PAD_EQUALS + A5O_KEY_BACKQUOTE + A5O_KEY_SEMICOLON2 + A5O_KEY_COMMAND /* Since: 5.1.1 */ /* Android only for now */ - ALLEGRO_KEY_BACK + A5O_KEY_BACK /* Since: 5.1.2 */ /* Android only for now */ - ALLEGRO_KEY_VOLUME_UP - ALLEGRO_KEY_VOLUME_DOWN + A5O_KEY_VOLUME_UP + A5O_KEY_VOLUME_DOWN /* Since: 5.1.6 */ /* Android only for now */ - ALLEGRO_KEY_SEARCH - ALLEGRO_KEY_DPAD_CENTER - ALLEGRO_KEY_BUTTON_X - ALLEGRO_KEY_BUTTON_Y - ALLEGRO_KEY_DPAD_UP - ALLEGRO_KEY_DPAD_DOWN - ALLEGRO_KEY_DPAD_LEFT - ALLEGRO_KEY_DPAD_RIGHT - ALLEGRO_KEY_SELECT - ALLEGRO_KEY_START - ALLEGRO_KEY_L1 - ALLEGRO_KEY_R1 + A5O_KEY_SEARCH + A5O_KEY_DPAD_CENTER + A5O_KEY_BUTTON_X + A5O_KEY_BUTTON_Y + A5O_KEY_DPAD_UP + A5O_KEY_DPAD_DOWN + A5O_KEY_DPAD_LEFT + A5O_KEY_DPAD_RIGHT + A5O_KEY_SELECT + A5O_KEY_START + A5O_KEY_L1 + A5O_KEY_R1 ## Keyboard modifier flags - ALLEGRO_KEYMOD_SHIFT - ALLEGRO_KEYMOD_CTRL - ALLEGRO_KEYMOD_ALT - ALLEGRO_KEYMOD_LWIN - ALLEGRO_KEYMOD_RWIN - ALLEGRO_KEYMOD_MENU - ALLEGRO_KEYMOD_ALTGR - ALLEGRO_KEYMOD_COMMAND - ALLEGRO_KEYMOD_SCROLLLOCK - ALLEGRO_KEYMOD_NUMLOCK - ALLEGRO_KEYMOD_CAPSLOCK - ALLEGRO_KEYMOD_INALTSEQ - ALLEGRO_KEYMOD_ACCENT1 - ALLEGRO_KEYMOD_ACCENT2 - ALLEGRO_KEYMOD_ACCENT3 - ALLEGRO_KEYMOD_ACCENT4 + A5O_KEYMOD_SHIFT + A5O_KEYMOD_CTRL + A5O_KEYMOD_ALT + A5O_KEYMOD_LWIN + A5O_KEYMOD_RWIN + A5O_KEYMOD_MENU + A5O_KEYMOD_ALTGR + A5O_KEYMOD_COMMAND + A5O_KEYMOD_SCROLLLOCK + A5O_KEYMOD_NUMLOCK + A5O_KEYMOD_CAPSLOCK + A5O_KEYMOD_INALTSEQ + A5O_KEYMOD_ACCENT1 + A5O_KEYMOD_ACCENT2 + A5O_KEYMOD_ACCENT3 + A5O_KEYMOD_ACCENT4 The event field 'keyboard.modifiers' is a bitfield composed of these constants. These indicate the modifier keys which were pressed at the time a character was @@ -173,11 +173,11 @@ See also: [al_install_keyboard] Save the state of the keyboard specified at the time the function is called into the structure pointed to by *ret_state*. -See also: [al_key_down], [al_clear_keyboard_state], [ALLEGRO_KEYBOARD_STATE] +See also: [al_key_down], [al_clear_keyboard_state], [A5O_KEYBOARD_STATE] ## API: al_clear_keyboard_state -Clear the state of the keyboard, emitting [ALLEGRO_EVENT_KEY_UP] for +Clear the state of the keyboard, emitting [A5O_EVENT_KEY_UP] for each currently pressed key. The given display is regarded as the one which had the keyboard focus when the event occurred. In case display is NULL no event is emitted. For most keyboard drivers Allegro @@ -185,9 +185,9 @@ maintains its own state of the keyboard, which might get out of sync with the real one. This function is intended to remedy such situation by resetting Allegro's keyboard state to a known default (no key pressed). This is particularly useful in response to -[ALLEGRO_EVENT_DISPLAY_SWITCH_OUT] events. +[A5O_EVENT_DISPLAY_SWITCH_OUT] events. -See also: [al_get_keyboard_state], [ALLEGRO_KEYBOARD_STATE] +See also: [al_get_keyboard_state], [A5O_KEYBOARD_STATE] Since: 5.2.3 @@ -199,7 +199,7 @@ being decided upon. Return true if the key specified was held down in the state specified. -See also: [ALLEGRO_KEYBOARD_STATE] +See also: [A5O_KEYBOARD_STATE] ## API: al_keycode_to_name @@ -217,8 +217,8 @@ See also: [al_set_keyboard_leds] Overrides the state of the keyboard LED indicators. Set `leds` to a combination of the keyboard modifier flags to enable the corresponding LED -indicators (`ALLEGRO_KEYMOD_NUMLOCK`, `ALLEGRO_KEYMOD_CAPSLOCK` and -`ALLEGRO_KEYMOD_SCROLLLOCK` are supported) or to -1 to return to default +indicators (`A5O_KEYMOD_NUMLOCK`, `A5O_KEYMOD_CAPSLOCK` and +`A5O_KEYMOD_SCROLLLOCK` are supported) or to -1 to return to default behavior. False is returned if the current keyboard driver cannot set LED indicators. @@ -226,7 +226,7 @@ See also: [al_can_set_keyboard_leds] ## API: al_get_keyboard_event_source -Retrieve the keyboard event source. All [keyboard events][ALLEGRO_EVENT_KEY_DOWN] +Retrieve the keyboard event source. All [keyboard events][A5O_EVENT_KEY_DOWN] are generated by this event source. Returns NULL if the keyboard subsystem was not installed. diff --git a/docs/src/refman/memory.txt b/docs/src/refman/memory.txt index bfc36bb07b..d3d34baf71 100644 --- a/docs/src/refman/memory.txt +++ b/docs/src/refman/memory.txt @@ -75,7 +75,7 @@ unless overridden with [al_set_memory_interface], Generally you should use the [al_calloc] macro. -## API: ALLEGRO_MEMORY_INTERFACE +## API: A5O_MEMORY_INTERFACE This structure has the following fields. @@ -99,5 +99,5 @@ new functions should be thread safe. If the pointer is NULL, the default behaviour will be restored. -See also: [ALLEGRO_MEMORY_INTERFACE] +See also: [A5O_MEMORY_INTERFACE] diff --git a/docs/src/refman/misc.txt b/docs/src/refman/misc.txt index 4bb6524fe6..744c883cba 100644 --- a/docs/src/refman/misc.txt +++ b/docs/src/refman/misc.txt @@ -6,7 +6,7 @@ These functions are declared in the main Allegro header file: #include ~~~~ -## API: ALLEGRO_PI +## API: A5O_PI C99 compilers have no predefined value like M_PI for the constant ฯ€, but you can use this one instead. diff --git a/docs/src/refman/monitor.txt b/docs/src/refman/monitor.txt index 5f911e892a..94204f0ed5 100644 --- a/docs/src/refman/monitor.txt +++ b/docs/src/refman/monitor.txt @@ -6,7 +6,7 @@ These functions are declared in the main Allegro header file: #include ~~~~ -## API: ALLEGRO_MONITOR_INFO +## API: A5O_MONITOR_INFO Describes a monitor's size and position relative to other monitors. x1, y1 will be 0, 0 on the primary display. @@ -17,13 +17,13 @@ x2-x1 gives the width and y2-y1 gives the height of the display. ~~~~c -typedef struct ALLEGRO_MONITOR_INFO +typedef struct A5O_MONITOR_INFO { int x1; int y1; int x2; int y2; -} ALLEGRO_MONITOR_INFO; +} A5O_MONITOR_INFO; ~~~~ See also: [al_get_monitor_info] @@ -33,7 +33,7 @@ See also: [al_get_monitor_info] Gets the video adapter index where new displays will be created by the calling thread, if previously set with [al_set_new_display_adapter]. -Otherwise returns `ALLEGRO_DEFAULT_DISPLAY_ADAPTER`. +Otherwise returns `A5O_DEFAULT_DISPLAY_ADAPTER`. See also: [al_set_new_display_adapter] @@ -44,7 +44,7 @@ The adapter has a monitor attached to it. Information about the monitor can be gotten using [al_get_num_video_adapters] and [al_get_monitor_info]. -To return to the default behaviour, pass `ALLEGRO_DEFAULT_DISPLAY_ADAPTER`. +To return to the default behaviour, pass `A5O_DEFAULT_DISPLAY_ADAPTER`. See also: [al_get_num_video_adapters], [al_get_monitor_info] @@ -58,7 +58,7 @@ OpenGL backends, which will often have different adapters available. Returns `true` on success, `false` on failure. -See also: [ALLEGRO_MONITOR_INFO], [al_get_num_video_adapters] +See also: [A5O_MONITOR_INFO], [al_get_num_video_adapters] ## API: al_get_monitor_dpi diff --git a/docs/src/refman/mouse.txt b/docs/src/refman/mouse.txt index 7f67223255..4cda101bff 100644 --- a/docs/src/refman/mouse.txt +++ b/docs/src/refman/mouse.txt @@ -6,7 +6,7 @@ These functions are declared in the main Allegro header file: #include ~~~~ -## API: ALLEGRO_MOUSE_STATE +## API: A5O_MOUSE_STATE Public fields (read only): @@ -64,7 +64,7 @@ is called into the given structure. Example: ~~~~c -ALLEGRO_MOUSE_STATE state; +A5O_MOUSE_STATE state; al_get_mouse_state(&state); if (state.buttons & 1) { @@ -79,7 +79,7 @@ if (state.buttons & 4) { } ~~~~ -See also: [ALLEGRO_MOUSE_STATE], [al_get_mouse_state_axis], +See also: [A5O_MOUSE_STATE], [al_get_mouse_state_axis], [al_mouse_button_down] ## API: al_get_mouse_state_axis @@ -88,20 +88,20 @@ Extract the mouse axis value from the saved state. The axes are numbered from 0, in this order: x-axis, y-axis, z-axis, w-axis. -See also: [ALLEGRO_MOUSE_STATE], [al_get_mouse_state], [al_mouse_button_down] +See also: [A5O_MOUSE_STATE], [al_get_mouse_state], [al_mouse_button_down] ## API: al_mouse_button_down Return true if the mouse button specified was held down in the state specified. Unlike most things, the first mouse button is numbered 1. -See also: [ALLEGRO_MOUSE_STATE], [al_get_mouse_state], [al_get_mouse_state_axis] +See also: [A5O_MOUSE_STATE], [al_get_mouse_state], [al_get_mouse_state_axis] ## API: al_set_mouse_xy Try to position the mouse at the given coordinates on the given display. The mouse movement resulting from a successful move will generate an -[ALLEGRO_EVENT_MOUSE_WARPED] event. +[A5O_EVENT_MOUSE_WARPED] event. Returns true on success, false on failure. @@ -136,7 +136,7 @@ See also: [al_set_mouse_xy], [al_set_mouse_z], [al_set_mouse_w] ## API: al_get_mouse_event_source -Retrieve the mouse event source. All [mouse events][ALLEGRO_EVENT_MOUSE_AXES] +Retrieve the mouse event source. All [mouse events][A5O_EVENT_MOUSE_AXES] are generated by this event source. Returns NULL if the mouse subsystem was not installed. @@ -146,7 +146,7 @@ Returns NULL if the mouse subsystem was not installed. Sets the precision of the mouse wheel (the z and w coordinates). This precision manifests itself as a multiplier on the `dz` and `dw` fields in mouse events. -It also affects the `z` and `w` fields of events and [ALLEGRO_MOUSE_STATE], but +It also affects the `z` and `w` fields of events and [A5O_MOUSE_STATE], but not in a simple way if you alter the precision often, so it is suggested to reset those axes to 0 when you change precision. Setting this to a high value allows you to detect small changes in those two axes for some high precision @@ -157,9 +157,9 @@ and `dw` like so: ~~~~c al_set_mouse_wheel_precision(120); -ALLEGRO_EVENT event; +A5O_EVENT event; al_wait_for_event(event_queue, &event); -if (event.type == ALLEGRO_EVENT_MOUSE_AXES) { +if (event.type == A5O_EVENT_MOUSE_AXES) { double dz = (double)event.mouse.dz / al_get_mouse_wheel_precision(); /* Use dz in some way... */ } @@ -224,25 +224,25 @@ silently be substituted. The cursors are: -* ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT -* ALLEGRO_SYSTEM_MOUSE_CURSOR_ARROW -* ALLEGRO_SYSTEM_MOUSE_CURSOR_BUSY -* ALLEGRO_SYSTEM_MOUSE_CURSOR_QUESTION -* ALLEGRO_SYSTEM_MOUSE_CURSOR_EDIT -* ALLEGRO_SYSTEM_MOUSE_CURSOR_MOVE -* ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_N -* ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_W -* ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_S -* ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_E -* ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NW -* ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_SW -* ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_SE -* ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NE -* ALLEGRO_SYSTEM_MOUSE_CURSOR_PROGRESS -* ALLEGRO_SYSTEM_MOUSE_CURSOR_PRECISION -* ALLEGRO_SYSTEM_MOUSE_CURSOR_LINK -* ALLEGRO_SYSTEM_MOUSE_CURSOR_ALT_SELECT -* ALLEGRO_SYSTEM_MOUSE_CURSOR_UNAVAILABLE +* A5O_SYSTEM_MOUSE_CURSOR_DEFAULT +* A5O_SYSTEM_MOUSE_CURSOR_ARROW +* A5O_SYSTEM_MOUSE_CURSOR_BUSY +* A5O_SYSTEM_MOUSE_CURSOR_QUESTION +* A5O_SYSTEM_MOUSE_CURSOR_EDIT +* A5O_SYSTEM_MOUSE_CURSOR_MOVE +* A5O_SYSTEM_MOUSE_CURSOR_RESIZE_N +* A5O_SYSTEM_MOUSE_CURSOR_RESIZE_W +* A5O_SYSTEM_MOUSE_CURSOR_RESIZE_S +* A5O_SYSTEM_MOUSE_CURSOR_RESIZE_E +* A5O_SYSTEM_MOUSE_CURSOR_RESIZE_NW +* A5O_SYSTEM_MOUSE_CURSOR_RESIZE_SW +* A5O_SYSTEM_MOUSE_CURSOR_RESIZE_SE +* A5O_SYSTEM_MOUSE_CURSOR_RESIZE_NE +* A5O_SYSTEM_MOUSE_CURSOR_PROGRESS +* A5O_SYSTEM_MOUSE_CURSOR_PRECISION +* A5O_SYSTEM_MOUSE_CURSOR_LINK +* A5O_SYSTEM_MOUSE_CURSOR_ALT_SELECT +* A5O_SYSTEM_MOUSE_CURSOR_UNAVAILABLE Returns true on success, false on failure. diff --git a/docs/src/refman/native_dialog.txt b/docs/src/refman/native_dialog.txt index 570c75ca60..5654fb8d2a 100644 --- a/docs/src/refman/native_dialog.txt +++ b/docs/src/refman/native_dialog.txt @@ -7,11 +7,11 @@ Link with allegro_dialog. #include ~~~~ -## API: ALLEGRO_FILECHOOSER +## API: A5O_FILECHOOSER Opaque handle to a native file dialog. -## API: ALLEGRO_TEXTLOG +## API: A5O_TEXTLOG Opaque handle to a text log window. @@ -84,26 +84,26 @@ Parameters: - `mode`: 0, or a combination of the following flags: -ALLEGRO_FILECHOOSER_FILE_MUST_EXIST +A5O_FILECHOOSER_FILE_MUST_EXIST : If supported by the native dialog, it will not allow entering new names, but just allow existing files to be selected. Else it is ignored. -ALLEGRO_FILECHOOSER_SAVE +A5O_FILECHOOSER_SAVE : If the native dialog system has a different dialog for saving (for example one which allows creating new directories), it is used. Else it is ignored. -ALLEGRO_FILECHOOSER_FOLDER +A5O_FILECHOOSER_FOLDER : If there is support for a separate dialog to select a folder instead of a file, it will be used. -ALLEGRO_FILECHOOSER_PICTURES +A5O_FILECHOOSER_PICTURES : If a different dialog is available for selecting pictures, it is used. Else it is ignored. -ALLEGRO_FILECHOOSER_SHOW_HIDDEN +A5O_FILECHOOSER_SHOW_HIDDEN : If the platform supports it, also hidden files will be shown. -ALLEGRO_FILECHOOSER_MULTIPLE +A5O_FILECHOOSER_MULTIPLE : If supported, allow selecting multiple files. Returns: @@ -127,8 +127,8 @@ call it from inside that thread. Returns true on success, false on failure. -> *Note:* On Android, [ALLEGRO_EVENT_DISPLAY_HALT_DRAWING] and -[ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING] need to be handled before this function +> *Note:* On Android, [A5O_EVENT_DISPLAY_HALT_DRAWING] and +[A5O_EVENT_DISPLAY_RESUME_DRAWING] need to be handled before this function returns. This means that you must call it from a different thread. ## API: al_get_native_file_dialog_count @@ -163,21 +163,21 @@ separated by a vertical bar (|). The flags available are: -ALLEGRO_MESSAGEBOX_WARN +A5O_MESSAGEBOX_WARN : The message is a warning. This may cause a different icon (or other effects). -ALLEGRO_MESSAGEBOX_ERROR +A5O_MESSAGEBOX_ERROR : The message is an error. -ALLEGRO_MESSAGEBOX_QUESTION +A5O_MESSAGEBOX_QUESTION : The message is a question. -ALLEGRO_MESSAGEBOX_OK_CANCEL +A5O_MESSAGEBOX_OK_CANCEL : Display a cancel button alongside the "OK" button. Ignored if `buttons` is not NULL. -ALLEGRO_MESSAGEBOX_YES_NO +A5O_MESSAGEBOX_YES_NO : Display Yes/No buttons instead of the "OK" button. Ignored if `buttons` is not NULL. @@ -210,7 +210,7 @@ int button = al_show_native_message_box( "generated by the action you took to open this " "message box.", NULL, - ALLEGRO_MESSAGEBOX_YES_NO + A5O_MESSAGEBOX_YES_NO ); ~~~~ @@ -224,12 +224,12 @@ Use [al_close_native_text_log] to close the window again. The flags available are: -ALLEGRO_TEXTLOG_NO_CLOSE +A5O_TEXTLOG_NO_CLOSE : Prevent the window from having a close button. Otherwise, if the close button is pressed, an event is generated; see [al_get_native_text_log_event_source]. -ALLEGRO_TEXTLOG_MONOSPACE +A5O_TEXTLOG_MONOSPACE : Use a monospace font to display the text. Returns NULL if there was an error opening the window, or if text log windows @@ -262,10 +262,10 @@ a terminal. Get an event source for a text log window. The possible events are: -ALLEGRO_EVENT_NATIVE_DIALOG_CLOSE +A5O_EVENT_NATIVE_DIALOG_CLOSE : The window was requested to be closed, either by pressing the close button or pressing Escape on the keyboard. - The user.data1 field will hold a pointer to the [ALLEGRO_TEXTLOG] + The user.data1 field will hold a pointer to the [A5O_TEXTLOG] which generated the event. The user.data2 field will be 1 if the event was generated as a result of a key press; otherwise it will be zero. @@ -279,7 +279,7 @@ Returns the (compiled) version of the addon, in the same format as Menus are implemented on Windows, X and OS X. Menus on X are implemented with GTK, and have a special requirement: you must -set the ALLEGRO_GTK_TOPLEVEL display flag prior to creating the display +set the A5O_GTK_TOPLEVEL display flag prior to creating the display which will have menus attached. A menu can be attached to a single display window or popped up as a context @@ -302,7 +302,7 @@ Anything else (including zero) will be considered an index based on the absolute value. In other words, 0 is the first menu item, -1 is the second menu item, -2 is the third menu item, and so on. -The event type is `ALLEGRO_EVENT_MENU_CLICK`. It contains three fields: +The event type is `A5O_EVENT_MENU_CLICK`. It contains three fields: ~~~~c event.user.data1 = id; @@ -318,8 +318,8 @@ A basic example: ~~~~c #define FILE_EXIT_ID 1 -ALLEGRO_MENU *menu = al_create_menu(); -ALLEGRO_MENU *file_menu = al_create_menu(); +A5O_MENU *menu = al_create_menu(); +A5O_MENU *file_menu = al_create_menu(); al_append_menu_item(file_menu, "Exit", FILE_EXIT_ID, 0, NULL, NULL); al_append_menu_item(menu, "File", 0, 0, NULL, file_menu); al_set_display_menu(display, menu); @@ -327,7 +327,7 @@ al_set_display_menu(display, menu); al_register_event_source(queue, al_get_default_menu_event_source()); al_wait_for_event(queue, &event); -if (event.type == ALLEGRO_EVENT_MENU_CLICK) { +if (event.type == A5O_EVENT_MENU_CLICK) { if (event.user.data1 == FILE_EXIT_ID) { exit_program(); } @@ -338,12 +338,12 @@ Because there is no "DISPLAY_DESTROYED" event, you must call al_set_display_menu(display, NULL) before destroying any display with a menu attached, to avoid leaking resources. -### API: ALLEGRO_MENU +### API: A5O_MENU An opaque data type that represents a menu that contains menu items. Each of the menu items may optionally include a sub-menu. -### API: ALLEGRO_MENU_INFO +### API: A5O_MENU_INFO A structure that defines how to create a complete menu system. For standard menu items, the following format is used: @@ -353,33 +353,33 @@ standard menu items, the following format is used: For special items, these macros are helpful: ~~~~c -ALLEGRO_START_OF_MENU(caption, id) -ALLEGRO_MENU_SEPARATOR -ALLEGRO_END_OF_MENU +A5O_START_OF_MENU(caption, id) +A5O_MENU_SEPARATOR +A5O_END_OF_MENU ~~~~ -A well-defined menu will begin with `ALLEGRO_START_OF_MENU`, contain -one or more menu items, and end with `ALLEGRO_END_OF_MENU`. A menu +A well-defined menu will begin with `A5O_START_OF_MENU`, contain +one or more menu items, and end with `A5O_END_OF_MENU`. A menu may contain sub-menus. An example: ~~~~c -ALLEGRO_MENU_INFO menu_info[] = { - ALLEGRO_START_OF_MENU("&File", 1), +A5O_MENU_INFO menu_info[] = { + A5O_START_OF_MENU("&File", 1), { "&Open", 2, 0, NULL }, - ALLEGRO_START_OF_MENU("Open &Recent...", 3), + A5O_START_OF_MENU("Open &Recent...", 3), { "Recent 1", 4, 0, NULL }, { "Recent 2", 5, 0, NULL }, - ALLEGRO_END_OF_MENU, - ALLEGRO_MENU_SEPARATOR, + A5O_END_OF_MENU, + A5O_MENU_SEPARATOR, { "E&xit", 6, 0, NULL }, - ALLEGRO_END_OF_MENU, - ALLEGRO_START_OF_MENU("&Help", 7), + A5O_END_OF_MENU, + A5O_START_OF_MENU("&Help", 7), {"&About", 8, 0, NULL }, - ALLEGRO_END_OF_MENU, - ALLEGRO_END_OF_MENU + A5O_END_OF_MENU, + A5O_END_OF_MENU }; -ALLEGRO_MENU *menu = al_build_menu(menu_info); +A5O_MENU *menu = al_build_menu(menu_info); ~~~~ If you prefer, you can build the menu without the structure @@ -412,15 +412,15 @@ See also: [al_create_menu], [al_build_menu] ### API: al_build_menu Builds a menu based on the specifications of a sequence of -`ALLEGRO_MENU_INFO` elements. +`A5O_MENU_INFO` elements. -Returns a pointer to the root `ALLEGRO_MENU`, or `NULL` on failure. +Returns a pointer to the root `A5O_MENU`, or `NULL` on failure. To gain access to the other menus and items, you will need to search for them using [al_find_menu_item]. Since: 5.1.0 -See also: [ALLEGRO_MENU_INFO], [al_create_menu], [al_create_popup_menu] +See also: [A5O_MENU_INFO], [al_create_menu], [al_create_popup_menu] ### API: al_append_menu_item @@ -441,16 +441,16 @@ one character in the `title`, prefix it with an ampersand. The `flags` can be any combination of: -ALLEGRO_MENU_ITEM_DISABLED +A5O_MENU_ITEM_DISABLED : The item is "grayed out" and cannot be selected. -ALLEGRO_MENU_ITEM_CHECKBOX +A5O_MENU_ITEM_CHECKBOX : The item is a check box. This flag can only be set at the time the menu is created. If a check box is clicked, it will automatically be toggled. -ALLEGRO_MENU_ITEM_CHECKED -: The item is checked. If set, ALLEGRO_MENU_ITEM_CHECKBOX will automatically +A5O_MENU_ITEM_CHECKED +: The item is checked. If set, A5O_MENU_ITEM_CHECKBOX will automatically be set as well. The `icon` is not yet supported. @@ -579,7 +579,7 @@ See also: [al_set_menu_item_icon] ### API: al_set_menu_item_icon Sets the icon for the specified menu item. The menu assumes ownership of the -`ALLEGRO_BITMAP` and may invalidate the pointer, so you must clone it if you +`A5O_BITMAP` and may invalidate the pointer, so you must clone it if you wish to continue using it. If a video bitmap is passed, it will automatically be converted to a memory @@ -692,7 +692,7 @@ Returns `true` if the context menu was displayed. > *Note:* On Linux this function will fail if any of the mouse keys are held down. I.e. it will only reliably work if you handle it in -`ALLEGRO_MOUSE_BUTTON_UP` events and even then only if that event corresponds +`A5O_MOUSE_BUTTON_UP` events and even then only if that event corresponds to the final mouse button that was pressed. Since: 5.1.0 diff --git a/docs/src/refman/opengl.txt b/docs/src/refman/opengl.txt index 5d89a7fe84..3ff1bce497 100644 --- a/docs/src/refman/opengl.txt +++ b/docs/src/refman/opengl.txt @@ -17,7 +17,7 @@ structure returned by `al_get_opengl_extension_list`. For example: ~~~~c -if (al_get_opengl_extension_list()->ALLEGRO_GL_ARB_multitexture) { +if (al_get_opengl_extension_list()->A5O_GL_ARB_multitexture) { //use it } ~~~~ @@ -50,7 +50,7 @@ with ARB's Multitexture extension: ~~~~c // define the type of the function -ALLEGRO_DEFINE_PROC_TYPE(void, MULTI_TEX_FUNC, +A5O_DEFINE_PROC_TYPE(void, MULTI_TEX_FUNC, (GLenum, GLfloat, GLfloat, GLfloat)); // declare the function pointer MULTI_TEX_FUNC glMultiTexCoord3fARB; @@ -63,7 +63,7 @@ If _glMultiTexCoord3fARB_ is not NULL then it can be used as if it has been defined in the OpenGL core library. > *Note:* Under Windows, OpenGL functions may need a special calling -convention, so it's best to always use the ALLEGRO_DEFINE_PROC_TYPE +convention, so it's best to always use the A5O_DEFINE_PROC_TYPE macro when declaring function pointer types for OpenGL functions. Parameters: @@ -109,7 +109,7 @@ See also: [al_get_opengl_texture_size] ## API: al_get_opengl_program_object Returns the OpenGL program object associated with this shader, if the platform -is `ALLEGRO_SHADER_GLSL`. Otherwise, returns 0. +is `A5O_SHADER_GLSL`. Otherwise, returns 0. ## API: al_get_opengl_fbo @@ -168,10 +168,10 @@ Returns the variant or type of OpenGL used on the running platform. This function can be called before creating a display or setting properties for new displays. Possible values are: -ALLEGRO_DESKTOP_OPENGL +A5O_DESKTOP_OPENGL : Regular OpenGL as seen on desktop/laptop computers. -ALLEGRO_OPENGL_ES +A5O_OPENGL_ES : Trimmed down version of OpenGL used on many small consumer electronic devices such as handheld (and sometimes full size) consoles. diff --git a/docs/src/refman/path.txt b/docs/src/refman/path.txt index 8bc048db6e..251d544a3e 100644 --- a/docs/src/refman/path.txt +++ b/docs/src/refman/path.txt @@ -41,7 +41,7 @@ See also: [al_create_path], [al_create_path_for_directory] ## API: al_clone_path -Clones an ALLEGRO_PATH structure. +Clones an A5O_PATH structure. Returns NULL on failure. See also: [al_destroy_path] @@ -214,12 +214,12 @@ Convert a path to its string representation, i.e. optional drive, followed by directory components separated by 'delim', followed by an optional filename. -To use the current native path separator, use ALLEGRO_NATIVE_PATH_SEP +To use the current native path separator, use A5O_NATIVE_PATH_SEP for 'delim'. The returned pointer is valid only until the path is modified in any way, or until the path is destroyed. This returns a null-terminated string. If you -need an ALLEGRO_USTR instead, use [al_path_ustr]. +need an A5O_USTR instead, use [al_path_ustr]. See also: [al_path_ustr] @@ -229,11 +229,11 @@ Convert a path to its string representation, i.e. optional drive, followed by directory components separated by 'delim', followed by an optional filename. -To use the current native path separator, use ALLEGRO_NATIVE_PATH_SEP +To use the current native path separator, use A5O_NATIVE_PATH_SEP for 'delim'. The returned pointer is valid only until the path is modified in any way, -or until the path is destroyed. This returns an ALLEGRO_USTR. If you need +or until the path is destroyed. This returns an A5O_USTR. If you need a null-terminated string instead, use [al_path_cstr]. Since: 5.2.3 diff --git a/docs/src/refman/physfs.txt b/docs/src/refman/physfs.txt index f8f678e045..24a8236591 100644 --- a/docs/src/refman/physfs.txt +++ b/docs/src/refman/physfs.txt @@ -9,7 +9,7 @@ For example, that means you can use the Image I/O addon to load images from .zip files. You must set up PhysicsFS through its own API. When you want to open an -ALLEGRO_FILE using PhysicsFS, first call [al_set_physfs_file_interface], +A5O_FILE using PhysicsFS, first call [al_set_physfs_file_interface], then [al_fopen] or another function that calls [al_fopen]. @@ -22,8 +22,8 @@ Link with allegro_physfs. ## API: al_set_physfs_file_interface -This function sets *both* the [ALLEGRO_FILE_INTERFACE] and -[ALLEGRO_FS_INTERFACE] for the calling thread. +This function sets *both* the [A5O_FILE_INTERFACE] and +[A5O_FS_INTERFACE] for the calling thread. Subsequent calls to [al_fopen] on the calling thread will be handled by PHYSFS_open(). Operations on the files returned by [al_fopen] will then be @@ -36,7 +36,7 @@ To remember and restore another file I/O backend, you can use > *Note:* due to an oversight, this function differs from [al_set_new_file_interface] and [al_set_standard_file_interface] -which only alter the current [ALLEGRO_FILE_INTERFACE]. +which only alter the current [A5O_FILE_INTERFACE]. > *Note:* PhysFS does not support the text-mode reading and writing, which means that Windows-style newlines will not be preserved. diff --git a/docs/src/refman/platform.txt b/docs/src/refman/platform.txt index fcaa39a232..c1faa82d8f 100644 --- a/docs/src/refman/platform.txt +++ b/docs/src/refman/platform.txt @@ -67,10 +67,10 @@ These functions are declared in the following header file: Sets the orientation of the status bar, which can be one of the following: -- ALLEGRO_IPHONE_STATUSBAR_ORIENTATION_PORTRAIT -- ALLEGRO_IPHONE_STATUSBAR_ORIENTATION_PORTRAIT_UPSIDE_DOWN -- ALLEGRO_IPHONE_STATUSBAR_ORIENTATION_LANDSCAPE_RIGHT -- ALLEGRO_IPHONE_STATUSBAR_ORIENTATION_LANDSCAPE_LEFT +- A5O_IPHONE_STATUSBAR_ORIENTATION_PORTRAIT +- A5O_IPHONE_STATUSBAR_ORIENTATION_PORTRAIT_UPSIDE_DOWN +- A5O_IPHONE_STATUSBAR_ORIENTATION_LANDSCAPE_RIGHT +- A5O_IPHONE_STATUSBAR_ORIENTATION_LANDSCAPE_LEFT Since: 5.1.0 @@ -96,7 +96,7 @@ These functions are declared in the following header file: ### API: al_android_set_apk_file_interface -This function will set up a custom [ALLEGRO_FILE_INTERFACE] that makes all +This function will set up a custom [A5O_FILE_INTERFACE] that makes all future calls of [al_fopen] read from the applicatons's APK file. > *Note:* Currently, access to the APK file after calling this function is read @@ -106,7 +106,7 @@ Since: 5.1.2 ### API: al_android_set_apk_fs_interface -This function will set up a custom [ALLEGRO_FS_INTERFACE] which allows +This function will set up a custom [A5O_FS_INTERFACE] which allows working within the APK filesystem. The filesystem root is your assets directory and there is read-only access to all files within. @@ -179,7 +179,7 @@ const char *content_uri = "content://..."; int fd = al_android_open_fd(content_uri, "r"); if (fd >= 0) { - ALLEGRO_FILE *f = al_fopen_fd(fd, "r"); + A5O_FILE *f = al_fopen_fd(fd, "r"); if (f != NULL) { do_something_with(f); diff --git a/docs/src/refman/primitives.txt b/docs/src/refman/primitives.txt index 3d4522636a..dce77d5f03 100644 --- a/docs/src/refman/primitives.txt +++ b/docs/src/refman/primitives.txt @@ -239,7 +239,7 @@ Example with `thickness <= 0`: ~~~~c const int num_points = 4; float points[num_points][2]; -al_calculate_arc(&points[0][0], 2 * sizeof(float), 0, 0, 10, 10, 0, ALLEGRO_PI / 2, 0, num_points); +al_calculate_arc(&points[0][0], 2 * sizeof(float), 0, 0, 10, 10, 0, A5O_PI / 2, 0, num_points); assert((int)points[0][0] == 10); assert((int)points[0][1] == 0); @@ -253,7 +253,7 @@ Example with `thickness > 0`: ~~~~c const int num_points = 4; float points[num_points * 2][2]; -al_calculate_arc(&points[0][0], 2 * sizeof(float), 0, 0, 10, 10, 0, ALLEGRO_PI / 2, 2, num_points); +al_calculate_arc(&points[0][0], 2 * sizeof(float), 0, 0, 10, 10, 0, A5O_PI / 2, 2, num_points); assert((int)points[0][0] == 11); assert((int)points[0][1] == 0); @@ -505,10 +505,10 @@ Draws a subset of the passed vertex array. * texture - Texture to use, pass NULL to use only color shaded primitves * vtxs - Pointer to an array of vertices * decl - Pointer to a [vertex declaration][al_create_vertex_decl]. If set to NULL, - the vertices are assumed to be of the [ALLEGRO_VERTEX] type + the vertices are assumed to be of the [A5O_VERTEX] type * start - Start index of the subset of the vertex array to draw * end - One past the last index of the subset of the vertex array to draw -* type - A member of the [ALLEGRO_PRIM_TYPE] enumeration, specifying what kind +* type - A member of the [A5O_PRIM_TYPE] enumeration, specifying what kind of primitive to draw *Returns:* @@ -517,16 +517,16 @@ Number of primitives drawn For example to draw a textured triangle you could use: ~~~~c -ALLEGRO_COLOR white = al_map_rgb_f(1, 1, 1); -ALLEGRO_VERTEX v[] = { +A5O_COLOR white = al_map_rgb_f(1, 1, 1); +A5O_VERTEX v[] = { {.x = 128, .y = 0, .z = 0, .color = white, .u = 128, .v = 0}, {.x = 0, .y = 256, .z = 0, .color = white, .u = 0, .v = 256}, {.x = 256, .y = 256, .z = 0, .color = white, .u = 256, .v = 256}}; -al_draw_prim(v, NULL, texture, 0, 3, ALLEGRO_PRIM_TRIANGLE_LIST); +al_draw_prim(v, NULL, texture, 0, 3, A5O_PRIM_TRIANGLE_LIST); ~~~~ See also: -[ALLEGRO_VERTEX], [ALLEGRO_PRIM_TYPE], [ALLEGRO_VERTEX_DECL], +[A5O_VERTEX], [A5O_PRIM_TYPE], [A5O_VERTEX_DECL], [al_draw_indexed_prim] ### API: al_draw_indexed_prim @@ -539,24 +539,24 @@ to specify which vertices to use. * texture - Texture to use, pass NULL to use only color shaded primitves * vtxs - Pointer to an array of vertices * decl - Pointer to a vertex declaration. If set to NULL, the vtxs are assumed - to be of the ALLEGRO_VERTEX type + to be of the A5O_VERTEX type * indices - An array of indices into the vertex array * num_vtx - Number of indices from the indices array you want to draw -* type - A member of the [ALLEGRO_PRIM_TYPE] enumeration, specifying what kind +* type - A member of the [A5O_PRIM_TYPE] enumeration, specifying what kind of primitive to draw *Returns:* Number of primitives drawn See also: -[ALLEGRO_VERTEX], [ALLEGRO_PRIM_TYPE], [ALLEGRO_VERTEX_DECL], [al_draw_prim] +[A5O_VERTEX], [A5O_PRIM_TYPE], [A5O_VERTEX_DECL], [al_draw_prim] ### API: al_draw_vertex_buffer Draws a subset of the passed vertex buffer. The vertex buffer must not be locked. Additionally, to draw onto memory bitmaps or with memory bitmap textures the vertex buffer must support reading (i.e. -it must be created with the `ALLEGRO_PRIM_BUFFER_READWRITE`). +it must be created with the `A5O_PRIM_BUFFER_READWRITE`). *Parameters:* @@ -564,7 +564,7 @@ it must be created with the `ALLEGRO_PRIM_BUFFER_READWRITE`). * texture - Texture to use, pass NULL to use only color shaded primitves * start - Start index of the subset of the vertex buffer to draw * end - One past the last index of the subset of the vertex buffer to draw -* type - A member of the [ALLEGRO_PRIM_TYPE] enumeration, specifying what kind +* type - A member of the [A5O_PRIM_TYPE] enumeration, specifying what kind of primitive to draw *Returns:* @@ -573,7 +573,7 @@ Number of primitives drawn Since: 5.1.3 See also: -[ALLEGRO_VERTEX_BUFFER], [ALLEGRO_PRIM_TYPE] +[A5O_VERTEX_BUFFER], [A5O_PRIM_TYPE] ### API: al_draw_indexed_buffer @@ -581,7 +581,7 @@ Draws a subset of the passed vertex buffer. This function uses an index buffer to specify which vertices to use. Both buffers must not be locked. Additionally, to draw onto memory bitmaps or with memory bitmap textures both buffers must support reading (i.e. they must be -created with the `ALLEGRO_PRIM_BUFFER_READWRITE`). +created with the `A5O_PRIM_BUFFER_READWRITE`). *Parameters:* @@ -590,9 +590,9 @@ created with the `ALLEGRO_PRIM_BUFFER_READWRITE`). * index_buffer - Index buffer to use * start - Start index of the subset of the index buffer to draw * end - One past the last index of the subset of the index buffer to draw -* type - A member of the [ALLEGRO_PRIM_TYPE] enumeration, specifying - what kind of primitive to draw. Note that ALLEGRO_PRIM_LINE_LOOP and - ALLEGRO_PRIM_POINT_LIST are not supported. +* type - A member of the [A5O_PRIM_TYPE] enumeration, specifying + what kind of primitive to draw. Note that A5O_PRIM_LINE_LOOP and + A5O_PRIM_POINT_LIST are not supported. *Returns:* Number of primitives drawn @@ -600,7 +600,7 @@ Number of primitives drawn Since: 5.1.8 See also: -[ALLEGRO_VERTEX_BUFFER], [ALLEGRO_INDEX_BUFFER], [ALLEGRO_PRIM_TYPE] +[A5O_VERTEX_BUFFER], [A5O_INDEX_BUFFER], [A5O_PRIM_TYPE] ### API: al_draw_soft_triangle @@ -669,14 +669,14 @@ Creates a vertex declaration, which describes a custom vertex format. *Parameters:* -* elements - An array of [ALLEGRO_VERTEX_ELEMENT] structures. +* elements - An array of [A5O_VERTEX_ELEMENT] structures. * stride - Size of the custom vertex structure *Returns:* Newly created vertex declaration. See also: -[ALLEGRO_VERTEX_ELEMENT], [ALLEGRO_VERTEX_DECL], [al_destroy_vertex_decl] +[A5O_VERTEX_ELEMENT], [A5O_VERTEX_DECL], [al_destroy_vertex_decl] ### API: al_destroy_vertex_decl @@ -687,7 +687,7 @@ Destroys a vertex declaration. * decl - Vertex declaration to destroy See also: -[ALLEGRO_VERTEX_ELEMENT], [ALLEGRO_VERTEX_DECL], [al_create_vertex_decl] +[A5O_VERTEX_ELEMENT], [A5O_VERTEX_DECL], [al_create_vertex_decl] ## Vertex buffer routines @@ -706,17 +706,17 @@ created (e.g. the system only supports write-only buffers). *Parameters:* * decl - Vertex type that this buffer will hold. NULL implies that this buffer will - hold [ALLEGRO_VERTEX] vertices + hold [A5O_VERTEX] vertices * initial_data - Memory buffer to copy from to initialize the vertex buffer. Can be `NULL`, in which case the buffer is uninitialized. * num_vertices - Number of vertices the buffer will hold -* flags - A combination of the [ALLEGRO_PRIM_BUFFER_FLAGS] flags +* flags - A combination of the [A5O_PRIM_BUFFER_FLAGS] flags specifying how this buffer will be created. Passing 0 is the same - as passing `ALLEGRO_PRIM_BUFFER_STATIC`. + as passing `A5O_PRIM_BUFFER_STATIC`. Since: 5.1.3 -See also: [ALLEGRO_VERTEX_BUFFER], [al_destroy_vertex_buffer] +See also: [A5O_VERTEX_BUFFER], [al_destroy_vertex_buffer] ### API: al_destroy_vertex_buffer @@ -724,7 +724,7 @@ Destroys a vertex buffer. Does nothing if passed NULL. Since: 5.1.3 -See also: [ALLEGRO_VERTEX_BUFFER], [al_create_vertex_buffer] +See also: [A5O_VERTEX_BUFFER], [al_create_vertex_buffer] ### API: al_lock_vertex_buffer @@ -737,11 +737,11 @@ if the buffer is already locked. * buffer - Vertex buffer to lock * offset - Vertex index of the start of the locked range * length - How many vertices to lock -* flags - ALLEGRO_LOCK_READONLY, ALLEGRO_LOCK_WRITEONLY or ALLEGRO_LOCK_READWRITE +* flags - A5O_LOCK_READONLY, A5O_LOCK_WRITEONLY or A5O_LOCK_READWRITE Since: 5.1.3 -See also: [ALLEGRO_VERTEX_BUFFER], [al_unlock_vertex_buffer] +See also: [A5O_VERTEX_BUFFER], [al_unlock_vertex_buffer] ### API: al_unlock_vertex_buffer @@ -749,7 +749,7 @@ Unlocks a previously locked vertex buffer. Since: 5.1.3 -See also: [ALLEGRO_VERTEX_BUFFER], [al_lock_vertex_buffer] +See also: [A5O_VERTEX_BUFFER], [al_lock_vertex_buffer] ### API: al_get_vertex_buffer_size @@ -757,7 +757,7 @@ Returns the size of the vertex buffer Since: 5.1.8 -See also: [ALLEGRO_VERTEX_BUFFER] +See also: [A5O_VERTEX_BUFFER] ## Index buffer routines @@ -780,13 +780,13 @@ created (e.g. the system only supports write-only buffers). * initial_data - Memory buffer to copy from to initialize the index buffer. Can be `NULL`, in which case the buffer is uninitialized. * num_indices - Number of indices the buffer will hold -* flags - A combination of the [ALLEGRO_PRIM_BUFFER_FLAGS] flags +* flags - A combination of the [A5O_PRIM_BUFFER_FLAGS] flags specifying how this buffer will be created. Passing 0 is the same - as passing `ALLEGRO_PRIM_BUFFER_STATIC`. + as passing `A5O_PRIM_BUFFER_STATIC`. Since: 5.1.8 -See also: [ALLEGRO_INDEX_BUFFER], [al_destroy_index_buffer] +See also: [A5O_INDEX_BUFFER], [al_destroy_index_buffer] ### API: al_destroy_index_buffer @@ -794,7 +794,7 @@ Destroys a index buffer. Does nothing if passed NULL. Since: 5.1.8 -See also: [ALLEGRO_INDEX_BUFFER], [al_create_index_buffer] +See also: [A5O_INDEX_BUFFER], [al_create_index_buffer] ### API: al_lock_index_buffer @@ -807,11 +807,11 @@ if the buffer is already locked. * buffer - Index buffer to lock * offset - Element index of the start of the locked range * length - How many indices to lock -* flags - ALLEGRO_LOCK_READONLY, ALLEGRO_LOCK_WRITEONLY or ALLEGRO_LOCK_READWRITE +* flags - A5O_LOCK_READONLY, A5O_LOCK_WRITEONLY or A5O_LOCK_READWRITE Since: 5.1.8 -See also: [ALLEGRO_INDEX_BUFFER], [al_unlock_index_buffer] +See also: [A5O_INDEX_BUFFER], [al_unlock_index_buffer] ### API: al_unlock_index_buffer @@ -819,7 +819,7 @@ Unlocks a previously locked index buffer. Since: 5.1.8 -See also: [ALLEGRO_INDEX_BUFFER], [al_lock_index_buffer] +See also: [A5O_INDEX_BUFFER], [al_lock_index_buffer] ### API: al_get_index_buffer_size @@ -827,7 +827,7 @@ Returns the size of the index buffer Since: 5.1.8 -See also: [ALLEGRO_INDEX_BUFFER] +See also: [A5O_INDEX_BUFFER] ## Polygon routines @@ -838,9 +838,9 @@ Draw a series of line segments. * vertices - Interleaved array of (x, y) vertex coordinates * vertex_stride - the number of bytes between pairs of vertices (the stride) * vertex_count - Number of vertices in the array -* join_style - Member of [ALLEGRO_LINE_JOIN] specifying how to render the +* join_style - Member of [A5O_LINE_JOIN] specifying how to render the joins between line segments -* cap_style - Member of [ALLEGRO_LINE_CAP] specifying how to render the end +* cap_style - Member of [A5O_LINE_CAP] specifying how to render the end caps * color - Color of the line * thickness - Thickness of the line, pass `<= 0` to draw hairline lines @@ -856,10 +856,10 @@ struct VertexInfo { int id; }; -void my_draw(struct VertexInfo verts[], int vertex_count, ALLEGRO_COLOR c) +void my_draw(struct VertexInfo verts[], int vertex_count, A5O_COLOR c) { al_draw_polyline((float *)verts, sizeof(VertexInfo), vertex_count, - ALLEGRO_LINE_JOIN_NONE, ALLEGRO_LINE_CAP_NONE, c, 1.0, 1.0); + A5O_LINE_JOIN_NONE, A5O_LINE_CAP_NONE, c, 1.0, 1.0); } ~~~~ @@ -867,16 +867,16 @@ The stride may also be negative if the vertices are stored in reverse order. Since: 5.1.0 -See also: [al_draw_polygon], [ALLEGRO_LINE_JOIN], [ALLEGRO_LINE_CAP] +See also: [al_draw_polygon], [A5O_LINE_JOIN], [A5O_LINE_CAP] ### API: al_draw_polygon Draw an unfilled polygon. This is the same as passing -`ALLEGRO_LINE_CAP_CLOSED` to [al_draw_polyline]. +`A5O_LINE_CAP_CLOSED` to [al_draw_polyline]. * vertex - Interleaved array of (x, y) vertex coordinates * vertex_count - Number of vertices in the array -* join_style - Member of [ALLEGRO_LINE_JOIN] specifying how to render the +* join_style - Member of [A5O_LINE_JOIN] specifying how to render the joins between line segments * color - Color of the line * thickness - Thickness of the line, pass `<= 0` to draw hairline lines @@ -884,7 +884,7 @@ joins between line segments Since: 5.1.0 -See also: [al_draw_filled_polygon], [al_draw_polyline], [ALLEGRO_LINE_JOIN] +See also: [al_draw_filled_polygon], [al_draw_polyline], [A5O_LINE_JOIN] ### API: al_draw_filled_polygon @@ -978,7 +978,7 @@ See also: [al_draw_filled_polygon_with_holes] ## Structures and types -### API: ALLEGRO_VERTEX +### API: A5O_VERTEX Defines the generic vertex type, with a 3D position, color and texture coordinates for a single texture. Note that at this time, the software driver @@ -991,21 +991,21 @@ be left uninitialized when you are not using textures. * x, y, z - Position of the vertex (float) * u, v - Texture coordinates measured in pixels (float) -* color - [ALLEGRO_COLOR] structure, storing the color of the vertex +* color - [A5O_COLOR] structure, storing the color of the vertex See also: -[ALLEGRO_PRIM_ATTR] +[A5O_PRIM_ATTR] -### API: ALLEGRO_VERTEX_DECL +### API: A5O_VERTEX_DECL A vertex declaration. This opaque structure is responsible for describing the format and layout of a user defined custom vertex. It is created and destroyed by specialized functions. See also: -[al_create_vertex_decl], [al_destroy_vertex_decl], [ALLEGRO_VERTEX_ELEMENT] +[al_create_vertex_decl], [al_destroy_vertex_decl], [A5O_VERTEX_ELEMENT] -### API: ALLEGRO_VERTEX_ELEMENT +### API: A5O_VERTEX_ELEMENT A small structure describing a certain element of a vertex. E.g. the position of the vertex, or its color. These structures are used by the @@ -1013,84 +1013,84 @@ position of the vertex, or its color. These structures are used by the generally occur in an array. The last element of such an array should have the attribute field equal to 0, to signify that it is the end of the array. Here is an example code that would create a declaration describing the -[ALLEGRO_VERTEX] structure (passing this as vertex declaration to +[A5O_VERTEX] structure (passing this as vertex declaration to al_draw_prim would be identical to passing NULL): ~~~~c /* On compilers without the offsetof keyword you need to obtain the * offset with sizeof and make sure to account for packing. */ -ALLEGRO_VERTEX_ELEMENT elems[] = { - {ALLEGRO_PRIM_POSITION, ALLEGRO_PRIM_FLOAT_3, offsetof(ALLEGRO_VERTEX, x)}, - {ALLEGRO_PRIM_TEX_COORD_PIXEL, ALLEGRO_PRIM_FLOAT_2, offsetof(ALLEGRO_VERTEX, u)}, - {ALLEGRO_PRIM_COLOR_ATTR, 0, offsetof(ALLEGRO_VERTEX, color)}, +A5O_VERTEX_ELEMENT elems[] = { + {A5O_PRIM_POSITION, A5O_PRIM_FLOAT_3, offsetof(A5O_VERTEX, x)}, + {A5O_PRIM_TEX_COORD_PIXEL, A5O_PRIM_FLOAT_2, offsetof(A5O_VERTEX, u)}, + {A5O_PRIM_COLOR_ATTR, 0, offsetof(A5O_VERTEX, color)}, {0, 0, 0} }; -ALLEGRO_VERTEX_DECL* decl = al_create_vertex_decl(elems, sizeof(ALLEGRO_VERTEX)); +A5O_VERTEX_DECL* decl = al_create_vertex_decl(elems, sizeof(A5O_VERTEX)); ~~~~ *Fields:* -* attribute - A member of the [ALLEGRO_PRIM_ATTR] enumeration, specifying what +* attribute - A member of the [A5O_PRIM_ATTR] enumeration, specifying what this attribute signifies -* storage - A member of the [ALLEGRO_PRIM_STORAGE] enumeration, specifying how +* storage - A member of the [A5O_PRIM_STORAGE] enumeration, specifying how this attribute is stored * offset - Offset in bytes from the beginning of the custom vertex structure. The C function offsetof is very useful here. See also: -[al_create_vertex_decl], [ALLEGRO_VERTEX_DECL], [ALLEGRO_PRIM_ATTR], -[ALLEGRO_PRIM_STORAGE] +[al_create_vertex_decl], [A5O_VERTEX_DECL], [A5O_PRIM_ATTR], +[A5O_PRIM_STORAGE] -### API: ALLEGRO_PRIM_TYPE +### API: A5O_PRIM_TYPE Enumerates the types of primitives this addon can draw. -* ALLEGRO_PRIM_POINT_LIST - A list of points, each vertex defines a point +* A5O_PRIM_POINT_LIST - A list of points, each vertex defines a point -* ALLEGRO_PRIM_LINE_LIST - A list of lines, sequential pairs of vertices define +* A5O_PRIM_LINE_LIST - A list of lines, sequential pairs of vertices define disjointed lines -* ALLEGRO_PRIM_LINE_STRIP - A strip of lines, sequential vertices define a +* A5O_PRIM_LINE_STRIP - A strip of lines, sequential vertices define a strip of lines -* ALLEGRO_PRIM_LINE_LOOP - Like a line strip, except at the end the first and +* A5O_PRIM_LINE_LOOP - Like a line strip, except at the end the first and the last vertices are also connected by a line -* ALLEGRO_PRIM_TRIANGLE_LIST - A list of triangles, sequential triplets of +* A5O_PRIM_TRIANGLE_LIST - A list of triangles, sequential triplets of vertices define disjointed triangles -* ALLEGRO_PRIM_TRIANGLE_STRIP - A strip of triangles, sequential vertices +* A5O_PRIM_TRIANGLE_STRIP - A strip of triangles, sequential vertices define a strip of triangles -* ALLEGRO_PRIM_TRIANGLE_FAN - A fan of triangles, all triangles share the first +* A5O_PRIM_TRIANGLE_FAN - A fan of triangles, all triangles share the first vertex -### API: ALLEGRO_PRIM_ATTR +### API: A5O_PRIM_ATTR Enumerates the types of vertex attributes that a custom vertex may have. -* ALLEGRO_PRIM_POSITION - Position information, can be stored only in - ALLEGRO_PRIM_SHORT_2, ALLEGRO_PRIM_FLOAT_2 and ALLEGRO_PRIM_FLOAT_3. +* A5O_PRIM_POSITION - Position information, can be stored only in + A5O_PRIM_SHORT_2, A5O_PRIM_FLOAT_2 and A5O_PRIM_FLOAT_3. -* ALLEGRO_PRIM_COLOR_ATTR - Color information, stored in an [ALLEGRO_COLOR]. - The storage field of ALLEGRO_VERTEX_ELEMENT is ignored +* A5O_PRIM_COLOR_ATTR - Color information, stored in an [A5O_COLOR]. + The storage field of A5O_VERTEX_ELEMENT is ignored -* ALLEGRO_PRIM_TEX_COORD - Texture coordinate information, can be stored only in - ALLEGRO_PRIM_FLOAT_2 and ALLEGRO_PRIM_SHORT_2. These coordinates are +* A5O_PRIM_TEX_COORD - Texture coordinate information, can be stored only in + A5O_PRIM_FLOAT_2 and A5O_PRIM_SHORT_2. These coordinates are normalized by the width and height of the texture, meaning that the bottom-right corner has texture coordinates of (1, 1). -* ALLEGRO_PRIM_TEX_COORD_PIXEL - Texture coordinate information, can be stored - only in ALLEGRO_PRIM_FLOAT_2 and ALLEGRO_PRIM_SHORT_2. These coordinates are +* A5O_PRIM_TEX_COORD_PIXEL - Texture coordinate information, can be stored + only in A5O_PRIM_FLOAT_2 and A5O_PRIM_SHORT_2. These coordinates are measured in pixels. -* ALLEGRO_PRIM_USER_ATTR - A user specified attribute. You can use any storage - for this attribute. You may have at most ALLEGRO_PRIM_MAX_USER_ATTR +* A5O_PRIM_USER_ATTR - A user specified attribute. You can use any storage + for this attribute. You may have at most A5O_PRIM_MAX_USER_ATTR (currently 10) of these that you can specify by adding an index to the - value of ALLEGRO_PRIM_USER_ATTR, e.g. the first user attribute is - `ALLEGRO_PRIM_USER_ATTR + 0`, the second is - `ALLEGRO_PRIM_USER_ATTR + 1` and so on. + value of A5O_PRIM_USER_ATTR, e.g. the first user attribute is + `A5O_PRIM_USER_ATTR + 0`, the second is + `A5O_PRIM_USER_ATTR + 1` and so on. To access these custom attributes from GLSL shaders you need to declare attributes that follow this nomenclature: `al_user_attr_#` where # is the index @@ -1100,17 +1100,17 @@ Enumerates the types of vertex attributes that a custom vertex may have. you could declare it like this: ~~~~c - ALLEGRO_VERTEX_ELEMENT elements[3] = { - {ALLEGRO_PRIM_POSITION, ALLEGRO_PRIM_FLOAT_3, 0}, - {ALLEGRO_PRIM_USER_ATTR + 0, ALLEGRO_PRIM_FLOAT_3, 12}, + A5O_VERTEX_ELEMENT elements[3] = { + {A5O_PRIM_POSITION, A5O_PRIM_FLOAT_3, 0}, + {A5O_PRIM_USER_ATTR + 0, A5O_PRIM_FLOAT_3, 12}, {0, 0, 0}}; ~~~~ And then in your vertex shader access it like this: ~~~~c - attribute vec3 al_pos; // ALLEGRO_PRIM_POSITION - attribute vec3 al_user_attr_0; // ALLEGRO_PRIM_USER_ATTR + 0 + attribute vec3 al_pos; // A5O_PRIM_POSITION + attribute vec3 al_user_attr_0; // A5O_PRIM_USER_ATTR + 0 varying float light; const vec3 light_direction = vec3(0, 0, 1); void main() { @@ -1127,77 +1127,77 @@ Enumerates the types of vertex attributes that a custom vertex may have. Since: 5.1.6 See also: -[ALLEGRO_VERTEX_DECL], [ALLEGRO_PRIM_STORAGE], [al_attach_shader_source] +[A5O_VERTEX_DECL], [A5O_PRIM_STORAGE], [al_attach_shader_source] -### API: ALLEGRO_PRIM_STORAGE +### API: A5O_PRIM_STORAGE Enumerates the types of storage an attribute of a custom vertex may be stored -in. Many of these can only be used for ALLEGRO_PRIM_USER_ATTR attributes and +in. Many of these can only be used for A5O_PRIM_USER_ATTR attributes and can only be accessed via shaders. Usually no matter what the storage is specified the attribute gets converted to single precision floating point when the shader is run. Despite that, it may be advantageous to use more dense -storage formats (e.g. ALLEGRO_PRIM_NORMALIZED_UBYTE_4 instead of -ALLEGRO_PRIM_FLOAT_4) when bandwidth (amount of memory sent to the GPU) is an +storage formats (e.g. A5O_PRIM_NORMALIZED_UBYTE_4 instead of +A5O_PRIM_FLOAT_4) when bandwidth (amount of memory sent to the GPU) is an issue but precision is not. -* ALLEGRO_PRIM_FLOAT_1 - A single float +* A5O_PRIM_FLOAT_1 - A single float Since: 5.1.6 -* ALLEGRO_PRIM_FLOAT_2 - A doublet of floats +* A5O_PRIM_FLOAT_2 - A doublet of floats -* ALLEGRO_PRIM_FLOAT_3 - A triplet of floats +* A5O_PRIM_FLOAT_3 - A triplet of floats -* ALLEGRO_PRIM_FLOAT_4 - A quad of floats +* A5O_PRIM_FLOAT_4 - A quad of floats Since: 5.1.6 -* ALLEGRO_PRIM_SHORT_2 - A doublet of shorts +* A5O_PRIM_SHORT_2 - A doublet of shorts -* ALLEGRO_PRIM_SHORT_4 - A quad of shorts +* A5O_PRIM_SHORT_4 - A quad of shorts Since: 5.1.6 -* ALLEGRO_PRIM_UBYTE_4 - A quad of unsigned bytes +* A5O_PRIM_UBYTE_4 - A quad of unsigned bytes Since: 5.1.6 -* ALLEGRO_PRIM_NORMALIZED_SHORT_2 - A doublet of shorts. Before being sent to +* A5O_PRIM_NORMALIZED_SHORT_2 - A doublet of shorts. Before being sent to the shader, each component is divided by 32767. Each component of the resultant float doublet ranges between -1.0 and 1.0 Since: 5.1.6 -* ALLEGRO_PRIM_NORMALIZED_SHORT_4 - A quad of shorts. Before being sent to +* A5O_PRIM_NORMALIZED_SHORT_4 - A quad of shorts. Before being sent to the shader, each component is divided by 32767. Each component of the resultant float quad ranges between -1.0 and 1.0 Since: 5.1.6 -* ALLEGRO_PRIM_NORMALIZED_UBYTE_4 - A quad of unsigned bytes. Before being sent +* A5O_PRIM_NORMALIZED_UBYTE_4 - A quad of unsigned bytes. Before being sent to the shader, each component is divided by 255. Each component of the resultant float quad ranges between 0.0 and 1.0 Since: 5.1.6 -* ALLEGRO_PRIM_NORMALIZED_USHORT_2 - A doublet of unsigned shorts. Before being +* A5O_PRIM_NORMALIZED_USHORT_2 - A doublet of unsigned shorts. Before being sent to the shader, each component is divided by 65535. Each component of the resultant float doublet ranges between 0.0 and 1.0 Since: 5.1.6 -* ALLEGRO_PRIM_NORMALIZED_USHORT_4 - A quad of unsigned shorts. Before being +* A5O_PRIM_NORMALIZED_USHORT_4 - A quad of unsigned shorts. Before being sent to the shader, each component is divided by 65535. Each component of the resultant float quad ranges between 0.0 and 1.0 Since: 5.1.6 -* ALLEGRO_PRIM_HALF_FLOAT_2 - A doublet of half-precision floats. Note that this +* A5O_PRIM_HALF_FLOAT_2 - A doublet of half-precision floats. Note that this storage format is not supported on all platforms. [al_create_vertex_decl] will return NULL if you use it on those platforms Since: 5.1.6 -* ALLEGRO_PRIM_HALF_FLOAT_4 - A quad of half-precision floats. Note that this +* A5O_PRIM_HALF_FLOAT_4 - A quad of half-precision floats. Note that this storage format is not supported on all platforms. [al_create_vertex_decl] will return NULL if you use it on those platforms. Since: 5.1.6 See also: -[ALLEGRO_PRIM_ATTR] +[A5O_PRIM_ATTR] -### API: ALLEGRO_VERTEX_CACHE_SIZE +### API: A5O_VERTEX_CACHE_SIZE Defines the size of the transformation vertex cache for the software renderer. If you pass less than this many vertices to the primitive rendering functions @@ -1205,21 +1205,21 @@ you will get a speed boost. This also defines the size of the cache vertex buffer, used for the high-level primitives. This corresponds to the maximum number of line segments that will be used to form them. -### API: ALLEGRO_PRIM_QUALITY +### API: A5O_PRIM_QUALITY Controls the quality of the approximation of curved primitives (e.g. circles). Curved primitives are drawn by approximating them with a sequence of line segments. By default, this roughly corresponds to error of less than half of a pixel. -### API: ALLEGRO_LINE_JOIN +### API: A5O_LINE_JOIN -* ALLEGRO_LINE_JOIN_NONE -* ALLEGRO_LINE_JOIN_BEVEL -* ALLEGRO_LINE_JOIN_ROUND -* ALLEGRO_LINE_JOIN_MITER +* A5O_LINE_JOIN_NONE +* A5O_LINE_JOIN_BEVEL +* A5O_LINE_JOIN_ROUND +* A5O_LINE_JOIN_MITER -![*ALLEGRO_LINE_JOIN styles*](images/LINE_JOIN.png) +![*A5O_LINE_JOIN styles*](images/LINE_JOIN.png) See the picture for the difference. @@ -1230,27 +1230,27 @@ Since: 5.1.0 See also: [al_draw_polygon] -### API: ALLEGRO_LINE_CAP +### API: A5O_LINE_CAP -* ALLEGRO_LINE_CAP_NONE -* ALLEGRO_LINE_CAP_SQUARE -* ALLEGRO_LINE_CAP_ROUND -* ALLEGRO_LINE_CAP_TRIANGLE -* ALLEGRO_LINE_CAP_CLOSED +* A5O_LINE_CAP_NONE +* A5O_LINE_CAP_SQUARE +* A5O_LINE_CAP_ROUND +* A5O_LINE_CAP_TRIANGLE +* A5O_LINE_CAP_CLOSED -![*ALLEGRO_LINE_CAP styles*](images/LINE_CAP.png) +![*A5O_LINE_CAP styles*](images/LINE_CAP.png) See the picture for the difference. -ALLEGRO_LINE_CAP_CLOSED is different from the others - it causes the polygon -to have no caps. (And the [ALLEGRO_LINE_JOIN] style will determine how the +A5O_LINE_CAP_CLOSED is different from the others - it causes the polygon +to have no caps. (And the [A5O_LINE_JOIN] style will determine how the vertex looks.) Since: 5.1.0 See also: [al_draw_polygon] -### API: ALLEGRO_VERTEX_BUFFER +### API: A5O_VERTEX_BUFFER A GPU vertex buffer that you can use to store vertices on the GPU instead of uploading them afresh during every drawing operation. @@ -1259,7 +1259,7 @@ Since: 5.1.3 See also: [al_create_vertex_buffer], [al_destroy_vertex_buffer] -### API: ALLEGRO_INDEX_BUFFER +### API: A5O_INDEX_BUFFER A GPU index buffer that you can use to store indices of vertices in a vertex buffer on the GPU instead of uploading them afresh during @@ -1269,20 +1269,20 @@ Since: 5.1.8 See also: [al_create_index_buffer], [al_destroy_index_buffer] -### API: ALLEGRO_PRIM_BUFFER_FLAGS +### API: A5O_PRIM_BUFFER_FLAGS Flags to specify how to create a vertex or an index buffer. -* ALLEGRO_PRIM_BUFFER_STREAM - Hints to the driver that the buffer +* A5O_PRIM_BUFFER_STREAM - Hints to the driver that the buffer is written to often, but used only a few times per frame -* ALLEGRO_PRIM_BUFFER_STATIC - Hints to the driver that the buffer +* A5O_PRIM_BUFFER_STATIC - Hints to the driver that the buffer is written to once and is used often -* ALLEGRO_PRIM_BUFFER_DYNAMIC - Hints to the driver that the buffer +* A5O_PRIM_BUFFER_DYNAMIC - Hints to the driver that the buffer is written to often and is used often -* ALLEGRO_PRIM_BUFFER_READWRITE - Specifies that you want to be able +* A5O_PRIM_BUFFER_READWRITE - Specifies that you want to be able read from this buffer. By default this is disabled for performance. Some platforms (like OpenGL ES) do not support reading from vertex buffers, so if you pass this flag to `al_create_vertex_buffer` or diff --git a/docs/src/refman/shader.txt b/docs/src/refman/shader.txt index ade89afb39..7ff63a9248 100644 --- a/docs/src/refman/shader.txt +++ b/docs/src/refman/shader.txt @@ -6,25 +6,25 @@ These functions are declared in the main Allegro header file: #include ~~~~ -## API: ALLEGRO_SHADER +## API: A5O_SHADER -An [ALLEGRO_SHADER] is a program that runs on the GPU. +An [A5O_SHADER] is a program that runs on the GPU. It combines both a vertex and a pixel shader. -(In OpenGL terms, an [ALLEGRO_SHADER] is actually a *program* +(In OpenGL terms, an [A5O_SHADER] is actually a *program* which has one or more *shaders* attached. This can be confusing.) The source code for the underlying vertex or pixel shader can be provided -either as GLSL or HLSL, depending on the value of [ALLEGRO_SHADER_PLATFORM] +either as GLSL or HLSL, depending on the value of [A5O_SHADER_PLATFORM] used when creating it. Since: 5.1.0 -## API: ALLEGRO_SHADER_TYPE +## API: A5O_SHADER_TYPE Used with [al_attach_shader_source] and [al_attach_shader_source_file] to specify how to interpret the attached source. -ALLEGRO_VERTEX_SHADER +A5O_VERTEX_SHADER : A vertex shader is executed for each vertex it is used with. The program will output exactly one vertex at a time. @@ -32,7 +32,7 @@ ALLEGRO_VERTEX_SHADER primitives from the primitives addon, each drawn bitmap also consists of four vertices. -ALLEGRO_PIXEL_SHADER +A5O_PIXEL_SHADER : A pixel shader is executed for each pixel it is used with. The program will output exactly one pixel at a time - either in the backbuffer or in the current target bitmap. @@ -47,20 +47,20 @@ ALLEGRO_PIXEL_SHADER Since: 5.1.0 -## API: ALLEGRO_SHADER_PLATFORM +## API: A5O_SHADER_PLATFORM -The underlying platform which the [ALLEGRO_SHADER] is built on top of, +The underlying platform which the [A5O_SHADER] is built on top of, which dictates the language used to program the shader. -* ALLEGRO_SHADER_AUTO - Pick a platform automatically given the +* A5O_SHADER_AUTO - Pick a platform automatically given the current display flags. -* ALLEGRO_SHADER_GLSL - OpenGL Shading Language -* ALLEGRO_SHADER_HLSL - High Level Shader Language (for Direct3D) -* ALLEGRO_SHADER_AUTO_MINIMAL - Like ALLEGRO_SHADER_AUTO, but pick a +* A5O_SHADER_GLSL - OpenGL Shading Language +* A5O_SHADER_HLSL - High Level Shader Language (for Direct3D) +* A5O_SHADER_AUTO_MINIMAL - Like A5O_SHADER_AUTO, but pick a more minimal implementation that may not support alpha testing. -* ALLEGRO_SHADER_GLSL_MINIMAL - Minimal GLSL shader. -* ALLEGRO_SHADER_HLSL_MINIMAL - Minimal HLSL shader. -* ALLEGRO_SHADER_HLSL_SM_3_0 - HLSL shader using shader model 3_0. +* A5O_SHADER_GLSL_MINIMAL - Minimal GLSL shader. +* A5O_SHADER_HLSL_MINIMAL - Minimal HLSL shader. +* A5O_SHADER_HLSL_SM_3_0 - HLSL shader using shader model 3_0. Since: 5.1.0 @@ -68,7 +68,7 @@ Since: 5.1.0 Create a shader object. -The platform argument is one of the [ALLEGRO_SHADER_PLATFORM] values, +The platform argument is one of the [A5O_SHADER_PLATFORM] values, and specifies the type of shader object to create, and which language is used to program the shader. @@ -76,7 +76,7 @@ The shader platform must be compatible with the type of display that you will use the shader with. For example, you cannot create and use a HLSL shader on an OpenGL display, nor a GLSL shader on a Direct3D display. -The ALLEGRO_SHADER_AUTO value automatically chooses the appropriate platform +The A5O_SHADER_AUTO value automatically chooses the appropriate platform for the display currently targeted by the calling thread; there must be such a display. It will create a GLSL shader for an OpenGL display, and a HLSL shader for a Direct3D display. @@ -96,14 +96,14 @@ NULL deletes the underlying (OpenGL or DirectX) shader. See also [al_attach_shader_source_file] if you prefer to obtain your shader source from an external file. -If you do not use ALLEGRO_PROGRAMMABLE_PIPELINE Allegro's graphics functions +If you do not use A5O_PROGRAMMABLE_PIPELINE Allegro's graphics functions will not use any shader specific functions themselves. In case of a system with no fixed function pipeline (like OpenGL ES 2 or OpenGL 3 or 4) this means Allegro's drawing functions cannot be used. -TODO: Is ALLEGRO_PROGRAMMABLE_PIPELINE set automatically in this case? +TODO: Is A5O_PROGRAMMABLE_PIPELINE set automatically in this case? -When ALLEGRO_PROGRAMMABLE_PIPELINE is used the following shader uniforms +When A5O_PROGRAMMABLE_PIPELINE is used the following shader uniforms are provided by Allegro and can be accessed in your shaders: al_projview_matrix @@ -137,13 +137,13 @@ al_alpha_test `al_alpha_test_val`. al_alpha_func -: The alpha testing function used. One of the [ALLEGRO_RENDER_FUNCTION] - values. The default is ALLEGRO_RENDER_ALWAYS which means all pixels +: The alpha testing function used. One of the [A5O_RENDER_FUNCTION] + values. The default is A5O_RENDER_ALWAYS which means all pixels (even completely transparent ones) are rendered. The type is `int`. - See [ALLEGRO_RENDER_STATE]. + See [A5O_RENDER_STATE]. al_alpha_test_val -: If alpha testing is not ALLEGRO_RENDER_NEVER or ALLEGRO_RENDER_ALWAYS +: If alpha testing is not A5O_RENDER_NEVER or A5O_RENDER_ALWAYS the alpha value to compare to for alpha testing. The type is `float`. For GLSL shaders the vertex attributes are passed using the following variables: @@ -158,10 +158,10 @@ al_color : vertex color attribute. Type is `vec4`. al_user_attr_0 -: The vertex attribute declared as ALLEGRO_PRIM_USER_ATTR +: The vertex attribute declared as A5O_PRIM_USER_ATTR al_user_attr_1, ..., al_user_attr_9 -: The vertex attribute declared as ALLEGRO_PRIM_USER_ATTR + X where X is an integer from 1 to 9 +: The vertex attribute declared as A5O_PRIM_USER_ATTR + X where X is an integer from 1 to 9 For HLSL shaders the vertex attributes are passed using the following semantics: @@ -179,16 +179,16 @@ Also, each shader variable has a corresponding macro name that can be used when defining the shaders using string literals. Don't use these macros with the other shader functions as that will lead to undefined behavior. -* ALLEGRO_SHADER_VAR_PROJVIEW_MATRIX for "al_projview_matrix" -* ALLEGRO_SHADER_VAR_POS for "al_pos" -* ALLEGRO_SHADER_VAR_COLOR for "al_color" -* ALLEGRO_SHADER_VAR_TEXCOORD for "al_texcoord" -* ALLEGRO_SHADER_VAR_USE_TEX for "al_use_tex" -* ALLEGRO_SHADER_VAR_TEX for "al_tex" -* ALLEGRO_SHADER_VAR_USE_TEX_MATRIX for "al_use_tex_matrix" -* ALLEGRO_SHADER_VAR_TEX_MATRIX for "al_tex_matrix" -* ALLEGRO_SHADER_VAR_ALPHA_FUNCTION for "al_alpha_func" -* ALLEGRO_SHADER_VAR_ALPHA_TEST_VALUE for "al_alpha_test_val" +* A5O_SHADER_VAR_PROJVIEW_MATRIX for "al_projview_matrix" +* A5O_SHADER_VAR_POS for "al_pos" +* A5O_SHADER_VAR_COLOR for "al_color" +* A5O_SHADER_VAR_TEXCOORD for "al_texcoord" +* A5O_SHADER_VAR_USE_TEX for "al_use_tex" +* A5O_SHADER_VAR_TEX for "al_tex" +* A5O_SHADER_VAR_USE_TEX_MATRIX for "al_use_tex_matrix" +* A5O_SHADER_VAR_TEX_MATRIX for "al_tex_matrix" +* A5O_SHADER_VAR_ALPHA_FUNCTION for "al_alpha_func" +* A5O_SHADER_VAR_ALPHA_TEST_VALUE for "al_alpha_test_val" Examine the output of [al_get_default_shader_source] for an example of how to use the above uniforms and attributes. @@ -199,7 +199,7 @@ updated. The error log can be retrieved with [al_get_shader_log]. Since: 5.1.0 See also: [al_attach_shader_source_file], [al_build_shader], -[al_get_default_shader_source], [al_get_shader_log], [ALLEGRO_PRIM_ATTR] +[al_get_default_shader_source], [al_get_shader_log], [A5O_PRIM_ATTR] ## API: al_attach_shader_source_file @@ -222,7 +222,7 @@ be called after successfully attaching the pixel and/or vertex shaders with Returns true on success and false on error, in which case the error log is updated. The error log can be retrieved with [al_get_shader_log]. -> *Note:* If you are using the ALLEGRO_PROGRAMMABLE_PIPELINE flag, then you +> *Note:* If you are using the A5O_PROGRAMMABLE_PIPELINE flag, then you must specify both a pixel and a vertex shader sources for anything to be rendered. @@ -246,7 +246,7 @@ See also: [al_attach_shader_source], [al_attach_shader_source_file], ## API: al_get_shader_platform Returns the platform the shader was created with (either -ALLEGRO_SHADER_HLSL or ALLEGRO_SHADER_GLSL). +A5O_SHADER_HLSL or A5O_SHADER_GLSL). Since: 5.1.6 @@ -395,8 +395,8 @@ See also: [al_set_shader_int_vector], [al_use_shader] ## API: al_get_default_shader_source Returns a string containing the source code to Allegro's default vertex or pixel -shader appropriate for the passed platform. The ALLEGRO_SHADER_AUTO value means -GLSL is used if OpenGL is being used otherwise HLSL. ALLEGRO_SHADER_AUTO +shader appropriate for the passed platform. The A5O_SHADER_AUTO value means +GLSL is used if OpenGL is being used otherwise HLSL. A5O_SHADER_AUTO requires that there is a current display set on the calling thread. This function can return NULL if Allegro was built without support for shaders of the selected platform. diff --git a/docs/src/refman/state.txt b/docs/src/refman/state.txt index 7bda019227..98ac1fa64a 100644 --- a/docs/src/refman/state.txt +++ b/docs/src/refman/state.txt @@ -4,7 +4,7 @@ These functions are declared in the main Allegro header file: #include -## API: ALLEGRO_STATE +## API: A5O_STATE Opaque type which is passed to [al_store_state]/[al_restore_state]. @@ -36,7 +36,7 @@ want to minimize that though and for the remaining cases use synchronization primitives described in the threads section or events described in the events section to control inter-thread communication.) -## API: ALLEGRO_STATE_FLAGS +## API: A5O_STATE_FLAGS Flags which can be passed to [al_store_state]/[al_restore_state] as bit combinations. See [al_store_state] for the list of flags. @@ -44,29 +44,29 @@ combinations. See [al_store_state] for the list of flags. ## API: al_restore_state Restores part of the state of the current thread from the given -[ALLEGRO_STATE] object. +[A5O_STATE] object. -See also: [al_store_state], [ALLEGRO_STATE_FLAGS] +See also: [al_store_state], [A5O_STATE_FLAGS] ## API: al_store_state -Stores part of the state of the current thread in the given [ALLEGRO_STATE] +Stores part of the state of the current thread in the given [A5O_STATE] object. The flags parameter can take any bit-combination of these flags: -* ALLEGRO_STATE_NEW_DISPLAY_PARAMETERS - new_display_format, +* A5O_STATE_NEW_DISPLAY_PARAMETERS - new_display_format, new_display_refresh_rate, new_display_flags -* ALLEGRO_STATE_NEW_BITMAP_PARAMETERS - new_bitmap_format, new_bitmap_flags -* ALLEGRO_STATE_DISPLAY - current_display -* ALLEGRO_STATE_TARGET_BITMAP - target_bitmap -* ALLEGRO_STATE_BLENDER - blender -* ALLEGRO_STATE_TRANSFORM - current_transformation -* ALLEGRO_STATE_PROJECTION_TRANSFORM - current_projection_transformation -* ALLEGRO_STATE_NEW_FILE_INTERFACE - new_file_interface -* ALLEGRO_STATE_BITMAP - same as ALLEGRO_STATE_NEW_BITMAP_PARAMETERS and - ALLEGRO_STATE_TARGET_BITMAP -* ALLEGRO_STATE_ALL - all of the above - -See also: [al_restore_state], [ALLEGRO_STATE] +* A5O_STATE_NEW_BITMAP_PARAMETERS - new_bitmap_format, new_bitmap_flags +* A5O_STATE_DISPLAY - current_display +* A5O_STATE_TARGET_BITMAP - target_bitmap +* A5O_STATE_BLENDER - blender +* A5O_STATE_TRANSFORM - current_transformation +* A5O_STATE_PROJECTION_TRANSFORM - current_projection_transformation +* A5O_STATE_NEW_FILE_INTERFACE - new_file_interface +* A5O_STATE_BITMAP - same as A5O_STATE_NEW_BITMAP_PARAMETERS and + A5O_STATE_TARGET_BITMAP +* A5O_STATE_ALL - all of the above + +See also: [al_restore_state], [A5O_STATE] ## API: al_get_errno diff --git a/docs/src/refman/system.txt b/docs/src/refman/system.txt index 2cb79deb00..b2b5f61919 100644 --- a/docs/src/refman/system.txt +++ b/docs/src/refman/system.txt @@ -11,7 +11,7 @@ These functions are declared in the main Allegro header file: Initialize the Allegro system. No other Allegro functions can be called before this (with one or two exceptions). -The version field should always be set to ALLEGRO_VERSION_INT. +The version field should always be set to A5O_VERSION_INT. If atexit_ptr is non-NULL, and if hasn't been done already, [al_uninstall_system] will be registered as an atexit @@ -27,7 +27,7 @@ The version compatibility check works as follows. Let A = xa.ya.za.* be the version of Allegro you compiled with, and B = xb.yb.zb.* be the version of Allegro found in the system shared library. -If you defined `ALLEGRO_UNSTABLE` before including Allegro headers, then +If you defined `A5O_UNSTABLE` before including Allegro headers, then version A is compatible with B only if xa.ya.za = xb.yb.zb. Otherwise, A is compatible with B only if xa.ya = xb.yb. @@ -89,7 +89,7 @@ the same on some platforms), so you should be sure your filenames are unique if you need to avoid naming collisions. Also, a returned path may not actually exist on the file system. -ALLEGRO_RESOURCES_PATH +A5O_RESOURCES_PATH : If you bundle data in a location relative to your executable, then you should use this path to locate that data. On most platforms, this is the directory that contains the executable file. @@ -107,16 +107,16 @@ ALLEGRO_RESOURCES_PATH /usr/share or C:\\ProgramData), then you are responsible for keeping track of that yourself. -ALLEGRO_TEMP_PATH +A5O_TEMP_PATH : Path to the directory for temporary files. -ALLEGRO_USER_HOME_PATH +A5O_USER_HOME_PATH : This is the user's home directory. You should not normally write files into this directory directly, or create any sub folders in it, without explicit permission from the user. One practical application of this path would be to use it as the starting place of a file selector in a GUI. -ALLEGRO_USER_DOCUMENTS_PATH +A5O_USER_DOCUMENTS_PATH : This location is easily accessible by the user, and is the place to store documents and files that the user might want to later open with an external program or transfer to another place. @@ -124,19 +124,19 @@ ALLEGRO_USER_DOCUMENTS_PATH You should not save files here unless the user expects it, usually by explicit permission. -ALLEGRO_USER_DATA_PATH +A5O_USER_DATA_PATH : If your program saves any data that the user doesn't need to access externally, then you should place it here. This is generally the least intrusive place to store data. This path will usually not be present on the file system, so make sure to create it before writing to it. -ALLEGRO_USER_SETTINGS_PATH +A5O_USER_SETTINGS_PATH : If you are saving configuration files (especially if the user may want to edit them outside of your program), then you should place them here. This path will usually not be present on the file system, so make sure to create it before writing to it. -ALLEGRO_EXENAME_PATH +A5O_EXENAME_PATH : The full path to the executable. Returns NULL on failure. The returned path should be freed with @@ -147,7 +147,7 @@ See also: [al_set_app_name], [al_set_org_name], [al_destroy_path], [al_set_exe_n ## API: al_set_exe_name This override the executable name used by [al_get_standard_path] for -ALLEGRO_EXENAME_PATH and ALLEGRO_RESOURCES_PATH. +A5O_EXENAME_PATH and A5O_RESOURCES_PATH. One possibility where changing this can be useful is if you use the Python wrapper. Allegro would then by default think that the system's @@ -220,7 +220,7 @@ Note that Allegro will not look into that file unless you make a copy of it and place it next to your executable! ~~~~ini -__ALLEGRO_5_CFG +__A5O_5_CFG ~~~~ ## API: al_get_system_id @@ -229,7 +229,7 @@ Returns the platform that Allegro is running on. Since: 5.2.5 -See also: [ALLEGRO_SYSTEM_ID] +See also: [A5O_SYSTEM_ID] ## API: al_register_assert_handler @@ -296,19 +296,19 @@ This function may be called prior to [al_install_system] or [al_init]. Since: 5.1.12 -## API: ALLEGRO_SYSTEM_ID +## API: A5O_SYSTEM_ID The system Allegro is running on. -* ALLEGRO_SYSTEM_ID_UNKNOWN - Unknown system. -* ALLEGRO_SYSTEM_ID_XGLX - Xglx -* ALLEGRO_SYSTEM_ID_WINDOWS - Windows -* ALLEGRO_SYSTEM_ID_MACOSX - macOS -* ALLEGRO_SYSTEM_ID_ANDROID - Android -* ALLEGRO_SYSTEM_ID_IPHONE - iOS -* ALLEGRO_SYSTEM_ID_GP2XWIZ - GP2XWIZ -* ALLEGRO_SYSTEM_ID_RASPBERRYPI - Raspberry Pi -* ALLEGRO_SYSTEM_ID_SDL - SDL +* A5O_SYSTEM_ID_UNKNOWN - Unknown system. +* A5O_SYSTEM_ID_XGLX - Xglx +* A5O_SYSTEM_ID_WINDOWS - Windows +* A5O_SYSTEM_ID_MACOSX - macOS +* A5O_SYSTEM_ID_ANDROID - Android +* A5O_SYSTEM_ID_IPHONE - iOS +* A5O_SYSTEM_ID_GP2XWIZ - GP2XWIZ +* A5O_SYSTEM_ID_RASPBERRYPI - Raspberry Pi +* A5O_SYSTEM_ID_SDL - SDL Since: 5.2.5 diff --git a/docs/src/refman/threads.txt b/docs/src/refman/threads.txt index 05e5fc7ec0..9e0788c481 100644 --- a/docs/src/refman/threads.txt +++ b/docs/src/refman/threads.txt @@ -15,19 +15,19 @@ These functions are declared in the main Allegro header file: ~~~~ -## API: ALLEGRO_THREAD +## API: A5O_THREAD An opaque structure representing a thread. -## API: ALLEGRO_MUTEX +## API: A5O_MUTEX An opaque structure representing a mutex. -## API: ALLEGRO_COND +## API: A5O_COND An opaque structure representing a condition variable. diff --git a/docs/src/refman/time.txt b/docs/src/refman/time.txt index ab55a399ec..dc18922d3d 100644 --- a/docs/src/refman/time.txt +++ b/docs/src/refman/time.txt @@ -6,7 +6,7 @@ These functions are declared in the main Allegro header file: #include ~~~~ -## API: ALLEGRO_TIMEOUT +## API: A5O_TIMEOUT Represent a timeout value. The size of the structure is known so it can be statically allocated. The contents are private. @@ -26,7 +26,7 @@ Set timeout value of some number of seconds after the function call. For compatibility with all platforms, `seconds` must be 2,147,483.647 seconds or less. -See also: [ALLEGRO_TIMEOUT], [al_wait_for_event_until] +See also: [A5O_TIMEOUT], [al_wait_for_event_until] ## API: al_rest diff --git a/docs/src/refman/timer.txt b/docs/src/refman/timer.txt index 3d57284f23..a571632b15 100644 --- a/docs/src/refman/timer.txt +++ b/docs/src/refman/timer.txt @@ -6,23 +6,23 @@ These functions are declared in the main Allegro header file: #include ~~~~ -## API: ALLEGRO_TIMER +## API: A5O_TIMER This is an abstract data type representing a timer object. -## API: ALLEGRO_USECS_TO_SECS +## API: A5O_USECS_TO_SECS Convert microseconds to seconds. -## API: ALLEGRO_MSECS_TO_SECS +## API: A5O_MSECS_TO_SECS Convert milliseconds to seconds. -## API: ALLEGRO_BPS_TO_SECS +## API: A5O_BPS_TO_SECS Convert beats per second to seconds. -## API: ALLEGRO_BPM_TO_SECS +## API: A5O_BPM_TO_SECS Convert beats per minute to seconds. @@ -31,7 +31,7 @@ Convert beats per minute to seconds. Allocates and initializes a timer. If successful, a pointer to a new timer object is returned, otherwise NULL is returned. *speed_secs* is in seconds per "tick", and must be positive. The new timer is initially stopped and needs to -be started with [al_start_timer] before [ALLEGRO_EVENT_TIMER] events are sent. +be started with [al_start_timer] before [A5O_EVENT_TIMER] events are sent. Usage note: typical granularity is on the order of microseconds, but with some drivers might only be milliseconds. @@ -126,4 +126,4 @@ See also: [al_get_timer_speed] ## API: al_get_timer_event_source Retrieve the associated event source. Timers will generate events of -type [ALLEGRO_EVENT_TIMER]. +type [A5O_EVENT_TIMER]. diff --git a/docs/src/refman/touch.txt b/docs/src/refman/touch.txt index 950a25b402..00718bdc4c 100644 --- a/docs/src/refman/touch.txt +++ b/docs/src/refman/touch.txt @@ -6,19 +6,19 @@ These functions are declared in the main Allegro header file: #include ~~~~ -## API: ALLEGRO_TOUCH_INPUT +## API: A5O_TOUCH_INPUT An abstract data type representing a physical touch screen or touch pad. Since: 5.1.0 -## API: ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT +## API: A5O_TOUCH_INPUT_MAX_TOUCH_COUNT The maximum amount of simultaneous touches that can be detected. Since: 5.1.0 -## API: ALLEGRO_TOUCH_STATE +## API: A5O_TOUCH_STATE This is a structure that is used to hold a "snapshot" of a touch at a particular instant. @@ -31,38 +31,38 @@ Public fields (read only): * dx - touch relative x position * dy - touch relative y position * primary - TRUE if this touch is the primary one (usually the first one). -* display - The [ALLEGRO_DISPLAY] that was touched. +* display - The [A5O_DISPLAY] that was touched. Since: 5.1.0 -## API: ALLEGRO_TOUCH_INPUT_STATE +## API: A5O_TOUCH_INPUT_STATE This is a structure that holds a snapshot of all simultaneous touches at a particular instant. Public fields (read only): -* touches - an array of [ALLEGRO_TOUCH_STATE] +* touches - an array of [A5O_TOUCH_STATE] Since: 5.1.0 -## API: ALLEGRO_MOUSE_EMULATION_MODE +## API: A5O_MOUSE_EMULATION_MODE Type of mouse emulation to apply. -ALLEGRO_MOUSE_EMULATION_NONE +A5O_MOUSE_EMULATION_NONE : Disables mouse emulation. -ALLEGRO_MOUSE_EMULATION_TRANSPARENT +A5O_MOUSE_EMULATION_TRANSPARENT : Enables transparent mouse emulation. -ALLEGRO_MOUSE_EMULATION_INCLUSIVE +A5O_MOUSE_EMULATION_INCLUSIVE : Enable inclusive mouse emulation. -ALLEGRO_MOUSE_EMULATION_EXCLUSIVE +A5O_MOUSE_EMULATION_EXCLUSIVE : Enables exclusive mouse emulation. -ALLEGRO_MOUSE_EMULATION_5_0_x +A5O_MOUSE_EMULATION_5_0_x : Enables mouse emulation that is backwards compatible with Allegro 5.0.x. Since: 5.1.0 @@ -99,7 +99,7 @@ Since: 5.1.0 ## API: al_get_touch_input_state Gets the current touch input state. The touch information is copied into the -[ALLEGRO_TOUCH_INPUT_STATE] you provide to this function. +[A5O_TOUCH_INPUT_STATE] you provide to this function. Since: 5.1.0 @@ -112,7 +112,7 @@ Since: 5.1.0 > *[Unstable API]:* Seems of limited value, as touch input tends to have different semantics compared to mouse input. -See also: [ALLEGRO_MOUSE_EMULATION_MODE], [al_get_mouse_emulation_mode]. +See also: [A5O_MOUSE_EMULATION_MODE], [al_get_mouse_emulation_mode]. ## API: al_get_mouse_emulation_mode @@ -124,24 +124,24 @@ Since: 5.1.0 > *[Unstable API]:* Seems of limited value, as touch input tends to have different semantics compared to mouse input. -See also: [ALLEGRO_MOUSE_EMULATION_MODE], [al_set_mouse_emulation_mode]. +See also: [A5O_MOUSE_EMULATION_MODE], [al_set_mouse_emulation_mode]. ## API: al_get_touch_input_event_source Returns the global touch input event source. This event source generates -[touch input events][ALLEGRO_EVENT_TOUCH_BEGIN]. +[touch input events][A5O_EVENT_TOUCH_BEGIN]. Since: 5.1.0 -See also: [ALLEGRO_EVENT_SOURCE], [al_register_event_source] +See also: [A5O_EVENT_SOURCE], [al_register_event_source] ## API: al_get_touch_input_mouse_emulation_event_source Returns the global touch input event source for emulated mouse events. -This event source generates [emulated mouse events][ALLEGRO_EVENT_MOUSE_AXES] +This event source generates [emulated mouse events][A5O_EVENT_MOUSE_AXES] that are based on touch events. -See also: [ALLEGRO_EVENT_SOURCE], [al_register_event_source] +See also: [A5O_EVENT_SOURCE], [al_register_event_source] Since: 5.1.0 diff --git a/docs/src/refman/transformations.txt b/docs/src/refman/transformations.txt index 39e8e986c6..9db860dc2d 100644 --- a/docs/src/refman/transformations.txt +++ b/docs/src/refman/transformations.txt @@ -87,7 +87,7 @@ al_translate_transform(&T, 100, 0); al_use_transform(&T); ~~~~ -## API: ALLEGRO_TRANSFORM +## API: A5O_TRANSFORM Defines the generic transformation type, a 4x4 matrix. 2D transforms use only a small subsection of this matrix, namely the top left 2x2 matrix, and the @@ -123,7 +123,7 @@ safe to pass references to local variables. ~~~~c void setup_my_transformation(void) { - ALLEGRO_TRANSFORM transform; + A5O_TRANSFORM transform; al_translate_transform(&transform, 5, 10); al_use_transform(&transform); } @@ -154,7 +154,7 @@ transformation. To return default behavior, call this function with an orthographic transform like so: ~~~~c -ALLEGRO_TRANSFORM trans; +A5O_TRANSFORM trans; al_identity_transform(&trans); al_orthographic_transform(&trans, 0, 0, -1.0, al_get_bitmap_width(bitmap), al_get_bitmap_height(bitmap), 1.0); @@ -281,7 +281,7 @@ transformation. Use [al_use_transform] on an identity transformation to return to the default. ~~~~c -ALLEGRO_TRANSFORM t; +A5O_TRANSFORM t; al_identity_transform(&t); al_use_transform(&t); ~~~~ @@ -457,11 +457,11 @@ y = h / 2 - y * h / 2 Example: ~~~~c -ALLEGRO_TRANSFORM t2; +A5O_TRANSFORM t2; al_copy_transform(&t2, al_get_current_transform()); al_compose_transform(&t2, al_get_current_projection_transform()); -ALLEGRO_TRANSFORM t3; +A5O_TRANSFORM t3; al_identity_transform(&t3); al_scale_transform(&t3, 0.5, -0.5); al_translate_transform(&t3, 0.5, 0.5); @@ -539,11 +539,11 @@ Example 1: ~~~~c float w = 800, h = 450; // assume our display is 800 x 450 - float fov = tan(90 * ALLEGRO_PI / 180 / 2); // 90 degree field of view + float fov = tan(90 * A5O_PI / 180 / 2); // 90 degree field of view // Our projection goes from 0/0 to w/h with the near parameter set // for a 90 degree horizontal viewing angle. - ALLEGRO_TRANSFORM projection; + A5O_TRANSFORM projection; al_identity_transform(&projection); al_perspective_transform(&projection, 0, 0, w / 2 / fov, @@ -552,7 +552,7 @@ Example 1: al_use_projection_transform(&projection); // Set the camera z to +400 (which is exactly the near distance) - ALLEGRO_TRANSFORM camera; + A5O_TRANSFORM camera; al_build_camera_transform(&camera, 0, 0, 400, 0, 0, 0, 0, 1, 0); al_use_transform(&camera); @@ -567,7 +567,7 @@ Example 2: ~~~~c float w = 800, h = 450; // assume our display is 800 x 450 - float fov = tan(90 * ALLEGRO_PI / 180 / 2); // 90 degree field of view + float fov = tan(90 * A5O_PI / 180 / 2); // 90 degree field of view float aspect = h / w; float zoom = 2; // enlarge x 2 @@ -576,7 +576,7 @@ Example 2: // the y axis goes from -1 at the bottom to +1 at the top, scaled by // the aspect ratio. We also add a zoom parameter so we can control // the visible portion of the scene independent of the field of view. - ALLEGRO_TRANSFORM projection; + A5O_TRANSFORM projection; al_identity_transform(&projection); al_perspective_transform(&projection, -1 / zoom, aspect / zoom, @@ -586,7 +586,7 @@ Example 2: al_use_projection_transform(&projection); // Moves everything by -4 in the z direction. - ALLEGRO_TRANSFORM camera; + A5O_TRANSFORM camera; al_build_camera_transform(&camera, 0, 0, 4, 0, 0, 0, 0, 1, 0); al_use_transform(&camera); diff --git a/docs/src/refman/utf8.txt b/docs/src/refman/utf8.txt index 58c455903f..e56b98a5d6 100644 --- a/docs/src/refman/utf8.txt +++ b/docs/src/refman/utf8.txt @@ -78,7 +78,7 @@ unit (byte) or code point indices. In general, all position parameters are in code unit offsets. This may be surprising, but if you think about it, it is required for good performance. (It also means some functions will work even if they do not contain UTF-8, since they only care about storing bytes, so -you may actually store arbitrary data in the ALLEGRO_USTRs.) +you may actually store arbitrary data in the A5O_USTRs.) For actual text processing, where you want to specify positions with code point indices, you should use [al_ustr_offset] to find the code unit offset position. @@ -87,17 +87,17 @@ However, most of the time you would probably just work with byte offsets. ## UTF-8 string types -### API: ALLEGRO_USTR +### API: A5O_USTR -An opaque type representing a string. ALLEGRO_USTRs normally contain UTF-8 +An opaque type representing a string. A5O_USTRs normally contain UTF-8 encoded strings, but they may be used to hold any byte sequences, including NULs. -### API: ALLEGRO_USTR_INFO +### API: A5O_USTR_INFO -A type that holds additional information for an [ALLEGRO_USTR] that references -an external memory buffer. You can convert it back to [ALLEGRO_USTR] via +A type that holds additional information for an [A5O_USTR] that references +an external memory buffer. You can convert it back to [A5O_USTR] via [al_ref_info]. See also: [al_ref_cstr], [al_ref_buffer], [al_ref_info] and [al_ref_ustr]. @@ -128,8 +128,8 @@ Create a new string using a printf-style format string. *Notes:* -The "%s" specifier takes C string arguments, not ALLEGRO_USTRs. Therefore to -pass an ALLEGRO_USTR as a parameter you must use [al_cstr], and it must be NUL +The "%s" specifier takes C string arguments, not A5O_USTRs. Therefore to +pass an A5O_USTR as a parameter you must use [al_cstr], and it must be NUL terminated. If the string contains an embedded NUL byte everything from that byte onwards will be ignored. @@ -153,19 +153,19 @@ See also: [al_ustr_new], [al_ustr_new_from_buffer], [al_ustr_newf] ### API: al_cstr Get a `char *` pointer to the data in a string. This pointer will only be -valid while the [ALLEGRO_USTR] object is not modified and not destroyed. +valid while the [A5O_USTR] object is not modified and not destroyed. The pointer may be passed to functions expecting C-style strings, with the following caveats: -* ALLEGRO_USTRs are allowed to contain embedded NUL (`'\0'`) bytes. +* A5O_USTRs are allowed to contain embedded NUL (`'\0'`) bytes. That means `al_ustr_size(u)` and `strlen(al_cstr(u))` may not agree. -* An ALLEGRO_USTR may be created in such a way that it is not NUL terminated. +* An A5O_USTR may be created in such a way that it is not NUL terminated. A string which is dynamically allocated will always be NUL terminated, but a string which references the middle of another string or region of memory will *not* be NUL terminated. -* If the ALLEGRO_USTR references another string, the returned C string will +* If the A5O_USTR references another string, the returned C string will point into the referenced string. Again, no NUL terminator will be added to the referenced string. @@ -233,8 +233,8 @@ The string is valid until the underlying C string disappears. Example: ~~~~c -ALLEGRO_USTR_INFO info; -ALLEGRO_USTR *us = al_ref_cstr(&info, "my string"); +A5O_USTR_INFO info; +A5O_USTR *us = al_ref_cstr(&info, "my string"); ~~~~ See also: [al_ref_buffer], [al_ref_ustr] @@ -254,7 +254,7 @@ See also: [al_ref_cstr], [al_ref_ustr] ### API: al_ref_ustr Create a read-only string that references the storage of another -[ALLEGRO_USTR] string. +[A5O_USTR] string. The information about the string (e.g. its size) is stored in the structure pointed to by the `info` parameter. The new string will not have any other storage allocated of its own, so if you allocate the `info` structure on the @@ -272,8 +272,8 @@ See also: [al_ref_cstr], [al_ref_buffer] ### API: al_ref_info -Create a read-only string that references the storage of another [ALLEGRO_USTR] -string that has already been stored in the [ALLEGRO_USTR_INFO] structure. +Create a read-only string that references the storage of another [A5O_USTR] +string that has already been stored in the [A5O_USTR_INFO] structure. The string is valid until the underlying string is modified or destroyed. @@ -419,7 +419,7 @@ Returns true on success, false on error. This function can be used to append an arbitrary buffer: ~~~~c - ALLEGRO_USTR_INFO info; + A5O_USTR_INFO info; al_ustr_append(us, al_ref_buffer(&info, buf, size)); ~~~~ diff --git a/docs/src/refman/video.txt b/docs/src/refman/video.txt index e2bd61a246..6adff41e46 100644 --- a/docs/src/refman/video.txt +++ b/docs/src/refman/video.txt @@ -10,51 +10,51 @@ Link with allegro_video. Currently we have an Ogg backend (Theora + Vorbis). See for installation instructions, licensing information and supported video formats. -## API: ALLEGRO_VIDEO_EVENT_TYPE +## API: A5O_VIDEO_EVENT_TYPE Events sent by [al_get_video_event_source]. -### ALLEGRO_EVENT_VIDEO_FRAME_SHOW +### A5O_EVENT_VIDEO_FRAME_SHOW This event is sent when it is time to show a new frame. Once you receive this event, you can draw the current frame (as returned by [al_get_video_frame]). [al_get_video_frame] will continue returning the same frame until the next -ALLEGRO_EVENT_VIDEO_FRAME_SHOW is sent. +A5O_EVENT_VIDEO_FRAME_SHOW is sent. -user.data1 (ALLEGRO_VIDEO *) +user.data1 (A5O_VIDEO *) : The video which generated the event. Since: 5.1.0 -### ALLEGRO_EVENT_VIDEO_FINISHED +### A5O_EVENT_VIDEO_FINISHED This event is sent when the video is finished. Depending on the backend, it may be possible to seek to an earlier part of the video and set the video to play to resume playback. -user.data1 (ALLEGRO_VIDEO *) +user.data1 (A5O_VIDEO *) : The video which generated the event. Since: 5.1.0 -## API: ALLEGRO_VIDEO_POSITION_TYPE +## API: A5O_VIDEO_POSITION_TYPE Used with [al_get_video_position] to specify which position to retrieve. If these get out of sync, audio and video may be out of sync in the display of the video. -* ALLEGRO_VIDEO_POSITION_ACTUAL - +* A5O_VIDEO_POSITION_ACTUAL - The amount of time the video has been playing. If the video has audio then -this value can be ahead of ALLEGRO_VIDEO_POSITION_VIDEO_DECODE when video +this value can be ahead of A5O_VIDEO_POSITION_VIDEO_DECODE when video decoding lags. -* ALLEGRO_VIDEO_POSITION_VIDEO_DECODE - +* A5O_VIDEO_POSITION_VIDEO_DECODE - The amount of video that has been decoded. This may lag behind the "actual" and audio positions if decoding is slower than realtime. -* ALLEGRO_VIDEO_POSITION_AUDIO_DECODE - +* A5O_VIDEO_POSITION_AUDIO_DECODE - The amount of audio that has been decoded. This may be the same as -ALLEGRO_VIDEO_POSITION_ACTUAL if audio decode is driving the position, +A5O_VIDEO_POSITION_ACTUAL if audio decode is driving the position, which is common to keep audio and video in sync. Since: 5.1.11 @@ -105,7 +105,7 @@ See also: [al_init_video_addon], [al_identify_video_f] ## API: al_identify_video_f -Tries to guess the video file type of the open ALLEGRO_FILE by +Tries to guess the video file type of the open A5O_FILE by reading the first few bytes. By default Allegro cannot recognize any file types, but calling [al_init_video_addon] will add detection of the types it can read. @@ -140,7 +140,7 @@ Since: 5.1.0 ## API: al_get_video_event_source Get an event source for the video. The possible events are described -under [ALLEGRO_VIDEO_EVENT_TYPE]. +under [A5O_VIDEO_EVENT_TYPE]. Since: 5.1.0 @@ -200,7 +200,7 @@ frame would be using code like this: ~~~~c float scale = 1.0; /* Adjust this to fit your target bitmap dimensions. */ -ALLEGRO_BITMAP* frame = al_get_video_frame(video); +A5O_BITMAP* frame = al_get_video_frame(video); float sw = al_get_bitmap_width(frame); float sh = al_get_bitmap_height(frame); float dw = scale * al_get_video_scaled_width(video); @@ -215,7 +215,7 @@ See also: [al_get_video_scaled_width], [al_get_video_scaled_height] ## API: al_get_video_position Returns the current position of the video stream in seconds since the -beginning. The parameter is one of the [ALLEGRO_VIDEO_POSITION_TYPE] +beginning. The parameter is one of the [A5O_VIDEO_POSITION_TYPE] constants. Since: 5.1.0 diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 087b05b066..a43ae2964e 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -213,7 +213,7 @@ if(SUPPORT_OPENGL AND NOT SUPPORT_OPENGLES) example(ex_opengl) example(ex_opengl_pixel_shader ${IMAGE}) endif() -if(SUPPORT_OPENGL AND NOT IPHONE AND NOT ALLEGRO_RASPBERRYPI) +if(SUPPORT_OPENGL AND NOT IPHONE AND NOT A5O_RASPBERRYPI) example(ex_palette ${IMAGE} ${COLOR} ${DATA_IMAGES} ${DATA_SHADERS}) endif() diff --git a/examples/Helper.cmake b/examples/Helper.cmake index 70f26e1a98..e9e1280498 100644 --- a/examples/Helper.cmake +++ b/examples/Helper.cmake @@ -34,9 +34,9 @@ function(example name) # Prepend the base libraries. if(ANDROID) - set(libs ${ALLEGRO_LINK_WITH} ${libs}) + set(libs ${A5O_LINK_WITH} ${libs}) else() - set(libs ${ALLEGRO_LINK_WITH} ${ALLEGRO_MAIN_LINK_WITH} ${libs}) + set(libs ${A5O_LINK_WITH} ${A5O_MAIN_LINK_WITH} ${libs}) endif() # Popup error messages. @@ -46,7 +46,7 @@ function(example name) # Monolith contains all other libraries which were enabled. if(WANT_MONOLITH) - set(libs ${ALLEGRO_MONOLITH_LINK_WITH}) + set(libs ${A5O_MONOLITH_LINK_WITH}) endif() # Append the extra, non-Allegro libraries. diff --git a/examples/common.c b/examples/common.c index ff4f9eaaa1..08267dec43 100644 --- a/examples/common.c +++ b/examples/common.c @@ -1,7 +1,7 @@ #include #include -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID #include "allegro5/allegro_android.h" #endif @@ -14,23 +14,23 @@ void log_printf(char const *format, ...); void init_platform_specific(void) { -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID al_install_touch_input(); al_android_set_apk_file_interface(); #endif } -#ifdef ALLEGRO_POPUP_EXAMPLES +#ifdef A5O_POPUP_EXAMPLES #include "allegro5/allegro_native_dialog.h" -ALLEGRO_TEXTLOG *textlog = NULL; +A5O_TEXTLOG *textlog = NULL; void abort_example(char const *format, ...) { char str[1024]; va_list args; - ALLEGRO_DISPLAY *display; + A5O_DISPLAY *display; va_start(args, format); vsnprintf(str, sizeof str, format, args); @@ -56,14 +56,14 @@ void open_log(void) void open_log_monospace(void) { if (al_init_native_dialog_addon()) { - textlog = al_open_native_text_log("Log", ALLEGRO_TEXTLOG_MONOSPACE); + textlog = al_open_native_text_log("Log", A5O_TEXTLOG_MONOSPACE); } } void close_log(bool wait_for_user) { if (textlog && wait_for_user) { - ALLEGRO_EVENT_QUEUE *queue = al_create_event_queue(); + A5O_EVENT_QUEUE *queue = al_create_event_queue(); al_register_event_source(queue, al_get_native_text_log_event_source( textlog)); al_wait_for_event(queue, NULL); @@ -112,10 +112,10 @@ void log_printf(char const *format, ...) { va_list args; va_start(args, format); - #ifdef ALLEGRO_ANDROID + #ifdef A5O_ANDROID char x[1024]; vsnprintf(x, sizeof x, format, args); - ALLEGRO_TRACE_CHANNEL_LEVEL("log", 1)("%s", x); + A5O_TRACE_CHANNEL_LEVEL("log", 1)("%s", x); #else vprintf(format, args); #endif diff --git a/examples/enet_common.h b/examples/enet_common.h index 4b56b4f912..81472f7192 100644 --- a/examples/enet_common.h +++ b/examples/enet_common.h @@ -33,7 +33,7 @@ typedef struct MESSAGE_TYPE type; int x; // current position (x) int y; // current position (y) - ALLEGRO_COLOR color; // valid when type == PLAYER_JOIN + A5O_COLOR color; // valid when type == PLAYER_JOIN } ServerMessage; // storage for all players @@ -42,7 +42,7 @@ struct bool active; int x, y; // current position int dx, dy; // direction of movemnt - ALLEGRO_COLOR color; + A5O_COLOR color; } players[MAX_PLAYER_COUNT]; #endif diff --git a/examples/ex_acodec.c b/examples/ex_acodec.c index 3b1b394d25..0850930ab8 100644 --- a/examples/ex_acodec.c +++ b/examples/ex_acodec.c @@ -4,7 +4,7 @@ * Originlly derived from the audio example on the wiki. */ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include "allegro5/allegro.h" @@ -15,9 +15,9 @@ int main(int argc, char **argv) { - ALLEGRO_VOICE *voice; - ALLEGRO_MIXER *mixer; - ALLEGRO_SAMPLE_INSTANCE *sample; + A5O_VOICE *voice; + A5O_MIXER *mixer; + A5O_SAMPLE_INSTANCE *sample; int i; char const **filenames; int n; @@ -47,14 +47,14 @@ int main(int argc, char **argv) abort_example("Could not init sound!\n"); } - voice = al_create_voice(44100, ALLEGRO_AUDIO_DEPTH_INT16, - ALLEGRO_CHANNEL_CONF_2); + voice = al_create_voice(44100, A5O_AUDIO_DEPTH_INT16, + A5O_CHANNEL_CONF_2); if (!voice) { - abort_example("Could not create ALLEGRO_VOICE.\n"); + abort_example("Could not create A5O_VOICE.\n"); } - mixer = al_create_mixer(44100, ALLEGRO_AUDIO_DEPTH_FLOAT32, - ALLEGRO_CHANNEL_CONF_2); + mixer = al_create_mixer(44100, A5O_AUDIO_DEPTH_FLOAT32, + A5O_CHANNEL_CONF_2); if (!mixer) { abort_example("al_create_mixer failed.\n"); } @@ -69,7 +69,7 @@ int main(int argc, char **argv) } for (i = 0; i < n; ++i) { - ALLEGRO_SAMPLE *sample_data = NULL; + A5O_SAMPLE *sample_data = NULL; const char *filename = filenames[i]; float sample_time = 0; /* A matrix that puts everything in the left channel. */ @@ -94,7 +94,7 @@ int main(int argc, char **argv) } /* Play sample in looping mode. */ - al_set_sample_instance_playmode(sample, ALLEGRO_PLAYMODE_LOOP); + al_set_sample_instance_playmode(sample, A5O_PLAYMODE_LOOP); al_play_sample_instance(sample); sample_time = al_get_sample_instance_time(sample); diff --git a/examples/ex_acodec_multi.c b/examples/ex_acodec_multi.c index 1b88c3c7e5..e3a954666f 100644 --- a/examples/ex_acodec_multi.c +++ b/examples/ex_acodec_multi.c @@ -18,10 +18,10 @@ char *default_files[] = {NULL, "data/welcome.voc", int main(int argc, char **argv) { int i; - ALLEGRO_SAMPLE **sample_data; - ALLEGRO_SAMPLE_INSTANCE **sample; - ALLEGRO_MIXER *mixer; - ALLEGRO_VOICE *voice; + A5O_SAMPLE **sample_data; + A5O_SAMPLE_INSTANCE **sample; + A5O_MIXER *mixer; + A5O_VOICE *voice; float longest_sample; if (!al_init()) { @@ -53,14 +53,14 @@ int main(int argc, char **argv) } /* a voice is used for playback */ - voice = al_create_voice(44100, ALLEGRO_AUDIO_DEPTH_INT16, - ALLEGRO_CHANNEL_CONF_2); + voice = al_create_voice(44100, A5O_AUDIO_DEPTH_INT16, + A5O_CHANNEL_CONF_2); if (!voice) { - abort_example("Could not create ALLEGRO_VOICE from sample\n"); + abort_example("Could not create A5O_VOICE from sample\n"); } - mixer = al_create_mixer(44100, ALLEGRO_AUDIO_DEPTH_FLOAT32, - ALLEGRO_CHANNEL_CONF_2); + mixer = al_create_mixer(44100, A5O_AUDIO_DEPTH_FLOAT32, + A5O_CHANNEL_CONF_2); if (!mixer) { abort_example("al_create_mixer failed.\n"); } diff --git a/examples/ex_android.c b/examples/ex_android.c index 69804383a4..e0e3bdb22a 100644 --- a/examples/ex_android.c +++ b/examples/ex_android.c @@ -1,11 +1,11 @@ #include #include #include -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID #include /* al_android_set_apk_file_interface */ #endif -ALLEGRO_DEBUG_CHANNEL("main") +A5O_DEBUG_CHANNEL("main") #define MAX_TOUCH 10 @@ -17,19 +17,19 @@ struct touch { /* debugging */ #define print_standard_path(std) \ do { \ - ALLEGRO_PATH *path = al_get_standard_path(std); \ - ALLEGRO_DEBUG(#std ": %s", al_path_cstr(path, '/')); \ + A5O_PATH *path = al_get_standard_path(std); \ + A5O_DEBUG(#std ": %s", al_path_cstr(path, '/')); \ } while (0) static void print_standard_paths(void) { - print_standard_path(ALLEGRO_RESOURCES_PATH); - print_standard_path(ALLEGRO_TEMP_PATH); - print_standard_path(ALLEGRO_USER_DATA_PATH); - print_standard_path(ALLEGRO_USER_HOME_PATH); - print_standard_path(ALLEGRO_USER_SETTINGS_PATH); - print_standard_path(ALLEGRO_USER_DOCUMENTS_PATH); - print_standard_path(ALLEGRO_EXENAME_PATH); + print_standard_path(A5O_RESOURCES_PATH); + print_standard_path(A5O_TEMP_PATH); + print_standard_path(A5O_USER_DATA_PATH); + print_standard_path(A5O_USER_HOME_PATH); + print_standard_path(A5O_USER_SETTINGS_PATH); + print_standard_path(A5O_USER_DOCUMENTS_PATH); + print_standard_path(A5O_EXENAME_PATH); } static void draw_touches(void) @@ -48,59 +48,59 @@ static void draw_touches(void) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *dpy; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; - ALLEGRO_TIMER *timer; - ALLEGRO_BITMAP *image; - ALLEGRO_BITMAP *image2; + A5O_DISPLAY *dpy; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; + A5O_TIMER *timer; + A5O_BITMAP *image; + A5O_BITMAP *image2; (void) argc; (void) argv; - ALLEGRO_DEBUG("init allegro!"); + A5O_DEBUG("init allegro!"); if (!al_init()) { return 1; } - ALLEGRO_DEBUG("init primitives"); + A5O_DEBUG("init primitives"); al_init_primitives_addon(); - ALLEGRO_DEBUG("init image addon"); + A5O_DEBUG("init image addon"); al_init_image_addon(); - ALLEGRO_DEBUG("init touch input"); + A5O_DEBUG("init touch input"); al_install_touch_input(); - ALLEGRO_DEBUG("init keyboard"); + A5O_DEBUG("init keyboard"); al_install_keyboard(); - ALLEGRO_DEBUG("creating display"); + A5O_DEBUG("creating display"); dpy = al_create_display(800, 480); if (!dpy) { - ALLEGRO_ERROR("failed to create display!"); + A5O_ERROR("failed to create display!"); return 1; } print_standard_paths(); /* This is loaded from assets in the apk. */ - #ifdef ALLEGRO_ANDROID + #ifdef A5O_ANDROID al_android_set_apk_file_interface(); #endif image = al_load_bitmap("data/alexlogo.png"); if (!image) { - ALLEGRO_DEBUG("failed to load alexlogo.png"); + A5O_DEBUG("failed to load alexlogo.png"); return 1; } - #ifdef ALLEGRO_ANDROID + #ifdef A5O_ANDROID /* Copy the .png from the .apk into the user data area. */ - ALLEGRO_FILE *fin = al_fopen("data/alexlogo.png", "rb"); + A5O_FILE *fin = al_fopen("data/alexlogo.png", "rb"); al_set_standard_file_interface(); - ALLEGRO_PATH *path = al_get_standard_path(ALLEGRO_USER_DATA_PATH); + A5O_PATH *path = al_get_standard_path(A5O_USER_DATA_PATH); al_set_path_filename(path, "alexlogo.png"); - ALLEGRO_FILE *fout = al_fopen(al_path_cstr(path, '/'), "wb"); + A5O_FILE *fout = al_fopen(al_path_cstr(path, '/'), "wb"); while (!al_feof(fin)) { char buf[1024]; int n = al_fread(fin, buf, 1024); @@ -141,77 +141,77 @@ int main(int argc, char **argv) al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_TOUCH_BEGIN: - //ALLEGRO_DEBUG("touch %i begin", event.touch.id); + case A5O_EVENT_TOUCH_BEGIN: + //A5O_DEBUG("touch %i begin", event.touch.id); touch[event.touch.id].down = true; touch[event.touch.id].x = event.touch.x; touch[event.touch.id].y = event.touch.y; break; - case ALLEGRO_EVENT_TOUCH_END: - //ALLEGRO_DEBUG("touch %i end", event.touch.id); + case A5O_EVENT_TOUCH_END: + //A5O_DEBUG("touch %i end", event.touch.id); touch[event.touch.id].down = false; touch[event.touch.id].x = 0.0; touch[event.touch.id].y = 0.0; break; - case ALLEGRO_EVENT_TOUCH_MOVE: - //ALLEGRO_DEBUG("touch %i move: %fx%f", event.touch.id, event.touch.x, event.touch.y); + case A5O_EVENT_TOUCH_MOVE: + //A5O_DEBUG("touch %i move: %fx%f", event.touch.id, event.touch.x, event.touch.y); touch[event.touch.id].x = event.touch.x; touch[event.touch.id].y = event.touch.y; break; - case ALLEGRO_EVENT_TOUCH_CANCEL: - //ALLEGRO_DEBUG("touch %i canceled", event.touch.id); + case A5O_EVENT_TOUCH_CANCEL: + //A5O_DEBUG("touch %i canceled", event.touch.id); break; - case ALLEGRO_EVENT_KEY_UP: - if (event.keyboard.keycode == ALLEGRO_KEY_BACK) { - ALLEGRO_DEBUG("back key pressed, exit!"); + case A5O_EVENT_KEY_UP: + if (event.keyboard.keycode == A5O_KEY_BACK) { + A5O_DEBUG("back key pressed, exit!"); running = false; } else { - ALLEGRO_DEBUG("%i key pressed", event.keyboard.keycode); + A5O_DEBUG("%i key pressed", event.keyboard.keycode); } break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: draw = true; if (count == 60) { - ALLEGRO_DEBUG("tick"); + A5O_DEBUG("tick"); count = 0; } count++; break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: - ALLEGRO_DEBUG("display close"); + case A5O_EVENT_DISPLAY_CLOSE: + A5O_DEBUG("display close"); running = false; break; - case ALLEGRO_EVENT_DISPLAY_HALT_DRAWING: - ALLEGRO_DEBUG("halt drawing"); + case A5O_EVENT_DISPLAY_HALT_DRAWING: + A5O_DEBUG("halt drawing"); // Stop the timer so we don't run at all while our display isn't // active. al_stop_timer(timer); - ALLEGRO_DEBUG("after set target"); + A5O_DEBUG("after set target"); draw = false; al_acknowledge_drawing_halt(dpy); break; - case ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING: - ALLEGRO_DEBUG("resume drawing"); + case A5O_EVENT_DISPLAY_RESUME_DRAWING: + A5O_DEBUG("resume drawing"); al_acknowledge_drawing_resume(dpy); - ALLEGRO_DEBUG("done waiting for surface recreated"); + A5O_DEBUG("done waiting for surface recreated"); al_start_timer(timer); break; - case ALLEGRO_EVENT_DISPLAY_RESIZE: - ALLEGRO_DEBUG("display resize"); + case A5O_EVENT_DISPLAY_RESIZE: + A5O_DEBUG("display resize"); al_acknowledge_resize(dpy); - ALLEGRO_DEBUG("done resize"); + A5O_DEBUG("done resize"); break; } @@ -235,7 +235,7 @@ int main(int argc, char **argv) } } - ALLEGRO_DEBUG("done"); + A5O_DEBUG("done"); return 0; } diff --git a/examples/ex_audio_chain.cpp b/examples/ex_audio_chain.cpp index b1581e3e6b..1e2cc17524 100644 --- a/examples/ex_audio_chain.cpp +++ b/examples/ex_audio_chain.cpp @@ -30,12 +30,12 @@ class Sample; class Audiostream; struct Context { - ALLEGRO_FONT *font; - ALLEGRO_COLOR bg; - ALLEGRO_COLOR fg; - ALLEGRO_COLOR fill; - ALLEGRO_COLOR disabled; - ALLEGRO_COLOR highlight; + A5O_FONT *font; + A5O_COLOR bg; + A5O_COLOR fg; + A5O_COLOR fill; + A5O_COLOR disabled; + A5O_COLOR highlight; }; class Element { @@ -90,14 +90,14 @@ class Voice : public Element { bool do_attach(Audiostream & stream); bool do_detach(); - ALLEGRO_VOICE *voice; + A5O_VOICE *voice; }; class Mixer : public Element { public: Mixer(); ~Mixer(); - operator ALLEGRO_MIXER *() const { return mixer; } + operator A5O_MIXER *() const { return mixer; } bool is_playing() const; bool toggle_playing(); float get_gain() const; @@ -109,14 +109,14 @@ class Mixer : public Element { bool do_attach(Audiostream & stream); bool do_detach(); - ALLEGRO_MIXER *mixer; + A5O_MIXER *mixer; }; class SampleInstance : public Element { public: SampleInstance(); ~SampleInstance(); - operator ALLEGRO_SAMPLE_INSTANCE *() const { return splinst; } + operator A5O_SAMPLE_INSTANCE *() const { return splinst; } bool is_playing() const; bool toggle_playing(); float get_gain() const; @@ -126,7 +126,7 @@ class SampleInstance : public Element { private: bool do_detach(); - ALLEGRO_SAMPLE_INSTANCE *splinst; + A5O_SAMPLE_INSTANCE *splinst; Sample const *spl; unsigned pos; }; @@ -135,11 +135,11 @@ class Sample { public: Sample(char const *filename); ~Sample(); - operator ALLEGRO_SAMPLE *() const { return spl; } + operator A5O_SAMPLE *() const { return spl; } bool valid() const; string const& get_filename() const; private: - ALLEGRO_SAMPLE *spl; + A5O_SAMPLE *spl; string filename; }; @@ -147,7 +147,7 @@ class Audiostream : public Element { public: Audiostream(string const& filename); ~Audiostream(); - operator ALLEGRO_AUDIO_STREAM *() const { return stream; } + operator A5O_AUDIO_STREAM *() const { return stream; } bool valid() const; bool is_playing() const; bool toggle_playing(); @@ -157,20 +157,20 @@ class Audiostream : public Element { private: bool do_detach(); - ALLEGRO_AUDIO_STREAM *stream; + A5O_AUDIO_STREAM *stream; string filename; }; /*---------------------------------------------------------------------------*/ -static ALLEGRO_PATH *make_path(char const *str) +static A5O_PATH *make_path(char const *str) { - static ALLEGRO_PATH *dir; - ALLEGRO_PATH *path; + static A5O_PATH *dir; + A5O_PATH *path; if (!dir) { - dir = al_get_standard_path(ALLEGRO_RESOURCES_PATH); -#ifdef ALLEGRO_MSVC + dir = al_get_standard_path(A5O_RESOURCES_PATH); +#ifdef A5O_MSVC { /* Hack to cope automatically with MSVC workspaces. */ const char *last = al_get_path_component(dir, -1); @@ -293,8 +293,8 @@ void Element::draw(Context const& ctx, bool highlight) const draw_arrow(ctx, x2, y2, highlight); } - ALLEGRO_COLOR textcol = ctx.fg; - ALLEGRO_COLOR boxcol = ctx.fg; + A5O_COLOR textcol = ctx.fg; + A5O_COLOR boxcol = ctx.fg; if (highlight) boxcol = ctx.highlight; if (!is_playing()) @@ -306,7 +306,7 @@ void Element::draw(Context const& ctx, bool highlight) const float th = al_get_font_line_height(ctx.font); al_draw_text(ctx.font, textcol, x + w/2, y + h/2 - th/2, - ALLEGRO_ALIGN_CENTRE, get_label()); + A5O_ALIGN_CENTRE, get_label()); float gain = get_gain(); if (gain > 0.0) { @@ -318,7 +318,7 @@ void Element::draw(Context const& ctx, bool highlight) const void Element::draw_arrow(Context const& ctx, float x2, float y2, bool highlight) const { float x1, y1; - ALLEGRO_COLOR col; + A5O_COLOR col; output_point(x1, y1); col = (highlight ? ctx.highlight : ctx.fg); al_draw_line(x1, y1, x2, y2, col, 1.0); @@ -365,8 +365,8 @@ void Element::input_point(float & ox, float & oy) const Voice::Voice() { set_random_pos(); - voice = al_create_voice(44100, ALLEGRO_AUDIO_DEPTH_INT16, - ALLEGRO_CHANNEL_CONF_2); + voice = al_create_voice(44100, A5O_AUDIO_DEPTH_INT16, + A5O_CHANNEL_CONF_2); } Voice::~Voice() @@ -431,8 +431,8 @@ char const *Voice::get_label() const Mixer::Mixer() { set_random_pos(); - mixer = al_create_mixer(44100, ALLEGRO_AUDIO_DEPTH_FLOAT32, - ALLEGRO_CHANNEL_CONF_2); + mixer = al_create_mixer(44100, A5O_AUDIO_DEPTH_FLOAT32, + A5O_CHANNEL_CONF_2); } Mixer::~Mixer() @@ -540,7 +540,7 @@ bool SampleInstance::set_sample(Sample const & spl) bool rc = al_set_sample(splinst, spl); if (rc) { this->spl = &spl; - al_set_sample_instance_playmode(splinst, ALLEGRO_PLAYMODE_LOOP); + al_set_sample_instance_playmode(splinst, A5O_PLAYMODE_LOOP); al_set_sample_instance_playing(splinst, playing); } return rc; @@ -587,7 +587,7 @@ Audiostream::Audiostream(string const& filename) stream = al_load_audio_stream(filename.c_str(), 4, 2048); if (stream) { - al_set_audio_stream_playmode(stream, ALLEGRO_PLAYMODE_LOOP); + al_set_audio_stream_playmode(stream, A5O_PLAYMODE_LOOP); } } @@ -659,8 +659,8 @@ class Prog { void delete_element(Element *elt); void redraw(); - ALLEGRO_DISPLAY *dpy; - ALLEGRO_EVENT_QUEUE *queue; + A5O_DISPLAY *dpy; + A5O_EVENT_QUEUE *queue; Context ctx; vector samples; vector stream_paths; @@ -722,7 +722,7 @@ void Prog::init() void Prog::add_sample(char const *filename) { - ALLEGRO_PATH *path = make_path(filename); + A5O_PATH *path = make_path(filename); Sample *spl = new Sample(al_path_cstr(path, '/')); if (spl) { samples.push_back(spl); @@ -734,7 +734,7 @@ void Prog::add_sample(char const *filename) void Prog::add_stream_path(char const *filename) { - ALLEGRO_PATH *path = make_path(filename); + A5O_PATH *path = make_path(filename); stream_paths.push_back(al_path_cstr(path, '/')); al_destroy_path(path); } @@ -827,18 +827,18 @@ void Prog::run() redraw(); } - ALLEGRO_EVENT ev; + A5O_EVENT ev; al_wait_for_event(queue, &ev); switch (ev.type) { - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: return; - case ALLEGRO_EVENT_MOUSE_BUTTON_DOWN: + case A5O_EVENT_MOUSE_BUTTON_DOWN: process_mouse_button_down(ev.mouse.button, ev.mouse.x, ev.mouse.y); break; - case ALLEGRO_EVENT_MOUSE_BUTTON_UP: + case A5O_EVENT_MOUSE_BUTTON_UP: process_mouse_button_up(ev.mouse.button, ev.mouse.x, ev.mouse.y); break; - case ALLEGRO_EVENT_MOUSE_AXES: + case A5O_EVENT_MOUSE_AXES: if (ev.mouse.dz) { process_mouse_wheel(ev.mouse.dz); } @@ -847,7 +847,7 @@ void Prog::run() ev.mouse.dx, ev.mouse.dy); } break; - case ALLEGRO_EVENT_KEY_CHAR: + case A5O_EVENT_KEY_CHAR: if (ev.keyboard.unichar == 27) { return; } @@ -984,12 +984,12 @@ void Prog::redraw() float y = al_get_display_height(dpy); float th = al_get_font_line_height(ctx.font); - al_draw_textf(ctx.font, ctx.fg, 0, y-th*2, ALLEGRO_ALIGN_LEFT, + al_draw_textf(ctx.font, ctx.fg, 0, y-th*2, A5O_ALIGN_LEFT, "Create [v]oices, [m]ixers, [s]ample instances, [a]udiostreams. " "[SPACE] pause playback. " "[1]-[9] set sample. " "[x] delete."); - al_draw_textf(ctx.font, ctx.fg, 0, y-th*1, ALLEGRO_ALIGN_LEFT, + al_draw_textf(ctx.font, ctx.fg, 0, y-th*1, A5O_ALIGN_LEFT, "Mouse: [LMB] select element. " "[RMB] attach sources to sinks " "(sample->mixer, mixer->mixer, mixer->voice, sample->voice)"); diff --git a/examples/ex_audio_devices.c b/examples/ex_audio_devices.c index 68f8a44b1c..d141a66c45 100644 --- a/examples/ex_audio_devices.c +++ b/examples/ex_audio_devices.c @@ -1,6 +1,6 @@ /* This example lists the available audio devices. */ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include "allegro5/allegro.h" @@ -30,7 +30,7 @@ int main(int argc, char **argv) } for (int i = 0; i < count; i++) { - const ALLEGRO_AUDIO_DEVICE* device = al_get_audio_output_device(i); + const A5O_AUDIO_DEVICE* device = al_get_audio_output_device(i); log_printf("%s\n", al_get_audio_device_name(device)); } diff --git a/examples/ex_audio_props.cpp b/examples/ex_audio_props.cpp index 2462e3e44d..bfeb81e1b5 100644 --- a/examples/ex_audio_props.cpp +++ b/examples/ex_audio_props.cpp @@ -14,9 +14,9 @@ #include "common.c" -ALLEGRO_FONT *font_gui; -ALLEGRO_SAMPLE *sample; -ALLEGRO_SAMPLE_INSTANCE *sample_inst; +A5O_FONT *font_gui; +A5O_SAMPLE *sample; +A5O_SAMPLE_INSTANCE *sample_inst; class Prog { private: @@ -38,12 +38,12 @@ class Prog { Label zero_label; public: - Prog(const Theme & theme, ALLEGRO_DISPLAY *display, unsigned int instance_len); + Prog(const Theme & theme, A5O_DISPLAY *display, unsigned int instance_len); void run(); void update_properties(); }; -Prog::Prog(const Theme & theme, ALLEGRO_DISPLAY *display, unsigned int instance_len) : +Prog::Prog(const Theme & theme, A5O_DISPLAY *display, unsigned int instance_len) : d(Dialog(theme, display, 40, 20)), length_label(Label("Length")), length_slider(HSlider(instance_len, instance_len)), @@ -114,7 +114,7 @@ void Prog::update_properties() if (pan_button.get_pushed()) pan = pan_slider.get_cur_value() / 1000.0f - 1.0f; else - pan = ALLEGRO_AUDIO_PAN_NONE; + pan = A5O_AUDIO_PAN_NONE; al_set_sample_instance_pan(sample_inst, pan); speed = speed_slider.get_cur_value() / 1000.0f; @@ -124,9 +124,9 @@ void Prog::update_properties() al_set_sample_instance_length(sample_inst, length); if (bidir_button.get_pushed()) - al_set_sample_instance_playmode(sample_inst, ALLEGRO_PLAYMODE_BIDIR); + al_set_sample_instance_playmode(sample_inst, A5O_PLAYMODE_BIDIR); else - al_set_sample_instance_playmode(sample_inst, ALLEGRO_PLAYMODE_LOOP); + al_set_sample_instance_playmode(sample_inst, A5O_PLAYMODE_LOOP); al_set_sample_instance_playing(sample_inst, play_button.get_pushed()); @@ -139,7 +139,7 @@ void Prog::update_properties() int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; + A5O_DISPLAY *display; const char *filename; if (argc >= 2) { @@ -173,7 +173,7 @@ int main(int argc, char **argv) abort_example("Could not load sample from '%s'!\n", filename); } - al_set_new_display_flags(ALLEGRO_GENERATE_EXPOSE_EVENTS); + al_set_new_display_flags(A5O_GENERATE_EXPOSE_EVENTS); display = al_create_display(640, 480); if (!display) { abort_example("Unable to create display\n"); @@ -186,7 +186,7 @@ int main(int argc, char **argv) /* Loop the sample. */ sample_inst = al_create_sample_instance(sample); - al_set_sample_instance_playmode(sample_inst, ALLEGRO_PLAYMODE_LOOP); + al_set_sample_instance_playmode(sample_inst, A5O_PLAYMODE_LOOP); al_attach_sample_instance_to_mixer(sample_inst, al_get_default_mixer()); al_play_sample_instance(sample_inst); diff --git a/examples/ex_audio_simple.c b/examples/ex_audio_simple.c index 9a34500e92..9054fa077e 100644 --- a/examples/ex_audio_simple.c +++ b/examples/ex_audio_simple.c @@ -4,7 +4,7 @@ * Demonstrate 'simple' audio interface. */ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include #include "allegro5/allegro.h" @@ -26,15 +26,15 @@ const char *default_files[] = {NULL, "data/welcome.wav", int main(int argc, const char *argv[]) { - ALLEGRO_SAMPLE *sample_data[MAX_SAMPLE_DATA] = {NULL}; - ALLEGRO_DISPLAY *display = NULL; - ALLEGRO_EVENT_QUEUE *event_queue; - ALLEGRO_EVENT event; - ALLEGRO_SAMPLE_ID sample_id; + A5O_SAMPLE *sample_data[MAX_SAMPLE_DATA] = {NULL}; + A5O_DISPLAY *display = NULL; + A5O_EVENT_QUEUE *event_queue; + A5O_EVENT event; + A5O_SAMPLE_ID sample_id; bool sample_id_valid = false; - ALLEGRO_TIMER* timer; - ALLEGRO_FONT* font; - ALLEGRO_AUDIO_STREAM *music = NULL; + A5O_TIMER* timer; + A5O_FONT* font; + A5O_AUDIO_STREAM *music = NULL; int i; bool panning = false; @@ -103,8 +103,8 @@ int main(int argc, const char *argv[]) while (true) { al_wait_for_event(event_queue, &event); - if (event.type == ALLEGRO_EVENT_KEY_CHAR) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_CHAR) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } if (event.keyboard.unichar == ' ') { @@ -115,31 +115,31 @@ int main(int argc, const char *argv[]) } } - if (event.keyboard.keycode >= ALLEGRO_KEY_0 && event.keyboard.keycode <= ALLEGRO_KEY_9) { - bool loop = event.keyboard.modifiers & ALLEGRO_KEYMOD_ALT; - bool bidir = event.keyboard.modifiers & ALLEGRO_KEYMOD_CTRL; - bool reversed = event.keyboard.modifiers & ALLEGRO_KEYMOD_SHIFT; - i = (event.keyboard.keycode - ALLEGRO_KEY_0 + 9) % 10; + if (event.keyboard.keycode >= A5O_KEY_0 && event.keyboard.keycode <= A5O_KEY_9) { + bool loop = event.keyboard.modifiers & A5O_KEYMOD_ALT; + bool bidir = event.keyboard.modifiers & A5O_KEYMOD_CTRL; + bool reversed = event.keyboard.modifiers & A5O_KEYMOD_SHIFT; + i = (event.keyboard.keycode - A5O_KEY_0 + 9) % 10; if (sample_data[i]) { - ALLEGRO_SAMPLE_ID new_sample_id; - ALLEGRO_PLAYMODE playmode; + A5O_SAMPLE_ID new_sample_id; + A5O_PLAYMODE playmode; const char* playmode_str; if (loop) { - playmode = ALLEGRO_PLAYMODE_LOOP; + playmode = A5O_PLAYMODE_LOOP; playmode_str = "on a loop"; } else if (bidir) { - playmode = ALLEGRO_PLAYMODE_BIDIR; + playmode = A5O_PLAYMODE_BIDIR; playmode_str = "on a bidirectional loop"; } else { - playmode = ALLEGRO_PLAYMODE_ONCE; + playmode = A5O_PLAYMODE_ONCE; playmode_str = "once"; } bool ret = al_play_sample(sample_data[i], 1.0, 0.0, 1.0, playmode, &new_sample_id); if (reversed) { - ALLEGRO_SAMPLE_INSTANCE* inst = al_lock_sample_id(&new_sample_id); + A5O_SAMPLE_INSTANCE* inst = al_lock_sample_id(&new_sample_id); al_set_sample_instance_position(inst, al_get_sample_instance_length(inst) - 1); al_set_sample_instance_speed(inst, -1); al_unlock_sample_id(&new_sample_id); @@ -188,14 +188,14 @@ int main(int argc, const char *argv[]) goto Restart; } } - else if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + else if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } - else if (event.type == ALLEGRO_EVENT_TIMER) { + else if (event.type == A5O_EVENT_TIMER) { int y = 12; int dy = 12; if (panning && sample_id_valid) { - ALLEGRO_SAMPLE_INSTANCE* instance = al_lock_sample_id(&sample_id); + A5O_SAMPLE_INSTANCE* instance = al_lock_sample_id(&sample_id); if (instance) { al_set_sample_instance_pan(instance, sin(al_get_time())); } @@ -203,35 +203,35 @@ int main(int argc, const char *argv[]) } al_clear_to_color(al_map_rgb_f(0., 0., 0.)); al_draw_text(font, al_map_rgb_f(1., 0.5, 0.5), 12, y, - ALLEGRO_ALIGN_LEFT, "CONTROLS"); + A5O_ALIGN_LEFT, "CONTROLS"); y += dy; al_draw_text(font, al_map_rgb_f(1., 0.5, 0.5), 12, y, - ALLEGRO_ALIGN_LEFT, "1-9 - play the sounds"); + A5O_ALIGN_LEFT, "1-9 - play the sounds"); y += dy; al_draw_text(font, al_map_rgb_f(1., 0.5, 0.5), 12, y, - ALLEGRO_ALIGN_LEFT, "SPACE - stop all sounds"); + A5O_ALIGN_LEFT, "SPACE - stop all sounds"); y += dy; al_draw_text(font, al_map_rgb_f(1., 0.5, 0.5), 12, y, - ALLEGRO_ALIGN_LEFT, "Ctrl 1-9 - play sounds with bidirectional looping"); + A5O_ALIGN_LEFT, "Ctrl 1-9 - play sounds with bidirectional looping"); y += dy; al_draw_text(font, al_map_rgb_f(1., 0.5, 0.5), 12, y, - ALLEGRO_ALIGN_LEFT, "Alt 1-9 - play sounds with regular looping"); + A5O_ALIGN_LEFT, "Alt 1-9 - play sounds with regular looping"); y += dy; al_draw_text(font, al_map_rgb_f(1., 0.5, 0.5), 12, y, - ALLEGRO_ALIGN_LEFT, "Shift 1-9 - play sounds reversed"); + A5O_ALIGN_LEFT, "Shift 1-9 - play sounds reversed"); y += dy; al_draw_text(font, al_map_rgb_f(1., 0.5, 0.5), 12, y, - ALLEGRO_ALIGN_LEFT, "p - pan the last played sound"); + A5O_ALIGN_LEFT, "p - pan the last played sound"); y += dy; al_draw_text(font, al_map_rgb_f(1., 0.5, 0.5), 12, y, - ALLEGRO_ALIGN_LEFT, "m - play music"); + A5O_ALIGN_LEFT, "m - play music"); y += 2 * dy; al_draw_text(font, al_map_rgb_f(0.5, 1., 0.5), 12, y, - ALLEGRO_ALIGN_LEFT, "SOUNDS"); + A5O_ALIGN_LEFT, "SOUNDS"); y += dy; for (i = 0; i < argc && i < MAX_SAMPLE_DATA; i++) { al_draw_textf(font, al_map_rgb_f(0.5, 1., 0.5), 12, y, - ALLEGRO_ALIGN_LEFT, "%d - %s", i + 1, argv[i]); + A5O_ALIGN_LEFT, "%d - %s", i + 1, argv[i]); y += dy; } al_flip_display(); diff --git a/examples/ex_audio_timer.c b/examples/ex_audio_timer.c index b07971fc06..3b83f93c04 100644 --- a/examples/ex_audio_timer.c +++ b/examples/ex_audio_timer.c @@ -15,24 +15,24 @@ #define PERIOD 5 -static ALLEGRO_DISPLAY *display; -static ALLEGRO_FONT *font; -static ALLEGRO_SAMPLE *ping; -static ALLEGRO_TIMER *timer; -static ALLEGRO_EVENT_QUEUE *event_queue; +static A5O_DISPLAY *display; +static A5O_FONT *font; +static A5O_SAMPLE *ping; +static A5O_TIMER *timer; +static A5O_EVENT_QUEUE *event_queue; -static ALLEGRO_SAMPLE *create_sample_s16(int freq, int len) +static A5O_SAMPLE *create_sample_s16(int freq, int len) { char *buf = al_malloc(freq * len * sizeof(int16_t)); - return al_create_sample(buf, len, freq, ALLEGRO_AUDIO_DEPTH_INT16, - ALLEGRO_CHANNEL_CONF_1, true); + return al_create_sample(buf, len, freq, A5O_AUDIO_DEPTH_INT16, + A5O_CHANNEL_CONF_1, true); } /* Adapted from SPEED. */ -static ALLEGRO_SAMPLE *generate_ping(void) +static A5O_SAMPLE *generate_ping(void) { float osc1, osc2, vol, ramp; int16_t *p; @@ -71,8 +71,8 @@ static ALLEGRO_SAMPLE *generate_ping(void) int main(int argc, char **argv) { - ALLEGRO_TRANSFORM trans; - ALLEGRO_EVENT event; + A5O_TRANSFORM trans; + A5O_EVENT event; int bps = 4; bool redraw = false; unsigned int last_timer = 0; @@ -127,16 +127,16 @@ int main(int argc, char **argv) while (true) { al_wait_for_event(event_queue, &event); - if (event.type == ALLEGRO_EVENT_TIMER) { + if (event.type == A5O_EVENT_TIMER) { const float speed = pow(21.0/20.0, (event.timer.count % PERIOD)); - if (!al_play_sample(ping, 1.0, 0.0, speed, ALLEGRO_PLAYMODE_ONCE, NULL)) { + if (!al_play_sample(ping, 1.0, 0.0, speed, A5O_PLAYMODE_ONCE, NULL)) { log_printf("Not enough reserved samples.\n"); } redraw = true; last_timer = event.timer.count; } - else if (event.type == ALLEGRO_EVENT_KEY_CHAR) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + else if (event.type == A5O_EVENT_KEY_CHAR) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } if (event.keyboard.unichar == '+' || event.keyboard.unichar == '=') { @@ -152,19 +152,19 @@ int main(int argc, char **argv) } } } - else if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + else if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } if (redraw && al_is_event_queue_empty(event_queue)) { - ALLEGRO_COLOR c; + A5O_COLOR c; if (last_timer % PERIOD == 0) c = al_map_rgb_f(1, 1, 1); else c = al_map_rgb_f(0.5, 0.5, 1.0); al_clear_to_color(al_map_rgb(0, 0, 0)); - al_draw_textf(font, c, 640/32, 480/32 - 4, ALLEGRO_ALIGN_CENTRE, + al_draw_textf(font, c, 640/32, 480/32 - 4, A5O_ALIGN_CENTRE, "%u", last_timer); al_flip_display(); } diff --git a/examples/ex_bitmap.c b/examples/ex_bitmap.c index 726b44eed0..f390598b47 100644 --- a/examples/ex_bitmap.c +++ b/examples/ex_bitmap.c @@ -12,10 +12,10 @@ int main(int argc, char **argv) { const char *filename; - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *bitmap; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; + A5O_DISPLAY *display; + A5O_BITMAP *bitmap; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; bool redraw = true; double zoom = 1; double t0; @@ -91,30 +91,30 @@ int main(int argc, char **argv) // Primary 'game' loop. while (1) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); // Wait for and get an event. - if (event.type == ALLEGRO_EVENT_DISPLAY_ORIENTATION) { + if (event.type == A5O_EVENT_DISPLAY_ORIENTATION) { int o = event.display.orientation; - if (o == ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES) { + if (o == A5O_DISPLAY_ORIENTATION_0_DEGREES) { log_printf("0 degrees\n"); } - else if (o == ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES) { + else if (o == A5O_DISPLAY_ORIENTATION_90_DEGREES) { log_printf("90 degrees\n"); } - else if (o == ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES) { + else if (o == A5O_DISPLAY_ORIENTATION_180_DEGREES) { log_printf("180 degrees\n"); } - else if (o == ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES) { + else if (o == A5O_DISPLAY_ORIENTATION_270_DEGREES) { log_printf("270 degrees\n"); } - else if (o == ALLEGRO_DISPLAY_ORIENTATION_FACE_UP) { + else if (o == A5O_DISPLAY_ORIENTATION_FACE_UP) { log_printf("Face up\n"); } - else if (o == ALLEGRO_DISPLAY_ORIENTATION_FACE_DOWN) { + else if (o == A5O_DISPLAY_ORIENTATION_FACE_DOWN) { log_printf("Face down\n"); } } - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) + if (event.type == A5O_EVENT_DISPLAY_CLOSE) break; /* Use keyboard to zoom image in and out. * 1: Reset zoom. @@ -122,8 +122,8 @@ int main(int argc, char **argv) * -: Zoom out 10% * f: Zoom to width of window */ - if (event.type == ALLEGRO_EVENT_KEY_CHAR) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + if (event.type == A5O_EVENT_KEY_CHAR) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) break; // Break the loop and quite on escape key. if (event.keyboard.unichar == '1') zoom = 1; @@ -137,7 +137,7 @@ int main(int argc, char **argv) } // Trigger a redraw on the timer event - if (event.type == ALLEGRO_EVENT_TIMER) + if (event.type == A5O_EVENT_TIMER) redraw = true; // Redraw, but only if the event queue is empty diff --git a/examples/ex_bitmap_file.c b/examples/ex_bitmap_file.c index d26f39f8ae..0f5fefd681 100644 --- a/examples/ex_bitmap_file.c +++ b/examples/ex_bitmap_file.c @@ -1,7 +1,7 @@ /* This example displays a picture on the screen, with support for * command-line parameters, multi-screen, screen-orientation and * zooming. It is a little different from ex_bitmap in the sense - * that it uses the ALLEGRO_FILE interface. + * that it uses the A5O_FILE interface. */ #include #include @@ -14,11 +14,11 @@ int main(int argc, char **argv) { const char *filename; char *fileextension = NULL; - ALLEGRO_DISPLAY *display; - ALLEGRO_FILE *file; - ALLEGRO_BITMAP *bitmap = NULL; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; + A5O_DISPLAY *display; + A5O_FILE *file; + A5O_BITMAP *bitmap = NULL; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; bool redraw = true; double zoom = 1; @@ -100,30 +100,30 @@ int main(int argc, char **argv) // Primary 'game' loop. while (1) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); // Wait for and get an event. - if (event.type == ALLEGRO_EVENT_DISPLAY_ORIENTATION) { + if (event.type == A5O_EVENT_DISPLAY_ORIENTATION) { int o = event.display.orientation; - if (o == ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES) { + if (o == A5O_DISPLAY_ORIENTATION_0_DEGREES) { log_printf("0 degrees\n"); } - else if (o == ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES) { + else if (o == A5O_DISPLAY_ORIENTATION_90_DEGREES) { log_printf("90 degrees\n"); } - else if (o == ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES) { + else if (o == A5O_DISPLAY_ORIENTATION_180_DEGREES) { log_printf("180 degrees\n"); } - else if (o == ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES) { + else if (o == A5O_DISPLAY_ORIENTATION_270_DEGREES) { log_printf("270 degrees\n"); } - else if (o == ALLEGRO_DISPLAY_ORIENTATION_FACE_UP) { + else if (o == A5O_DISPLAY_ORIENTATION_FACE_UP) { log_printf("Face up\n"); } - else if (o == ALLEGRO_DISPLAY_ORIENTATION_FACE_DOWN) { + else if (o == A5O_DISPLAY_ORIENTATION_FACE_DOWN) { log_printf("Face down\n"); } } - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) + if (event.type == A5O_EVENT_DISPLAY_CLOSE) break; /* Use keyboard to zoom image in and out. * 1: Reset zoom. @@ -131,8 +131,8 @@ int main(int argc, char **argv) * -: Zoom out 10% * f: Zoom to width of window */ - if (event.type == ALLEGRO_EVENT_KEY_CHAR) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + if (event.type == A5O_EVENT_KEY_CHAR) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) break; // Break the loop and quite on escape key. if (event.keyboard.unichar == '1') zoom = 1; @@ -146,7 +146,7 @@ int main(int argc, char **argv) } // Trigger a redraw on the timer event - if (event.type == ALLEGRO_EVENT_TIMER) + if (event.type == A5O_EVENT_TIMER) redraw = true; // Redraw, but only if the event queue is empty diff --git a/examples/ex_bitmap_flip.c b/examples/ex_bitmap_flip.c index 75a6f463b9..1529a2e2d0 100644 --- a/examples/ex_bitmap_flip.c +++ b/examples/ex_bitmap_flip.c @@ -17,9 +17,9 @@ float bmp_dy = 96; int bmp_flag = 0; /* Updates the bitmap velocity, orientation and position. */ -static void update(ALLEGRO_BITMAP *bmp) +static void update(A5O_BITMAP *bmp) { - ALLEGRO_BITMAP *target = al_get_target_bitmap(); + A5O_BITMAP *target = al_get_target_bitmap(); int display_w = al_get_bitmap_width(target); int display_h = al_get_bitmap_height(target); int bitmap_w = al_get_bitmap_width(bmp); @@ -32,38 +32,38 @@ static void update(ALLEGRO_BITMAP *bmp) if (bmp_y < 0) { bmp_y = 0; bmp_dy *= -1; - bmp_flag &= ~ALLEGRO_FLIP_VERTICAL; + bmp_flag &= ~A5O_FLIP_VERTICAL; } if (bmp_x < 0) { bmp_x = 0; bmp_dx *= -1; - bmp_flag &= ~ALLEGRO_FLIP_HORIZONTAL; + bmp_flag &= ~A5O_FLIP_HORIZONTAL; } if (bmp_y > display_h - bitmap_h) { bmp_y = display_h - bitmap_h; bmp_dy *= -1; - bmp_flag |= ALLEGRO_FLIP_VERTICAL; + bmp_flag |= A5O_FLIP_VERTICAL; } if (bmp_x > display_w - bitmap_w) { bmp_x = display_w - bitmap_w; bmp_dx *= -1; - bmp_flag |= ALLEGRO_FLIP_HORIZONTAL; + bmp_flag |= A5O_FLIP_HORIZONTAL; } } int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_BITMAP *bmp; - ALLEGRO_BITMAP *mem_bmp; - ALLEGRO_BITMAP *disp_bmp; - ALLEGRO_FONT *font; + A5O_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_BITMAP *bmp; + A5O_BITMAP *mem_bmp; + A5O_BITMAP *disp_bmp; + A5O_FONT *font; char *text; bool done = false; bool redraw = true; @@ -116,7 +116,7 @@ int main(int argc, char **argv) } text = "Display bitmap (space to change)"; - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); mem_bmp = al_load_bitmap("data/mysha.pcx"); if (!mem_bmp) { abort_example("Error loading data/mysha.pcx\n"); @@ -133,11 +133,11 @@ int main(int argc, char **argv) al_start_timer(timer); /* Default premultiplied aplha blending. */ - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); /* Primary 'game' loop. */ while (!done) { - ALLEGRO_EVENT event; + A5O_EVENT event; /* If the timer has since been fired and the queue is empty, draw.*/ if (redraw && al_is_event_queue_empty(queue)) { @@ -153,10 +153,10 @@ int main(int argc, char **argv) al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) done = true; - else if (event.keyboard.keycode == ALLEGRO_KEY_SPACE) { + else if (event.keyboard.keycode == A5O_KEY_SPACE) { /* Spacebar toggles whether render from a memory bitmap * or display bitamp. */ @@ -172,11 +172,11 @@ int main(int argc, char **argv) break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: done = true; break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: redraw = true; break; } diff --git a/examples/ex_blend.c b/examples/ex_blend.c index 591c0a2565..bfb1bb3954 100644 --- a/examples/ex_blend.c +++ b/examples/ex_blend.c @@ -1,7 +1,7 @@ /* An example demonstrating different blending modes. */ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include #include @@ -15,11 +15,11 @@ /* A structure holding all variables of our example program. */ struct Example { - ALLEGRO_BITMAP *example; /* Our example bitmap. */ - ALLEGRO_BITMAP *offscreen; /* An offscreen buffer, for testing. */ - ALLEGRO_BITMAP *memory; /* A memory buffer, for testing. */ - ALLEGRO_FONT *myfont; /* Our font. */ - ALLEGRO_EVENT_QUEUE *queue; /* Our events queue. */ + A5O_BITMAP *example; /* Our example bitmap. */ + A5O_BITMAP *offscreen; /* An offscreen buffer, for testing. */ + A5O_BITMAP *memory; /* A memory buffer, for testing. */ + A5O_FONT *myfont; /* Our font. */ + A5O_EVENT_QUEUE *queue; /* Our events queue. */ int image; /* Which test image to use. */ int mode; /* How to draw it. */ int BUTTONS_X; /* Where to draw buttons. */ @@ -35,7 +35,7 @@ static void print(int x, int y, bool vertical, char const *format, ...) { va_list list; char message[1024]; - ALLEGRO_COLOR color; + A5O_COLOR color; int h; int j; @@ -43,7 +43,7 @@ static void print(int x, int y, bool vertical, char const *format, ...) vsnprintf(message, sizeof message, format, list); va_end(list); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); h = al_get_font_line_height(ex.myfont); for (j = 0; j < 2; j++) { @@ -54,10 +54,10 @@ static void print(int x, int y, bool vertical, char const *format, ...) if (vertical) { int i; - ALLEGRO_USTR_INFO ui; - const ALLEGRO_USTR *us = al_ref_cstr(&ui, message); + A5O_USTR_INFO ui; + const A5O_USTR *us = al_ref_cstr(&ui, message); for (i = 0; i < (int)al_ustr_length(us); i++) { - ALLEGRO_USTR_INFO letter; + A5O_USTR_INFO letter; al_draw_ustr(ex.myfont, color, x + 1 - j, y + 1 - j + h * i, 0, al_ref_ustr(&letter, us, al_ustr_offset(us, i), al_ustr_offset(us, i + 1))); @@ -70,15 +70,15 @@ static void print(int x, int y, bool vertical, char const *format, ...) } /* Create an example bitmap. */ -static ALLEGRO_BITMAP *create_example_bitmap(void) +static A5O_BITMAP *create_example_bitmap(void) { - ALLEGRO_BITMAP *bitmap; + A5O_BITMAP *bitmap; int i, j; - ALLEGRO_LOCKED_REGION *locked; + A5O_LOCKED_REGION *locked; unsigned char *data; bitmap = al_create_bitmap(100, 100); - locked = al_lock_bitmap(bitmap, ALLEGRO_PIXEL_FORMAT_ABGR_8888, ALLEGRO_LOCK_WRITEONLY); + locked = al_lock_bitmap(bitmap, A5O_PIXEL_FORMAT_ABGR_8888, A5O_LOCK_WRITEONLY); data = locked->data; for (j = 0; j < 100; j++) { @@ -103,13 +103,13 @@ static ALLEGRO_BITMAP *create_example_bitmap(void) /* Draw our example scene. */ static void draw(void) { - ALLEGRO_COLOR test[5]; - ALLEGRO_BITMAP *target = al_get_target_bitmap(); + A5O_COLOR test[5]; + A5O_BITMAP *target = al_get_target_bitmap(); char const *blend_names[] = {"ZERO", "ONE", "ALPHA", "INVERSE"}; char const *blend_vnames[] = {"ZERO", "ONE", "ALPHA", "INVER"}; - int blend_modes[] = {ALLEGRO_ZERO, ALLEGRO_ONE, ALLEGRO_ALPHA, - ALLEGRO_INVERSE_ALPHA}; + int blend_modes[] = {A5O_ZERO, A5O_ONE, A5O_ALPHA, + A5O_INVERSE_ALPHA}; float x = 40, y = 40; int i, j; @@ -128,7 +128,7 @@ static void draw(void) print(20, y + i * 110, true, blend_vnames[i]); } - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); if (ex.mode >= 1 && ex.mode <= 5) { al_set_target_bitmap(ex.offscreen); al_clear_to_color(test[ex.mode - 1]); @@ -140,7 +140,7 @@ static void draw(void) for (j = 0; j < 4; j++) { for (i = 0; i < 4; i++) { - al_set_blender(ALLEGRO_ADD, blend_modes[j], blend_modes[i]); + al_set_blender(A5O_ADD, blend_modes[j], blend_modes[i]); if (ex.image == 0) al_draw_bitmap(ex.example, x + i * 110, y + j * 110, 0); else if (ex.image >= 1 && ex.image <= 6) { @@ -152,12 +152,12 @@ static void draw(void) } if (ex.mode >= 1 && ex.mode <= 5) { - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_set_target_bitmap(target); al_draw_bitmap_region(ex.offscreen, x, y, 430, 430, x, y, 0); } if (ex.mode >= 6 && ex.mode <= 10) { - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_set_target_bitmap(target); al_draw_bitmap_region(ex.memory, x, y, 430, 430, x, y, 0); } @@ -209,7 +209,7 @@ static void tick(void) /* Run our test. */ static void run(void) { - ALLEGRO_EVENT event; + A5O_EVENT event; float x, y; bool need_draw = true; @@ -224,22 +224,22 @@ static void run(void) switch (event.type) { /* Was the X button on the window pressed? */ - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: return; /* Was a key pressed? */ - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) return; break; /* Is it time for the next timer tick? */ - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: need_draw = true; break; /* Mouse click? */ - case ALLEGRO_EVENT_MOUSE_BUTTON_UP: + case A5O_EVENT_MOUSE_BUTTON_UP: x = event.mouse.x; y = event.mouse.y; if (x >= ex.BUTTONS_X) { @@ -283,14 +283,14 @@ static void init(void) ex.example = create_example_bitmap(); ex.offscreen = al_create_bitmap(640, 480); - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); ex.memory = al_create_bitmap(640, 480); } int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; + A5O_DISPLAY *display; + A5O_TIMER *timer; (void)argc; (void)argv; diff --git a/examples/ex_blend2.cpp b/examples/ex_blend2.cpp index 12538fe80f..7f8c990967 100644 --- a/examples/ex_blend2.cpp +++ b/examples/ex_blend2.cpp @@ -14,12 +14,12 @@ #include "nihgui.hpp" -ALLEGRO_BITMAP *allegro; -ALLEGRO_BITMAP *mysha; -ALLEGRO_BITMAP *allegro_bmp; -ALLEGRO_BITMAP *mysha_bmp; -ALLEGRO_BITMAP *target; -ALLEGRO_BITMAP *target_bmp; +A5O_BITMAP *allegro; +A5O_BITMAP *mysha; +A5O_BITMAP *allegro_bmp; +A5O_BITMAP *mysha_bmp; +A5O_BITMAP *target; +A5O_BITMAP *target_bmp; class Prog { private: @@ -40,7 +40,7 @@ class Prog { HSlider a[3]; public: - Prog(const Theme & theme, ALLEGRO_DISPLAY *display); + Prog(const Theme & theme, A5O_DISPLAY *display); void run(); private: @@ -49,7 +49,7 @@ class Prog { void draw_bitmap(const std::string &, const std::string &, bool, bool); }; -Prog::Prog(const Theme & theme, ALLEGRO_DISPLAY *display) : +Prog::Prog(const Theme & theme, A5O_DISPLAY *display) : d(Dialog(theme, display, 20, 40)), memory_label(Label("Memory")), texture_label(Label("Texture")), @@ -147,39 +147,39 @@ void Prog::run() int str_to_blend_mode(const std::string & str) { if (str == "ZERO") - return ALLEGRO_ZERO; + return A5O_ZERO; if (str == "ONE") - return ALLEGRO_ONE; + return A5O_ONE; if (str == "SRC_COLOR") - return ALLEGRO_SRC_COLOR; + return A5O_SRC_COLOR; if (str == "DEST_COLOR") - return ALLEGRO_DEST_COLOR; + return A5O_DEST_COLOR; if (str == "INV_SRC_COLOR") - return ALLEGRO_INVERSE_SRC_COLOR; + return A5O_INVERSE_SRC_COLOR; if (str == "INV_DEST_COLOR") - return ALLEGRO_INVERSE_DEST_COLOR; + return A5O_INVERSE_DEST_COLOR; if (str == "ALPHA") - return ALLEGRO_ALPHA; + return A5O_ALPHA; if (str == "INVERSE") - return ALLEGRO_INVERSE_ALPHA; + return A5O_INVERSE_ALPHA; if (str == "ADD") - return ALLEGRO_ADD; + return A5O_ADD; if (str == "SRC_MINUS_DEST") - return ALLEGRO_SRC_MINUS_DEST; + return A5O_SRC_MINUS_DEST; if (str == "DEST_MINUS_SRC") - return ALLEGRO_DEST_MINUS_SRC; + return A5O_DEST_MINUS_SRC; if (str == "CONST_COLOR") - return ALLEGRO_CONST_COLOR; + return A5O_CONST_COLOR; if (str == "INV_CONST_COLOR") - return ALLEGRO_INVERSE_CONST_COLOR; + return A5O_INVERSE_CONST_COLOR; - ALLEGRO_ASSERT(false); - return ALLEGRO_ONE; + A5O_ASSERT(false); + return A5O_ONE; } void draw_background(int x, int y) { - ALLEGRO_COLOR c[] = { + A5O_COLOR c[] = { al_map_rgba(0x66, 0x66, 0x66, 0xff), al_map_rgba(0x99, 0x99, 0x99, 0xff) }; @@ -193,7 +193,7 @@ void draw_background(int x, int y) } } -static ALLEGRO_COLOR makecol(int r, int g, int b, int a) +static A5O_COLOR makecol(int r, int g, int b, int a) { /* Premultiply alpha. */ float rf = (float)r / 255.0f; @@ -218,8 +218,8 @@ void Prog::draw_bitmap(const std::string & str, int gv = g[i].get_cur_value(); int bv = b[i].get_cur_value(); int av = a[i].get_cur_value(); - ALLEGRO_COLOR color = makecol(rv, gv, bv, av); - ALLEGRO_BITMAP *bmp; + A5O_COLOR color = makecol(rv, gv, bv, av); + A5O_BITMAP *bmp; if (contains(str, "Mysha")) bmp = (memory ? mysha_bmp : mysha); @@ -256,18 +256,18 @@ void Prog::draw_bitmap(const std::string & str, } else if (contains(str, "tint")) { al_draw_tinted_rotated_bitmap(bmp, color, 160, 100, - 160, 100, ALLEGRO_PI / 8, 0); + 160, 100, A5O_PI / 8, 0); } else { al_draw_rotated_bitmap(bmp, 160, 100, - 160, 100, ALLEGRO_PI / 8, 0); + 160, 100, A5O_PI / 8, 0); } } } void Prog::blending_test(bool memory) { - ALLEGRO_COLOR transparency = al_map_rgba_f(0, 0, 0, 0); + A5O_COLOR transparency = al_map_rgba_f(0, 0, 0, 0); int op = str_to_blend_mode(operations[4].get_selected_item_text()); int aop = str_to_blend_mode(operations[5].get_selected_item_text()); int src = str_to_blend_mode(operations[0].get_selected_item_text()); @@ -278,11 +278,11 @@ void Prog::blending_test(bool memory) int gv = g[2].get_cur_value(); int bv = b[2].get_cur_value(); int av = a[2].get_cur_value(); - ALLEGRO_COLOR color = makecol(rv, gv, bv, av); + A5O_COLOR color = makecol(rv, gv, bv, av); /* Initialize with destination. */ al_clear_to_color(transparency); // Just in case. - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); draw_bitmap(destination_image.get_selected_item_text(), "original", memory, true); @@ -295,8 +295,8 @@ void Prog::blending_test(bool memory) void Prog::draw_samples() { - ALLEGRO_STATE state; - al_store_state(&state, ALLEGRO_STATE_TARGET_BITMAP | ALLEGRO_STATE_BLENDER); + A5O_STATE state; + al_store_state(&state, A5O_STATE_TARGET_BITMAP | A5O_STATE_BLENDER); /* Draw a background, in case our target bitmap will end up with * alpha in it. @@ -314,7 +314,7 @@ void Prog::draw_samples() /* Display results. */ al_restore_state(&state); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_draw_bitmap(target, 40, 20, 0); al_draw_bitmap(target_bmp, 400, 20, 0); @@ -323,8 +323,8 @@ void Prog::draw_samples() int main(int argc, char *argv[]) { - ALLEGRO_DISPLAY *display; - ALLEGRO_FONT *font; + A5O_DISPLAY *display; + A5O_FONT *font; (void)argc; (void)argv; @@ -340,7 +340,7 @@ int main(int argc, char *argv[]) al_init_image_addon(); init_platform_specific(); - al_set_new_display_flags(ALLEGRO_GENERATE_EXPOSE_EVENTS); + al_set_new_display_flags(A5O_GENERATE_EXPOSE_EVENTS); display = al_create_display(800, 600); if (!display) { abort_example("Unable to create display\n"); @@ -361,7 +361,7 @@ int main(int argc, char *argv[]) target = al_create_bitmap(320, 200); - al_add_new_bitmap_flag(ALLEGRO_MEMORY_BITMAP); + al_add_new_bitmap_flag(A5O_MEMORY_BITMAP); allegro_bmp = al_clone_bitmap(allegro); mysha_bmp = al_clone_bitmap(mysha); target_bmp = al_clone_bitmap(target); diff --git a/examples/ex_blend_bench.c b/examples/ex_blend_bench.c index 5f8143a7c9..24b4af5ae3 100644 --- a/examples/ex_blend_bench.c +++ b/examples/ex_blend_bench.c @@ -32,9 +32,9 @@ static char const *names[] = { "", "Plain blit", "Scaled blit", "Rotated blit" }; -ALLEGRO_DISPLAY *display; +A5O_DISPLAY *display; -static void step(enum Mode mode, ALLEGRO_BITMAP *b2) +static void step(enum Mode mode, A5O_BITMAP *b2) { switch (mode) { case ALL: break; @@ -46,7 +46,7 @@ static void step(enum Mode mode, ALLEGRO_BITMAP *b2) break; case ROTATE_BLIT: al_draw_scaled_rotated_bitmap(b2, 10, 10, 10, 10, 2.0, 2.0, - ALLEGRO_PI/30, 0); + A5O_PI/30, 0); break; } } @@ -62,14 +62,14 @@ static double current_clock(void) static bool do_test(enum Mode mode) { - ALLEGRO_STATE state; - ALLEGRO_BITMAP *b1; - ALLEGRO_BITMAP *b2; + A5O_STATE state; + A5O_BITMAP *b1; + A5O_BITMAP *b2; int REPEAT; double t0, t1; int i; - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); b1 = al_load_bitmap("data/mysha.pcx"); if (!b1) { @@ -84,13 +84,13 @@ static bool do_test(enum Mode mode) } al_set_target_bitmap(b1); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); step(mode, b2); /* Display the blended bitmap to the screen so we can see something. */ - al_store_state(&state, ALLEGRO_STATE_ALL); + al_store_state(&state, A5O_STATE_ALL); al_set_target_backbuffer(display); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_draw_bitmap(b1, 0, 0, 0); al_flip_display(); al_restore_state(&state); diff --git a/examples/ex_blend_target.c b/examples/ex_blend_target.c index 216827ff64..f04b890a33 100644 --- a/examples/ex_blend_target.c +++ b/examples/ex_blend_target.c @@ -1,4 +1,4 @@ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include #include @@ -9,9 +9,9 @@ #define FPS 60 -static ALLEGRO_BITMAP *load_bitmap(char const *filename) +static A5O_BITMAP *load_bitmap(char const *filename) { - ALLEGRO_BITMAP *bitmap = al_load_bitmap(filename); + A5O_BITMAP *bitmap = al_load_bitmap(filename); if (!bitmap) abort_example("%s not found or failed to load\n", filename); return bitmap; @@ -19,13 +19,13 @@ static ALLEGRO_BITMAP *load_bitmap(char const *filename) int main(int argc, char **argv) { - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP* mysha; - ALLEGRO_BITMAP* parrot; - ALLEGRO_BITMAP* targets[4]; - ALLEGRO_BITMAP* backbuffer; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_DISPLAY *display; + A5O_BITMAP* mysha; + A5O_BITMAP* parrot; + A5O_BITMAP* targets[4]; + A5O_BITMAP* backbuffer; int w; int h; @@ -64,17 +64,17 @@ int main(int argc, char **argv) backbuffer = al_get_backbuffer(display); targets[0] = al_create_sub_bitmap(backbuffer, 0, 0, w, h ); al_set_target_bitmap(targets[0]); - al_set_bitmap_blender(ALLEGRO_DEST_MINUS_SRC, ALLEGRO_SRC_COLOR, ALLEGRO_DST_COLOR); + al_set_bitmap_blender(A5O_DEST_MINUS_SRC, A5O_SRC_COLOR, A5O_DST_COLOR); targets[1] = al_create_sub_bitmap(backbuffer, w, 0, w, h ); al_set_target_bitmap(targets[1]); - al_set_bitmap_blender(ALLEGRO_ADD, ALLEGRO_SRC_COLOR, ALLEGRO_DST_COLOR); + al_set_bitmap_blender(A5O_ADD, A5O_SRC_COLOR, A5O_DST_COLOR); al_set_bitmap_blend_color(al_map_rgb_f(0.5, 0.5, 1.0)); targets[2] = al_create_sub_bitmap(backbuffer, 0, h, w, h ); al_set_target_bitmap(targets[2]); - al_set_bitmap_blender(ALLEGRO_SRC_MINUS_DEST, ALLEGRO_SRC_COLOR, ALLEGRO_DST_COLOR); + al_set_bitmap_blender(A5O_SRC_MINUS_DEST, A5O_SRC_COLOR, A5O_DST_COLOR); targets[3] = al_create_sub_bitmap(backbuffer, w, h, w, h ); al_set_target_bitmap(targets[3]); - al_set_bitmap_blender(ALLEGRO_DEST_MINUS_SRC, ALLEGRO_INVERSE_SRC_COLOR, ALLEGRO_DST_COLOR); + al_set_bitmap_blender(A5O_DEST_MINUS_SRC, A5O_INVERSE_SRC_COLOR, A5O_DST_COLOR); timer = al_create_timer(1.0 / FPS); @@ -88,7 +88,7 @@ int main(int argc, char **argv) al_start_timer(timer); while (!done) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (need_redraw) { int i; @@ -108,16 +108,16 @@ int main(int argc, char **argv) while (true) { al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_KEY_CHAR: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_CHAR: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) done = true; break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: done = true; break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: need_redraw = true; break; } diff --git a/examples/ex_blend_test.c b/examples/ex_blend_test.c index 1322bd1cc2..c74136a9da 100644 --- a/examples/ex_blend_test.c +++ b/examples/ex_blend_test.c @@ -8,46 +8,46 @@ int test_only_index = 0; int test_index = 0; bool test_display = false; -ALLEGRO_DISPLAY *display; +A5O_DISPLAY *display; -static void print_color(ALLEGRO_COLOR c) +static void print_color(A5O_COLOR c) { float r, g, b, a; al_unmap_rgba_f(c, &r, &g, &b, &a); log_printf("%.2f, %.2f, %.2f, %.2f", r, g, b, a); } -static ALLEGRO_COLOR test(ALLEGRO_COLOR src_col, ALLEGRO_COLOR dst_col, +static A5O_COLOR test(A5O_COLOR src_col, A5O_COLOR dst_col, int src_format, int dst_format, int src, int dst, int src_a, int dst_a, int operation, bool verbose) { - ALLEGRO_COLOR result; - ALLEGRO_BITMAP *dst_bmp; + A5O_COLOR result; + A5O_BITMAP *dst_bmp; al_set_new_bitmap_format(dst_format); - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); dst_bmp = al_create_bitmap(1, 1); al_set_target_bitmap(dst_bmp); al_clear_to_color(dst_col); if (operation == 0) { - ALLEGRO_BITMAP *src_bmp; + A5O_BITMAP *src_bmp; al_set_new_bitmap_format(src_format); src_bmp = al_create_bitmap(1, 1); al_set_target_bitmap(src_bmp); al_clear_to_color(src_col); al_set_target_bitmap(dst_bmp); - al_set_separate_blender(ALLEGRO_ADD, src, dst, ALLEGRO_ADD, src_a, dst_a); + al_set_separate_blender(A5O_ADD, src, dst, A5O_ADD, src_a, dst_a); al_draw_bitmap(src_bmp, 0, 0, 0); al_destroy_bitmap(src_bmp); } else if (operation == 1) { - al_set_separate_blender(ALLEGRO_ADD, src, dst, ALLEGRO_ADD, src_a, dst_a); + al_set_separate_blender(A5O_ADD, src, dst, A5O_ADD, src_a, dst_a); al_draw_pixel(0, 0, src_col); } else if (operation == 2) { - al_set_separate_blender(ALLEGRO_ADD, src, dst, ALLEGRO_ADD, src_a, dst_a); + al_set_separate_blender(A5O_ADD, src, dst, A5O_ADD, src_a, dst_a); al_draw_line(0, 0, 1, 1, src_col, 0); } @@ -56,7 +56,7 @@ static ALLEGRO_COLOR test(ALLEGRO_COLOR src_col, ALLEGRO_COLOR dst_col, al_set_target_backbuffer(display); if (test_display) { - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_draw_bitmap(dst_bmp, 0, 0, 0); } @@ -86,7 +86,7 @@ static ALLEGRO_COLOR test(ALLEGRO_COLOR src_col, ALLEGRO_COLOR dst_col, return result; } -static bool same_color(ALLEGRO_COLOR c1, ALLEGRO_COLOR c2) +static bool same_color(A5O_COLOR c1, A5O_COLOR c2) { float r1, g1, b1, a1; float r2, g2, b2, a2; @@ -108,27 +108,27 @@ static bool same_color(ALLEGRO_COLOR c1, ALLEGRO_COLOR c2) static float get_factor(int operation, float alpha) { switch(operation) { - case ALLEGRO_ZERO: return 0; - case ALLEGRO_ONE: return 1; - case ALLEGRO_ALPHA: return alpha; - case ALLEGRO_INVERSE_ALPHA: return 1 - alpha; + case A5O_ZERO: return 0; + case A5O_ONE: return 1; + case A5O_ALPHA: return alpha; + case A5O_INVERSE_ALPHA: return 1 - alpha; } return 0; } static bool has_alpha(int format) { - if (format == ALLEGRO_PIXEL_FORMAT_RGB_888) + if (format == A5O_PIXEL_FORMAT_RGB_888) return false; - if (format == ALLEGRO_PIXEL_FORMAT_BGR_888) + if (format == A5O_PIXEL_FORMAT_BGR_888) return false; return true; } #define CLAMP(x) (x > 1 ? 1 : x) -static ALLEGRO_COLOR reference_implementation( - ALLEGRO_COLOR src_col, ALLEGRO_COLOR dst_col, +static A5O_COLOR reference_implementation( + A5O_COLOR src_col, A5O_COLOR dst_col, int src_format, int dst_format, int src_mode, int dst_mode, int src_alpha, int dst_alpha, int operation) @@ -176,12 +176,12 @@ static ALLEGRO_COLOR reference_implementation( return al_map_rgba_f(r, g, b, a); } -static void do_test2(ALLEGRO_COLOR src_col, ALLEGRO_COLOR dst_col, +static void do_test2(A5O_COLOR src_col, A5O_COLOR dst_col, int src_format, int dst_format, int src_mode, int dst_mode, int src_alpha, int dst_alpha, int operation) { - ALLEGRO_COLOR reference, result, from_display; + A5O_COLOR reference, result, from_display; test_index++; if (test_only_index && test_index != test_only_index) @@ -230,14 +230,14 @@ static void do_test2(ALLEGRO_COLOR src_col, ALLEGRO_COLOR dst_col, } } -static void do_test1(ALLEGRO_COLOR src_col, ALLEGRO_COLOR dst_col, +static void do_test1(A5O_COLOR src_col, A5O_COLOR dst_col, int src_format, int dst_format) { int i, j, k, l, m; - int smodes[4] = {ALLEGRO_ALPHA, ALLEGRO_ZERO, ALLEGRO_ONE, - ALLEGRO_INVERSE_ALPHA}; - int dmodes[4] = {ALLEGRO_INVERSE_ALPHA, ALLEGRO_ZERO, ALLEGRO_ONE, - ALLEGRO_ALPHA}; + int smodes[4] = {A5O_ALPHA, A5O_ZERO, A5O_ONE, + A5O_INVERSE_ALPHA}; + int dmodes[4] = {A5O_INVERSE_ALPHA, A5O_ZERO, A5O_ONE, + A5O_ALPHA}; for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { for (k = 0; k < 4; k++) { @@ -259,15 +259,15 @@ static void do_test1(ALLEGRO_COLOR src_col, ALLEGRO_COLOR dst_col, int main(int argc, char **argv) { int i, j, l, m; - ALLEGRO_COLOR src_colors[2]; - ALLEGRO_COLOR dst_colors[2]; + A5O_COLOR src_colors[2]; + A5O_COLOR dst_colors[2]; int src_formats[2] = { - ALLEGRO_PIXEL_FORMAT_ABGR_8888, - ALLEGRO_PIXEL_FORMAT_BGR_888 + A5O_PIXEL_FORMAT_ABGR_8888, + A5O_PIXEL_FORMAT_BGR_888 }; int dst_formats[2] = { - ALLEGRO_PIXEL_FORMAT_ABGR_8888, - ALLEGRO_PIXEL_FORMAT_BGR_888 + A5O_PIXEL_FORMAT_ABGR_8888, + A5O_PIXEL_FORMAT_BGR_888 }; src_colors[0] = C(0, 0, 0, 1); src_colors[1] = C(1, 1, 1, 1); @@ -311,8 +311,8 @@ int main(int argc, char **argv) log_printf("\nDone\n"); if (test_only_index && test_display) { - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; al_flip_display(); al_install_keyboard(); queue = al_create_event_queue(); diff --git a/examples/ex_blit.c b/examples/ex_blit.c index 5eb14ad34c..061c504e0e 100644 --- a/examples/ex_blit.c +++ b/examples/ex_blit.c @@ -12,32 +12,32 @@ struct Example { - ALLEGRO_BITMAP *pattern; - ALLEGRO_FONT *font; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_COLOR background, text, white; + A5O_BITMAP *pattern; + A5O_FONT *font; + A5O_EVENT_QUEUE *queue; + A5O_COLOR background, text, white; double timer[4], counter[4]; int FPS; float text_x, text_y; } ex; -static ALLEGRO_BITMAP *example_bitmap(int w, int h) +static A5O_BITMAP *example_bitmap(int w, int h) { int i, j; float mx = w * 0.5; float my = h * 0.5; - ALLEGRO_STATE state; - ALLEGRO_BITMAP *pattern = al_create_bitmap(w, h); - al_store_state(&state, ALLEGRO_STATE_TARGET_BITMAP); + A5O_STATE state; + A5O_BITMAP *pattern = al_create_bitmap(w, h); + al_store_state(&state, A5O_STATE_TARGET_BITMAP); al_set_target_bitmap(pattern); - al_lock_bitmap(pattern, ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_WRITEONLY); + al_lock_bitmap(pattern, A5O_PIXEL_FORMAT_ANY, A5O_LOCK_WRITEONLY); for (i = 0; i < w; i++) { for (j = 0; j < h; j++) { float a = atan2(i - mx, j - my); float d = sqrt(pow(i - mx, 2) + pow(j - my, 2)); float sat = pow(1.0 - 1 / (1 + d * 0.1), 5); - float hue = 3 * a * 180 / ALLEGRO_PI; + float hue = 3 * a * 180 / A5O_PI; hue = (hue / 360 - floorf(hue / 360)) * 360; al_put_pixel(i, j, al_color_hsv(hue, sat, 1)); } @@ -68,7 +68,7 @@ static void print(char const *format, ...) va_start(list, format); vsnprintf(message, sizeof message, format, list); va_end(list); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_draw_textf(ex.font, ex.text, ex.text_x, ex.text_y, 0, "%s", message); ex.text_y += th; } @@ -96,12 +96,12 @@ static void draw(void) float x, y; int iw = al_get_bitmap_width(ex.pattern); int ih = al_get_bitmap_height(ex.pattern); - ALLEGRO_BITMAP *screen, *temp; - ALLEGRO_LOCKED_REGION *lock; + A5O_BITMAP *screen, *temp; + A5O_LOCKED_REGION *lock; void *data; int size, i, format; - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_clear_to_color(ex.background); @@ -145,7 +145,7 @@ static void draw(void) get_xy(&x, &y); al_draw_bitmap(ex.pattern, x, y, 0); - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); temp = al_create_bitmap(iw, ih); al_set_target_bitmap(temp); al_clear_to_color(al_map_rgba_f(1, 0, 0, 1)); @@ -158,7 +158,7 @@ static void draw(void) set_xy(x, y + ih); al_destroy_bitmap(temp); - al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP); + al_set_new_bitmap_flags(A5O_VIDEO_BITMAP); /* Test 4. */ print("Screen -> Locked -> Screen (%.1f fps)", get_fps(3)); @@ -167,7 +167,7 @@ static void draw(void) start_timer(3); lock = al_lock_bitmap_region(screen, x, y, iw, ih, - ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_READONLY); + A5O_PIXEL_FORMAT_ANY, A5O_LOCK_READONLY); format = lock->format; size = lock->pixel_size; data = malloc(size * iw * ih); @@ -177,7 +177,7 @@ static void draw(void) al_unlock_bitmap(screen); lock = al_lock_bitmap_region(screen, x + 8 + iw, y, iw, ih, format, - ALLEGRO_LOCK_WRITEONLY); + A5O_LOCK_WRITEONLY); for (i = 0; i < ih; i++) memcpy((char*)lock->data + i * lock->pitch, (char*)data + i * size * iw, size * iw); @@ -196,7 +196,7 @@ static void tick(void) static void run(void) { - ALLEGRO_EVENT event; + A5O_EVENT event; bool need_draw = true; while (1) { @@ -208,15 +208,15 @@ static void run(void) al_wait_for_event(ex.queue, &event); switch (event.type) { - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: return; - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) return; break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: need_draw = true; break; } @@ -239,8 +239,8 @@ static void init(void) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; + A5O_DISPLAY *display; + A5O_TIMER *timer; (void)argc; (void)argv; diff --git a/examples/ex_camera.c b/examples/ex_camera.c index cd28df4b0d..ce574b1bf7 100644 --- a/examples/ex_camera.c +++ b/examples/ex_camera.c @@ -1,4 +1,4 @@ -/* An example demonstrating how to use ALLEGRO_TRANSFORM to represent a 3D +/* An example demonstrating how to use A5O_TRANSFORM to represent a 3D * camera. */ #include @@ -10,7 +10,7 @@ #include "common.c" -#define pi ALLEGRO_PI +#define pi A5O_PI typedef struct { float x, y, z; @@ -33,8 +33,8 @@ typedef struct { /* keyboard and mouse state */ int button[10]; - int key[ALLEGRO_KEY_MAX]; - int keystate[ALLEGRO_KEY_MAX]; + int key[A5O_KEY_MAX]; + int keystate[A5O_KEY_MAX]; int mouse_dx, mouse_dy; /* control scheme selection */ @@ -43,13 +43,13 @@ typedef struct { /* the vertex data */ int n, v_size; - ALLEGRO_VERTEX *v; + A5O_VERTEX *v; /* used to draw some info text */ - ALLEGRO_FONT *font; + A5O_FONT *font; /* if not NULL the skybox picture to use */ - ALLEGRO_BITMAP *skybox; + A5O_BITMAP *skybox; } Example; Example ex; @@ -104,7 +104,7 @@ static void vector_iadd(Vector *a, Vector b) /* Rotate the camera around the given axis. */ static void camera_rotate_around_axis(Camera *c, Vector axis, double radians) { - ALLEGRO_TRANSFORM t; + A5O_TRANSFORM t; al_identity_transform(&t); al_rotate_transform_3d(&t, axis.x, axis.y, axis.z, radians); al_transform_coordinates_3d(&t, &c->yaxis.x, &c->yaxis.y, &c->yaxis.z); @@ -190,8 +190,8 @@ static double get_roll(Camera *c) */ static void setup_3d_projection(void) { - ALLEGRO_TRANSFORM projection; - ALLEGRO_DISPLAY *display = al_get_current_display(); + A5O_TRANSFORM projection; + A5O_DISPLAY *display = al_get_current_display(); double dw = al_get_display_width(display); double dh = al_get_display_height(display); double f; @@ -206,7 +206,7 @@ static void setup_3d_projection(void) /* Adds a new vertex to our scene. */ static void add_vertex(double x, double y, double z, double u, double v, - ALLEGRO_COLOR color) + A5O_COLOR color) { int i = ex.n++; if (i >= ex.v_size) { @@ -226,7 +226,7 @@ static void add_vertex(double x, double y, double z, double u, double v, static void add_quad(double x, double y, double z, double u, double v, double ux, double uy, double uz, double uu, double uv, double vx, double vy, double vz, double vu, double vv, - ALLEGRO_COLOR c1, ALLEGRO_COLOR c2) + A5O_COLOR c1, A5O_COLOR c2) { add_vertex(x, y, z, u, v, c1); add_vertex(x + ux, y + uy, z + uz, u + uu, v + uv, c1); @@ -241,15 +241,15 @@ static void add_quad(double x, double y, double z, double u, double v, static void add_checkerboard(void) { int x, y; - ALLEGRO_COLOR c1 = al_color_name("yellow"); - ALLEGRO_COLOR c2 = al_color_name("green"); + A5O_COLOR c1 = al_color_name("yellow"); + A5O_COLOR c2 = al_color_name("green"); for (y = 0; y < 20; y++) { for (x = 0; x < 20; x++) { double px = x - 20 * 0.5; double py = 0.2; double pz = y - 20 * 0.5; - ALLEGRO_COLOR c = c1; + A5O_COLOR c = c1; if ((x + y) & 1) { c = c2; py -= 0.1; @@ -268,9 +268,9 @@ static void add_checkerboard(void) static void add_skybox(void) { Vector p = ex.camera.position; - ALLEGRO_COLOR c1 = al_color_name("black"); - ALLEGRO_COLOR c2 = al_color_name("blue"); - ALLEGRO_COLOR c3 = al_color_name("white"); + A5O_COLOR c1 = al_color_name("black"); + A5O_COLOR c2 = al_color_name("blue"); + A5O_COLOR c3 = al_color_name("white"); double a = 0, b = 0; if (ex.skybox) { @@ -322,10 +322,10 @@ static void draw_scene(void) { Camera *c = &ex.camera; /* We save Allegro's projection so we can restore it for drawing text. */ - ALLEGRO_TRANSFORM projection = *al_get_current_projection_transform(); - ALLEGRO_TRANSFORM t; - ALLEGRO_COLOR back = al_color_name("black"); - ALLEGRO_COLOR front = al_color_name("white"); + A5O_TRANSFORM projection = *al_get_current_projection_transform(); + A5O_TRANSFORM t; + A5O_COLOR back = al_color_name("black"); + A5O_COLOR front = al_color_name("white"); int th; double pitch, yaw, roll; @@ -333,7 +333,7 @@ static void draw_scene(void) al_clear_to_color(back); /* We use a depth buffer. */ - al_set_render_state(ALLEGRO_DEPTH_TEST, 1); + al_set_render_state(A5O_DEPTH_TEST, 1); al_clear_depth_buffer(1); /* Recreate the entire scene geometry - this is only a very small example @@ -354,13 +354,13 @@ static void draw_scene(void) ex.camera.position.z - ex.camera.zaxis.z, ex.camera.yaxis.x, ex.camera.yaxis.y, ex.camera.yaxis.z); al_use_transform(&t); - al_draw_prim(ex.v, NULL, ex.skybox, 0, ex.n, ALLEGRO_PRIM_TRIANGLE_LIST); + al_draw_prim(ex.v, NULL, ex.skybox, 0, ex.n, A5O_PRIM_TRIANGLE_LIST); /* Restore projection. */ al_identity_transform(&t); al_use_transform(&t); al_use_projection_transform(&projection); - al_set_render_state(ALLEGRO_DEPTH_TEST, 0); + al_set_render_state(A5O_DEPTH_TEST, 0); /* Draw some text. */ th = al_get_font_line_height(ex.font); @@ -402,19 +402,19 @@ static void handle_input(void) { double x = 0, y = 0; double xy; - if (ex.key[ALLEGRO_KEY_A] || ex.key[ALLEGRO_KEY_LEFT]) x = -1; - if (ex.key[ALLEGRO_KEY_S] || ex.key[ALLEGRO_KEY_DOWN]) y = -1; - if (ex.key[ALLEGRO_KEY_D] || ex.key[ALLEGRO_KEY_RIGHT]) x = 1; - if (ex.key[ALLEGRO_KEY_W] || ex.key[ALLEGRO_KEY_UP]) y = 1; + if (ex.key[A5O_KEY_A] || ex.key[A5O_KEY_LEFT]) x = -1; + if (ex.key[A5O_KEY_S] || ex.key[A5O_KEY_DOWN]) y = -1; + if (ex.key[A5O_KEY_D] || ex.key[A5O_KEY_RIGHT]) x = 1; + if (ex.key[A5O_KEY_W] || ex.key[A5O_KEY_UP]) y = 1; /* Change field of view with Z/X. */ - if (ex.key[ALLEGRO_KEY_Z]) { + if (ex.key[A5O_KEY_Z]) { double m = 20 * pi / 180; ex.camera.vertical_field_of_view -= 0.01; if (ex.camera.vertical_field_of_view < m) ex.camera.vertical_field_of_view = m; } - if (ex.key[ALLEGRO_KEY_X]) { + if (ex.key[A5O_KEY_X]) { double m = 120 * pi / 180; ex.camera.vertical_field_of_view += 0.01; if (ex.camera.vertical_field_of_view > m) @@ -470,9 +470,9 @@ static void handle_input(void) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; + A5O_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; int redraw = 0; bool halt_drawing = false; char const *skybox_name = NULL; @@ -491,10 +491,10 @@ int main(int argc, char **argv) al_install_mouse(); al_set_config_value(al_get_system_config(), "osx", "allow_live_resize", "false"); - al_set_new_display_option(ALLEGRO_SAMPLE_BUFFERS, 1, ALLEGRO_SUGGEST); - al_set_new_display_option(ALLEGRO_SAMPLES, 8, ALLEGRO_SUGGEST); - al_set_new_display_option(ALLEGRO_DEPTH_SIZE, 16, ALLEGRO_SUGGEST); - al_set_new_display_flags(ALLEGRO_RESIZABLE); + al_set_new_display_option(A5O_SAMPLE_BUFFERS, 1, A5O_SUGGEST); + al_set_new_display_option(A5O_SAMPLES, 8, A5O_SUGGEST); + al_set_new_display_option(A5O_DEPTH_SIZE, 16, A5O_SUGGEST); + al_set_new_display_flags(A5O_RESIZABLE); display = al_create_display(640, 360); if (!display) { abort_example("Error creating display\n"); @@ -525,58 +525,58 @@ int main(int argc, char **argv) al_start_timer(timer); while (true) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) + if (event.type == A5O_EVENT_DISPLAY_CLOSE) break; - else if (event.type == ALLEGRO_EVENT_DISPLAY_RESIZE) { + else if (event.type == A5O_EVENT_DISPLAY_RESIZE) { al_acknowledge_resize(display); } - else if (event.type == ALLEGRO_EVENT_KEY_DOWN) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + else if (event.type == A5O_EVENT_KEY_DOWN) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) break; - if (event.keyboard.keycode == ALLEGRO_KEY_SPACE) { + if (event.keyboard.keycode == A5O_KEY_SPACE) { ex.controls++; ex.controls %= 3; } ex.key[event.keyboard.keycode] = 1; ex.keystate[event.keyboard.keycode] = 1; } - else if (event.type == ALLEGRO_EVENT_KEY_UP) { + else if (event.type == A5O_EVENT_KEY_UP) { /* In case a key gets pressed and immediately released, we will still * have set ex.key so it is not lost. */ ex.keystate[event.keyboard.keycode] = 0; } - else if (event.type == ALLEGRO_EVENT_TIMER) { + else if (event.type == A5O_EVENT_TIMER) { int i; handle_input(); redraw = 1; /* Reset keyboard state for keys not held down anymore. */ - for (i = 0; i < ALLEGRO_KEY_MAX; i++) { + for (i = 0; i < A5O_KEY_MAX; i++) { if (ex.keystate[i] == 0) ex.key[i] = 0; } ex.mouse_dx = 0; ex.mouse_dy = 0; } - else if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN) { + else if (event.type == A5O_EVENT_MOUSE_BUTTON_DOWN) { ex.button[event.mouse.button] = 1; } - else if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_UP) { + else if (event.type == A5O_EVENT_MOUSE_BUTTON_UP) { ex.button[event.mouse.button] = 0; } - else if (event.type == ALLEGRO_EVENT_DISPLAY_HALT_DRAWING) { + else if (event.type == A5O_EVENT_DISPLAY_HALT_DRAWING) { halt_drawing = true; al_acknowledge_drawing_halt(display); } - else if (event.type == ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING) { + else if (event.type == A5O_EVENT_DISPLAY_RESUME_DRAWING) { halt_drawing = false; al_acknowledge_drawing_resume(display); } - else if (event.type == ALLEGRO_EVENT_MOUSE_AXES) { + else if (event.type == A5O_EVENT_MOUSE_AXES) { ex.mouse_dx += event.mouse.dx; ex.mouse_dy += event.mouse.dy; } diff --git a/examples/ex_clip.c b/examples/ex_clip.c index 2bd2d036d3..a97296dcc3 100644 --- a/examples/ex_clip.c +++ b/examples/ex_clip.c @@ -13,32 +13,32 @@ struct Example { - ALLEGRO_BITMAP *pattern; - ALLEGRO_FONT *font; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_COLOR background, text, white; + A5O_BITMAP *pattern; + A5O_FONT *font; + A5O_EVENT_QUEUE *queue; + A5O_COLOR background, text, white; double timer[4], counter[4]; int FPS; float text_x, text_y; } ex; -static ALLEGRO_BITMAP *example_bitmap(int w, int h) +static A5O_BITMAP *example_bitmap(int w, int h) { int i, j; float mx = w * 0.5; float my = h * 0.5; - ALLEGRO_STATE state; - ALLEGRO_BITMAP *pattern = al_create_bitmap(w, h); - al_store_state(&state, ALLEGRO_STATE_TARGET_BITMAP); + A5O_STATE state; + A5O_BITMAP *pattern = al_create_bitmap(w, h); + al_store_state(&state, A5O_STATE_TARGET_BITMAP); al_set_target_bitmap(pattern); - al_lock_bitmap(pattern, ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_WRITEONLY); + al_lock_bitmap(pattern, A5O_PIXEL_FORMAT_ANY, A5O_LOCK_WRITEONLY); for (i = 0; i < w; i++) { for (j = 0; j < h; j++) { float a = atan2(i - mx, j - my); float d = sqrt(pow(i - mx, 2) + pow(j - my, 2)); float l = 1 - pow(1.0 - 1 / (1 + d * 0.1), 5); - float hue = a * 180 / ALLEGRO_PI; + float hue = a * 180 / A5O_PI; float sat = 1; if (i == 0 || j == 0 || i == w - 1 || j == h - 1) { hue += 180; @@ -77,7 +77,7 @@ static void print(char const *format, ...) vsnprintf(message, sizeof message, format, list); va_end(list); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_draw_textf(ex.font, ex.text, ex.text_x, ex.text_y, 0, "%s", message); ex.text_y += th; @@ -106,12 +106,12 @@ static void draw(void) float x, y; int iw = al_get_bitmap_width(ex.pattern); int ih = al_get_bitmap_height(ex.pattern); - ALLEGRO_BITMAP *temp; + A5O_BITMAP *temp; int cx, cy, cw, ch, gap = 8; al_get_clipping_rectangle(&cx, &cy, &cw, &ch); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_clear_to_color(ex.background); @@ -160,7 +160,7 @@ static void tick(void) static void run(void) { - ALLEGRO_EVENT event; + A5O_EVENT event; bool need_draw = true; while (1) { @@ -172,15 +172,15 @@ static void run(void) al_wait_for_event(ex.queue, &event); switch (event.type) { - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: return; - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) return; break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: need_draw = true; break; } @@ -203,8 +203,8 @@ static void init(void) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; + A5O_DISPLAY *display; + A5O_TIMER *timer; (void)argc; (void)argv; diff --git a/examples/ex_clipboard.c b/examples/ex_clipboard.c index e8922ff406..8a38cddc2a 100644 --- a/examples/ex_clipboard.c +++ b/examples/ex_clipboard.c @@ -12,10 +12,10 @@ int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_FONT *font; + A5O_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_FONT *font; char *text = NULL; bool done = false; bool redraw = true; @@ -57,10 +57,10 @@ int main(int argc, char **argv) al_start_timer(timer); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); while (!done) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (redraw && al_is_event_queue_empty(queue)) { if (text) @@ -88,20 +88,20 @@ int main(int argc, char **argv) al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) { done = true; } - else if (event.keyboard.keycode == ALLEGRO_KEY_SPACE) { + else if (event.keyboard.keycode == A5O_KEY_SPACE) { al_set_clipboard_text(display, "Copied from Allegro!"); } break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: done = true; break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: redraw = true; break; } diff --git a/examples/ex_color.cpp b/examples/ex_color.cpp index 4c38f834bb..4e32911bdd 100644 --- a/examples/ex_color.cpp +++ b/examples/ex_color.cpp @@ -37,14 +37,14 @@ class Prog { int previous[SLIDERS_COUNT]; public: - Prog(const Theme & theme, ALLEGRO_DISPLAY *display); + Prog(const Theme & theme, A5O_DISPLAY *display); void run(); private: void draw_swatch(float x, float y, float w, float h, float v[3]); }; -Prog::Prog(const Theme & theme, ALLEGRO_DISPLAY *display) : +Prog::Prog(const Theme & theme, A5O_DISPLAY *display) : d(Dialog(theme, display, 640, 480)) { for (int i = 0; i < SLIDERS_COUNT; i++) { @@ -86,7 +86,7 @@ void Prog::run() al_color_rgb_to_lch(v[0], v[1], v[2], v + 16, v + 17, v + 18); v[3] /= 360; v[6] /= 360; - v[18] /= ALLEGRO_PI * 2; + v[18] /= A5O_PI * 2; break; case 1: al_color_hsv_to_rgb(v[3] * 360, v[4], v[5], v + 0, v + 1, v + 2); @@ -95,7 +95,7 @@ void Prog::run() al_color_rgb_to_yuv(v[0], v[1], v[2], v + 9, v + 10, v + 11); al_color_rgb_to_lch(v[0], v[1], v[2], v + 16, v + 17, v + 18); v[6] /= 360; - v[18] /= ALLEGRO_PI * 2; + v[18] /= A5O_PI * 2; break; case 2: al_color_hsl_to_rgb(v[6] * 360, v[7], v[8], v + 0, v + 1, v + 2); @@ -104,7 +104,7 @@ void Prog::run() al_color_rgb_to_yuv(v[0], v[1], v[2], v + 9, v + 10, v + 11); al_color_rgb_to_lch(v[0], v[1], v[2], v + 16, v + 17, v + 18); v[3] /= 360; - v[18] /= ALLEGRO_PI * 2; + v[18] /= A5O_PI * 2; break; case 3: al_color_yuv_to_rgb(v[9], v[10], v[11], v + 0, v + 1, v + 2); @@ -118,7 +118,7 @@ void Prog::run() al_color_rgb_to_lch(v[0], v[1], v[2], v + 16, v + 17, v + 18); v[3] /= 360; v[6] /= 360; - v[18] /= ALLEGRO_PI * 2; + v[18] /= A5O_PI * 2; break; case 4: al_color_cmyk_to_rgb(v[12], v[13], v[14], v[15], v + 0, v + 1, v + 2); @@ -128,10 +128,10 @@ void Prog::run() al_color_rgb_to_lch(v[0], v[1], v[2], v + 16, v + 17, v + 18); v[3] /= 360; v[6] /= 360; - v[18] /= ALLEGRO_PI * 2; + v[18] /= A5O_PI * 2; break; case 5: - al_color_lch_to_rgb(v[16], v[17], v[18] * 2 * ALLEGRO_PI, v + 0, v + 1, v + 2); + al_color_lch_to_rgb(v[16], v[17], v[18] * 2 * A5O_PI, v + 0, v + 1, v + 2); v[0] = clamp(v[0]); v[1] = clamp(v[1]); v[2] = clamp(v[2]); @@ -141,7 +141,7 @@ void Prog::run() al_color_rgb_to_lch(v[0], v[1], v[2], v + 16, v + 17, v + 18); v[3] /= 360; v[6] /= 360; - v[18] /= ALLEGRO_PI * 2; + v[18] /= A5O_PI * 2; break; } } @@ -156,7 +156,7 @@ void Prog::run() d.draw(); - ALLEGRO_BITMAP *target = al_get_target_bitmap(); + A5O_BITMAP *target = al_get_target_bitmap(); int w = al_get_bitmap_width(target); int h = al_get_bitmap_height(target); draw_swatch(0, h - 80, w, h, v); @@ -181,8 +181,8 @@ void Prog::draw_swatch(float x1, float y1, float x2, float y2, float v[3]) int main(int argc, char *argv[]) { - ALLEGRO_DISPLAY *display; - ALLEGRO_FONT *font; + A5O_DISPLAY *display; + A5O_FONT *font; (void)argc; (void)argv; @@ -198,7 +198,7 @@ int main(int argc, char *argv[]) al_init_ttf_addon(); init_platform_specific(); - al_set_new_display_flags(ALLEGRO_GENERATE_EXPOSE_EVENTS); + al_set_new_display_flags(A5O_GENERATE_EXPOSE_EVENTS); display = al_create_display(720, 480); if (!display) { abort_example("Unable to create display\n"); diff --git a/examples/ex_color2.c b/examples/ex_color2.c index 4799223344..eb536d3fc5 100644 --- a/examples/ex_color2.c +++ b/examples/ex_color2.c @@ -1,4 +1,4 @@ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include #include @@ -11,15 +11,15 @@ #define FPS 60 typedef struct { - ALLEGRO_COLOR rgb; + A5O_COLOR rgb; float l, a, b; } Color; struct Example { - ALLEGRO_FONT *font; - ALLEGRO_BITMAP *lab[512]; - ALLEGRO_COLOR black; - ALLEGRO_COLOR white; + A5O_FONT *font; + A5O_BITMAP *lab[512]; + A5O_COLOR black; + A5O_COLOR white; Color color[2]; int mx, my; int mb; // 1 = clicked, 2 = released, 3 = pressed @@ -35,15 +35,15 @@ static void draw_lab(int l) if (example.lab[l]) return; example.lab[l] = al_create_bitmap(512, 512); - ALLEGRO_LOCKED_REGION *rg = al_lock_bitmap(example.lab[l], - ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, ALLEGRO_LOCK_WRITEONLY); + A5O_LOCKED_REGION *rg = al_lock_bitmap(example.lab[l], + A5O_PIXEL_FORMAT_ABGR_8888_LE, A5O_LOCK_WRITEONLY); int x, y; for (y = 0; y < 512; y++) { for (x = 0; x < 512; x++) { float a = (x - 511.0 / 2) / (511.0 / 2); float b = (y - 511.0 / 2) / (511.0 / 2); b = -b; - ALLEGRO_COLOR rgb = al_color_lab(l / 511.0, a, b); + A5O_COLOR rgb = al_color_lab(l / 511.0, a, b); if (!al_is_color_valid(rgb)) { rgb = al_map_rgb_f(0, 0, 0); } @@ -117,7 +117,7 @@ static void draw_range(int ci) if (rf < 0 || rf > 1 || gf < 0 || gf > 1 || bf < 0 || bf > 1) { continue; } - ALLEGRO_COLOR rgb = {rf, gf, bf, 1}; + A5O_COLOR rgb = {rf, gf, bf, 1}; float d = al_color_distance_ciede2000(rgb, example.color[ci].rgb); if (d <= 0.05) { if (d > 0.04) { @@ -156,7 +156,7 @@ static void draw_axis(float x, float y, float a, float a2, float l, float y2 = y - l * sin(a) * i / (ticks - 1); al_draw_line(x2, y2, x2 + tl * cos(a2), y2 - tl * sin(a2), example.white, 1); al_draw_textf(example.font, example.white, - (int)(x2 + (tl + 2) * cos(a2)), (int)(y2 - (tl + 2) * sin(a2)), ALLEGRO_ALIGN_RIGHT, numformat, + (int)(x2 + (tl + 2) * cos(a2)), (int)(y2 - (tl + 2) * sin(a2)), A5O_ALIGN_RIGHT, numformat, num1 + i * (num2 - num1) / (ticks - 1)); } float lv = (num - num1) * l / (num2 - num1); @@ -179,24 +179,24 @@ static void redraw(void) float a = example.color[ci].a; float b = example.color[ci].b; - ALLEGRO_COLOR rgb = example.color[ci].rgb; + A5O_COLOR rgb = example.color[ci].rgb; draw_lab((int)(l * 511)); al_draw_bitmap(example.lab[(int)(l * 511)], cx + example.left_x, example.top_y, 0); - draw_axis(cx + example.left_x, example.top_y + 512.5, 0, ALLEGRO_PI / -2, 512, 16, + draw_axis(cx + example.left_x, example.top_y + 512.5, 0, A5O_PI / -2, 512, 16, "a*", 11, "%.2f", -1, 1, a); - draw_axis(cx + example.left_x - 0.5, example.top_y + 512, ALLEGRO_PI / 2, ALLEGRO_PI, + draw_axis(cx + example.left_x - 0.5, example.top_y + 512, A5O_PI / 2, A5O_PI, 512, 16, "b*", 11, "%.2f", -1, 1, b); al_draw_textf(example.font, example.white, cx + example.left_x + 36, 8, 0, "L*a*b* = %.2f/%.2f/%.2f sRGB = %.2f/%.2f/%.2f", l, a, b, rgb.r, rgb.g, rgb.b); - draw_axis(cx + example.slider_x - 0.5, example.top_y + 512, ALLEGRO_PI / 2, ALLEGRO_PI, + draw_axis(cx + example.slider_x - 0.5, example.top_y + 512, A5O_PI / 2, A5O_PI, 512, 4, "L*", 3, "%.1f", 0, 1, l); - ALLEGRO_COLOR c = al_map_rgb_f(rgb.r, rgb.g, rgb.b); + A5O_COLOR c = al_map_rgb_f(rgb.r, rgb.g, rgb.b); al_draw_filled_rectangle(cx, h - 128, cx + w / 2, h, c); draw_range(ci); @@ -220,11 +220,11 @@ static void redraw(void) float d2000 = al_color_distance_ciede2000(example.color[0].rgb, example.color[1].rgb); al_draw_textf(example.font, example.white, w / 2, h - 64, - ALLEGRO_ALIGN_CENTER, "dRGB = %.2f", drgb); + A5O_ALIGN_CENTER, "dRGB = %.2f", drgb); al_draw_textf(example.font, example.white, w / 2, h - 64 + 12, - ALLEGRO_ALIGN_CENTER, "dLab = %.2f", dlab); + A5O_ALIGN_CENTER, "dLab = %.2f", dlab); al_draw_textf(example.font, example.white, w / 2, h - 64 + 24, - ALLEGRO_ALIGN_CENTER, "CIEDE2000 = %.2f", d2000); + A5O_ALIGN_CENTER, "CIEDE2000 = %.2f", d2000); al_draw_rectangle(w / 2 - 80, h - 70, w / 2 + 80, h - 24, example.white, 4); @@ -278,9 +278,9 @@ static void update(void) int main(int argc, char **argv) { - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_DISPLAY *display; int w = 1280, h = 720; bool done = false; bool need_redraw = true; @@ -320,7 +320,7 @@ int main(int argc, char **argv) al_start_timer(timer); while (!done) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (need_redraw) { redraw(); @@ -331,29 +331,29 @@ int main(int argc, char **argv) while (true) { al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_KEY_CHAR: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_CHAR: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) done = true; break; - case ALLEGRO_EVENT_MOUSE_AXES: + case A5O_EVENT_MOUSE_AXES: example.mx = event.mouse.x; example.my = event.mouse.y; break; - case ALLEGRO_EVENT_MOUSE_BUTTON_DOWN: + case A5O_EVENT_MOUSE_BUTTON_DOWN: example.mb = 1; break; - case ALLEGRO_EVENT_MOUSE_BUTTON_UP: + case A5O_EVENT_MOUSE_BUTTON_UP: example.mb = 2; break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: done = true; break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: update(); need_redraw = true; break; diff --git a/examples/ex_color_gradient.c b/examples/ex_color_gradient.c index a004c88055..31910337a6 100644 --- a/examples/ex_color_gradient.c +++ b/examples/ex_color_gradient.c @@ -17,7 +17,7 @@ * * See readme.txt for copyright information. */ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include #include @@ -40,7 +40,7 @@ static char const *colorspace_name[] = { }; struct Example { - ALLEGRO_FONT *font; + A5O_FONT *font; bool resized; int ox, oy; float scale; @@ -60,8 +60,8 @@ static void print(int x, int y, char const *format, ...) float ox = 0; if (x - tw / 2 < 0) ox = tw / 2 - x; if (x + tw / 2 > SCREEN_W) ox = SCREEN_W - x - tw / 2; - ALLEGRO_TRANSFORM backup = *al_get_current_transform(); - ALLEGRO_TRANSFORM t; + A5O_TRANSFORM backup = *al_get_current_transform(); + A5O_TRANSFORM t; // Since we re-load the font when the window is resized we need to // un-scale it for drawing (but keep the scaled position). al_identity_transform(&t); @@ -76,7 +76,7 @@ static void print(int x, int y, char const *format, ...) } -static ALLEGRO_COLOR get_colorspace_rgb(ColorSpace cs, float *v) +static A5O_COLOR get_colorspace_rgb(ColorSpace cs, float *v) { if (cs == RGB) { return al_map_rgb_f(v[0], v[1], v[2]); @@ -100,8 +100,8 @@ static ALLEGRO_COLOR get_colorspace_rgb(ColorSpace cs, float *v) static void draw_gradient(int x, int y, ColorSpace cs, int color1, int color2) { - ALLEGRO_COLOR rgb1 = al_color_name(example.colors[color1]); - ALLEGRO_COLOR rgb2 = al_color_name(example.colors[color2]); + A5O_COLOR rgb1 = al_color_name(example.colors[color1]); + A5O_COLOR rgb2 = al_color_name(example.colors[color2]); float v1[3], v2[3]; if (cs == RGB) { al_unmap_rgb_f(rgb1, v1 + 0, v1 + 1, v1 + 2); @@ -131,7 +131,7 @@ static void draw_gradient(int x, int y, ColorSpace cs, v[0] = v1[0] + p * (v2[0] - v1[0]); v[1] = v1[1] + p * (v2[1] - v1[1]); v[2] = v1[2] + p * (v2[2] - v1[2]); - ALLEGRO_COLOR rgb = get_colorspace_rgb(cs, v); + A5O_COLOR rgb = get_colorspace_rgb(cs, v); float colx = x + 10 + i / example.scale; al_draw_filled_rectangle(colx, y + 10, colx + 1 / example.scale, y + 80, rgb); float l, a, b; @@ -169,7 +169,7 @@ static void redraw(void) // size whenever the transformation changes. example.font = al_load_font("data/DejaVuSans.ttf", 20 * example.scale, 0); } - ALLEGRO_TRANSFORM transform; + A5O_TRANSFORM transform; al_build_transform(&transform, example.ox, example.oy, example.scale, example.scale, 0); al_use_transform(&transform); @@ -209,9 +209,9 @@ static void init(void) int main(int argc, char **argv) { - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_DISPLAY *display; bool done = false; bool need_redraw = true; @@ -227,9 +227,9 @@ int main(int argc, char **argv) init_platform_specific(); example.resized = true; - al_set_new_display_flags(ALLEGRO_RESIZABLE); - al_set_new_display_option(ALLEGRO_SAMPLE_BUFFERS, 1, ALLEGRO_SUGGEST); - al_set_new_display_option(ALLEGRO_SAMPLES, 16, ALLEGRO_SUGGEST); + al_set_new_display_flags(A5O_RESIZABLE); + al_set_new_display_option(A5O_SAMPLE_BUFFERS, 1, A5O_SUGGEST); + al_set_new_display_option(A5O_SAMPLES, 16, A5O_SUGGEST); display = al_create_display(SCREEN_W, SCREEN_H); if (!display) { abort_example("Error creating display.\n"); @@ -253,7 +253,7 @@ int main(int argc, char **argv) al_start_timer(timer); while (!done) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (need_redraw) { redraw(); @@ -264,21 +264,21 @@ int main(int argc, char **argv) while (true) { al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_KEY_CHAR: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_CHAR: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) done = true; break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: done = true; break; - case ALLEGRO_EVENT_DISPLAY_RESIZE: + case A5O_EVENT_DISPLAY_RESIZE: al_acknowledge_resize(display); example.resized = true; break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: need_redraw = true; break; } diff --git a/examples/ex_compressed.c b/examples/ex_compressed.c index 3a6b656d5c..fb863b0b4d 100644 --- a/examples/ex_compressed.c +++ b/examples/ex_compressed.c @@ -7,32 +7,32 @@ #include "common.c" typedef struct BITMAP_TYPE { - ALLEGRO_BITMAP* bmp; - ALLEGRO_BITMAP* clone; - ALLEGRO_BITMAP* decomp; - ALLEGRO_BITMAP* lock_clone; - ALLEGRO_PIXEL_FORMAT format; + A5O_BITMAP* bmp; + A5O_BITMAP* clone; + A5O_BITMAP* decomp; + A5O_BITMAP* lock_clone; + A5O_PIXEL_FORMAT format; const char* name; } BITMAP_TYPE; int main(int argc, char **argv) { const char *filename; - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_FONT *font; - ALLEGRO_BITMAP *bkg; + A5O_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_FONT *font; + A5O_BITMAP *bkg; bool redraw = true; int ii; int cur_bitmap = 0; bool compare = false; #define NUM_BITMAPS 4 BITMAP_TYPE bitmaps[NUM_BITMAPS] = { - {NULL, NULL, NULL, NULL, ALLEGRO_PIXEL_FORMAT_ANY, "Uncompressed"}, - {NULL, NULL, NULL, NULL, ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1, "DXT1"}, - {NULL, NULL, NULL, NULL, ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3, "DXT3"}, - {NULL, NULL, NULL, NULL, ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5, "DXT5"}, + {NULL, NULL, NULL, NULL, A5O_PIXEL_FORMAT_ANY, "Uncompressed"}, + {NULL, NULL, NULL, NULL, A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1, "DXT1"}, + {NULL, NULL, NULL, NULL, A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3, "DXT3"}, + {NULL, NULL, NULL, NULL, A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5, "DXT5"}, }; if (argc > 1) { @@ -86,7 +86,7 @@ int main(int argc, char **argv) log_printf("%s clone time: %f sec\n", bitmaps[ii].name, t1 - t0); /* Decompress */ - al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ANY); + al_set_new_bitmap_format(A5O_PIXEL_FORMAT_ANY); t0 = al_get_time(); bitmaps[ii].decomp = al_clone_bitmap(bitmaps[ii].bmp); t1 = al_get_time(); @@ -113,7 +113,7 @@ int main(int argc, char **argv) /* Lock and unlock it, hopefully causing a no-op operation */ al_lock_bitmap_region_blocked(bitmaps[ii].lock_clone, 16 / block_width, 16 / block_height, 64 / block_width, - 64 / block_height, ALLEGRO_LOCK_READWRITE); + 64 / block_height, A5O_LOCK_READWRITE); al_unlock_bitmap(bitmaps[ii].lock_clone); } @@ -124,7 +124,7 @@ int main(int argc, char **argv) abort_example("data/bkg.png not found or failed to load\n"); } - al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ANY); + al_set_new_bitmap_format(A5O_PIXEL_FORMAT_ANY); font = al_create_builtin_font(); timer = al_create_timer(1.0 / 30); queue = al_create_event_queue(); @@ -134,31 +134,31 @@ int main(int argc, char **argv) al_start_timer(timer); while (1) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: goto EXIT; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: redraw = true; break; - case ALLEGRO_EVENT_KEY_DOWN: + case A5O_EVENT_KEY_DOWN: switch (event.keyboard.keycode) { - case ALLEGRO_KEY_LEFT: + case A5O_KEY_LEFT: cur_bitmap = (cur_bitmap - 1 + NUM_BITMAPS) % NUM_BITMAPS; break; - case ALLEGRO_KEY_RIGHT: + case A5O_KEY_RIGHT: cur_bitmap = (cur_bitmap + 1) % NUM_BITMAPS; break; - case ALLEGRO_KEY_SPACE: + case A5O_KEY_SPACE: compare = true; break; - case ALLEGRO_KEY_ESCAPE: + case A5O_KEY_ESCAPE: goto EXIT; } break; - case ALLEGRO_EVENT_KEY_UP: - if (event.keyboard.keycode == ALLEGRO_KEY_SPACE) { + case A5O_EVENT_KEY_UP: + if (event.keyboard.keycode == A5O_KEY_SPACE) { compare = false; } break; @@ -170,7 +170,7 @@ int main(int argc, char **argv) redraw = false; al_clear_to_color(al_map_rgb_f(0, 0, 0)); al_draw_bitmap(bkg, 0, 0, 0); - al_draw_textf(font, al_map_rgb_f(1, 1, 1), 5, 5, ALLEGRO_ALIGN_LEFT, + al_draw_textf(font, al_map_rgb_f(1, 1, 1), 5, 5, A5O_ALIGN_LEFT, "SPACE to compare. Arrows to switch. Format: %s", bitmaps[idx].name); al_draw_bitmap(bitmaps[idx].bmp, 0, 20, 0); al_draw_bitmap(bitmaps[idx].clone, w, 20, 0); diff --git a/examples/ex_config.c b/examples/ex_config.c index 8fbf01d219..8d5648a9e2 100644 --- a/examples/ex_config.c +++ b/examples/ex_config.c @@ -23,10 +23,10 @@ do { \ int main(int argc, char **argv) { - ALLEGRO_CONFIG *cfg; + A5O_CONFIG *cfg; const char *value; - ALLEGRO_CONFIG_SECTION *iterator; - ALLEGRO_CONFIG_ENTRY *iterator2; + A5O_CONFIG_SECTION *iterator; + A5O_CONFIG_ENTRY *iterator2; (void)argc; (void)argv; diff --git a/examples/ex_convert.c b/examples/ex_convert.c index 711e1cdf6a..4b14320d35 100644 --- a/examples/ex_convert.c +++ b/examples/ex_convert.c @@ -9,7 +9,7 @@ int main(int argc, char **argv) { - ALLEGRO_BITMAP *bitmap; + A5O_BITMAP *bitmap; double t0; double t1; @@ -28,10 +28,10 @@ int main(int argc, char **argv) al_init_image_addon(); - al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ARGB_8888); - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_format(A5O_PIXEL_FORMAT_ARGB_8888); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); - bitmap = al_load_bitmap_flags(argv[1], ALLEGRO_NO_PREMULTIPLIED_ALPHA); + bitmap = al_load_bitmap_flags(argv[1], A5O_NO_PREMULTIPLIED_ALPHA); if (!bitmap) { log_printf("Error loading input file\n"); goto done; diff --git a/examples/ex_cpu.c b/examples/ex_cpu.c index 8434e8ce70..2854e64981 100644 --- a/examples/ex_cpu.c +++ b/examples/ex_cpu.c @@ -12,10 +12,10 @@ int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_FONT *font; + A5O_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_FONT *font; bool done = false; bool redraw = true; @@ -50,10 +50,10 @@ int main(int argc, char **argv) al_start_timer(timer); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); while (!done) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (redraw && al_is_event_queue_empty(queue)) { al_clear_to_color(al_map_rgba_f(0, 0, 0, 1.0)); @@ -67,17 +67,17 @@ int main(int argc, char **argv) al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) { done = true; } break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: done = true; break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: redraw = true; break; } diff --git a/examples/ex_curl.c b/examples/ex_curl.c index 2c90f08dbc..eedef5bbf3 100644 --- a/examples/ex_curl.c +++ b/examples/ex_curl.c @@ -62,7 +62,7 @@ struct CURL_FILE { /* forward declaration */ -static ALLEGRO_FILE_INTERFACE curl_file_vtable; +static A5O_FILE_INTERFACE curl_file_vtable; /* we use a global one for convenience */ @@ -140,7 +140,7 @@ static void *curl_file_fopen(const char *path, const char *mode) } -static bool curl_file_fclose(ALLEGRO_FILE *f) +static bool curl_file_fclose(A5O_FILE *f) { CURL_FILE *cf = al_get_file_userdata(f); @@ -225,7 +225,7 @@ static void use_buffer(CURL_FILE *cf, size_t size) } -static size_t curl_file_fread(ALLEGRO_FILE *f, void *ptr, size_t size) +static size_t curl_file_fread(A5O_FILE *f, void *ptr, size_t size) { CURL_FILE *cf = al_get_file_userdata(f); @@ -242,7 +242,7 @@ static size_t curl_file_fread(ALLEGRO_FILE *f, void *ptr, size_t size) } -static size_t curl_file_fwrite(ALLEGRO_FILE *f, const void *ptr, size_t size) +static size_t curl_file_fwrite(A5O_FILE *f, const void *ptr, size_t size) { (void)f; (void)ptr; @@ -252,14 +252,14 @@ static size_t curl_file_fwrite(ALLEGRO_FILE *f, const void *ptr, size_t size) } -static bool curl_file_fflush(ALLEGRO_FILE *f) +static bool curl_file_fflush(A5O_FILE *f) { (void)f; return true; } -static int64_t curl_file_ftell(ALLEGRO_FILE *f) +static int64_t curl_file_ftell(A5O_FILE *f) { /* Not implemented. */ (void)f; @@ -268,9 +268,9 @@ static int64_t curl_file_ftell(ALLEGRO_FILE *f) } -static bool curl_file_fseek(ALLEGRO_FILE *f, int64_t offset, int whence) +static bool curl_file_fseek(A5O_FILE *f, int64_t offset, int whence) { - if (whence != ALLEGRO_SEEK_CUR || offset < 0) { + if (whence != A5O_SEEK_CUR || offset < 0) { /* Not implemented. */ al_set_errno(ENOSYS); return false; @@ -286,7 +286,7 @@ static bool curl_file_fseek(ALLEGRO_FILE *f, int64_t offset, int whence) } -static bool curl_file_feof(ALLEGRO_FILE *f) +static bool curl_file_feof(A5O_FILE *f) { CURL_FILE *cf = al_get_file_userdata(f); @@ -294,7 +294,7 @@ static bool curl_file_feof(ALLEGRO_FILE *f) } -static int curl_file_ferror(ALLEGRO_FILE *f) +static int curl_file_ferror(A5O_FILE *f) { /* Not implemented. */ (void)f; @@ -302,7 +302,7 @@ static int curl_file_ferror(ALLEGRO_FILE *f) } -static const char *curl_file_ferrmsg(ALLEGRO_FILE *f) +static const char *curl_file_ferrmsg(A5O_FILE *f) { /* Not implemented. */ (void)f; @@ -310,14 +310,14 @@ static const char *curl_file_ferrmsg(ALLEGRO_FILE *f) } -static void curl_file_fclearerr(ALLEGRO_FILE *f) +static void curl_file_fclearerr(A5O_FILE *f) { /* Not implemented. */ (void)f; } -static int curl_file_fungetc(ALLEGRO_FILE *f, int c) +static int curl_file_fungetc(A5O_FILE *f, int c) { /* Not implemented. */ (void)f; @@ -327,7 +327,7 @@ static int curl_file_fungetc(ALLEGRO_FILE *f, int c) } -static off_t curl_file_fsize(ALLEGRO_FILE *f) +static off_t curl_file_fsize(A5O_FILE *f) { /* Not implemented. */ (void)f; @@ -336,7 +336,7 @@ static off_t curl_file_fsize(ALLEGRO_FILE *f) } -static ALLEGRO_FILE_INTERFACE curl_file_vtable = +static A5O_FILE_INTERFACE curl_file_vtable = { curl_file_fopen, curl_file_fclose, @@ -354,10 +354,10 @@ static ALLEGRO_FILE_INTERFACE curl_file_vtable = }; -static void show_image(ALLEGRO_BITMAP *bmp, ALLEGRO_DISPLAY *disp) +static void show_image(A5O_BITMAP *bmp, A5O_DISPLAY *disp) { - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; queue = al_create_event_queue(); al_register_event_source(queue, al_get_keyboard_event_source()); @@ -367,11 +367,11 @@ static void show_image(ALLEGRO_BITMAP *bmp, ALLEGRO_DISPLAY *disp) al_draw_bitmap(bmp, 0, 0, 0); al_flip_display(); al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_KEY_DOWN - && event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_DOWN + && event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } - else if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + else if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } } @@ -383,8 +383,8 @@ static void show_image(ALLEGRO_BITMAP *bmp, ALLEGRO_DISPLAY *disp) int main(int argc, const char *argv[]) { const char *url; - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *bmp; + A5O_DISPLAY *display; + A5O_BITMAP *bmp; bool wait_for_log = true; if (argc > 1) diff --git a/examples/ex_d3d.cpp b/examples/ex_d3d.cpp index 842f9ffe32..204dccfbd5 100644 --- a/examples/ex_d3d.cpp +++ b/examples/ex_d3d.cpp @@ -21,7 +21,7 @@ struct D3DVERTEX int main(int argc, char *argv[]) { - ALLEGRO_DISPLAY *display; + A5O_DISPLAY *display; (void)argc; (void)argv; @@ -32,14 +32,14 @@ int main(int argc, char *argv[]) open_log(); al_install_keyboard(); - al_set_new_display_flags(ALLEGRO_DIRECT3D); - al_set_new_display_option(ALLEGRO_DEPTH_SIZE, 16, ALLEGRO_SUGGEST); + al_set_new_display_flags(A5O_DIRECT3D); + al_set_new_display_option(A5O_DEPTH_SIZE, 16, A5O_SUGGEST); display = al_create_display(640, 480); if (!display) { abort_example("Unable to create display.\n"); } - ALLEGRO_KEYBOARD_STATE state; + A5O_KEYBOARD_STATE state; IDirect3DDevice9 *d3dd = al_get_d3d_device(display); @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) start = al_get_time(); frames++; - } while (!al_key_down(&state, ALLEGRO_KEY_ESCAPE)); + } while (!al_key_down(&state, A5O_KEY_ESCAPE)); double elapsed = al_get_time() - start_secs; log_printf("%g fps\n", frames/elapsed); diff --git a/examples/ex_depth_mask.c b/examples/ex_depth_mask.c index 5b8d6ca535..d23f9a0214 100644 --- a/examples/ex_depth_mask.c +++ b/examples/ex_depth_mask.c @@ -10,9 +10,9 @@ #define COUNT 80 struct Example { - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *mysha, *obp; - ALLEGRO_FONT *font, *font2; + A5O_DISPLAY *display; + A5O_BITMAP *mysha, *obp; + A5O_FONT *font, *font2; double direct_speed_measure; struct Sprite { @@ -24,18 +24,18 @@ struct Example { static void redraw(void) { - ALLEGRO_TRANSFORM t; + A5O_TRANSFORM t; int i; /* We first draw the Obp background and clear the depth buffer to 1. */ - al_set_render_state(ALLEGRO_ALPHA_TEST, true); - al_set_render_state(ALLEGRO_ALPHA_FUNCTION, ALLEGRO_RENDER_GREATER); - al_set_render_state(ALLEGRO_ALPHA_TEST_VALUE, 0); + al_set_render_state(A5O_ALPHA_TEST, true); + al_set_render_state(A5O_ALPHA_FUNCTION, A5O_RENDER_GREATER); + al_set_render_state(A5O_ALPHA_TEST_VALUE, 0); - al_set_render_state(ALLEGRO_DEPTH_TEST, false); + al_set_render_state(A5O_DEPTH_TEST, false); - al_set_render_state(ALLEGRO_WRITE_MASK, ALLEGRO_MASK_DEPTH | ALLEGRO_MASK_RGBA); + al_set_render_state(A5O_WRITE_MASK, A5O_MASK_DEPTH | A5O_MASK_RGBA); al_clear_depth_buffer(1); al_clear_to_color(al_map_rgb_f(0, 0, 0)); @@ -46,9 +46,9 @@ static void redraw(void) * of 0). */ - al_set_render_state(ALLEGRO_DEPTH_TEST, true); - al_set_render_state(ALLEGRO_DEPTH_FUNCTION, ALLEGRO_RENDER_ALWAYS); - al_set_render_state(ALLEGRO_WRITE_MASK, ALLEGRO_MASK_DEPTH); + al_set_render_state(A5O_DEPTH_TEST, true); + al_set_render_state(A5O_DEPTH_FUNCTION, A5O_RENDER_ALWAYS); + al_set_render_state(A5O_WRITE_MASK, A5O_MASK_DEPTH); for (i = 0; i < COUNT; i++) { struct Sprite *s = example.sprites + i; @@ -61,7 +61,7 @@ static void redraw(void) al_translate_transform(&t, s->x + x, s->y + y); al_use_transform(&t); al_draw_text(example.font, al_map_rgb(0, 0, 0), 0, 0, - ALLEGRO_ALIGN_CENTER, "Allegro 5"); + A5O_ALIGN_CENTER, "Allegro 5"); } } al_hold_bitmap_drawing(false); @@ -73,15 +73,15 @@ static void redraw(void) * sprites have been drawn before. */ - al_set_render_state(ALLEGRO_DEPTH_FUNCTION, ALLEGRO_RENDER_EQUAL); - al_set_render_state(ALLEGRO_WRITE_MASK, ALLEGRO_MASK_RGBA); + al_set_render_state(A5O_DEPTH_FUNCTION, A5O_RENDER_EQUAL); + al_set_render_state(A5O_WRITE_MASK, A5O_MASK_RGBA); al_draw_scaled_bitmap(example.mysha, 0, 0, 320, 200, 0, 0, 320 * 480 / 200, 480, 0); /* Finally we draw an FPS counter. */ - al_set_render_state(ALLEGRO_DEPTH_TEST, false); + al_set_render_state(A5O_DEPTH_TEST, false); al_draw_textf(example.font2, al_map_rgb_f(1, 1, 1), 640, 0, - ALLEGRO_ALIGN_RIGHT, "%.1f FPS", 1.0 / example.direct_speed_measure); + A5O_ALIGN_RIGHT, "%.1f FPS", 1.0 / example.direct_speed_measure); } static void update(void) @@ -92,7 +92,7 @@ static void update(void) s->x -= 4; if (s->x < 80) s->x += 640; - s->angle += i * ALLEGRO_PI / 180 / COUNT; + s->angle += i * A5O_PI / 180 / COUNT; } } @@ -108,9 +108,9 @@ static void init(void) int main(int argc, char **argv) { - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_MONITOR_INFO info; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_MONITOR_INFO info; int w = 640, h = 480; bool done = false; bool need_redraw = true; @@ -140,21 +140,21 @@ int main(int argc, char **argv) al_get_monitor_info(0, &info); int flags = 0; - #ifdef ALLEGRO_IPHONE - flags |= ALLEGRO_FULLSCREEN_WINDOW; + #ifdef A5O_IPHONE + flags |= A5O_FULLSCREEN_WINDOW; #endif if (argc > 1 && strcmp(argv[1], "shader") == 0) { - flags |= ALLEGRO_PROGRAMMABLE_PIPELINE; + flags |= A5O_PROGRAMMABLE_PIPELINE; } al_set_new_display_flags(flags); - al_set_new_display_option(ALLEGRO_SUPPORTED_ORIENTATIONS, - ALLEGRO_DISPLAY_ORIENTATION_ALL, ALLEGRO_SUGGEST); + al_set_new_display_option(A5O_SUPPORTED_ORIENTATIONS, + A5O_DISPLAY_ORIENTATION_ALL, A5O_SUGGEST); - al_set_new_display_option(ALLEGRO_DEPTH_SIZE, 8, ALLEGRO_SUGGEST); + al_set_new_display_option(A5O_DEPTH_SIZE, 8, A5O_SUGGEST); - al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR); + al_set_new_bitmap_flags(A5O_MIN_LINEAR | A5O_MAG_LINEAR); example.display = al_create_display(w, h); if (!example.display) { @@ -199,7 +199,7 @@ int main(int argc, char **argv) al_start_timer(timer); while (!done) { - ALLEGRO_EVENT event; + A5O_EVENT event; w = al_get_display_width(example.display); h = al_get_display_height(example.display); @@ -216,31 +216,31 @@ int main(int argc, char **argv) al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_KEY_CHAR: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_CHAR: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) done = true; break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: done = true; break; - case ALLEGRO_EVENT_DISPLAY_HALT_DRAWING: + case A5O_EVENT_DISPLAY_HALT_DRAWING: background = true; al_acknowledge_drawing_halt(event.display.source); break; - case ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING: + case A5O_EVENT_DISPLAY_RESUME_DRAWING: background = false; break; - case ALLEGRO_EVENT_DISPLAY_RESIZE: + case A5O_EVENT_DISPLAY_RESIZE: al_acknowledge_resize(event.display.source); break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: update(); need_redraw = true; break; diff --git a/examples/ex_depth_target.c b/examples/ex_depth_target.c index 767ea9e74f..f9e6dca0c0 100644 --- a/examples/ex_depth_target.c +++ b/examples/ex_depth_target.c @@ -1,4 +1,4 @@ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include #include @@ -12,22 +12,22 @@ #define FPS 60 struct Example { - ALLEGRO_BITMAP *target_depth; - ALLEGRO_BITMAP *target_no_depth; - ALLEGRO_BITMAP *target_no_multisample; - ALLEGRO_FONT *font; + A5O_BITMAP *target_depth; + A5O_BITMAP *target_no_depth; + A5O_BITMAP *target_no_multisample; + A5O_FONT *font; double t; double direct_speed_measure; } example; -static void draw_on_target(ALLEGRO_BITMAP *target) +static void draw_on_target(A5O_BITMAP *target) { - ALLEGRO_STATE state; - ALLEGRO_TRANSFORM transform; + A5O_STATE state; + A5O_TRANSFORM transform; - al_store_state(&state, ALLEGRO_STATE_TARGET_BITMAP | - ALLEGRO_STATE_TRANSFORM | - ALLEGRO_STATE_PROJECTION_TRANSFORM); + al_store_state(&state, A5O_STATE_TARGET_BITMAP | + A5O_STATE_TRANSFORM | + A5O_STATE_PROJECTION_TRANSFORM); al_set_target_bitmap(target); al_clear_to_color(al_map_rgba_f(0, 0, 0, 0)); @@ -41,7 +41,7 @@ static void draw_on_target(ALLEGRO_BITMAP *target) al_draw_filled_rectangle(-0.75, -0.5, 0.75, 0.5, al_color_name("blue")); - al_set_render_state(ALLEGRO_DEPTH_TEST, true); + al_set_render_state(A5O_DEPTH_TEST, true); int i, j; for (i = 0; i < 24; i++) { @@ -49,8 +49,8 @@ static void draw_on_target(ALLEGRO_BITMAP *target) al_identity_transform(&transform); al_translate_transform_3d(&transform, 0, 0, j * 0.01); al_rotate_transform_3d(&transform, 0, 1, 0, - ALLEGRO_PI * (i / 12.0 + example.t / 2)); - al_rotate_transform_3d(&transform, 1, 0, 0, ALLEGRO_PI * 0.25); + A5O_PI * (i / 12.0 + example.t / 2)); + al_rotate_transform_3d(&transform, 1, 0, 0, A5O_PI * 0.25); al_use_transform(&transform); if (j == 0) al_draw_filled_rectangle(0, -.5, .5, .5, i % 2 == 0 ? @@ -61,7 +61,7 @@ static void draw_on_target(ALLEGRO_BITMAP *target) } } - al_set_render_state(ALLEGRO_DEPTH_TEST, false); + al_set_render_state(A5O_DEPTH_TEST, false); al_identity_transform(&transform); al_use_transform(&transform); @@ -77,19 +77,19 @@ static void draw_on_target(ALLEGRO_BITMAP *target) static void redraw(void) { double w = 512, h = 512; - ALLEGRO_COLOR black = al_color_name("black"); + A5O_COLOR black = al_color_name("black"); draw_on_target(example.target_depth); draw_on_target(example.target_no_depth); draw_on_target(example.target_no_multisample); al_clear_to_color(al_color_name("green")); - ALLEGRO_TRANSFORM transform; + A5O_TRANSFORM transform; al_identity_transform(&transform); al_use_transform(&transform); al_translate_transform(&transform, -128, -128); - al_rotate_transform(&transform, example.t * ALLEGRO_PI / 3); + al_rotate_transform(&transform, example.t * A5O_PI / 3); al_translate_transform(&transform, 512 + 128, 128); al_use_transform(&transform); al_draw_bitmap(example.target_no_depth, 0, 0, 0); @@ -98,7 +98,7 @@ static void redraw(void) al_identity_transform(&transform); al_use_transform(&transform); al_translate_transform(&transform, -128, -128); - al_rotate_transform(&transform, example.t * ALLEGRO_PI / 3); + al_rotate_transform(&transform, example.t * A5O_PI / 3); al_translate_transform(&transform, 512 + 128, 256 + 128); al_use_transform(&transform); al_draw_bitmap(example.target_no_multisample, 0, 0, 0); @@ -107,7 +107,7 @@ static void redraw(void) al_identity_transform(&transform); al_use_transform(&transform); al_translate_transform(&transform, -256, -256); - al_rotate_transform(&transform, example.t * ALLEGRO_PI / 3); + al_rotate_transform(&transform, example.t * A5O_PI / 3); al_translate_transform(&transform, 256, 256); al_use_transform(&transform); al_draw_bitmap(example.target_depth, 0, 0, 0); @@ -122,7 +122,7 @@ static void redraw(void) al_identity_transform(&transform); al_use_transform(&transform); al_draw_textf(example.font, black, w, 0, - ALLEGRO_ALIGN_RIGHT, "%.1f FPS", 1.0 / example.direct_speed_measure); + A5O_ALIGN_RIGHT, "%.1f FPS", 1.0 / example.direct_speed_measure); } static void update(void) @@ -132,7 +132,7 @@ static void update(void) static void init(void) { - al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR); + al_set_new_bitmap_flags(A5O_MIN_LINEAR | A5O_MAG_LINEAR); al_set_new_bitmap_depth(16); al_set_new_bitmap_samples(4); example.target_depth = al_create_bitmap(512, 512); @@ -144,9 +144,9 @@ static void init(void) int main(int argc, char **argv) { - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_DISPLAY *display; int w = 512 + 256, h = 512; bool done = false; bool need_redraw = true; @@ -169,8 +169,8 @@ int main(int argc, char **argv) init_platform_specific(); - al_set_new_display_option(ALLEGRO_DEPTH_SIZE, 16, ALLEGRO_SUGGEST); - al_set_new_display_flags(ALLEGRO_PROGRAMMABLE_PIPELINE); + al_set_new_display_option(A5O_DEPTH_SIZE, 16, A5O_SUGGEST); + al_set_new_display_flags(A5O_PROGRAMMABLE_PIPELINE); display = al_create_display(w, h); if (!display) { @@ -197,7 +197,7 @@ int main(int argc, char **argv) double t = -al_get_time(); while (!done) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (need_redraw) { t += al_get_time(); @@ -211,16 +211,16 @@ int main(int argc, char **argv) while (true) { al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_KEY_CHAR: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_CHAR: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) done = true; break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: done = true; break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: update(); need_redraw = true; break; diff --git a/examples/ex_dir.c b/examples/ex_dir.c index d9fdbc9af1..ea18c6e457 100644 --- a/examples/ex_dir.c +++ b/examples/ex_dir.c @@ -3,7 +3,7 @@ #include "common.c" -static void print_file(ALLEGRO_FS_ENTRY *entry) +static void print_file(A5O_FS_ENTRY *entry) { int mode = al_get_fs_entry_mode(entry); time_t now = time(NULL); @@ -15,25 +15,25 @@ static void print_file(ALLEGRO_FS_ENTRY *entry) log_printf("%-36s %s%s%s%s%s%s %8u %8u %8u %8u\n", name, - mode & ALLEGRO_FILEMODE_READ ? "r" : ".", - mode & ALLEGRO_FILEMODE_WRITE ? "w" : ".", - mode & ALLEGRO_FILEMODE_EXECUTE ? "x" : ".", - mode & ALLEGRO_FILEMODE_HIDDEN ? "h" : ".", - mode & ALLEGRO_FILEMODE_ISFILE ? "f" : ".", - mode & ALLEGRO_FILEMODE_ISDIR ? "d" : ".", + mode & A5O_FILEMODE_READ ? "r" : ".", + mode & A5O_FILEMODE_WRITE ? "w" : ".", + mode & A5O_FILEMODE_EXECUTE ? "x" : ".", + mode & A5O_FILEMODE_HIDDEN ? "h" : ".", + mode & A5O_FILEMODE_ISFILE ? "f" : ".", + mode & A5O_FILEMODE_ISDIR ? "d" : ".", (unsigned)(now - ctime), (unsigned)(now - mtime), (unsigned)(now - atime), (unsigned)size); } -static void print_entry(ALLEGRO_FS_ENTRY *entry) +static void print_entry(A5O_FS_ENTRY *entry) { - ALLEGRO_FS_ENTRY *next; + A5O_FS_ENTRY *next; print_file(entry); - if (!(al_get_fs_entry_mode(entry) & ALLEGRO_FILEMODE_ISDIR)) + if (!(al_get_fs_entry_mode(entry) & A5O_FILEMODE_ISDIR)) return; if (!al_open_directory(entry)) { @@ -54,26 +54,26 @@ static void print_entry(ALLEGRO_FS_ENTRY *entry) } -static int print_fs_entry_cb(ALLEGRO_FS_ENTRY * entry, void * extra) { +static int print_fs_entry_cb(A5O_FS_ENTRY * entry, void * extra) { (void) extra; print_file(entry); - return ALLEGRO_FOR_EACH_FS_ENTRY_OK; + return A5O_FOR_EACH_FS_ENTRY_OK; } -static int print_fs_entry_cb_norecurse(ALLEGRO_FS_ENTRY * entry, void * extra) { +static int print_fs_entry_cb_norecurse(A5O_FS_ENTRY * entry, void * extra) { (void) extra; print_file(entry); - return ALLEGRO_FOR_EACH_FS_ENTRY_SKIP; + return A5O_FOR_EACH_FS_ENTRY_SKIP; } -static void print_fs_entry(ALLEGRO_FS_ENTRY * dir) +static void print_fs_entry(A5O_FS_ENTRY * dir) { log_printf("\n------------------------------------\nExample of al_for_each_fs_entry with recursion:\n\n"); al_for_each_fs_entry(dir, print_fs_entry_cb, (void*) al_get_fs_entry_name(dir)); } -static void print_fs_entry_norecurse(ALLEGRO_FS_ENTRY * dir) +static void print_fs_entry_norecurse(A5O_FS_ENTRY * dir) { log_printf("\n------------------------------------\nExample of al_for_each_fs_entry without recursion:\n\n"); al_for_each_fs_entry(dir, print_fs_entry_cb_norecurse, @@ -99,12 +99,12 @@ int main(int argc, char **argv) "-------- " "--------\n"); - #ifdef ALLEGRO_ANDROID + #ifdef A5O_ANDROID al_android_set_apk_fs_interface(); #endif if (argc == 1) { - ALLEGRO_FS_ENTRY *entry = al_create_fs_entry("data"); + A5O_FS_ENTRY *entry = al_create_fs_entry("data"); print_entry(entry); print_fs_entry(entry); print_fs_entry_norecurse(entry); @@ -112,7 +112,7 @@ int main(int argc, char **argv) } for (i = 1; i < argc; i++) { - ALLEGRO_FS_ENTRY *entry = al_create_fs_entry(argv[i]); + A5O_FS_ENTRY *entry = al_create_fs_entry(argv[i]); print_entry(entry); print_fs_entry(entry); print_fs_entry_norecurse(entry); diff --git a/examples/ex_disable_screensaver.c b/examples/ex_disable_screensaver.c index b83394b1d0..a2b8fe55ac 100644 --- a/examples/ex_disable_screensaver.c +++ b/examples/ex_disable_screensaver.c @@ -6,10 +6,10 @@ int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_FONT *font; - ALLEGRO_EVENT_QUEUE *events; - ALLEGRO_EVENT event; + A5O_DISPLAY *display; + A5O_FONT *font; + A5O_EVENT_QUEUE *events; + A5O_EVENT event; bool done = false; bool active = true; bool fullscreen = false; @@ -27,8 +27,8 @@ int main(int argc, char **argv) al_install_keyboard(); al_init_font_addon(); - al_set_new_display_flags(ALLEGRO_GENERATE_EXPOSE_EVENTS | - (fullscreen ? ALLEGRO_FULLSCREEN : 0)); + al_set_new_display_flags(A5O_GENERATE_EXPOSE_EVENTS | + (fullscreen ? A5O_FULLSCREEN : 0)); display = al_create_display(640, 480); if (!display) { @@ -52,10 +52,10 @@ int main(int argc, char **argv) al_flip_display(); al_wait_for_event(events, &event); switch (event.type) { - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) done = true; - else if (event.keyboard.keycode == ALLEGRO_KEY_SPACE) { + else if (event.keyboard.keycode == A5O_KEY_SPACE) { if (al_inhibit_screensaver(active)) { active = !active; } diff --git a/examples/ex_display_events.c b/examples/ex_display_events.c index 70f2c868ac..df61123331 100644 --- a/examples/ex_display_events.c +++ b/examples/ex_display_events.c @@ -20,11 +20,11 @@ static void add_event(char const *f, ...) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; - ALLEGRO_FONT *font; - ALLEGRO_COLOR color, black, red, blue; + A5O_DISPLAY *display; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; + A5O_FONT *font; + A5O_COLOR color, black, red, blue; int i; (void)argc; @@ -39,7 +39,7 @@ int main(int argc, char **argv) al_install_keyboard(); al_init_font_addon(); - al_set_new_display_flags(ALLEGRO_RESIZABLE); + al_set_new_display_flags(A5O_RESIZABLE); display = al_create_display(640, 480); if (!display) { abort_example("Error creating display\n"); @@ -78,46 +78,46 @@ int main(int argc, char **argv) al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_MOUSE_ENTER_DISPLAY: - add_event("ALLEGRO_EVENT_MOUSE_ENTER_DISPLAY"); + case A5O_EVENT_MOUSE_ENTER_DISPLAY: + add_event("A5O_EVENT_MOUSE_ENTER_DISPLAY"); break; - case ALLEGRO_EVENT_MOUSE_LEAVE_DISPLAY: - add_event("ALLEGRO_EVENT_MOUSE_LEAVE_DISPLAY"); + case A5O_EVENT_MOUSE_LEAVE_DISPLAY: + add_event("A5O_EVENT_MOUSE_LEAVE_DISPLAY"); break; - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) { goto done; } break; - case ALLEGRO_EVENT_DISPLAY_RESIZE: - add_event("ALLEGRO_EVENT_DISPLAY_RESIZE x=%d, y=%d, " + case A5O_EVENT_DISPLAY_RESIZE: + add_event("A5O_EVENT_DISPLAY_RESIZE x=%d, y=%d, " "width=%d, height=%d", event.display.x, event.display.y, event.display.width, event.display.height); al_acknowledge_resize(event.display.source); break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: - add_event("ALLEGRO_EVENT_DISPLAY_CLOSE"); + case A5O_EVENT_DISPLAY_CLOSE: + add_event("A5O_EVENT_DISPLAY_CLOSE"); break; - case ALLEGRO_EVENT_DISPLAY_LOST: - add_event("ALLEGRO_EVENT_DISPLAY_LOST"); + case A5O_EVENT_DISPLAY_LOST: + add_event("A5O_EVENT_DISPLAY_LOST"); break; - case ALLEGRO_EVENT_DISPLAY_FOUND: - add_event("ALLEGRO_EVENT_DISPLAY_FOUND"); + case A5O_EVENT_DISPLAY_FOUND: + add_event("A5O_EVENT_DISPLAY_FOUND"); break; - case ALLEGRO_EVENT_DISPLAY_SWITCH_OUT: - add_event("ALLEGRO_EVENT_DISPLAY_SWITCH_OUT"); + case A5O_EVENT_DISPLAY_SWITCH_OUT: + add_event("A5O_EVENT_DISPLAY_SWITCH_OUT"); break; - case ALLEGRO_EVENT_DISPLAY_SWITCH_IN: - add_event("ALLEGRO_EVENT_DISPLAY_SWITCH_IN"); + case A5O_EVENT_DISPLAY_SWITCH_IN: + add_event("A5O_EVENT_DISPLAY_SWITCH_IN"); break; } } diff --git a/examples/ex_display_options.c b/examples/ex_display_options.c index 976b93fd9e..8b9b0dbdfc 100644 --- a/examples/ex_display_options.c +++ b/examples/ex_display_options.c @@ -6,8 +6,8 @@ #include "common.c" -ALLEGRO_FONT *font; -ALLEGRO_COLOR white; +A5O_FONT *font; +A5O_COLOR white; int font_h; int modes_count; int options_count; @@ -21,7 +21,7 @@ int selected_column; int selected_mode; int selected_option; -#define X(x, m) {#x, ALLEGRO_##x, 0, m, 0} +#define X(x, m) {#x, A5O_##x, 0, m, 0} struct { char const *name; int option; @@ -58,7 +58,7 @@ static char const *flag_names[32]; static void init_flags(void) { int i; - #define X(f) if (1 << i == ALLEGRO_##f) flag_names[i] = #f; + #define X(f) if (1 << i == A5O_##f) flag_names[i] = #f; for (i = 0; i < 32; i++) { X(WINDOWED) X(FULLSCREEN) @@ -81,14 +81,14 @@ static void load_font(void) font_h = al_get_font_line_height(font); } -static void display_options(ALLEGRO_DISPLAY *display) +static void display_options(A5O_DISPLAY *display) { int i, y = 10; int x = 10; int n = options_count; int dw = al_get_display_width(display); int dh = al_get_display_height(display); - ALLEGRO_COLOR c; + A5O_COLOR c; modes_count = al_get_num_display_modes(); @@ -97,7 +97,7 @@ static void display_options(ALLEGRO_DISPLAY *display) y += font_h; for (i = first_visible_row; i < modes_count + 2 && i < first_visible_row + visible_rows; i++) { - ALLEGRO_DISPLAY_MODE mode; + A5O_DISPLAY_MODE mode; if (i > 1) { al_get_display_mode(i - 2, &mode); } @@ -115,11 +115,11 @@ static void display_options(ALLEGRO_DISPLAY *display) } if (selected_column == 0 && selected_mode == i) { c = al_map_rgb_f(1, 1, 0); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_draw_filled_rectangle(x, y, x + 300, y + font_h, c); } c = al_map_rgb_f(0, 0, 0); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); if ((i == first_visible_row && i > 0) || (i == first_visible_row + visible_rows - 1 && i < modes_count + 1)) { @@ -137,7 +137,7 @@ static void display_options(ALLEGRO_DISPLAY *display) y = 10; c = al_map_rgb_f(0.8, 0.8, 1); al_draw_textf(font, c, x, y, 0, "Options for new display"); - al_draw_textf(font, c, dw - 10, y, ALLEGRO_ALIGN_RIGHT, "(current display)"); + al_draw_textf(font, c, dw - 10, y, A5O_ALIGN_RIGHT, "(current display)"); y += font_h; for (i = 0; i < n; i++) { if (selected_column == 1 && selected_option == i) { @@ -146,18 +146,18 @@ static void display_options(ALLEGRO_DISPLAY *display) } switch (options[i].required) { - case ALLEGRO_REQUIRE: c = al_map_rgb_f(0.5, 0, 0); break; - case ALLEGRO_SUGGEST: c = al_map_rgb_f(0, 0, 0); break; - case ALLEGRO_DONTCARE: c = al_map_rgb_f(0.5, 0.5, 0.5); break; + case A5O_REQUIRE: c = al_map_rgb_f(0.5, 0, 0); break; + case A5O_SUGGEST: c = al_map_rgb_f(0, 0, 0); break; + case A5O_DONTCARE: c = al_map_rgb_f(0.5, 0.5, 0.5); break; } al_draw_textf(font, c, x, y, 0, "%s: %d (%s)", options[i].name, options[i].value, - options[i].required == ALLEGRO_REQUIRE ? "required" : - options[i].required == ALLEGRO_SUGGEST ? "suggested" : + options[i].required == A5O_REQUIRE ? "required" : + options[i].required == A5O_SUGGEST ? "suggested" : "ignored"); c = al_map_rgb_f(0.9, 0.5, 0.3); - al_draw_textf(font, c, dw - 10, y, ALLEGRO_ALIGN_RIGHT, "%d", + al_draw_textf(font, c, dw - 10, y, A5O_ALIGN_RIGHT, "%d", al_get_display_option(display, options[i].option)); y += font_h; } @@ -184,7 +184,7 @@ static void display_options(ALLEGRO_DISPLAY *display) } c = al_map_rgb_f(1, 0, 0); - al_draw_text(font, c, dw / 2, dh - font_h, ALLEGRO_ALIGN_CENTRE, status); + al_draw_text(font, c, dw / 2, dh - font_h, A5O_ALIGN_CENTRE, status); } static void update_ui(void) @@ -195,9 +195,9 @@ static void update_ui(void) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_TIMER *timer; + A5O_DISPLAY *display; + A5O_EVENT_QUEUE *queue; + A5O_TIMER *timer; bool redraw = false; (void)argc; @@ -242,12 +242,12 @@ int main(int argc, char **argv) al_start_timer(timer); while (1) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } - if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN) { + if (event.type == A5O_EVENT_MOUSE_BUTTON_DOWN) { if (event.mouse.button == 1) { int dw = al_get_display_width(display); int y = 10; @@ -269,7 +269,7 @@ int main(int argc, char **argv) } } } - if (event.type == ALLEGRO_EVENT_TIMER) { + if (event.type == A5O_EVENT_TIMER) { int f = al_get_display_flags(display); if (f != flags) { redraw = true; @@ -277,45 +277,45 @@ int main(int argc, char **argv) old_flags |= f; } } - if (event.type == ALLEGRO_EVENT_KEY_CHAR) { + if (event.type == A5O_EVENT_KEY_CHAR) { int change; - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + if (event.keyboard.keycode == A5O_KEY_ESCAPE) break; - if (event.keyboard.keycode == ALLEGRO_KEY_LEFT) { + if (event.keyboard.keycode == A5O_KEY_LEFT) { selected_column = 0; redraw = true; } - if (event.keyboard.keycode == ALLEGRO_KEY_RIGHT) { + if (event.keyboard.keycode == A5O_KEY_RIGHT) { selected_column = 1; redraw = true; } - if (event.keyboard.keycode == ALLEGRO_KEY_UP) { + if (event.keyboard.keycode == A5O_KEY_UP) { if (selected_column == 0) selected_mode -= 1; if (selected_column == 1) selected_option -= 1; redraw = true; } - if (event.keyboard.keycode == ALLEGRO_KEY_DOWN) { + if (event.keyboard.keycode == A5O_KEY_DOWN) { if (selected_column == 0) selected_mode += 1; if (selected_column == 1) selected_option += 1; redraw = true; } - if (event.keyboard.keycode == ALLEGRO_KEY_ENTER) { + if (event.keyboard.keycode == A5O_KEY_ENTER) { if (selected_column == 0) { - ALLEGRO_DISPLAY_MODE mode; - ALLEGRO_DISPLAY *new_display; + A5O_DISPLAY_MODE mode; + A5O_DISPLAY *new_display; if (selected_mode > 1) { al_get_display_mode(selected_mode - 2, &mode); - al_set_new_display_flags(ALLEGRO_FULLSCREEN); + al_set_new_display_flags(A5O_FULLSCREEN); } else if (selected_mode == 1) { mode.width = 800; mode.height = 600; - al_set_new_display_flags(ALLEGRO_FULLSCREEN_WINDOW); + al_set_new_display_flags(A5O_FULLSCREEN_WINDOW); } else { mode.width = 800; mode.height = 600; - al_set_new_display_flags(ALLEGRO_WINDOWED); + al_set_new_display_flags(A5O_WINDOWED); } al_destroy_font(font); @@ -349,8 +349,8 @@ int main(int argc, char **argv) redraw = true; } change = 0; - if (event.keyboard.keycode == ALLEGRO_KEY_PGUP) change = 1; - if (event.keyboard.keycode == ALLEGRO_KEY_PGDN) change = -1; + if (event.keyboard.keycode == A5O_KEY_PGUP) change = 1; + if (event.keyboard.keycode == A5O_KEY_PGDN) change = -1; if (change && selected_column == 1) { options[selected_option].value += change; if (options[selected_option].value < 0) diff --git a/examples/ex_drag_and_drop.c b/examples/ex_drag_and_drop.c index b7deef70cd..7dfab227ca 100644 --- a/examples/ex_drag_and_drop.c +++ b/examples/ex_drag_and_drop.c @@ -15,7 +15,7 @@ * * See readme.txt for copyright information. */ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include #include @@ -28,15 +28,15 @@ // We only accept up to 25 lines of text or files at a time. typedef struct Cell { char *rows[25]; - ALLEGRO_BITMAP *bitmap; + A5O_BITMAP *bitmap; } Cell; int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_FONT *font; + A5O_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_FONT *font; bool done = false; bool redraw = true; int xdiv = 3; @@ -63,14 +63,14 @@ int main(int argc, char **argv) al_init_font_addon(); al_init_ttf_addon(); init_platform_specific(); - ALLEGRO_MONITOR_INFO info; + A5O_MONITOR_INFO info; al_get_monitor_info(0, &info); // Make the window half as wide as the desktop and 4:3 aspect int w = (info.x2 - info.x1) / 2; int h = w * 3 / 4; // Turn on drag/drop support - al_set_new_display_flags(ALLEGRO_DRAG_AND_DROP); + al_set_new_display_flags(A5O_DRAG_AND_DROP); display = al_create_display(w, h); if (!display) { abort_example("Error creating display.\n"); @@ -96,21 +96,21 @@ int main(int argc, char **argv) al_start_timer(timer); while (!done) { - ALLEGRO_EVENT event; + A5O_EVENT event; int fh = al_get_font_line_height(font); if (redraw && al_is_event_queue_empty(queue)) { // draw a grid with the dropped text rows or files - ALLEGRO_COLOR c1 = al_color_name("gainsboro"); - ALLEGRO_COLOR c2 = al_color_name("orange"); + A5O_COLOR c1 = al_color_name("gainsboro"); + A5O_COLOR c2 = al_color_name("orange"); al_clear_to_color(al_map_rgb_f(0, 0, 0)); for (int y = 0; y < ydiv; y++) { for (int x = 0; x < xdiv; x++) { int gx = x * w / xdiv; int gy = y * h / ydiv; if (grid[x + y * xdiv].bitmap) { - ALLEGRO_BITMAP *bmp = grid[x + y * xdiv].bitmap; + A5O_BITMAP *bmp = grid[x + y * xdiv].bitmap; float bw = al_get_bitmap_width(bmp); float bh = al_get_bitmap_height(bmp); float s = w / xdiv / bw; @@ -137,21 +137,21 @@ int main(int argc, char **argv) al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) { done = true; } break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: done = true; break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: redraw = true; break; - case ALLEGRO_EVENT_DROP: + case A5O_EVENT_DROP: drop_x = event.drop.x; drop_y = event.drop.y; int col = drop_x * xdiv / w; diff --git a/examples/ex_draw.c b/examples/ex_draw.c index e7b1bba7de..a66376e583 100644 --- a/examples/ex_draw.c +++ b/examples/ex_draw.c @@ -13,12 +13,12 @@ struct Example { - ALLEGRO_FONT *font; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_COLOR background, text, white, foreground; - ALLEGRO_COLOR outline; - ALLEGRO_BITMAP *pattern; - ALLEGRO_BITMAP *zoom; + A5O_FONT *font; + A5O_EVENT_QUEUE *queue; + A5O_COLOR background, text, white, foreground; + A5O_COLOR outline; + A5O_BITMAP *pattern; + A5O_BITMAP *zoom; double timer[4], counter[4]; int FPS; @@ -38,19 +38,19 @@ char const *names[] = { "lines" }; -static void draw_pattern(ALLEGRO_BITMAP *b) +static void draw_pattern(A5O_BITMAP *b) { int w = al_get_bitmap_width(b); int h = al_get_bitmap_height(b); int x, y; - int format = ALLEGRO_PIXEL_FORMAT_BGR_888; - ALLEGRO_COLOR light = al_map_rgb_f(1, 1, 1); - ALLEGRO_COLOR dark = al_map_rgb_f(1, 0.9, 0.8); - ALLEGRO_LOCKED_REGION *lock; - lock = al_lock_bitmap(b, format, ALLEGRO_LOCK_WRITEONLY); + int format = A5O_PIXEL_FORMAT_BGR_888; + A5O_COLOR light = al_map_rgb_f(1, 1, 1); + A5O_COLOR dark = al_map_rgb_f(1, 0.9, 0.8); + A5O_LOCKED_REGION *lock; + lock = al_lock_bitmap(b, format, A5O_LOCK_WRITEONLY); for (y = 0; y < h; y++) { for (x = 0; x < w; x++) { - ALLEGRO_COLOR c = (x + y) & 1 ? light : dark; + A5O_COLOR c = (x + y) & 1 ? light : dark; unsigned char r, g, b; unsigned char *data = lock->data; al_unmap_rgb(c, &r, &g, &b); @@ -74,15 +74,15 @@ static void print(char const *format, ...) { va_list list; char message[1024]; - ALLEGRO_STATE state; + A5O_STATE state; int th = al_get_font_line_height(ex.font); - al_store_state(&state, ALLEGRO_STATE_BLENDER); + al_store_state(&state, A5O_STATE_BLENDER); va_start(list, format); vsnprintf(message, sizeof message, format, list); va_end(list); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_draw_textf(ex.font, ex.text, ex.text_x, ex.text_y, 0, "%s", message); al_restore_state(&state); @@ -90,7 +90,7 @@ static void print(char const *format, ...) } static void primitive(float l, float t, float r, float b, - ALLEGRO_COLOR color, bool never_fill) + A5O_COLOR color, bool never_fill) { float cx = (l + r) / 2; float cy = (t + b) / 2; @@ -113,8 +113,8 @@ static void draw(void) int cx, cy, cw, ch; int w = al_get_bitmap_width(ex.zoom); int h = al_get_bitmap_height(ex.zoom); - ALLEGRO_BITMAP *screen = al_get_target_bitmap(); - ALLEGRO_BITMAP *mem; + A5O_BITMAP *screen = al_get_target_bitmap(); + A5O_BITMAP *mem; int rects_num = 16, i, j; float rects[16 * 4]; for (j = 0; j < 4; j++) { @@ -138,10 +138,10 @@ static void draw(void) set_xy(80, 16); print("Enlarged x 16"); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); if (ex.software) { - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); al_set_new_bitmap_format(al_get_bitmap_format(al_get_target_bitmap())); mem = al_create_bitmap(w, h); al_set_target_bitmap(mem); @@ -157,9 +157,9 @@ static void draw(void) /* Draw the test scene. */ - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); for (i = 0; i < rects_num; i++) { - ALLEGRO_COLOR rgba = ex.foreground; + A5O_COLOR rgba = ex.foreground; rgba.a *= 0.5; primitive( x + rects[i * 4 + 0], @@ -169,7 +169,7 @@ static void draw(void) rgba, false); } - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); if (ex.software) { al_set_target_bitmap(screen); @@ -206,7 +206,7 @@ static void draw(void) print("Supersampling: %dx (edit ex_draw.ini to change)", ex.samples); // FIXME: doesn't work -// al_get_display_option(ALLEGRO_SAMPLE_BUFFERS)); +// al_get_display_option(A5O_SAMPLE_BUFFERS)); } static void tick(void) @@ -217,7 +217,7 @@ static void tick(void) static void run(void) { - ALLEGRO_EVENT event; + A5O_EVENT event; bool need_draw = true; while (1) { @@ -229,26 +229,26 @@ static void run(void) al_wait_for_event(ex.queue, &event); switch (event.type) { - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: return; - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) return; - if (event.keyboard.keycode == ALLEGRO_KEY_SPACE) { + if (event.keyboard.keycode == A5O_KEY_SPACE) { ex.what++; if (ex.what == 5) ex.what = 0; } - if (event.keyboard.keycode == ALLEGRO_KEY_S) { + if (event.keyboard.keycode == A5O_KEY_S) { ex.software = !ex.software; } - if (event.keyboard.keycode == ALLEGRO_KEY_T) { + if (event.keyboard.keycode == A5O_KEY_T) { ex.thickness++; if (ex.thickness == 2) ex.thickness = 0; } break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: need_draw = true; break; } @@ -275,9 +275,9 @@ static void init(void) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; - ALLEGRO_CONFIG *config; + A5O_DISPLAY *display; + A5O_TIMER *timer; + A5O_CONFIG *config; char const *value; char str[256]; @@ -309,8 +309,8 @@ int main(int argc, char **argv) al_destroy_config(config); if (ex.samples) { - al_set_new_display_option(ALLEGRO_SAMPLE_BUFFERS, 1, ALLEGRO_REQUIRE); - al_set_new_display_option(ALLEGRO_SAMPLES, ex.samples, ALLEGRO_SUGGEST); + al_set_new_display_option(A5O_SAMPLE_BUFFERS, 1, A5O_REQUIRE); + al_set_new_display_option(A5O_SAMPLES, ex.samples, A5O_SUGGEST); } display = al_create_display(640, 640); if (!display) { diff --git a/examples/ex_draw_bitmap.c b/examples/ex_draw_bitmap.c index 3756b6bcc1..ad4b5c64a6 100644 --- a/examples/ex_draw_bitmap.c +++ b/examples/ex_draw_bitmap.c @@ -6,7 +6,7 @@ #include "common.c" -ALLEGRO_DEBUG_CHANNEL("main") +A5O_DEBUG_CHANNEL("main") #define FPS 60 #define MAX_SPRITES 1024 @@ -28,20 +28,20 @@ struct Example { Sprite sprites[MAX_SPRITES]; bool use_memory_bitmaps; int blending; - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *mysha, *bitmap; + A5O_DISPLAY *display; + A5O_BITMAP *mysha, *bitmap; bool hold_bitmap_drawing; int bitmap_size; int sprite_count; bool show_help; - ALLEGRO_FONT *font; + A5O_FONT *font; int t; - ALLEGRO_COLOR white; - ALLEGRO_COLOR half_white; - ALLEGRO_COLOR dark; - ALLEGRO_COLOR red; + A5O_COLOR white; + A5O_COLOR half_white; + A5O_COLOR dark; + A5O_COLOR red; double direct_speed_measure; @@ -121,11 +121,11 @@ static void change_size(int size) if (example.bitmap) al_destroy_bitmap(example.bitmap); al_set_new_bitmap_flags( - example.use_memory_bitmaps ? ALLEGRO_MEMORY_BITMAP : ALLEGRO_VIDEO_BITMAP); + example.use_memory_bitmaps ? A5O_MEMORY_BITMAP : A5O_VIDEO_BITMAP); example.bitmap = al_create_bitmap(size, size); example.bitmap_size = size; al_set_target_bitmap(example.bitmap); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_clear_to_color(al_map_rgba_f(0, 0, 0, 0)); bw = al_get_bitmap_width(example.mysha); bh = al_get_bitmap_height(example.mysha); @@ -171,7 +171,7 @@ static void update(void) example.t++; if (example.t == 60) { - ALLEGRO_DEBUG("tick"); + A5O_DEBUG("tick"); example.t = 0; } } @@ -185,32 +185,32 @@ static void redraw(void) int fh = al_get_font_line_height(example.font); char const *info[] = {"textures", "memory buffers"}; char const *binfo[] = {"alpha", "additive", "tinted", "solid", "alpha test"}; - ALLEGRO_COLOR tint = example.white; + A5O_COLOR tint = example.white; if (example.blending == 0) { - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); tint = example.half_white; } else if (example.blending == 1) { - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE); tint = example.dark; } else if (example.blending == 2) { - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); tint = example.red; } else if (example.blending == 3) { - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); } if (example.blending == 4) { - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); - al_set_render_state(ALLEGRO_ALPHA_TEST, true); - al_set_render_state(ALLEGRO_ALPHA_FUNCTION, ALLEGRO_RENDER_GREATER); - al_set_render_state(ALLEGRO_ALPHA_TEST_VALUE, 128); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); + al_set_render_state(A5O_ALPHA_TEST, true); + al_set_render_state(A5O_ALPHA_FUNCTION, A5O_RENDER_GREATER); + al_set_render_state(A5O_ALPHA_TEST_VALUE, 128); } else { - al_set_render_state(ALLEGRO_ALPHA_TEST, false); + al_set_render_state(A5O_ALPHA_TEST, false); } if (example.hold_bitmap_drawing) { @@ -224,7 +224,7 @@ static void redraw(void) al_hold_bitmap_drawing(false); } - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); if (example.show_help) { int dh = fh * 3.5; for (i = 5; i >= 0; i--) { @@ -243,18 +243,18 @@ static void redraw(void) binfo[example.blending]); get_fps(&f1, &f2); - al_draw_textf(example.font, example.white, w, 0, ALLEGRO_ALIGN_RIGHT, "FPS: %4d +- %-4d", + al_draw_textf(example.font, example.white, w, 0, A5O_ALIGN_RIGHT, "FPS: %4d +- %-4d", f1, f2); - al_draw_textf(example.font, example.white, w, fh, ALLEGRO_ALIGN_RIGHT, "%4d / sec", + al_draw_textf(example.font, example.white, w, fh, A5O_ALIGN_RIGHT, "%4d / sec", (int)(1.0 / example.direct_speed_measure)); } int main(int argc, char **argv) { - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_MONITOR_INFO info; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_MONITOR_INFO info; const char* bitmap_filename; int w = 640, h = 480; bool done = false; @@ -285,8 +285,8 @@ int main(int argc, char **argv) al_get_monitor_info(0, &info); - al_set_new_display_option(ALLEGRO_SUPPORTED_ORIENTATIONS, - ALLEGRO_DISPLAY_ORIENTATION_ALL, ALLEGRO_SUGGEST); + al_set_new_display_option(A5O_SUPPORTED_ORIENTATIONS, + A5O_DISPLAY_ORIENTATION_ALL, A5O_SUGGEST); example.display = al_create_display(w, h); if (!example.display) { abort_example("Error creating display.\n"); @@ -338,7 +338,7 @@ int main(int argc, char **argv) while (!done) { float x, y; - ALLEGRO_EVENT event; + A5O_EVENT event; w = al_get_display_width(example.display); h = al_get_display_height(example.display); @@ -355,69 +355,69 @@ int main(int argc, char **argv) al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_KEY_CHAR: /* includes repeats */ - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_CHAR: /* includes repeats */ + if (event.keyboard.keycode == A5O_KEY_ESCAPE) done = true; - else if (event.keyboard.keycode == ALLEGRO_KEY_UP) { + else if (event.keyboard.keycode == A5O_KEY_UP) { add_sprites(1); } - else if (event.keyboard.keycode == ALLEGRO_KEY_DOWN) { + else if (event.keyboard.keycode == A5O_KEY_DOWN) { remove_sprites(1); } - else if (event.keyboard.keycode == ALLEGRO_KEY_LEFT) { + else if (event.keyboard.keycode == A5O_KEY_LEFT) { change_size(example.bitmap_size - 1); } - else if (event.keyboard.keycode == ALLEGRO_KEY_RIGHT) { + else if (event.keyboard.keycode == A5O_KEY_RIGHT) { change_size(example.bitmap_size + 1); } - else if (event.keyboard.keycode == ALLEGRO_KEY_F1) { + else if (event.keyboard.keycode == A5O_KEY_F1) { example.show_help ^= 1; } - else if (event.keyboard.keycode == ALLEGRO_KEY_SPACE) { + else if (event.keyboard.keycode == A5O_KEY_SPACE) { example.use_memory_bitmaps ^= 1; change_size(example.bitmap_size); } - else if (event.keyboard.keycode == ALLEGRO_KEY_B) { + else if (event.keyboard.keycode == A5O_KEY_B) { example.blending++; if (example.blending == 5) example.blending = 0; } - else if (event.keyboard.keycode == ALLEGRO_KEY_H) { + else if (event.keyboard.keycode == A5O_KEY_H) { example.hold_bitmap_drawing ^= 1; } break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: done = true; break; - case ALLEGRO_EVENT_DISPLAY_HALT_DRAWING: + case A5O_EVENT_DISPLAY_HALT_DRAWING: background = true; al_acknowledge_drawing_halt(event.display.source); break; - case ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING: + case A5O_EVENT_DISPLAY_RESUME_DRAWING: background = false; al_acknowledge_drawing_resume(event.display.source); break; - case ALLEGRO_EVENT_DISPLAY_RESIZE: + case A5O_EVENT_DISPLAY_RESIZE: al_acknowledge_resize(event.display.source); break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: update(); need_redraw = true; break; - case ALLEGRO_EVENT_TOUCH_BEGIN: + case A5O_EVENT_TOUCH_BEGIN: x = event.touch.x; y = event.touch.y; goto click; - case ALLEGRO_EVENT_MOUSE_BUTTON_UP: + case A5O_EVENT_MOUSE_BUTTON_UP: x = event.mouse.x; y = event.mouse.y; goto click; diff --git a/examples/ex_drawpixels.c b/examples/ex_drawpixels.c index f297d66534..54f00ada36 100644 --- a/examples/ex_drawpixels.c +++ b/examples/ex_drawpixels.c @@ -17,11 +17,11 @@ typedef struct Point int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_KEYBOARD_STATE key_state; + A5O_DISPLAY *display; + A5O_KEYBOARD_STATE key_state; Point stars[3][NUM_STARS/3]; float speeds[3] = { 0.0001f, 0.05f, 0.15f }; - ALLEGRO_COLOR colors[3]; + A5O_COLOR colors[3]; long start, now, elapsed, frame_count; int total_frames = 0; double program_start; @@ -77,7 +77,7 @@ int main(int argc, char **argv) Point *p = &stars[0][star]; al_draw_pixel(p->x, p->y, colors[0]); } - al_lock_bitmap(al_get_backbuffer(display), ALLEGRO_PIXEL_FORMAT_ANY, 0); + al_lock_bitmap(al_get_backbuffer(display), A5O_PIXEL_FORMAT_ANY, 0); for (layer = 1; layer < 3; layer++) { for (star = 0; star < NUM_STARS/3; star++) { @@ -118,7 +118,7 @@ int main(int argc, char **argv) al_rest(0.001); al_get_keyboard_state(&key_state); - if (al_key_down(&key_state, ALLEGRO_KEY_ESCAPE)) + if (al_key_down(&key_state, A5O_KEY_ESCAPE)) break; } diff --git a/examples/ex_dualies.c b/examples/ex_dualies.c index 6bebb14092..b57218bcb2 100644 --- a/examples/ex_dualies.c +++ b/examples/ex_dualies.c @@ -6,12 +6,12 @@ static void go(void) { - ALLEGRO_DISPLAY *d1, *d2; - ALLEGRO_BITMAP *b1, *b2; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; + A5O_DISPLAY *d1, *d2; + A5O_BITMAP *b1, *b2; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; - al_set_new_display_flags(ALLEGRO_FULLSCREEN); + al_set_new_display_flags(A5O_FULLSCREEN); al_set_new_display_adapter(0); d1 = al_create_display(640, 480); @@ -39,8 +39,8 @@ static void go(void) while (1) { if (!al_is_event_queue_empty(queue)) { al_get_next_event(queue, &event); - if (event.type == ALLEGRO_EVENT_KEY_DOWN) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_DOWN) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } } diff --git a/examples/ex_enet_client.c b/examples/ex_enet_client.c index ad1b1c6fd4..b0a11bc21b 100644 --- a/examples/ex_enet_client.c +++ b/examples/ex_enet_client.c @@ -128,10 +128,10 @@ static void send_receive(ENetHost *client) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; + A5O_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; ENetHost *client; ENetPeer *server; bool update = true; // when true, update positions and render @@ -182,34 +182,34 @@ int main(int argc, char **argv) al_wait_for_event(queue, &event); // Wait for and get an event. switch (event.type) { - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: done = true; break; - case ALLEGRO_EVENT_KEY_DOWN: + case A5O_EVENT_KEY_DOWN: switch (event.keyboard.keycode) { - case ALLEGRO_KEY_UP: - case ALLEGRO_KEY_W: dy -= 1; direction_changed = true; break; - case ALLEGRO_KEY_DOWN: - case ALLEGRO_KEY_S: dy += 1; direction_changed = true; break; - case ALLEGRO_KEY_LEFT: - case ALLEGRO_KEY_A: dx -= 1; direction_changed = true; break; - case ALLEGRO_KEY_RIGHT: - case ALLEGRO_KEY_D: dx += 1; direction_changed = true; break; + case A5O_KEY_UP: + case A5O_KEY_W: dy -= 1; direction_changed = true; break; + case A5O_KEY_DOWN: + case A5O_KEY_S: dy += 1; direction_changed = true; break; + case A5O_KEY_LEFT: + case A5O_KEY_A: dx -= 1; direction_changed = true; break; + case A5O_KEY_RIGHT: + case A5O_KEY_D: dx += 1; direction_changed = true; break; } break; - case ALLEGRO_EVENT_KEY_UP: + case A5O_EVENT_KEY_UP: switch (event.keyboard.keycode) { - case ALLEGRO_KEY_UP: - case ALLEGRO_KEY_W: dy += 1; direction_changed = true; break; - case ALLEGRO_KEY_DOWN: - case ALLEGRO_KEY_S: dy -= 1; direction_changed = true; break; - case ALLEGRO_KEY_LEFT: - case ALLEGRO_KEY_A: dx += 1; direction_changed = true; break; - case ALLEGRO_KEY_RIGHT: - case ALLEGRO_KEY_D: dx -= 1; direction_changed = true; break; + case A5O_KEY_UP: + case A5O_KEY_W: dy += 1; direction_changed = true; break; + case A5O_KEY_DOWN: + case A5O_KEY_S: dy -= 1; direction_changed = true; break; + case A5O_KEY_LEFT: + case A5O_KEY_A: dx += 1; direction_changed = true; break; + case A5O_KEY_RIGHT: + case A5O_KEY_D: dx -= 1; direction_changed = true; break; } break; - case (ALLEGRO_EVENT_TIMER): + case (A5O_EVENT_TIMER): update = true; break; } @@ -243,7 +243,7 @@ int main(int argc, char **argv) int x = players[i].x; int y = players[i].y; - ALLEGRO_COLOR color = players[i].color; + A5O_COLOR color = players[i].color; al_draw_filled_circle(x, y, PLAYER_SIZE, color); } al_flip_display(); diff --git a/examples/ex_enet_server.c b/examples/ex_enet_server.c index edb3e89fcd..c90964dd22 100644 --- a/examples/ex_enet_server.c +++ b/examples/ex_enet_server.c @@ -185,9 +185,9 @@ static ENetHost* create_server(int port) int main(int argc, char **argv) { - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; double last_time; // time of last update double cur_time; // time of this update srand(time(NULL)); @@ -223,7 +223,7 @@ int main(int argc, char **argv) { al_wait_for_event(queue, &event); // Wait for and get an event. - if (event.type == ALLEGRO_EVENT_TIMER) { + if (event.type == A5O_EVENT_TIMER) { cur_time = al_get_time(); update_players(server, cur_time - last_time); last_time = cur_time; diff --git a/examples/ex_expose.c b/examples/ex_expose.c index df9b3d0486..fda2f16985 100644 --- a/examples/ex_expose.c +++ b/examples/ex_expose.c @@ -6,10 +6,10 @@ int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *bitmap; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; + A5O_DISPLAY *display; + A5O_BITMAP *bitmap; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; (void)argc; (void)argv; @@ -24,9 +24,9 @@ int main(int argc, char **argv) al_install_mouse(); init_platform_specific(); - al_set_new_display_flags(ALLEGRO_RESIZABLE | - ALLEGRO_GENERATE_EXPOSE_EVENTS); - al_set_new_display_option(ALLEGRO_SINGLE_BUFFER, true, ALLEGRO_REQUIRE); + al_set_new_display_flags(A5O_RESIZABLE | + A5O_GENERATE_EXPOSE_EVENTS); + al_set_new_display_option(A5O_SINGLE_BUFFER, true, A5O_REQUIRE); display = al_create_display(320, 200); if (!display) { abort_example("Error creating display\n"); @@ -49,31 +49,31 @@ int main(int argc, char **argv) al_start_timer(timer); while (true) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) + if (event.type == A5O_EVENT_DISPLAY_CLOSE) break; - if (event.type == ALLEGRO_EVENT_KEY_DOWN && - event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_DOWN && + event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } - if (event.type == ALLEGRO_EVENT_DISPLAY_RESIZE) { + if (event.type == A5O_EVENT_DISPLAY_RESIZE) { al_acknowledge_resize(event.display.source); } - if (event.type == ALLEGRO_EVENT_DISPLAY_EXPOSE) { + if (event.type == A5O_EVENT_DISPLAY_EXPOSE) { int x = event.display.x, y = event.display.y, w = event.display.width, h = event.display.height; /* Draw a red rectangle over the damaged area. */ - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_draw_filled_rectangle(x, y, x + w, y + h, al_map_rgba_f(1, 0, 0, 1)); al_flip_display(); } - if (event.type == ALLEGRO_EVENT_TIMER) { + if (event.type == A5O_EVENT_TIMER) { /* Slowly restore the original bitmap. */ int x, y; - al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA); for (y = 0; y < al_get_display_height(display); y += 200) { for (x = 0; x < al_get_display_width(display); x += 320) { al_draw_tinted_bitmap(bitmap, al_map_rgba_f(1, 1, 1, 0.1), x, y, 0); diff --git a/examples/ex_file.c b/examples/ex_file.c index 96ed7de4eb..8296212785 100644 --- a/examples/ex_file.c +++ b/examples/ex_file.c @@ -20,7 +20,7 @@ static int error = 0; static void read_test(void) { - ALLEGRO_FILE *f; + A5O_FILE *f; uint8_t bs[8]; int32_t sz; @@ -57,26 +57,26 @@ static void read_test(void) /* Test: seek absolute. */ SEP(); - CHECK(al_fseek(f, 13, ALLEGRO_SEEK_SET), bool, true); + CHECK(al_fseek(f, 13, A5O_SEEK_SET), bool, true); CHECK(al_ftell(f), int64_t, 13); CHECK(al_fgetc(f), int, 0x02); /* Test: seek nowhere. */ SEP(); - CHECK(al_fseek(f, 0, ALLEGRO_SEEK_CUR), bool, true); + CHECK(al_fseek(f, 0, A5O_SEEK_CUR), bool, true); CHECK(al_ftell(f), int64_t, 14); CHECK(al_fgetc(f), int, 0xe0); /* Test: seek nowhere with pushback. */ SEP(); CHECK(al_fungetc(f, 0x55), bool, true); - CHECK(al_fseek(f, 0, ALLEGRO_SEEK_CUR), bool, true); + CHECK(al_fseek(f, 0, A5O_SEEK_CUR), bool, true); CHECK(al_ftell(f), int64_t, 14); CHECK(al_fgetc(f), int, 0xe0); /* Test: seek relative backwards. */ SEP(); - CHECK(al_fseek(f, -3, ALLEGRO_SEEK_CUR), bool, true); + CHECK(al_fseek(f, -3, A5O_SEEK_CUR), bool, true); CHECK(al_ftell(f), int64_t, 12); CHECK(al_fgetc(f), int, 0x80); @@ -85,13 +85,13 @@ static void read_test(void) CHECK(al_ftell(f), int64_t, 13); CHECK(al_fungetc(f, 0x66), bool, true); CHECK(al_ftell(f), int64_t, 12); - CHECK(al_fseek(f, -2, ALLEGRO_SEEK_CUR), bool, true); + CHECK(al_fseek(f, -2, A5O_SEEK_CUR), bool, true); CHECK(al_ftell(f), int64_t, 10); CHECK(al_fgetc(f), int, 0xc7); /* Test: seek relative to end. */ SEP(); - CHECK(al_fseek(f, 0, ALLEGRO_SEEK_END), bool, true); + CHECK(al_fseek(f, 0, A5O_SEEK_END), bool, true); CHECK(al_feof(f), bool, false); CHECK(al_ftell(f), int64_t, 0xab06); @@ -103,18 +103,18 @@ static void read_test(void) /* Test: seek clears EOF indicator. */ SEP(); - CHECK(al_fseek(f, 0, ALLEGRO_SEEK_END), bool, true); + CHECK(al_fseek(f, 0, A5O_SEEK_END), bool, true); CHECK(al_feof(f), bool, false); CHECK(al_ftell(f), int64_t, 0xab06); /* Test: seek backwards from end. */ SEP(); - CHECK(al_fseek(f, -20, ALLEGRO_SEEK_END), bool, true); + CHECK(al_fseek(f, -20, A5O_SEEK_END), bool, true); CHECK(al_ftell(f), int64_t, 0xaaf2); /* Test: seek forwards from end. */ SEP(); - CHECK(al_fseek(f, 20, ALLEGRO_SEEK_END), bool, true); + CHECK(al_fseek(f, 20, A5O_SEEK_END), bool, true); CHECK(al_ftell(f), int64_t, 0xab1a); CHECK(al_fgetc(f), int, -1); CHECK(al_feof(f), bool, true); diff --git a/examples/ex_file_slice.c b/examples/ex_file_slice.c index cfa972fae8..857bca9422 100644 --- a/examples/ex_file_slice.c +++ b/examples/ex_file_slice.c @@ -13,7 +13,7 @@ #define BUFFER_SIZE 1024 -static void pack_object(ALLEGRO_FILE *file, const void *object, size_t len) +static void pack_object(A5O_FILE *file, const void *object, size_t len) { /* First write the length of the object, so we know how big to make the slice when it is opened later. */ @@ -21,7 +21,7 @@ static void pack_object(ALLEGRO_FILE *file, const void *object, size_t len) al_fwrite(file, object, len); } -static ALLEGRO_FILE *get_next_chunk(ALLEGRO_FILE *file) +static A5O_FILE *get_next_chunk(A5O_FILE *file) { /* Reads the length of the next chunk, and if not at end of file, returns a slice that represents that portion of the file. */ @@ -31,8 +31,8 @@ static ALLEGRO_FILE *get_next_chunk(ALLEGRO_FILE *file) int main(int argc, const char *argv[]) { - ALLEGRO_FILE *master, *slice; - ALLEGRO_PATH *tmp_path; + A5O_FILE *master, *slice; + A5O_PATH *tmp_path; const char *first_string = "Hello, World!"; const char *second_string = "The quick brown fox jumps over the lazy dog."; @@ -56,7 +56,7 @@ int main(int argc, const char *argv[]) pack_object(master, second_string, strlen(second_string)); /* Seek back to the beginning of the file, as if we had just opened it */ - al_fseek(master, 0, ALLEGRO_SEEK_SET); + al_fseek(master, 0, A5O_SEEK_SET); /* Loop through the main file, opening a slice for each object */ while ((slice = get_next_chunk(master))) { diff --git a/examples/ex_filter.c b/examples/ex_filter.c index 7fc11df527..5b036b3949 100644 --- a/examples/ex_filter.c +++ b/examples/ex_filter.c @@ -9,21 +9,21 @@ #define FPS 60 static struct Example { - ALLEGRO_DISPLAY *display; - ALLEGRO_FONT *font; - ALLEGRO_BITMAP *bitmaps[2][9]; - ALLEGRO_COLOR bg, fg, info; + A5O_DISPLAY *display; + A5O_FONT *font; + A5O_BITMAP *bitmaps[2][9]; + A5O_COLOR bg, fg, info; int bitmap; int ticks; } example; static int const filter_flags[6] = { 0, - ALLEGRO_MIN_LINEAR, - ALLEGRO_MIPMAP, - ALLEGRO_MIN_LINEAR | ALLEGRO_MIPMAP, + A5O_MIN_LINEAR, + A5O_MIPMAP, + A5O_MIN_LINEAR | A5O_MIPMAP, 0, - ALLEGRO_MAG_LINEAR + A5O_MAG_LINEAR }; static char const *filter_text[4] = { @@ -47,12 +47,12 @@ static void redraw(void) for (i = 0; i < 6; i++) { float x = (i / 2) * w / 3 + w / 6; float y = (i % 2) * h / 2 + h / 4; - ALLEGRO_BITMAP *bmp = example.bitmaps[example.bitmap][i]; + A5O_BITMAP *bmp = example.bitmaps[example.bitmap][i]; float bw = al_get_bitmap_width(bmp); float bh = al_get_bitmap_height(bmp); float t = 1 - 2 * fabs((example.ticks % (FPS * 16)) / 16.0 / FPS - 0.5); float scale; - float angle = example.ticks * ALLEGRO_PI * 2 / FPS / 8; + float angle = example.ticks * A5O_PI * 2 / FPS / 8; if (i < 4) scale = 1 - t * 0.9; @@ -60,7 +60,7 @@ static void redraw(void) scale = 1 + t * 9; al_draw_textf(example.font, example.fg, x, y - 64 - 14, - ALLEGRO_ALIGN_CENTRE, "%s", filter_text[i % 4]); + A5O_ALIGN_CENTRE, "%s", filter_text[i % 4]); al_set_clipping_rectangle(x - 64, y - 64, 128, 128); al_draw_scaled_rotated_bitmap(bmp, bw / 2, bh / 2, @@ -68,18 +68,18 @@ static void redraw(void) al_set_clipping_rectangle(0, 0, w, h); } al_draw_textf(example.font, example.info, w / 2, h - 14, - ALLEGRO_ALIGN_CENTRE, "press space to change"); + A5O_ALIGN_CENTRE, "press space to change"); } int main(int argc, char **argv) { - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; int w = 640, h = 480; bool done = false; bool need_redraw = true; int i; - ALLEGRO_BITMAP *mysha; + A5O_BITMAP *mysha; (void)argc; (void)argv; @@ -121,14 +121,14 @@ int main(int argc, char **argv) } for (i = 0; i < 6; i++) { - ALLEGRO_LOCKED_REGION *lock; + A5O_LOCKED_REGION *lock; int x, y; /* Only power-of-two bitmaps can have mipmaps. */ al_set_new_bitmap_flags(filter_flags[i]); example.bitmaps[0][i] = al_create_bitmap(1024, 1024); example.bitmaps[1][i] = al_clone_bitmap(mysha); lock = al_lock_bitmap(example.bitmaps[0][i], - ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, ALLEGRO_LOCK_WRITEONLY); + A5O_PIXEL_FORMAT_ABGR_8888_LE, A5O_LOCK_WRITEONLY); for (y = 0; y < 1024; y++) { unsigned char *row = (unsigned char *)lock->data + lock->pitch * y; unsigned char *ptr = row; @@ -160,7 +160,7 @@ int main(int argc, char **argv) al_start_timer(timer); while (!done) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (need_redraw && al_is_event_queue_empty(queue)) { redraw(); @@ -170,23 +170,23 @@ int main(int argc, char **argv) al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) done = true; - if (event.keyboard.keycode == ALLEGRO_KEY_SPACE) + if (event.keyboard.keycode == A5O_KEY_SPACE) example.bitmap = (example.bitmap + 1) % 2; break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: done = true; break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: update(); need_redraw = true; break; - case ALLEGRO_EVENT_MOUSE_BUTTON_DOWN: + case A5O_EVENT_MOUSE_BUTTON_DOWN: example.bitmap = (example.bitmap + 1) % 2; break; } diff --git a/examples/ex_font.c b/examples/ex_font.c index 184414d739..079a132969 100644 --- a/examples/ex_font.c +++ b/examples/ex_font.c @@ -9,25 +9,25 @@ #define EURO "\xe2\x82\xac" -static void wait_for_esc(ALLEGRO_DISPLAY *display) +static void wait_for_esc(A5O_DISPLAY *display) { - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_BITMAP *screen_clone; + A5O_EVENT_QUEUE *queue; + A5O_BITMAP *screen_clone; al_install_keyboard(); queue = al_create_event_queue(); al_register_event_source(queue, al_get_keyboard_event_source()); al_register_event_source(queue, al_get_display_event_source(display)); screen_clone = al_clone_bitmap(al_get_target_bitmap()); while (1) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) + if (event.type == A5O_EVENT_DISPLAY_CLOSE) break; - else if (event.type == ALLEGRO_EVENT_KEY_DOWN) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + else if (event.type == A5O_EVENT_KEY_DOWN) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) break; } - else if (event.type == ALLEGRO_EVENT_DISPLAY_EXPOSE) { + else if (event.type == A5O_EVENT_DISPLAY_EXPOSE) { int x = event.display.x; int y = event.display.y; int w = event.display.width; @@ -44,9 +44,9 @@ static void wait_for_esc(ALLEGRO_DISPLAY *display) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *bitmap, *font_bitmap; - ALLEGRO_FONT *f1, *f2, *f3; + A5O_DISPLAY *display; + A5O_BITMAP *bitmap, *font_bitmap; + A5O_FONT *f1, *f2, *f3; int range, index, x, y; @@ -67,8 +67,8 @@ int main(int argc, char **argv) al_init_font_addon(); init_platform_specific(); - al_set_new_display_option(ALLEGRO_SINGLE_BUFFER, true, ALLEGRO_SUGGEST); - al_set_new_display_flags(ALLEGRO_GENERATE_EXPOSE_EVENTS); + al_set_new_display_option(A5O_SINGLE_BUFFER, true, A5O_SUGGEST); + al_set_new_display_flags(A5O_GENERATE_EXPOSE_EVENTS); display = al_create_display(640, 480); if (!display) { abort_example("Failed to create display\n"); @@ -107,7 +107,7 @@ int main(int argc, char **argv) al_draw_textf(f2, al_map_rgb(0, 0, 255), 60, 60, 0, "Mysha's 0.02" EURO); /* Draw a yellow text with the builtin font */ - al_draw_textf(f3, al_map_rgb(255, 255, 0), 20, 200, ALLEGRO_ALIGN_CENTER, + al_draw_textf(f3, al_map_rgb(255, 255, 0), 20, 200, A5O_ALIGN_CENTER, "a string from builtin font data"); /* Draw all individual glyphs the f2 font's range in rainbow colors. @@ -120,10 +120,10 @@ int main(int argc, char **argv) int stop = ranges[2*range + 1]; for (index = start; index < stop; index ++) { /* Use al_get_glyph_advance for the stride. */ - int width = al_get_glyph_advance(f2, index, ALLEGRO_NO_KERNING); - int r = fabs(sin(ALLEGRO_PI * (index) * 36 / 360.0)) * 255.0; - int g = fabs(sin(ALLEGRO_PI * (index + 12) * 36 / 360.0)) * 255.0; - int b = fabs(sin(ALLEGRO_PI * (index + 24) * 36 / 360.0)) * 255.0; + int width = al_get_glyph_advance(f2, index, A5O_NO_KERNING); + int r = fabs(sin(A5O_PI * (index) * 36 / 360.0)) * 255.0; + int g = fabs(sin(A5O_PI * (index + 12) * 36 / 360.0)) * 255.0; + int b = fabs(sin(A5O_PI * (index + 24) * 36 / 360.0)) * 255.0; al_draw_glyph(f2, al_map_rgb(r, g, b), x, y, index); x += width; if (x > (al_get_display_width(display) - 10)) { diff --git a/examples/ex_font_justify.cpp b/examples/ex_font_justify.cpp index 95eb8f0f73..100ec83bf3 100644 --- a/examples/ex_font_justify.cpp +++ b/examples/ex_font_justify.cpp @@ -14,8 +14,8 @@ #include "common.c" -ALLEGRO_FONT *font; -ALLEGRO_FONT *font_gui; +A5O_FONT *font; +A5O_FONT *font_gui; class Prog { private: @@ -28,12 +28,12 @@ class Prog { HSlider diff_slider; public: - Prog(const Theme & theme, ALLEGRO_DISPLAY *display); + Prog(const Theme & theme, A5O_DISPLAY *display); void run(); void draw_text(); }; -Prog::Prog(const Theme & theme, ALLEGRO_DISPLAY *display) : +Prog::Prog(const Theme & theme, A5O_DISPLAY *display) : d(Dialog(theme, display, 10, 20)), text_label(Label("Text")), width_label(Label("Width")), @@ -70,7 +70,7 @@ void Prog::run() void Prog::draw_text() { - ALLEGRO_BITMAP *target = al_get_target_bitmap(); + A5O_BITMAP *target = al_get_target_bitmap(); const int cx = al_get_bitmap_width(target) / 2; const int x1 = cx - width_slider.get_cur_value() / 2; const int x2 = cx + width_slider.get_cur_value() / 2; @@ -78,7 +78,7 @@ void Prog::draw_text() const int th = al_get_font_line_height(font); al_draw_justified_text(font, al_map_rgb_f(1, 1, 1), x1, x2, 50, diff, - ALLEGRO_ALIGN_INTEGER, text_entry.get_text()); + A5O_ALIGN_INTEGER, text_entry.get_text()); al_draw_rectangle(x1, 50, x2, 50 + th, al_map_rgb(0, 0, 255), 0); @@ -88,7 +88,7 @@ void Prog::draw_text() int main(int argc, char *argv[]) { - ALLEGRO_DISPLAY *display; + A5O_DISPLAY *display; (void)argc; (void)argv; @@ -105,7 +105,7 @@ int main(int argc, char *argv[]) al_init_ttf_addon(); init_platform_specific(); - al_set_new_display_flags(ALLEGRO_GENERATE_EXPOSE_EVENTS); + al_set_new_display_flags(A5O_GENERATE_EXPOSE_EVENTS); display = al_create_display(640, 480); if (!display) { abort_example("Unable to create display\n"); diff --git a/examples/ex_font_multiline.cpp b/examples/ex_font_multiline.cpp index e372d66d73..c314df93fd 100644 --- a/examples/ex_font_multiline.cpp +++ b/examples/ex_font_multiline.cpp @@ -20,15 +20,15 @@ /* This is a custom mult line output function that demonstrates * al_do_multiline_text. See below for the implementation. */ -static void draw_custom_multiline(ALLEGRO_FONT * font, int x, int y, +static void draw_custom_multiline(A5O_FONT * font, int x, int y, int max_width, int line_height, int tick, const char * text); -ALLEGRO_TIMER *timer; -ALLEGRO_FONT *font; -ALLEGRO_FONT *font_ttf; -ALLEGRO_FONT *font_bmp; -ALLEGRO_FONT *font_gui; -ALLEGRO_FONT *font_bin; +A5O_TIMER *timer; +A5O_FONT *font; +A5O_FONT *font_ttf; +A5O_FONT *font_bmp; +A5O_FONT *font_gui; +A5O_FONT *font_bin; class Prog : public EventHandler { private: @@ -47,14 +47,14 @@ class Prog : public EventHandler { int tick; public: - Prog(const Theme & theme, ALLEGRO_DISPLAY *display); + Prog(const Theme & theme, A5O_DISPLAY *display); virtual ~Prog() {} void run(); void draw_text(); - void handle_event(const ALLEGRO_EVENT & event); + void handle_event(const A5O_EVENT & event); }; -Prog::Prog(const Theme & theme, ALLEGRO_DISPLAY *display) : +Prog::Prog(const Theme & theme, A5O_DISPLAY *display) : d(Dialog(theme, display, 14, 20)), text_label(Label("Text")), width_label(Label("Width")), @@ -111,9 +111,9 @@ void Prog::run() } } -void Prog::handle_event(const ALLEGRO_EVENT & event) +void Prog::handle_event(const A5O_EVENT & event) { - if (event.type == ALLEGRO_EVENT_TIMER) { + if (event.type == A5O_EVENT_TIMER) { tick = (int)event.timer.count; d.request_draw(); } @@ -137,12 +137,12 @@ void Prog::draw_text() } if (text_align.get_selected_item_text() == "Left") { - flags = ALLEGRO_ALIGN_LEFT | ALLEGRO_ALIGN_INTEGER; + flags = A5O_ALIGN_LEFT | A5O_ALIGN_INTEGER; } else if (text_align.get_selected_item_text() == "Center") { - flags = ALLEGRO_ALIGN_CENTER | ALLEGRO_ALIGN_INTEGER; + flags = A5O_ALIGN_CENTER | A5O_ALIGN_INTEGER; x = 10 + w / 2; } else if (text_align.get_selected_item_text() == "Right") { - flags = ALLEGRO_ALIGN_RIGHT | ALLEGRO_ALIGN_INTEGER; + flags = A5O_ALIGN_RIGHT | A5O_ALIGN_INTEGER; x = 10 + w; } @@ -164,7 +164,7 @@ void Prog::draw_text() int main(int argc, char *argv[]) { - ALLEGRO_DISPLAY *display; + A5O_DISPLAY *display; (void)argc; (void)argv; @@ -181,7 +181,7 @@ int main(int argc, char *argv[]) al_init_ttf_addon(); init_platform_specific(); - al_set_new_display_flags(ALLEGRO_GENERATE_EXPOSE_EVENTS); + al_set_new_display_flags(A5O_GENERATE_EXPOSE_EVENTS); display = al_create_display(640, 480); if (!display) { abort_example("Unable to create display\n"); @@ -229,7 +229,7 @@ int main(int argc, char *argv[]) /* Helper struct for draw_custom_multiline. */ typedef struct DRAW_CUSTOM_LINE_EXTRA { - const ALLEGRO_FONT *font; + const A5O_FONT *font; float x; float y; int tick; @@ -245,8 +245,8 @@ static bool draw_custom_multiline_cb(int line_num, const char *line, int size, void *extra) { DRAW_CUSTOM_LINE_EXTRA *s = (DRAW_CUSTOM_LINE_EXTRA *) extra; float x, y; - ALLEGRO_USTR_INFO info; - ALLEGRO_COLOR c = + A5O_USTR_INFO info; + A5O_COLOR c = al_color_hsv(fmod(360.0 * (float)line_num / 5.0 + s->tick, 360.0), 1.0, 1.0); x = s->x + 10 + sin(line_num + s->tick * 0.05) * 10; @@ -257,7 +257,7 @@ static bool draw_custom_multiline_cb(int line_num, const char *line, int size, /* This is a custom mult line output function that demonstrates * al_do_multiline_text. */ -static void draw_custom_multiline(ALLEGRO_FONT * font, int x, int y, +static void draw_custom_multiline(A5O_FONT * font, int x, int y, int max_width, int line_height, int tick, const char * text) { DRAW_CUSTOM_LINE_EXTRA extra; diff --git a/examples/ex_fs_resize.c b/examples/ex_fs_resize.c index 5d101bbdcc..f24e7445ec 100644 --- a/examples/ex_fs_resize.c +++ b/examples/ex_fs_resize.c @@ -18,10 +18,10 @@ static struct { static int cur_res = 0; -static void redraw(ALLEGRO_BITMAP *picture) +static void redraw(A5O_BITMAP *picture) { - ALLEGRO_COLOR color; - ALLEGRO_BITMAP *target = al_get_target_bitmap(); + A5O_COLOR color; + A5O_BITMAP *target = al_get_target_bitmap(); int w = al_get_bitmap_width(target); int h = al_get_bitmap_height(target); @@ -39,10 +39,10 @@ static void redraw(ALLEGRO_BITMAP *picture) al_flip_display(); } -static void main_loop(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *picture) +static void main_loop(A5O_DISPLAY *display, A5O_BITMAP *picture) { - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; bool can_draw; int new_res; @@ -58,21 +58,21 @@ static void main_loop(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *picture) } al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_LOST) { + if (event.type == A5O_EVENT_DISPLAY_LOST) { log_printf("Display lost\n"); can_draw = false; continue; } - if (event.type == ALLEGRO_EVENT_DISPLAY_FOUND) { + if (event.type == A5O_EVENT_DISPLAY_FOUND) { log_printf("Display found\n"); can_draw = true; continue; } - if (event.type != ALLEGRO_EVENT_KEY_CHAR) { + if (event.type != A5O_EVENT_KEY_CHAR) { continue; } - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } @@ -80,7 +80,7 @@ static void main_loop(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *picture) if (event.keyboard.unichar == '+' || event.keyboard.unichar == ' ' || - event.keyboard.keycode == ALLEGRO_KEY_ENTER) { + event.keyboard.keycode == A5O_KEY_ENTER) { new_res++; if (new_res >= NUM_RESOLUTIONS) new_res = 0; @@ -109,8 +109,8 @@ static void main_loop(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *picture) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *picture; + A5O_DISPLAY *display; + A5O_BITMAP *picture; if (!al_init()) { abort_example("Could not init Allegro.\n"); @@ -126,8 +126,8 @@ int main(int argc, char **argv) al_set_new_display_adapter(atoi(argv[1])); } - al_set_new_display_flags(ALLEGRO_FULLSCREEN | - ALLEGRO_GENERATE_EXPOSE_EVENTS); + al_set_new_display_flags(A5O_FULLSCREEN | + A5O_GENERATE_EXPOSE_EVENTS); display = al_create_display(res[cur_res].w, res[cur_res].h); if (!display) { abort_example("Error creating display\n"); diff --git a/examples/ex_fs_window.c b/examples/ex_fs_window.c index bda4550d2e..da3ad5dc17 100644 --- a/examples/ex_fs_window.c +++ b/examples/ex_fs_window.c @@ -5,15 +5,15 @@ #include "common.c" -static ALLEGRO_DISPLAY *display; -static ALLEGRO_BITMAP *picture; -static ALLEGRO_EVENT_QUEUE *queue; -static ALLEGRO_FONT *font; +static A5O_DISPLAY *display; +static A5O_BITMAP *picture; +static A5O_EVENT_QUEUE *queue; +static A5O_FONT *font; static bool big; static void redraw(void) { - ALLEGRO_COLOR color; + A5O_COLOR color; int w = al_get_display_width(display); int h = al_get_display_height(display); int pw = al_get_bitmap_width(picture); @@ -21,7 +21,7 @@ static void redraw(void) int th = al_get_font_line_height(font); float cx = (w - pw) * 0.5; float cy = (h - ph) * 0.5; - ALLEGRO_COLOR white = al_map_rgb_f(1, 1, 1); + A5O_COLOR white = al_map_rgb_f(1, 1, 1); color = al_map_rgb_f(0.8, 0.7, 0.9); al_clear_to_color(color); @@ -32,14 +32,14 @@ static void redraw(void) al_draw_bitmap(picture, cx, cy, 0); - al_draw_textf(font, white, w / 2, cy + ph, ALLEGRO_ALIGN_CENTRE, + al_draw_textf(font, white, w / 2, cy + ph, A5O_ALIGN_CENTRE, "Press Space to toggle fullscreen"); - al_draw_textf(font, white, w / 2, cy + ph + th, ALLEGRO_ALIGN_CENTRE, + al_draw_textf(font, white, w / 2, cy + ph + th, A5O_ALIGN_CENTRE, "Press Enter to toggle window size"); - al_draw_textf(font, white, w / 2, cy + ph + th * 2, ALLEGRO_ALIGN_CENTRE, + al_draw_textf(font, white, w / 2, cy + ph + th * 2, A5O_ALIGN_CENTRE, "Window: %dx%d (%s)", al_get_display_width(display), al_get_display_height(display), - (al_get_display_flags(display) & ALLEGRO_FULLSCREEN_WINDOW) ? + (al_get_display_flags(display) & A5O_FULLSCREEN_WINDOW) ? "fullscreen" : "not fullscreen"); al_flip_display(); @@ -47,21 +47,21 @@ static void redraw(void) static void run(void) { - ALLEGRO_EVENT event; + A5O_EVENT event; bool quit = false; while (!quit) { while (al_get_next_event(queue, &event)) { - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) + if (event.type == A5O_EVENT_DISPLAY_CLOSE) quit = true; - else if (event.type == ALLEGRO_EVENT_KEY_DOWN) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + else if (event.type == A5O_EVENT_KEY_DOWN) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) quit = true; - else if (event.keyboard.keycode == ALLEGRO_KEY_SPACE) { - bool opp = !(al_get_display_flags(display) & ALLEGRO_FULLSCREEN_WINDOW); - al_set_display_flag(display, ALLEGRO_FULLSCREEN_WINDOW, opp); + else if (event.keyboard.keycode == A5O_KEY_SPACE) { + bool opp = !(al_get_display_flags(display) & A5O_FULLSCREEN_WINDOW); + al_set_display_flag(display, A5O_FULLSCREEN_WINDOW, opp); redraw(); } - else if (event.keyboard.keycode == ALLEGRO_KEY_ENTER) { + else if (event.keyboard.keycode == A5O_KEY_ENTER) { big = !big; if (big) al_resize_display(display, 800, 600); @@ -92,7 +92,7 @@ int main(int argc, char **argv) al_init_font_addon(); init_platform_specific(); - al_set_new_display_flags(ALLEGRO_FULLSCREEN_WINDOW); + al_set_new_display_flags(A5O_FULLSCREEN_WINDOW); display = al_create_display(640, 480); if (!display) { abort_example("Error creating display\n"); diff --git a/examples/ex_get_path.c b/examples/ex_get_path.c index 2951fd763e..8421b19773 100644 --- a/examples/ex_get_path.c +++ b/examples/ex_get_path.c @@ -5,11 +5,11 @@ static void show_path(int id, const char *label) { - ALLEGRO_PATH *path; + A5O_PATH *path; const char *path_str; path = al_get_standard_path(id); - path_str = (path) ? al_path_cstr(path, ALLEGRO_NATIVE_PATH_SEP) : ""; + path_str = (path) ? al_path_cstr(path, A5O_NATIVE_PATH_SEP) : ""; log_printf("%s: %s\n", label, path_str); al_destroy_path(path); } @@ -45,13 +45,13 @@ int main(int argc, char **argv) al_set_exe_name("/tmp/blahblah.exe"); } - show_path(ALLEGRO_RESOURCES_PATH, "RESOURCES_PATH"); - show_path(ALLEGRO_TEMP_PATH, "TEMP_PATH"); - show_path(ALLEGRO_USER_DATA_PATH, "USER_DATA_PATH"); - show_path(ALLEGRO_USER_SETTINGS_PATH, "USER_SETTINGS_PATH"); - show_path(ALLEGRO_USER_HOME_PATH, "USER_HOME_PATH"); - show_path(ALLEGRO_USER_DOCUMENTS_PATH, "USER_DOCUMENTS_PATH"); - show_path(ALLEGRO_EXENAME_PATH, "EXENAME_PATH"); + show_path(A5O_RESOURCES_PATH, "RESOURCES_PATH"); + show_path(A5O_TEMP_PATH, "TEMP_PATH"); + show_path(A5O_USER_DATA_PATH, "USER_DATA_PATH"); + show_path(A5O_USER_SETTINGS_PATH, "USER_SETTINGS_PATH"); + show_path(A5O_USER_HOME_PATH, "USER_HOME_PATH"); + show_path(A5O_USER_DOCUMENTS_PATH, "USER_DOCUMENTS_PATH"); + show_path(A5O_EXENAME_PATH, "EXENAME_PATH"); } close_log(true); diff --git a/examples/ex_gldepth.c b/examples/ex_gldepth.c index 2f90c01488..99ba80c284 100644 --- a/examples/ex_gldepth.c +++ b/examples/ex_gldepth.c @@ -23,8 +23,8 @@ double angle_speed = 5.0; double dist_speed = 1.0; GLuint tex; -ALLEGRO_BITMAP *bmp; -bool key[ALLEGRO_KEY_MAX]; +A5O_BITMAP *bmp; +bool key[A5O_KEY_MAX]; static void set_camera_position(void) { @@ -42,14 +42,14 @@ static void set_camera_position(void) static void keyboard(void) { - if(key[ALLEGRO_KEY_LEFT]) camera.yangle += angle_speed; - if(key[ALLEGRO_KEY_RIGHT]) camera.yangle -= angle_speed; + if(key[A5O_KEY_LEFT]) camera.yangle += angle_speed; + if(key[A5O_KEY_RIGHT]) camera.yangle -= angle_speed; - if(key[ALLEGRO_KEY_UP]) camera.xangle += angle_speed; - if(key[ALLEGRO_KEY_DOWN]) camera.xangle -= angle_speed; + if(key[A5O_KEY_UP]) camera.xangle += angle_speed; + if(key[A5O_KEY_DOWN]) camera.xangle -= angle_speed; - if(key[ALLEGRO_KEY_PGUP]) camera.dist -= dist_speed; - if(key[ALLEGRO_KEY_PGDN]) camera.dist += dist_speed; + if(key[A5O_KEY_PGUP]) camera.dist -= dist_speed; + if(key[A5O_KEY_PGDN]) camera.dist += dist_speed; } @@ -136,10 +136,10 @@ static void draw(void) -static void setup_textures(ALLEGRO_DISPLAY *display) +static void setup_textures(A5O_DISPLAY *display) { - ALLEGRO_BITMAP *tmp_bmp; - ALLEGRO_FONT *font; + A5O_BITMAP *tmp_bmp; + A5O_FONT *font; int w, h, depth; font = al_load_font("data/fixed_font.tga", 0, 0); @@ -159,7 +159,7 @@ static void setup_textures(ALLEGRO_DISPLAY *display) 0, 0, al_get_bitmap_width(bmp), al_get_bitmap_height(bmp), 0, 0, w, h, 0); - depth = al_get_display_option(display, ALLEGRO_DEPTH_SIZE); + depth = al_get_display_option(display, A5O_DEPTH_SIZE); if (!depth) al_draw_textf(font, al_map_rgb(255, 0, 0), 0, 5, 0, "No Z-buffer!"); else @@ -178,10 +178,10 @@ static void setup_textures(ALLEGRO_DISPLAY *display) int main(void) { - ALLEGRO_DISPLAY *display; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT event; + A5O_DISPLAY *display; + A5O_EVENT_QUEUE *queue; + A5O_TIMER *timer; + A5O_EVENT event; if(!al_init()) { abort_example("Could not init Allegro.\n"); @@ -191,8 +191,8 @@ int main(void) al_init_font_addon(); al_install_keyboard(); - al_set_new_display_flags(ALLEGRO_OPENGL); - al_set_new_display_option(ALLEGRO_DEPTH_SIZE, 16, ALLEGRO_SUGGEST); + al_set_new_display_flags(A5O_OPENGL); + al_set_new_display_option(A5O_DEPTH_SIZE, 16, A5O_SUGGEST); display = al_create_display(640, 480); if(!display) { abort_example("Could not create display.\n"); @@ -214,20 +214,20 @@ int main(void) while(true) { al_wait_for_event(queue, &event); switch(event.type) { - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: goto done; - case ALLEGRO_EVENT_KEY_DOWN: - if(event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_DOWN: + if(event.keyboard.keycode == A5O_KEY_ESCAPE) goto done; key[event.keyboard.keycode] = true; break; - case ALLEGRO_EVENT_KEY_UP: + case A5O_EVENT_KEY_UP: key[event.keyboard.keycode] = false; break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: keyboard(); if(al_is_event_queue_empty(queue)) { set_camera_position(); diff --git a/examples/ex_glext.c b/examples/ex_glext.c index 8c45c0e9c1..7c863961d3 100644 --- a/examples/ex_glext.c +++ b/examples/ex_glext.c @@ -2,7 +2,7 @@ * Taken from AllegroGL. */ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include @@ -179,7 +179,7 @@ static void draw_mesh(void) wave_movement += 0.00001f; - if (wave_movement > 2 * ALLEGRO_PI) { + if (wave_movement > 2 * A5O_PI) { wave_movement = 0.0f; } } @@ -194,10 +194,10 @@ static void draw_mesh(void) int main(int argc, const char *argv[]) { GLuint pid; - ALLEGRO_DISPLAY *d; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; - ALLEGRO_TIMER *timer; + A5O_DISPLAY *d; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; + A5O_TIMER *timer; int frames = 0; double start; bool limited = true; @@ -212,16 +212,16 @@ int main(int argc, const char *argv[]) open_log(); - al_set_new_display_flags(ALLEGRO_OPENGL); - al_set_new_display_option(ALLEGRO_SAMPLE_BUFFERS, 1, ALLEGRO_SUGGEST); - al_set_new_display_option(ALLEGRO_SAMPLES, 4, ALLEGRO_SUGGEST); + al_set_new_display_flags(A5O_OPENGL); + al_set_new_display_option(A5O_SAMPLE_BUFFERS, 1, A5O_SUGGEST); + al_set_new_display_option(A5O_SAMPLES, 4, A5O_SUGGEST); d = al_create_display(WINDOW_W, WINDOW_H); if (!d) { abort_example("Unable to open a OpenGL display.\n"); } - if (al_get_display_option(d, ALLEGRO_SAMPLE_BUFFERS)) { - log_printf("With multisampling, level %i\n", al_get_display_option(d, ALLEGRO_SAMPLES)); + if (al_get_display_option(d, A5O_SAMPLE_BUFFERS)) { + log_printf("With multisampling, level %i\n", al_get_display_option(d, A5O_SAMPLES)); } else { log_printf("Without multisampling.\n"); @@ -242,11 +242,11 @@ int main(int argc, const char *argv[]) timer = NULL; } - if (al_get_opengl_extension_list()->ALLEGRO_GL_ARB_multisample) { + if (al_get_opengl_extension_list()->A5O_GL_ARB_multisample) { glEnable(GL_MULTISAMPLE_ARB); } - if (!al_get_opengl_extension_list()->ALLEGRO_GL_ARB_vertex_program) { + if (!al_get_opengl_extension_list()->A5O_GL_ARB_vertex_program) { abort_example("This example requires a video card that supports " " the ARB_vertex_program extension.\n"); } @@ -276,7 +276,7 @@ int main(int argc, const char *argv[]) glBindProgramARB(GL_VERTEX_PROGRAM_ARB, pid); glGetError(); - if (al_get_opengl_extension_list()->ALLEGRO_GL_NV_vertex_program2_option) { + if (al_get_opengl_extension_list()->A5O_GL_NV_vertex_program2_option) { glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(program_nv), program_nv); } @@ -287,7 +287,7 @@ int main(int argc, const char *argv[]) /* Check for errors */ if (glGetError()) { - const char *pgm = al_get_opengl_extension_list()->ALLEGRO_GL_NV_vertex_program2_option + const char *pgm = al_get_opengl_extension_list()->A5O_GL_NV_vertex_program2_option ? program_nv : program; GLint error_pos; const GLubyte *error_str = glGetString(GL_PROGRAM_ERROR_STRING_ARB); @@ -308,11 +308,11 @@ int main(int argc, const char *argv[]) if (!al_is_event_queue_empty(queue)) { while (al_get_next_event(queue, &event)) { switch (event.type) { - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: goto done; - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) goto done; break; } diff --git a/examples/ex_haiku.c b/examples/ex_haiku.c index 7aae9eb7c6..096fde1fdd 100644 --- a/examples/ex_haiku.c +++ b/examples/ex_haiku.c @@ -10,7 +10,7 @@ * the nice title sequence, text labels and mouse cursors. */ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include #include @@ -18,8 +18,8 @@ #include "common.c" -const float PI = ALLEGRO_PI; -const float TWOPI = ALLEGRO_PI * 2.0; +const float PI = A5O_PI; +const float TWOPI = A5O_PI * 2.0; enum { TYPE_EARTH, @@ -108,19 +108,19 @@ enum { NUM_TOKENS = TOKENS_X * TOKENS_Y, }; -ALLEGRO_DISPLAY *display; -ALLEGRO_TIMER *refresh_timer; -ALLEGRO_TIMER *playback_timer; +A5O_DISPLAY *display; +A5O_TIMER *refresh_timer; +A5O_TIMER *playback_timer; -ALLEGRO_BITMAP *images[IMG_MAX]; -ALLEGRO_SAMPLE *element_samples[NUM_TYPES][NUM_PITCH]; -ALLEGRO_SAMPLE *select_sample; +A5O_BITMAP *images[IMG_MAX]; +A5O_SAMPLE *element_samples[NUM_TYPES][NUM_PITCH]; +A5O_SAMPLE *select_sample; Token tokens[NUM_TOKENS]; Token buttons[NUM_TYPES]; Sprite glow; Sprite glow_overlay; -ALLEGRO_COLOR glow_color[NUM_TYPES]; +A5O_COLOR glow_color[NUM_TYPES]; Flair *flairs = NULL; Token *hover_token = NULL; Token *selected_button = NULL; @@ -391,7 +391,7 @@ static void anim_delta(Sprite *spr, float *lval, float delta, anim_full(spr, lval, *lval, *lval + delta, func, 0.0, duration); } -static void anim_tint(Sprite *spr, const ALLEGRO_COLOR color, Interp func, +static void anim_tint(Sprite *spr, const A5O_COLOR color, Interp func, float duration) { float r, g, b; @@ -522,8 +522,8 @@ static void update_anims(float now) static void draw_sprite(const Sprite *spr) { - ALLEGRO_BITMAP *bmp; - ALLEGRO_COLOR tint; + A5O_BITMAP *bmp; + A5O_COLOR tint; float cx, cy; bmp = images[spr->image]; @@ -548,7 +548,7 @@ static void draw_screen(void) al_clear_to_color(al_map_rgb(0, 0, 0)); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ALPHA, A5O_ONE); draw_sprite(&glow); draw_sprite(&glow_overlay); @@ -556,12 +556,12 @@ static void draw_screen(void) for (i = 0; i < NUM_TOKENS; i++) draw_token(&tokens[i]); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); for (i = 0; i < NUM_TYPES; i++) draw_token(&buttons[i]); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ALPHA, A5O_ONE); for (fl = flairs; fl != NULL; fl = fl->next) draw_sprite(&fl->sprite); @@ -670,7 +670,7 @@ static void spawn_water_effects(float x, float y) static void play_element(int type, int pitch, float vol, float pan) { al_play_sample(element_samples[type][pitch], vol, pan, 1.0, - ALLEGRO_PLAYMODE_ONCE, NULL); + A5O_PLAYMODE_ONCE, NULL); } static void activate_token(Token *token) @@ -835,7 +835,7 @@ static void select_button(Token *button) change_healthy_glow(button->type, button->x); - al_play_sample(select_sample, 1.0, 0.0, 1.0, ALLEGRO_PLAYMODE_ONCE, NULL); + al_play_sample(select_sample, 1.0, 0.0, 1.0, A5O_PLAYMODE_ONCE, NULL); } static void on_mouse_down(float x, float y, int mbut) @@ -875,9 +875,9 @@ static void on_mouse_axes(float x, float y) } } -static void main_loop(ALLEGRO_EVENT_QUEUE *queue) +static void main_loop(A5O_EVENT_QUEUE *queue) { - ALLEGRO_EVENT event; + A5O_EVENT event; bool redraw = true; for (;;) { @@ -901,25 +901,25 @@ static void main_loop(ALLEGRO_EVENT_QUEUE *queue) continue; } - if (event.type == ALLEGRO_EVENT_MOUSE_AXES) { + if (event.type == A5O_EVENT_MOUSE_AXES) { on_mouse_axes(event.mouse.x, event.mouse.y); continue; } - if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN) { + if (event.type == A5O_EVENT_MOUSE_BUTTON_DOWN) { on_mouse_down(event.mouse.x, event.mouse.y, event.mouse.button); continue; } - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } - if (event.type == ALLEGRO_EVENT_KEY_DOWN) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + if (event.type == A5O_EVENT_KEY_DOWN) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) break; - if (event.keyboard.keycode == ALLEGRO_KEY_C) + if (event.keyboard.keycode == A5O_KEY_C) unselect_all_tokens(); } } @@ -927,7 +927,7 @@ static void main_loop(ALLEGRO_EVENT_QUEUE *queue) int main(int argc, char **argv) { - ALLEGRO_EVENT_QUEUE *queue; + A5O_EVENT_QUEUE *queue; (void)argc; (void)argv; @@ -942,7 +942,7 @@ int main(int argc, char **argv) al_init_image_addon(); init_platform_specific(); - al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR); + al_set_new_bitmap_flags(A5O_MIN_LINEAR | A5O_MAG_LINEAR); display = al_create_display(screen_w, screen_h); if (!display) { diff --git a/examples/ex_haptic.c b/examples/ex_haptic.c index f05249cee8..dd5855b9cb 100644 --- a/examples/ex_haptic.c +++ b/examples/ex_haptic.c @@ -4,18 +4,18 @@ * This program tests haptic effects. */ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include #include "common.c" -static void test_haptic_joystick(ALLEGRO_JOYSTICK *joy) +static void test_haptic_joystick(A5O_JOYSTICK *joy) { - ALLEGRO_HAPTIC_EFFECT_ID id; - ALLEGRO_HAPTIC *haptic; - ALLEGRO_HAPTIC_EFFECT effect; + A5O_HAPTIC_EFFECT_ID id; + A5O_HAPTIC *haptic; + A5O_HAPTIC_EFFECT effect; const double intensity = 1.0; const double duration = 1.0; @@ -39,7 +39,7 @@ static void test_haptic_joystick(ALLEGRO_JOYSTICK *joy) al_get_haptic_capabilities(haptic)); memset(&effect, 0, sizeof(effect)); - effect.type = ALLEGRO_HAPTIC_RUMBLE; + effect.type = A5O_HAPTIC_RUMBLE; effect.data.rumble.strong_magnitude = intensity; effect.data.rumble.weak_magnitude = intensity; effect.replay.delay = 0.1; @@ -83,7 +83,7 @@ static void test_haptic_joystick(ALLEGRO_JOYSTICK *joy) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; + A5O_DISPLAY *display; int num_joysticks; int i; @@ -111,7 +111,7 @@ int main(int argc, char **argv) log_printf("Found %d joysticks.\n", num_joysticks); for (i = 0; i < num_joysticks; i++) { - ALLEGRO_JOYSTICK *joy = al_get_joystick(i); + A5O_JOYSTICK *joy = al_get_joystick(i); if (!joy) { continue; } diff --git a/examples/ex_haptic2.cpp b/examples/ex_haptic2.cpp index a20e6a2382..6f78776e7e 100644 --- a/examples/ex_haptic2.cpp +++ b/examples/ex_haptic2.cpp @@ -6,7 +6,7 @@ #include -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include "allegro5/allegro.h" #include "allegro5/allegro_font.h" #include "allegro5/allegro_primitives.h" @@ -18,9 +18,9 @@ struct Haptic { - ALLEGRO_HAPTIC *haptic; - ALLEGRO_HAPTIC_EFFECT effect; - ALLEGRO_HAPTIC_EFFECT_ID id; + A5O_HAPTIC *haptic; + A5O_HAPTIC_EFFECT effect; + A5O_HAPTIC_EFFECT_ID id; const char *name; bool playing; }; @@ -29,8 +29,8 @@ struct Haptic static Haptic haptics[EX_MAX_HAPTICS]; static int num_haptics = 0; -static ALLEGRO_EVENT_QUEUE * joystick_queue; -static ALLEGRO_TIMER * update_timer = NULL; +static A5O_EVENT_QUEUE * joystick_queue; +static A5O_TIMER * update_timer = NULL; static void release_all_haptics() { for (int i = 0; i < num_haptics; i++) { @@ -41,7 +41,7 @@ static void release_all_haptics() { static void get_all_haptics() { num_haptics = 0; - ALLEGRO_DISPLAY * display = al_get_current_display(); + A5O_DISPLAY * display = al_get_current_display(); if (al_is_display_haptic(display)) { haptics[num_haptics].haptic = al_get_haptic_from_display(display); @@ -56,7 +56,7 @@ static void get_all_haptics() { num_haptics < EX_MAX_HAPTICS && i < al_get_num_joysticks(); i++) { - ALLEGRO_JOYSTICK *joy = al_get_joystick(i); + A5O_JOYSTICK *joy = al_get_joystick(i); if (al_is_joystick_haptic(joy)) { haptics[num_haptics].haptic = al_get_haptic_from_joystick(joy); if (haptics[num_haptics].haptic) { @@ -78,24 +78,24 @@ struct CapacityName static const CapacityName capname[] = { - {ALLEGRO_HAPTIC_RUMBLE, "ALLEGRO_HAPTIC_RUMBLE"}, - {ALLEGRO_HAPTIC_PERIODIC, "ALLEGRO_HAPTIC_PERIODIC"}, - {ALLEGRO_HAPTIC_CONSTANT, "ALLEGRO_HAPTIC_CONSTANT"}, - {ALLEGRO_HAPTIC_SPRING, "ALLEGRO_HAPTIC_SPRING"}, - {ALLEGRO_HAPTIC_FRICTION, "ALLEGRO_HAPTIC_FRICTION"}, - {ALLEGRO_HAPTIC_DAMPER, "ALLEGRO_HAPTIC_DAMPER"}, - {ALLEGRO_HAPTIC_INERTIA, "ALLEGRO_HAPTIC_INERTIA"}, - {ALLEGRO_HAPTIC_RAMP, "ALLEGRO_HAPTIC_RAMP"}, - {ALLEGRO_HAPTIC_SQUARE, "ALLEGRO_HAPTIC_SQUARE"}, - {ALLEGRO_HAPTIC_TRIANGLE, "ALLEGRO_HAPTIC_TRIANGLE"}, - {ALLEGRO_HAPTIC_SINE, "ALLEGRO_HAPTIC_SINE"}, - {ALLEGRO_HAPTIC_SAW_UP, "ALLEGRO_HAPTIC_SAW_UP"}, - {ALLEGRO_HAPTIC_SAW_DOWN, "ALLEGRO_HAPTIC_SAW_DOWN"}, - {ALLEGRO_HAPTIC_CUSTOM, "ALLEGRO_HAPTIC_CUSTOM"}, - {ALLEGRO_HAPTIC_GAIN, "ALLEGRO_HAPTIC_GAIN"}, - {ALLEGRO_HAPTIC_ANGLE, "ALLEGRO_HAPTIC_ANGLE"}, - {ALLEGRO_HAPTIC_RADIUS, "ALLEGRO_HAPTIC_RADIUS"}, - {ALLEGRO_HAPTIC_AZIMUTH, "ALLEGRO_HAPTIC_AZIMUTH"} + {A5O_HAPTIC_RUMBLE, "A5O_HAPTIC_RUMBLE"}, + {A5O_HAPTIC_PERIODIC, "A5O_HAPTIC_PERIODIC"}, + {A5O_HAPTIC_CONSTANT, "A5O_HAPTIC_CONSTANT"}, + {A5O_HAPTIC_SPRING, "A5O_HAPTIC_SPRING"}, + {A5O_HAPTIC_FRICTION, "A5O_HAPTIC_FRICTION"}, + {A5O_HAPTIC_DAMPER, "A5O_HAPTIC_DAMPER"}, + {A5O_HAPTIC_INERTIA, "A5O_HAPTIC_INERTIA"}, + {A5O_HAPTIC_RAMP, "A5O_HAPTIC_RAMP"}, + {A5O_HAPTIC_SQUARE, "A5O_HAPTIC_SQUARE"}, + {A5O_HAPTIC_TRIANGLE, "A5O_HAPTIC_TRIANGLE"}, + {A5O_HAPTIC_SINE, "A5O_HAPTIC_SINE"}, + {A5O_HAPTIC_SAW_UP, "A5O_HAPTIC_SAW_UP"}, + {A5O_HAPTIC_SAW_DOWN, "A5O_HAPTIC_SAW_DOWN"}, + {A5O_HAPTIC_CUSTOM, "A5O_HAPTIC_CUSTOM"}, + {A5O_HAPTIC_GAIN, "A5O_HAPTIC_GAIN"}, + {A5O_HAPTIC_ANGLE, "A5O_HAPTIC_ANGLE"}, + {A5O_HAPTIC_RADIUS, "A5O_HAPTIC_RADIUS"}, + {A5O_HAPTIC_AZIMUTH, "A5O_HAPTIC_AZIMUTH"} }; #define EX_START_TYPES 0 @@ -260,16 +260,16 @@ class Prog: public CanStopAndPlay Haptic *show_haptic; public: - Prog(const Theme & theme, ALLEGRO_DISPLAY *display); + Prog(const Theme & theme, A5O_DISPLAY *display); void run(); void update(); void update_controls(Haptic *dev); virtual void on_play(); virtual void on_stop(); - void get_envelope(ALLEGRO_HAPTIC_ENVELOPE *envelope); + void get_envelope(A5O_HAPTIC_ENVELOPE *envelope); }; -Prog::Prog(const Theme & theme, ALLEGRO_DISPLAY *display) : +Prog::Prog(const Theme & theme, A5O_DISPLAY *display) : d(Dialog(theme, display, 20, 40)), device_list(0), type_list(0), @@ -461,12 +461,12 @@ void Prog::update() } } - ALLEGRO_EVENT e; + A5O_EVENT e; /* Check for hot plugging*/ while(al_get_next_event(joystick_queue, &e)) { /* clear, reconfigure and fetch haptics again. */ - if (e.type == ALLEGRO_EVENT_JOYSTICK_CONFIGURATION) { + if (e.type == A5O_EVENT_JOYSTICK_CONFIGURATION) { al_reconfigure_joysticks(); release_all_haptics(); get_all_haptics(); @@ -530,18 +530,18 @@ void Prog::update_controls(Haptic *dev) } /* Gain capability */ - gain_slider.set_disabled(!TEST_CAP(cap, ALLEGRO_HAPTIC_GAIN)); - gain_label.set_disabled(!TEST_CAP(cap, ALLEGRO_HAPTIC_GAIN)); + gain_slider.set_disabled(!TEST_CAP(cap, A5O_HAPTIC_GAIN)); + gain_label.set_disabled(!TEST_CAP(cap, A5O_HAPTIC_GAIN)); /* Autocenter capability */ - autocenter_slider.set_disabled(!TEST_CAP(cap, ALLEGRO_HAPTIC_AUTOCENTER)); - autocenter_label.set_disabled(!TEST_CAP(cap, ALLEGRO_HAPTIC_AUTOCENTER)); + autocenter_slider.set_disabled(!TEST_CAP(cap, A5O_HAPTIC_AUTOCENTER)); + autocenter_label.set_disabled(!TEST_CAP(cap, A5O_HAPTIC_AUTOCENTER)); /* Envelope related capabilities and sliders. */ - envelope = TEST_CAP(cap, ALLEGRO_HAPTIC_PERIODIC) || - TEST_CAP(cap, ALLEGRO_HAPTIC_CONSTANT) || - TEST_CAP(cap, ALLEGRO_HAPTIC_RAMP); + envelope = TEST_CAP(cap, A5O_HAPTIC_PERIODIC) || + TEST_CAP(cap, A5O_HAPTIC_CONSTANT) || + TEST_CAP(cap, A5O_HAPTIC_RAMP); envelope_label.set_disabled(!envelope); attack_level_slider.set_disabled(!envelope); @@ -554,18 +554,18 @@ void Prog::update_controls(Haptic *dev) fade_length_label.set_disabled(!envelope); /* Coordinate related capabilities. */ - angle_slider.set_disabled(!TEST_CAP(cap, ALLEGRO_HAPTIC_ANGLE)); - angle_label.set_disabled(!TEST_CAP(cap, ALLEGRO_HAPTIC_ANGLE)); - radius_slider.set_disabled(!TEST_CAP(cap, ALLEGRO_HAPTIC_RADIUS)); - radius_label.set_disabled(!TEST_CAP(cap, ALLEGRO_HAPTIC_RADIUS)); - azimuth_slider.set_disabled(!TEST_CAP(cap, ALLEGRO_HAPTIC_AZIMUTH)); - azimuth_label.set_disabled(!TEST_CAP(cap, ALLEGRO_HAPTIC_AZIMUTH)); + angle_slider.set_disabled(!TEST_CAP(cap, A5O_HAPTIC_ANGLE)); + angle_label.set_disabled(!TEST_CAP(cap, A5O_HAPTIC_ANGLE)); + radius_slider.set_disabled(!TEST_CAP(cap, A5O_HAPTIC_RADIUS)); + radius_label.set_disabled(!TEST_CAP(cap, A5O_HAPTIC_RADIUS)); + azimuth_slider.set_disabled(!TEST_CAP(cap, A5O_HAPTIC_AZIMUTH)); + azimuth_label.set_disabled(!TEST_CAP(cap, A5O_HAPTIC_AZIMUTH)); /* Condition effect related capabilities. */ - condition = TEST_CAP(cap, ALLEGRO_HAPTIC_DAMPER) || - TEST_CAP(cap, ALLEGRO_HAPTIC_FRICTION) || - TEST_CAP(cap, ALLEGRO_HAPTIC_INERTIA) || - TEST_CAP(cap, ALLEGRO_HAPTIC_SPRING); + condition = TEST_CAP(cap, A5O_HAPTIC_DAMPER) || + TEST_CAP(cap, A5O_HAPTIC_FRICTION) || + TEST_CAP(cap, A5O_HAPTIC_INERTIA) || + TEST_CAP(cap, A5O_HAPTIC_SPRING); condition_effect_label.set_disabled(!condition); right_coeff_slider.set_disabled(!condition); @@ -582,19 +582,19 @@ void Prog::update_controls(Haptic *dev) deadband_label.set_disabled(!condition); /* Constant effect related capabilities. */ - constant_effect_label.set_disabled(!TEST_CAP(cap, ALLEGRO_HAPTIC_CONSTANT)); - level_slider.set_disabled(!TEST_CAP(cap, ALLEGRO_HAPTIC_CONSTANT)); - level_label.set_disabled(!TEST_CAP(cap, ALLEGRO_HAPTIC_CONSTANT)); + constant_effect_label.set_disabled(!TEST_CAP(cap, A5O_HAPTIC_CONSTANT)); + level_slider.set_disabled(!TEST_CAP(cap, A5O_HAPTIC_CONSTANT)); + level_label.set_disabled(!TEST_CAP(cap, A5O_HAPTIC_CONSTANT)); /* Ramp effect capabilities. */ - ramp_effect_label.set_disabled(!TEST_CAP(cap, ALLEGRO_HAPTIC_RAMP)); - start_level_slider.set_disabled(!TEST_CAP(cap, ALLEGRO_HAPTIC_RAMP)); - start_level_label.set_disabled(!TEST_CAP(cap, ALLEGRO_HAPTIC_RAMP)); - end_level_slider.set_disabled(!TEST_CAP(cap, ALLEGRO_HAPTIC_RAMP)); - end_level_label.set_disabled(!TEST_CAP(cap, ALLEGRO_HAPTIC_RAMP)); + ramp_effect_label.set_disabled(!TEST_CAP(cap, A5O_HAPTIC_RAMP)); + start_level_slider.set_disabled(!TEST_CAP(cap, A5O_HAPTIC_RAMP)); + start_level_label.set_disabled(!TEST_CAP(cap, A5O_HAPTIC_RAMP)); + end_level_slider.set_disabled(!TEST_CAP(cap, A5O_HAPTIC_RAMP)); + end_level_label.set_disabled(!TEST_CAP(cap, A5O_HAPTIC_RAMP)); /* Period effect capabilities. */ - periodic = TEST_CAP(cap, ALLEGRO_HAPTIC_PERIODIC); + periodic = TEST_CAP(cap, A5O_HAPTIC_PERIODIC); waveform_label.set_disabled(!periodic); waveform_list.set_disabled(!periodic); periodic_effect_label.set_disabled(!periodic); @@ -667,7 +667,7 @@ static double slider_to_angle(const HSlider & slider) return value / max; } -void Prog::get_envelope(ALLEGRO_HAPTIC_ENVELOPE *envelope) +void Prog::get_envelope(A5O_HAPTIC_ENVELOPE *envelope) { if (!envelope) return; @@ -725,7 +725,7 @@ void Prog::on_play() return; } - if ((wavetype < 0) && (type == ALLEGRO_HAPTIC_PERIODIC)) { + if ((wavetype < 0) && (type == A5O_HAPTIC_PERIODIC)) { message_label.set_text("Unknown Wave Form!"); log_printf("Unknown wave type: %d on %s\n", wavetype, haptic->name); return; @@ -740,11 +740,11 @@ void Prog::on_play() haptic->effect.direction.azimuth = slider_to_angle(angle_slider); switch (type) { - case ALLEGRO_HAPTIC_RUMBLE: + case A5O_HAPTIC_RUMBLE: haptic->effect.data.rumble.strong_magnitude = slider_to_magnitude(strong_magnitude_slider); haptic->effect.data.rumble.weak_magnitude = slider_to_magnitude(weak_magnitude_slider); break; - case ALLEGRO_HAPTIC_PERIODIC: + case A5O_HAPTIC_PERIODIC: get_envelope(&haptic->effect.data.periodic.envelope); haptic->effect.data.periodic.waveform = wavetype; haptic->effect.data.periodic.magnitude = slider_to_magnitude(magnitude_slider); @@ -754,20 +754,20 @@ void Prog::on_play() haptic->effect.data.periodic.custom_len = 0; haptic->effect.data.periodic.custom_data = NULL; break; - case ALLEGRO_HAPTIC_CONSTANT: + case A5O_HAPTIC_CONSTANT: get_envelope(&haptic->effect.data.constant.envelope); haptic->effect.data.constant.level = slider_to_magnitude(level_slider); break; - case ALLEGRO_HAPTIC_RAMP: + case A5O_HAPTIC_RAMP: get_envelope(&haptic->effect.data.ramp.envelope); haptic->effect.data.ramp.start_level = slider_to_magnitude(start_level_slider); haptic->effect.data.ramp.end_level = slider_to_magnitude(end_level_slider); break; - case ALLEGRO_HAPTIC_SPRING: - case ALLEGRO_HAPTIC_FRICTION: - case ALLEGRO_HAPTIC_DAMPER: - case ALLEGRO_HAPTIC_INERTIA: /* fall through. */ + case A5O_HAPTIC_SPRING: + case A5O_HAPTIC_FRICTION: + case A5O_HAPTIC_DAMPER: + case A5O_HAPTIC_INERTIA: /* fall through. */ haptic->effect.data.condition.right_saturation = slider_to_magnitude(right_saturation_slider); haptic->effect.data.condition.left_saturation = slider_to_magnitude(left_saturation_slider); haptic->effect.data.condition.right_coeff = slider_to_magnitude(right_coeff_slider); @@ -829,8 +829,8 @@ void Prog::on_stop() int main(int argc, char *argv[]) { - ALLEGRO_DISPLAY *display; - ALLEGRO_FONT *font; + A5O_DISPLAY *display; + A5O_FONT *font; (void)argc; (void)argv; @@ -849,7 +849,7 @@ int main(int argc, char *argv[]) al_init_font_addon(); al_init_ttf_addon(); - al_set_new_display_flags(ALLEGRO_GENERATE_EXPOSE_EVENTS); + al_set_new_display_flags(A5O_GENERATE_EXPOSE_EVENTS); display = al_create_display(800, 600); if (!display) { abort_example("Unable to create display\n"); diff --git a/examples/ex_icon.c b/examples/ex_icon.c index 998ffcf367..396f44d01c 100644 --- a/examples/ex_icon.c +++ b/examples/ex_icon.c @@ -5,11 +5,11 @@ int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *icon1; - ALLEGRO_BITMAP *icon2; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_TIMER *timer; + A5O_DISPLAY *display; + A5O_BITMAP *icon1; + A5O_BITMAP *icon2; + A5O_EVENT_QUEUE *queue; + A5O_TIMER *timer; int i; (void)argc; @@ -36,7 +36,7 @@ int main(int argc, char **argv) } /* Second icon: Create it. */ - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); icon2 = al_create_bitmap(16, 16); al_set_target_bitmap(icon2); for (i = 0; i < 256; i++) { @@ -56,17 +56,17 @@ int main(int argc, char **argv) al_start_timer(timer); for (;;) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_KEY_DOWN && - event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_DOWN && + event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } - if (event.type == ALLEGRO_EVENT_TIMER) { + if (event.type == A5O_EVENT_TIMER) { al_set_display_icon(display, (event.timer.count & 1) ? icon2 : icon1); } } diff --git a/examples/ex_icon2.c b/examples/ex_icon2.c index a13e596d7a..c4268b913c 100644 --- a/examples/ex_icon2.c +++ b/examples/ex_icon2.c @@ -6,11 +6,11 @@ * and the big one for the alt-tab popup, for example. */ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include "allegro5/allegro_image.h" -#ifdef ALLEGRO_UNIX +#ifdef A5O_UNIX #include #endif @@ -20,9 +20,9 @@ int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *icons[NUM_ICONS]; - ALLEGRO_EVENT_QUEUE *queue; + A5O_DISPLAY *display; + A5O_BITMAP *icons[NUM_ICONS]; + A5O_EVENT_QUEUE *queue; int u, v; (void)argc; @@ -41,7 +41,7 @@ int main(int argc, char **argv) abort_example("icons.tga not found\n"); } -#if defined(ALLEGRO_UNIX) && !defined(ALLEGRO_RASPBERRYPI) +#if defined(A5O_UNIX) && !defined(A5O_RASPBERRYPI) al_x_set_initial_icon(icons[0]); #endif @@ -53,7 +53,7 @@ int main(int argc, char **argv) al_flip_display(); /* Second icon 32x32: Create it. */ - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); icons[1] = al_create_bitmap(32, 32); al_set_target_bitmap(icons[1]); for (v = 0; v < 32; v++) { @@ -70,14 +70,14 @@ int main(int argc, char **argv) al_register_event_source(queue, al_get_display_event_source(display)); for (;;) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_KEY_DOWN && - event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_DOWN && + event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } } diff --git a/examples/ex_inject_events.c b/examples/ex_inject_events.c index d7545bea22..cb10b4daae 100644 --- a/examples/ex_inject_events.c +++ b/examples/ex_inject_events.c @@ -14,10 +14,10 @@ int main(int argc, char **argv) { - ALLEGRO_EVENT_SOURCE fake_src; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT fake_keydown_event, fake_joystick_event; - ALLEGRO_EVENT event; + A5O_EVENT_SOURCE fake_src; + A5O_EVENT_QUEUE *queue; + A5O_EVENT fake_keydown_event, fake_joystick_event; + A5O_EVENT event; (void)argc; (void)argv; @@ -34,15 +34,15 @@ int main(int argc, char **argv) al_register_event_source(queue, &fake_src); /* fake a joystick event */ - fake_joystick_event.any.type = ALLEGRO_EVENT_JOYSTICK_AXIS; + fake_joystick_event.any.type = A5O_EVENT_JOYSTICK_AXIS; fake_joystick_event.joystick.stick = 1; fake_joystick_event.joystick.axis = 0; fake_joystick_event.joystick.pos = 0.5; al_emit_user_event(&fake_src, &fake_joystick_event, NULL); /* fake a keyboard event */ - fake_keydown_event.any.type = ALLEGRO_EVENT_KEY_DOWN; - fake_keydown_event.keyboard.keycode = ALLEGRO_KEY_ENTER; + fake_keydown_event.any.type = A5O_EVENT_KEY_DOWN; + fake_keydown_event.keyboard.keycode = A5O_KEY_ENTER; al_emit_user_event(&fake_src, &fake_keydown_event, NULL); /* poll for the events we injected */ @@ -50,12 +50,12 @@ int main(int argc, char **argv) al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_KEY_DOWN: - ALLEGRO_ASSERT(event.user.source == &fake_src); + case A5O_EVENT_KEY_DOWN: + A5O_ASSERT(event.user.source == &fake_src); log_printf("Got keydown: %d\n", event.keyboard.keycode); break; - case ALLEGRO_EVENT_JOYSTICK_AXIS: - ALLEGRO_ASSERT(event.user.source == &fake_src); + case A5O_EVENT_JOYSTICK_AXIS: + A5O_ASSERT(event.user.source == &fake_src); log_printf("Got joystick axis: stick=%d axis=%d pos=%f\n", event.joystick.stick, event.joystick.axis, event.joystick.pos); break; diff --git a/examples/ex_joystick_events.c b/examples/ex_joystick_events.c index e996ed5c19..d156130ef2 100644 --- a/examples/ex_joystick_events.c +++ b/examples/ex_joystick_events.c @@ -16,11 +16,11 @@ /* globals */ -ALLEGRO_EVENT_QUEUE *event_queue; -ALLEGRO_FONT *font; -ALLEGRO_COLOR black; -ALLEGRO_COLOR grey; -ALLEGRO_COLOR white; +A5O_EVENT_QUEUE *event_queue; +A5O_FONT *font; +A5O_COLOR black; +A5O_COLOR grey; +A5O_COLOR white; int num_sticks = 0; int num_buttons = 0; @@ -29,9 +29,9 @@ float joys[MAX_STICKS][MAX_AXES] = {{ 0 }}; bool joys_buttons[MAX_BUTTONS] = { 0 }; -static void setup_joystick_values(ALLEGRO_JOYSTICK *joy) +static void setup_joystick_values(A5O_JOYSTICK *joy) { - ALLEGRO_JOYSTICK_STATE jst; + A5O_JOYSTICK_STATE jst; int i, j; if (joy == NULL) { @@ -62,7 +62,7 @@ static void setup_joystick_values(ALLEGRO_JOYSTICK *joy) -static void draw_joystick_axes(ALLEGRO_JOYSTICK *joy, int cx, int cy, int stick) +static void draw_joystick_axes(A5O_JOYSTICK *joy, int cx, int cy, int stick) { const int size = 30; const int csize = 5; @@ -84,11 +84,11 @@ static void draw_joystick_axes(ALLEGRO_JOYSTICK *joy, int cx, int cy, int stick) } if (joy) { - al_draw_text(font, black, cx, cy + osize + 1, ALLEGRO_ALIGN_CENTRE, + al_draw_text(font, black, cx, cy + osize + 1, A5O_ALIGN_CENTRE, al_get_joystick_stick_name(joy, stick)); for (i = 0; i < num_axes[stick]; i++) { al_draw_text(font, black, cx, cy + osize + (1 + i) * 10, - ALLEGRO_ALIGN_CENTRE, + A5O_ALIGN_CENTRE, al_get_joystick_axis_name(joy, stick, i)); } } @@ -96,12 +96,12 @@ static void draw_joystick_axes(ALLEGRO_JOYSTICK *joy, int cx, int cy, int stick) -static void draw_joystick_button(ALLEGRO_JOYSTICK *joy, int button, bool down) +static void draw_joystick_button(A5O_JOYSTICK *joy, int button, bool down) { - ALLEGRO_BITMAP *bmp = al_get_target_bitmap(); + A5O_BITMAP *bmp = al_get_target_bitmap(); int x = al_get_bitmap_width(bmp)/2-120 + (button % 8) * 30; int y = al_get_bitmap_height(bmp)-120 + (button / 8) * 30; - ALLEGRO_COLOR fg; + A5O_COLOR fg; al_draw_filled_rectangle(x, y, x + 25, y + 25, grey); al_draw_rectangle(x+0.5, y+0.5, x + 24.5, y + 24.5, black, 0); @@ -116,16 +116,16 @@ static void draw_joystick_button(ALLEGRO_JOYSTICK *joy, int button, bool down) if (joy) { const char *name = al_get_joystick_button_name(joy, button); if (strlen(name) < 4) { - al_draw_text(font, fg, x + 13, y + 8, ALLEGRO_ALIGN_CENTRE, name); + al_draw_text(font, fg, x + 13, y + 8, A5O_ALIGN_CENTRE, name); } } } -static void draw_all(ALLEGRO_JOYSTICK *joy) +static void draw_all(A5O_JOYSTICK *joy) { - ALLEGRO_BITMAP *bmp = al_get_target_bitmap(); + A5O_BITMAP *bmp = al_get_target_bitmap(); int width = al_get_bitmap_width(bmp); int height = al_get_bitmap_height(bmp); int i; @@ -133,7 +133,7 @@ static void draw_all(ALLEGRO_JOYSTICK *joy) al_clear_to_color(al_map_rgb(0xff, 0xff, 0xc0)); if (joy) { - al_draw_textf(font, black, width / 2, 10, ALLEGRO_ALIGN_CENTRE, + al_draw_textf(font, black, width / 2, 10, A5O_ALIGN_CENTRE, "Joystick: %s", al_get_joystick_name(joy)); } @@ -156,7 +156,7 @@ static void draw_all(ALLEGRO_JOYSTICK *joy) static void main_loop(void) { - ALLEGRO_EVENT event; + A5O_EVENT event; while (true) { if (al_is_event_queue_empty(event_queue)) @@ -165,37 +165,37 @@ static void main_loop(void) al_wait_for_event(event_queue, &event); switch (event.type) { - /* ALLEGRO_EVENT_JOYSTICK_AXIS - a joystick axis value changed. + /* A5O_EVENT_JOYSTICK_AXIS - a joystick axis value changed. */ - case ALLEGRO_EVENT_JOYSTICK_AXIS: + case A5O_EVENT_JOYSTICK_AXIS: if (event.joystick.stick < MAX_STICKS && event.joystick.axis < MAX_AXES) { joys[event.joystick.stick][event.joystick.axis] = event.joystick.pos; } break; - /* ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN - a joystick button was pressed. + /* A5O_EVENT_JOYSTICK_BUTTON_DOWN - a joystick button was pressed. */ - case ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN: + case A5O_EVENT_JOYSTICK_BUTTON_DOWN: joys_buttons[event.joystick.button] = true; break; - /* ALLEGRO_EVENT_JOYSTICK_BUTTON_UP - a joystick button was released. + /* A5O_EVENT_JOYSTICK_BUTTON_UP - a joystick button was released. */ - case ALLEGRO_EVENT_JOYSTICK_BUTTON_UP: + case A5O_EVENT_JOYSTICK_BUTTON_UP: joys_buttons[event.joystick.button] = false; break; - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) return; break; - /* ALLEGRO_EVENT_DISPLAY_CLOSE - the window close button was pressed. + /* A5O_EVENT_DISPLAY_CLOSE - the window close button was pressed. */ - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: return; - case ALLEGRO_EVENT_JOYSTICK_CONFIGURATION: + case A5O_EVENT_JOYSTICK_CONFIGURATION: al_reconfigure_joysticks(); setup_joystick_values(al_get_joystick(0)); break; @@ -213,7 +213,7 @@ static void main_loop(void) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; + A5O_DISPLAY *display; (void)argc; (void)argv; diff --git a/examples/ex_joystick_hotplugging.c b/examples/ex_joystick_hotplugging.c index 569ea6fef6..e0782b8335 100644 --- a/examples/ex_joystick_hotplugging.c +++ b/examples/ex_joystick_hotplugging.c @@ -4,7 +4,7 @@ #include "common.c" -static void print_joystick_info(ALLEGRO_JOYSTICK *joy) +static void print_joystick_info(A5O_JOYSTICK *joy) { int i, n, a; @@ -31,11 +31,11 @@ static void print_joystick_info(ALLEGRO_JOYSTICK *joy) } } -static void draw(ALLEGRO_JOYSTICK *curr_joy) +static void draw(A5O_JOYSTICK *curr_joy) { int x = 100; int y = 100; - ALLEGRO_JOYSTICK_STATE joystate; + A5O_JOYSTICK_STATE joystate; int i; al_clear_to_color(al_map_rgb(0, 0, 0)); @@ -64,9 +64,9 @@ static void draw(ALLEGRO_JOYSTICK *curr_joy) int main(int argc, char **argv) { int num_joysticks; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_JOYSTICK *curr_joy; - ALLEGRO_DISPLAY *display; + A5O_EVENT_QUEUE *queue; + A5O_JOYSTICK *curr_joy; + A5O_DISPLAY *display; (void)argc; (void)argv; @@ -106,16 +106,16 @@ int main(int argc, char **argv) draw(curr_joy); while (1) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_KEY_DOWN && - event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_DOWN && + event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } - else if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + else if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } - else if (event.type == ALLEGRO_EVENT_KEY_CHAR) { + else if (event.type == A5O_EVENT_KEY_CHAR) { int n = event.keyboard.unichar - '0'; if (n >= 0 && n < num_joysticks) { curr_joy = al_get_joystick(n); @@ -123,7 +123,7 @@ int main(int argc, char **argv) print_joystick_info(curr_joy); } } - else if (event.type == ALLEGRO_EVENT_JOYSTICK_CONFIGURATION) { + else if (event.type == A5O_EVENT_JOYSTICK_CONFIGURATION) { al_reconfigure_joysticks(); num_joysticks = al_get_num_joysticks(); log_printf("after reconfiguration num joysticks = %d\n", @@ -134,14 +134,14 @@ int main(int argc, char **argv) } curr_joy = al_get_joystick(0); } - else if (event.type == ALLEGRO_EVENT_JOYSTICK_AXIS) { + else if (event.type == A5O_EVENT_JOYSTICK_AXIS) { log_printf("axis event from %p, stick %d, axis %d\n", event.joystick.id, event.joystick.stick, event.joystick.axis); } - else if (event.type == ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN) { + else if (event.type == A5O_EVENT_JOYSTICK_BUTTON_DOWN) { log_printf("button down event %d from %p\n", event.joystick.button, event.joystick.id); } - else if (event.type == ALLEGRO_EVENT_JOYSTICK_BUTTON_UP) { + else if (event.type == A5O_EVENT_JOYSTICK_BUTTON_UP) { log_printf("button up event %d from %p\n", event.joystick.button, event.joystick.id); } diff --git a/examples/ex_kcm_direct.c b/examples/ex_kcm_direct.c index 938679f59e..27712e5ae4 100644 --- a/examples/ex_kcm_direct.c +++ b/examples/ex_kcm_direct.c @@ -11,8 +11,8 @@ char *default_files[] = {NULL, "data/welcome.wav"}; int main(int argc, char **argv) { - ALLEGRO_VOICE *voice; - ALLEGRO_SAMPLE_INSTANCE *sample; + A5O_VOICE *voice; + A5O_SAMPLE_INSTANCE *sample; int i; if (!al_init()) { @@ -34,10 +34,10 @@ int main(int argc, char **argv) } for (i = 1; i < argc; ++i) { - ALLEGRO_SAMPLE *sample_data = NULL; + A5O_SAMPLE *sample_data = NULL; const char *filename = argv[i]; - ALLEGRO_CHANNEL_CONF chan; - ALLEGRO_AUDIO_DEPTH depth; + A5O_CHANNEL_CONF chan; + A5O_AUDIO_DEPTH depth; unsigned long freq; float sample_time = 0; @@ -67,7 +67,7 @@ int main(int argc, char **argv) log_printf("Trying to create a voice with the same specs... "); voice = al_create_voice(freq, depth, chan); if (!voice) { - abort_example("Could not create ALLEGRO_VOICE.\n"); + abort_example("Could not create A5O_VOICE.\n"); } log_printf("done.\n"); @@ -76,7 +76,7 @@ int main(int argc, char **argv) } /* Play sample in looping mode. */ - al_set_sample_instance_playmode(sample, ALLEGRO_PLAYMODE_LOOP); + al_set_sample_instance_playmode(sample, A5O_PLAYMODE_LOOP); al_play_sample_instance(sample); sample_time = al_get_sample_instance_time(sample); diff --git a/examples/ex_keyboard_events.c b/examples/ex_keyboard_events.c index 3d516bd279..be4a7bcc49 100644 --- a/examples/ex_keyboard_events.c +++ b/examples/ex_keyboard_events.c @@ -6,7 +6,7 @@ */ #include -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include "common.c" @@ -17,8 +17,8 @@ /* globals */ -ALLEGRO_EVENT_QUEUE *event_queue; -ALLEGRO_DISPLAY *display; +A5O_EVENT_QUEUE *event_queue; +A5O_DISPLAY *display; @@ -44,7 +44,7 @@ static void log_key(char const *how, int keycode, int unichar, int modifiers) */ static void main_loop(void) { - ALLEGRO_EVENT event; + A5O_EVENT event; log_printf("Focus on the main window (black) and press keys to see events. "); log_printf("Escape quits.\n\n"); @@ -53,7 +53,7 @@ static void main_loop(void) /* Take the next event out of the event queue, and store it in `event'. */ al_wait_for_event(event_queue, &event); - /* Check what type of event we got and act accordingly. ALLEGRO_EVENT + /* Check what type of event we got and act accordingly. A5O_EVENT * is a union type and interpretation of its contents is dependent on * the event type, which is given by the 'type' field. * @@ -63,24 +63,24 @@ static void main_loop(void) */ switch (event.type) { - /* ALLEGRO_EVENT_KEY_DOWN - a keyboard key was pressed. + /* A5O_EVENT_KEY_DOWN - a keyboard key was pressed. */ - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) { return; } log_key("KEY_DOWN", event.keyboard.keycode, 0, 0); break; - /* ALLEGRO_EVENT_KEY_UP - a keyboard key was released. + /* A5O_EVENT_KEY_UP - a keyboard key was released. */ - case ALLEGRO_EVENT_KEY_UP: + case A5O_EVENT_KEY_UP: log_key("KEY_UP", event.keyboard.keycode, 0, 0); break; - /* ALLEGRO_EVENT_KEY_CHAR - a character was typed or repeated. + /* A5O_EVENT_KEY_CHAR - a character was typed or repeated. */ - case ALLEGRO_EVENT_KEY_CHAR: { + case A5O_EVENT_KEY_CHAR: { char const *label = (event.keyboard.repeat ? "repeat" : "KEY_CHAR"); log_key(label, event.keyboard.keycode, @@ -89,12 +89,12 @@ static void main_loop(void) break; } - /* ALLEGRO_EVENT_DISPLAY_CLOSE - the window close button was pressed. + /* A5O_EVENT_DISPLAY_CLOSE - the window close button was pressed. */ - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: return; - case ALLEGRO_EVENT_DISPLAY_SWITCH_OUT: + case A5O_EVENT_DISPLAY_SWITCH_OUT: al_clear_keyboard_state(event.display.source); log_printf("Cleared keyboard state\n"); break; diff --git a/examples/ex_keyboard_focus.c b/examples/ex_keyboard_focus.c index dc3d921b24..00eabed923 100644 --- a/examples/ex_keyboard_focus.c +++ b/examples/ex_keyboard_focus.c @@ -1,7 +1,7 @@ /* * Example program for the Allegro library. * - * This program tests if the ALLEGRO_KEYBOARD_STATE `display' field + * This program tests if the A5O_KEYBOARD_STATE `display' field * is set correctly to the focused display. */ @@ -9,10 +9,10 @@ #include "common.c" -static ALLEGRO_DISPLAY *display1; -static ALLEGRO_DISPLAY *display2; +static A5O_DISPLAY *display1; +static A5O_DISPLAY *display2; -static void redraw(ALLEGRO_COLOR color1, ALLEGRO_COLOR color2) +static void redraw(A5O_COLOR color1, A5O_COLOR color2) { al_set_target_backbuffer(display1); al_clear_to_color(color1); @@ -25,9 +25,9 @@ static void redraw(ALLEGRO_COLOR color1, ALLEGRO_COLOR color2) int main(int argc, char **argv) { - ALLEGRO_COLOR black; - ALLEGRO_COLOR red; - ALLEGRO_KEYBOARD_STATE kbdstate; + A5O_COLOR black; + A5O_COLOR red; + A5O_KEYBOARD_STATE kbdstate; (void)argc; (void)argv; @@ -51,7 +51,7 @@ int main(int argc, char **argv) while (1) { al_get_keyboard_state(&kbdstate); - if (al_key_down(&kbdstate, ALLEGRO_KEY_ESCAPE)) { + if (al_key_down(&kbdstate, A5O_KEY_ESCAPE)) { break; } diff --git a/examples/ex_lines.c b/examples/ex_lines.c index 58022bf7d1..12fe26cd87 100644 --- a/examples/ex_lines.c +++ b/examples/ex_lines.c @@ -13,12 +13,12 @@ const int W = 640; const int H = 480; -ALLEGRO_DISPLAY *display; -ALLEGRO_EVENT_QUEUE *queue; -ALLEGRO_COLOR black; -ALLEGRO_COLOR white; -ALLEGRO_COLOR background; -ALLEGRO_BITMAP *dbuf; +A5O_DISPLAY *display; +A5O_EVENT_QUEUE *queue; +A5O_COLOR black; +A5O_COLOR white; +A5O_COLOR background; +A5O_BITMAP *dbuf; int last_x = -1; int last_y = -1; @@ -26,7 +26,7 @@ int last_y = -1; static void fade(void) { - al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA); al_draw_filled_rectangle(0, 0, W, H, al_map_rgba_f(0.5, 0.5, 0.6, 0.2)); } @@ -53,7 +53,7 @@ static void reset_clip_rect(void) static void flip(void) { al_set_target_backbuffer(display); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_draw_bitmap(dbuf, 0.0, 0.0, 0); al_flip_display(); } @@ -63,7 +63,7 @@ static void plonk(const int x, const int y, bool blend) al_set_target_bitmap(dbuf); fade(); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ALPHA, A5O_ZERO); draw_clip_rect(); red_dot(x, y); @@ -74,7 +74,7 @@ static void plonk(const int x, const int y, bool blend) else { my_set_clip_rect(); if (blend) { - al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA); } al_draw_line(last_x, last_y, x, y, white, 0); last_x = last_y = -1; @@ -91,15 +91,15 @@ static void splat(const int x, const int y, bool blend) al_set_target_bitmap(dbuf); fade(); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ALPHA, A5O_ZERO); draw_clip_rect(); red_dot(x, y); my_set_clip_rect(); if (blend) { - al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA); } - for (theta = 0.0; theta < 2.0 * ALLEGRO_PI; theta += ALLEGRO_PI/16.0) { + for (theta = 0.0; theta < 2.0 * A5O_PI; theta += A5O_PI/16.0) { al_draw_line(x, y, x + 40.0 * cos(theta), y + 40.0 * sin(theta), white, 0); } reset_clip_rect(); @@ -109,8 +109,8 @@ static void splat(const int x, const int y, bool blend) int main(int argc, char **argv) { - ALLEGRO_EVENT event; - ALLEGRO_KEYBOARD_STATE kst; + A5O_EVENT event; + A5O_KEYBOARD_STATE kst; bool blend; if (!al_init()) { @@ -131,7 +131,7 @@ int main(int argc, char **argv) background = al_map_rgb_f(0.5, 0.5, 0.6); if (argc > 1 && 0 == strcmp(argv[1], "--memory-bitmap")) { - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); } dbuf = al_create_bitmap(W, H); if (!dbuf) { @@ -149,21 +149,21 @@ int main(int argc, char **argv) while (true) { al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN) { + if (event.type == A5O_EVENT_MOUSE_BUTTON_DOWN) { al_get_keyboard_state(&kst); - blend = al_key_down(&kst, ALLEGRO_KEY_LSHIFT) || - al_key_down(&kst, ALLEGRO_KEY_RSHIFT); + blend = al_key_down(&kst, A5O_KEY_LSHIFT) || + al_key_down(&kst, A5O_KEY_RSHIFT); if (event.mouse.button == 1) { plonk(event.mouse.x, event.mouse.y, blend); } else { splat(event.mouse.x, event.mouse.y, blend); } } - else if (event.type == ALLEGRO_EVENT_DISPLAY_SWITCH_OUT) { + else if (event.type == A5O_EVENT_DISPLAY_SWITCH_OUT) { last_x = last_y = -1; } - else if (event.type == ALLEGRO_EVENT_KEY_DOWN && - event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + else if (event.type == A5O_EVENT_KEY_DOWN && + event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } diff --git a/examples/ex_loading_thread.c b/examples/ex_loading_thread.c index af1c135d2c..c01463c3ba 100644 --- a/examples/ex_loading_thread.c +++ b/examples/ex_loading_thread.c @@ -10,13 +10,13 @@ static const int load_total = 100; static int load_count = 0; -static ALLEGRO_BITMAP *bitmaps[100]; -static ALLEGRO_MUTEX *mutex; +static A5O_BITMAP *bitmaps[100]; +static A5O_MUTEX *mutex; -static void *loading_thread(ALLEGRO_THREAD *thread, void *arg) +static void *loading_thread(A5O_THREAD *thread, void *arg) { - ALLEGRO_FONT *font; - ALLEGRO_COLOR text; + A5O_FONT *font; + A5O_COLOR text; font = al_load_font("data/fixed_font.tga", 0, 0); text = al_map_rgb_f(255, 255, 255); @@ -26,8 +26,8 @@ static void *loading_thread(ALLEGRO_THREAD *thread, void *arg) */ load_count = 0; while (load_count < load_total) { - ALLEGRO_COLOR color; - ALLEGRO_BITMAP *bmp; + A5O_COLOR color; + A5O_BITMAP *bmp; color = al_map_rgb(rand() % 256, rand() % 256, rand() % 256); color.r /= 4; @@ -60,14 +60,14 @@ static void *loading_thread(ALLEGRO_THREAD *thread, void *arg) return arg; } -static void print_bitmap_flags(ALLEGRO_BITMAP *bitmap) +static void print_bitmap_flags(A5O_BITMAP *bitmap) { - ALLEGRO_USTR *ustr = al_ustr_new(""); - if (al_get_bitmap_flags(bitmap) & ALLEGRO_VIDEO_BITMAP) + A5O_USTR *ustr = al_ustr_new(""); + if (al_get_bitmap_flags(bitmap) & A5O_VIDEO_BITMAP) al_ustr_append_cstr(ustr, " VIDEO"); - if (al_get_bitmap_flags(bitmap) & ALLEGRO_MEMORY_BITMAP) + if (al_get_bitmap_flags(bitmap) & A5O_MEMORY_BITMAP) al_ustr_append_cstr(ustr, " MEMORY"); - if (al_get_bitmap_flags(bitmap) & ALLEGRO_CONVERT_BITMAP) + if (al_get_bitmap_flags(bitmap) & A5O_CONVERT_BITMAP) al_ustr_append_cstr(ustr, " CONVERT"); al_ustr_trim_ws(ustr); @@ -79,15 +79,15 @@ static void print_bitmap_flags(ALLEGRO_BITMAP *bitmap) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; + A5O_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; bool redraw = true; - ALLEGRO_FONT *font; - ALLEGRO_BITMAP *spin, *spin2; + A5O_FONT *font; + A5O_BITMAP *spin, *spin2; int current_bitmap = 0; int loaded_bitmap = 0; - ALLEGRO_THREAD *thread; + A5O_THREAD *thread; (void)argc; (void)argv; @@ -108,7 +108,7 @@ int main(int argc, char **argv) spin = al_load_bitmap("data/cursor.tga"); log_printf("default bitmap without display: %p\n", spin); - al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP); + al_set_new_bitmap_flags(A5O_VIDEO_BITMAP); spin2 = al_load_bitmap("data/cursor.tga"); log_printf("video bitmap without display: %p\n", spin2); @@ -166,22 +166,22 @@ int main(int argc, char **argv) al_start_timer(timer); while (1) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) + if (event.type == A5O_EVENT_DISPLAY_CLOSE) break; - if (event.type == ALLEGRO_EVENT_KEY_DOWN) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + if (event.type == A5O_EVENT_KEY_DOWN) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) break; } - if (event.type == ALLEGRO_EVENT_TIMER) + if (event.type == A5O_EVENT_TIMER) redraw = true; if (redraw && al_is_event_queue_empty(queue)) { float x = 20, y = 320; int i; - ALLEGRO_COLOR color = al_map_rgb_f(0, 0, 0); + A5O_COLOR color = al_map_rgb_f(0, 0, 0); float t = al_current_time(); redraw = false; @@ -217,7 +217,7 @@ int main(int argc, char **argv) if (loaded_bitmap < load_total) { al_draw_scaled_rotated_bitmap(spin, - 16, 16, x, y, 1.0, 1.0, t * ALLEGRO_PI * 2, 0); + 16, 16, x, y, 1.0, 1.0, t * A5O_PI * 2, 0); } al_flip_display(); diff --git a/examples/ex_lockbitmap.c b/examples/ex_lockbitmap.c index 86dd0ae413..b239994d0b 100644 --- a/examples/ex_lockbitmap.c +++ b/examples/ex_lockbitmap.c @@ -4,7 +4,7 @@ * From left to right you should see Red, Green, Blue gradients. */ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include "allegro5/allegro.h" #include "common.c" @@ -16,9 +16,9 @@ enum Mode MODE_BACKBUFFER }; -static void fill(ALLEGRO_BITMAP *bitmap, int lock_flags) +static void fill(A5O_BITMAP *bitmap, int lock_flags) { - ALLEGRO_LOCKED_REGION *locked; + A5O_LOCKED_REGION *locked; uint8_t *ptr; int i, j; @@ -30,7 +30,7 @@ static void fill(ALLEGRO_BITMAP *bitmap, int lock_flags) * chances of uncovering bugs. */ locked = al_lock_bitmap_region(bitmap, 193, 65, 3*127, 127, - ALLEGRO_PIXEL_FORMAT_RGB_565, lock_flags); + A5O_PIXEL_FORMAT_RGB_565, lock_flags); if (!locked) return; @@ -69,7 +69,7 @@ static void fill(ALLEGRO_BITMAP *bitmap, int lock_flags) * In READWRITE mode the light blue background should should through * the stipple pattern. */ - if ((lock_flags & ALLEGRO_LOCK_WRITEONLY) || (j + i) % 2 == 1) { + if ((lock_flags & A5O_LOCK_WRITEONLY) || (j + i) % 2 == 1) { col = ((red/8) << 11) | ((green/4) << 5) | (blue/8); *cptr = col; } @@ -79,21 +79,21 @@ static void fill(ALLEGRO_BITMAP *bitmap, int lock_flags) al_unlock_bitmap(bitmap); } -static void draw(ALLEGRO_DISPLAY *display, enum Mode mode, int lock_flags) +static void draw(A5O_DISPLAY *display, enum Mode mode, int lock_flags) { - ALLEGRO_BITMAP *bitmap; + A5O_BITMAP *bitmap; /* Create the bitmap to lock, or use the display backbuffer. */ if (mode == MODE_VIDEO) { log_printf("Locking video bitmap"); al_clear_to_color(al_map_rgb(0, 0, 0)); - al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP); + al_set_new_bitmap_flags(A5O_VIDEO_BITMAP); bitmap = al_create_bitmap(3*256, 256); } else if (mode == MODE_MEMORY) { log_printf("Locking memory bitmap"); al_clear_to_color(al_map_rgb(0, 0, 0)); - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); bitmap = al_create_bitmap(3*256, 256); } else { @@ -104,7 +104,7 @@ static void draw(ALLEGRO_DISPLAY *display, enum Mode mode, int lock_flags) abort_example("Error creating bitmap"); } - if (lock_flags & ALLEGRO_LOCK_WRITEONLY) { + if (lock_flags & A5O_LOCK_WRITEONLY) { log_printf(" in write-only mode\n"); } else { @@ -141,16 +141,16 @@ static enum Mode cycle_mode(enum Mode mode) static int toggle_writeonly(int lock_flags) { - return lock_flags ^ ALLEGRO_LOCK_WRITEONLY; + return lock_flags ^ A5O_LOCK_WRITEONLY; } int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_EVENT_QUEUE *events; - ALLEGRO_EVENT event; + A5O_DISPLAY *display; + A5O_EVENT_QUEUE *events; + A5O_EVENT event; enum Mode mode = MODE_VIDEO; - int lock_flags = ALLEGRO_LOCK_WRITEONLY; + int lock_flags = A5O_LOCK_WRITEONLY; bool redraw = true; (void)argc; @@ -190,8 +190,8 @@ int main(int argc, char **argv) } al_wait_for_event(events, &event); - if (event.type == ALLEGRO_EVENT_KEY_CHAR) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + if (event.type == A5O_EVENT_KEY_CHAR) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) break; if (event.keyboard.unichar == ' ') { mode = cycle_mode(mode); @@ -202,7 +202,7 @@ int main(int argc, char **argv) redraw = true; } } - else if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN) { + else if (event.type == A5O_EVENT_MOUSE_BUTTON_DOWN) { if (event.mouse.button == 1) { if (event.mouse.x < al_get_display_width(display) / 2) { mode = cycle_mode(mode); diff --git a/examples/ex_logo.c b/examples/ex_logo.c index e72d2ffc88..210743ee73 100644 --- a/examples/ex_logo.c +++ b/examples/ex_logo.c @@ -14,18 +14,18 @@ #include "common.c" -#ifdef ALLEGRO_MSVC +#ifdef A5O_MSVC #define snprintf _snprintf #endif -static ALLEGRO_BITMAP *logo, *logo_flash; +static A5O_BITMAP *logo, *logo_flash; static int logo_x, logo_y; -static ALLEGRO_FONT *font; +static A5O_FONT *font; static int cursor; static int selection; static bool regenerate = 0, editing = 0; -static ALLEGRO_CONFIG *config; -static ALLEGRO_COLOR white; +static A5O_CONFIG *config; +static A5O_COLOR white; static double anim; static float clamp(float x) @@ -56,7 +56,7 @@ static char param_values[][256] = { * contain another bitmap which is a white, blurred mask of the logo * which we use for the flash effect. */ -static ALLEGRO_BITMAP *generate_logo(char const *text, +static A5O_BITMAP *generate_logo(char const *text, char const *fontname, int font_size, float shadow_offset, @@ -65,14 +65,14 @@ static ALLEGRO_BITMAP *generate_logo(char const *text, float light_red, float light_green, float light_blue, - ALLEGRO_BITMAP **bumpmap) + A5O_BITMAP **bumpmap) { - ALLEGRO_COLOR transparent = al_map_rgba_f(0, 0, 0, 0); + A5O_COLOR transparent = al_map_rgba_f(0, 0, 0, 0); int xp, yp, w, h, i, j, x, y, br, bw, dw, dh; - ALLEGRO_COLOR c; - ALLEGRO_FONT *logofont; - ALLEGRO_STATE state; - ALLEGRO_BITMAP *blur, *light, *logo; + A5O_COLOR c; + A5O_FONT *logofont; + A5O_STATE state; + A5O_BITMAP *blur, *light, *logo; int left, right, top, bottom; float cx, cy; @@ -85,7 +85,7 @@ static ALLEGRO_BITMAP *generate_logo(char const *text, logofont = al_load_font(fontname, -font_size, 0); al_get_text_dimensions(logofont, text, &xp, &yp, &w, &h); - al_store_state(&state, ALLEGRO_STATE_TARGET_BITMAP | ALLEGRO_STATE_BLENDER); + al_store_state(&state, A5O_STATE_TARGET_BITMAP | A5O_STATE_BLENDER); /* Cheap blur effect to create a bump map. */ blur = al_create_bitmap(dw, dh); @@ -94,8 +94,8 @@ static ALLEGRO_BITMAP *generate_logo(char const *text, br = blur_radius; bw = br * 2 + 1; c = al_map_rgba_f(1, 1, 1, 1.0 / (bw * bw * blur_factor)); - al_set_separate_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, - ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + al_set_separate_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, + A5O_ADD, A5O_ONE, A5O_ONE); for (i = -br; i <= br; i++) { for (j = -br; j <= br; j++) { al_draw_text(logofont, c, @@ -122,19 +122,19 @@ static ALLEGRO_BITMAP *generate_logo(char const *text, light = al_create_bitmap(dw, dh); al_set_target_bitmap(light); al_clear_to_color(transparent); - al_lock_bitmap(blur, ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_READONLY); + al_lock_bitmap(blur, A5O_PIXEL_FORMAT_ANY, A5O_LOCK_READONLY); al_lock_bitmap_region(light, left, top, 1 + right - left, 1 + bottom - top, - ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_WRITEONLY); + A5O_PIXEL_FORMAT_ANY, A5O_LOCK_WRITEONLY); for (y = top; y <= bottom; y++) { for (x = left; x <= right; x++) { float r1, g1, b1, a1; float r2, g2, b2, a2; float r, g, b, a; float d; - ALLEGRO_COLOR c = al_get_pixel(blur, x, y); - ALLEGRO_COLOR c1 = al_get_pixel(blur, x - 1, y - 1); - ALLEGRO_COLOR c2 = al_get_pixel(blur, x + 1, y + 1); + A5O_COLOR c = al_get_pixel(blur, x, y); + A5O_COLOR c1 = al_get_pixel(blur, x - 1, y - 1); + A5O_COLOR c2 = al_get_pixel(blur, x + 1, y + 1); al_unmap_rgba_f(c, &r, &g, &b, &a); al_unmap_rgba_f(c1, &r1, &g1, &b1, &a1); al_unmap_rgba_f(c2, &r2, &g2, &b2, &a2); @@ -163,8 +163,8 @@ static ALLEGRO_BITMAP *generate_logo(char const *text, /* Draw a shadow. */ c = al_map_rgba_f(0, 0, 0, 0.5 / 9); - al_set_separate_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, - ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + al_set_separate_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, + A5O_ADD, A5O_ONE, A5O_ONE); for (i = -1; i <= 1; i++) for (j = -1; j <= 1; j++) al_draw_text(logofont, c, @@ -173,8 +173,8 @@ static ALLEGRO_BITMAP *generate_logo(char const *text, 0, text); /* Then draw the lit text we made before on top. */ - al_set_separate_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, - ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_separate_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, + A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_draw_bitmap(light, 0, 0, 0); al_destroy_bitmap(light); @@ -187,7 +187,7 @@ static ALLEGRO_BITMAP *generate_logo(char const *text, /* Draw the checkerboard background. */ static void draw_background(void) { - ALLEGRO_COLOR c[2]; + A5O_COLOR c[2]; int i, j; c[0] = al_map_rgba(0xaa, 0xaa, 0xaa, 0xff); c[1] = al_map_rgba(0x99, 0x99, 0x99, 0xff); @@ -205,17 +205,17 @@ static void draw_background(void) static void print_parameters(void) { int i; - ALLEGRO_STATE state; - ALLEGRO_COLOR normal = al_map_rgba_f(0, 0, 0, 1); - ALLEGRO_COLOR light = al_map_rgba_f(0, 0, 1, 1); - ALLEGRO_COLOR label = al_map_rgba_f(0.2, 0.2, 0.2, 1); + A5O_STATE state; + A5O_COLOR normal = al_map_rgba_f(0, 0, 0, 1); + A5O_COLOR light = al_map_rgba_f(0, 0, 1, 1); + A5O_COLOR label = al_map_rgba_f(0.2, 0.2, 0.2, 1); int th; - al_store_state(&state, ALLEGRO_STATE_BLENDER); + al_store_state(&state, A5O_STATE_BLENDER); th = al_get_font_line_height(font) + 3; for (i = 0; param_names[i]; i++) { - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_draw_textf(font, label, 2, 2 + i * th, 0, "%s", param_names[i]); } for (i = 0; param_names[i]; i++) { @@ -226,12 +226,12 @@ static void print_parameters(void) if (i == selection && editing && (((int)(al_get_time() * 2)) & 1)) { int x = 75 + al_get_text_width(font, param_values[i]); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_draw_line(x, y, x, y + th, white, 0); } } - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_draw_textf(font, normal, 400, 2, 0, "%s", "R - Randomize"); al_draw_textf(font, normal, 400, 2 + th, 0, "%s", "S - Save as logo.png"); @@ -302,8 +302,8 @@ static void render(void) } if (!logo) { /* Generate a new logo. */ - ALLEGRO_BITMAP *fullflash; - ALLEGRO_BITMAP *fulllogo = generate_logo(param_values[0], + A5O_BITMAP *fullflash; + A5O_BITMAP *fulllogo = generate_logo(param_values[0], param_values[1], strtol(param_values[2], NULL, 10), strtod(param_values[3], NULL), @@ -313,13 +313,13 @@ static void render(void) strtod(param_values[7], NULL), strtod(param_values[8], NULL), &fullflash); - ALLEGRO_BITMAP *crop; + A5O_BITMAP *crop; int x, y, left = 640, top = 480, right = -1, bottom = -1; /* Crop out the non-transparent part. */ - al_lock_bitmap(fulllogo, ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_READONLY); + al_lock_bitmap(fulllogo, A5O_PIXEL_FORMAT_ANY, A5O_LOCK_READONLY); for (y = 0; y < 480; y++) { for (x = 0; x < 640; x++) { - ALLEGRO_COLOR c = al_get_pixel(fulllogo, x, y); + A5O_COLOR c = al_get_pixel(fulllogo, x, y); float r, g, b, a; al_unmap_rgba_f(c, &r, &g, &b, &a); if (a > 0) { @@ -366,14 +366,14 @@ static void render(void) /* For half a second, display our flash animation. */ if (t - anim < 0.5) { - ALLEGRO_STATE state; + A5O_STATE state; int i, j; - float f = sin(ALLEGRO_PI * ((t - anim) / 0.5)); - ALLEGRO_COLOR c = al_map_rgb_f(f * 0.3, f * 0.3, f * 0.3); - al_store_state(&state, ALLEGRO_STATE_BLENDER); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + float f = sin(A5O_PI * ((t - anim) / 0.5)); + A5O_COLOR c = al_map_rgb_f(f * 0.3, f * 0.3, f * 0.3); + al_store_state(&state, A5O_STATE_BLENDER); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_draw_tinted_bitmap(logo, al_map_rgba_f(1, 1, 1, 1 - f), logo_x, logo_y, 0); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE); for (j = -2; j <= 2; j += 2) { for (i = -2; i <= 2; i += 2) { al_draw_tinted_bitmap(logo_flash, c, logo_x + i, logo_y + j, 0); @@ -390,9 +390,9 @@ static void render(void) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; + A5O_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; int redraw = 0, i; bool quit = false; @@ -444,15 +444,15 @@ int main(int argc, char **argv) al_start_timer(timer); while (!quit) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) + if (event.type == A5O_EVENT_DISPLAY_CLOSE) break; - if (event.type == ALLEGRO_EVENT_KEY_CHAR) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_CHAR) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) { quit = true; } - else if (event.keyboard.keycode == ALLEGRO_KEY_ENTER) { + else if (event.keyboard.keycode == A5O_KEY_ENTER) { if (editing) { regenerate = true; editing = false; @@ -462,14 +462,14 @@ int main(int argc, char **argv) editing = true; } } - else if (event.keyboard.keycode == ALLEGRO_KEY_UP) { + else if (event.keyboard.keycode == A5O_KEY_UP) { if (selection > 0) { selection--; cursor = strlen(param_values[selection]); editing = false; } } - else if (event.keyboard.keycode == ALLEGRO_KEY_DOWN) { + else if (event.keyboard.keycode == A5O_KEY_DOWN) { if (param_names[selection + 1]) { selection++; cursor = strlen(param_values[selection]); @@ -479,9 +479,9 @@ int main(int argc, char **argv) else { int c = event.keyboard.unichar; if (editing) { - if (event.keyboard.keycode == ALLEGRO_KEY_BACKSPACE) { + if (event.keyboard.keycode == A5O_KEY_BACKSPACE) { if (cursor > 0) { - ALLEGRO_USTR *u = al_ustr_new(param_values[selection]); + A5O_USTR *u = al_ustr_new(param_values[selection]); if (al_ustr_prev(u, &cursor)) { al_ustr_remove_chr(u, cursor); strncpy(param_values[selection], al_cstr(u), @@ -491,7 +491,7 @@ int main(int argc, char **argv) } } else if (c >= 32) { - ALLEGRO_USTR *u = al_ustr_new(param_values[selection]); + A5O_USTR *u = al_ustr_new(param_values[selection]); cursor += al_ustr_set_chr(u, cursor, c); al_ustr_set_chr(u, cursor, 0); strncpy(param_values[selection], al_cstr(u), @@ -507,12 +507,12 @@ int main(int argc, char **argv) } } } - if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN) { + if (event.type == A5O_EVENT_MOUSE_BUTTON_DOWN) { if (event.mouse.button == 1) { mouse_click(event.mouse.x, event.mouse.y); } } - if (event.type == ALLEGRO_EVENT_TIMER) + if (event.type == A5O_EVENT_TIMER) redraw++; if (redraw && al_is_event_queue_empty(queue)) { diff --git a/examples/ex_membmp.c b/examples/ex_membmp.c index abfa5d7900..90764b9959 100644 --- a/examples/ex_membmp.c +++ b/examples/ex_membmp.c @@ -6,16 +6,16 @@ #include "common.c" -static void print(ALLEGRO_FONT *myfont, char *message, int x, int y) +static void print(A5O_FONT *myfont, char *message, int x, int y) { al_draw_text(myfont, al_map_rgb(0, 0, 0), x+2, y+2, 0, message); al_draw_text(myfont, al_map_rgb(255, 255, 255), x, y, 0, message); } -static bool test(ALLEGRO_BITMAP *bitmap, ALLEGRO_FONT *font, char *message) +static bool test(A5O_BITMAP *bitmap, A5O_FONT *font, char *message) { - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; double start_time; long frames = 0; double fps = 0; @@ -29,18 +29,18 @@ static bool test(ALLEGRO_BITMAP *bitmap, ALLEGRO_FONT *font, char *message) for (;;) { if (al_get_next_event(queue, &event)) { - if (event.type == ALLEGRO_EVENT_KEY_DOWN) { - if (event.keyboard.keycode == ALLEGRO_KEY_SPACE) { + if (event.type == A5O_EVENT_KEY_DOWN) { + if (event.keyboard.keycode == A5O_KEY_SPACE) { break; } - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) { quit = true; break; } } } - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); /* Clear the backbuffer with red so we can tell if the bitmap does not * cover the entire backbuffer. @@ -55,7 +55,7 @@ static bool test(ALLEGRO_BITMAP *bitmap, ALLEGRO_FONT *font, char *message) al_get_bitmap_height(al_get_target_bitmap()), 0); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); /* Note this makes the memory buffer case much slower due to repeated * locking of the backbuffer. Officially you can't use al_lock_bitmap @@ -78,11 +78,11 @@ static bool test(ALLEGRO_BITMAP *bitmap, ALLEGRO_FONT *font, char *message) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_FONT *accelfont; - ALLEGRO_FONT *memfont; - ALLEGRO_BITMAP *accelbmp; - ALLEGRO_BITMAP *membmp; + A5O_DISPLAY *display; + A5O_FONT *accelfont; + A5O_FONT *memfont; + A5O_BITMAP *accelbmp; + A5O_BITMAP *membmp; (void)argc; (void)argv; @@ -110,7 +110,7 @@ int main(int argc, char **argv) abort_example("mysha.pcx not found\n"); } - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); memfont = al_load_font("data/font.tga", 0, 0); membmp = al_load_bitmap("data/mysha.pcx"); diff --git a/examples/ex_memfile.c b/examples/ex_memfile.c index f3fce7566f..f45e7161c3 100644 --- a/examples/ex_memfile.c +++ b/examples/ex_memfile.c @@ -8,7 +8,7 @@ #ifdef _MSC_VER #pragma comment ( linker, "/SUBSYSTEM:CONSOLE") #endif -#define ALLEGRO_USE_CONSOLE +#define A5O_USE_CONSOLE #include #include @@ -16,7 +16,7 @@ int main(void) { - ALLEGRO_FILE *memfile; + A5O_FILE *memfile; char *data; int i; const int data_size = 1024; @@ -47,7 +47,7 @@ int main(void) } } - al_fseek(memfile, 0, ALLEGRO_SEEK_SET); + al_fseek(memfile, 0, A5O_SEEK_SET); log_printf("Reading and testing data from memfile\n"); for (i = 0; i < data_size/4; i++) { @@ -64,7 +64,7 @@ int main(void) } /* testing the ungetc buffer */ - al_fseek(memfile, 0, ALLEGRO_SEEK_SET); + al_fseek(memfile, 0, A5O_SEEK_SET); for (i = 0; al_fungetc(memfile, i) != EOF; ++i) { } log_printf("Length of ungetc buffer: %d\n", i); @@ -89,7 +89,7 @@ int main(void) } al_fputs(memfile, "legro rocks!"); - al_fseek(memfile, 0, ALLEGRO_SEEK_SET); + al_fseek(memfile, 0, A5O_SEEK_SET); al_fungetc(memfile, 'l'); al_fungetc(memfile, 'A'); al_fgets(memfile, buffer, 15); diff --git a/examples/ex_menu.c b/examples/ex_menu.c index 630af20f08..bc0077dbe9 100644 --- a/examples/ex_menu.c +++ b/examples/ex_menu.c @@ -30,33 +30,33 @@ enum { /* This is one way to define a menu. The entire system, nested menus and all, * can be defined by this single array. */ -ALLEGRO_MENU_INFO main_menu_info[] = { - ALLEGRO_START_OF_MENU("&File", FILE_ID), +A5O_MENU_INFO main_menu_info[] = { + A5O_START_OF_MENU("&File", FILE_ID), { "&Open", FILE_OPEN_ID, 0, NULL }, - ALLEGRO_MENU_SEPARATOR, + A5O_MENU_SEPARATOR, { "E&xit", FILE_EXIT_ID, 0, NULL }, - ALLEGRO_END_OF_MENU, + A5O_END_OF_MENU, - ALLEGRO_START_OF_MENU("&Dynamic Options", DYNAMIC_ID), - { "&Checkbox", DYNAMIC_CHECKBOX_ID, ALLEGRO_MENU_ITEM_CHECKED, NULL }, - { "&Disabled", DYNAMIC_DISABLED_ID, ALLEGRO_MENU_ITEM_DISABLED, NULL }, + A5O_START_OF_MENU("&Dynamic Options", DYNAMIC_ID), + { "&Checkbox", DYNAMIC_CHECKBOX_ID, A5O_MENU_ITEM_CHECKED, NULL }, + { "&Disabled", DYNAMIC_DISABLED_ID, A5O_MENU_ITEM_DISABLED, NULL }, { "DELETE ME!", DYNAMIC_DELETE_ID, 0, NULL }, { "Click Me", DYNAMIC_CREATE_ID, 0, NULL }, - ALLEGRO_END_OF_MENU, + A5O_END_OF_MENU, - ALLEGRO_START_OF_MENU("&Help", 0), + A5O_START_OF_MENU("&Help", 0), { "&About", HELP_ABOUT_ID, 0, NULL }, - ALLEGRO_END_OF_MENU, + A5O_END_OF_MENU, - ALLEGRO_END_OF_MENU + A5O_END_OF_MENU }; /* This is the menu on the secondary windows. */ -ALLEGRO_MENU_INFO child_menu_info[] = { - ALLEGRO_START_OF_MENU("&File", 0), +A5O_MENU_INFO child_menu_info[] = { + A5O_START_OF_MENU("&File", 0), { "&Close", FILE_CLOSE_ID, 0, NULL }, - ALLEGRO_END_OF_MENU, - ALLEGRO_END_OF_MENU + A5O_END_OF_MENU, + A5O_END_OF_MENU }; int main(int argc, char **argv) @@ -65,14 +65,14 @@ int main(int argc, char **argv) const int initial_height = 200; int dcount = 0; - ALLEGRO_DISPLAY *display; - ALLEGRO_MENU *menu; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_TIMER *timer; + A5O_DISPLAY *display; + A5O_MENU *menu; + A5O_EVENT_QUEUE *queue; + A5O_TIMER *timer; bool redraw = true; bool menu_visible = true; - ALLEGRO_MENU *pmenu; - ALLEGRO_BITMAP *bg; + A5O_MENU *pmenu; + A5O_BITMAP *bg; (void)argc; (void)argv; @@ -89,11 +89,11 @@ int main(int argc, char **argv) queue = al_create_event_queue(); -#ifdef ALLEGRO_GTK_TOPLEVEL - /* ALLEGRO_GTK_TOPLEVEL is necessary for menus with GTK. */ - al_set_new_display_flags(ALLEGRO_RESIZABLE | ALLEGRO_GTK_TOPLEVEL); +#ifdef A5O_GTK_TOPLEVEL + /* A5O_GTK_TOPLEVEL is necessary for menus with GTK. */ + al_set_new_display_flags(A5O_RESIZABLE | A5O_GTK_TOPLEVEL); #else - al_set_new_display_flags(ALLEGRO_RESIZABLE); + al_set_new_display_flags(A5O_RESIZABLE); #endif display = al_create_display(initial_width, initial_height); if (!display) { @@ -143,7 +143,7 @@ int main(int argc, char **argv) al_start_timer(timer); while (true) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (redraw && al_is_event_queue_empty(queue)) { redraw = false; @@ -165,7 +165,7 @@ int main(int argc, char **argv) al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + if (event.type == A5O_EVENT_DISPLAY_CLOSE) { if (event.display.source == display) { /* Closing the primary display */ break; @@ -176,7 +176,7 @@ int main(int argc, char **argv) al_destroy_display(event.display.source); } } - else if (event.type == ALLEGRO_EVENT_MENU_CLICK) { + else if (event.type == A5O_EVENT_MENU_CLICK) { /* data1: id * data2: display (could be null) * data3: menu (could be null) @@ -184,9 +184,9 @@ int main(int argc, char **argv) if (event.user.data2 == (intptr_t) display) { /* The main window. */ if (event.user.data1 == FILE_OPEN_ID) { - ALLEGRO_DISPLAY *d = al_create_display(320, 240); + A5O_DISPLAY *d = al_create_display(320, 240); if (d) { - ALLEGRO_MENU *menu = al_build_menu(child_menu_info); + A5O_MENU *menu = al_build_menu(child_menu_info); al_set_display_menu(d, menu); al_clear_to_color(al_map_rgb(0,0,0)); al_flip_display(); @@ -196,9 +196,9 @@ int main(int argc, char **argv) } } else if (event.user.data1 == DYNAMIC_CHECKBOX_ID) { - al_set_menu_item_flags(menu, DYNAMIC_DISABLED_ID, al_get_menu_item_flags(menu, DYNAMIC_DISABLED_ID) ^ ALLEGRO_MENU_ITEM_DISABLED); + al_set_menu_item_flags(menu, DYNAMIC_DISABLED_ID, al_get_menu_item_flags(menu, DYNAMIC_DISABLED_ID) ^ A5O_MENU_ITEM_DISABLED); al_set_menu_item_caption(menu, DYNAMIC_DISABLED_ID, - (al_get_menu_item_flags(menu, DYNAMIC_DISABLED_ID) & ALLEGRO_MENU_ITEM_DISABLED) ? + (al_get_menu_item_flags(menu, DYNAMIC_DISABLED_ID) & A5O_MENU_ITEM_DISABLED) ? "&Disabled" : "&Enabled"); } else if (event.user.data1 == DYNAMIC_DELETE_ID) { @@ -219,7 +219,7 @@ int main(int argc, char **argv) if (dcount == 5) { /* disable the option */ - al_set_menu_item_flags(menu, DYNAMIC_CREATE_ID, ALLEGRO_MENU_ITEM_DISABLED); + al_set_menu_item_flags(menu, DYNAMIC_CREATE_ID, A5O_MENU_ITEM_DISABLED); } } } @@ -242,24 +242,24 @@ int main(int argc, char **argv) } else if (event.user.data1 == FILE_FULLSCREEN_ID) { int flags = al_get_display_flags(display); - bool value = (flags & ALLEGRO_FULLSCREEN_WINDOW) ? true : false; - al_set_display_flag(display, ALLEGRO_FULLSCREEN_WINDOW, !value); + bool value = (flags & A5O_FULLSCREEN_WINDOW) ? true : false; + al_set_display_flag(display, A5O_FULLSCREEN_WINDOW, !value); } else if (event.user.data1 == FILE_FRAMELESS_ID) { int flags = al_get_display_flags(display); - bool value = (flags & ALLEGRO_FRAMELESS) ? true : false; - al_set_display_flag(display, ALLEGRO_FRAMELESS, !value); + bool value = (flags & A5O_FRAMELESS) ? true : false; + al_set_display_flag(display, A5O_FRAMELESS, !value); } else if (event.user.data1 == FILE_MAXIMIZE_ID) { int flags = al_get_display_flags(display); - bool value = (flags & ALLEGRO_MAXIMIZED) ? true : false; - al_set_display_flag(display, ALLEGRO_MAXIMIZED, !value); + bool value = (flags & A5O_MAXIMIZED) ? true : false; + al_set_display_flag(display, A5O_MAXIMIZED, !value); } } else { /* The child window */ if (event.user.data1 == FILE_CLOSE_ID) { - ALLEGRO_DISPLAY *d = (ALLEGRO_DISPLAY *) event.user.data2; + A5O_DISPLAY *d = (A5O_DISPLAY *) event.user.data2; if (d) { al_set_display_menu(d, NULL); al_destroy_display(d); @@ -267,7 +267,7 @@ int main(int argc, char **argv) } } } - else if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_UP) { + else if (event.type == A5O_EVENT_MOUSE_BUTTON_UP) { /* Popup a context menu on a right click. */ if (event.mouse.display == display && event.mouse.button == 2) { if (pmenu) { @@ -277,7 +277,7 @@ int main(int argc, char **argv) } } } - else if (event.type == ALLEGRO_EVENT_KEY_CHAR) { + else if (event.type == A5O_EVENT_KEY_CHAR) { /* Toggle the menu if the spacebar is pressed */ if (event.keyboard.display == display) { if (event.keyboard.unichar == ' ') { @@ -290,11 +290,11 @@ int main(int argc, char **argv) } } } - else if (event.type == ALLEGRO_EVENT_DISPLAY_RESIZE) { + else if (event.type == A5O_EVENT_DISPLAY_RESIZE) { al_acknowledge_resize(display); redraw = true; } - else if (event.type == ALLEGRO_EVENT_TIMER) { + else if (event.type == A5O_EVENT_TIMER) { redraw = true; } } diff --git a/examples/ex_mixer_chain.c b/examples/ex_mixer_chain.c index 628e23a4c8..cb44fb198a 100644 --- a/examples/ex_mixer_chain.c +++ b/examples/ex_mixer_chain.c @@ -16,11 +16,11 @@ char *default_files[] = {NULL, "data/haiku/water_0.ogg", int main(int argc, char **argv) { - ALLEGRO_VOICE *voice; - ALLEGRO_MIXER *mixer; - ALLEGRO_MIXER *submixer[2]; - ALLEGRO_SAMPLE_INSTANCE *sample[2]; - ALLEGRO_SAMPLE *sample_data[2]; + A5O_VOICE *voice; + A5O_MIXER *mixer; + A5O_MIXER *submixer[2]; + A5O_SAMPLE_INSTANCE *sample[2]; + A5O_SAMPLE *sample_data[2]; float sample_time; float max_sample_time; int i; @@ -43,18 +43,18 @@ int main(int argc, char **argv) abort_example("Could not init sound!\n"); } - voice = al_create_voice(44100, ALLEGRO_AUDIO_DEPTH_INT16, - ALLEGRO_CHANNEL_CONF_2); + voice = al_create_voice(44100, A5O_AUDIO_DEPTH_INT16, + A5O_CHANNEL_CONF_2); if (!voice) { - abort_example("Could not create ALLEGRO_VOICE.\n"); + abort_example("Could not create A5O_VOICE.\n"); } - mixer = al_create_mixer(44100, ALLEGRO_AUDIO_DEPTH_FLOAT32, - ALLEGRO_CHANNEL_CONF_2); - submixer[0] = al_create_mixer(44100, ALLEGRO_AUDIO_DEPTH_FLOAT32, - ALLEGRO_CHANNEL_CONF_2); - submixer[1] = al_create_mixer(44100, ALLEGRO_AUDIO_DEPTH_FLOAT32, - ALLEGRO_CHANNEL_CONF_2); + mixer = al_create_mixer(44100, A5O_AUDIO_DEPTH_FLOAT32, + A5O_CHANNEL_CONF_2); + submixer[0] = al_create_mixer(44100, A5O_AUDIO_DEPTH_FLOAT32, + A5O_CHANNEL_CONF_2); + submixer[1] = al_create_mixer(44100, A5O_AUDIO_DEPTH_FLOAT32, + A5O_CHANNEL_CONF_2); if (!mixer || !submixer[0] || !submixer[1]) { abort_example("al_create_mixer failed.\n"); } @@ -86,7 +86,7 @@ int main(int argc, char **argv) /* Play sample in looping mode. */ for (i = 0; i < 2; i++) { - al_set_sample_instance_playmode(sample[i], ALLEGRO_PLAYMODE_LOOP); + al_set_sample_instance_playmode(sample[i], A5O_PLAYMODE_LOOP); al_play_sample_instance(sample[i]); } diff --git a/examples/ex_mixer_pp.c b/examples/ex_mixer_pp.c index 0d51c633dd..f2b5e5c618 100644 --- a/examples/ex_mixer_pp.c +++ b/examples/ex_mixer_pp.c @@ -18,9 +18,9 @@ static volatile float rms_l = 0.0; static volatile float rms_r = 0.0; -static ALLEGRO_DISPLAY *display; -static ALLEGRO_BITMAP *dbuf; -static ALLEGRO_BITMAP *bmp; +static A5O_DISPLAY *display; +static A5O_BITMAP *dbuf; +static A5O_BITMAP *bmp; static float theta; static void update_meter(void *buf, unsigned int samples, void *data) @@ -69,19 +69,19 @@ static void draw(void) } al_set_target_bitmap(dbuf); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA); al_draw_filled_rectangle(0, 0, al_get_bitmap_width(dbuf), al_get_bitmap_height(dbuf), al_map_rgba_f(0.8, 0.3, 0.1, 0.06)); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_draw_tinted_scaled_rotated_bitmap(bmp, al_map_rgba_f(0.8, 0.3, 0.1, 0.2), sw/2.0, sh/2.0, dx, dy - disp, scale, scale, theta, 0); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_set_target_backbuffer(display); al_draw_bitmap(dbuf, 0, 0, 0); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA); al_draw_line(10, dh - db_l, 10, dh, al_map_rgb_f(1, 0.6, 0.2), 6); al_draw_line(20, dh - db_r, 20, dh, al_map_rgb_f(1, 0.6, 0.2), 6); @@ -92,8 +92,8 @@ static void draw(void) static void main_loop(void) { - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; bool redraw = true; queue = al_create_event_queue(); @@ -113,11 +113,11 @@ static void main_loop(void) continue; } - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } - if (event.type == ALLEGRO_EVENT_KEY_DOWN && - event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_DOWN && + event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } } @@ -128,9 +128,9 @@ static void main_loop(void) int main(int argc, char **argv) { const char *filename = "../demos/cosmic_protector/data/sfx/title_music.ogg"; - ALLEGRO_VOICE *voice; - ALLEGRO_MIXER *mixer; - ALLEGRO_AUDIO_STREAM *stream; + A5O_VOICE *voice; + A5O_MIXER *mixer; + A5O_AUDIO_STREAM *stream; if (argc > 1) { filename = argv[1]; @@ -163,14 +163,14 @@ int main(int argc, char **argv) abort_example("Could not init sound.\n"); } - voice = al_create_voice(44100, ALLEGRO_AUDIO_DEPTH_INT16, - ALLEGRO_CHANNEL_CONF_2); + voice = al_create_voice(44100, A5O_AUDIO_DEPTH_INT16, + A5O_CHANNEL_CONF_2); if (!voice) { abort_example("Could not create voice.\n"); } - mixer = al_create_mixer(44100, ALLEGRO_AUDIO_DEPTH_FLOAT32, - ALLEGRO_CHANNEL_CONF_2); + mixer = al_create_mixer(44100, A5O_AUDIO_DEPTH_FLOAT32, + A5O_CHANNEL_CONF_2); if (!mixer) { abort_example("Could not create mixer.\n"); } @@ -188,7 +188,7 @@ int main(int argc, char **argv) abort_example("Could not load '%s'\n", filename); } - al_set_audio_stream_playmode(stream, ALLEGRO_PLAYMODE_LOOP); + al_set_audio_stream_playmode(stream, A5O_PLAYMODE_LOOP); al_attach_audio_stream_to_mixer(stream, mixer); al_set_mixer_postprocess_callback(mixer, update_meter, NULL); diff --git a/examples/ex_monitorinfo.c b/examples/ex_monitorinfo.c index 5ca1fdb5a2..ebf977c585 100644 --- a/examples/ex_monitorinfo.c +++ b/examples/ex_monitorinfo.c @@ -5,7 +5,7 @@ int main(int argc, char **argv) { - ALLEGRO_MONITOR_INFO info; + A5O_MONITOR_INFO info; int num_adapters; int i, j; @@ -30,7 +30,7 @@ int main(int argc, char **argv) al_set_new_display_adapter(i); log_printf(" Available fullscreen display modes:\n"); for (j = 0; j < al_get_num_display_modes(); j++) { - ALLEGRO_DISPLAY_MODE mode; + A5O_DISPLAY_MODE mode; al_get_display_mode(j, &mode); diff --git a/examples/ex_mouse.c b/examples/ex_mouse.c index f3fcc6cefc..61e4674db3 100644 --- a/examples/ex_mouse.c +++ b/examples/ex_mouse.c @@ -9,8 +9,8 @@ static void draw_mouse_button(int but, bool down) { const int offset[NUM_BUTTONS] = {0, 70, 35}; - ALLEGRO_COLOR grey; - ALLEGRO_COLOR black; + A5O_COLOR grey; + A5O_COLOR black; int x; int y; @@ -29,10 +29,10 @@ static void draw_mouse_button(int but, bool down) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *cursor; - ALLEGRO_MOUSE_STATE msestate; - ALLEGRO_KEYBOARD_STATE kbdstate; + A5O_DISPLAY *display; + A5O_BITMAP *cursor; + A5O_MOUSE_STATE msestate; + A5O_KEYBOARD_STATE kbdstate; int i; (void)argc; @@ -72,7 +72,7 @@ int main(int argc, char **argv) al_flip_display(); al_rest(0.005); - } while (!al_key_down(&kbdstate, ALLEGRO_KEY_ESCAPE)); + } while (!al_key_down(&kbdstate, A5O_KEY_ESCAPE)); return 0; } diff --git a/examples/ex_mouse_cursor.c b/examples/ex_mouse_cursor.c index 016c3d3dc6..265e958fa2 100644 --- a/examples/ex_mouse_cursor.c +++ b/examples/ex_mouse_cursor.c @@ -22,39 +22,39 @@ typedef struct { CursorList cursor_list[NUM_CURSORS] = { - { ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT, "DEFAULT" }, - { ALLEGRO_SYSTEM_MOUSE_CURSOR_ARROW, "ARROW" }, - { ALLEGRO_SYSTEM_MOUSE_CURSOR_BUSY, "BUSY" }, - { ALLEGRO_SYSTEM_MOUSE_CURSOR_QUESTION, "QUESTION" }, - { ALLEGRO_SYSTEM_MOUSE_CURSOR_EDIT, "EDIT" }, - { ALLEGRO_SYSTEM_MOUSE_CURSOR_MOVE, "MOVE" }, - { ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_N, "RESIZE_N" }, - { ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_W, "RESIZE_W" }, - { ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_S, "RESIZE_S" }, - { ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_E, "RESIZE_E" }, - { ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NW, "RESIZE_NW" }, - { ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_SW, "RESIZE_SW" }, - { ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_SE, "RESIZE_SE" }, - { ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NE, "RESIZE_NE" }, - { ALLEGRO_SYSTEM_MOUSE_CURSOR_PROGRESS, "PROGRESS" }, - { ALLEGRO_SYSTEM_MOUSE_CURSOR_PRECISION, "PRECISION" }, - { ALLEGRO_SYSTEM_MOUSE_CURSOR_LINK, "LINK" }, - { ALLEGRO_SYSTEM_MOUSE_CURSOR_ALT_SELECT, "ALT_SELECT" }, - { ALLEGRO_SYSTEM_MOUSE_CURSOR_UNAVAILABLE, "UNAVAILABLE" }, + { A5O_SYSTEM_MOUSE_CURSOR_DEFAULT, "DEFAULT" }, + { A5O_SYSTEM_MOUSE_CURSOR_ARROW, "ARROW" }, + { A5O_SYSTEM_MOUSE_CURSOR_BUSY, "BUSY" }, + { A5O_SYSTEM_MOUSE_CURSOR_QUESTION, "QUESTION" }, + { A5O_SYSTEM_MOUSE_CURSOR_EDIT, "EDIT" }, + { A5O_SYSTEM_MOUSE_CURSOR_MOVE, "MOVE" }, + { A5O_SYSTEM_MOUSE_CURSOR_RESIZE_N, "RESIZE_N" }, + { A5O_SYSTEM_MOUSE_CURSOR_RESIZE_W, "RESIZE_W" }, + { A5O_SYSTEM_MOUSE_CURSOR_RESIZE_S, "RESIZE_S" }, + { A5O_SYSTEM_MOUSE_CURSOR_RESIZE_E, "RESIZE_E" }, + { A5O_SYSTEM_MOUSE_CURSOR_RESIZE_NW, "RESIZE_NW" }, + { A5O_SYSTEM_MOUSE_CURSOR_RESIZE_SW, "RESIZE_SW" }, + { A5O_SYSTEM_MOUSE_CURSOR_RESIZE_SE, "RESIZE_SE" }, + { A5O_SYSTEM_MOUSE_CURSOR_RESIZE_NE, "RESIZE_NE" }, + { A5O_SYSTEM_MOUSE_CURSOR_PROGRESS, "PROGRESS" }, + { A5O_SYSTEM_MOUSE_CURSOR_PRECISION, "PRECISION" }, + { A5O_SYSTEM_MOUSE_CURSOR_LINK, "LINK" }, + { A5O_SYSTEM_MOUSE_CURSOR_ALT_SELECT, "ALT_SELECT" }, + { A5O_SYSTEM_MOUSE_CURSOR_UNAVAILABLE, "UNAVAILABLE" }, { -1, "CUSTOM" } }; int current_cursor[2] = { 0, 0 }; -static void draw_display(ALLEGRO_FONT *font) +static void draw_display(A5O_FONT *font) { int th; int i; al_clear_to_color(al_map_rgb(128, 128, 128)); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); th = al_get_font_line_height(font); for (i = 0; i < NUM_CURSORS; i++) { al_draw_text(font, al_map_rgba_f(0, 0, 0, 1), @@ -69,7 +69,7 @@ static void draw_display(ALLEGRO_FONT *font) al_flip_display(); } -static int hover(ALLEGRO_FONT *font, int y) +static int hover(A5O_FONT *font, int y) { int th; int i; @@ -87,14 +87,14 @@ static int hover(ALLEGRO_FONT *font, int y) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display1; - ALLEGRO_DISPLAY *display2; - ALLEGRO_BITMAP *bmp; - ALLEGRO_BITMAP *shrunk_bmp; - ALLEGRO_MOUSE_CURSOR *custom_cursor; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_FONT *font; - ALLEGRO_EVENT event; + A5O_DISPLAY *display1; + A5O_DISPLAY *display2; + A5O_BITMAP *bmp; + A5O_BITMAP *shrunk_bmp; + A5O_MOUSE_CURSOR *custom_cursor; + A5O_EVENT_QUEUE *queue; + A5O_FONT *font; + A5O_EVENT event; (void)argc; (void)argv; @@ -114,7 +114,7 @@ int main(int argc, char **argv) abort_example("Error installing keyboard\n"); } - al_set_new_display_flags(ALLEGRO_GENERATE_EXPOSE_EVENTS); + al_set_new_display_flags(A5O_GENERATE_EXPOSE_EVENTS); display1 = al_create_display(400, 400); if (!display1) { abort_example("Error creating display1\n"); @@ -175,15 +175,15 @@ int main(int argc, char **argv) while (1) { al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } - if (event.type == ALLEGRO_EVENT_DISPLAY_EXPOSE) { + if (event.type == A5O_EVENT_DISPLAY_EXPOSE) { al_set_target_backbuffer(event.display.source); draw_display(font); continue; } - if (event.type == ALLEGRO_EVENT_KEY_CHAR) { + if (event.type == A5O_EVENT_KEY_CHAR) { switch (event.keyboard.unichar) { case 27: /* escape */ goto Quit; @@ -197,7 +197,7 @@ int main(int argc, char **argv) break; } } - if (event.type == ALLEGRO_EVENT_MOUSE_AXES) { + if (event.type == A5O_EVENT_MOUSE_AXES) { int dpy = (event.mouse.display == display1) ? 0 : 1; int i = hover(font, event.mouse.y); diff --git a/examples/ex_mouse_events.c b/examples/ex_mouse_events.c index 7111262246..853f89a7a4 100644 --- a/examples/ex_mouse_events.c +++ b/examples/ex_mouse_events.c @@ -11,8 +11,8 @@ static int actual_buttons; static void draw_mouse_button(int but, bool down) { const int offset[NUM_BUTTONS] = {0, 70, 35, 105, 140}; - ALLEGRO_COLOR grey; - ALLEGRO_COLOR black; + A5O_COLOR grey; + A5O_COLOR black; int x; int y; @@ -31,11 +31,11 @@ static void draw_mouse_button(int but, bool down) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *cursor; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; - ALLEGRO_FONT *font; + A5O_DISPLAY *display; + A5O_BITMAP *cursor; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; + A5O_FONT *font; int mx = 0; int my = 0; int mz = 0; @@ -49,7 +49,7 @@ int main(int argc, char **argv) bool buttons[NUM_BUTTONS] = {false}; int i; float p = 0.0; - ALLEGRO_COLOR black; + A5O_COLOR black; (void)argc; (void)argv; @@ -69,7 +69,7 @@ int main(int argc, char **argv) if (actual_buttons > NUM_BUTTONS) actual_buttons = NUM_BUTTONS; - al_set_new_display_flags(ALLEGRO_RESIZABLE); + al_set_new_display_flags(A5O_RESIZABLE); display = al_create_display(640, 480); if (!display) { abort_example("Error creating display\n"); @@ -106,20 +106,20 @@ int main(int argc, char **argv) draw_mouse_button(i, buttons[i]); } al_draw_bitmap(cursor, mx, my, 0); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_draw_textf(font, black, 5, 5, 0, "dx %i, dy %i, dz %i, dw %i", mmx, mmy, mmz, mmw); al_draw_textf(font, black, 5, 25, 0, "x %i, y %i, z %i, w %i", mx, my, mz, mw); al_draw_textf(font, black, 5, 45, 0, "p = %g", p); al_draw_textf(font, black, 5, 65, 0, "%s", in ? "in" : "out"); al_draw_textf(font, black, 5, 85, 0, "wheel precision (PgUp/PgDn) %d", precision); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); mmx = mmy = mmz = 0; al_flip_display(); } al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_MOUSE_AXES: + case A5O_EVENT_MOUSE_AXES: mx = event.mouse.x; my = event.mouse.y; mz = event.mouse.z; @@ -131,40 +131,40 @@ int main(int argc, char **argv) p = event.mouse.pressure; break; - case ALLEGRO_EVENT_MOUSE_BUTTON_DOWN: + case A5O_EVENT_MOUSE_BUTTON_DOWN: if (event.mouse.button-1 < NUM_BUTTONS) { buttons[event.mouse.button-1] = true; } p = event.mouse.pressure; break; - case ALLEGRO_EVENT_MOUSE_BUTTON_UP: + case A5O_EVENT_MOUSE_BUTTON_UP: if (event.mouse.button-1 < NUM_BUTTONS) { buttons[event.mouse.button-1] = false; } p = event.mouse.pressure; break; - case ALLEGRO_EVENT_MOUSE_ENTER_DISPLAY: + case A5O_EVENT_MOUSE_ENTER_DISPLAY: in = true; break; - case ALLEGRO_EVENT_MOUSE_LEAVE_DISPLAY: + case A5O_EVENT_MOUSE_LEAVE_DISPLAY: in = false; break; - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) { goto done; } break; - case ALLEGRO_EVENT_KEY_CHAR: - if (event.keyboard.keycode == ALLEGRO_KEY_PGUP) { + case A5O_EVENT_KEY_CHAR: + if (event.keyboard.keycode == A5O_KEY_PGUP) { precision++; al_set_mouse_wheel_precision(precision); } - else if (event.keyboard.keycode == ALLEGRO_KEY_PGDN) { + else if (event.keyboard.keycode == A5O_KEY_PGDN) { precision--; if (precision < 1) precision = 1; @@ -172,11 +172,11 @@ int main(int argc, char **argv) } break; - case ALLEGRO_EVENT_DISPLAY_RESIZE: + case A5O_EVENT_DISPLAY_RESIZE: al_acknowledge_resize(event.display.source); break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: goto done; } } diff --git a/examples/ex_mouse_focus.c b/examples/ex_mouse_focus.c index db89634de0..f145f146c0 100644 --- a/examples/ex_mouse_focus.c +++ b/examples/ex_mouse_focus.c @@ -1,7 +1,7 @@ /* * Example program for the Allegro library. * - * This program tests if the ALLEGRO_MOUSE_STATE `display' field + * This program tests if the A5O_MOUSE_STATE `display' field * is set correctly. */ @@ -10,10 +10,10 @@ #include "common.c" -static ALLEGRO_DISPLAY *display1; -static ALLEGRO_DISPLAY *display2; +static A5O_DISPLAY *display1; +static A5O_DISPLAY *display2; -static void redraw(ALLEGRO_COLOR color1, ALLEGRO_COLOR color2) +static void redraw(A5O_COLOR color1, A5O_COLOR color2) { al_set_target_backbuffer(display1); al_clear_to_color(color1); @@ -26,11 +26,11 @@ static void redraw(ALLEGRO_COLOR color1, ALLEGRO_COLOR color2) int main(int argc, char **argv) { - ALLEGRO_COLOR black; - ALLEGRO_COLOR red; - ALLEGRO_MOUSE_STATE mst0; - ALLEGRO_MOUSE_STATE mst; - ALLEGRO_KEYBOARD_STATE kst; + A5O_COLOR black; + A5O_COLOR red; + A5O_MOUSE_STATE mst0; + A5O_MOUSE_STATE mst; + A5O_KEYBOARD_STATE kst; (void)argc; (void)argv; @@ -92,7 +92,7 @@ int main(int argc, char **argv) al_rest(0.1); al_get_keyboard_state(&kst); - if (al_key_down(&kst, ALLEGRO_KEY_ESCAPE)) { + if (al_key_down(&kst, A5O_KEY_ESCAPE)) { break; } } diff --git a/examples/ex_mouse_warp.c b/examples/ex_mouse_warp.c index dfc015938b..a24bb5a9b6 100644 --- a/examples/ex_mouse_warp.c +++ b/examples/ex_mouse_warp.c @@ -10,14 +10,14 @@ int height = 480; int main(int argc, char **argv) { - ALLEGRO_FONT *font; - ALLEGRO_DISPLAY *display; - ALLEGRO_EVENT_QUEUE *event_queue; - ALLEGRO_EVENT event; + A5O_FONT *font; + A5O_DISPLAY *display; + A5O_EVENT_QUEUE *event_queue; + A5O_EVENT event; bool right_button_down = false; bool redraw = true; int fake_x = 0, fake_y = 0; - ALLEGRO_COLOR white; + A5O_COLOR white; (void)argc; (void)argv; @@ -33,7 +33,7 @@ int main(int argc, char **argv) al_install_mouse(); al_install_keyboard(); - al_set_new_display_flags(ALLEGRO_WINDOWED); + al_set_new_display_flags(A5O_WINDOWED); display = al_create_display(width, height); if (!display) { abort_example("Could not create display.\n"); @@ -67,9 +67,9 @@ int main(int argc, char **argv) al_draw_textf(font, white, 0, 0, 0, "x: %i y: %i dx: %i dy %i", event.mouse.x, event.mouse.y, event.mouse.dx, event.mouse.dy); - al_draw_textf(font, white, width / 2, height / 2 - th, ALLEGRO_ALIGN_CENTRE, + al_draw_textf(font, white, width / 2, height / 2 - th, A5O_ALIGN_CENTRE, "Left-Click to warp pointer to the middle once."); - al_draw_textf(font, white, width / 2, height / 2, ALLEGRO_ALIGN_CENTRE, + al_draw_textf(font, white, width / 2, height / 2, A5O_ALIGN_CENTRE, "Hold right mouse button to constantly move pointer to the middle."); al_flip_display(); redraw = false; @@ -77,17 +77,17 @@ int main(int argc, char **argv) al_wait_for_event(event_queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } - if (event.type == ALLEGRO_EVENT_KEY_DOWN) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + if (event.type == A5O_EVENT_KEY_DOWN) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) break; } - if (event.type == ALLEGRO_EVENT_MOUSE_WARPED) { + if (event.type == A5O_EVENT_MOUSE_WARPED) { log_printf("Warp\n"); } - if (event.type == ALLEGRO_EVENT_MOUSE_AXES) { + if (event.type == A5O_EVENT_MOUSE_AXES) { if (right_button_down) { al_set_mouse_xy(display, width / 2, height / 2); fake_x += event.mouse.dx; @@ -95,7 +95,7 @@ int main(int argc, char **argv) } redraw = true; } - if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN) { + if (event.type == A5O_EVENT_MOUSE_BUTTON_DOWN) { if (event.mouse.button == 1) al_set_mouse_xy(display, width / 2, height / 2); if (event.mouse.button == 2) { @@ -104,7 +104,7 @@ int main(int argc, char **argv) fake_y = height / 2; } } - if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_UP) { + if (event.type == A5O_EVENT_MOUSE_BUTTON_UP) { if (event.mouse.button == 2) { right_button_down = false; } diff --git a/examples/ex_multisample.c b/examples/ex_multisample.c index e073d175f6..e55255fc0a 100644 --- a/examples/ex_multisample.c +++ b/examples/ex_multisample.c @@ -35,26 +35,26 @@ #include "common.c" -static ALLEGRO_FONT *font, *font_ms; -static ALLEGRO_BITMAP *bitmap_normal; -static ALLEGRO_BITMAP *bitmap_filter; -static ALLEGRO_BITMAP *bitmap_normal_ms; -static ALLEGRO_BITMAP *bitmap_filter_ms; +static A5O_FONT *font, *font_ms; +static A5O_BITMAP *bitmap_normal; +static A5O_BITMAP *bitmap_filter; +static A5O_BITMAP *bitmap_normal_ms; +static A5O_BITMAP *bitmap_filter_ms; static float bitmap_x[8], bitmap_y[8]; static float bitmap_t; -static ALLEGRO_BITMAP *create_bitmap(void) +static A5O_BITMAP *create_bitmap(void) { const int checkers_size = 8; const int bitmap_size = 24; - ALLEGRO_BITMAP *bitmap; - ALLEGRO_LOCKED_REGION *locked; + A5O_BITMAP *bitmap; + A5O_LOCKED_REGION *locked; int x, y, p; unsigned char *rgba; bitmap = al_create_bitmap(bitmap_size, bitmap_size); - locked = al_lock_bitmap(bitmap, ALLEGRO_PIXEL_FORMAT_ABGR_8888, 0); + locked = al_lock_bitmap(bitmap, A5O_PIXEL_FORMAT_ABGR_8888, 0); rgba = locked->data; p = locked->pitch; for (y = 0; y < bitmap_size; y++) { @@ -76,29 +76,29 @@ static void bitmap_move(void) bitmap_t++; for (i = 0; i < 8; i++) { - float a = 2 * ALLEGRO_PI * i / 16; - float s = sin((bitmap_t + i * 40) / 180 * ALLEGRO_PI); + float a = 2 * A5O_PI * i / 16; + float s = sin((bitmap_t + i * 40) / 180 * A5O_PI); s *= 90; bitmap_x[i] = 100 + s * cos(a); bitmap_y[i] = 100 + s * sin(a); } } -static void draw(ALLEGRO_BITMAP *bitmap, int y, char const *text) +static void draw(A5O_BITMAP *bitmap, int y, char const *text) { int i; al_draw_text(font_ms, al_map_rgb(0, 0, 0), 0, y, 0, text); for (i = 0; i < 16; i++) { - float a = 2 * ALLEGRO_PI * i / 16; - ALLEGRO_COLOR c = al_color_hsv(i * 360 / 16, 1, 1); + float a = 2 * A5O_PI * i / 16; + A5O_COLOR c = al_color_hsv(i * 360 / 16, 1, 1); al_draw_line(150 + cos(a) * 10, y + 100 + sin(a) * 10, 150 + cos(a) * 90, y + 100 + sin(a) * 90, c, 3); } for (i = 0; i < 8; i++) { - float a = 2 * ALLEGRO_PI * i / 16; + float a = 2 * A5O_PI * i / 16; int s = al_get_bitmap_width(bitmap); al_draw_rotated_bitmap(bitmap, s / 2, s / 2, 50 + bitmap_x[i], y + bitmap_y[i], a, 0); @@ -107,10 +107,10 @@ static void draw(ALLEGRO_BITMAP *bitmap, int y, char const *text) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display, *ms_display; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_TIMER *timer; - ALLEGRO_BITMAP *memory; + A5O_DISPLAY *display, *ms_display; + A5O_EVENT_QUEUE *queue; + A5O_TIMER *timer; + A5O_BITMAP *memory; char title[1024]; bool quit = false; bool redraw = true; @@ -126,12 +126,12 @@ int main(int argc, char **argv) al_install_keyboard(); - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); memory = create_bitmap(); /* Create the normal display. */ - al_set_new_display_option(ALLEGRO_SAMPLE_BUFFERS, 0, ALLEGRO_REQUIRE); - al_set_new_display_option(ALLEGRO_SAMPLES, 0, ALLEGRO_SUGGEST); + al_set_new_display_option(A5O_SAMPLE_BUFFERS, 0, A5O_REQUIRE); + al_set_new_display_option(A5O_SAMPLES, 0, A5O_SUGGEST); display = al_create_display(300, 450); if (!display) { abort_example("Error creating display\n"); @@ -139,7 +139,7 @@ int main(int argc, char **argv) al_set_window_title(display, "Normal"); /* Create bitmaps for the normal display. */ - al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR); + al_set_new_bitmap_flags(A5O_MIN_LINEAR | A5O_MAG_LINEAR); bitmap_filter = al_clone_bitmap(memory); al_set_new_bitmap_flags(0); bitmap_normal = al_clone_bitmap(memory); @@ -151,18 +151,18 @@ int main(int argc, char **argv) wx = 160; /* Create the multi-sampling display. */ - al_set_new_display_option(ALLEGRO_SAMPLE_BUFFERS, 1, ALLEGRO_REQUIRE); - al_set_new_display_option(ALLEGRO_SAMPLES, 4, ALLEGRO_SUGGEST); + al_set_new_display_option(A5O_SAMPLE_BUFFERS, 1, A5O_REQUIRE); + al_set_new_display_option(A5O_SAMPLES, 4, A5O_SUGGEST); ms_display = al_create_display(300, 450); if (!ms_display) { abort_example("Multisampling not available.\n"); } sprintf(title, "Multisampling (%dx)", al_get_display_option( - ms_display, ALLEGRO_SAMPLES)); + ms_display, A5O_SAMPLES)); al_set_window_title(ms_display, title); /* Create bitmaps for the multi-sampling display. */ - al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR); + al_set_new_bitmap_flags(A5O_MIN_LINEAR | A5O_MAG_LINEAR); bitmap_filter_ms = al_clone_bitmap(memory); al_set_new_bitmap_flags(0); bitmap_normal_ms = al_clone_bitmap(memory); @@ -185,21 +185,21 @@ int main(int argc, char **argv) al_start_timer(timer); while (!quit) { - ALLEGRO_EVENT event; + A5O_EVENT event; /* Check for ESC key or close button event and quit in either case. */ al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: quit = true; break; - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) quit = true; break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: bitmap_move(); redraw = true; break; diff --git a/examples/ex_multisample_target.c b/examples/ex_multisample_target.c index 4b416ed34e..9e38409d91 100644 --- a/examples/ex_multisample_target.c +++ b/examples/ex_multisample_target.c @@ -1,4 +1,4 @@ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include #include @@ -12,29 +12,29 @@ #define FPS 60 static struct Example { - ALLEGRO_BITMAP *targets[4]; - ALLEGRO_BITMAP *bitmap_normal; - ALLEGRO_BITMAP *bitmap_filter; - ALLEGRO_BITMAP *sub; - ALLEGRO_FONT *font; + A5O_BITMAP *targets[4]; + A5O_BITMAP *bitmap_normal; + A5O_BITMAP *bitmap_filter; + A5O_BITMAP *sub; + A5O_FONT *font; float bitmap_x[8], bitmap_y[8]; float bitmap_t; int step_t, step_x, step_y; - ALLEGRO_BITMAP *step[4]; + A5O_BITMAP *step[4]; bool update_step; } example; -static ALLEGRO_BITMAP *create_bitmap(void) +static A5O_BITMAP *create_bitmap(void) { const int checkers_size = 8; const int bitmap_size = 24; - ALLEGRO_BITMAP *bitmap; - ALLEGRO_LOCKED_REGION *locked; + A5O_BITMAP *bitmap; + A5O_LOCKED_REGION *locked; int x, y, p; unsigned char *rgba; bitmap = al_create_bitmap(bitmap_size, bitmap_size); - locked = al_lock_bitmap(bitmap, ALLEGRO_PIXEL_FORMAT_ABGR_8888, 0); + locked = al_lock_bitmap(bitmap, A5O_PIXEL_FORMAT_ABGR_8888, 0); rgba = locked->data; p = locked->pitch; for (y = 0; y < bitmap_size; y++) { @@ -52,8 +52,8 @@ static ALLEGRO_BITMAP *create_bitmap(void) static void init(void) { - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); - ALLEGRO_BITMAP *memory = create_bitmap(); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); + A5O_BITMAP *memory = create_bitmap(); al_set_new_bitmap_flags(0); al_set_new_bitmap_samples(0); @@ -64,7 +64,7 @@ static void init(void) example.targets[3] = al_create_bitmap(300, 200); al_set_new_bitmap_samples(0); - al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR); + al_set_new_bitmap_flags(A5O_MIN_LINEAR | A5O_MAG_LINEAR); example.bitmap_filter = al_clone_bitmap(memory); al_set_new_bitmap_flags(0); example.bitmap_normal = al_clone_bitmap(memory); @@ -82,15 +82,15 @@ static void bitmap_move(void) example.bitmap_t++; for (i = 0; i < 8; i++) { - float a = 2 * ALLEGRO_PI * i / 16; - float s = sin((example.bitmap_t + i * 40) / 180 * ALLEGRO_PI); + float a = 2 * A5O_PI * i / 16; + float s = sin((example.bitmap_t + i * 40) / 180 * A5O_PI); s *= 90; example.bitmap_x[i] = 100 + s * cos(a); example.bitmap_y[i] = 100 + s * sin(a); } } -static void draw(char const *text, ALLEGRO_BITMAP *bitmap) +static void draw(char const *text, A5O_BITMAP *bitmap) { int i; @@ -99,14 +99,14 @@ static void draw(char const *text, ALLEGRO_BITMAP *bitmap) al_draw_text(example.font, al_map_rgb(0, 0, 0), 0, 0, 0, text); for (i = 0; i < 16; i++) { - float a = 2 * ALLEGRO_PI * i / 16; - ALLEGRO_COLOR c = al_color_hsv(i * 360 / 16, 1, 1); + float a = 2 * A5O_PI * i / 16; + A5O_COLOR c = al_color_hsv(i * 360 / 16, 1, 1); al_draw_line(100 + cos(a) * 10, 100 + sin(a) * 10, 100 + cos(a) * 90, 100 + sin(a) * 90, c, 3); } for (i = 0; i < 8; i++) { - float a = 2 * ALLEGRO_PI * i / 16; + float a = 2 * A5O_PI * i / 16; int s = al_get_bitmap_width(bitmap); al_draw_rotated_bitmap(bitmap, s / 2, s / 2, example.bitmap_x[i], example.bitmap_y[i], a, 0); @@ -165,9 +165,9 @@ static void update(void) int main(int argc, char **argv) { - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_DISPLAY *display; int w = 20 + 300 + 20 + 300 + 20, h = 20 + 200 + 20 + 200 + 20; bool done = false; bool need_redraw = true; @@ -213,7 +213,7 @@ int main(int argc, char **argv) al_start_timer(timer); while (!done) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (need_redraw) { redraw(); @@ -224,16 +224,16 @@ int main(int argc, char **argv) while (true) { al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_KEY_CHAR: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_CHAR: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) done = true; break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: done = true; break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: update(); need_redraw = true; break; diff --git a/examples/ex_multiwin.c b/examples/ex_multiwin.c index 0d8648af35..cf0bd1e1d1 100644 --- a/examples/ex_multiwin.c +++ b/examples/ex_multiwin.c @@ -9,11 +9,11 @@ const int H = 400; int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display[2]; - ALLEGRO_EVENT event; - ALLEGRO_EVENT_QUEUE *events; - ALLEGRO_BITMAP *pictures[2]; - ALLEGRO_BITMAP *target; + A5O_DISPLAY *display[2]; + A5O_EVENT event; + A5O_EVENT_QUEUE *events; + A5O_BITMAP *pictures[2]; + A5O_BITMAP *target; int width, height; int i; @@ -32,7 +32,7 @@ int main(int argc, char **argv) events = al_create_event_queue(); - al_set_new_display_flags(ALLEGRO_WINDOWED|ALLEGRO_RESIZABLE); + al_set_new_display_flags(A5O_WINDOWED|A5O_RESIZABLE); /* Create two windows. */ display[0] = al_create_display(W, H); @@ -62,23 +62,23 @@ int main(int argc, char **argv) /* read input */ while (!al_is_event_queue_empty(events)) { al_get_next_event(events, &event); - if (event.type == ALLEGRO_EVENT_KEY_DOWN) { - ALLEGRO_KEYBOARD_EVENT *key = &event.keyboard; - if (key->keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_DOWN) { + A5O_KEYBOARD_EVENT *key = &event.keyboard; + if (key->keycode == A5O_KEY_ESCAPE) { goto done; } } - if (event.type == ALLEGRO_EVENT_DISPLAY_RESIZE) { - ALLEGRO_DISPLAY_EVENT *de = &event.display; + if (event.type == A5O_EVENT_DISPLAY_RESIZE) { + A5O_DISPLAY_EVENT *de = &event.display; al_acknowledge_resize(de->source); } - if (event.type == ALLEGRO_EVENT_DISPLAY_SWITCH_IN) { + if (event.type == A5O_EVENT_DISPLAY_SWITCH_IN) { log_printf("%p switching in\n", event.display.source); } - if (event.type == ALLEGRO_EVENT_DISPLAY_SWITCH_OUT) { + if (event.type == A5O_EVENT_DISPLAY_SWITCH_OUT) { log_printf("%p switching out\n", event.display.source); } - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + if (event.type == A5O_EVENT_DISPLAY_CLOSE) { int i; for (i = 0; i < 2; i++) { if (display[i] == event.display.source) diff --git a/examples/ex_native_filechooser.c b/examples/ex_native_filechooser.c index a59d58c272..77796cf480 100644 --- a/examples/ex_native_filechooser.c +++ b/examples/ex_native_filechooser.c @@ -6,7 +6,7 @@ * source to communicate back to the main program. */ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include #include @@ -14,26 +14,26 @@ #include #include -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID #include #endif #include "common.c" /* To communicate from a separate thread, we need a user event. */ -#define ASYNC_DIALOG_EVENT1 ALLEGRO_GET_EVENT_TYPE('e', 'N', 'F', '1') -#define ASYNC_DIALOG_EVENT2 ALLEGRO_GET_EVENT_TYPE('e', 'N', 'F', '2') +#define ASYNC_DIALOG_EVENT1 A5O_GET_EVENT_TYPE('e', 'N', 'F', '1') +#define ASYNC_DIALOG_EVENT2 A5O_GET_EVENT_TYPE('e', 'N', 'F', '2') typedef struct { - ALLEGRO_DISPLAY *display; - ALLEGRO_FILECHOOSER *file_dialog; - ALLEGRO_EVENT_SOURCE event_source; - ALLEGRO_THREAD *thread; + A5O_DISPLAY *display; + A5O_FILECHOOSER *file_dialog; + A5O_EVENT_SOURCE event_source; + A5O_THREAD *thread; } AsyncDialog; -ALLEGRO_TEXTLOG *textlog; +A5O_TEXTLOG *textlog; static void message(char const *format, ...) { @@ -47,10 +47,10 @@ static void message(char const *format, ...) } /* Our thread to show the native file dialog. */ -static void *async_file_dialog_thread_func(ALLEGRO_THREAD *thread, void *arg) +static void *async_file_dialog_thread_func(A5O_THREAD *thread, void *arg) { AsyncDialog *data = arg; - ALLEGRO_EVENT event; + A5O_EVENT event; (void)thread; /* The next line is the heart of this example - we display the @@ -69,10 +69,10 @@ static void *async_file_dialog_thread_func(ALLEGRO_THREAD *thread, void *arg) /* A thread to show the message boxes. */ -static void *message_box_thread(ALLEGRO_THREAD *thread, void *arg) +static void *message_box_thread(A5O_THREAD *thread, void *arg) { AsyncDialog *data = arg; - ALLEGRO_EVENT event; + A5O_EVENT event; int button; (void)thread; @@ -80,11 +80,11 @@ static void *message_box_thread(ALLEGRO_THREAD *thread, void *arg) button = al_show_native_message_box(data->display, "Warning", "Click Detected", "That does nothing. Stop clicking there.", - "Oh no!|Don't press|Ok", ALLEGRO_MESSAGEBOX_WARN); + "Oh no!|Don't press|Ok", A5O_MESSAGEBOX_WARN); if (button == 2) { button = al_show_native_message_box(data->display, "Error", "Hey!", "Stop it! I told you not to click there.", - NULL, ALLEGRO_MESSAGEBOX_ERROR); + NULL, A5O_MESSAGEBOX_ERROR); } event.user.type = ASYNC_DIALOG_EVENT2; @@ -95,12 +95,12 @@ static void *message_box_thread(ALLEGRO_THREAD *thread, void *arg) /* Function to start the new thread. */ -static AsyncDialog *spawn_async_file_dialog(ALLEGRO_DISPLAY *display, +static AsyncDialog *spawn_async_file_dialog(A5O_DISPLAY *display, const char *initial_path, bool save) { AsyncDialog *data = malloc(sizeof *data); - int flags = save ? ALLEGRO_FILECHOOSER_SAVE : ALLEGRO_FILECHOOSER_MULTIPLE; + int flags = save ? A5O_FILECHOOSER_SAVE : A5O_FILECHOOSER_MULTIPLE; const char* title = save ? "Save (no files will be changed)" : "Choose files"; data->file_dialog = al_create_native_file_dialog( initial_path, title, NULL, @@ -114,7 +114,7 @@ static AsyncDialog *spawn_async_file_dialog(ALLEGRO_DISPLAY *display, return data; } -static AsyncDialog *spawn_async_message_dialog(ALLEGRO_DISPLAY *display) +static AsyncDialog *spawn_async_message_dialog(A5O_DISPLAY *display) { AsyncDialog *data = calloc(1, sizeof *data); @@ -141,10 +141,10 @@ static void stop_async_dialog(AsyncDialog *data) /* Helper function to display the result from a file dialog. */ -static void show_files_list(ALLEGRO_FILECHOOSER *dialog, - const ALLEGRO_FONT *font, ALLEGRO_COLOR info) +static void show_files_list(A5O_FILECHOOSER *dialog, + const A5O_FONT *font, A5O_COLOR info) { - ALLEGRO_BITMAP *target = al_get_target_bitmap(); + A5O_BITMAP *target = al_get_target_bitmap(); int count = al_get_native_file_dialog_count(dialog); int th = al_get_font_line_height(font); float x = al_get_bitmap_width(target) / 2; @@ -153,19 +153,19 @@ static void show_files_list(ALLEGRO_FILECHOOSER *dialog, for (i = 0; i < count; i++) { const char *name = al_get_native_file_dialog_path(dialog, i); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); - al_draw_textf(font, info, x, y + i * th, ALLEGRO_ALIGN_CENTRE, name, 0, 0); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); + al_draw_textf(font, info, x, y + i * th, A5O_ALIGN_CENTRE, name, 0, 0); } } int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_FONT *font; - ALLEGRO_COLOR background, active, inactive, info; + A5O_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_FONT *font; + A5O_COLOR background, active, inactive, info; AsyncDialog *old_dialog = NULL; AsyncDialog *cur_dialog = NULL; AsyncDialog *message_box = NULL; @@ -202,13 +202,13 @@ int main(int argc, char **argv) al_install_keyboard(); if (touch) { - al_set_mouse_emulation_mode(ALLEGRO_MOUSE_EMULATION_5_0_x); + al_set_mouse_emulation_mode(A5O_MOUSE_EMULATION_5_0_x); } message("Creating window..."); -#ifdef ALLEGRO_IPHONE - al_set_new_display_flags(ALLEGRO_FULLSCREEN_WINDOW); +#ifdef A5O_IPHONE + al_set_new_display_flags(A5O_FULLSCREEN_WINDOW); #endif display = al_create_display(640, 480); @@ -218,7 +218,7 @@ int main(int argc, char **argv) } message("success.\n"); -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID al_android_set_apk_file_interface(); #endif @@ -251,16 +251,16 @@ int main(int argc, char **argv) while (1) { float h = al_get_display_height(display); - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE && !cur_dialog) + if (event.type == A5O_EVENT_DISPLAY_CLOSE && !cur_dialog) break; - if (event.type == ALLEGRO_EVENT_KEY_DOWN) { + if (event.type == A5O_EVENT_KEY_DOWN) { if (!cur_dialog) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE || - event.keyboard.keycode == ALLEGRO_KEY_BACK) + if (event.keyboard.keycode == A5O_KEY_ESCAPE || + event.keyboard.keycode == A5O_KEY_BACK) break; } } @@ -268,7 +268,7 @@ int main(int argc, char **argv) /* When a mouse button is pressed, and no native dialog is * shown already, we show a new one. */ - if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN) { + if (event.type == A5O_EVENT_MOUSE_BUTTON_DOWN) { message("Mouse clicked at %d,%d.\n", event.mouse.x, event.mouse.y); if (event.mouse.y > 30) { if (event.mouse.y > h - 30) { @@ -328,30 +328,30 @@ int main(int argc, char **argv) message_box = NULL; } - if (event.type == ALLEGRO_EVENT_NATIVE_DIALOG_CLOSE) { + if (event.type == A5O_EVENT_NATIVE_DIALOG_CLOSE) { close_log = true; } - if (event.type == ALLEGRO_EVENT_TIMER) { + if (event.type == A5O_EVENT_TIMER) { redraw = true; } -#ifdef ALLEGRO_ANDROID - if (event.type == ALLEGRO_EVENT_DISPLAY_HALT_DRAWING) { +#ifdef A5O_ANDROID + if (event.type == A5O_EVENT_DISPLAY_HALT_DRAWING) { message("Drawing halt"); halt_drawing = true; al_stop_timer(timer); al_acknowledge_drawing_halt(display); } - if (event.type == ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING) { + if (event.type == A5O_EVENT_DISPLAY_RESUME_DRAWING) { message("Drawing resume"); al_acknowledge_drawing_resume(display); al_resume_timer(timer); halt_drawing = false; } - if (event.type == ALLEGRO_EVENT_DISPLAY_RESIZE) { + if (event.type == A5O_EVENT_DISPLAY_RESIZE) { message("Display resize"); al_acknowledge_resize(display); } @@ -362,11 +362,11 @@ int main(int argc, char **argv) float y = 0; redraw = false; al_clear_to_color(background); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); - al_draw_textf(font, cur_dialog ? inactive : active, x/2, y, ALLEGRO_ALIGN_CENTRE, "Open"); - al_draw_textf(font, cur_dialog ? inactive : active, x/2*3, y, ALLEGRO_ALIGN_CENTRE, "Save"); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); + al_draw_textf(font, cur_dialog ? inactive : active, x/2, y, A5O_ALIGN_CENTRE, "Open"); + al_draw_textf(font, cur_dialog ? inactive : active, x/2*3, y, A5O_ALIGN_CENTRE, "Save"); al_draw_textf(font, cur_dialog ? inactive : active, x, h - 30, - ALLEGRO_ALIGN_CENTRE, message_log ? "Close Message Log" : "Open Message Log"); + A5O_ALIGN_CENTRE, message_log ? "Close Message Log" : "Open Message Log"); if (old_dialog) show_files_list(old_dialog->file_dialog, font, info); al_flip_display(); @@ -393,7 +393,7 @@ int main(int argc, char **argv) " This is your last chance to rethink your decision." " Do you really want to quit?", NULL, - ALLEGRO_MESSAGEBOX_YES_NO | ALLEGRO_MESSAGEBOX_QUESTION); + A5O_MESSAGEBOX_YES_NO | A5O_MESSAGEBOX_QUESTION); if (button != 1) goto restart; diff --git a/examples/ex_nodisplay.c b/examples/ex_nodisplay.c index a711da1034..63ef752bdb 100644 --- a/examples/ex_nodisplay.c +++ b/examples/ex_nodisplay.c @@ -8,9 +8,9 @@ int main(int argc, char **argv) { - ALLEGRO_BITMAP *bmp; - ALLEGRO_BITMAP *sprite; - ALLEGRO_COLOR c1, c2, c3; + A5O_BITMAP *bmp; + A5O_BITMAP *sprite; + A5O_COLOR c1, c2, c3; bool rc; (void)argc; @@ -40,17 +40,17 @@ int main(int argc, char **argv) al_clear_to_color(al_map_rgba(255, 0, 0, 128)); al_draw_bitmap(sprite, 0, 0, 0); - al_draw_tinted_bitmap(sprite, c1, 64, 0, ALLEGRO_FLIP_HORIZONTAL); - al_draw_tinted_bitmap(sprite, c2, 0, 64, ALLEGRO_FLIP_VERTICAL); - al_draw_tinted_bitmap(sprite, c3, 64, 64, ALLEGRO_FLIP_HORIZONTAL | - ALLEGRO_FLIP_VERTICAL); + al_draw_tinted_bitmap(sprite, c1, 64, 0, A5O_FLIP_HORIZONTAL); + al_draw_tinted_bitmap(sprite, c2, 0, 64, A5O_FLIP_VERTICAL); + al_draw_tinted_bitmap(sprite, c3, 64, 64, A5O_FLIP_HORIZONTAL | + A5O_FLIP_VERTICAL); al_set_target_bitmap(NULL); rc = al_save_bitmap("ex_nodisplay_out.tga", bmp); if (rc) { -#ifdef ALLEGRO_POPUP_EXAMPLES +#ifdef A5O_POPUP_EXAMPLES al_show_native_message_box(NULL, "ex_nodisplay_out", "", "Saved ex_nodisplay_out.tga", NULL, 0); #else diff --git a/examples/ex_noframe.c b/examples/ex_noframe.c index ad178e81f0..2de29c57e1 100644 --- a/examples/ex_noframe.c +++ b/examples/ex_noframe.c @@ -7,13 +7,13 @@ int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *bitmap; - ALLEGRO_EVENT_QUEUE *events; - ALLEGRO_EVENT event; + A5O_DISPLAY *display; + A5O_BITMAP *bitmap; + A5O_EVENT_QUEUE *events; + A5O_EVENT event; bool down = false; int down_x = 0, down_y = 0; - ALLEGRO_TIMER *timer; + A5O_TIMER *timer; (void)argc; (void)argv; @@ -27,7 +27,7 @@ int main(int argc, char **argv) al_init_image_addon(); init_platform_specific(); - al_set_new_display_flags(ALLEGRO_FRAMELESS); + al_set_new_display_flags(A5O_FRAMELESS); display = al_create_display(300, 200); if (!display) { abort_example("Error creating display\n"); @@ -50,26 +50,26 @@ int main(int argc, char **argv) for (;;) { al_wait_for_event(events, &event); - if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN) { + if (event.type == A5O_EVENT_MOUSE_BUTTON_DOWN) { if (event.mouse.button == 1 && event.mouse.x) { down = true; down_x = event.mouse.x; down_y = event.mouse.y; } if (event.mouse.button == 2) { - al_set_display_flag(display, ALLEGRO_FRAMELESS, - !(al_get_display_flags(display) & ALLEGRO_FRAMELESS)); + al_set_display_flag(display, A5O_FRAMELESS, + !(al_get_display_flags(display) & A5O_FRAMELESS)); } } - else if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + else if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } - else if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_UP) { + else if (event.type == A5O_EVENT_MOUSE_BUTTON_UP) { if (event.mouse.button == 1) { down = false; } } - else if (event.type == ALLEGRO_EVENT_MOUSE_AXES) { + else if (event.type == A5O_EVENT_MOUSE_AXES) { if (down) { int cx, cy; if (al_get_mouse_cursor_position(&cx, &cy)) { @@ -77,11 +77,11 @@ int main(int argc, char **argv) } } } - else if (event.type == ALLEGRO_EVENT_KEY_DOWN && - event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + else if (event.type == A5O_EVENT_KEY_DOWN && + event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } - else if (event.type == ALLEGRO_EVENT_TIMER) { + else if (event.type == A5O_EVENT_TIMER) { al_draw_bitmap(bitmap, 0, 0, 0); al_flip_display(); } diff --git a/examples/ex_ogre3d.cpp b/examples/ex_ogre3d.cpp index 52e56636e2..8a25bb3202 100644 --- a/examples/ex_ogre3d.cpp +++ b/examples/ex_ogre3d.cpp @@ -14,7 +14,7 @@ #include #include -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS #include #endif #include @@ -46,7 +46,7 @@ class Application Camera *mCamera; public: - void setup(ALLEGRO_DISPLAY *display) + void setup(A5O_DISPLAY *display) { createRoot(); defineResources(); @@ -102,7 +102,7 @@ class Application } } - void createRenderWindow(ALLEGRO_DISPLAY *display) + void createRenderWindow(A5O_DISPLAY *display) { int w = al_get_display_width(display); int h = al_get_display_height(display); @@ -111,7 +111,7 @@ class Application mRoot->initialise(false); Ogre::NameValuePairList misc; - #ifdef ALLEGRO_WINDOWS + #ifdef A5O_WINDOWS unsigned long winHandle = reinterpret_cast(al_get_win_window_handle(display)); unsigned long winGlContext = reinterpret_cast(wglGetCurrentContext()); misc["externalWindowHandle"] = StringConverter::toString(winHandle); @@ -171,9 +171,9 @@ class Application class Example : public Application { private: - ALLEGRO_DISPLAY *display; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_TIMER *timer; + A5O_DISPLAY *display; + A5O_EVENT_QUEUE *queue; + A5O_TIMER *timer; double startTime; double lastRenderTime; @@ -188,7 +188,7 @@ class Example : public Application Vector3 last_translate; public: - Example(ALLEGRO_DISPLAY *display); + Example(A5O_DISPLAY *display); ~Example(); void setup(); void mainLoop(); @@ -201,7 +201,7 @@ class Example : public Application void nextFrame(); }; -Example::Example(ALLEGRO_DISPLAY *display) : +Example::Example(A5O_DISPLAY *display) : display(display), queue(NULL), timer(NULL), @@ -282,7 +282,7 @@ void Example::mainLoop() al_start_timer(timer); for (;;) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (al_is_event_queue_empty(queue) && redraw) { nextFrame(); @@ -290,11 +290,11 @@ void Example::mainLoop() } al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_KEY_DOWN && - event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_DOWN && + event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } @@ -303,18 +303,18 @@ void Example::mainLoop() Vector3 translate(Vector3::ZERO); switch (event.type) { - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: redraw = true; break; - case ALLEGRO_EVENT_MOUSE_BUTTON_DOWN: + case A5O_EVENT_MOUSE_BUTTON_DOWN: if (event.mouse.button == 1) lmb = true; if (event.mouse.button == 2) rmb = true; break; - case ALLEGRO_EVENT_MOUSE_BUTTON_UP: + case A5O_EVENT_MOUSE_BUTTON_UP: if (event.mouse.button == 1) lmb = false; if (event.mouse.button == 2) @@ -323,7 +323,7 @@ void Example::mainLoop() al_show_mouse_cursor(display); break; - case ALLEGRO_EVENT_MOUSE_AXES: + case A5O_EVENT_MOUSE_AXES: if (lmb) { rot_x = Degree(-event.mouse.dx * 0.13); rot_y = Degree(-event.mouse.dy * 0.13); @@ -340,21 +340,21 @@ void Example::mainLoop() } break; - case ALLEGRO_EVENT_KEY_DOWN: - case ALLEGRO_EVENT_KEY_UP: { - const bool is_down = (event.type == ALLEGRO_EVENT_KEY_DOWN); - if (event.keyboard.keycode == ALLEGRO_KEY_W) + case A5O_EVENT_KEY_DOWN: + case A5O_EVENT_KEY_UP: { + const bool is_down = (event.type == A5O_EVENT_KEY_DOWN); + if (event.keyboard.keycode == A5O_KEY_W) forward = is_down; - if (event.keyboard.keycode == ALLEGRO_KEY_S) + if (event.keyboard.keycode == A5O_KEY_S) back = is_down; - if (event.keyboard.keycode == ALLEGRO_KEY_A) + if (event.keyboard.keycode == A5O_KEY_A) left = is_down; - if (event.keyboard.keycode == ALLEGRO_KEY_D) + if (event.keyboard.keycode == A5O_KEY_D) right = is_down; break; } - case ALLEGRO_EVENT_DISPLAY_RESIZE: { + case A5O_EVENT_DISPLAY_RESIZE: { al_acknowledge_resize(event.display.source); int w = al_get_display_width(display); int h = al_get_display_height(display); @@ -439,7 +439,7 @@ int main(int argc, char *argv[]) { (void)argc; (void)argv; - ALLEGRO_DISPLAY *display; + A5O_DISPLAY *display; if (!al_init()) { abort_example("Could not init Allegro.\n"); @@ -447,7 +447,7 @@ int main(int argc, char *argv[]) al_install_keyboard(); al_install_mouse(); - al_set_new_display_flags(ALLEGRO_OPENGL | ALLEGRO_RESIZABLE); + al_set_new_display_flags(A5O_OPENGL | A5O_RESIZABLE); display = al_create_display(WIDTH, HEIGHT); if (!display) { abort_example("Error creating display\n"); diff --git a/examples/ex_opengl.c b/examples/ex_opengl.c index 012281c927..e4829963e7 100644 --- a/examples/ex_opengl.c +++ b/examples/ex_opengl.c @@ -1,4 +1,4 @@ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include @@ -49,7 +49,7 @@ static void draw_opengl(void) /* Let's create a framebuffer object. */ if (!fbo && !no_fbo) { /* Did Allegro discover the OpenGL extension for us? */ - if (al_get_opengl_extension_list()->ALLEGRO_GL_EXT_framebuffer_object) { + if (al_get_opengl_extension_list()->A5O_GL_EXT_framebuffer_object) { /* If yes, then it also filled in the function pointer. How nice. */ glGenFramebuffersEXT(1, &fbo); @@ -86,7 +86,7 @@ static void draw_opengl(void) glDisable(GL_TEXTURE_2D); glColor3f(1, 1, 0); - glTranslatef(128, 128 + sin(secs * ALLEGRO_PI * 2 * 2) * 20, 0); + glTranslatef(128, 128 + sin(secs * A5O_PI * 2 * 2) * 20, 0); glBegin(GL_TRIANGLES); glVertex2f(0, -100); glVertex2f(100, 0); @@ -119,9 +119,9 @@ static void draw_opengl(void) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; + A5O_DISPLAY *display; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; int frames = 0; double start; @@ -135,7 +135,7 @@ int main(int argc, char **argv) open_log(); al_install_keyboard(); - al_set_new_display_flags(ALLEGRO_OPENGL); + al_set_new_display_flags(A5O_OPENGL); display = al_create_display(640, 480); if (!display) { abort_example("Could not create display.\n"); @@ -151,11 +151,11 @@ int main(int argc, char **argv) if (!al_is_event_queue_empty(queue)) { while (al_get_next_event(queue, &event)) { switch (event.type) { - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: goto done; - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) goto done; break; } diff --git a/examples/ex_opengl_pixel_shader.c b/examples/ex_opengl_pixel_shader.c index b8883bf365..e426231a23 100644 --- a/examples/ex_opengl_pixel_shader.c +++ b/examples/ex_opengl_pixel_shader.c @@ -1,4 +1,4 @@ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include @@ -14,9 +14,9 @@ int main(int argc, char **argv) { float r = 0.5, g = 0.5, b = 1, ratio = 0; int dir = 1; - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *mysha; - ALLEGRO_BITMAP *buffer; + A5O_DISPLAY *display; + A5O_BITMAP *mysha; + A5O_BITMAP *buffer; const char *tinter_shader_src[] = { "uniform sampler2D backBuffer;", @@ -52,7 +52,7 @@ int main(int argc, char **argv) al_install_keyboard(); al_init_image_addon(); - al_set_new_display_flags(ALLEGRO_OPENGL); + al_set_new_display_flags(A5O_OPENGL); display = al_create_display(320, 200); if (!display) { abort_example("Error creating display\n"); @@ -84,9 +84,9 @@ int main(int argc, char **argv) while (1) { double now, diff; - ALLEGRO_KEYBOARD_STATE state; + A5O_KEYBOARD_STATE state; al_get_keyboard_state(&state); - if (al_key_down(&state, ALLEGRO_KEY_ESCAPE)) { + if (al_key_down(&state, A5O_KEY_ESCAPE)) { break; } now = al_get_time(); diff --git a/examples/ex_palette.c b/examples/ex_palette.c index f25f7e8f2c..6231d7978f 100644 --- a/examples/ex_palette.c +++ b/examples/ex_palette.c @@ -22,13 +22,13 @@ typedef struct { int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *bitmap, *background, *pal_bitmap; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; + A5O_DISPLAY *display; + A5O_BITMAP *bitmap, *background, *pal_bitmap; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; bool redraw = true; bool show_pal = false; - ALLEGRO_SHADER *shader; + A5O_SHADER *shader; float pals[7][3 * 256]; int i, j; float t = 0; @@ -46,15 +46,15 @@ int main(int argc, char **argv) al_init_image_addon(); init_platform_specific(); - al_set_new_display_flags(ALLEGRO_PROGRAMMABLE_PIPELINE | - ALLEGRO_OPENGL); + al_set_new_display_flags(A5O_PROGRAMMABLE_PIPELINE | + A5O_OPENGL); display = al_create_display(640, 480); if (!display) { abort_example("Error creating display\n"); } - al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8); - bitmap = al_load_bitmap_flags("data/alexlogo.bmp", ALLEGRO_KEEP_INDEX); + al_set_new_bitmap_format(A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8); + bitmap = al_load_bitmap_flags("data/alexlogo.bmp", A5O_KEEP_INDEX); if (!bitmap) { abort_example("alexlogo not found or failed to load\n"); } @@ -62,10 +62,10 @@ int main(int argc, char **argv) /* Create 8 sprites. */ for (i = 0; i < 8; i++) { Sprite *s = sprite + i; - s->angle = ALLEGRO_PI * 2 * i / 8; + s->angle = A5O_PI * 2 * i / 8; s->x = 320 + sin(s->angle) * (64 + i * 16); s->y = 240 - cos(s->angle) * (64 + i * 16); - s->flags = (i % 2) ? ALLEGRO_FLIP_HORIZONTAL : 0; + s->flags = (i % 2) ? A5O_FLIP_HORIZONTAL : 0; s->t = i / 8.0; s->i = i % 6; s->j = (s->i + 1) % 6; @@ -94,7 +94,7 @@ int main(int argc, char **argv) } } - al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ANY); + al_set_new_bitmap_format(A5O_PIXEL_FORMAT_ANY); pal_bitmap = al_create_bitmap(255, 7); al_set_target_bitmap(pal_bitmap); for (int y = 0; y < 7; y++) { @@ -107,12 +107,12 @@ int main(int argc, char **argv) } al_set_target_backbuffer(display); - shader = al_create_shader(ALLEGRO_SHADER_GLSL); - if (!al_attach_shader_source(shader, ALLEGRO_VERTEX_SHADER, - al_get_default_shader_source(ALLEGRO_SHADER_AUTO, ALLEGRO_VERTEX_SHADER))) { + shader = al_create_shader(A5O_SHADER_GLSL); + if (!al_attach_shader_source(shader, A5O_VERTEX_SHADER, + al_get_default_shader_source(A5O_SHADER_AUTO, A5O_VERTEX_SHADER))) { abort_example("al_attach_shader_source for vertex shader failed: %s\n", al_get_shader_log(shader)); } - if (!al_attach_shader_source_file(shader, ALLEGRO_PIXEL_SHADER, "data/ex_shader_palette_pixel.glsl")) { + if (!al_attach_shader_source_file(shader, A5O_PIXEL_SHADER, "data/ex_shader_palette_pixel.glsl")) { abort_example("al_attach_shader_source_file for pixel shader failed: %s\n", al_get_shader_log(shader)); } if (!al_build_shader(shader)) @@ -132,18 +132,18 @@ int main(int argc, char **argv) log_printf("%s\n", "Press P to toggle displaying the palette"); while (1) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) + if (event.type == A5O_EVENT_DISPLAY_CLOSE) break; - if (event.type == ALLEGRO_EVENT_KEY_CHAR) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + if (event.type == A5O_EVENT_KEY_CHAR) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) break; - if (event.keyboard.keycode == ALLEGRO_KEY_P) + if (event.keyboard.keycode == A5O_KEY_P) show_pal = !show_pal; } - if (event.type == ALLEGRO_EVENT_TIMER) { + if (event.type == A5O_EVENT_TIMER) { redraw = true; t++; for (i = 0; i < 8; i++) { @@ -151,7 +151,7 @@ int main(int argc, char **argv) int dir = s->flags ? 1 : -1; s->x += cos(s->angle) * 2 * dir; s->y += sin(s->angle) * 2 * dir; - s->angle += ALLEGRO_PI / 180.0 * dir; + s->angle += A5O_PI / 180.0 * dir; } } @@ -172,7 +172,7 @@ int main(int argc, char **argv) for (i = 0; i < 8; i++) { Sprite *s = sprite + 7 - i; - float pos = (1 + sin((t / 60 + s->t) * 2 * ALLEGRO_PI)) / 2; + float pos = (1 + sin((t / 60 + s->t) * 2 * A5O_PI)) / 2; al_set_shader_float("pal_set_1", s->i); al_set_shader_float("pal_set_2", s->j); al_set_shader_float("pal_interp", pos); diff --git a/examples/ex_path.c b/examples/ex_path.c index 89dd67a175..009456ac7d 100644 --- a/examples/ex_path.c +++ b/examples/ex_path.c @@ -5,9 +5,9 @@ int main(int argc, char **argv) { - ALLEGRO_PATH *dyn = NULL; - ALLEGRO_PATH *tostring = NULL; - ALLEGRO_PATH *cloned = NULL; + A5O_PATH *dyn = NULL; + A5O_PATH *tostring = NULL; + A5O_PATH *cloned = NULL; if (!al_init()) { abort_example("Could not init Allegro.\n"); @@ -15,7 +15,7 @@ int main(int argc, char **argv) open_log(); if (argc < 2) { - ALLEGRO_PATH *exe = al_create_path(argv[0]); + A5O_PATH *exe = al_create_path(argv[0]); if (exe) { log_printf("This example needs to be run from the command line.\nUsage1: %s \n", al_get_path_filename(exe)); al_destroy_path(exe); @@ -73,12 +73,12 @@ int main(int argc, char **argv) al_destroy_path(cloned); } else { - log_printf("failed to clone ALLEGRO_PATH :(\n"); + log_printf("failed to clone A5O_PATH :(\n"); al_destroy_path(dyn); } } else { - log_printf("failed to create new ALLEGRO_PATH for cloning..."); + log_printf("failed to create new A5O_PATH for cloning..."); } done: diff --git a/examples/ex_path_test.c b/examples/ex_path_test.c index 4e97924ede..b30f9421d9 100644 --- a/examples/ex_path_test.c +++ b/examples/ex_path_test.c @@ -9,7 +9,7 @@ #include "common.c" -#ifdef ALLEGRO_MSVC +#ifdef A5O_MSVC #pragma warning (disable: 4066) #endif @@ -37,7 +37,7 @@ int error = 0; */ static void t1(void) { - ALLEGRO_PATH *path; + A5O_PATH *path; CHECK(path = al_create_path(NULL)); al_destroy_path(path); @@ -99,8 +99,8 @@ static void t1(void) /* Test parsing UNC paths. */ static void t2(void) { -#ifdef ALLEGRO_WINDOWS - ALLEGRO_PATH *path; +#ifdef A5O_WINDOWS + A5O_PATH *path; /* The mixed slashes are deliberate. */ /* Good paths. */ @@ -124,8 +124,8 @@ static void t2(void) /* Test parsing drive letter paths. */ static void t3(void) { -#ifdef ALLEGRO_WINDOWS - ALLEGRO_PATH *path; +#ifdef A5O_WINDOWS + A5O_PATH *path; /* The mixed slashes are deliberate. */ @@ -155,7 +155,7 @@ static void t3(void) /* Test al_append_path_component. */ static void t4(void) { - ALLEGRO_PATH *path = al_create_path(NULL); + A5O_PATH *path = al_create_path(NULL); CHECK(al_get_path_num_components(path) == 0); @@ -179,7 +179,7 @@ static void t4(void) /* Test al_replace_path_component. */ static void t5(void) { - ALLEGRO_PATH *path = al_create_path(NULL); + A5O_PATH *path = al_create_path(NULL); al_append_path_component(path, "abc"); al_append_path_component(path, "INKY"); @@ -206,7 +206,7 @@ static void t5(void) /* Test al_remove_path_component. */ static void t6(void) { - ALLEGRO_PATH *path = al_create_path(NULL); + A5O_PATH *path = al_create_path(NULL); al_append_path_component(path, "abc"); al_append_path_component(path, "INKY"); @@ -232,7 +232,7 @@ static void t6(void) /* Test al_insert_path_component. */ static void t7(void) { - ALLEGRO_PATH *path = al_create_path("INKY/BLINKY/"); + A5O_PATH *path = al_create_path("INKY/BLINKY/"); al_insert_path_component(path, 0, "abc"); al_insert_path_component(path, 2, "def"); @@ -251,7 +251,7 @@ static void t7(void) /* Test al_get_path_tail, al_drop_path_tail. */ static void t8(void) { - ALLEGRO_PATH *path = al_create_path(NULL); + A5O_PATH *path = al_create_path(NULL); CHECK(! al_get_path_tail(path)); @@ -278,7 +278,7 @@ static void t8(void) */ static void t9(void) { - ALLEGRO_PATH *path = al_create_path(NULL); + A5O_PATH *path = al_create_path(NULL); CHECK_EQ(al_path_cstr(path, '/'), ""); @@ -318,8 +318,8 @@ static void t9(void) /* Test al_join_paths. */ static void t10(void) { - ALLEGRO_PATH *path1; - ALLEGRO_PATH *path2; + A5O_PATH *path1; + A5O_PATH *path2; /* Both empty. */ path1 = al_create_path(NULL); @@ -346,7 +346,7 @@ static void t10(void) al_destroy_path(path1); al_destroy_path(path2); -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS /* Both relative paths with drive letters. */ path1 = al_create_path("d:dir1a/dir1b/file1"); path2 = al_create_path("e:dir2a/dir2b/file2"); @@ -376,8 +376,8 @@ static void t10(void) /* Test al_rebase_path. */ static void t11(void) { - ALLEGRO_PATH *path1; - ALLEGRO_PATH *path2; + A5O_PATH *path1; + A5O_PATH *path2; /* Both empty. */ path1 = al_create_path(NULL); @@ -404,7 +404,7 @@ static void t11(void) al_destroy_path(path1); al_destroy_path(path2); -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS /* Both relative paths with drive letters. */ path1 = al_create_path("d:dir1a/dir1b/file1"); path2 = al_create_path("e:dir2a/dir2b/file2"); @@ -434,7 +434,7 @@ static void t11(void) /* Test al_set_path_extension, al_get_path_extension. */ static void t12(void) { - ALLEGRO_PATH *path = al_create_path(NULL); + A5O_PATH *path = al_create_path(NULL); /* Get null extension. */ CHECK_EQ(al_get_path_extension(path), ""); @@ -466,7 +466,7 @@ static void t12(void) /* Test al_get_path_basename. */ static void t13(void) { - ALLEGRO_PATH *path = al_create_path(NULL); + A5O_PATH *path = al_create_path(NULL); /* No filename. */ al_set_path_filename(path, NULL); @@ -490,8 +490,8 @@ static void t13(void) /* Test al_clone_path. */ static void t14(void) { - ALLEGRO_PATH *path1; - ALLEGRO_PATH *path2; + A5O_PATH *path1; + A5O_PATH *path2; path1 = al_create_path("/abc/def/ghi"); path2 = al_clone_path(path1); @@ -522,7 +522,7 @@ static void t16(void) /* Test al_make_path_canonical. */ static void t17(void) { - ALLEGRO_PATH *path; + A5O_PATH *path; path = al_create_path("/../.././abc/./def/../../ghi/jkl"); CHECK(al_make_path_canonical(path)); diff --git a/examples/ex_physfs.c b/examples/ex_physfs.c index 0f32c6374e..e77adc8071 100644 --- a/examples/ex_physfs.c +++ b/examples/ex_physfs.c @@ -13,10 +13,10 @@ #include "common.c" -static void show_image(ALLEGRO_BITMAP *bmp) +static void show_image(A5O_BITMAP *bmp) { - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; queue = al_create_event_queue(); al_register_event_source(queue, al_get_keyboard_event_source()); @@ -25,8 +25,8 @@ static void show_image(ALLEGRO_BITMAP *bmp) al_draw_bitmap(bmp, 0, 0, 0); al_flip_display(); al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_KEY_DOWN - && event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_DOWN + && event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } } @@ -34,7 +34,7 @@ static void show_image(ALLEGRO_BITMAP *bmp) al_destroy_event_queue(queue); } -static void print_file(ALLEGRO_FS_ENTRY *entry) +static void print_file(A5O_FS_ENTRY *entry) { int mode = al_get_fs_entry_mode(entry); time_t now = time(NULL); @@ -46,21 +46,21 @@ static void print_file(ALLEGRO_FS_ENTRY *entry) log_printf("%-36s %s%s%s%s%s%s %8u %8u %8u %8u\n", name, - mode & ALLEGRO_FILEMODE_READ ? "r" : ".", - mode & ALLEGRO_FILEMODE_WRITE ? "w" : ".", - mode & ALLEGRO_FILEMODE_EXECUTE ? "x" : ".", - mode & ALLEGRO_FILEMODE_HIDDEN ? "h" : ".", - mode & ALLEGRO_FILEMODE_ISFILE ? "f" : ".", - mode & ALLEGRO_FILEMODE_ISDIR ? "d" : ".", + mode & A5O_FILEMODE_READ ? "r" : ".", + mode & A5O_FILEMODE_WRITE ? "w" : ".", + mode & A5O_FILEMODE_EXECUTE ? "x" : ".", + mode & A5O_FILEMODE_HIDDEN ? "h" : ".", + mode & A5O_FILEMODE_ISFILE ? "f" : ".", + mode & A5O_FILEMODE_ISDIR ? "d" : ".", (unsigned)(now - ctime), (unsigned)(now - mtime), (unsigned)(now - atime), (unsigned)size); } -static void listdir(ALLEGRO_FS_ENTRY *entry) +static void listdir(A5O_FS_ENTRY *entry) { - ALLEGRO_FS_ENTRY *next; + A5O_FS_ENTRY *next; al_open_directory(entry); while (1) { @@ -69,7 +69,7 @@ static void listdir(ALLEGRO_FS_ENTRY *entry) break; print_file(next); - if (al_get_fs_entry_mode(next) & ALLEGRO_FILEMODE_ISDIR) + if (al_get_fs_entry_mode(next) & A5O_FILEMODE_ISDIR) listdir(next); al_destroy_fs_entry(next); } @@ -78,13 +78,13 @@ static void listdir(ALLEGRO_FS_ENTRY *entry) static bool add_main_zipfile(void) { - ALLEGRO_PATH *exe; + A5O_PATH *exe; const char *ext; const char *zipfile; bool ret; /* On Android we treat the APK itself as the zip file. */ - exe = al_get_standard_path(ALLEGRO_EXENAME_PATH); + exe = al_get_standard_path(A5O_EXENAME_PATH); ext = al_get_path_extension(exe); if (0 == strcmp(ext, ".apk")) { zipfile = al_path_cstr(exe, '/'); @@ -108,9 +108,9 @@ static bool add_main_zipfile(void) int main(int argc, char *argv[]) { - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *bmp; - ALLEGRO_FS_ENTRY *entry; + A5O_DISPLAY *display; + A5O_BITMAP *bmp; + A5O_FS_ENTRY *entry; int i; if (!al_init()) { diff --git a/examples/ex_pixelformat.cpp b/examples/ex_pixelformat.cpp index a16e8558fa..18fd3bd5e2 100644 --- a/examples/ex_pixelformat.cpp +++ b/examples/ex_pixelformat.cpp @@ -19,44 +19,44 @@ typedef struct FORMAT char const *name; } FORMAT; -const FORMAT formats[ALLEGRO_NUM_PIXEL_FORMATS] = { - {ALLEGRO_PIXEL_FORMAT_ANY, "any"}, - {ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA, "no alpha"}, - {ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA, "alpha"}, - {ALLEGRO_PIXEL_FORMAT_ANY_15_NO_ALPHA, "15"}, - {ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA, "16"}, - {ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA, "16 alpha"}, - {ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA, "24"}, - {ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA, "32"}, - {ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA, "32 alpha"}, - {ALLEGRO_PIXEL_FORMAT_ARGB_8888, "ARGB8888"}, - {ALLEGRO_PIXEL_FORMAT_RGBA_8888, "RGBA8888"}, - {ALLEGRO_PIXEL_FORMAT_ARGB_4444, "ARGB4444"}, - {ALLEGRO_PIXEL_FORMAT_RGB_888, "RGB888"}, - {ALLEGRO_PIXEL_FORMAT_RGB_565, "RGB565"}, - {ALLEGRO_PIXEL_FORMAT_RGB_555, "RGB555"}, - {ALLEGRO_PIXEL_FORMAT_RGBA_5551, "RGBA5551"}, - {ALLEGRO_PIXEL_FORMAT_ARGB_1555, "ARGB1555"}, - {ALLEGRO_PIXEL_FORMAT_ABGR_8888, "ABGR8888"}, - {ALLEGRO_PIXEL_FORMAT_XBGR_8888, "XBGR8888"}, - {ALLEGRO_PIXEL_FORMAT_BGR_888, "BGR888"}, - {ALLEGRO_PIXEL_FORMAT_BGR_565, "BGR565"}, - {ALLEGRO_PIXEL_FORMAT_BGR_555, "BGR555"}, - {ALLEGRO_PIXEL_FORMAT_RGBX_8888, "RGBX8888"}, - {ALLEGRO_PIXEL_FORMAT_XRGB_8888, "XRGB8888"}, - {ALLEGRO_PIXEL_FORMAT_ABGR_F32, "ABGR32F"}, - {ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, "ABGR(LE)"}, - {ALLEGRO_PIXEL_FORMAT_RGBA_4444, "RGBA4444"}, - {ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8, "SINGLE_CHANNEL_8"}, - {ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1, "RGBA_DXT1"}, - {ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3, "RGBA_DXT3"}, - {ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5, "RGBA_DXT5"}, +const FORMAT formats[A5O_NUM_PIXEL_FORMATS] = { + {A5O_PIXEL_FORMAT_ANY, "any"}, + {A5O_PIXEL_FORMAT_ANY_NO_ALPHA, "no alpha"}, + {A5O_PIXEL_FORMAT_ANY_WITH_ALPHA, "alpha"}, + {A5O_PIXEL_FORMAT_ANY_15_NO_ALPHA, "15"}, + {A5O_PIXEL_FORMAT_ANY_16_NO_ALPHA, "16"}, + {A5O_PIXEL_FORMAT_ANY_16_WITH_ALPHA, "16 alpha"}, + {A5O_PIXEL_FORMAT_ANY_24_NO_ALPHA, "24"}, + {A5O_PIXEL_FORMAT_ANY_32_NO_ALPHA, "32"}, + {A5O_PIXEL_FORMAT_ANY_32_WITH_ALPHA, "32 alpha"}, + {A5O_PIXEL_FORMAT_ARGB_8888, "ARGB8888"}, + {A5O_PIXEL_FORMAT_RGBA_8888, "RGBA8888"}, + {A5O_PIXEL_FORMAT_ARGB_4444, "ARGB4444"}, + {A5O_PIXEL_FORMAT_RGB_888, "RGB888"}, + {A5O_PIXEL_FORMAT_RGB_565, "RGB565"}, + {A5O_PIXEL_FORMAT_RGB_555, "RGB555"}, + {A5O_PIXEL_FORMAT_RGBA_5551, "RGBA5551"}, + {A5O_PIXEL_FORMAT_ARGB_1555, "ARGB1555"}, + {A5O_PIXEL_FORMAT_ABGR_8888, "ABGR8888"}, + {A5O_PIXEL_FORMAT_XBGR_8888, "XBGR8888"}, + {A5O_PIXEL_FORMAT_BGR_888, "BGR888"}, + {A5O_PIXEL_FORMAT_BGR_565, "BGR565"}, + {A5O_PIXEL_FORMAT_BGR_555, "BGR555"}, + {A5O_PIXEL_FORMAT_RGBX_8888, "RGBX8888"}, + {A5O_PIXEL_FORMAT_XRGB_8888, "XRGB8888"}, + {A5O_PIXEL_FORMAT_ABGR_F32, "ABGR32F"}, + {A5O_PIXEL_FORMAT_ABGR_8888_LE, "ABGR(LE)"}, + {A5O_PIXEL_FORMAT_RGBA_4444, "RGBA4444"}, + {A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8, "SINGLE_CHANNEL_8"}, + {A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1, "RGBA_DXT1"}, + {A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3, "RGBA_DXT3"}, + {A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5, "RGBA_DXT5"}, }; -#define NUM_FORMATS ALLEGRO_NUM_PIXEL_FORMATS +#define NUM_FORMATS A5O_NUM_PIXEL_FORMATS -const char *get_format_name(ALLEGRO_BITMAP *bmp) +const char *get_format_name(A5O_BITMAP *bmp) { if (!bmp) return "none"; @@ -84,7 +84,7 @@ class Prog { const char* bmp_filename; public: - Prog(const Theme & theme, ALLEGRO_DISPLAY *display, const char* bmp_filename); + Prog(const Theme & theme, A5O_DISPLAY *display, const char* bmp_filename); void run(); private: @@ -92,7 +92,7 @@ class Prog { }; -Prog::Prog(const Theme & theme, ALLEGRO_DISPLAY *display, const char* bmp_filename) : +Prog::Prog(const Theme & theme, A5O_DISPLAY *display, const char* bmp_filename) : d(Dialog(theme, display, 20, 30)), source_label(Label("Source")), dest_label(Label("Destination")), @@ -141,17 +141,17 @@ void Prog::draw_sample() { const int i = source_list.get_cur_value(); const int j = dest_list.get_cur_value(); - ALLEGRO_BITMAP *bitmap1; - ALLEGRO_BITMAP *bitmap2; + A5O_BITMAP *bitmap1; + A5O_BITMAP *bitmap2; bool use_memory = use_memory_button.get_pushed(); bool enable_timing = enable_timing_button.get_pushed(); int bmp_w = 128; int bmp_h = 128; if (use_memory) - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); else - al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP); + al_set_new_bitmap_flags(A5O_VIDEO_BITMAP); al_set_new_bitmap_format(formats[i].format); @@ -173,11 +173,11 @@ void Prog::draw_sample() } if (bitmap1 && bitmap2) { - ALLEGRO_BITMAP *target = al_get_target_bitmap(); + A5O_BITMAP *target = al_get_target_bitmap(); al_set_target_bitmap(bitmap2); al_clear_to_color(al_map_rgb(128, 128, 128)); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); if (enable_timing) { double t0, t1; char str[256]; @@ -200,7 +200,7 @@ void Prog::draw_sample() } al_set_target_bitmap(target); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_draw_bitmap(bitmap2, 0, 0, 0); } else { @@ -220,8 +220,8 @@ void Prog::draw_sample() int main(int argc, char *argv[]) { - ALLEGRO_DISPLAY *display; - ALLEGRO_FONT *font; + A5O_DISPLAY *display; + A5O_FONT *font; const char* bmp_filename = "data/allegro.pcx"; if (argc > 1) { @@ -242,7 +242,7 @@ int main(int argc, char *argv[]) al_install_keyboard(); al_install_mouse(); - al_set_new_display_flags(ALLEGRO_GENERATE_EXPOSE_EVENTS); + al_set_new_display_flags(A5O_GENERATE_EXPOSE_EVENTS); display = al_create_display(800, 600); if (!display) { abort_example("Error creating display\n"); diff --git a/examples/ex_polygon.c b/examples/ex_polygon.c index d34166c6f6..3120ccf017 100644 --- a/examples/ex_polygon.c +++ b/examples/ex_polygon.c @@ -4,7 +4,7 @@ * This program tests the polygon routines in the primitives addon. */ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include #include @@ -38,21 +38,21 @@ struct Vertex { }; struct Example { - ALLEGRO_DISPLAY *display; - ALLEGRO_FONT *font; - ALLEGRO_FONT *fontbmp; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_BITMAP *dbuf; - ALLEGRO_COLOR bg; - ALLEGRO_COLOR fg; + A5O_DISPLAY *display; + A5O_FONT *font; + A5O_FONT *fontbmp; + A5O_EVENT_QUEUE *queue; + A5O_BITMAP *dbuf; + A5O_COLOR bg; + A5O_COLOR fg; Vertex vertices[MAX_VERTICES]; int vertex_polygon[MAX_VERTICES]; int vertex_count; int cur_vertex; /* -1 = none */ int cur_polygon; int mode; - ALLEGRO_LINE_CAP cap_style; - ALLEGRO_LINE_JOIN join_style; + A5O_LINE_CAP cap_style; + A5O_LINE_JOIN join_style; float thickness; float miter_limit; bool software; @@ -68,8 +68,8 @@ static void reset(void) ex.vertex_count = 0; ex.cur_vertex = -1; ex.cur_polygon = 0; - ex.cap_style = ALLEGRO_LINE_CAP_NONE; - ex.join_style = ALLEGRO_LINE_JOIN_NONE; + ex.cap_style = A5O_LINE_CAP_NONE; + ex.join_style = A5O_LINE_JOIN_NONE; ex.thickness = 1.0f; ex.miter_limit = 1.0f; ex.software = false; @@ -148,50 +148,50 @@ static void scroll(int mx, int my) ex.scroll_y += my; } -static const char *join_style_to_string(ALLEGRO_LINE_JOIN x) +static const char *join_style_to_string(A5O_LINE_JOIN x) { switch (x) { - case ALLEGRO_LINE_JOIN_NONE: + case A5O_LINE_JOIN_NONE: return "NONE"; - case ALLEGRO_LINE_JOIN_BEVEL: + case A5O_LINE_JOIN_BEVEL: return "BEVEL"; - case ALLEGRO_LINE_JOIN_ROUND: + case A5O_LINE_JOIN_ROUND: return "ROUND"; - case ALLEGRO_LINE_JOIN_MITER: + case A5O_LINE_JOIN_MITER: return "MITER"; default: return "unknown"; } } -static const char *cap_style_to_string(ALLEGRO_LINE_CAP x) +static const char *cap_style_to_string(A5O_LINE_CAP x) { switch (x) { - case ALLEGRO_LINE_CAP_NONE: + case A5O_LINE_CAP_NONE: return "NONE"; - case ALLEGRO_LINE_CAP_SQUARE: + case A5O_LINE_CAP_SQUARE: return "SQUARE"; - case ALLEGRO_LINE_CAP_ROUND: + case A5O_LINE_CAP_ROUND: return "ROUND"; - case ALLEGRO_LINE_CAP_TRIANGLE: + case A5O_LINE_CAP_TRIANGLE: return "TRIANGLE"; - case ALLEGRO_LINE_CAP_CLOSED: + case A5O_LINE_CAP_CLOSED: return "CLOSED"; default: return "unknown"; } } -static ALLEGRO_FONT *choose_font(void) +static A5O_FONT *choose_font(void) { return (ex.software) ? ex.fontbmp : ex.font; } static void draw_vertices(void) { - ALLEGRO_FONT *f = choose_font(); - ALLEGRO_COLOR vertc = al_map_rgba_f(0.7, 0, 0, 0.7); - ALLEGRO_COLOR textc = al_map_rgba_f(0, 0, 0, 0.7); + A5O_FONT *f = choose_font(); + A5O_COLOR vertc = al_map_rgba_f(0.7, 0, 0, 0.7); + A5O_COLOR textc = al_map_rgba_f(0, 0, 0, 0.7); int i; for (i = 0; i < ex.vertex_count; i++) { @@ -218,13 +218,13 @@ static void compute_polygon_vertex_counts( static void draw_all(void) { - ALLEGRO_FONT *f = choose_font(); - ALLEGRO_COLOR textc = al_map_rgb(0, 0, 0); + A5O_FONT *f = choose_font(); + A5O_COLOR textc = al_map_rgb(0, 0, 0); float texth = al_get_font_line_height(f) * 1.5; float textx = 5; float texty = 5; - ALLEGRO_TRANSFORM t; - ALLEGRO_COLOR holec; + A5O_TRANSFORM t; + A5O_COLOR holec; al_clear_to_color(ex.bg); @@ -341,7 +341,7 @@ static void print_vertices(void) int main(int argc, char **argv) { - ALLEGRO_EVENT event; + A5O_EVENT event; bool have_touch_input; bool mdown = false; @@ -372,7 +372,7 @@ int main(int argc, char **argv) abort_example("Error creating builtin font\n"); } - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); ex.dbuf = al_create_bitmap(800, 600); ex.fontbmp = al_create_builtin_font(); if (!ex.fontbmp) { @@ -409,10 +409,10 @@ int main(int argc, char **argv) } al_wait_for_event(ex.queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) + if (event.type == A5O_EVENT_DISPLAY_CLOSE) break; - if (event.type == ALLEGRO_EVENT_KEY_CHAR) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + if (event.type == A5O_EVENT_KEY_CHAR) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) break; switch (toupper(event.keyboard.unichar)) { case ' ': @@ -420,12 +420,12 @@ int main(int argc, char **argv) ex.mode = 0; break; case 'J': - if (++ex.join_style > ALLEGRO_LINE_JOIN_MITER) - ex.join_style = ALLEGRO_LINE_JOIN_NONE; + if (++ex.join_style > A5O_LINE_JOIN_MITER) + ex.join_style = A5O_LINE_JOIN_NONE; break; case 'C': - if (++ex.cap_style > ALLEGRO_LINE_CAP_CLOSED) - ex.cap_style = ALLEGRO_LINE_CAP_NONE; + if (++ex.cap_style > A5O_LINE_CAP_CLOSED) + ex.cap_style = A5O_LINE_CAP_NONE; break; case '+': ex.thickness += 0.25f; @@ -459,7 +459,7 @@ int main(int argc, char **argv) break; } } - if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN) { + if (event.type == A5O_EVENT_MOUSE_BUTTON_DOWN) { float x = event.mouse.x, y = event.mouse.y; transform(&x, &y); if (event.mouse.button == 1) @@ -469,12 +469,12 @@ int main(int argc, char **argv) if (event.mouse.button == 3) mdown = true; } - if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_UP) { + if (event.type == A5O_EVENT_MOUSE_BUTTON_UP) { ex.cur_vertex = -1; if (event.mouse.button == 3) mdown = false; } - if (event.type == ALLEGRO_EVENT_MOUSE_AXES) { + if (event.type == A5O_EVENT_MOUSE_AXES) { float x = event.mouse.x, y = event.mouse.y; transform(&x, &y); diff --git a/examples/ex_premulalpha.c b/examples/ex_premulalpha.c index d512a7b337..189e7e23bb 100644 --- a/examples/ex_premulalpha.c +++ b/examples/ex_premulalpha.c @@ -8,13 +8,13 @@ int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *tex1, *tex2; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; + A5O_DISPLAY *display; + A5O_BITMAP *tex1, *tex2; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; bool redraw = true; - ALLEGRO_LOCKED_REGION *lock; - ALLEGRO_FONT *font; + A5O_LOCKED_REGION *lock; + A5O_FONT *font; unsigned char *p; int x, y; @@ -37,7 +37,7 @@ int main(int argc, char **argv) font = al_create_builtin_font(); tex1 = al_create_bitmap(8, 8); - lock = al_lock_bitmap(tex1, ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, ALLEGRO_LOCK_WRITEONLY); + lock = al_lock_bitmap(tex1, A5O_PIXEL_FORMAT_ABGR_8888_LE, A5O_LOCK_WRITEONLY); p = lock->data; for (y = 0; y < 8; y++) { unsigned char *lp = p; @@ -60,7 +60,7 @@ int main(int argc, char **argv) } al_unlock_bitmap(tex1); - al_set_new_bitmap_flags(ALLEGRO_MAG_LINEAR); + al_set_new_bitmap_flags(A5O_MAG_LINEAR); tex2 = al_clone_bitmap(tex1); timer = al_create_timer(1.0 / 30); @@ -71,64 +71,64 @@ int main(int argc, char **argv) al_start_timer(timer); while (1) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) + if (event.type == A5O_EVENT_DISPLAY_CLOSE) break; - if (event.type == ALLEGRO_EVENT_KEY_DOWN) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + if (event.type == A5O_EVENT_KEY_DOWN) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) break; } - if (event.type == ALLEGRO_EVENT_TIMER) + if (event.type == A5O_EVENT_TIMER) redraw = true; if (redraw && al_is_event_queue_empty(queue)) { float x = 8, y = 60; float a, t = al_get_time(); float th = al_get_font_line_height(font); - ALLEGRO_COLOR color = al_map_rgb_f(0, 0, 0); - ALLEGRO_COLOR color2 = al_map_rgb_f(1, 0, 0); - ALLEGRO_COLOR color3 = al_map_rgb_f(0, 0.5, 0); + A5O_COLOR color = al_map_rgb_f(0, 0, 0); + A5O_COLOR color2 = al_map_rgb_f(1, 0, 0); + A5O_COLOR color3 = al_map_rgb_f(0, 0.5, 0); t /= 10; a = t - floor(t); - a *= 2 * ALLEGRO_PI; + a *= 2 * A5O_PI; redraw = false; al_clear_to_color(al_map_rgb_f(0.5, 0.6, 1)); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_draw_textf(font, color, x, y, 0, "not premultiplied"); al_draw_textf(font, color, x, y + th, 0, "no filtering"); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA); al_draw_scaled_rotated_bitmap(tex1, 4, 4, x + 320, y, 8, 8, a, 0); y += 120; - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_draw_textf(font, color, x, y, 0, "not premultiplied"); al_draw_textf(font, color, x, y + th, 0, "mag linear filtering"); al_draw_textf(font, color2, x + 400, y, 0, "wrong dark border"); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA); al_draw_scaled_rotated_bitmap(tex2, 4, 4, x + 320, y, 8, 8, a, 0); y += 120; - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_draw_textf(font, color, x, y, 0, "premultiplied alpha"); al_draw_textf(font, color, x, y + th, 0, "no filtering"); al_draw_textf(font, color, x + 400, y, 0, "no difference"); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_draw_scaled_rotated_bitmap(tex1, 4, 4, x + 320, y, 8, 8, a, 0); y += 120; - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_draw_textf(font, color, x, y, 0, "premultiplied alpha"); al_draw_textf(font, color, x, y + th, 0, "mag linear filtering"); al_draw_textf(font, color3, x + 400, y, 0, "correct color"); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_draw_scaled_rotated_bitmap(tex2, 4, 4, x + 320, y, 8, 8, a, 0); al_flip_display(); diff --git a/examples/ex_prim.c b/examples/ex_prim.c index 2461af3c8d..42d6f53299 100644 --- a/examples/ex_prim.c +++ b/examples/ex_prim.c @@ -17,7 +17,7 @@ * See readme.txt for copyright information. */ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include @@ -34,11 +34,11 @@ int ScreenW = 800, ScreenH = 600; #define ROTATE_SPEED 0.0001f Screen Screens[NUM_SCREENS]; const char *ScreenName[NUM_SCREENS]; -ALLEGRO_FONT* Font; -ALLEGRO_TRANSFORM Identity; -ALLEGRO_BITMAP* Buffer; -ALLEGRO_BITMAP* Texture; -ALLEGRO_COLOR solid_white; +A5O_FONT* Font; +A5O_TRANSFORM Identity; +A5O_BITMAP* Buffer; +A5O_BITMAP* Texture; +A5O_COLOR solid_white; int Soft = 0; int Blend = 1; @@ -46,7 +46,7 @@ float Speed = ROTATE_SPEED; float Theta; int Background = 1; float Thickness = 0; -ALLEGRO_TRANSFORM MainTrans; +A5O_TRANSFORM MainTrans; enum MODE { INIT, @@ -57,7 +57,7 @@ enum MODE { typedef struct { - ALLEGRO_COLOR color; + A5O_COLOR color; short u, v; short x, y; int junk[6]; @@ -66,21 +66,21 @@ typedef struct static void CustomVertexFormatPrimitives(int mode) { static CUSTOM_VERTEX vtx[4]; - static ALLEGRO_VERTEX_DECL* decl; + static A5O_VERTEX_DECL* decl; if (mode == INIT) { int ii = 0; - ALLEGRO_VERTEX_ELEMENT elems[] = { - {ALLEGRO_PRIM_POSITION, ALLEGRO_PRIM_SHORT_2, offsetof(CUSTOM_VERTEX, x)}, - {ALLEGRO_PRIM_TEX_COORD_PIXEL, ALLEGRO_PRIM_SHORT_2, offsetof(CUSTOM_VERTEX, u)}, - {ALLEGRO_PRIM_COLOR_ATTR, 0, offsetof(CUSTOM_VERTEX, color)}, + A5O_VERTEX_ELEMENT elems[] = { + {A5O_PRIM_POSITION, A5O_PRIM_SHORT_2, offsetof(CUSTOM_VERTEX, x)}, + {A5O_PRIM_TEX_COORD_PIXEL, A5O_PRIM_SHORT_2, offsetof(CUSTOM_VERTEX, u)}, + {A5O_PRIM_COLOR_ATTR, 0, offsetof(CUSTOM_VERTEX, color)}, {0, 0, 0} }; decl = al_create_vertex_decl(elems, sizeof(CUSTOM_VERTEX)); for (ii = 0; ii < 4; ii++) { float x, y; - x = 200 * cosf((float)ii / 4.0f * 2 * ALLEGRO_PI); - y = 200 * sinf((float)ii / 4.0f * 2 * ALLEGRO_PI); + x = 200 * cosf((float)ii / 4.0f * 2 * A5O_PI); + y = 200 * sinf((float)ii / 4.0f * 2 * A5O_PI); vtx[ii].x = x; vtx[ii].y = y; vtx[ii].u = 64 * x / 100; vtx[ii].v = 64 * y / 100; @@ -91,13 +91,13 @@ static void CustomVertexFormatPrimitives(int mode) al_build_transform(&MainTrans, ScreenW / 2, ScreenH / 2, 1, 1, Theta); } else if (mode == DRAW) { if (Blend) - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE); else - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_use_transform(&MainTrans); - al_draw_prim(vtx, decl, Texture, 0, 4, ALLEGRO_PRIM_TRIANGLE_FAN); + al_draw_prim(vtx, decl, Texture, 0, 4, A5O_PRIM_TRIANGLE_FAN); al_use_transform(&Identity); } @@ -105,15 +105,15 @@ static void CustomVertexFormatPrimitives(int mode) static void TexturePrimitives(int mode) { - static ALLEGRO_VERTEX vtx[13]; - static ALLEGRO_VERTEX vtx2[13]; + static A5O_VERTEX vtx[13]; + static A5O_VERTEX vtx2[13]; if (mode == INIT) { int ii = 0; - ALLEGRO_COLOR color; + A5O_COLOR color; for (ii = 0; ii < 13; ii++) { float x, y; - x = 200 * cosf((float)ii / 13.0f * 2 * ALLEGRO_PI); - y = 200 * sinf((float)ii / 13.0f * 2 * ALLEGRO_PI); + x = 200 * cosf((float)ii / 13.0f * 2 * A5O_PI); + y = 200 * sinf((float)ii / 13.0f * 2 * A5O_PI); color = al_map_rgb((ii + 1) % 3 * 64, (ii + 2) % 3 * 64, (ii) % 3 * 64); @@ -132,16 +132,16 @@ static void TexturePrimitives(int mode) al_build_transform(&MainTrans, ScreenW / 2, ScreenH / 2, 1, 1, Theta); } else if (mode == DRAW) { if (Blend) - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE); else - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_use_transform(&MainTrans); - al_draw_prim(vtx, 0, Texture, 0, 4, ALLEGRO_PRIM_LINE_LIST); - al_draw_prim(vtx, 0, Texture, 4, 9, ALLEGRO_PRIM_LINE_STRIP); - al_draw_prim(vtx, 0, Texture, 9, 13, ALLEGRO_PRIM_LINE_LOOP); - al_draw_prim(vtx2, 0, Texture, 0, 13, ALLEGRO_PRIM_POINT_LIST); + al_draw_prim(vtx, 0, Texture, 0, 4, A5O_PRIM_LINE_LIST); + al_draw_prim(vtx, 0, Texture, 4, 9, A5O_PRIM_LINE_STRIP); + al_draw_prim(vtx, 0, Texture, 9, 13, A5O_PRIM_LINE_LOOP); + al_draw_prim(vtx2, 0, Texture, 0, 13, A5O_PRIM_POINT_LIST); al_use_transform(&Identity); } @@ -150,18 +150,18 @@ static void TexturePrimitives(int mode) static void FilledTexturePrimitives(int mode) { - static ALLEGRO_VERTEX vtx[21]; + static A5O_VERTEX vtx[21]; if (mode == INIT) { int ii = 0; for (ii = 0; ii < 21; ii++) { float x, y; - ALLEGRO_COLOR color; + A5O_COLOR color; if (ii % 2 == 0) { - x = 150 * cosf((float)ii / 20 * 2 * ALLEGRO_PI); - y = 150 * sinf((float)ii / 20 * 2 * ALLEGRO_PI); + x = 150 * cosf((float)ii / 20 * 2 * A5O_PI); + y = 150 * sinf((float)ii / 20 * 2 * A5O_PI); } else { - x = 200 * cosf((float)ii / 20 * 2 * ALLEGRO_PI); - y = 200 * sinf((float)ii / 20 * 2 * ALLEGRO_PI); + x = 200 * cosf((float)ii / 20 * 2 * A5O_PI); + y = 200 * sinf((float)ii / 20 * 2 * A5O_PI); } if (ii == 0) { @@ -182,15 +182,15 @@ static void FilledTexturePrimitives(int mode) al_build_transform(&MainTrans, ScreenW / 2, ScreenH / 2, 1, 1, Theta); } else if (mode == DRAW) { if (Blend) - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE); else - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_use_transform(&MainTrans); - al_draw_prim(vtx, 0, Texture, 0, 6, ALLEGRO_PRIM_TRIANGLE_FAN); - al_draw_prim(vtx, 0, Texture, 7, 13, ALLEGRO_PRIM_TRIANGLE_LIST); - al_draw_prim(vtx, 0, Texture, 14, 20, ALLEGRO_PRIM_TRIANGLE_STRIP); + al_draw_prim(vtx, 0, Texture, 0, 6, A5O_PRIM_TRIANGLE_FAN); + al_draw_prim(vtx, 0, Texture, 7, 13, A5O_PRIM_TRIANGLE_LIST); + al_draw_prim(vtx, 0, Texture, 14, 20, A5O_PRIM_TRIANGLE_STRIP); al_use_transform(&Identity); } @@ -198,18 +198,18 @@ static void FilledTexturePrimitives(int mode) static void FilledPrimitives(int mode) { - static ALLEGRO_VERTEX vtx[21]; + static A5O_VERTEX vtx[21]; if (mode == INIT) { int ii = 0; for (ii = 0; ii < 21; ii++) { float x, y; - ALLEGRO_COLOR color; + A5O_COLOR color; if (ii % 2 == 0) { - x = 150 * cosf((float)ii / 20 * 2 * ALLEGRO_PI); - y = 150 * sinf((float)ii / 20 * 2 * ALLEGRO_PI); + x = 150 * cosf((float)ii / 20 * 2 * A5O_PI); + y = 150 * sinf((float)ii / 20 * 2 * A5O_PI); } else { - x = 200 * cosf((float)ii / 20 * 2 * ALLEGRO_PI); - y = 200 * sinf((float)ii / 20 * 2 * ALLEGRO_PI); + x = 200 * cosf((float)ii / 20 * 2 * A5O_PI); + y = 200 * sinf((float)ii / 20 * 2 * A5O_PI); } if (ii == 0) { @@ -226,15 +226,15 @@ static void FilledPrimitives(int mode) al_build_transform(&MainTrans, ScreenW / 2, ScreenH / 2, 1, 1, Theta); } else if (mode == DRAW) { if (Blend) - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE); else - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_use_transform(&MainTrans); - al_draw_prim(vtx, 0, 0, 0, 6, ALLEGRO_PRIM_TRIANGLE_FAN); - al_draw_prim(vtx, 0, 0, 7, 13, ALLEGRO_PRIM_TRIANGLE_LIST); - al_draw_prim(vtx, 0, 0, 14, 20, ALLEGRO_PRIM_TRIANGLE_STRIP); + al_draw_prim(vtx, 0, 0, 0, 6, A5O_PRIM_TRIANGLE_FAN); + al_draw_prim(vtx, 0, 0, 7, 13, A5O_PRIM_TRIANGLE_LIST); + al_draw_prim(vtx, 0, 0, 14, 20, A5O_PRIM_TRIANGLE_STRIP); al_use_transform(&Identity); } @@ -242,7 +242,7 @@ static void FilledPrimitives(int mode) static void IndexedFilledPrimitives(int mode) { - static ALLEGRO_VERTEX vtx[21]; + static A5O_VERTEX vtx[21]; static int indices1[] = {12, 13, 14, 16, 17, 18}; static int indices2[] = {6, 7, 8, 9, 10, 11}; static int indices3[] = {0, 1, 2, 3, 4, 5}; @@ -250,13 +250,13 @@ static void IndexedFilledPrimitives(int mode) int ii = 0; for (ii = 0; ii < 21; ii++) { float x, y; - ALLEGRO_COLOR color; + A5O_COLOR color; if (ii % 2 == 0) { - x = 150 * cosf((float)ii / 20 * 2 * ALLEGRO_PI); - y = 150 * sinf((float)ii / 20 * 2 * ALLEGRO_PI); + x = 150 * cosf((float)ii / 20 * 2 * A5O_PI); + y = 150 * sinf((float)ii / 20 * 2 * A5O_PI); } else { - x = 200 * cosf((float)ii / 20 * 2 * ALLEGRO_PI); - y = 200 * sinf((float)ii / 20 * 2 * ALLEGRO_PI); + x = 200 * cosf((float)ii / 20 * 2 * A5O_PI); + y = 200 * sinf((float)ii / 20 * 2 * A5O_PI); } if (ii == 0) { @@ -281,15 +281,15 @@ static void IndexedFilledPrimitives(int mode) al_build_transform(&MainTrans, ScreenW / 2, ScreenH / 2, 1, 1, Theta); } else if (mode == DRAW) { if (Blend) - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE); else - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_use_transform(&MainTrans); - al_draw_indexed_prim(vtx, 0, 0, indices1, 6, ALLEGRO_PRIM_TRIANGLE_LIST); - al_draw_indexed_prim(vtx, 0, 0, indices2, 6, ALLEGRO_PRIM_TRIANGLE_STRIP); - al_draw_indexed_prim(vtx, 0, 0, indices3, 6, ALLEGRO_PRIM_TRIANGLE_FAN); + al_draw_indexed_prim(vtx, 0, 0, indices1, 6, A5O_PRIM_TRIANGLE_LIST); + al_draw_indexed_prim(vtx, 0, 0, indices2, 6, A5O_PRIM_TRIANGLE_STRIP); + al_draw_indexed_prim(vtx, 0, 0, indices3, 6, A5O_PRIM_TRIANGLE_FAN); al_use_transform(&Identity); } @@ -311,9 +311,9 @@ static void HighPrimitives(int mode) }; if (Blend) - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE); else - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_use_transform(&MainTrans); @@ -323,10 +323,10 @@ static void HighPrimitives(int mode) al_draw_rounded_rectangle(-200, -125, 200, 125, 50, 100, al_map_rgba_f(0.2, 0.2, 0, 1), Thickness); al_draw_ellipse(0, 0, 300, 150, al_map_rgba_f(0, 0.5, 0.5, 1), Thickness); - al_draw_elliptical_arc(-20, 0, 300, 200, -ALLEGRO_PI / 2, -ALLEGRO_PI, al_map_rgba_f(0.25, 0.25, 0.5, 1), Thickness); - al_draw_arc(0, 0, 200, -ALLEGRO_PI / 2, ALLEGRO_PI, al_map_rgba_f(0.5, 0.25, 0, 1), Thickness); + al_draw_elliptical_arc(-20, 0, 300, 200, -A5O_PI / 2, -A5O_PI, al_map_rgba_f(0.25, 0.25, 0.5, 1), Thickness); + al_draw_arc(0, 0, 200, -A5O_PI / 2, A5O_PI, al_map_rgba_f(0.5, 0.25, 0, 1), Thickness); al_draw_spline(points, al_map_rgba_f(0.1, 0.2, 0.5, 1), Thickness); - al_draw_pieslice(0, 25, 150, ALLEGRO_PI * 3 / 4, -ALLEGRO_PI / 2, al_map_rgba_f(0.4, 0.3, 0.1, 1), Thickness); + al_draw_pieslice(0, 25, 150, A5O_PI * 3 / 4, -A5O_PI / 2, al_map_rgba_f(0.4, 0.3, 0.1, 1), Thickness); al_use_transform(&Identity); } @@ -341,9 +341,9 @@ static void HighFilledPrimitives(int mode) al_build_transform(&MainTrans, ScreenW / 2, ScreenH / 2, 1, 1, Theta); } else if (mode == DRAW) { if (Blend) - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE); else - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_use_transform(&MainTrans); @@ -351,7 +351,7 @@ static void HighFilledPrimitives(int mode) al_draw_filled_rectangle(20, -50, 200, 50, al_map_rgb_f(0.3, 0.2, 0.6)); al_draw_filled_ellipse(-250, 0, 100, 150, al_map_rgb_f(0.3, 0.3, 0.3)); al_draw_filled_rounded_rectangle(50, -250, 350, -75, 50, 70, al_map_rgb_f(0.4, 0.2, 0)); - al_draw_filled_pieslice(200, 125, 50, ALLEGRO_PI / 4, 3 * ALLEGRO_PI / 2, al_map_rgb_f(0.3, 0.3, 0.1)); + al_draw_filled_pieslice(200, 125, 50, A5O_PI / 4, 3 * A5O_PI / 2, al_map_rgb_f(0.3, 0.3, 0.1)); al_use_transform(&Identity); } @@ -374,9 +374,9 @@ static void TransformationsPrimitives(int mode) }; if (Blend) - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE); else - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_use_transform(&MainTrans); @@ -386,10 +386,10 @@ static void TransformationsPrimitives(int mode) al_draw_rounded_rectangle(-200, -125, 200, 125, 50, 100, al_map_rgba_f(0.2, 0.2, 0, 1), Thickness); al_draw_ellipse(0, 0, 300, 150, al_map_rgba_f(0, 0.5, 0.5, 1), Thickness); - al_draw_elliptical_arc(-20, 0, 300, 200, -ALLEGRO_PI / 2, -ALLEGRO_PI, al_map_rgba_f(0.25, 0.25, 0.5, 1), Thickness); - al_draw_arc(0, 0, 200, -ALLEGRO_PI / 2, ALLEGRO_PI, al_map_rgba_f(0.5, 0.25, 0, 1), Thickness); + al_draw_elliptical_arc(-20, 0, 300, 200, -A5O_PI / 2, -A5O_PI, al_map_rgba_f(0.25, 0.25, 0.5, 1), Thickness); + al_draw_arc(0, 0, 200, -A5O_PI / 2, A5O_PI, al_map_rgba_f(0.5, 0.25, 0, 1), Thickness); al_draw_spline(points, al_map_rgba_f(0.1, 0.2, 0.5, 1), Thickness); - al_draw_pieslice(0, 25, 150, ALLEGRO_PI * 3 / 4, -ALLEGRO_PI / 2, al_map_rgba_f(0.4, 0.3, 0.1, 1), Thickness); + al_draw_pieslice(0, 25, 150, A5O_PI * 3 / 4, -A5O_PI / 2, al_map_rgba_f(0.4, 0.3, 0.1, 1), Thickness); al_use_transform(&Identity); } @@ -397,15 +397,15 @@ static void TransformationsPrimitives(int mode) static void LowPrimitives(int mode) { - static ALLEGRO_VERTEX vtx[13]; - static ALLEGRO_VERTEX vtx2[13]; + static A5O_VERTEX vtx[13]; + static A5O_VERTEX vtx2[13]; if (mode == INIT) { int ii = 0; - ALLEGRO_COLOR color; + A5O_COLOR color; for (ii = 0; ii < 13; ii++) { float x, y; - x = 200 * cosf((float)ii / 13.0f * 2 * ALLEGRO_PI); - y = 200 * sinf((float)ii / 13.0f * 2 * ALLEGRO_PI); + x = 200 * cosf((float)ii / 13.0f * 2 * A5O_PI); + y = 200 * sinf((float)ii / 13.0f * 2 * A5O_PI); color = al_map_rgb((ii + 1) % 3 * 64, (ii + 2) % 3 * 64, (ii) % 3 * 64); @@ -419,16 +419,16 @@ static void LowPrimitives(int mode) al_build_transform(&MainTrans, ScreenW / 2, ScreenH / 2, 1, 1, Theta); } else if (mode == DRAW) { if (Blend) - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE); else - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_use_transform(&MainTrans); - al_draw_prim(vtx, 0, 0, 0, 4, ALLEGRO_PRIM_LINE_LIST); - al_draw_prim(vtx, 0, 0, 4, 9, ALLEGRO_PRIM_LINE_STRIP); - al_draw_prim(vtx, 0, 0, 9, 13, ALLEGRO_PRIM_LINE_LOOP); - al_draw_prim(vtx2, 0, 0, 0, 13, ALLEGRO_PRIM_POINT_LIST); + al_draw_prim(vtx, 0, 0, 0, 4, A5O_PRIM_LINE_LIST); + al_draw_prim(vtx, 0, 0, 4, 9, A5O_PRIM_LINE_STRIP); + al_draw_prim(vtx, 0, 0, 9, 13, A5O_PRIM_LINE_LOOP); + al_draw_prim(vtx2, 0, 0, 0, 13, A5O_PRIM_POINT_LIST); al_use_transform(&Identity); } @@ -439,15 +439,15 @@ static void IndexedPrimitives(int mode) static int indices1[] = {0, 1, 3, 4}; static int indices2[] = {5, 6, 7, 8}; static int indices3[] = {9, 10, 11, 12}; - static ALLEGRO_VERTEX vtx[13]; - static ALLEGRO_VERTEX vtx2[13]; + static A5O_VERTEX vtx[13]; + static A5O_VERTEX vtx2[13]; if (mode == INIT) { int ii = 0; - ALLEGRO_COLOR color; + A5O_COLOR color; for (ii = 0; ii < 13; ii++) { float x, y; - x = 200 * cosf((float)ii / 13.0f * 2 * ALLEGRO_PI); - y = 200 * sinf((float)ii / 13.0f * 2 * ALLEGRO_PI); + x = 200 * cosf((float)ii / 13.0f * 2 * A5O_PI); + y = 200 * sinf((float)ii / 13.0f * 2 * A5O_PI); color = al_map_rgb((ii + 1) % 3 * 64, (ii + 2) % 3 * 64, (ii) % 3 * 64); @@ -468,16 +468,16 @@ static void IndexedPrimitives(int mode) al_build_transform(&MainTrans, ScreenW / 2, ScreenH / 2, 1, 1, Theta); } else if (mode == DRAW) { if (Blend) - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE); else - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_use_transform(&MainTrans); - al_draw_indexed_prim(vtx, 0, 0, indices1, 4, ALLEGRO_PRIM_LINE_LIST); - al_draw_indexed_prim(vtx, 0, 0, indices2, 4, ALLEGRO_PRIM_LINE_STRIP); - al_draw_indexed_prim(vtx, 0, 0, indices3, 4, ALLEGRO_PRIM_LINE_LOOP); - al_draw_indexed_prim(vtx2, 0, 0, indices3, 4, ALLEGRO_PRIM_POINT_LIST); + al_draw_indexed_prim(vtx, 0, 0, indices1, 4, A5O_PRIM_LINE_LIST); + al_draw_indexed_prim(vtx, 0, 0, indices2, 4, A5O_PRIM_LINE_STRIP); + al_draw_indexed_prim(vtx, 0, 0, indices3, 4, A5O_PRIM_LINE_LOOP); + al_draw_indexed_prim(vtx2, 0, 0, indices3, 4, A5O_PRIM_POINT_LIST); al_use_transform(&Identity); } @@ -485,19 +485,19 @@ static void IndexedPrimitives(int mode) static void VertexBuffers(int mode) { - static ALLEGRO_VERTEX vtx[13]; - static ALLEGRO_VERTEX vtx2[13]; - static ALLEGRO_VERTEX_BUFFER* vbuff; - static ALLEGRO_VERTEX_BUFFER* vbuff2; + static A5O_VERTEX vtx[13]; + static A5O_VERTEX vtx2[13]; + static A5O_VERTEX_BUFFER* vbuff; + static A5O_VERTEX_BUFFER* vbuff2; static bool no_soft; static bool no_soft2; if (mode == INIT) { int ii = 0; - ALLEGRO_COLOR color; + A5O_COLOR color; for (ii = 0; ii < 13; ii++) { float x, y; - x = 200 * cosf((float)ii / 13.0f * 2 * ALLEGRO_PI); - y = 200 * sinf((float)ii / 13.0f * 2 * ALLEGRO_PI); + x = 200 * cosf((float)ii / 13.0f * 2 * A5O_PI); + y = 200 * sinf((float)ii / 13.0f * 2 * A5O_PI); color = al_map_rgb((ii + 1) % 3 * 64, (ii + 2) % 3 * 64, (ii) % 3 * 64); @@ -506,7 +506,7 @@ static void VertexBuffers(int mode) vtx[ii].color = color; vtx2[ii].color = color; } - vbuff = al_create_vertex_buffer(0, vtx, 13, ALLEGRO_PRIM_BUFFER_READWRITE); + vbuff = al_create_vertex_buffer(0, vtx, 13, A5O_PRIM_BUFFER_READWRITE); if (!vbuff) { vbuff = al_create_vertex_buffer(0, vtx, 13, 0); no_soft = true; @@ -515,7 +515,7 @@ static void VertexBuffers(int mode) no_soft = false; } - vbuff2 = al_create_vertex_buffer(0, vtx2, 13, ALLEGRO_PRIM_BUFFER_READWRITE); + vbuff2 = al_create_vertex_buffer(0, vtx2, 13, A5O_PRIM_BUFFER_READWRITE); if (!vbuff2) { vbuff2 = al_create_vertex_buffer(0, vtx2, 13, 0); no_soft2 = true; @@ -528,23 +528,23 @@ static void VertexBuffers(int mode) al_build_transform(&MainTrans, ScreenW / 2, ScreenH / 2, 1, 1, Theta); } else if (mode == DRAW) { if (Blend) - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE); else - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_use_transform(&MainTrans); if (vbuff && !(Soft && no_soft)) { - al_draw_vertex_buffer(vbuff, 0, 0, 4, ALLEGRO_PRIM_LINE_LIST); - al_draw_vertex_buffer(vbuff, 0, 4, 9, ALLEGRO_PRIM_LINE_STRIP); - al_draw_vertex_buffer(vbuff, 0, 9, 13, ALLEGRO_PRIM_LINE_LOOP); + al_draw_vertex_buffer(vbuff, 0, 0, 4, A5O_PRIM_LINE_LIST); + al_draw_vertex_buffer(vbuff, 0, 4, 9, A5O_PRIM_LINE_STRIP); + al_draw_vertex_buffer(vbuff, 0, 9, 13, A5O_PRIM_LINE_LOOP); } else { al_draw_text(Font, al_map_rgb_f(1, 1, 1), 0, -40, 0, "Vertex buffers not supported"); } if (vbuff2 && !(Soft && no_soft2)) { - al_draw_vertex_buffer(vbuff2, 0, 0, 13, ALLEGRO_PRIM_POINT_LIST); + al_draw_vertex_buffer(vbuff2, 0, 0, 13, A5O_PRIM_POINT_LIST); } else { al_draw_text(Font, al_map_rgb_f(1, 1, 1), 0, 40, 0, "Vertex buffers not supported"); @@ -559,16 +559,16 @@ static void VertexBuffers(int mode) static void IndexedBuffers(int mode) { - static ALLEGRO_VERTEX_BUFFER* vbuff; - static ALLEGRO_INDEX_BUFFER* ibuff; + static A5O_VERTEX_BUFFER* vbuff; + static A5O_INDEX_BUFFER* ibuff; static bool soft = true; if (mode == INIT) { int ii; - ALLEGRO_COLOR color; - ALLEGRO_VERTEX* vtx; - int flags = ALLEGRO_PRIM_BUFFER_READWRITE; + A5O_COLOR color; + A5O_VERTEX* vtx; + int flags = A5O_PRIM_BUFFER_READWRITE; - vbuff = al_create_vertex_buffer(NULL, NULL, 13, ALLEGRO_PRIM_BUFFER_READWRITE); + vbuff = al_create_vertex_buffer(NULL, NULL, 13, A5O_PRIM_BUFFER_READWRITE); if (vbuff == NULL) { vbuff = al_create_vertex_buffer(NULL, NULL, 13, 0); soft = false; @@ -578,12 +578,12 @@ static void IndexedBuffers(int mode) ibuff = al_create_index_buffer(sizeof(short), NULL, 8, flags); if (vbuff) { - vtx = al_lock_vertex_buffer(vbuff, 0, 13, ALLEGRO_LOCK_WRITEONLY); + vtx = al_lock_vertex_buffer(vbuff, 0, 13, A5O_LOCK_WRITEONLY); for (ii = 0; ii < 13; ii++) { float x, y; - x = 200 * cosf((float)ii / 13.0f * 2 * ALLEGRO_PI); - y = 200 * sinf((float)ii / 13.0f * 2 * ALLEGRO_PI); + x = 200 * cosf((float)ii / 13.0f * 2 * A5O_PI); + y = 200 * sinf((float)ii / 13.0f * 2 * A5O_PI); color = al_map_rgb((ii + 1) % 3 * 64, (ii + 2) % 3 * 64, (ii) % 3 * 64); @@ -599,7 +599,7 @@ static void IndexedBuffers(int mode) if (ibuff) { int ii; int t = (int)al_get_time(); - short* indices = al_lock_index_buffer(ibuff, 0, 8, ALLEGRO_LOCK_WRITEONLY); + short* indices = al_lock_index_buffer(ibuff, 0, 8, A5O_LOCK_WRITEONLY); for (ii = 0; ii < 8; ii++) { indices[ii] = (t + ii) % 13; @@ -611,15 +611,15 @@ static void IndexedBuffers(int mode) al_build_transform(&MainTrans, ScreenW / 2, ScreenH / 2, 1, 1, Theta); } else if (mode == DRAW) { if (Blend) - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE); else - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_use_transform(&MainTrans); if(!(Soft && !soft) && vbuff && ibuff) { - al_draw_indexed_buffer(vbuff, NULL, ibuff, 0, 4, ALLEGRO_PRIM_LINE_LIST); - al_draw_indexed_buffer(vbuff, NULL, ibuff, 4, 8, ALLEGRO_PRIM_LINE_STRIP); + al_draw_indexed_buffer(vbuff, NULL, ibuff, 0, 4, A5O_PRIM_LINE_LIST); + al_draw_indexed_buffer(vbuff, NULL, ibuff, 4, 8, A5O_PRIM_LINE_STRIP); } else { al_draw_text(Font, al_map_rgb_f(1, 1, 1), 0, 0, 0, "Indexed buffers not supported"); @@ -634,10 +634,10 @@ static void IndexedBuffers(int mode) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP* bkg; - ALLEGRO_COLOR black; - ALLEGRO_EVENT_QUEUE *queue; + A5O_DISPLAY *display; + A5O_BITMAP* bkg; + A5O_COLOR black; + A5O_EVENT_QUEUE *queue; bool use_shader = false; if (argc > 1) { @@ -659,7 +659,7 @@ int main(int argc, char **argv) init_platform_specific(); if (use_shader) { - al_set_new_display_flags(ALLEGRO_PROGRAMMABLE_PIPELINE); + al_set_new_display_flags(A5O_PROGRAMMABLE_PIPELINE); } // Create a window to display things on: 640x480 pixels @@ -687,7 +687,7 @@ int main(int argc, char **argv) bkg = al_load_bitmap("data/bkg.png"); - al_set_new_bitmap_wrap(ALLEGRO_BITMAP_WRAP_CLAMP, ALLEGRO_BITMAP_WRAP_MIRROR); + al_set_new_bitmap_wrap(A5O_BITMAP_WRAP_CLAMP, A5O_BITMAP_WRAP_MIRROR); Texture = al_load_bitmap("data/texture.tga"); // Make and set some color to draw with @@ -712,17 +712,17 @@ int main(int argc, char **argv) int cur_screen = 0; bool done = false; int clip = 0; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *timer_queue; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *timer_queue; int old; - timer = al_create_timer(ALLEGRO_BPS_TO_SECS(refresh_rate)); + timer = al_create_timer(A5O_BPS_TO_SECS(refresh_rate)); al_start_timer(timer); timer_queue = al_create_event_queue(); al_register_event_source(timer_queue, al_get_timer_event_source(timer)); old = al_get_new_bitmap_flags(); - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); Buffer = al_create_bitmap(ScreenW, ScreenH); al_set_new_bitmap_flags(old); @@ -770,7 +770,7 @@ int main(int argc, char **argv) } while (real_time - game_time >= 0) { - ALLEGRO_EVENT key_event; + A5O_EVENT key_event; double start_time = al_get_time(); game_time += fixed_timestep; @@ -778,7 +778,7 @@ int main(int argc, char **argv) while (al_get_next_event(queue, &key_event)) { switch (key_event.type) { - case ALLEGRO_EVENT_MOUSE_BUTTON_DOWN: { + case A5O_EVENT_MOUSE_BUTTON_DOWN: { cur_screen++; if (cur_screen >= NUM_SCREENS) { cur_screen = 0; @@ -786,72 +786,72 @@ int main(int argc, char **argv) break; } - case ALLEGRO_EVENT_DISPLAY_CLOSE: { + case A5O_EVENT_DISPLAY_CLOSE: { done = true; break; } - case ALLEGRO_EVENT_KEY_CHAR: { + case A5O_EVENT_KEY_CHAR: { switch (key_event.keyboard.keycode) { - case ALLEGRO_KEY_ESCAPE: { + case A5O_KEY_ESCAPE: { done = true; break; } - case ALLEGRO_KEY_S: { + case A5O_KEY_S: { Soft = !Soft; time_diff = al_get_time(); frames_done = 0; break; } - case ALLEGRO_KEY_C: { + case A5O_KEY_C: { clip = !clip; time_diff = al_get_time(); frames_done = 0; break; } - case ALLEGRO_KEY_L: { + case A5O_KEY_L: { Blend = !Blend; time_diff = al_get_time(); frames_done = 0; break; } - case ALLEGRO_KEY_B: { + case A5O_KEY_B: { Background = !Background; time_diff = al_get_time(); frames_done = 0; break; } - case ALLEGRO_KEY_LEFT: { + case A5O_KEY_LEFT: { Speed -= ROTATE_SPEED; break; } - case ALLEGRO_KEY_RIGHT: { + case A5O_KEY_RIGHT: { Speed += ROTATE_SPEED; break; } - case ALLEGRO_KEY_PGUP: { + case A5O_KEY_PGUP: { Thickness += 0.5f; if (Thickness < 1.0f) Thickness = 1.0f; break; } - case ALLEGRO_KEY_PGDN: { + case A5O_KEY_PGDN: { Thickness -= 0.5f; if (Thickness < 1.0f) Thickness = 0.0f; break; } - case ALLEGRO_KEY_UP: { + case A5O_KEY_UP: { cur_screen++; if (cur_screen >= NUM_SCREENS) { cur_screen = 0; } break; } - case ALLEGRO_KEY_SPACE: { + case A5O_KEY_SPACE: { Speed = 0; break; } - case ALLEGRO_KEY_DOWN: { + case A5O_KEY_DOWN: { cur_screen--; if (cur_screen < 0) { cur_screen = NUM_SCREENS - 1; @@ -876,7 +876,7 @@ int main(int argc, char **argv) } if (Background && bkg) { - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_draw_scaled_bitmap(bkg, 0, 0, al_get_bitmap_width(bkg), al_get_bitmap_height(bkg), 0, 0, ScreenW, ScreenH, 0); } @@ -889,13 +889,13 @@ int main(int argc, char **argv) al_set_clipping_rectangle(0, 0, ScreenW, ScreenH); if (Soft == 1) { - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_set_target_backbuffer(display); al_draw_bitmap(Buffer, 0, 0, 0); } - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); - al_draw_textf(Font, solid_white, ScreenW / 2, ScreenH - 20, ALLEGRO_ALIGN_CENTRE, "%s", ScreenName[cur_screen]); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); + al_draw_textf(Font, solid_white, ScreenW / 2, ScreenH - 20, A5O_ALIGN_CENTRE, "%s", ScreenName[cur_screen]); al_draw_textf(Font, solid_white, 0, 0, 0, "FPS: %f", (float)frames_done / (al_get_time() - time_diff)); al_draw_textf(Font, solid_white, 0, 20, 0, "Change Screen (Up/Down). Esc to Quit."); al_draw_textf(Font, solid_white, 0, 40, 0, "Rotation (Left/Right/Space): %f", Speed); diff --git a/examples/ex_prim_shader.c b/examples/ex_prim_shader.c index 9ec3be1456..7c3a6f6d51 100644 --- a/examples/ex_prim_shader.c +++ b/examples/ex_prim_shader.c @@ -2,7 +2,7 @@ #include #include -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include "allegro5/allegro.h" #include "allegro5/allegro_primitives.h" @@ -27,8 +27,8 @@ static void setup_vertex(CUSTOM_VERTEX* vtx, int ring, int segment, bool inside) { float len; float x, y, z; - x = ring * RING_SIZE * cosf(2 * ALLEGRO_PI * segment / NUM_SEGMENTS); - y = ring * RING_SIZE * sinf(2 * ALLEGRO_PI * segment / NUM_SEGMENTS); + x = ring * RING_SIZE * cosf(2 * A5O_PI * segment / NUM_SEGMENTS); + y = ring * RING_SIZE * sinf(2 * A5O_PI * segment / NUM_SEGMENTS); vtx->x = x + SCREEN_WIDTH / 2; vtx->y = y + SCREEN_HEIGHT / 2; @@ -53,15 +53,15 @@ static void setup_vertex(CUSTOM_VERTEX* vtx, int ring, int segment, bool inside) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; + A5O_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; bool redraw = true; - ALLEGRO_SHADER *shader; - ALLEGRO_VERTEX_DECL *vertex_decl; - ALLEGRO_VERTEX_ELEMENT vertex_elems[] = { - {ALLEGRO_PRIM_POSITION, ALLEGRO_PRIM_FLOAT_2, offsetof(CUSTOM_VERTEX, x)}, - {ALLEGRO_PRIM_USER_ATTR, ALLEGRO_PRIM_FLOAT_3, offsetof(CUSTOM_VERTEX, nx)}, + A5O_SHADER *shader; + A5O_VERTEX_DECL *vertex_decl; + A5O_VERTEX_ELEMENT vertex_elems[] = { + {A5O_PRIM_POSITION, A5O_PRIM_FLOAT_2, offsetof(CUSTOM_VERTEX, x)}, + {A5O_PRIM_USER_ATTR, A5O_PRIM_FLOAT_3, offsetof(CUSTOM_VERTEX, nx)}, {0, 0, 0} }; CUSTOM_VERTEX vertices[NUM_VERTICES]; @@ -87,7 +87,7 @@ int main(int argc, char **argv) abort_example("Could not init primitives addon.\n"); } init_platform_specific(); - al_set_new_display_flags(ALLEGRO_PROGRAMMABLE_PIPELINE); + al_set_new_display_flags(A5O_PROGRAMMABLE_PIPELINE); display = al_create_display(SCREEN_WIDTH, SCREEN_HEIGHT); if (!display) { abort_example("Error creating display.\n"); @@ -114,13 +114,13 @@ int main(int argc, char **argv) } } - shader = al_create_shader(ALLEGRO_SHADER_AUTO); + shader = al_create_shader(A5O_SHADER_AUTO); if (!shader) { abort_example("Failed to create shader."); } - if (al_get_shader_platform(shader) == ALLEGRO_SHADER_GLSL) { + if (al_get_shader_platform(shader) == A5O_SHADER_GLSL) { vertex_shader_file = "data/ex_prim_shader_vertex.glsl"; pixel_shader_file = "data/ex_prim_shader_pixel.glsl"; } @@ -129,11 +129,11 @@ int main(int argc, char **argv) pixel_shader_file = "data/ex_prim_shader_pixel.hlsl"; } - if (!al_attach_shader_source_file(shader, ALLEGRO_VERTEX_SHADER, vertex_shader_file)) { + if (!al_attach_shader_source_file(shader, A5O_VERTEX_SHADER, vertex_shader_file)) { abort_example("al_attach_shader_source_file for vertex shader failed: %s\n", al_get_shader_log(shader)); } - if (!al_attach_shader_source_file(shader, ALLEGRO_PIXEL_SHADER, pixel_shader_file)) { + if (!al_attach_shader_source_file(shader, A5O_PIXEL_SHADER, pixel_shader_file)) { abort_example("al_attach_shader_source_file for pixel shader failed: %s\n", al_get_shader_log(shader)); } @@ -160,22 +160,22 @@ int main(int argc, char **argv) al_start_timer(timer); while (!quit) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: quit = true; break; - case ALLEGRO_EVENT_MOUSE_AXES: + case A5O_EVENT_MOUSE_AXES: light_position[0] = event.mouse.x; light_position[1] = event.mouse.y; break; - case ALLEGRO_EVENT_KEY_CHAR: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_CHAR: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) quit = true; break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: redraw = true; break; } @@ -184,7 +184,7 @@ int main(int argc, char **argv) al_clear_to_color(al_map_rgb_f(0, 0, 0)); al_set_shader_float_vector("light_position", 3, light_position, 1); - al_draw_prim(vertices, vertex_decl, NULL, 0, NUM_VERTICES, ALLEGRO_PRIM_TRIANGLE_LIST); + al_draw_prim(vertices, vertex_decl, NULL, 0, NUM_VERTICES, A5O_PRIM_TRIANGLE_LIST); al_flip_display(); redraw = false; diff --git a/examples/ex_prim_wrap.c b/examples/ex_prim_wrap.c index 7869c81181..56e0643dc6 100644 --- a/examples/ex_prim_wrap.c +++ b/examples/ex_prim_wrap.c @@ -12,7 +12,7 @@ * * See readme.txt for copyright information. */ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include "allegro5/allegro.h" #include "allegro5/allegro_image.h" @@ -28,30 +28,30 @@ typedef enum { NUM_TYPES, } PRIM_TYPE; -static void draw_square(ALLEGRO_BITMAP* texture, float x, float y, float w, float h, int prim_type) +static void draw_square(A5O_BITMAP* texture, float x, float y, float w, float h, int prim_type) { - ALLEGRO_COLOR c = al_map_rgb_f(1, 1, 1); + A5O_COLOR c = al_map_rgb_f(1, 1, 1); switch (prim_type) { case TRIANGLES: { - ALLEGRO_VERTEX vtxs[4] = { + A5O_VERTEX vtxs[4] = { /* x y z u v c */ {x, y, 0., -2 * w, -2 * h, c}, {x + 5 * w, y, 0., 3 * w, -2 * h, c}, {x + 5 * w, y + 5 * h, 0., 3 * w, 3 * h, c}, {x, y + 5 * h, 0., -2 * w, 3 * h, c}, }; - al_draw_prim(vtxs, NULL, texture, 0, 4, ALLEGRO_PRIM_TRIANGLE_FAN); + al_draw_prim(vtxs, NULL, texture, 0, 4, A5O_PRIM_TRIANGLE_FAN); break; } case POINTS: { #define POINTS_N 32 float d = POINTS_N - 1; - ALLEGRO_VERTEX vtxs[POINTS_N * POINTS_N]; + A5O_VERTEX vtxs[POINTS_N * POINTS_N]; for (int iy = 0; iy < POINTS_N; iy++) { for (int ix = 0; ix < POINTS_N; ix++) { - ALLEGRO_VERTEX *v = &vtxs[iy * POINTS_N + ix]; + A5O_VERTEX *v = &vtxs[iy * POINTS_N + ix]; v->x = x + 5. * w * (float)ix / d; v->y = y + 5. * h * (float)iy / d; v->z = 0.; @@ -61,17 +61,17 @@ static void draw_square(ALLEGRO_BITMAP* texture, float x, float y, float w, floa } } - al_draw_prim(vtxs, NULL, texture, 0, POINTS_N * POINTS_N, ALLEGRO_PRIM_POINT_LIST); + al_draw_prim(vtxs, NULL, texture, 0, POINTS_N * POINTS_N, A5O_PRIM_POINT_LIST); break; } case LINES: { #define LINES_N 32 float d = LINES_N - 1; - ALLEGRO_VERTEX vtxs[2 * LINES_N * 2]; + A5O_VERTEX vtxs[2 * LINES_N * 2]; for (int iy = 0; iy < LINES_N; iy++) { for (int ix = 0; ix < 2; ix++) { - ALLEGRO_VERTEX *v = &vtxs[ix + 2 * iy]; + A5O_VERTEX *v = &vtxs[ix + 2 * iy]; v->x = x + 5. * w * (float)ix; v->y = y + 5. * h * (float)iy / d; v->z = 0.; @@ -82,7 +82,7 @@ static void draw_square(ALLEGRO_BITMAP* texture, float x, float y, float w, floa } for (int iy = 0; iy < 2; iy++) { for (int ix = 0; ix < LINES_N; ix++) { - ALLEGRO_VERTEX *v = &vtxs[2 * ix + iy + 2 * LINES_N]; + A5O_VERTEX *v = &vtxs[2 * ix + iy + 2 * LINES_N]; v->x = x + 5. * w * (float)ix / d; v->y = y + 5. * h * (float)iy; v->z = 0.; @@ -91,7 +91,7 @@ static void draw_square(ALLEGRO_BITMAP* texture, float x, float y, float w, floa v->color = c; } } - al_draw_prim(vtxs, NULL, texture, 0, 4 * LINES_N, ALLEGRO_PRIM_LINE_LIST); + al_draw_prim(vtxs, NULL, texture, 0, 4 * LINES_N, A5O_PRIM_LINE_LIST); break; } } @@ -119,20 +119,20 @@ int main(int argc, char **argv) } if (allow_shader) - al_set_new_display_flags(ALLEGRO_PROGRAMMABLE_PIPELINE); - ALLEGRO_DISPLAY *display = al_create_display(1024, 1024); + al_set_new_display_flags(A5O_PROGRAMMABLE_PIPELINE); + A5O_DISPLAY *display = al_create_display(1024, 1024); if (!display) abort_example("Error creating display\n"); - ALLEGRO_BITMAP *bitmap = al_load_bitmap("data/texture2.tga"); + A5O_BITMAP *bitmap = al_load_bitmap("data/texture2.tga"); if (!bitmap) abort_example("Could not load 'data/texture2.tga'.\n"); - ALLEGRO_BITMAP_WRAP wrap_settings[4] = { - ALLEGRO_BITMAP_WRAP_DEFAULT, - ALLEGRO_BITMAP_WRAP_REPEAT, - ALLEGRO_BITMAP_WRAP_CLAMP, - ALLEGRO_BITMAP_WRAP_MIRROR, + A5O_BITMAP_WRAP wrap_settings[4] = { + A5O_BITMAP_WRAP_DEFAULT, + A5O_BITMAP_WRAP_REPEAT, + A5O_BITMAP_WRAP_CLAMP, + A5O_BITMAP_WRAP_MIRROR, }; const char* wrap_names[4] = { "DEFAULT", @@ -146,7 +146,7 @@ int main(int argc, char **argv) "LINES", }; - ALLEGRO_BITMAP *bitmaps[4][4]; + A5O_BITMAP *bitmaps[4][4]; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { al_set_new_bitmap_wrap(wrap_settings[i], wrap_settings[j]); @@ -154,29 +154,29 @@ int main(int argc, char **argv) } } - ALLEGRO_FONT *font = al_create_builtin_font(); + A5O_FONT *font = al_create_builtin_font(); - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); - ALLEGRO_BITMAP *memory_buffer = al_create_bitmap(al_get_display_width(display), + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); + A5O_BITMAP *memory_buffer = al_create_bitmap(al_get_display_width(display), al_get_display_height(display)); - al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP); - ALLEGRO_BITMAP *display_buffer = al_get_backbuffer(display); + al_set_new_bitmap_flags(A5O_VIDEO_BITMAP); + A5O_BITMAP *display_buffer = al_get_backbuffer(display); - ALLEGRO_SHADER *shader = NULL; + A5O_SHADER *shader = NULL; if (allow_shader) { - shader = al_create_shader(ALLEGRO_SHADER_AUTO); + shader = al_create_shader(A5O_SHADER_AUTO); if (!shader) abort_example("Error creating shader.\n"); const char* pixel_file; - if (al_get_shader_platform(shader) == ALLEGRO_SHADER_GLSL) { - #ifdef ALLEGRO_CFG_SHADER_GLSL + if (al_get_shader_platform(shader) == A5O_SHADER_GLSL) { + #ifdef A5O_CFG_SHADER_GLSL pixel_file = "data/ex_bitmap_wrap_pixel.glsl"; #endif } else { - #ifdef ALLEGRO_CFG_SHADER_HLSL + #ifdef A5O_CFG_SHADER_HLSL pixel_file = "data/ex_bitmap_wrap_pixel.hlsl"; #endif } @@ -184,18 +184,18 @@ int main(int argc, char **argv) if (!pixel_file) { abort_example("No shader source\n"); } - if (!al_attach_shader_source(shader, ALLEGRO_VERTEX_SHADER, - al_get_default_shader_source(ALLEGRO_SHADER_AUTO, ALLEGRO_VERTEX_SHADER))) { + if (!al_attach_shader_source(shader, A5O_VERTEX_SHADER, + al_get_default_shader_source(A5O_SHADER_AUTO, A5O_VERTEX_SHADER))) { abort_example("al_attach_shader_source for vertex shader failed: %s\n", al_get_shader_log(shader)); } - if (!al_attach_shader_source_file(shader, ALLEGRO_PIXEL_SHADER, pixel_file)) + if (!al_attach_shader_source_file(shader, A5O_PIXEL_SHADER, pixel_file)) abort_example("al_attach_shader_source_file for pixel shader failed: %s\n", al_get_shader_log(shader)); if (!al_build_shader(shader)) abort_example("al_build_shader failed: %s\n", al_get_shader_log(shader)); } - ALLEGRO_TIMER *timer = al_create_timer(1.0 / 60); - ALLEGRO_EVENT_QUEUE *queue = al_create_event_queue(); + A5O_TIMER *timer = al_create_timer(1.0 / 60); + A5O_EVENT_QUEUE *queue = al_create_event_queue(); al_register_event_source(queue, al_get_keyboard_event_source()); al_register_event_source(queue, al_get_display_event_source(display)); al_register_event_source(queue, al_get_timer_event_source(timer)); @@ -207,28 +207,28 @@ int main(int argc, char **argv) bool quit = false; while (!quit) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) + if (event.type == A5O_EVENT_DISPLAY_CLOSE) break; - if (event.type == ALLEGRO_EVENT_KEY_CHAR) { + if (event.type == A5O_EVENT_KEY_CHAR) { switch (event.keyboard.keycode) { - case ALLEGRO_KEY_ESCAPE: + case A5O_KEY_ESCAPE: quit = true; break; - case ALLEGRO_KEY_S: + case A5O_KEY_S: software = !software; break; - case ALLEGRO_KEY_R: + case A5O_KEY_R: if (allow_shader) use_shader = !use_shader; break; - case ALLEGRO_KEY_P: + case A5O_KEY_P: prim_type = (prim_type + 1) % NUM_TYPES; break; } } - if (event.type == ALLEGRO_EVENT_TIMER) { + if (event.type == A5O_EVENT_TIMER) { redraw = true; } @@ -253,19 +253,19 @@ int main(int argc, char **argv) } al_draw_textf(font, al_map_rgb_f(1., 1., 0.5), 16, 16, - ALLEGRO_ALIGN_LEFT, "(S)oftware: %s", (software && !use_shader) ? "On" : "Off"); + A5O_ALIGN_LEFT, "(S)oftware: %s", (software && !use_shader) ? "On" : "Off"); al_draw_textf(font, al_map_rgb_f(1., 1., 0.5), 16, 32, - ALLEGRO_ALIGN_LEFT, "Shade(r) (--shader to enable): %s", use_shader ? "On" : "Off"); + A5O_ALIGN_LEFT, "Shade(r) (--shader to enable): %s", use_shader ? "On" : "Off"); al_draw_textf(font, al_map_rgb_f(1., 1., 0.5), 16, 48, - ALLEGRO_ALIGN_LEFT, "(P)rimitive type: %s", prim_names[prim_type]); + A5O_ALIGN_LEFT, "(P)rimitive type: %s", prim_names[prim_type]); for (int i = 0; i < 4; i++) { al_draw_text(font, al_map_rgb_f(1., 0.5, 1.), offt_x + spacing + w * i + w / 2, - 64, ALLEGRO_ALIGN_CENTRE, wrap_names[i]); + 64, A5O_ALIGN_CENTRE, wrap_names[i]); for (int j = 0; j < 4; j++) { if (i == 0) { al_draw_text(font, al_map_rgb_f(1., 0.5, 1.), 16, - offt_y + spacing + h * j + h / 2, ALLEGRO_ALIGN_LEFT, wrap_names[j]); + offt_y + spacing + h * j + h / 2, A5O_ALIGN_LEFT, wrap_names[j]); } if (use_shader) { al_use_shader(shader); diff --git a/examples/ex_projection.c b/examples/ex_projection.c index bdf4a92bc7..04bdbbf0fd 100644 --- a/examples/ex_projection.c +++ b/examples/ex_projection.c @@ -11,13 +11,13 @@ static float scroll_y; static int text_length; /* The Alex logo. */ -static ALLEGRO_BITMAP *logo; +static A5O_BITMAP *logo; /* The star particle. */ -static ALLEGRO_BITMAP *particle; +static A5O_BITMAP *particle; /* The font we use for everything. */ -static ALLEGRO_FONT *font; +static A5O_FONT *font; /* Local pseudo-random number generator. */ @@ -51,7 +51,7 @@ static void *load(char const *path, char const *type, ...) /* Print fading text. */ -static int print(ALLEGRO_FONT *font, float x, float y, float r, float g, +static int print(A5O_FONT *font, float x, float y, float r, float g, float b, float fade, char const *text) { float c = 1 + (y - fade) / 360 / 2.0; @@ -60,7 +60,7 @@ static int print(ALLEGRO_FONT *font, float x, float y, float r, float g, if (c < 0) c = 0; al_draw_text(font, al_map_rgba_f(c * r, c * g, c * b, c), x, y, - ALLEGRO_ALIGN_CENTER, text); + A5O_ALIGN_CENTER, text); return y + al_get_font_line_height(font); } @@ -69,9 +69,9 @@ static int print(ALLEGRO_FONT *font, float x, float y, float r, float g, * 180 vertical units with square pixel aspect and 90ยฐ vertical * FoV. */ -static void setup_3d_projection(ALLEGRO_TRANSFORM *projection) +static void setup_3d_projection(A5O_TRANSFORM *projection) { - ALLEGRO_DISPLAY *display = al_get_current_display(); + A5O_DISPLAY *display = al_get_current_display(); int dw = al_get_display_width(display); int dh = al_get_display_height(display); al_perspective_transform(projection, -180 * dw / dh, -180, 180, @@ -83,11 +83,11 @@ static void setup_3d_projection(ALLEGRO_TRANSFORM *projection) /* 3D transformations make it very easy to draw a starfield. */ static void draw_stars(void) { - ALLEGRO_TRANSFORM projection; + A5O_TRANSFORM projection; int seed; int i; - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE); seed = 0; for (i = 0; i < 100; i++) { @@ -107,12 +107,12 @@ static void draw_stars(void) /* The main part of this example. */ static void draw_scrolling_text(void) { - ALLEGRO_TRANSFORM projection; + A5O_TRANSFORM projection; int bw = al_get_bitmap_width(logo); int bh = al_get_bitmap_height(logo); float x, y, c; - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_identity_transform(&projection); @@ -125,7 +125,7 @@ static void draw_scrolling_text(void) /* Then we tilt it backwards 30 degrees. */ al_rotate_transform_3d(&projection, 1, 0, 0, - 30 * ALLEGRO_PI / 180.0); + 30 * A5O_PI / 180.0); /* And finally move it down so the 0 position ends up * at the bottom of the screen. @@ -170,7 +170,7 @@ static void draw_scrolling_text(void) static void draw_intro_text(void) { - ALLEGRO_TRANSFORM projection; + A5O_TRANSFORM projection; int fade; int fh = al_get_font_line_height(font); @@ -190,9 +190,9 @@ static void draw_intro_text(void) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; + A5O_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; int redraw = 0; (void)argc; @@ -207,14 +207,14 @@ int main(int argc, char **argv) init_platform_specific(); al_install_keyboard(); - al_set_new_display_flags(ALLEGRO_RESIZABLE); + al_set_new_display_flags(A5O_RESIZABLE); display = al_create_display(640, 360); if (!display) { abort_example("Error creating display\n"); } - al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR | - ALLEGRO_MIPMAP); + al_set_new_bitmap_flags(A5O_MIN_LINEAR | A5O_MAG_LINEAR | + A5O_MIPMAP); font = load("data/DejaVuSans.ttf", "font", 40, 0); logo = load("data/alexlogo.png", "bitmap"); @@ -234,19 +234,19 @@ int main(int argc, char **argv) al_start_timer(timer); while (true) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) + if (event.type == A5O_EVENT_DISPLAY_CLOSE) break; - else if (event.type == ALLEGRO_EVENT_DISPLAY_RESIZE) { + else if (event.type == A5O_EVENT_DISPLAY_RESIZE) { al_acknowledge_resize(display); } - else if (event.type == ALLEGRO_EVENT_KEY_DOWN && - event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + else if (event.type == A5O_EVENT_KEY_DOWN && + event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } - else if (event.type == ALLEGRO_EVENT_TIMER) { + else if (event.type == A5O_EVENT_TIMER) { scroll_y++; if (scroll_y > text_length * 2) scroll_y -= text_length * 2; @@ -255,7 +255,7 @@ int main(int argc, char **argv) } if (redraw && al_is_event_queue_empty(queue)) { - ALLEGRO_COLOR black = al_map_rgba_f(0, 0, 0, 1); + A5O_COLOR black = al_map_rgba_f(0, 0, 0, 1); al_clear_to_color(black); diff --git a/examples/ex_projection2.c b/examples/ex_projection2.c index 49a16c9ac4..7b48e850ee 100644 --- a/examples/ex_projection2.c +++ b/examples/ex_projection2.c @@ -7,11 +7,11 @@ #include "common.c" -static void draw_pyramid(ALLEGRO_BITMAP* texture, float x, float y, float z, float theta) +static void draw_pyramid(A5O_BITMAP* texture, float x, float y, float z, float theta) { - ALLEGRO_COLOR c = al_map_rgb_f(1, 1, 1); - ALLEGRO_TRANSFORM t; - ALLEGRO_VERTEX vtx[5] = { + A5O_COLOR c = al_map_rgb_f(1, 1, 1); + A5O_TRANSFORM t; + A5O_VERTEX vtx[5] = { /* x y z u v c */ { 0, 1, 0, 0, 64, c}, {-1, -1, -1, 0, 0, c}, @@ -30,12 +30,12 @@ static void draw_pyramid(ALLEGRO_BITMAP* texture, float x, float y, float z, flo al_rotate_transform_3d(&t, 0, 1, 0, theta); al_translate_transform_3d(&t, x, y, z); al_use_transform(&t); - al_draw_indexed_prim(vtx, NULL, texture, indices, 12, ALLEGRO_PRIM_TRIANGLE_LIST); + al_draw_indexed_prim(vtx, NULL, texture, indices, 12, A5O_PRIM_TRIANGLE_LIST); } -static void set_perspective_transform(ALLEGRO_BITMAP* bmp) +static void set_perspective_transform(A5O_BITMAP* bmp) { - ALLEGRO_TRANSFORM p; + A5O_TRANSFORM p; float aspect_ratio = (float)al_get_bitmap_height(bmp) / al_get_bitmap_width(bmp); al_set_target_bitmap(bmp); al_identity_transform(&p); @@ -45,24 +45,24 @@ static void set_perspective_transform(ALLEGRO_BITMAP* bmp) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_BITMAP *texture; - ALLEGRO_BITMAP *display_sub_persp; - ALLEGRO_BITMAP *display_sub_ortho; - ALLEGRO_BITMAP *buffer; - ALLEGRO_FONT *font; + A5O_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_BITMAP *texture; + A5O_BITMAP *display_sub_persp; + A5O_BITMAP *display_sub_ortho; + A5O_BITMAP *buffer; + A5O_FONT *font; bool redraw = false; bool quit = false; bool fullscreen = false; bool background = false; - int display_flags = ALLEGRO_RESIZABLE; + int display_flags = A5O_RESIZABLE; float theta = 0; if (argc > 1) { if(strcmp(argv[1], "--use-shaders") == 0) { - display_flags |= ALLEGRO_PROGRAMMABLE_PIPELINE; + display_flags |= A5O_PROGRAMMABLE_PIPELINE; } else { abort_example("Unknown command line argument: %s\n", argv[1]); @@ -79,10 +79,10 @@ int main(int argc, char **argv) al_install_keyboard(); al_set_new_display_flags(display_flags); - al_set_new_display_option(ALLEGRO_DEPTH_SIZE, 16, ALLEGRO_SUGGEST); + al_set_new_display_option(A5O_DEPTH_SIZE, 16, A5O_SUGGEST); /* Load everything as a POT bitmap to make sure the projection stuff works * with mismatched backing texture and bitmap sizes. */ - al_set_new_display_option(ALLEGRO_SUPPORT_NPOT_BITMAP, 0, ALLEGRO_REQUIRE); + al_set_new_display_option(A5O_SUPPORT_NPOT_BITMAP, 0, A5O_REQUIRE); display = al_create_display(800, 600); if (!display) { abort_example("Error creating display\n"); @@ -110,8 +110,8 @@ int main(int argc, char **argv) al_register_event_source(queue, al_get_display_event_source(display)); al_register_event_source(queue, al_get_timer_event_source(timer)); - al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR | - ALLEGRO_MIPMAP); + al_set_new_bitmap_flags(A5O_MIN_LINEAR | A5O_MAG_LINEAR | + A5O_MIPMAP); texture = al_load_bitmap("data/bkg.png"); if (!texture) { @@ -120,39 +120,39 @@ int main(int argc, char **argv) al_start_timer(timer); while (!quit) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: quit = true; break; - case ALLEGRO_EVENT_DISPLAY_RESIZE: + case A5O_EVENT_DISPLAY_RESIZE: al_acknowledge_resize(display); set_perspective_transform(al_get_backbuffer(display)); break; - case ALLEGRO_EVENT_KEY_DOWN: + case A5O_EVENT_KEY_DOWN: switch (event.keyboard.keycode) { - case ALLEGRO_KEY_ESCAPE: + case A5O_KEY_ESCAPE: quit = true; break; - case ALLEGRO_KEY_SPACE: + case A5O_KEY_SPACE: fullscreen = !fullscreen; - al_set_display_flag(display, ALLEGRO_FULLSCREEN_WINDOW, fullscreen); + al_set_display_flag(display, A5O_FULLSCREEN_WINDOW, fullscreen); set_perspective_transform(al_get_backbuffer(display)); break; } break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: redraw = true; - theta = fmod(theta + 0.05, 2 * ALLEGRO_PI); + theta = fmod(theta + 0.05, 2 * A5O_PI); break; - case ALLEGRO_EVENT_DISPLAY_HALT_DRAWING: + case A5O_EVENT_DISPLAY_HALT_DRAWING: background = true; al_acknowledge_drawing_halt(display); al_stop_timer(timer); break; - case ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING: + case A5O_EVENT_DISPLAY_RESUME_DRAWING: background = false; al_acknowledge_drawing_resume(display); al_start_timer(timer); @@ -161,26 +161,26 @@ int main(int argc, char **argv) if (!background && redraw && al_is_event_queue_empty(queue)) { al_set_target_backbuffer(display); - al_set_render_state(ALLEGRO_DEPTH_TEST, 1); + al_set_render_state(A5O_DEPTH_TEST, 1); al_clear_to_color(al_map_rgb_f(0, 0, 0)); al_clear_depth_buffer(1000); draw_pyramid(texture, 0, 0, -4, theta); al_set_target_bitmap(buffer); - al_set_render_state(ALLEGRO_DEPTH_TEST, 1); + al_set_render_state(A5O_DEPTH_TEST, 1); al_clear_to_color(al_map_rgb_f(0, 0.1, 0.1)); al_clear_depth_buffer(1000); draw_pyramid(texture, 0, 0, -4, theta); al_set_target_bitmap(display_sub_persp); - al_set_render_state(ALLEGRO_DEPTH_TEST, 1); + al_set_render_state(A5O_DEPTH_TEST, 1); al_clear_to_color(al_map_rgb_f(0, 0, 0.25)); al_clear_depth_buffer(1000); draw_pyramid(texture, 0, 0, -4, theta); al_set_target_bitmap(display_sub_ortho); - al_set_render_state(ALLEGRO_DEPTH_TEST, 0); - al_draw_text(font, al_map_rgb_f(1, 1, 1), 128, 16, ALLEGRO_ALIGN_CENTER, + al_set_render_state(A5O_DEPTH_TEST, 0); + al_draw_text(font, al_map_rgb_f(1, 1, 1), 128, 16, A5O_ALIGN_CENTER, "Press Space to toggle fullscreen"); al_draw_bitmap(buffer, 0, 256, 0); diff --git a/examples/ex_record.c b/examples/ex_record.c index 7396278924..dbc39445ab 100644 --- a/examples/ex_record.c +++ b/examples/ex_record.c @@ -14,7 +14,7 @@ * will be working with bytes. */ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include "allegro5/allegro.h" #include "allegro5/allegro_audio.h" #include "allegro5/allegro_primitives.h" @@ -33,7 +33,7 @@ #ifdef WANT_8_BIT_DEPTH -const ALLEGRO_AUDIO_DEPTH audio_depth = ALLEGRO_AUDIO_DEPTH_UINT8; +const A5O_AUDIO_DEPTH audio_depth = A5O_AUDIO_DEPTH_UINT8; typedef uint8_t* audio_buffer_t; const uint8_t sample_center = 128; const int8_t min_sample_val = 0x80; @@ -43,7 +43,7 @@ const int sample_size = 1; #else -const ALLEGRO_AUDIO_DEPTH audio_depth = ALLEGRO_AUDIO_DEPTH_INT16; +const A5O_AUDIO_DEPTH audio_depth = A5O_AUDIO_DEPTH_INT16; typedef int16_t* audio_buffer_t; const int16_t sample_center = 0; const int16_t min_sample_val = 0x8000; @@ -73,13 +73,13 @@ const unsigned int playback_samples_per_fragment = 4096; int main(int argc, char **argv) { - ALLEGRO_AUDIO_RECORDER *r; - ALLEGRO_AUDIO_STREAM *s; + A5O_AUDIO_RECORDER *r; + A5O_AUDIO_STREAM *s; - ALLEGRO_EVENT_QUEUE *q; - ALLEGRO_DISPLAY *d; - ALLEGRO_FILE *fp = NULL; - ALLEGRO_PATH *tmp_path = NULL; + A5O_EVENT_QUEUE *q; + A5O_DISPLAY *d; + A5O_FILE *fp = NULL; + A5O_PATH *tmp_path = NULL; int prev = 0; bool is_recording = false; @@ -114,14 +114,14 @@ int main(int argc, char **argv) * file. */ r = al_create_audio_recorder(1000, samples_per_fragment, frequency, - audio_depth, ALLEGRO_CHANNEL_CONF_1); + audio_depth, A5O_CHANNEL_CONF_1); if (!r) { abort_example("Unable to create audio recorder"); } s = al_create_audio_stream(playback_fragment_count, playback_samples_per_fragment, frequency, audio_depth, - ALLEGRO_CHANNEL_CONF_1); + A5O_CHANNEL_CONF_1); if (!s) { abort_example("Unable to create audio stream"); } @@ -134,8 +134,8 @@ int main(int argc, char **argv) /* Note: the following two options are referring to pixel samples, and have * nothing to do with audio samples. */ - al_set_new_display_option(ALLEGRO_SAMPLE_BUFFERS, 1, ALLEGRO_SUGGEST); - al_set_new_display_option(ALLEGRO_SAMPLES, 8, ALLEGRO_SUGGEST); + al_set_new_display_option(A5O_SAMPLE_BUFFERS, 1, A5O_SUGGEST); + al_set_new_display_option(A5O_SAMPLES, 8, A5O_SUGGEST); d = al_create_display(320, 256); if (!d) { @@ -152,11 +152,11 @@ int main(int argc, char **argv) al_start_audio_recorder(r); while (true) { - ALLEGRO_EVENT e; + A5O_EVENT e; al_wait_for_event(q, &e); - if (e.type == ALLEGRO_EVENT_AUDIO_RECORDER_FRAGMENT) { + if (e.type == A5O_EVENT_AUDIO_RECORDER_FRAGMENT) { /* We received an incoming fragment from the microphone. In this * example, the recorder is constantly recording even when we aren't * saving to disk. The display is updated every time a new fragment @@ -164,7 +164,7 @@ int main(int argc, char **argv) * are coming in faster than we can update the screen, then it will be * a problem. */ - ALLEGRO_AUDIO_RECORDER_EVENT *re = al_get_audio_recorder_event(&e); + A5O_AUDIO_RECORDER_EVENT *re = al_get_audio_recorder_event(&e); audio_buffer_t input = (audio_buffer_t) re->buffer; int sample_count = re->samples; const int R = sample_count / 320; @@ -221,7 +221,7 @@ int main(int argc, char **argv) al_flip_display(); } - else if (e.type == ALLEGRO_EVENT_AUDIO_STREAM_FRAGMENT) { + else if (e.type == A5O_EVENT_AUDIO_STREAM_FRAGMENT) { /* This event is received when we are playing back the audio clip. * See ex_saw.c for an example dedicated to playing streams. */ @@ -258,10 +258,10 @@ int main(int argc, char **argv) } } } - else if (e.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + else if (e.type == A5O_EVENT_DISPLAY_CLOSE) { break; } - else if (e.type == ALLEGRO_EVENT_KEY_CHAR) { + else if (e.type == A5O_EVENT_KEY_CHAR) { if (e.keyboard.unichar == 27) { /* pressed ESC */ break; diff --git a/examples/ex_record_name.c b/examples/ex_record_name.c index 2cda8d9524..e04c21f3a3 100644 --- a/examples/ex_record_name.c +++ b/examples/ex_record_name.c @@ -5,7 +5,7 @@ * play it back. */ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include "allegro5/allegro.h" #include "allegro5/allegro_audio.h" #include "allegro5/allegro_acodec.h" @@ -17,11 +17,11 @@ int main(int argc, char *argv[]) { - ALLEGRO_DISPLAY *display; - ALLEGRO_FONT *font; - ALLEGRO_AUDIO_RECORDER *recorder; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_TIMER *timer; + A5O_DISPLAY *display; + A5O_FONT *font; + A5O_AUDIO_RECORDER *recorder; + A5O_EVENT_QUEUE *queue; + A5O_TIMER *timer; int font_height; /* Frequency is the number of samples per second. */ @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) bool is_recording = false; - ALLEGRO_SAMPLE *spl = NULL; + A5O_SAMPLE *spl = NULL; (void) argc; (void) argv; @@ -103,8 +103,8 @@ int main(int argc, char *argv[]) frequency * latency, /* configure the fragment size to give us the given latency in seconds */ frequency, /* samples per second (higher => better quality) */ - ALLEGRO_AUDIO_DEPTH_INT16, /* 2-byte sample size */ - ALLEGRO_CHANNEL_CONF_2 /* stereo */ + A5O_AUDIO_DEPTH_INT16, /* 2-byte sample size */ + A5O_CHANNEL_CONF_2 /* stereo */ ); if (!recorder) { @@ -136,30 +136,30 @@ int main(int argc, char *argv[]) al_start_audio_recorder(recorder); while (true) { - ALLEGRO_EVENT event; + A5O_EVENT event; bool do_draw = false; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE || - (event.type == ALLEGRO_EVENT_KEY_UP && event.keyboard.keycode == ALLEGRO_KEY_ESCAPE)) { + if (event.type == A5O_EVENT_DISPLAY_CLOSE || + (event.type == A5O_EVENT_KEY_UP && event.keyboard.keycode == A5O_KEY_ESCAPE)) { break; } - else if (event.type == ALLEGRO_EVENT_KEY_CHAR) { + else if (event.type == A5O_EVENT_KEY_CHAR) { if (spl && event.keyboard.unichar != 27) { - al_play_sample(spl, 1.0, 0.0, 1.0, ALLEGRO_PLAYMODE_ONCE, NULL); + al_play_sample(spl, 1.0, 0.0, 1.0, A5O_PLAYMODE_ONCE, NULL); } } - else if (event.type == ALLEGRO_EVENT_TIMER) { + else if (event.type == A5O_EVENT_TIMER) { do_draw = true; } - else if (event.type == ALLEGRO_EVENT_AUDIO_RECORDER_FRAGMENT && recorder != NULL) { + else if (event.type == A5O_EVENT_AUDIO_RECORDER_FRAGMENT && recorder != NULL) { /* Because the recording happens in a different thread (and simply because we are queuing up events), it's quite possible to receive (process) a fragment event after the recorder has been stopped or destroyed. Thus, it is important to somehow check that the recorder is still valid, as we are doing above. */ - ALLEGRO_AUDIO_RECORDER_EVENT *re = al_get_audio_recorder_event(&event); + A5O_AUDIO_RECORDER_EVENT *re = al_get_audio_recorder_event(&event); int16_t *buffer = re->buffer; int16_t low = 0, high = 0; unsigned int i; @@ -209,7 +209,7 @@ int main(int argc, char *argv[]) if (!is_recording && name_buffer_pos != name_buffer && !spl) { /* finished recording, but haven't created the sample yet */ spl = al_create_sample(name_buffer, name_buffer_pos - name_buffer, frequency, - ALLEGRO_AUDIO_DEPTH_INT16, ALLEGRO_CHANNEL_CONF_2, false); + A5O_AUDIO_DEPTH_INT16, A5O_CHANNEL_CONF_2, false); /* We no longer need the recorder. Destroying it is the only way to unlock the device. */ al_destroy_audio_recorder(recorder); @@ -224,7 +224,7 @@ int main(int argc, char *argv[]) int width = al_get_text_width(font, msg); al_draw_text(font, al_map_rgb(255,255,255), - 320, 240 - font_height / 2, ALLEGRO_ALIGN_CENTRE, msg + 320, 240 - font_height / 2, A5O_ALIGN_CENTRE, msg ); /* draw volume meter */ @@ -241,7 +241,7 @@ int main(int argc, char *argv[]) } else { al_draw_text(font, al_map_rgb(255,255,255), 320, 240 - font_height / 2, - ALLEGRO_ALIGN_CENTRE, "Press Any Key"); + A5O_ALIGN_CENTRE, "Press Any Key"); } al_flip_display(); } diff --git a/examples/ex_reparent.c b/examples/ex_reparent.c index 4b09ab4944..45f78afabe 100644 --- a/examples/ex_reparent.c +++ b/examples/ex_reparent.c @@ -9,9 +9,9 @@ #define FPS 60 struct Example { - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *glyphs[2]; - ALLEGRO_BITMAP *sub; + A5O_DISPLAY *display; + A5O_BITMAP *glyphs[2]; + A5O_BITMAP *sub; int i; int p; } example; @@ -46,7 +46,7 @@ static void redraw(void) for (i = 0; i < 8; i++) { al_draw_scaled_rotated_bitmap(example.sub, 0, 0, i * 100, 32 * 6 + 33 * 5 + 4, - 2.0, 2.0, ALLEGRO_PI / 4 * i / 8, 0); + 2.0, 2.0, A5O_PI / 4 * i / 8, 0); } } @@ -79,8 +79,8 @@ static void init(void) int main(int argc, char **argv) { - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; int w = 800, h = 600; bool done = false; bool need_redraw = true; @@ -100,8 +100,8 @@ int main(int argc, char **argv) init_platform_specific(); - al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR); - al_set_new_display_flags(ALLEGRO_RESIZABLE); + al_set_new_bitmap_flags(A5O_MIN_LINEAR | A5O_MAG_LINEAR); + al_set_new_display_flags(A5O_RESIZABLE); example.display = al_create_display(w, h); if (!example.display) { abort_example("Error creating display.\n"); @@ -136,7 +136,7 @@ int main(int argc, char **argv) al_start_timer(timer); while (!done) { - ALLEGRO_EVENT event; + A5O_EVENT event; w = al_get_display_width(example.display); h = al_get_display_height(example.display); @@ -148,20 +148,20 @@ int main(int argc, char **argv) al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_KEY_CHAR: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_CHAR: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) done = true; break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: done = true; break; - case ALLEGRO_EVENT_DISPLAY_RESIZE: + case A5O_EVENT_DISPLAY_RESIZE: al_acknowledge_resize(event.display.source); break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: update(); need_redraw = true; break; diff --git a/examples/ex_resample_test.c b/examples/ex_resample_test.c index ea86a77125..3737c992f3 100644 --- a/examples/ex_resample_test.c +++ b/examples/ex_resample_test.c @@ -14,15 +14,15 @@ int frequency[N]; double samplepos[N]; -ALLEGRO_AUDIO_STREAM *stream[N]; -ALLEGRO_DISPLAY *display; +A5O_AUDIO_STREAM *stream[N]; +A5O_DISPLAY *display; float waveform[640], waveform_buffer[640]; static void mainloop(void) { - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_TIMER *timer; float *buf; double pitch = 440; int i, si; @@ -32,7 +32,7 @@ static void mainloop(void) for (i = 0; i < N; i++) { frequency[i] = 22050 * pow(2, i / (double)N); stream[i] = al_create_audio_stream(4, SAMPLES_PER_BUFFER, frequency[i], - ALLEGRO_AUDIO_DEPTH_FLOAT32, ALLEGRO_CHANNEL_CONF_1); + A5O_AUDIO_DEPTH_FLOAT32, A5O_CHANNEL_CONF_1); if (!stream[i]) { abort_example("Could not create stream.\n"); } @@ -48,7 +48,7 @@ static void mainloop(void) al_register_event_source(queue, al_get_audio_stream_event_source(stream[i])); } -#ifdef ALLEGRO_POPUP_EXAMPLES +#ifdef A5O_POPUP_EXAMPLES if (textlog) { al_register_event_source(queue, al_get_native_text_log_event_source(textlog)); } @@ -64,11 +64,11 @@ static void mainloop(void) al_start_timer(timer); while (n < 60 * frequency[0] / SAMPLES_PER_BUFFER * N) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_AUDIO_STREAM_FRAGMENT) { + if (event.type == A5O_EVENT_AUDIO_STREAM_FRAGMENT) { for (si = 0; si < N; si++) { buf = al_get_audio_stream_fragment(stream[si]); if (!buf) { @@ -77,7 +77,7 @@ static void mainloop(void) for (i = 0; i < SAMPLES_PER_BUFFER; i++) { double t = samplepos[si]++ / (double)frequency[si]; - buf[i] = sin(t * pitch * ALLEGRO_PI * 2) / N; + buf[i] = sin(t * pitch * A5O_PI * 2) / N; } if (!al_set_audio_stream_fragment(stream[si], buf)) { @@ -91,27 +91,27 @@ static void mainloop(void) } } - if (event.type == ALLEGRO_EVENT_TIMER) { + if (event.type == A5O_EVENT_TIMER) { redraw = true; } - if (event.type == ALLEGRO_EVENT_KEY_DOWN && - event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_DOWN && + event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } -#ifdef ALLEGRO_POPUP_EXAMPLES - if (event.type == ALLEGRO_EVENT_NATIVE_DIALOG_CLOSE) { +#ifdef A5O_POPUP_EXAMPLES + if (event.type == A5O_EVENT_NATIVE_DIALOG_CLOSE) { break; } #endif if (redraw &&al_is_event_queue_empty(queue)) { - ALLEGRO_COLOR c = al_map_rgb(0, 0, 0); + A5O_COLOR c = al_map_rgb(0, 0, 0); int i; al_clear_to_color(al_map_rgb_f(1, 1, 1)); diff --git a/examples/ex_resize.c b/examples/ex_resize.c index de4cd1420c..3a4f310f5e 100644 --- a/examples/ex_resize.c +++ b/examples/ex_resize.c @@ -5,7 +5,7 @@ static void redraw(void) { - ALLEGRO_COLOR black, white; + A5O_COLOR black, white; int w, h; white = al_map_rgba_f(1, 1, 1, 1); @@ -22,10 +22,10 @@ static void redraw(void) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *events; - ALLEGRO_EVENT event; + A5O_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *events; + A5O_EVENT event; int rs = 100; bool resize = false; @@ -40,7 +40,7 @@ int main(int argc, char **argv) events = al_create_event_queue(); /* Setup a display driver and register events from it. */ - al_set_new_display_flags(ALLEGRO_RESIZABLE); + al_set_new_display_flags(A5O_RESIZABLE); display = al_create_display(rs, rs); if (!display) { abort_example("Could not create display.\n"); @@ -71,13 +71,13 @@ int main(int argc, char **argv) resize = false; } al_wait_for_event(events, &event); - if (event.type == ALLEGRO_EVENT_TIMER) { + if (event.type == A5O_EVENT_TIMER) { resize = true; } - else if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + else if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } - else if (event.type == ALLEGRO_EVENT_KEY_DOWN) { + else if (event.type == A5O_EVENT_KEY_DOWN) { break; } } diff --git a/examples/ex_resize2.c b/examples/ex_resize2.c index f5ec01d465..efae83e93e 100644 --- a/examples/ex_resize2.c +++ b/examples/ex_resize2.c @@ -14,11 +14,11 @@ int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *bmp; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; - ALLEGRO_FONT *font; + A5O_DISPLAY *display; + A5O_BITMAP *bmp; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; + A5O_FONT *font; bool redraw; bool halt_drawing; @@ -33,14 +33,14 @@ int main(int argc, char **argv) al_init_font_addon(); al_set_config_value(al_get_system_config(), "osx", "allow_live_resize", "false"); - al_set_new_display_flags(ALLEGRO_RESIZABLE | - ALLEGRO_GENERATE_EXPOSE_EVENTS); + al_set_new_display_flags(A5O_RESIZABLE | + A5O_GENERATE_EXPOSE_EVENTS); display = al_create_display(640, 480); if (!display) { abort_example("Unable to set any graphic mode\n"); } - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); bmp = al_load_bitmap("data/mysha.pcx"); if (!bmp) { abort_example("Unable to load image\n"); @@ -69,7 +69,7 @@ int main(int argc, char **argv) "- key to un-maximize", al_get_display_width(display), al_get_display_height(display), - al_get_display_flags(display) & ALLEGRO_MAXIMIZED ? "yes" : + al_get_display_flags(display) & A5O_MAXIMIZED ? "yes" : "no"); al_flip_display(); @@ -77,34 +77,34 @@ int main(int argc, char **argv) } al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_RESIZE) { + if (event.type == A5O_EVENT_DISPLAY_RESIZE) { al_acknowledge_resize(event.display.source); redraw = true; } - if (event.type == ALLEGRO_EVENT_DISPLAY_EXPOSE) { + if (event.type == A5O_EVENT_DISPLAY_EXPOSE) { redraw = true; } - if (event.type == ALLEGRO_EVENT_DISPLAY_HALT_DRAWING) { + if (event.type == A5O_EVENT_DISPLAY_HALT_DRAWING) { halt_drawing = true; al_acknowledge_drawing_halt(display); } - if (event.type == ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING) { + if (event.type == A5O_EVENT_DISPLAY_RESUME_DRAWING) { halt_drawing = false; al_acknowledge_drawing_resume(display); } - if (event.type == ALLEGRO_EVENT_KEY_DOWN && - event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_DOWN && + event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } - if (event.type == ALLEGRO_EVENT_KEY_CHAR && + if (event.type == A5O_EVENT_KEY_CHAR && event.keyboard.unichar == '+') { - al_set_display_flag(display, ALLEGRO_MAXIMIZED, true); + al_set_display_flag(display, A5O_MAXIMIZED, true); } - if (event.type == ALLEGRO_EVENT_KEY_CHAR && + if (event.type == A5O_EVENT_KEY_CHAR && event.keyboard.unichar == '-') { - al_set_display_flag(display, ALLEGRO_MAXIMIZED, false); + al_set_display_flag(display, A5O_MAXIMIZED, false); } - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } } diff --git a/examples/ex_rotate.c b/examples/ex_rotate.c index 4a6348ab34..314c16e4af 100644 --- a/examples/ex_rotate.c +++ b/examples/ex_rotate.c @@ -14,13 +14,13 @@ int main(int argc, char **argv) const int display_w = 640; const int display_h = 480; - ALLEGRO_DISPLAY *dpy; - ALLEGRO_BITMAP *buf; - ALLEGRO_BITMAP *bmp; - ALLEGRO_BITMAP *mem_bmp; - ALLEGRO_BITMAP *src_bmp; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; + A5O_DISPLAY *dpy; + A5O_BITMAP *buf; + A5O_BITMAP *bmp; + A5O_BITMAP *mem_bmp; + A5O_BITMAP *src_bmp; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; double theta = 0; double k = 1.0; int mode = 0; @@ -29,7 +29,7 @@ int main(int argc, char **argv) bool trans_mode = false; int flags = 0; bool clip_mode = false; - ALLEGRO_COLOR trans; + A5O_COLOR trans; (void)argc; (void)argv; @@ -66,7 +66,7 @@ int main(int argc, char **argv) abort_example("Unable to load image\n"); } - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); mem_bmp = al_load_bitmap("data/mysha.pcx"); if (!mem_bmp) { abort_example("Unable to load image\n"); @@ -77,8 +77,8 @@ int main(int argc, char **argv) while (true) { if (al_get_next_event(queue, &event)) { - if (event.type == ALLEGRO_EVENT_KEY_CHAR) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + if (event.type == A5O_EVENT_KEY_CHAR) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) break; if (event.keyboard.unichar == ' ') { mode = !mode; @@ -99,9 +99,9 @@ int main(int argc, char **argv) if (event.keyboard.unichar == 't') trans_mode = !trans_mode; if (event.keyboard.unichar == 'h') - flags ^= ALLEGRO_FLIP_HORIZONTAL; + flags ^= A5O_FLIP_HORIZONTAL; if (event.keyboard.unichar == 'v') - flags ^= ALLEGRO_FLIP_VERTICAL; + flags ^= A5O_FLIP_VERTICAL; if (event.keyboard.unichar == 'c') clip_mode = !clip_mode; } @@ -123,7 +123,7 @@ int main(int argc, char **argv) src_bmp = (mem_src_mode) ? mem_bmp : bmp; k = (wide_mode) ? 2.0 : 1.0; - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); trans = al_map_rgba_f(1, 1, 1, 1); if (mode == 0) al_clear_to_color(al_map_rgba_f(1, 0, 0, 1)); @@ -131,7 +131,7 @@ int main(int argc, char **argv) al_clear_to_color(al_map_rgba_f(0, 0, 1, 1)); if (trans_mode) { - al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA); trans = al_map_rgba_f(1, 1, 1, 0.5); } @@ -151,7 +151,7 @@ int main(int argc, char **argv) if (mode == 0) { al_set_target_backbuffer(dpy); al_set_clipping_rectangle(0, 0, display_w, display_h); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_draw_bitmap(buf, 0, 0, 0); } diff --git a/examples/ex_saw.c b/examples/ex_saw.c index 1a2d21b496..e6ca7e24ba 100644 --- a/examples/ex_saw.c +++ b/examples/ex_saw.c @@ -11,9 +11,9 @@ #define SAMPLES_PER_BUFFER 1024 -static void saw(ALLEGRO_AUDIO_STREAM *stream) +static void saw(A5O_AUDIO_STREAM *stream) { - ALLEGRO_EVENT_QUEUE *queue; + A5O_EVENT_QUEUE *queue; int8_t *buf; int pitch = 0x10000; int val = 0; @@ -22,7 +22,7 @@ static void saw(ALLEGRO_AUDIO_STREAM *stream) queue = al_create_event_queue(); al_register_event_source(queue, al_get_audio_stream_event_source(stream)); -#ifdef ALLEGRO_POPUP_EXAMPLES +#ifdef A5O_POPUP_EXAMPLES if (textlog) { al_register_event_source(queue, al_get_native_text_log_event_source(textlog)); } @@ -31,11 +31,11 @@ static void saw(ALLEGRO_AUDIO_STREAM *stream) log_printf("Generating saw wave...\n"); while (n > 0) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_AUDIO_STREAM_FRAGMENT) { + if (event.type == A5O_EVENT_AUDIO_STREAM_FRAGMENT) { buf = al_get_audio_stream_fragment(stream); if (!buf) { /* This is a normal condition you must deal with. */ @@ -65,8 +65,8 @@ static void saw(ALLEGRO_AUDIO_STREAM *stream) } } -#ifdef ALLEGRO_POPUP_EXAMPLES - if (event.type == ALLEGRO_EVENT_NATIVE_DIALOG_CLOSE) { +#ifdef A5O_POPUP_EXAMPLES + if (event.type == A5O_EVENT_NATIVE_DIALOG_CLOSE) { break; } #endif @@ -82,7 +82,7 @@ static void saw(ALLEGRO_AUDIO_STREAM *stream) int main(int argc, char **argv) { - ALLEGRO_AUDIO_STREAM *stream; + A5O_AUDIO_STREAM *stream; void *buf; (void)argc; @@ -98,10 +98,10 @@ int main(int argc, char **argv) al_reserve_samples(0); stream = al_create_audio_stream(8, SAMPLES_PER_BUFFER, 22050, - ALLEGRO_AUDIO_DEPTH_UINT8, ALLEGRO_CHANNEL_CONF_1); + A5O_AUDIO_DEPTH_UINT8, A5O_CHANNEL_CONF_1); while ((buf = al_get_audio_stream_fragment(stream))) { - al_fill_silence(buf, SAMPLES_PER_BUFFER, ALLEGRO_AUDIO_DEPTH_UINT8, - ALLEGRO_CHANNEL_CONF_1); + al_fill_silence(buf, SAMPLES_PER_BUFFER, A5O_AUDIO_DEPTH_UINT8, + A5O_CHANNEL_CONF_1); al_set_audio_stream_fragment(stream, buf); } diff --git a/examples/ex_scale.c b/examples/ex_scale.c index fc4b18f234..ada571dcf9 100644 --- a/examples/ex_scale.c +++ b/examples/ex_scale.c @@ -14,15 +14,15 @@ int main(int argc, char **argv) const int display_w = 640; const int display_h = 480; - ALLEGRO_DISPLAY *dpy; - ALLEGRO_BITMAP *buf; - ALLEGRO_BITMAP *bmp; - ALLEGRO_BITMAP *mem_bmp; - ALLEGRO_BITMAP *src_bmp; + A5O_DISPLAY *dpy; + A5O_BITMAP *buf; + A5O_BITMAP *bmp; + A5O_BITMAP *mem_bmp; + A5O_BITMAP *src_bmp; int bmp_w; int bmp_h; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; double theta = 0; double k = 1.0; int mode = 0; @@ -31,7 +31,7 @@ int main(int argc, char **argv) bool trans_mode = false; int flags = 0; bool clip_mode = false; - ALLEGRO_COLOR tint; + A5O_COLOR tint; (void)argc; (void)argv; @@ -69,7 +69,7 @@ int main(int argc, char **argv) abort_example("Unable to load image\n"); } - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); mem_bmp = al_load_bitmap("data/mysha.pcx"); if (!mem_bmp) { abort_example("Unable to load image\n"); @@ -83,8 +83,8 @@ int main(int argc, char **argv) while (true) { if (al_get_next_event(queue, &event)) { - if (event.type == ALLEGRO_EVENT_KEY_CHAR) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + if (event.type == A5O_EVENT_KEY_CHAR) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) break; if (event.keyboard.unichar == ' ') { mode = !mode; @@ -105,9 +105,9 @@ int main(int argc, char **argv) if (event.keyboard.unichar == 't') trans_mode = !trans_mode; if (event.keyboard.unichar == 'h') - flags ^= ALLEGRO_FLIP_HORIZONTAL; + flags ^= A5O_FLIP_HORIZONTAL; if (event.keyboard.unichar == 'v') - flags ^= ALLEGRO_FLIP_VERTICAL; + flags ^= A5O_FLIP_VERTICAL; if (event.keyboard.unichar == 'c') clip_mode = !clip_mode; } @@ -129,7 +129,7 @@ int main(int argc, char **argv) src_bmp = (mem_src_mode) ? mem_bmp : bmp; k = (wide_mode) ? 2.0 : 1.0; - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); tint = al_map_rgba_f(1, 1, 1, 1); if (mode == 0) al_clear_to_color(al_map_rgba_f(1, 0, 0, 1)); @@ -137,7 +137,7 @@ int main(int argc, char **argv) al_clear_to_color(al_map_rgba_f(0, 0, 1, 1)); if (trans_mode) { - al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA); tint = al_map_rgba_f(1, 1, 1, 0.5); } @@ -157,7 +157,7 @@ int main(int argc, char **argv) if (mode == 0) { al_set_target_backbuffer(dpy); al_set_clipping_rectangle(0, 0, display_w, display_h); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_draw_bitmap(buf, 0, 0, 0); } diff --git a/examples/ex_shader.cpp b/examples/ex_shader.cpp index 87a42f5844..b0a886c3a0 100644 --- a/examples/ex_shader.cpp +++ b/examples/ex_shader.cpp @@ -3,13 +3,13 @@ #include "allegro5/allegro_image.h" #include "allegro5/allegro_primitives.h" -/* The ALLEGRO_CFG_* defines are actually internal to Allegro so don't use them +/* The A5O_CFG_* defines are actually internal to Allegro so don't use them * in your own programs. */ -#ifdef ALLEGRO_CFG_D3D +#ifdef A5O_CFG_D3D #include "allegro5/allegro_direct3d.h" #endif -#ifdef ALLEGRO_CFG_OPENGL +#ifdef A5O_CFG_OPENGL #include "allegro5/allegro_opengl.h" #endif @@ -23,12 +23,12 @@ static void parse_args(int argc, char **argv) for (i = 1; i < argc; i++) { if (0 == strcmp(argv[i], "--opengl")) { - display_flags = ALLEGRO_OPENGL; + display_flags = A5O_OPENGL; continue; } -#ifdef ALLEGRO_CFG_D3D +#ifdef A5O_CFG_D3D if (0 == strcmp(argv[i], "--d3d")) { - display_flags = ALLEGRO_DIRECT3D; + display_flags = A5O_DIRECT3D; continue; } #endif @@ -36,15 +36,15 @@ static void parse_args(int argc, char **argv) } } -static void choose_shader_source(ALLEGRO_SHADER *shader, +static void choose_shader_source(A5O_SHADER *shader, char const **vsource, char const **psource) { - ALLEGRO_SHADER_PLATFORM platform = al_get_shader_platform(shader); - if (platform == ALLEGRO_SHADER_HLSL) { + A5O_SHADER_PLATFORM platform = al_get_shader_platform(shader); + if (platform == A5O_SHADER_HLSL) { *vsource = "data/ex_shader_vertex.hlsl"; *psource = "data/ex_shader_pixel.hlsl"; } - else if (platform == ALLEGRO_SHADER_GLSL) { + else if (platform == A5O_SHADER_GLSL) { *vsource = "data/ex_shader_vertex.glsl"; *psource = "data/ex_shader_pixel.glsl"; } @@ -57,9 +57,9 @@ static void choose_shader_source(ALLEGRO_SHADER *shader, int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *bmp; - ALLEGRO_SHADER *shader; + A5O_DISPLAY *display; + A5O_BITMAP *bmp; + A5O_SHADER *shader; const char *vsource; const char *psource; @@ -72,7 +72,7 @@ int main(int argc, char **argv) al_init_image_addon(); init_platform_specific(); - al_set_new_display_flags(ALLEGRO_PROGRAMMABLE_PIPELINE | display_flags); + al_set_new_display_flags(A5O_PROGRAMMABLE_PIPELINE | display_flags); display = al_create_display(640, 480); if (!display) { @@ -84,7 +84,7 @@ int main(int argc, char **argv) abort_example("Could not load bitmap.\n"); } - shader = al_create_shader(ALLEGRO_SHADER_AUTO); + shader = al_create_shader(A5O_SHADER_AUTO); if (!shader) { abort_example("Could not create shader.\n"); } @@ -94,11 +94,11 @@ int main(int argc, char **argv) abort_example("Could not load source files.\n"); } - if (!al_attach_shader_source_file(shader, ALLEGRO_VERTEX_SHADER, vsource)) { + if (!al_attach_shader_source_file(shader, A5O_VERTEX_SHADER, vsource)) { abort_example("al_attach_shader_source_file failed: %s\n", al_get_shader_log(shader)); } - if (!al_attach_shader_source_file(shader, ALLEGRO_PIXEL_SHADER, psource)) { + if (!al_attach_shader_source_file(shader, A5O_PIXEL_SHADER, psource)) { abort_example("al_attach_shader_source_file failed: %s\n", al_get_shader_log(shader)); } @@ -117,9 +117,9 @@ int main(int argc, char **argv) }; while (1) { - ALLEGRO_KEYBOARD_STATE s; + A5O_KEYBOARD_STATE s; al_get_keyboard_state(&s); - if (al_key_down(&s, ALLEGRO_KEY_ESCAPE)) + if (al_key_down(&s, A5O_KEY_ESCAPE)) break; al_clear_to_color(al_map_rgb(140, 40, 40)); @@ -134,7 +134,7 @@ int main(int argc, char **argv) al_draw_bitmap(bmp, 0, 240, 0); /* Draw the last one transformed */ - ALLEGRO_TRANSFORM trans, backup; + A5O_TRANSFORM trans, backup; al_copy_transform(&backup, al_get_current_transform()); al_identity_transform(&trans); al_translate_transform(&trans, 320, 240); diff --git a/examples/ex_shader_multitex.c b/examples/ex_shader_multitex.c index 8b1a1f1e23..42e42ccc42 100644 --- a/examples/ex_shader_multitex.c +++ b/examples/ex_shader_multitex.c @@ -7,9 +7,9 @@ #include "common.c" -static ALLEGRO_BITMAP *load_bitmap(char const *filename) +static A5O_BITMAP *load_bitmap(char const *filename) { - ALLEGRO_BITMAP *bitmap = al_load_bitmap(filename); + A5O_BITMAP *bitmap = al_load_bitmap(filename); if (!bitmap) abort_example("%s not found or failed to load\n", filename); return bitmap; @@ -17,12 +17,12 @@ static ALLEGRO_BITMAP *load_bitmap(char const *filename) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *bitmap[2]; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; + A5O_DISPLAY *display; + A5O_BITMAP *bitmap[2]; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; bool redraw = true; - ALLEGRO_SHADER *shader; + A5O_SHADER *shader; int t = 0; const char* pixel_file = NULL; @@ -38,11 +38,11 @@ int main(int argc, char **argv) al_init_image_addon(); init_platform_specific(); - al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR | - ALLEGRO_MIPMAP); - al_set_new_display_option(ALLEGRO_SAMPLE_BUFFERS, 1, ALLEGRO_SUGGEST); - al_set_new_display_option(ALLEGRO_SAMPLES, 4, ALLEGRO_SUGGEST); - al_set_new_display_flags(ALLEGRO_PROGRAMMABLE_PIPELINE); + al_set_new_bitmap_flags(A5O_MIN_LINEAR | A5O_MAG_LINEAR | + A5O_MIPMAP); + al_set_new_display_option(A5O_SAMPLE_BUFFERS, 1, A5O_SUGGEST); + al_set_new_display_option(A5O_SAMPLES, 4, A5O_SUGGEST); + al_set_new_display_flags(A5O_PROGRAMMABLE_PIPELINE); display = al_create_display(640, 480); if (!display) { abort_example("Error creating display\n"); @@ -51,17 +51,17 @@ int main(int argc, char **argv) bitmap[0]= load_bitmap("data/mysha.pcx"); bitmap[1]= load_bitmap("data/obp.jpg"); - shader = al_create_shader(ALLEGRO_SHADER_AUTO); + shader = al_create_shader(A5O_SHADER_AUTO); if (!shader) abort_example("Error creating shader.\n"); - if (al_get_shader_platform(shader) == ALLEGRO_SHADER_GLSL) { -#ifdef ALLEGRO_CFG_SHADER_GLSL + if (al_get_shader_platform(shader) == A5O_SHADER_GLSL) { +#ifdef A5O_CFG_SHADER_GLSL pixel_file = "data/ex_shader_multitex_pixel.glsl"; #endif } else { -#ifdef ALLEGRO_CFG_SHADER_HLSL +#ifdef A5O_CFG_SHADER_HLSL pixel_file = "data/ex_shader_multitex_pixel.hlsl"; #endif } @@ -69,11 +69,11 @@ int main(int argc, char **argv) if (!pixel_file) { abort_example("No shader source\n"); } - if (!al_attach_shader_source(shader, ALLEGRO_VERTEX_SHADER, - al_get_default_shader_source(ALLEGRO_SHADER_AUTO, ALLEGRO_VERTEX_SHADER))) { + if (!al_attach_shader_source(shader, A5O_VERTEX_SHADER, + al_get_default_shader_source(A5O_SHADER_AUTO, A5O_VERTEX_SHADER))) { abort_example("al_attach_shader_source for vertex shader failed: %s\n", al_get_shader_log(shader)); } - if (!al_attach_shader_source_file(shader, ALLEGRO_PIXEL_SHADER, pixel_file)) + if (!al_attach_shader_source_file(shader, A5O_PIXEL_SHADER, pixel_file)) abort_example("al_attach_shader_source_file for pixel shader failed: %s\n", al_get_shader_log(shader)); if (!al_build_shader(shader)) abort_example("al_build_shader failed: %s\n", al_get_shader_log(shader)); @@ -88,26 +88,26 @@ int main(int argc, char **argv) al_start_timer(timer); while (1) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) + if (event.type == A5O_EVENT_DISPLAY_CLOSE) break; - if (event.type == ALLEGRO_EVENT_KEY_CHAR) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + if (event.type == A5O_EVENT_KEY_CHAR) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) break; } - if (event.type == ALLEGRO_EVENT_TIMER) { + if (event.type == A5O_EVENT_TIMER) { redraw = true; t++; } if (redraw && al_is_event_queue_empty(queue)) { int dw, dh; - double scale = 1 + 100 * (1 + sin(t * ALLEGRO_PI * 2 / 60 / 10)); - double angle = ALLEGRO_PI * 2 * t / 60 / 15; - double x = 120 - 20 * cos(ALLEGRO_PI * 2 * t / 60 / 25); - double y = 120 - 20 * sin(ALLEGRO_PI * 2 * t / 60 / 25); + double scale = 1 + 100 * (1 + sin(t * A5O_PI * 2 / 60 / 10)); + double angle = A5O_PI * 2 * t / 60 / 15; + double x = 120 - 20 * cos(A5O_PI * 2 * t / 60 / 25); + double y = 120 - 20 * sin(A5O_PI * 2 * t / 60 / 25); dw = al_get_display_width(display); dh = al_get_display_height(display); diff --git a/examples/ex_shader_target.c b/examples/ex_shader_target.c index 4a3f02e6b2..3a3717846d 100644 --- a/examples/ex_shader_target.c +++ b/examples/ex_shader_target.c @@ -19,14 +19,14 @@ static float tints[12] = 4.0, 4.0, 1.0 }; -static void choose_shader_source(ALLEGRO_SHADER_PLATFORM platform, +static void choose_shader_source(A5O_SHADER_PLATFORM platform, char const **vsource, char const **psource) { - if (platform == ALLEGRO_SHADER_HLSL) { + if (platform == A5O_SHADER_HLSL) { *vsource = "data/ex_shader_vertex.hlsl"; *psource = "data/ex_shader_pixel.hlsl"; } - else if (platform == ALLEGRO_SHADER_GLSL) { + else if (platform == A5O_SHADER_GLSL) { *vsource = "data/ex_shader_vertex.glsl"; *psource = "data/ex_shader_pixel.glsl"; } @@ -37,10 +37,10 @@ static void choose_shader_source(ALLEGRO_SHADER_PLATFORM platform, } } -static ALLEGRO_BITMAP *make_region(ALLEGRO_BITMAP *parent, - int x, int y, int w, int h, ALLEGRO_SHADER *shader) +static A5O_BITMAP *make_region(A5O_BITMAP *parent, + int x, int y, int w, int h, A5O_SHADER *shader) { - ALLEGRO_BITMAP *sub = al_create_sub_bitmap(parent, x, y, w, h); + A5O_BITMAP *sub = al_create_sub_bitmap(parent, x, y, w, h); if (sub) { al_set_target_bitmap(sub); al_use_shader(shader); @@ -51,14 +51,14 @@ static ALLEGRO_BITMAP *make_region(ALLEGRO_BITMAP *parent, int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *image; - ALLEGRO_BITMAP *backbuffer; - ALLEGRO_BITMAP *region[4]; - ALLEGRO_SHADER *shader; + A5O_DISPLAY *display; + A5O_BITMAP *image; + A5O_BITMAP *backbuffer; + A5O_BITMAP *region[4]; + A5O_SHADER *shader; const char *vsource; const char *psource; - ALLEGRO_TRANSFORM t; + A5O_TRANSFORM t; int i; (void)argc; @@ -71,7 +71,7 @@ int main(int argc, char **argv) al_init_image_addon(); init_platform_specific(); - al_set_new_display_flags(ALLEGRO_PROGRAMMABLE_PIPELINE); + al_set_new_display_flags(A5O_PROGRAMMABLE_PIPELINE); display = al_create_display(640, 480); if (!display) { abort_example("Could not create display.\n"); @@ -83,7 +83,7 @@ int main(int argc, char **argv) } /* Create the shader. */ - shader = al_create_shader(ALLEGRO_SHADER_AUTO); + shader = al_create_shader(A5O_SHADER_AUTO); if (!shader) { abort_example("Could not create shader.\n"); } @@ -91,11 +91,11 @@ int main(int argc, char **argv) if (!vsource|| !psource) { abort_example("Could not load source files.\n"); } - if (!al_attach_shader_source_file(shader, ALLEGRO_VERTEX_SHADER, vsource)) { + if (!al_attach_shader_source_file(shader, A5O_VERTEX_SHADER, vsource)) { abort_example("al_attach_shader_source_file failed: %s\n", al_get_shader_log(shader)); } - if (!al_attach_shader_source_file(shader, ALLEGRO_PIXEL_SHADER, psource)) { + if (!al_attach_shader_source_file(shader, A5O_PIXEL_SHADER, psource)) { abort_example("al_attach_shader_source_file failed: %s\n", al_get_shader_log(shader)); } @@ -120,9 +120,9 @@ int main(int argc, char **argv) al_use_transform(&t); for (;;) { - ALLEGRO_KEYBOARD_STATE s; + A5O_KEYBOARD_STATE s; al_get_keyboard_state(&s); - if (al_key_down(&s, ALLEGRO_KEY_ESCAPE)) + if (al_key_down(&s, A5O_KEY_ESCAPE)) break; for (i = 0; i < MAX_REGION; i++) { diff --git a/examples/ex_stream_file.c b/examples/ex_stream_file.c index b6485e7087..7c239a226c 100644 --- a/examples/ex_stream_file.c +++ b/examples/ex_stream_file.c @@ -25,8 +25,8 @@ char *default_files[] = {NULL, "../demos/skater/data/menu/skate2.ogg"}; int main(int argc, char **argv) { int i; - ALLEGRO_VOICE* voice; - ALLEGRO_MIXER* mixer; + A5O_VOICE* voice; + A5O_MIXER* mixer; bool loop = false; int arg_start = 1; @@ -54,18 +54,18 @@ int main(int argc, char **argv) abort_example("Could not init sound!\n"); } - voice = al_create_voice(44100, ALLEGRO_AUDIO_DEPTH_INT16, - ALLEGRO_CHANNEL_CONF_2); + voice = al_create_voice(44100, A5O_AUDIO_DEPTH_INT16, + A5O_CHANNEL_CONF_2); if (!voice) { - abort_example("Could not create ALLEGRO_VOICE.\n"); + abort_example("Could not create A5O_VOICE.\n"); } log_printf("Voice created.\n"); #ifndef BYPASS_MIXER - mixer = al_create_mixer(44100, ALLEGRO_AUDIO_DEPTH_FLOAT32, - ALLEGRO_CHANNEL_CONF_2); + mixer = al_create_mixer(44100, A5O_AUDIO_DEPTH_FLOAT32, + A5O_CHANNEL_CONF_2); if (!mixer) { - abort_example("Could not create ALLEGRO_MIXER.\n"); + abort_example("Could not create A5O_MIXER.\n"); } log_printf("Mixer created.\n"); @@ -76,11 +76,11 @@ int main(int argc, char **argv) for (i = arg_start; i < argc; ++i) { - ALLEGRO_AUDIO_STREAM* stream; + A5O_AUDIO_STREAM* stream; const char* filename = argv[i]; bool playing = true; - ALLEGRO_EVENT event; - ALLEGRO_EVENT_QUEUE* queue = al_create_event_queue(); + A5O_EVENT event; + A5O_EVENT_QUEUE* queue = al_create_event_queue(); stream = al_load_audio_stream(filename, 4, 2048); if (!stream) { @@ -90,13 +90,13 @@ int main(int argc, char **argv) } } if (!stream) { - log_printf("Could not create an ALLEGRO_AUDIO_STREAM from '%s'!\n", + log_printf("Could not create an A5O_AUDIO_STREAM from '%s'!\n", filename); continue; } log_printf("Stream created from '%s'.\n", filename); if (loop) { - al_set_audio_stream_playmode(stream, loop ? ALLEGRO_PLAYMODE_LOOP : ALLEGRO_PLAYMODE_ONCE); + al_set_audio_stream_playmode(stream, loop ? A5O_PLAYMODE_LOOP : A5O_PLAYMODE_ONCE); } al_register_event_source(queue, al_get_audio_stream_event_source(stream)); @@ -115,7 +115,7 @@ int main(int argc, char **argv) log_printf("Playing %s ... Waiting for stream to finish ", filename); do { al_wait_for_event(queue, &event); - if(event.type == ALLEGRO_EVENT_AUDIO_STREAM_FINISHED) + if(event.type == A5O_EVENT_AUDIO_STREAM_FINISHED) playing = false; } while (playing); log_printf("\n"); diff --git a/examples/ex_stream_seek.c b/examples/ex_stream_seek.c index 6a02408390..40b9ac890c 100644 --- a/examples/ex_stream_seek.c +++ b/examples/ex_stream_seek.c @@ -14,11 +14,11 @@ #include "common.c" -ALLEGRO_DISPLAY *display; -ALLEGRO_TIMER *timer; -ALLEGRO_EVENT_QUEUE *queue; -ALLEGRO_FONT *basic_font = NULL; -ALLEGRO_AUDIO_STREAM *music_stream = NULL; +A5O_DISPLAY *display; +A5O_TIMER *timer; +A5O_EVENT_QUEUE *queue; +A5O_FONT *basic_font = NULL; +A5O_AUDIO_STREAM *music_stream = NULL; const char *stream_filename = "data/welcome.wav"; float slider_pos = 0.0; @@ -105,12 +105,12 @@ static void render(void) double w = al_get_display_width(display) - 20; double loop_start_pos = w * (loop_start / length); double loop_end_pos = w * (loop_end / length); - ALLEGRO_COLOR c = al_map_rgb(255, 255, 255); + A5O_COLOR c = al_map_rgb(255, 255, 255); al_clear_to_color(al_map_rgb(64, 64, 128)); /* render "music player" */ - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_draw_textf(basic_font, c, 0, 0, 0, "Playing %s", stream_filename); print_time(8, 24, pos); al_draw_textf(basic_font, c, 100, 24, 0, "/"); @@ -166,69 +166,69 @@ static void maybe_fiddle_sliders(int mx, int my) } } -static void event_handler(const ALLEGRO_EVENT * event) +static void event_handler(const A5O_EVENT * event) { int i; switch (event->type) { /* Was the X button on the window pressed? */ - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: exiting = true; break; /* Was a key pressed? */ - case ALLEGRO_EVENT_KEY_CHAR: - if (event->keyboard.keycode == ALLEGRO_KEY_LEFT) { + case A5O_EVENT_KEY_CHAR: + if (event->keyboard.keycode == A5O_KEY_LEFT) { double pos = al_get_audio_stream_position_secs(music_stream); pos -= 5.0; if (pos < 0.0) pos = 0.0; al_seek_audio_stream_secs(music_stream, pos); } - else if (event->keyboard.keycode == ALLEGRO_KEY_RIGHT) { + else if (event->keyboard.keycode == A5O_KEY_RIGHT) { double pos = al_get_audio_stream_position_secs(music_stream); pos += 5.0; if (!al_seek_audio_stream_secs(music_stream, pos)) log_printf("seek error!\n"); } - else if (event->keyboard.keycode == ALLEGRO_KEY_R) { + else if (event->keyboard.keycode == A5O_KEY_R) { if (!al_rewind_audio_stream(music_stream)) { log_printf("rewind error!\n"); } } - else if (event->keyboard.keycode == ALLEGRO_KEY_SPACE) { + else if (event->keyboard.keycode == A5O_KEY_SPACE) { bool playing; playing = al_get_audio_stream_playing(music_stream); playing = !playing; al_set_audio_stream_playing(music_stream, playing); } - else if (event->keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + else if (event->keyboard.keycode == A5O_KEY_ESCAPE) { exiting = true; } break; - case ALLEGRO_EVENT_MOUSE_BUTTON_DOWN: + case A5O_EVENT_MOUSE_BUTTON_DOWN: mouse_button[event->mouse.button] = 1; maybe_fiddle_sliders(event->mouse.x, event->mouse.y); break; - case ALLEGRO_EVENT_MOUSE_AXES: + case A5O_EVENT_MOUSE_AXES: maybe_fiddle_sliders(event->mouse.x, event->mouse.y); break; - case ALLEGRO_EVENT_MOUSE_BUTTON_UP: + case A5O_EVENT_MOUSE_BUTTON_UP: mouse_button[event->mouse.button] = 0; break; - case ALLEGRO_EVENT_MOUSE_LEAVE_DISPLAY: + case A5O_EVENT_MOUSE_LEAVE_DISPLAY: for (i = 0; i < 16; i++) mouse_button[i] = 0; break; /* Is it time for the next timer tick? */ - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: logic(); render(); break; - case ALLEGRO_EVENT_AUDIO_STREAM_FINISHED: + case A5O_EVENT_AUDIO_STREAM_FINISHED: log_printf("Stream finished.\n"); break; } @@ -236,12 +236,12 @@ static void event_handler(const ALLEGRO_EVENT * event) int main(int argc, char *argv[]) { - ALLEGRO_CONFIG *config; - ALLEGRO_EVENT event; + A5O_CONFIG *config; + A5O_EVENT event; unsigned buffer_count; unsigned samples; const char *s; - ALLEGRO_PLAYMODE playmode = ALLEGRO_PLAYMODE_LOOP; + A5O_PLAYMODE playmode = A5O_PLAYMODE_LOOP; initialize(); @@ -261,13 +261,13 @@ int main(int argc, char *argv[]) } if ((s = al_get_config_value(config, "", "playmode"))) { if (!strcmp(s, "loop")) { - playmode = ALLEGRO_PLAYMODE_LOOP; + playmode = A5O_PLAYMODE_LOOP; } else if (!strcmp(s, "once")) { - playmode = ALLEGRO_PLAYMODE_ONCE; + playmode = A5O_PLAYMODE_ONCE; } else if (!strcmp(s, "loop_once")) { - playmode = ALLEGRO_PLAYMODE_LOOP_ONCE; + playmode = A5O_PLAYMODE_LOOP_ONCE; } } al_destroy_config(config); diff --git a/examples/ex_subbitmap.c b/examples/ex_subbitmap.c index 60d3ba3106..1a7ff9a8d2 100644 --- a/examples/ex_subbitmap.c +++ b/examples/ex_subbitmap.c @@ -30,10 +30,10 @@ enum { }; -ALLEGRO_DISPLAY *src_display; -ALLEGRO_DISPLAY *dst_display; -ALLEGRO_EVENT_QUEUE *queue; -ALLEGRO_BITMAP *src_bmp; +A5O_DISPLAY *src_display; +A5O_DISPLAY *dst_display; +A5O_EVENT_QUEUE *queue; +A5O_BITMAP *src_bmp; int src_x1 = SRC_X; int src_y1 = SRC_Y; @@ -49,9 +49,9 @@ int draw_flags = 0; int main(int argc, char **argv) { - ALLEGRO_BITMAP *src_subbmp[2] = {NULL, NULL}; - ALLEGRO_BITMAP *dst_subbmp[2] = {NULL, NULL}; - ALLEGRO_EVENT event; + A5O_BITMAP *src_subbmp[2] = {NULL, NULL}; + A5O_BITMAP *dst_subbmp[2] = {NULL, NULL}; + A5O_EVENT event; bool mouse_down; bool recreate_subbitmaps; bool redraw; @@ -67,7 +67,7 @@ int main(int argc, char **argv) open_log(); - al_set_new_display_flags(ALLEGRO_GENERATE_EXPOSE_EVENTS); + al_set_new_display_flags(A5O_GENERATE_EXPOSE_EVENTS); src_display = al_create_display(SRC_WIDTH, SRC_HEIGHT); if (!src_display) { abort_example("Error creating display\n"); @@ -234,11 +234,11 @@ int main(int argc, char **argv) } al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } - if (event.type == ALLEGRO_EVENT_KEY_CHAR) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_CHAR) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } if (event.keyboard.unichar == '1') { @@ -250,26 +250,26 @@ int main(int argc, char **argv) redraw = true; } else if (event.keyboard.unichar == 'h') { - draw_flags ^= ALLEGRO_FLIP_HORIZONTAL; + draw_flags ^= A5O_FLIP_HORIZONTAL; redraw = true; } else if (event.keyboard.unichar == 'v') { - draw_flags ^= ALLEGRO_FLIP_VERTICAL; + draw_flags ^= A5O_FLIP_VERTICAL; redraw = true; } else if (event.keyboard.unichar == 'm') { - ALLEGRO_BITMAP *temp = src_bmp; + A5O_BITMAP *temp = src_bmp; use_memory = !use_memory; log_printf("Using a %s bitmap.\n", use_memory ? "memory" : "video"); al_set_new_bitmap_flags(use_memory ? - ALLEGRO_MEMORY_BITMAP : ALLEGRO_VIDEO_BITMAP); + A5O_MEMORY_BITMAP : A5O_VIDEO_BITMAP); src_bmp = al_clone_bitmap(temp); al_destroy_bitmap(temp); redraw = true; recreate_subbitmaps = true; } } - else if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN && + else if (event.type == A5O_EVENT_MOUSE_BUTTON_DOWN && event.mouse.button == 1) { if (event.mouse.display == src_display) { src_x1 = src_x2 = event.mouse.x; @@ -282,7 +282,7 @@ int main(int argc, char **argv) mouse_down = true; redraw = true; } - else if (event.type == ALLEGRO_EVENT_MOUSE_AXES) { + else if (event.type == A5O_EVENT_MOUSE_AXES) { if (mouse_down) { if (event.mouse.display == src_display) { src_x2 = event.mouse.x; @@ -295,13 +295,13 @@ int main(int argc, char **argv) redraw = true; } } - else if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_UP && + else if (event.type == A5O_EVENT_MOUSE_BUTTON_UP && event.mouse.button == 1) { mouse_down = false; recreate_subbitmaps = true; redraw = true; } - else if (event.type == ALLEGRO_EVENT_DISPLAY_EXPOSE) { + else if (event.type == A5O_EVENT_DISPLAY_EXPOSE) { redraw = true; } } diff --git a/examples/ex_synth.cpp b/examples/ex_synth.cpp index c058442c3b..1166d4006a 100644 --- a/examples/ex_synth.cpp +++ b/examples/ex_synth.cpp @@ -16,7 +16,7 @@ #include "common.c" -#define PI (ALLEGRO_PI) +#define PI (A5O_PI) #define TWOPI (2.0 * PI) #define SAMPLES_PER_BUFFER (1024) #define STREAM_FREQUENCY (44100) @@ -47,11 +47,11 @@ static void sawtooth(float *buf, size_t samples, double t, /* globals */ -ALLEGRO_FONT *font_gui; -ALLEGRO_AUDIO_STREAM *streams[5]; +A5O_FONT *font_gui; +A5O_AUDIO_STREAM *streams[5]; bool saving = false; -ALLEGRO_FILE *save_fp = NULL; +A5O_FILE *save_fp = NULL; static void generate_wave(Waveform type, float *buf, size_t samples, double t, @@ -142,7 +142,7 @@ static void sawtooth(float *buf, size_t samples, double t, static void mixer_pp_callback(void *buf, unsigned int samples, void *userdata) { - ALLEGRO_MIXER *mixer = (ALLEGRO_MIXER *)userdata; + A5O_MIXER *mixer = (A5O_MIXER *)userdata; int nch; int sample_size; @@ -150,10 +150,10 @@ static void mixer_pp_callback(void *buf, unsigned int samples, void *userdata) return; switch (al_get_mixer_channels(mixer)) { - case ALLEGRO_CHANNEL_CONF_1: + case A5O_CHANNEL_CONF_1: nch = 1; break; - case ALLEGRO_CHANNEL_CONF_2: + case A5O_CHANNEL_CONF_2: nch = 2; break; default: @@ -330,14 +330,14 @@ class Prog : public EventHandler { SaveButton save_button; public: - Prog(const Theme & theme, ALLEGRO_DISPLAY *display); + Prog(const Theme & theme, A5O_DISPLAY *display); virtual ~Prog() {} void run(); - void handle_event(const ALLEGRO_EVENT & event); + void handle_event(const A5O_EVENT & event); }; -Prog::Prog(const Theme & theme, ALLEGRO_DISPLAY *display) : +Prog::Prog(const Theme & theme, A5O_DISPLAY *display) : d(Dialog(theme, display, 30, 26)), save_button(SaveButton()) { @@ -376,16 +376,16 @@ void Prog::run() } -void Prog::handle_event(const ALLEGRO_EVENT & event) +void Prog::handle_event(const A5O_EVENT & event) { - if (event.type == ALLEGRO_EVENT_AUDIO_STREAM_FRAGMENT) { - ALLEGRO_AUDIO_STREAM *stream; + if (event.type == A5O_EVENT_AUDIO_STREAM_FRAGMENT) { + A5O_AUDIO_STREAM *stream; Group *group; void *buf; float gain; float pan; - stream = (ALLEGRO_AUDIO_STREAM *) event.any.source; + stream = (A5O_AUDIO_STREAM *) event.any.source; buf = al_get_audio_stream_fragment(stream); if (!buf) { /* This is a normal condition that you must deal with. */ @@ -405,7 +405,7 @@ void Prog::handle_event(const ALLEGRO_EVENT & event) else group = NULL; - ALLEGRO_ASSERT(group); + A5O_ASSERT(group); if (group) { group->generate((float *) buf, SAMPLES_PER_BUFFER); @@ -426,7 +426,7 @@ void Prog::handle_event(const ALLEGRO_EVENT & event) int main(int argc, char *argv[]) { - ALLEGRO_DISPLAY *display; + A5O_DISPLAY *display; (void)argc; (void)argv; @@ -444,7 +444,7 @@ int main(int argc, char *argv[]) al_init_ttf_addon(); init_platform_specific(); - al_set_new_display_flags(ALLEGRO_GENERATE_EXPOSE_EVENTS); + al_set_new_display_flags(A5O_GENERATE_EXPOSE_EVENTS); display = al_create_display(800, 600); if (!display) { abort_example("Unable to create display\n"); @@ -468,9 +468,9 @@ int main(int argc, char *argv[]) unsigned samples = SAMPLES_PER_BUFFER; unsigned freq = STREAM_FREQUENCY; void *buf; - ALLEGRO_AUDIO_DEPTH depth = ALLEGRO_AUDIO_DEPTH_FLOAT32; - ALLEGRO_CHANNEL_CONF ch = ALLEGRO_CHANNEL_CONF_1; - ALLEGRO_MIXER *mixer = al_get_default_mixer(); + A5O_AUDIO_DEPTH depth = A5O_AUDIO_DEPTH_FLOAT32; + A5O_CHANNEL_CONF ch = A5O_CHANNEL_CONF_1; + A5O_MIXER *mixer = al_get_default_mixer(); for (int i = 0; i < 5; i++) { streams[i] = al_create_audio_stream(buffers, samples, freq, depth, ch); diff --git a/examples/ex_threads.c b/examples/ex_threads.c index ef60b8d3e7..3176d977b5 100644 --- a/examples/ex_threads.c +++ b/examples/ex_threads.c @@ -50,10 +50,10 @@ static void gen_square(Square *sq, int w, int h) sq->dy = 3.0 * rand11(); sq->size = 10 + (rand() % 10); sq->dsize = rand11(); - sq->rot = ALLEGRO_PI * rand01(); + sq->rot = A5O_PI * rand01(); sq->drot = rand11() / 3.0; sq->life = 0.0; - sq->dlife = (ALLEGRO_PI / 100.0) + (ALLEGRO_PI / 30.0) * rand01(); + sq->dlife = (A5O_PI / 100.0) + (A5O_PI / 30.0) * rand01(); } @@ -65,8 +65,8 @@ static void animate_square(Square *sq) sq->rot += sq->drot; sq->life += sq->dlife; - if (sq->size < 1.0 || sq->life > ALLEGRO_PI) { - ALLEGRO_BITMAP *bmp = al_get_target_bitmap(); + if (sq->size < 1.0 || sq->life > A5O_PI) { + A5O_BITMAP *bmp = al_get_target_bitmap(); gen_square(sq, al_get_bitmap_width(bmp), al_get_bitmap_height(bmp)); } } @@ -74,16 +74,16 @@ static void animate_square(Square *sq) static void draw_square(Square *sq) { - ALLEGRO_TRANSFORM trans; + A5O_TRANSFORM trans; float alpha; float size; - ALLEGRO_COLOR tint; + A5O_COLOR tint; al_build_transform(&trans, sq->cx, sq->cy, 1.0, 1.0, sq->rot); al_use_transform(&trans); alpha = sin(sq->life); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ALPHA, A5O_ONE); tint = al_map_rgba_f(0.5, 0.3, 0, alpha); size = sq->size; @@ -94,16 +94,16 @@ static void draw_square(Square *sq) } -static void *thread_func(ALLEGRO_THREAD *thr, void *arg) +static void *thread_func(A5O_THREAD *thr, void *arg) { const int INITIAL_WIDTH = 300; const int INITIAL_HEIGHT = 300; const Background *background = (Background *) arg; - ALLEGRO_DISPLAY *display; - ALLEGRO_EVENT_QUEUE *queue = NULL; - ALLEGRO_TIMER *timer = NULL; - ALLEGRO_EVENT event; - ALLEGRO_STATE state; + A5O_DISPLAY *display; + A5O_EVENT_QUEUE *queue = NULL; + A5O_TIMER *timer = NULL; + A5O_EVENT event; + A5O_STATE state; Square squares[MAX_SQUARES]; double theta = 0.0; bool redraw = true; @@ -111,7 +111,7 @@ static void *thread_func(ALLEGRO_THREAD *thr, void *arg) (void)thr; - al_set_new_display_flags(ALLEGRO_RESIZABLE); + al_set_new_display_flags(A5O_RESIZABLE); display = al_create_display(INITIAL_WIDTH, INITIAL_HEIGHT); if (!display) { @@ -139,14 +139,14 @@ static void *thread_func(ALLEGRO_THREAD *thr, void *arg) while (true) { if (al_is_event_queue_empty(queue) && redraw) { double r = 0.7 + 0.3 * (sin(theta) + 1.0) / 2.0; - ALLEGRO_COLOR c = al_map_rgb_f( + A5O_COLOR c = al_map_rgb_f( background->rmax * r, background->gmax * r, background->bmax * r ); al_clear_to_color(c); - al_store_state(&state, ALLEGRO_STATE_BLENDER | ALLEGRO_STATE_TRANSFORM); + al_store_state(&state, A5O_STATE_BLENDER | A5O_STATE_TRANSFORM); for (i = 0; i < MAX_SQUARES; i++) { draw_square(&squares[i]); } @@ -157,21 +157,21 @@ static void *thread_func(ALLEGRO_THREAD *thr, void *arg) } al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_TIMER) { + if (event.type == A5O_EVENT_TIMER) { for (i = 0; i < MAX_SQUARES; i++) { animate_square(&squares[i]); } theta += 0.1; redraw = true; } - else if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + else if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } - else if (event.type == ALLEGRO_EVENT_KEY_DOWN - && event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + else if (event.type == A5O_EVENT_KEY_DOWN + && event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } - else if (event.type == ALLEGRO_EVENT_DISPLAY_RESIZE) { + else if (event.type == A5O_EVENT_DISPLAY_RESIZE) { al_acknowledge_resize(event.display.source); } } @@ -194,7 +194,7 @@ static void *thread_func(ALLEGRO_THREAD *thr, void *arg) int main(int argc, char **argv) { - ALLEGRO_THREAD *thread[MAX_THREADS]; + A5O_THREAD *thread[MAX_THREADS]; Background background[MAX_BACKGROUNDS] = { { 1.0, 0.5, 0.5 }, { 0.5, 1.0, 0.5 }, diff --git a/examples/ex_threads2.c b/examples/ex_threads2.c index 4fbd785783..7154f05eb2 100644 --- a/examples/ex_threads2.c +++ b/examples/ex_threads2.c @@ -23,9 +23,9 @@ typedef struct ThreadInfo { - ALLEGRO_BITMAP *bitmap; - ALLEGRO_MUTEX *mutex; - ALLEGRO_COND *cond; + A5O_BITMAP *bitmap; + A5O_MUTEX *mutex; + A5O_COND *cond; bool is_paused; int random_seed; double target_x, target_y; @@ -101,10 +101,10 @@ static void random_palette(unsigned char palette[256][3], int *seed) } -static void draw_mandel_line(ALLEGRO_BITMAP *bitmap, const Viewport *viewport, +static void draw_mandel_line(A5O_BITMAP *bitmap, const Viewport *viewport, unsigned char palette[256][3], const int y) { - ALLEGRO_LOCKED_REGION *lr; + A5O_LOCKED_REGION *lr; unsigned char *rgb; double xlower, ylower; double xscale, yscale; @@ -117,8 +117,8 @@ static void draw_mandel_line(ALLEGRO_BITMAP *bitmap, const Viewport *viewport, w = al_get_bitmap_width(bitmap); h = al_get_bitmap_height(bitmap); - if (!(lr = al_lock_bitmap_region(bitmap, 0, y, w, 1, ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA, - ALLEGRO_LOCK_WRITEONLY))) { + if (!(lr = al_lock_bitmap_region(bitmap, 0, y, w, 1, A5O_PIXEL_FORMAT_ANY_24_NO_ALPHA, + A5O_LOCK_WRITEONLY))) { abort_example("draw_mandel_line: al_lock_bitmap_region failed\n"); } @@ -147,7 +147,7 @@ static void draw_mandel_line(ALLEGRO_BITMAP *bitmap, const Viewport *viewport, } -static void *thread_func(ALLEGRO_THREAD *thr, void *arg) +static void *thread_func(A5O_THREAD *thr, void *arg) { ThreadInfo *info = (ThreadInfo *) arg; Viewport viewport; @@ -210,7 +210,7 @@ static void show_images(void) int y = 0; int i; - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); for (i = 0; i < NUM_THREADS; i++) { /* for lots of threads, this is not good enough */ al_lock_mutex(thread_info[i].mutex); @@ -247,11 +247,11 @@ static void toggle_pausedness(int n) int main(int argc, char **argv) { - ALLEGRO_THREAD *thread[NUM_THREADS]; - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; + A5O_THREAD *thread[NUM_THREADS]; + A5O_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; bool need_draw; int i; @@ -293,8 +293,8 @@ int main(int argc, char **argv) * functions accessing the display check for it.. not sure it's worth the * additional complexity though. */ - al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_RGB_888); - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_format(A5O_PIXEL_FORMAT_RGB_888); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); for (i = 0; i < NUM_THREADS; i++) { thread_info[i].bitmap = al_create_bitmap(W, H); if (!thread_info[i].bitmap) { @@ -338,10 +338,10 @@ int main(int argc, char **argv) } al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_TIMER) { + if (event.type == A5O_EVENT_TIMER) { need_draw = true; } - else if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN) { + else if (event.type == A5O_EVENT_MOUSE_BUTTON_DOWN) { int n = (event.mouse.y / H) * IMAGES_PER_ROW + (event.mouse.x / W); if (n < NUM_THREADS) { double x = event.mouse.x - (event.mouse.x / W) * W; @@ -354,14 +354,14 @@ int main(int argc, char **argv) toggle_pausedness(n); } } - else if (event.type == ALLEGRO_EVENT_DISPLAY_EXPOSE) { + else if (event.type == A5O_EVENT_DISPLAY_EXPOSE) { need_draw = true; } - else if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + else if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } - else if (event.type == ALLEGRO_EVENT_KEY_DOWN) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + else if (event.type == A5O_EVENT_KEY_DOWN) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } need_draw = true; diff --git a/examples/ex_timedwait.c b/examples/ex_timedwait.c index bd9209eec9..f9c3ce7235 100644 --- a/examples/ex_timedwait.c +++ b/examples/ex_timedwait.c @@ -10,16 +10,16 @@ #include "common.c" -static bool test_relative_timeout(ALLEGRO_FONT *font, ALLEGRO_EVENT_QUEUE *queue); -static bool test_absolute_timeout(ALLEGRO_FONT *font, ALLEGRO_EVENT_QUEUE *queue); +static bool test_relative_timeout(A5O_FONT *font, A5O_EVENT_QUEUE *queue); +static bool test_absolute_timeout(A5O_FONT *font, A5O_EVENT_QUEUE *queue); int main(int argc, char **argv) { - ALLEGRO_DISPLAY *dpy; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_FONT *font; + A5O_DISPLAY *dpy; + A5O_EVENT_QUEUE *queue; + A5O_FONT *font; (void)argc; (void)argv; @@ -59,22 +59,22 @@ int main(int argc, char **argv) -static bool test_relative_timeout(ALLEGRO_FONT *font, ALLEGRO_EVENT_QUEUE *queue) +static bool test_relative_timeout(A5O_FONT *font, A5O_EVENT_QUEUE *queue) { - ALLEGRO_EVENT event; + A5O_EVENT event; float shade = 0.1; while (true) { if (al_wait_for_event_timed(queue, &event, 0.1)) { - if (event.type == ALLEGRO_EVENT_KEY_DOWN) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_DOWN) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) { return true; } else { shade = 0.0; } } - else if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + else if (event.type == A5O_EVENT_DISPLAY_CLOSE) { return false; } } @@ -86,32 +86,32 @@ static bool test_relative_timeout(ALLEGRO_FONT *font, ALLEGRO_EVENT_QUEUE *queue } al_clear_to_color(al_map_rgba_f(0.5 * shade, 0.25 * shade, shade, 0)); - al_draw_textf(font, al_map_rgb_f(1., 1., 1.), 320, 240, ALLEGRO_ALIGN_CENTRE, "Relative timeout (%.2f)", shade); - al_draw_text(font, al_map_rgb_f(1., 1., 1.), 320, 260, ALLEGRO_ALIGN_CENTRE, "Esc to move on, Space to restart."); + al_draw_textf(font, al_map_rgb_f(1., 1., 1.), 320, 240, A5O_ALIGN_CENTRE, "Relative timeout (%.2f)", shade); + al_draw_text(font, al_map_rgb_f(1., 1., 1.), 320, 260, A5O_ALIGN_CENTRE, "Esc to move on, Space to restart."); al_flip_display(); } } -static bool test_absolute_timeout(ALLEGRO_FONT *font, ALLEGRO_EVENT_QUEUE *queue) +static bool test_absolute_timeout(A5O_FONT *font, A5O_EVENT_QUEUE *queue) { - ALLEGRO_TIMEOUT timeout; - ALLEGRO_EVENT event; + A5O_TIMEOUT timeout; + A5O_EVENT event; float shade = 0.1; bool ret; while (true) { al_init_timeout(&timeout, 0.1); while ((ret = al_wait_for_event_until(queue, &event, &timeout))) { - if (event.type == ALLEGRO_EVENT_KEY_DOWN) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_DOWN) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) { return true; } else { shade = 0.; } } - else if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + else if (event.type == A5O_EVENT_DISPLAY_CLOSE) { return false; } } @@ -124,8 +124,8 @@ static bool test_absolute_timeout(ALLEGRO_FONT *font, ALLEGRO_EVENT_QUEUE *queue } al_clear_to_color(al_map_rgba_f(shade, 0.5 * shade, 0.25 * shade, 0)); - al_draw_textf(font, al_map_rgb_f(1., 1., 1.), 320, 240, ALLEGRO_ALIGN_CENTRE, "Absolute timeout (%.2f)", shade); - al_draw_text(font, al_map_rgb_f(1., 1., 1.), 320, 260, ALLEGRO_ALIGN_CENTRE, "Esc to move on, Space to restart."); + al_draw_textf(font, al_map_rgb_f(1., 1., 1.), 320, 240, A5O_ALIGN_CENTRE, "Absolute timeout (%.2f)", shade); + al_draw_text(font, al_map_rgb_f(1., 1., 1.), 320, 260, A5O_ALIGN_CENTRE, "Esc to move on, Space to restart."); al_flip_display(); } } diff --git a/examples/ex_timer.c b/examples/ex_timer.c index e12ae2dbe6..8872f6ffb3 100644 --- a/examples/ex_timer.c +++ b/examples/ex_timer.c @@ -13,8 +13,8 @@ /* A structure holding all variables of our example program. */ struct Example { - ALLEGRO_FONT *myfont; /* Our font. */ - ALLEGRO_EVENT_QUEUE *queue; /* Our events queue. */ + A5O_FONT *myfont; /* Our font. */ + A5O_EVENT_QUEUE *queue; /* Our events queue. */ double FPS; /* How often to update per second. */ @@ -94,7 +94,7 @@ static void draw(void) } /* Called a fixed amount of times per second. */ -static void tick(ALLEGRO_TIMER_EVENT* timer_event) +static void tick(A5O_TIMER_EVENT* timer_event) { int i; @@ -138,22 +138,22 @@ static void tick(ALLEGRO_TIMER_EVENT* timer_event) /* Run our test. */ static void run(void) { - ALLEGRO_EVENT event; + A5O_EVENT event; while (1) { al_wait_for_event(ex.queue, &event); switch (event.type) { /* Was the X button on the window pressed? */ - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: return; /* Was a key pressed? */ - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) return; break; /* Is it time for the next timer tick? */ - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: tick(&event.timer); break; } @@ -162,8 +162,8 @@ static void run(void) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; + A5O_DISPLAY *display; + A5O_TIMER *timer; (void)argc; (void)argv; diff --git a/examples/ex_timer_pause.c b/examples/ex_timer_pause.c index f57a5a8696..7f59ff09f6 100644 --- a/examples/ex_timer_pause.c +++ b/examples/ex_timer_pause.c @@ -19,11 +19,11 @@ int main(int argc, char **argv) const double pre_pause = 2; // how long to wait before pausing const double pause = 2; // how long to pause timer for - ALLEGRO_TIMER *timer1 = NULL; - ALLEGRO_TIMER *timer2 = NULL; - ALLEGRO_EVENT_QUEUE *queue = NULL; + A5O_TIMER *timer1 = NULL; + A5O_TIMER *timer2 = NULL; + A5O_EVENT_QUEUE *queue = NULL; - ALLEGRO_EVENT ev; + A5O_EVENT ev; (void)argc; (void)argv; diff --git a/examples/ex_touch_input.c b/examples/ex_touch_input.c index fd9258587b..c870c1fc8e 100644 --- a/examples/ex_touch_input.c +++ b/examples/ex_touch_input.c @@ -42,9 +42,9 @@ int main(int argc, char **argv) bool quit = false; bool background = false; TOUCH touches[MAX_TOUCHES]; - ALLEGRO_DISPLAY *display; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; + A5O_DISPLAY *display; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; (void)argc; (void)argv; @@ -74,10 +74,10 @@ int main(int argc, char **argv) } al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: quit = true; break; - case ALLEGRO_EVENT_TOUCH_BEGIN: { + case A5O_EVENT_TOUCH_BEGIN: { int i = num_touches; if (num_touches < MAX_TOUCHES) { touches[i].id = event.touch.id; @@ -87,7 +87,7 @@ int main(int argc, char **argv) } break; } - case ALLEGRO_EVENT_TOUCH_END: { + case A5O_EVENT_TOUCH_END: { int i = find_index(event.touch.id, num_touches, touches); if (i >= 0 && i < num_touches) { touches[i] = touches[num_touches - 1]; @@ -95,7 +95,7 @@ int main(int argc, char **argv) } break; } - case ALLEGRO_EVENT_TOUCH_MOVE: { + case A5O_EVENT_TOUCH_MOVE: { int i = find_index(event.touch.id, num_touches, touches); if (i >= 0) { touches[i].x = event.touch.x; @@ -103,15 +103,15 @@ int main(int argc, char **argv) } break; } - case ALLEGRO_EVENT_DISPLAY_HALT_DRAWING: + case A5O_EVENT_DISPLAY_HALT_DRAWING: background = true; al_acknowledge_drawing_halt(event.display.source); break; - case ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING: + case A5O_EVENT_DISPLAY_RESUME_DRAWING: background = false; al_acknowledge_drawing_resume(event.display.source); break; - case ALLEGRO_EVENT_DISPLAY_RESIZE: + case A5O_EVENT_DISPLAY_RESIZE: al_acknowledge_resize(event.display.source); break; } diff --git a/examples/ex_transform.c b/examples/ex_transform.c index 7bbc2b48ab..ac73aaf72c 100644 --- a/examples/ex_transform.c +++ b/examples/ex_transform.c @@ -10,19 +10,19 @@ int main(int argc, char **argv) { const char *filename; - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *buffer, *bitmap, *subbitmap, *buffer_subbitmap; - ALLEGRO_BITMAP *overlay; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_TRANSFORM transform; + A5O_DISPLAY *display; + A5O_BITMAP *buffer, *bitmap, *subbitmap, *buffer_subbitmap; + A5O_BITMAP *overlay; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_TRANSFORM transform; bool software = false; bool redraw = false; bool blend = false; bool use_subbitmap = true; int w, h; - ALLEGRO_FONT* font; - ALLEGRO_FONT* soft_font; + A5O_FONT* font; + A5O_FONT* soft_font; if (argc > 1) { filename = argv[1]; @@ -62,7 +62,7 @@ int main(int argc, char **argv) abort_example("data/bmpfont.tga not found or failed to load\n"); } - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); buffer = al_create_bitmap(640, 480); buffer_subbitmap = al_create_sub_bitmap(buffer, 50, 50, 640 - 50, 480 - 50); @@ -87,36 +87,36 @@ int main(int argc, char **argv) al_use_transform(&transform); while (1) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) + if (event.type == A5O_EVENT_DISPLAY_CLOSE) break; - if (event.type == ALLEGRO_EVENT_KEY_DOWN) { - if (event.keyboard.keycode == ALLEGRO_KEY_S) { + if (event.type == A5O_EVENT_KEY_DOWN) { + if (event.keyboard.keycode == A5O_KEY_S) { software = !software; if (software) { /* Restore identity transform on display bitmap. */ - ALLEGRO_TRANSFORM identity; + A5O_TRANSFORM identity; al_identity_transform(&identity); al_use_transform(&identity); } - } else if (event.keyboard.keycode == ALLEGRO_KEY_L) { + } else if (event.keyboard.keycode == A5O_KEY_L) { blend = !blend; - } else if (event.keyboard.keycode == ALLEGRO_KEY_B) { + } else if (event.keyboard.keycode == A5O_KEY_B) { use_subbitmap = !use_subbitmap; - } else if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + } else if (event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } } - if (event.type == ALLEGRO_EVENT_TIMER) + if (event.type == A5O_EVENT_TIMER) redraw = true; if (redraw && al_is_event_queue_empty(queue)) { double t = 3.0 + al_get_time(); - ALLEGRO_COLOR tint; + A5O_COLOR tint; redraw = false; - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE); if(blend) tint = al_map_rgba_f(0.5, 0.5, 0.5, 0.5); else @@ -151,31 +151,31 @@ int main(int argc, char **argv) /* Draw some stuff */ al_clear_to_color(al_map_rgb_f(0, 0, 0)); al_draw_tinted_bitmap(bitmap, tint, 0, 0, 0); - al_draw_tinted_scaled_bitmap(bitmap, tint, w / 4, h / 4, w / 2, h / 2, w, 0, w / 2, h / 4, 0);//ALLEGRO_FLIP_HORIZONTAL); - al_draw_tinted_bitmap_region(bitmap, tint, w / 4, h / 4, w / 2, h / 2, 0, h, ALLEGRO_FLIP_VERTICAL); + al_draw_tinted_scaled_bitmap(bitmap, tint, w / 4, h / 4, w / 2, h / 2, w, 0, w / 2, h / 4, 0);//A5O_FLIP_HORIZONTAL); + al_draw_tinted_bitmap_region(bitmap, tint, w / 4, h / 4, w / 2, h / 2, 0, h, A5O_FLIP_VERTICAL); al_draw_tinted_scaled_rotated_bitmap(bitmap, tint, w / 2, h / 2, w + w / 2, h + h / 2, 0.7, 0.7, 0.3, 0); al_draw_pixel(w + w / 2, h + h / 2, al_map_rgb_f(0, 1, 0)); al_put_pixel(w + w / 2 + 2, h + h / 2 + 2, al_map_rgb_f(0, 1, 1)); al_draw_circle(w, h, 50, al_map_rgb_f(1, 0.5, 0), 3); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); if(software) { al_draw_text(soft_font, al_map_rgba_f(1, 1, 1, 1), - 640 / 2, 430, ALLEGRO_ALIGN_CENTRE, "Software Rendering"); + 640 / 2, 430, A5O_ALIGN_CENTRE, "Software Rendering"); al_set_target_backbuffer(display); al_draw_bitmap(buffer, 0, 0, 0); } else { al_draw_text(font, al_map_rgba_f(1, 1, 1, 1), - 640 / 2, 430, ALLEGRO_ALIGN_CENTRE, "Hardware Rendering"); + 640 / 2, 430, A5O_ALIGN_CENTRE, "Hardware Rendering"); } /* Each target bitmap has its own transformation matrix, so this * overlay is unaffected by the transformations set earlier. */ al_set_target_bitmap(overlay); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE); al_draw_text(font, al_map_rgba_f(1, 1, 0, 1), - 0, 10, ALLEGRO_ALIGN_LEFT, "hello!"); + 0, 10, A5O_ALIGN_LEFT, "hello!"); al_set_target_backbuffer(display); al_flip_display(); diff --git a/examples/ex_ttf.c b/examples/ex_ttf.c index 2be31f41e6..ca3376e75b 100644 --- a/examples/ex_ttf.c +++ b/examples/ex_ttf.c @@ -1,4 +1,4 @@ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include @@ -15,13 +15,13 @@ const char *font_file = "data/DejaVuSans.ttf"; struct Example { double fps; - ALLEGRO_FONT *f1, *f2, *f3, *f4, *f5, *f6; - ALLEGRO_FONT *f_alex; - ALLEGRO_CONFIG *config; + A5O_FONT *f1, *f2, *f3, *f4, *f5, *f6; + A5O_FONT *f_alex; + A5O_CONFIG *config; int ranges_count; } ex; -static void print_ranges(ALLEGRO_FONT *f) +static void print_ranges(A5O_FONT *f) { int ranges[MAX_RANGES * 2]; int count; @@ -42,28 +42,28 @@ static const char *get_string(const char *key) return (v) ? v : key; } -static int ustr_at(ALLEGRO_USTR *string, int index) +static int ustr_at(A5O_USTR *string, int index) { return al_ustr_get(string, al_ustr_offset(string, index)); } static void render(void) { - ALLEGRO_COLOR white = al_map_rgba_f(1, 1, 1, 1); - ALLEGRO_COLOR black = al_map_rgba_f(0, 0, 0, 1); - ALLEGRO_COLOR red = al_map_rgba_f(1, 0, 0, 1); - ALLEGRO_COLOR green = al_map_rgba_f(0, 0.5, 0, 1); - ALLEGRO_COLOR blue = al_map_rgba_f(0.1, 0.2, 1, 1); - ALLEGRO_COLOR purple = al_map_rgba_f(0.3, 0.1, 0.2, 1); + A5O_COLOR white = al_map_rgba_f(1, 1, 1, 1); + A5O_COLOR black = al_map_rgba_f(0, 0, 0, 1); + A5O_COLOR red = al_map_rgba_f(1, 0, 0, 1); + A5O_COLOR green = al_map_rgba_f(0, 0.5, 0, 1); + A5O_COLOR blue = al_map_rgba_f(0.1, 0.2, 1, 1); + A5O_COLOR purple = al_map_rgba_f(0.3, 0.1, 0.2, 1); int x, y, w, h, as, de, xpos, ypos; unsigned int index; int target_w, target_h; - ALLEGRO_USTR_INFO info, sub_info; - const ALLEGRO_USTR *u; - ALLEGRO_USTR *tulip = al_ustr_new("Tulip"); - ALLEGRO_USTR *dimension_text = al_ustr_new("Tulip"); - ALLEGRO_USTR *vertical_text = al_ustr_new("Rose."); - ALLEGRO_USTR *dimension_label = al_ustr_new("(dimensions)"); + A5O_USTR_INFO info, sub_info; + const A5O_USTR *u; + A5O_USTR *tulip = al_ustr_new("Tulip"); + A5O_USTR *dimension_text = al_ustr_new("Tulip"); + A5O_USTR *vertical_text = al_ustr_new("Rose."); + A5O_USTR *dimension_label = al_ustr_new("(dimensions)"); int prev_cp = -1; al_clear_to_color(white); @@ -82,13 +82,13 @@ static void render(void) al_draw_rectangle(x + bbx + 0.5, y + bby + 0.5, x + bbx + bbw - 0.5, y + bby + bbh - 0.5, blue, 1); al_draw_rectangle(x + 0.5, y + 0.5, x + bbx + bbw - 0.5, y + bby + bbh - 0.5, green, 1); al_draw_glyph(ex.f2, purple, x, y, cp); - x += al_get_glyph_advance(ex.f2, cp, ALLEGRO_NO_KERNING); + x += al_get_glyph_advance(ex.f2, cp, A5O_NO_KERNING); } al_draw_line(50.5, y+0.5, x+0.5, y+0.5, red, 1); for (index = 0; index < al_ustr_length(dimension_label); index++) { int cp = ustr_at(dimension_label, index); - ALLEGRO_GLYPH g; + A5O_GLYPH g; if (al_get_glyph(ex.f2, prev_cp, cp, &g)) { al_draw_tinted_bitmap_region(g.bitmap, black, g.x, g.y, g.w, g.h, x + 10 + g.kerning + g.offset_x, y + g.offset_y, 0); x += g.advance; @@ -125,13 +125,13 @@ static void render(void) al_draw_textf(ex.f5, black, 50, 395, 0, "forced monochrome"); - ALLEGRO_TRANSFORM t; + A5O_TRANSFORM t; al_identity_transform(&t); al_rotate_transform(&t, al_get_time()); al_translate_transform(&t, 550, 300); al_use_transform(&t); al_draw_textf(ex.f6, black, 0, -al_get_font_line_height(ex.f6) / 2, - ALLEGRO_ALIGN_CENTRE, "T"); + A5O_ALIGN_CENTRE, "T"); al_identity_transform(&t); al_use_transform(&t); @@ -144,7 +144,7 @@ static void render(void) int cp = ustr_at(tulip, index); /* Use al_get_glyph_advance for the stride, with no kerning. */ al_draw_glyph(ex.f3, red, x, y, cp); - x += al_get_glyph_advance(ex.f3, cp, ALLEGRO_NO_KERNING); + x += al_get_glyph_advance(ex.f3, cp, A5O_NO_KERNING); } x = 50; @@ -156,7 +156,7 @@ static void render(void) for (index = 0; index < al_ustr_length(tulip); index ++) { int cp = ustr_at(tulip, index); int ncp = (index < (al_ustr_length(tulip) - 1)) ? - ustr_at(tulip, index + 1) : ALLEGRO_NO_KERNING; + ustr_at(tulip, index + 1) : A5O_NO_KERNING; /* Use al_get_glyph_advance for the stride and apply kerning. */ al_draw_glyph(ex.f3, green, x, y, cp); x += al_get_glyph_advance(ex.f3, cp, ncp); @@ -225,7 +225,7 @@ static void render(void) al_hold_bitmap_drawing(true); - al_draw_textf(ex.f3, black, target_w, 0, ALLEGRO_ALIGN_RIGHT, + al_draw_textf(ex.f3, black, target_w, 0, A5O_ALIGN_RIGHT, "%.1f FPS", ex.fps); al_draw_textf(ex.f3, black, 0, 0, 0, "%s: %d unicode ranges", font_file, @@ -236,9 +236,9 @@ static void render(void) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; + A5O_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; int redraw = 0; double t = 0; @@ -255,8 +255,8 @@ int main(int argc, char **argv) al_init_image_addon(); init_platform_specific(); -#ifdef ALLEGRO_IPHONE - al_set_new_display_flags(ALLEGRO_FULLSCREEN_WINDOW); +#ifdef A5O_IPHONE + al_set_new_display_flags(A5O_FULLSCREEN_WINDOW); #endif display = al_create_display(640, 480); if (!display) { @@ -269,25 +269,25 @@ int main(int argc, char **argv) } ex.f1 = al_load_font(font_file, 48, 0); - ex.f2 = al_load_font(font_file, 48, ALLEGRO_TTF_NO_KERNING); + ex.f2 = al_load_font(font_file, 48, A5O_TTF_NO_KERNING); ex.f3 = al_load_font(font_file, 12, 0); /* Specifying negative values means we specify the glyph height * in pixels, not the usual font size. */ ex.f4 = al_load_font(font_file, -140, 0); - ex.f5 = al_load_font(font_file, 12, ALLEGRO_TTF_MONOCHROME); + ex.f5 = al_load_font(font_file, 12, A5O_TTF_MONOCHROME); - al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR); + al_set_new_bitmap_flags(A5O_MIN_LINEAR | A5O_MAG_LINEAR); ex.f6 = al_load_font(font_file, -140, 0); al_set_new_bitmap_flags(0); { int ranges[] = {0x1F40A, 0x1F40A}; - ALLEGRO_BITMAP *icon = al_load_bitmap("data/icon.png"); + A5O_BITMAP *icon = al_load_bitmap("data/icon.png"); if (!icon) { abort_example("Couldn't load data/icon.png.\n"); } - ALLEGRO_BITMAP *glyph = al_create_bitmap(50, 50); + A5O_BITMAP *glyph = al_create_bitmap(50, 50); al_set_target_bitmap(glyph); al_clear_to_color(al_map_rgba_f(0, 0, 0, 0)); al_draw_rectangle(0.5, 0.5, 49.5, 49.5, al_map_rgb_f(1, 1, 0), @@ -320,15 +320,15 @@ int main(int argc, char **argv) al_start_timer(timer); while (true) { - ALLEGRO_EVENT event; + A5O_EVENT event; al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) + if (event.type == A5O_EVENT_DISPLAY_CLOSE) break; - if (event.type == ALLEGRO_EVENT_KEY_DOWN && - event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_DOWN && + event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } - if (event.type == ALLEGRO_EVENT_TIMER) + if (event.type == A5O_EVENT_TIMER) redraw++; while (redraw > 0 && al_is_event_queue_empty(queue)) { diff --git a/examples/ex_user_events.c b/examples/ex_user_events.c index bf25367760..89963fb0b1 100644 --- a/examples/ex_user_events.c +++ b/examples/ex_user_events.c @@ -7,8 +7,8 @@ #include "common.c" -#define MY_SIMPLE_EVENT_TYPE ALLEGRO_GET_EVENT_TYPE('m', 's', 'e', 't') -#define MY_COMPLEX_EVENT_TYPE ALLEGRO_GET_EVENT_TYPE('m', 'c', 'e', 't') +#define MY_SIMPLE_EVENT_TYPE A5O_GET_EVENT_TYPE('m', 's', 'e', 't') +#define MY_COMPLEX_EVENT_TYPE A5O_GET_EVENT_TYPE('m', 'c', 'e', 't') /* Just some fantasy event, supposedly used in an RPG - it's just to show that @@ -34,7 +34,7 @@ static MY_EVENT *new_event(int id) } -static void my_event_dtor(ALLEGRO_USER_EVENT *event) +static void my_event_dtor(A5O_USER_EVENT *event) { log_printf("my_event_dtor: %p\n", (void *) event->data1); free((void *) event->data1); @@ -43,11 +43,11 @@ static void my_event_dtor(ALLEGRO_USER_EVENT *event) int main(int argc, char **argv) { - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_SOURCE user_src; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT user_event; - ALLEGRO_EVENT event; + A5O_TIMER *timer; + A5O_EVENT_SOURCE user_src; + A5O_EVENT_QUEUE *queue; + A5O_EVENT user_event; + A5O_EVENT event; (void)argc; (void)argv; @@ -74,7 +74,7 @@ int main(int argc, char **argv) while (true) { al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_TIMER) { + if (event.type == A5O_EVENT_TIMER) { int n = event.timer.count; log_printf("Got timer event %d\n", n); @@ -89,7 +89,7 @@ int main(int argc, char **argv) } else if (event.type == MY_SIMPLE_EVENT_TYPE) { int n = (int) event.user.data1; - ALLEGRO_ASSERT(event.user.source == &user_src); + A5O_ASSERT(event.user.source == &user_src); al_unref_user_event(&event.user); @@ -100,7 +100,7 @@ int main(int argc, char **argv) } else if (event.type == MY_COMPLEX_EVENT_TYPE) { MY_EVENT *my_event = (void *)event.user.data1; - ALLEGRO_ASSERT(event.user.source == &user_src); + A5O_ASSERT(event.user.source == &user_src); log_printf("Got complex user event %d\n", my_event->id); al_unref_user_event(&event.user); diff --git a/examples/ex_utf8.c b/examples/ex_utf8.c index c42376cdea..90e475ea01 100644 --- a/examples/ex_utf8.c +++ b/examples/ex_utf8.c @@ -15,7 +15,7 @@ #include "common.c" -#ifdef ALLEGRO_MSVC +#ifdef A5O_MSVC #pragma warning (disable: 4066) #endif @@ -51,8 +51,8 @@ int error = 0; /* Test that we can create and destroy strings and get their data and size. */ static void t1(void) { - ALLEGRO_USTR *us1 = al_ustr_new(""); - ALLEGRO_USTR *us2 = al_ustr_new("รกฦต"); + A5O_USTR *us1 = al_ustr_new(""); + A5O_USTR *us2 = al_ustr_new("รกฦต"); CHECK(0 == strcmp(al_cstr(us1), "")); CHECK(0 == strcmp(al_cstr(us2), "รกฦต")); @@ -72,8 +72,8 @@ static void t2(void) /* No memory needs to be freed. */ static void t3(void) { - ALLEGRO_USTR_INFO info; - const ALLEGRO_USTR *us = al_ref_cstr(&info, "A static string."); + A5O_USTR_INFO info; + const A5O_USTR *us = al_ref_cstr(&info, "A static string."); CHECK(0 == strcmp(al_cstr(us), "A static string.")); } @@ -83,8 +83,8 @@ static void t3(void) static void t4(void) { const char s[] = "This contains an embedded NUL: \0 <-- here"; - ALLEGRO_USTR_INFO info; - const ALLEGRO_USTR *us = al_ref_buffer(&info, s, sizeof(s)); + A5O_USTR_INFO info; + const A5O_USTR *us = al_ref_buffer(&info, s, sizeof(s)); CHECK(al_ustr_size(us) == sizeof(s)); CHECK(0 == memcmp(al_cstr(us), s, sizeof(s))); @@ -93,9 +93,9 @@ static void t4(void) /* Test that we can make strings which reference (parts of) other strings. */ static void t5(void) { - ALLEGRO_USTR *us1; - const ALLEGRO_USTR *us2; - ALLEGRO_USTR_INFO us2_info; + A5O_USTR *us1; + const A5O_USTR *us2; + A5O_USTR_INFO us2_info; us1 = al_ustr_new("aรกbdรฐeรฉfghiรญjklmnoรณprstuรบvxyรฝรพรฆรถ"); @@ -120,8 +120,8 @@ static void t5(void) /* Test al_ustr_dup. */ static void t6(void) { - ALLEGRO_USTR *us1 = al_ustr_new("aรกbdรฐeรฉfghiรญjklmnoรณprstuรบvxyรฝรพรฆรถ"); - ALLEGRO_USTR *us2 = al_ustr_dup(us1); + A5O_USTR *us1 = al_ustr_new("aรกbdรฐeรฉfghiรญjklmnoรณprstuรบvxyรฝรพรฆรถ"); + A5O_USTR *us2 = al_ustr_dup(us1); CHECK(al_ustr_size(us1) == al_ustr_size(us2)); CHECK(0 == memcmp(al_cstr(us1), al_cstr(us2), al_ustr_size(us1))); @@ -133,8 +133,8 @@ static void t6(void) /* Test al_ustr_dup_substr. */ static void t7(void) { - ALLEGRO_USTR *us1; - ALLEGRO_USTR *us2; + A5O_USTR *us1; + A5O_USTR *us2; us1 = al_ustr_new("aรกbdรฐeรฉfghiรญjklmnoรณprstuรบvxyรฝรพรฆรถ"); @@ -161,8 +161,8 @@ static void t7(void) /* Test al_ustr_append, al_ustr_append_cstr. */ static void t8(void) { - ALLEGRO_USTR *us1 = al_ustr_new("aรกbdรฐeรฉfghiรญjklm"); - ALLEGRO_USTR *us2 = al_ustr_new("noรณprstuรบ"); + A5O_USTR *us1 = al_ustr_new("aรกbdรฐeรฉfghiรญjklm"); + A5O_USTR *us2 = al_ustr_new("noรณprstuรบ"); CHECK(al_ustr_append(us1, us2)); CHECK(0 == strcmp(al_cstr(us1), "aรกbdรฐeรฉfghiรญjklmnoรณprstuรบ")); @@ -177,9 +177,9 @@ static void t8(void) /* Test al_ustr_append with aliased strings. */ static void t9(void) { - ALLEGRO_USTR *us1; - ALLEGRO_USTR_INFO us2_info; - const ALLEGRO_USTR *us2; + A5O_USTR *us1; + A5O_USTR_INFO us2_info; + const A5O_USTR *us2; /* Append a string to itself. */ us1 = al_ustr_new("aรกbdรฐeรฉfghiรญjklm"); @@ -198,10 +198,10 @@ static void t9(void) /* Test al_ustr_equal. */ static void t10(void) { - ALLEGRO_USTR *us1; - ALLEGRO_USTR *us2; - const ALLEGRO_USTR *us3; - ALLEGRO_USTR_INFO us3_info; + A5O_USTR *us1; + A5O_USTR *us2; + const A5O_USTR *us3; + A5O_USTR_INFO us3_info; const char us3_data[] = "aรกbdรฐ\0eรฉfgh"; us1 = al_ustr_new("aรกbdรฐ"); @@ -221,8 +221,8 @@ static void t10(void) /* Test al_ustr_insert. */ static void t11(void) { - ALLEGRO_USTR *us1; - ALLEGRO_USTR *us2; + A5O_USTR *us1; + A5O_USTR *us2; size_t sz; /* Insert in middle. */ @@ -251,7 +251,7 @@ static void t11(void) /* Test al_ustr_insert_cstr. */ static void t12(void) { - ALLEGRO_USTR *us1 = al_ustr_new("aรกbeรฉf"); + A5O_USTR *us1 = al_ustr_new("aรกbeรฉf"); CHECK(al_ustr_insert_cstr(us1, 4, "dรฐ")); CHECK(0 == strcmp(al_cstr(us1), "aรกbdรฐeรฉf")); al_ustr_free(us1); @@ -260,7 +260,7 @@ static void t12(void) /* Test al_ustr_remove_range. */ static void t13(void) { - ALLEGRO_USTR *us1 = al_ustr_new("aรกbdรฐeรฉfghiรญjkprstuรบvxyรฝรพรฆรถ"); + A5O_USTR *us1 = al_ustr_new("aรกbdรฐeรฉfghiรญjkprstuรบvxyรฝรพรฆรถ"); /* Remove from middle of string. */ CHECK(al_ustr_remove_range(us1, 5, 30)); @@ -280,7 +280,7 @@ static void t13(void) /* Test al_ustr_truncate. */ static void t14(void) { - ALLEGRO_USTR *us1 = al_ustr_new("aรกbdรฐeรฉfghiรญjkprstuรบvxyรฝรพรฆรถ"); + A5O_USTR *us1 = al_ustr_new("aรกbdรฐeรฉfghiรญjkprstuรบvxyรฝรพรฆรถ"); /* Truncate from middle of string. */ CHECK(al_ustr_truncate(us1, 30)); @@ -300,8 +300,8 @@ static void t14(void) /* Test whitespace trim functions. */ static void t15(void) { - ALLEGRO_USTR *us1 = al_ustr_new(" \f\n\r\t\vhello \f\n\r\t\v"); - ALLEGRO_USTR *us2 = al_ustr_new(" \f\n\r\t\vhello \f\n\r\t\v"); + A5O_USTR *us1 = al_ustr_new(" \f\n\r\t\vhello \f\n\r\t\v"); + A5O_USTR *us2 = al_ustr_new(" \f\n\r\t\vhello \f\n\r\t\v"); CHECK(al_ustr_ltrim_ws(us1)); CHECK(0 == strcmp(al_cstr(us1), "hello \f\n\r\t\v")); @@ -319,7 +319,7 @@ static void t15(void) /* Test whitespace trim functions (edge cases). */ static void t16(void) { - ALLEGRO_USTR *us1; + A5O_USTR *us1; /* Check return value when passed empty strings. */ us1 = al_ustr_new(""); @@ -399,7 +399,7 @@ static void t18(void) /* Test al_ustr_insert_chr. */ static void t19(void) { - ALLEGRO_USTR *us = al_ustr_new(""); + A5O_USTR *us = al_ustr_new(""); CHECK(al_ustr_insert_chr(us, 0, 'a') == 1); CHECK(al_ustr_insert_chr(us, 0, U_ae) == 2); @@ -420,7 +420,7 @@ static void t19(void) /* Test al_ustr_append_chr. */ static void t20(void) { - ALLEGRO_USTR *us = al_ustr_new(""); + A5O_USTR *us = al_ustr_new(""); CHECK(al_ustr_append_chr(us, 'a') == 1); CHECK(al_ustr_append_chr(us, U_ae) == 2); @@ -437,8 +437,8 @@ static void t20(void) /* Test al_ustr_get. */ static void t21(void) { - ALLEGRO_USTR_INFO info; - const ALLEGRO_USTR *us; + A5O_USTR_INFO info; + const A5O_USTR *us; us = al_ref_buffer(&info, "", 1); CHECK(al_ustr_get(us, 0) == 0); @@ -468,8 +468,8 @@ static void t21(void) /* Test al_ustr_get on invalid sequences. */ static void t22(void) { - ALLEGRO_USTR_INFO info; - const ALLEGRO_USTR *us; + A5O_USTR_INFO info; + const A5O_USTR *us; /* Empty string. */ al_set_errno(0); @@ -501,8 +501,8 @@ static void t22(void) */ static void t23(void) { - ALLEGRO_USTR_INFO info; - const ALLEGRO_USTR *us; + A5O_USTR_INFO info; + const A5O_USTR *us; /* Examples of an overlong ASCII character */ us = al_ref_cstr(&info, "\xc0\xaf"); @@ -553,8 +553,8 @@ static void t23(void) static void t24(void) { const char str[] = "a\0รพโ‚ฌ\xf4\x8f\xbf\xbf"; - ALLEGRO_USTR_INFO info; - const ALLEGRO_USTR *us = al_ref_buffer(&info, str, sizeof(str) - 1); + A5O_USTR_INFO info; + const A5O_USTR *us = al_ref_buffer(&info, str, sizeof(str) - 1); int pos = 0; CHECK(al_ustr_next(us, &pos)); /* a */ @@ -580,8 +580,8 @@ static void t24(void) static void t25(void) { const char str[] = "รพ\xf4\x8f\xbf."; - ALLEGRO_USTR_INFO info; - const ALLEGRO_USTR *us = al_ref_buffer(&info, str, sizeof(str) - 1); + A5O_USTR_INFO info; + const A5O_USTR *us = al_ref_buffer(&info, str, sizeof(str) - 1); int pos; /* Starting in middle of a sequence. */ @@ -597,7 +597,7 @@ static void t25(void) /* Test al_ustr_prev. */ static void t26(void) { - ALLEGRO_USTR *us = al_ustr_new("aรพโ‚ฌ\xf4\x8f\xbf\xbf"); + A5O_USTR *us = al_ustr_new("aรพโ‚ฌ\xf4\x8f\xbf\xbf"); int pos = al_ustr_size(us); CHECK(al_ustr_prev(us, &pos)); /* U+10FFFF */ @@ -621,7 +621,7 @@ static void t26(void) /* Test al_ustr_length. */ static void t27(void) { - ALLEGRO_USTR *us = al_ustr_new("aรพโ‚ฌ\xf4\x8f\xbf\xbf"); + A5O_USTR *us = al_ustr_new("aรพโ‚ฌ\xf4\x8f\xbf\xbf"); CHECK(0 == al_ustr_length(al_ustr_empty_string())); CHECK(4 == al_ustr_length(us)); @@ -632,7 +632,7 @@ static void t27(void) /* Test al_ustr_offset. */ static void t28(void) { - ALLEGRO_USTR *us = al_ustr_new("aรพโ‚ฌ\xf4\x8f\xbf\xbf"); + A5O_USTR *us = al_ustr_new("aรพโ‚ฌ\xf4\x8f\xbf\xbf"); CHECK(al_ustr_offset(us, 0) == 0); CHECK(al_ustr_offset(us, 1) == 1); @@ -653,7 +653,7 @@ static void t28(void) /* Test al_ustr_get_next. */ static void t29(void) { - ALLEGRO_USTR *us = al_ustr_new("aรพโ‚ฌ"); + A5O_USTR *us = al_ustr_new("aรพโ‚ฌ"); int pos; pos = 0; @@ -674,7 +674,7 @@ static void t29(void) /* Test al_ustr_prev_get. */ static void t30(void) { - ALLEGRO_USTR *us = al_ustr_new("aรพโ‚ฌ"); + A5O_USTR *us = al_ustr_new("aรพโ‚ฌ"); int pos; pos = al_ustr_size(us); @@ -693,7 +693,7 @@ static void t30(void) /* Test al_ustr_find_chr. */ static void t31(void) { - ALLEGRO_USTR *us = al_ustr_new("aรกbdรฐeรฉfghiรญaรกbdรฐeรฉfghiรญ"); + A5O_USTR *us = al_ustr_new("aรกbdรฐeรฉfghiรญaรกbdรฐeรฉfghiรญ"); /* Find ASCII. */ CHECK(al_ustr_find_chr(us, 0, 'e') == 7); @@ -713,7 +713,7 @@ static void t31(void) /* Test al_ustr_rfind_chr. */ static void t32(void) { - ALLEGRO_USTR *us = al_ustr_new("aรกbdรฐeรฉfghiรญaรกbdรฐeรฉfghiรญ"); + A5O_USTR *us = al_ustr_new("aรกbdรฐeรฉfghiรญaรกbdรฐeรฉfghiรญ"); int end = al_ustr_size(us); /* Find ASCII. */ @@ -732,7 +732,7 @@ static void t32(void) /* Test al_ustr_find_set, al_ustr_find_set_cstr. */ static void t33(void) { - ALLEGRO_USTR *us = al_ustr_new("aรกbdรฐeรฉfghiรญaรกbdรฐeรฉfghiรญ"); + A5O_USTR *us = al_ustr_new("aรกbdรฐeรฉfghiรญaรกbdรฐeรฉfghiรญ"); /* al_ustr_find_set_cstr is s simple wrapper for al_ustr_find_set * so we test using that. @@ -755,7 +755,7 @@ static void t33(void) /* Test al_ustr_find_set, al_ustr_find_set_cstr (invalid values). */ static void t34(void) { - ALLEGRO_USTR *us = al_ustr_new("a\x80รกbdรฐeรฉfghiรญ"); + A5O_USTR *us = al_ustr_new("a\x80รกbdรฐeรฉfghiรญ"); /* Invalid byte sequence in search string. */ CHECK(al_ustr_find_set_cstr(us, 0, "gfe") == 8); @@ -769,7 +769,7 @@ static void t34(void) /* Test al_ustr_find_cset, al_ustr_find_cset_cstr. */ static void t35(void) { - ALLEGRO_USTR *us; + A5O_USTR *us; /* al_ustr_find_cset_cstr is s simple wrapper for al_ustr_find_cset * so we test using that. @@ -794,7 +794,7 @@ static void t35(void) /* Test al_ustr_find_cset, al_ustr_find_set_cstr (invalid values). */ static void t36(void) { - ALLEGRO_USTR *us = al_ustr_new("a\x80รกbdรฐeรฉfghiรญ"); + A5O_USTR *us = al_ustr_new("a\x80รกbdรฐeรฉfghiรญ"); /* Invalid byte sequence in search string. */ CHECK(al_ustr_find_cset_cstr(us, 0, "aรกbd") == 6); @@ -808,7 +808,7 @@ static void t36(void) /* Test al_ustr_find_str, al_ustr_find_cstr. */ static void t37(void) { - ALLEGRO_USTR *us = al_ustr_new("aรกbdรฐeรฉfghiรญaรกbdรฐeรฉfghiรญ"); + A5O_USTR *us = al_ustr_new("aรกbdรฐeรฉfghiรญaรกbdรฐeรฉfghiรญ"); /* al_ustr_find_cstr is s simple wrapper for al_ustr_find_str * so we test using that. @@ -826,7 +826,7 @@ static void t37(void) /* Test al_ustr_rfind_str, al_ustr_rfind_cstr. */ static void t38(void) { - ALLEGRO_USTR *us = al_ustr_new("aรกbdรฐeรฉfghiรญaรกbdรฐeรฉfghiรญ"); + A5O_USTR *us = al_ustr_new("aรกbdรฐeรฉfghiรญaรกbdรฐeรฉfghiรญ"); int end = al_ustr_size(us); /* al_ustr_find_cstr is s simple wrapper for al_ustr_find_str @@ -846,7 +846,7 @@ static void t38(void) static void t39(void) { const char s1[] = "ะšะพั€ะฐะฑัŠั‚ ะผะธ ะฝะฐ ะฒัŠะทะดัƒัˆะฝะฐ ะฒัŠะทะณะปะฐะฒะฝะธั†ะฐ\0ะต ะฟัŠะปะตะฝ ััŠั ะทะผะธะพั€ะบะธ"; - ALLEGRO_USTR *us; + A5O_USTR *us; char *s2; us = al_ustr_new_from_buffer(s1, sizeof(s1) - 1); /* missing NUL term. */ @@ -862,8 +862,8 @@ static void t39(void) /* Test al_ustr_assign, al_ustr_assign_cstr. */ static void t40(void) { - ALLEGRO_USTR *us1 = al_ustr_new("ๆˆ‘้šปๆฐฃๅขŠ่ˆน่ฃๆปฟๆ™’้ฑ”"); - ALLEGRO_USTR *us2 = al_ustr_new("ฮคแฝธ ฯ‡ฯŒฮฒฮตฯฮบฯฮฌฯ†ฯ„ ฮผฮฟฯ… ฮตแผถฮฝฮฑฮน ฮณฮตฮผแพถฯ„ฮฟ ฯ‡ฮญฮปฮนฮฑ"); + A5O_USTR *us1 = al_ustr_new("ๆˆ‘้šปๆฐฃๅขŠ่ˆน่ฃๆปฟๆ™’้ฑ”"); + A5O_USTR *us2 = al_ustr_new("ฮคแฝธ ฯ‡ฯŒฮฒฮตฯฮบฯฮฌฯ†ฯ„ ฮผฮฟฯ… ฮตแผถฮฝฮฑฮน ฮณฮตฮผแพถฯ„ฮฟ ฯ‡ฮญฮปฮนฮฑ"); CHECK(al_ustr_assign(us1, us2)); CHECK(0 == strcmp(al_cstr(us1), "ฮคแฝธ ฯ‡ฯŒฮฒฮตฯฮบฯฮฌฯ†ฯ„ ฮผฮฟฯ… ฮตแผถฮฝฮฑฮน ฮณฮตฮผแพถฯ„ฮฟ ฯ‡ฮญฮปฮนฮฑ")); @@ -878,8 +878,8 @@ static void t40(void) /* Test al_ustr_assign_cstr. */ static void t41(void) { - ALLEGRO_USTR *us1 = al_ustr_new("ะœะพั˜ะฐ ะปะตะฑะดะธะปะธั†ะฐ ั˜ะต ะฟัƒะฝะฐ ั˜ะตะณัƒั™ะฐ"); - ALLEGRO_USTR *us2 = al_ustr_new(""); + A5O_USTR *us1 = al_ustr_new("ะœะพั˜ะฐ ะปะตะฑะดะธะปะธั†ะฐ ั˜ะต ะฟัƒะฝะฐ ั˜ะตะณัƒั™ะฐ"); + A5O_USTR *us2 = al_ustr_new(""); CHECK(al_ustr_assign_substr(us2, us1, 9, 27)); CHECK(0 == strcmp(al_cstr(us2), "ะปะตะฑะดะธะปะธั†ะฐ")); @@ -899,7 +899,7 @@ static void t41(void) /* Test al_ustr_set_chr. */ static void t42(void) { - ALLEGRO_USTR *us = al_ustr_new("abcdef"); + A5O_USTR *us = al_ustr_new("abcdef"); /* Same size (ASCII). */ CHECK(al_ustr_set_chr(us, 1, 'B') == 1); @@ -941,7 +941,7 @@ static void t42(void) /* Test al_ustr_remove_chr. */ static void t43(void) { - ALLEGRO_USTR *us = al_ustr_new("ยซaฮฒแฟทยป"); + A5O_USTR *us = al_ustr_new("ยซaฮฒแฟทยป"); CHECK(al_ustr_remove_chr(us, 2)); CHECK(0 == strcmp(al_cstr(us), "ยซฮฒแฟทยป")); @@ -965,8 +965,8 @@ static void t43(void) /* Test al_ustr_replace_range. */ static void t44(void) { - ALLEGRO_USTR *us1 = al_ustr_new("ล is kungs par visu samaksฤs"); - ALLEGRO_USTR *us2 = al_ustr_new("ฤซ kundze"); + A5O_USTR *us1 = al_ustr_new("ล is kungs par visu samaksฤs"); + A5O_USTR *us2 = al_ustr_new("ฤซ kundze"); CHECK(al_ustr_replace_range(us1, 2, 10, us2)); CHECK(0 == strcmp(al_cstr(us1), "ล ฤซ kundze par visu samaksฤs")); @@ -983,8 +983,8 @@ static void t44(void) /* Test al_ustr_replace_range (part 2). */ static void t45(void) { - ALLEGRO_USTR *us1 = al_ustr_new("abcdef"); - ALLEGRO_USTR *us2 = al_ustr_new("ABCDEF"); + A5O_USTR *us1 = al_ustr_new("abcdef"); + A5O_USTR *us2 = al_ustr_new("ABCDEF"); /* Start1 < 0 [not allowed] */ CHECK(! al_ustr_replace_range(us1, -1, 1, us2)); @@ -1001,14 +1001,14 @@ static void t45(void) al_ustr_free(us2); } -extern bool call_vappendf(ALLEGRO_USTR *us, const char *fmt, ...); +extern bool call_vappendf(A5O_USTR *us, const char *fmt, ...); /* Test al_ustr_newf, al_ustr_appendf, al_ustr_vappendf. */ static void t46(void) { - ALLEGRO_USTR *us; + A5O_USTR *us; - us = al_ustr_newf("%s %c %.2f %.02d", "hรตljuk", 'c', ALLEGRO_PI, 42); + us = al_ustr_newf("%s %c %.2f %.02d", "hรตljuk", 'c', A5O_PI, 42); CHECK(0 == strcmp(al_cstr(us), "hรตljuk c 3.14 42")); CHECK(al_ustr_appendf(us, " %s", "Luftchรผssiboot")); @@ -1025,7 +1025,7 @@ static void t46(void) al_ustr_free(us); } -bool call_vappendf(ALLEGRO_USTR *us, const char *fmt, ...) +bool call_vappendf(A5O_USTR *us, const char *fmt, ...) { va_list ap; bool rc; @@ -1039,8 +1039,8 @@ bool call_vappendf(ALLEGRO_USTR *us, const char *fmt, ...) /* Test al_ustr_compare, al_ustr_ncompare. */ static void t47(void) { - ALLEGRO_USTR_INFO i1; - ALLEGRO_USTR_INFO i2; + A5O_USTR_INFO i1; + A5O_USTR_INFO i2; CHECK(al_ustr_compare( al_ref_cstr(&i1, "Thรบ mแป vแป‹t"), @@ -1087,8 +1087,8 @@ static void t47(void) /* Test al_ustr_has_prefix, al_ustr_has_suffix. */ static void t48(void) { - ALLEGRO_USTR_INFO i1; - const ALLEGRO_USTR *us1 = al_ref_cstr(&i1, "Thรบ mแป vแป‹t"); + A5O_USTR_INFO i1; + const A5O_USTR *us1 = al_ref_cstr(&i1, "Thรบ mแป vแป‹t"); /* The _cstr versions are simple wrappers around the real functions so its * okay to test them only. @@ -1106,11 +1106,11 @@ static void t48(void) /* Test al_ustr_find_replace, al_ustr_find_replace_cstr. */ static void t49(void) { - ALLEGRO_USTR *us; - ALLEGRO_USTR_INFO findi; - ALLEGRO_USTR_INFO repli; - const ALLEGRO_USTR *find; - const ALLEGRO_USTR *repl; + A5O_USTR *us; + A5O_USTR_INFO findi; + A5O_USTR_INFO repli; + const A5O_USTR *find; + const A5O_USTR *repl; us = al_ustr_new("aรกbdรฐeรฉfghiรญaรกbdรฐeรฉfghiรญ"); find = al_ref_cstr(&findi, "รฐeรฉf"); @@ -1139,7 +1139,7 @@ static void t49(void) /* Test UTF-16 conversion. */ static void t50(void) { - ALLEGRO_USTR *us; + A5O_USTR *us; char utf8[] = "โ…›-note: ๐… , domino: ๐Ÿก"; uint16_t *utf16; size_t s; @@ -1180,8 +1180,8 @@ static void t50(void) static void t51(void) { char str[256]; - const ALLEGRO_USTR *us; - ALLEGRO_USTR_INFO info; + const A5O_USTR *us; + A5O_USTR_INFO info; us = al_ref_buffer(&info, "Allegro", 3); al_ustr_to_buffer(us, str, 10); diff --git a/examples/ex_vertex_buffer.c b/examples/ex_vertex_buffer.c index 1022f8d5cc..8ce4453da6 100644 --- a/examples/ex_vertex_buffer.c +++ b/examples/ex_vertex_buffer.c @@ -19,46 +19,46 @@ struct METHOD { float x; float y; - ALLEGRO_VERTEX_BUFFER *vbuff; - ALLEGRO_VERTEX *vertices; + A5O_VERTEX_BUFFER *vbuff; + A5O_VERTEX *vertices; const char *name; int flags; double frame_average; }; -static ALLEGRO_COLOR get_color(size_t ii) +static A5O_COLOR get_color(size_t ii) { double t = al_get_time(); double frac = (float)(ii) / NUM_VERTICES; - #define THETA(period) ((t / (period) + frac) * 2 * ALLEGRO_PI) + #define THETA(period) ((t / (period) + frac) * 2 * A5O_PI) return al_map_rgb_f(sin(THETA(5.0)) / 2 + 1, cos(THETA(1.1)) / 2 + 1, sin(THETA(3.4) / 2) / 2 + 1); } -static void draw_method(METHOD *md, ALLEGRO_FONT *font, ALLEGRO_VERTEX* new_vertices) +static void draw_method(METHOD *md, A5O_FONT *font, A5O_VERTEX* new_vertices) { - ALLEGRO_TRANSFORM t; + A5O_TRANSFORM t; double start_time; double new_fps; - ALLEGRO_COLOR c; + A5O_COLOR c; al_identity_transform(&t); al_translate_transform(&t, md->x, md->y); al_use_transform(&t); - al_draw_textf(font, al_map_rgb_f(1, 1, 1), 0, -50, ALLEGRO_ALIGN_CENTRE, "%s%s", md->name, - md->flags & ALLEGRO_PRIM_BUFFER_READWRITE ? "+read/write" : "+write-only"); + al_draw_textf(font, al_map_rgb_f(1, 1, 1), 0, -50, A5O_ALIGN_CENTRE, "%s%s", md->name, + md->flags & A5O_PRIM_BUFFER_READWRITE ? "+read/write" : "+write-only"); start_time = al_get_time(); if (md->vbuff) { if (new_vertices) { - void* lock_mem = al_lock_vertex_buffer(md->vbuff, 0, NUM_VERTICES, ALLEGRO_LOCK_WRITEONLY); - memcpy(lock_mem, new_vertices, sizeof(ALLEGRO_VERTEX) * NUM_VERTICES); + void* lock_mem = al_lock_vertex_buffer(md->vbuff, 0, NUM_VERTICES, A5O_LOCK_WRITEONLY); + memcpy(lock_mem, new_vertices, sizeof(A5O_VERTEX) * NUM_VERTICES); al_unlock_vertex_buffer(md->vbuff); } - al_draw_vertex_buffer(md->vbuff, 0, 0, NUM_VERTICES, ALLEGRO_PRIM_TRIANGLE_STRIP); + al_draw_vertex_buffer(md->vbuff, 0, 0, NUM_VERTICES, A5O_PRIM_TRIANGLE_STRIP); } else if (md->vertices) { - al_draw_prim(md->vertices, 0, 0, 0, NUM_VERTICES, ALLEGRO_PRIM_TRIANGLE_STRIP); + al_draw_prim(md->vertices, 0, 0, 0, NUM_VERTICES, A5O_PRIM_TRIANGLE_STRIP); } /* Force the completion of the previous commands by reading from screen */ @@ -69,10 +69,10 @@ static void draw_method(METHOD *md, ALLEGRO_FONT *font, ALLEGRO_VERTEX* new_vert md->frame_average += (new_fps - md->frame_average) / FRAME_TAU; if (md->vbuff || md->vertices) { - al_draw_textf(font, al_map_rgb_f(1, 0, 0), 0, 0, ALLEGRO_ALIGN_CENTRE, "%.1e FPS", md->frame_average); + al_draw_textf(font, al_map_rgb_f(1, 0, 0), 0, 0, A5O_ALIGN_CENTRE, "%.1e FPS", md->frame_average); } else { - al_draw_text(font, al_map_rgb_f(1, 0, 0), 0, 0, ALLEGRO_ALIGN_CENTRE, "N/A"); + al_draw_text(font, al_map_rgb_f(1, 0, 0), 0, 0, A5O_ALIGN_CENTRE, "N/A"); } al_identity_transform(&t); @@ -81,10 +81,10 @@ static void draw_method(METHOD *md, ALLEGRO_FONT *font, ALLEGRO_VERTEX* new_vert int main(int argc, char **argv) { - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_DISPLAY *display; - ALLEGRO_FONT *font; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_DISPLAY *display; + A5O_FONT *font; int w = 640, h = 480; bool done = false; bool need_redraw = true; @@ -96,7 +96,7 @@ int main(int argc, char **argv) int spacing_x = 200; int spacing_y = 150; size_t ii; - ALLEGRO_VERTEX* vertices; + A5O_VERTEX* vertices; (void)argc; (void)argv; @@ -108,11 +108,11 @@ int main(int argc, char **argv) al_init_font_addon(); al_init_primitives_addon(); - #ifdef ALLEGRO_IPHONE - al_set_new_display_flags(ALLEGRO_FULLSCREEN_WINDOW); + #ifdef A5O_IPHONE + al_set_new_display_flags(A5O_FULLSCREEN_WINDOW); #endif - al_set_new_display_option(ALLEGRO_SUPPORTED_ORIENTATIONS, - ALLEGRO_DISPLAY_ORIENTATION_ALL, ALLEGRO_SUGGEST); + al_set_new_display_option(A5O_SUPPORTED_ORIENTATIONS, + A5O_DISPLAY_ORIENTATION_ALL, A5O_SUGGEST); display = al_create_display(w, h); if (!display) { abort_example("Error creating display.\n"); @@ -131,8 +131,8 @@ int main(int argc, char **argv) al_register_event_source(queue, al_get_timer_event_source(timer)); al_register_event_source(queue, al_get_display_event_source(display)); - vertices = al_malloc(sizeof(ALLEGRO_VERTEX) * NUM_VERTICES); - al_calculate_arc(&vertices[0].x, sizeof(ALLEGRO_VERTEX), 0, 0, 80, 30, 0, 2 * ALLEGRO_PI, 10, NUM_VERTICES / 2); + vertices = al_malloc(sizeof(A5O_VERTEX) * NUM_VERTICES); + al_calculate_arc(&vertices[0].x, sizeof(A5O_VERTEX), 0, 0, 80, 30, 0, 2 * A5O_PI, 10, NUM_VERTICES / 2); for (ii = 0; ii < NUM_VERTICES; ii++) { vertices[ii].z = 0; vertices[ii].color = get_color(ii); @@ -145,12 +145,12 @@ int main(int argc, char **argv) METHOD methods[] = { {GETX(1), GETY(0), 0, vertices, "No buffer", 0, 0}, - {GETX(0), GETY(1), 0, 0, "STREAM", ALLEGRO_PRIM_BUFFER_STREAM | ALLEGRO_PRIM_BUFFER_READWRITE, 0}, - {GETX(1), GETY(1), 0, 0, "STATIC", ALLEGRO_PRIM_BUFFER_STATIC | ALLEGRO_PRIM_BUFFER_READWRITE, 0}, - {GETX(2), GETY(1), 0, 0, "DYNAMIC", ALLEGRO_PRIM_BUFFER_STREAM | ALLEGRO_PRIM_BUFFER_READWRITE, 0}, - {GETX(0), GETY(2), 0, 0, "STREAM", ALLEGRO_PRIM_BUFFER_STREAM, 0}, - {GETX(1), GETY(2), 0, 0, "STATIC", ALLEGRO_PRIM_BUFFER_STATIC, 0}, - {GETX(2), GETY(2), 0, 0, "DYNAMIC", ALLEGRO_PRIM_BUFFER_DYNAMIC, 0} + {GETX(0), GETY(1), 0, 0, "STREAM", A5O_PRIM_BUFFER_STREAM | A5O_PRIM_BUFFER_READWRITE, 0}, + {GETX(1), GETY(1), 0, 0, "STATIC", A5O_PRIM_BUFFER_STATIC | A5O_PRIM_BUFFER_READWRITE, 0}, + {GETX(2), GETY(1), 0, 0, "DYNAMIC", A5O_PRIM_BUFFER_STREAM | A5O_PRIM_BUFFER_READWRITE, 0}, + {GETX(0), GETY(2), 0, 0, "STREAM", A5O_PRIM_BUFFER_STREAM, 0}, + {GETX(1), GETY(2), 0, 0, "STATIC", A5O_PRIM_BUFFER_STATIC, 0}, + {GETX(2), GETY(2), 0, 0, "DYNAMIC", A5O_PRIM_BUFFER_DYNAMIC, 0} }; num_methods = sizeof(methods) / sizeof(METHOD); @@ -165,7 +165,7 @@ int main(int argc, char **argv) al_start_timer(timer); while (!done) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (!background && need_redraw && al_is_event_queue_empty(queue)) { al_clear_to_color(al_map_rgb_f(0, 0, 0.2)); @@ -180,26 +180,26 @@ int main(int argc, char **argv) al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) done = true; - else if(event.keyboard.keycode == ALLEGRO_KEY_D) + else if(event.keyboard.keycode == A5O_KEY_D) dynamic_buffers = !dynamic_buffers; break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: done = true; break; - case ALLEGRO_EVENT_DISPLAY_HALT_DRAWING: + case A5O_EVENT_DISPLAY_HALT_DRAWING: background = true; al_acknowledge_drawing_halt(event.display.source); break; - case ALLEGRO_EVENT_DISPLAY_RESIZE: + case A5O_EVENT_DISPLAY_RESIZE: al_acknowledge_resize(event.display.source); break; - case ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING: + case A5O_EVENT_DISPLAY_RESUME_DRAWING: background = false; break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: for (ii = 0; ii < NUM_VERTICES; ii++) vertices[ii].color = get_color(ii); need_redraw = true; diff --git a/examples/ex_video.c b/examples/ex_video.c index 534dfed06d..01a0fe6310 100644 --- a/examples/ex_video.c +++ b/examples/ex_video.c @@ -8,12 +8,12 @@ #include "common.c" -static ALLEGRO_DISPLAY *screen; -static ALLEGRO_FONT *font; +static A5O_DISPLAY *screen; +static A5O_FONT *font; static char const *filename; static float zoom = 0; -static void video_display(ALLEGRO_VIDEO *video) +static void video_display(A5O_VIDEO *video) { /* Videos often do not use square pixels - these return the scaled dimensions * of the video frame. @@ -23,10 +23,10 @@ static void video_display(ALLEGRO_VIDEO *video) /* Get the currently visible frame of the video, based on clock * time. */ - ALLEGRO_BITMAP *frame = al_get_video_frame(video); + A5O_BITMAP *frame = al_get_video_frame(video); int w, h, x, y; - ALLEGRO_COLOR tc = al_map_rgba_f(0, 0, 0, 0.5); - ALLEGRO_COLOR bc = al_map_rgba_f(0.5, 0.5, 0.5, 0.5); + A5O_COLOR tc = al_map_rgba_f(0, 0, 0, 0.5); + A5O_COLOR bc = al_map_rgba_f(0.5, 0.5, 0.5, 0.5); double p; if (!frame) @@ -56,13 +56,13 @@ static void video_display(ALLEGRO_VIDEO *video) /* Show some video information. */ al_draw_filled_rounded_rectangle(4, 4, al_get_display_width(screen) - 4, 4 + 14 * 4, 8, 8, bc); - p = al_get_video_position(video, ALLEGRO_VIDEO_POSITION_ACTUAL); + p = al_get_video_position(video, A5O_VIDEO_POSITION_ACTUAL); al_draw_textf(font, tc, 8, 8 , 0, "%s", filename); al_draw_textf(font, tc, 8, 8 + 13, 0, "%3d:%02d (V: %+5.2f A: %+5.2f)", (int)(p / 60), ((int)p) % 60, - al_get_video_position(video, ALLEGRO_VIDEO_POSITION_VIDEO_DECODE) - p, - al_get_video_position(video, ALLEGRO_VIDEO_POSITION_AUDIO_DECODE) - p); + al_get_video_position(video, A5O_VIDEO_POSITION_VIDEO_DECODE) - p, + al_get_video_position(video, A5O_VIDEO_POSITION_AUDIO_DECODE) - p); al_draw_textf(font, tc, 8, 8 + 13 * 2, 0, "video rate %.02f (%dx%d, aspect %.1f) audio rate %.0f", al_get_video_fps(video), @@ -79,10 +79,10 @@ static void video_display(ALLEGRO_VIDEO *video) int main(int argc, char *argv[]) { - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; - ALLEGRO_TIMER *timer; - ALLEGRO_VIDEO *video; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; + A5O_TIMER *timer; + A5O_VIDEO *video; bool fullscreen = false; bool redraw = true; bool use_frame_events = false; @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) /* If use_frame_events is false, we use a fixed FPS timer. If the video is * displayed in a game this probably makes most sense. In a * dedicated video player you probably want to listen to - * ALLEGRO_EVENT_VIDEO_FRAME_SHOW events and only redraw whenever one + * A5O_EVENT_VIDEO_FRAME_SHOW events and only redraw whenever one * arrives - to reduce possible jitter and save CPU. */ if (argc == 3 && strcmp(argv[1], "--use-frame-events") == 0) { @@ -123,8 +123,8 @@ int main(int argc, char *argv[]) timer = al_create_timer(1.0 / 60); - al_set_new_display_flags(ALLEGRO_RESIZABLE); - al_set_new_display_option(ALLEGRO_VSYNC, 1, ALLEGRO_SUGGEST); + al_set_new_display_flags(A5O_RESIZABLE); + al_set_new_display_option(A5O_VSYNC, 1, A5O_SUGGEST); screen = al_create_display(640, 480); if (!screen) { abort_example("Could not set video mode - exiting\n"); @@ -135,7 +135,7 @@ int main(int argc, char *argv[]) abort_example("No font.\n"); } - al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR | ALLEGRO_MAG_LINEAR); + al_set_new_bitmap_flags(A5O_MIN_LINEAR | A5O_MAG_LINEAR); filename = argv[filename_arg_idx]; video = al_open_video(filename); @@ -171,43 +171,43 @@ int main(int argc, char *argv[]) al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_KEY_DOWN: + case A5O_EVENT_KEY_DOWN: switch (event.keyboard.keycode) { - case ALLEGRO_KEY_SPACE: + case A5O_KEY_SPACE: al_set_video_playing(video, !al_is_video_playing(video)); break; - case ALLEGRO_KEY_ESCAPE: + case A5O_KEY_ESCAPE: al_close_video(video); goto done; break; - case ALLEGRO_KEY_LEFT: + case A5O_KEY_LEFT: incr = -10.0; goto do_seek; - case ALLEGRO_KEY_RIGHT: + case A5O_KEY_RIGHT: incr = 10.0; goto do_seek; - case ALLEGRO_KEY_UP: + case A5O_KEY_UP: incr = 60.0; goto do_seek; - case ALLEGRO_KEY_DOWN: + case A5O_KEY_DOWN: incr = -60.0; goto do_seek; do_seek: - al_seek_video(video, al_get_video_position(video, ALLEGRO_VIDEO_POSITION_ACTUAL) + incr); + al_seek_video(video, al_get_video_position(video, A5O_VIDEO_POSITION_ACTUAL) + incr); break; - case ALLEGRO_KEY_F: + case A5O_KEY_F: fullscreen = !fullscreen; - al_set_display_flag(screen, ALLEGRO_FULLSCREEN_WINDOW, + al_set_display_flag(screen, A5O_FULLSCREEN_WINDOW, fullscreen); break; - case ALLEGRO_KEY_1: + case A5O_KEY_1: zoom = 1; break; - case ALLEGRO_KEY_S: + case A5O_KEY_S: zoom = 0; break; default: @@ -215,12 +215,12 @@ int main(int argc, char *argv[]) } break; - case ALLEGRO_EVENT_DISPLAY_RESIZE: + case A5O_EVENT_DISPLAY_RESIZE: al_acknowledge_resize(screen); al_clear_to_color(al_map_rgb(0, 0, 0)); break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: /* display_time += 1.0 / 60; if (display_time >= video_time) { @@ -232,18 +232,18 @@ int main(int argc, char *argv[]) } break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: al_close_video(video); goto done; break; - case ALLEGRO_EVENT_VIDEO_FRAME_SHOW: + case A5O_EVENT_VIDEO_FRAME_SHOW: if (use_frame_events) { redraw = true; } break; - case ALLEGRO_EVENT_VIDEO_FINISHED: + case A5O_EVENT_VIDEO_FINISHED: log_printf("video finished\n"); break; default: diff --git a/examples/ex_vsync.c b/examples/ex_vsync.c index 832d892d06..07f0403d9b 100644 --- a/examples/ex_vsync.c +++ b/examples/ex_vsync.c @@ -11,7 +11,7 @@ int vsync, fullscreen, frequency, bar_width; -static int option(ALLEGRO_CONFIG *config, char *name, int v) +static int option(A5O_CONFIG *config, char *name, int v) { char const *value; char str[256]; @@ -23,49 +23,49 @@ static int option(ALLEGRO_CONFIG *config, char *name, int v) return v; } -static bool display_warning(ALLEGRO_EVENT_QUEUE *queue, ALLEGRO_FONT *font) +static bool display_warning(A5O_EVENT_QUEUE *queue, A5O_FONT *font) { - ALLEGRO_EVENT event; - ALLEGRO_DISPLAY *display = al_get_current_display(); + A5O_EVENT event; + A5O_DISPLAY *display = al_get_current_display(); float x = al_get_display_width(display) / 2.0; float h = al_get_font_line_height(font); - ALLEGRO_COLOR white = al_map_rgb_f(1, 1, 1); + A5O_COLOR white = al_map_rgb_f(1, 1, 1); for (;;) { // Convert from 200 px on 480px high screen to same relative position // gtiven actual display height. float y = 5/12.0 * al_get_display_height(display); al_clear_to_color(al_map_rgb(0, 0, 0)); - al_draw_text(font, white, x, y, ALLEGRO_ALIGN_CENTRE, + al_draw_text(font, white, x, y, A5O_ALIGN_CENTRE, "Do not continue if you suffer from photosensitive epilepsy"); - al_draw_text(font, white, x, y + 15, ALLEGRO_ALIGN_CENTRE, + al_draw_text(font, white, x, y + 15, A5O_ALIGN_CENTRE, "or simply hate sliding bars."); - al_draw_text(font, white, x, y + 40, ALLEGRO_ALIGN_CENTRE, + al_draw_text(font, white, x, y + 40, A5O_ALIGN_CENTRE, "Press Escape to quit or Enter to continue."); y += 100; - al_draw_text(font, white, x, y, ALLEGRO_ALIGN_CENTRE, "Parameters from ex_vsync.ini:"); + al_draw_text(font, white, x, y, A5O_ALIGN_CENTRE, "Parameters from ex_vsync.ini:"); y += h; - al_draw_textf(font, white, x, y, ALLEGRO_ALIGN_CENTRE, "vsync: %d", vsync); + al_draw_textf(font, white, x, y, A5O_ALIGN_CENTRE, "vsync: %d", vsync); y += h; - al_draw_textf(font, white, x, y, ALLEGRO_ALIGN_CENTRE, "fullscreen: %d", fullscreen); + al_draw_textf(font, white, x, y, A5O_ALIGN_CENTRE, "fullscreen: %d", fullscreen); y += h; - al_draw_textf(font, white, x, y, ALLEGRO_ALIGN_CENTRE, "frequency: %d", frequency); + al_draw_textf(font, white, x, y, A5O_ALIGN_CENTRE, "frequency: %d", frequency); y += h; - al_draw_textf(font, white, x, y, ALLEGRO_ALIGN_CENTRE, "bar width: %d", bar_width); + al_draw_textf(font, white, x, y, A5O_ALIGN_CENTRE, "bar width: %d", bar_width); al_flip_display(); al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_KEY_DOWN) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_DOWN) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) { return true; } - if (event.keyboard.keycode == ALLEGRO_KEY_ENTER) { + if (event.keyboard.keycode == A5O_KEY_ENTER) { return false; } } - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + if (event.type == A5O_EVENT_DISPLAY_CLOSE) { return true; } } @@ -73,10 +73,10 @@ static bool display_warning(ALLEGRO_EVENT_QUEUE *queue, ALLEGRO_FONT *font) int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_FONT *font; - ALLEGRO_CONFIG *config; - ALLEGRO_EVENT_QUEUE *queue; + A5O_DISPLAY *display; + A5O_FONT *font; + A5O_CONFIG *config; + A5O_EVENT_QUEUE *queue; bool write = false; bool quit; bool right = true; @@ -123,11 +123,11 @@ int main(int argc, char **argv) /* Vsync 1 means force on, 2 means forced off. */ if (vsync) - al_set_new_display_option(ALLEGRO_VSYNC, vsync, ALLEGRO_SUGGEST); + al_set_new_display_option(A5O_VSYNC, vsync, A5O_SUGGEST); /* Force fullscreen mode. */ if (fullscreen) { - al_set_new_display_flags(ALLEGRO_FULLSCREEN_WINDOW); + al_set_new_display_flags(A5O_FULLSCREEN_WINDOW); /* Set a monitor frequency. */ if (frequency) al_set_new_display_refresh_rate(frequency); @@ -155,7 +155,7 @@ int main(int argc, char **argv) display_height = al_get_display_height(display); while (!quit) { - ALLEGRO_EVENT event; + A5O_EVENT event; /* With vsync, this will appear as a bar moving smoothly left to right. * Without vsync, it will appear that there are many bars moving left to right. @@ -186,12 +186,12 @@ int main(int argc, char **argv) while (al_get_next_event(queue, &event)) { switch (event.type) { - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: quit = true; break; - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) quit = true; } } diff --git a/examples/ex_window_constraints.c b/examples/ex_window_constraints.c index 7f2e07a6e4..7545fc1a3c 100644 --- a/examples/ex_window_constraints.c +++ b/examples/ex_window_constraints.c @@ -12,11 +12,11 @@ int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_BITMAP *bmp; - ALLEGRO_FONT *f; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_EVENT event; + A5O_DISPLAY *display; + A5O_BITMAP *bmp; + A5O_FONT *f; + A5O_EVENT_QUEUE *queue; + A5O_EVENT event; bool redraw; int min_w, min_h, max_w, max_h; int ret_min_w, ret_min_h, ret_max_w, ret_max_h; @@ -33,8 +33,8 @@ int main(int argc, char **argv) al_init_image_addon(); al_init_font_addon(); - al_set_new_display_flags(ALLEGRO_RESIZABLE | - ALLEGRO_GENERATE_EXPOSE_EVENTS); + al_set_new_display_flags(A5O_RESIZABLE | + A5O_GENERATE_EXPOSE_EVENTS); display = al_create_display(640, 480); if (!display) { abort_example("Unable to set any graphic mode\n"); @@ -105,27 +105,27 @@ int main(int argc, char **argv) } al_wait_for_event(queue, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_RESIZE) { + if (event.type == A5O_EVENT_DISPLAY_RESIZE) { al_acknowledge_resize(event.display.source); redraw = true; } - if (event.type == ALLEGRO_EVENT_DISPLAY_EXPOSE) { + if (event.type == A5O_EVENT_DISPLAY_EXPOSE) { redraw = true; } - if (event.type == ALLEGRO_EVENT_KEY_DOWN) { - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.type == A5O_EVENT_KEY_DOWN) { + if (event.keyboard.keycode == A5O_KEY_ESCAPE) { break; } - else if (event.keyboard.keycode == ALLEGRO_KEY_Z) { + else if (event.keyboard.keycode == A5O_KEY_Z) { constr_min_w = ! constr_min_w; } - else if (event.keyboard.keycode == ALLEGRO_KEY_X) { + else if (event.keyboard.keycode == A5O_KEY_X) { constr_min_h = ! constr_min_h; } - else if (event.keyboard.keycode == ALLEGRO_KEY_C) { + else if (event.keyboard.keycode == A5O_KEY_C) { constr_max_w = ! constr_max_w; } - else if (event.keyboard.keycode == ALLEGRO_KEY_V) { + else if (event.keyboard.keycode == A5O_KEY_V) { constr_max_h = ! constr_max_h; } @@ -140,7 +140,7 @@ int main(int argc, char **argv) } al_apply_window_constraints(display, true); } - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } } diff --git a/examples/ex_window_maximized.c b/examples/ex_window_maximized.c index 94c9814517..b0c3b7e72d 100644 --- a/examples/ex_window_maximized.c +++ b/examples/ex_window_maximized.c @@ -20,8 +20,8 @@ /* #define USE_GTK */ static void -draw_information(ALLEGRO_DISPLAY *display, - ALLEGRO_FONT *font, ALLEGRO_COLOR color); +draw_information(A5O_DISPLAY *display, + A5O_FONT *font, A5O_COLOR color); static bool use_constraints; @@ -29,9 +29,9 @@ static bool use_constraints; extern int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_FONT *font; + A5O_DISPLAY *display; + A5O_EVENT_QUEUE *queue; + A5O_FONT *font; bool done = false; bool redraw = true; use_constraints = true; @@ -59,12 +59,12 @@ main(int argc, char **argv) abort_example("Failed to init native dialog addon.\n"); } - al_set_new_display_flags(ALLEGRO_WINDOWED + al_set_new_display_flags(A5O_WINDOWED #if defined(USE_GTK) && !defined(_WIN32) - | ALLEGRO_GTK_TOPLEVEL + | A5O_GTK_TOPLEVEL #endif - | ALLEGRO_RESIZABLE | ALLEGRO_MAXIMIZED - | ALLEGRO_GENERATE_EXPOSE_EVENTS); + | A5O_RESIZABLE | A5O_MAXIMIZED + | A5O_GENERATE_EXPOSE_EVENTS); /* creating really small display */ display = al_create_display(DISPLAY_W / 3, DISPLAY_H / 3); @@ -85,15 +85,15 @@ main(int argc, char **argv) al_register_event_source(queue, al_get_keyboard_event_source()); al_register_event_source(queue, al_get_display_event_source(display)); - ALLEGRO_COLOR color_1 = al_map_rgb(255, 127, 0); - ALLEGRO_COLOR color_2 = al_map_rgb(0, 255, 0); - ALLEGRO_COLOR *color = &color_1; - ALLEGRO_COLOR color_text = al_map_rgb(0, 0, 0); + A5O_COLOR color_1 = al_map_rgb(255, 127, 0); + A5O_COLOR color_2 = al_map_rgb(0, 255, 0); + A5O_COLOR *color = &color_1; + A5O_COLOR color_text = al_map_rgb(0, 0, 0); font = al_create_builtin_font(); while (!done) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (redraw && al_is_event_queue_empty(queue)) { redraw = false; @@ -108,13 +108,13 @@ main(int argc, char **argv) al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) done = true; break; - case ALLEGRO_EVENT_KEY_UP: - if (event.keyboard.keycode == ALLEGRO_KEY_SPACE) { + case A5O_EVENT_KEY_UP: + if (event.keyboard.keycode == A5O_KEY_SPACE) { redraw = true; if (color == &color_1) { @@ -140,23 +140,23 @@ main(int argc, char **argv) al_apply_window_constraints(display, use_constraints); } - else if (event.keyboard.keycode == ALLEGRO_KEY_ENTER) { + else if (event.keyboard.keycode == A5O_KEY_ENTER) { redraw = true; use_constraints = !use_constraints; al_apply_window_constraints(display, use_constraints); } break; - case ALLEGRO_EVENT_DISPLAY_RESIZE: + case A5O_EVENT_DISPLAY_RESIZE: al_acknowledge_resize(event.display.source); redraw = true; break; - case ALLEGRO_EVENT_DISPLAY_EXPOSE: + case A5O_EVENT_DISPLAY_EXPOSE: redraw = true; break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: done = true; break; } /* switch (event.type) { */ @@ -169,8 +169,8 @@ main(int argc, char **argv) static void -draw_information(ALLEGRO_DISPLAY *display, - ALLEGRO_FONT *font, ALLEGRO_COLOR color) +draw_information(A5O_DISPLAY *display, + A5O_FONT *font, A5O_COLOR color) { int min_w, min_h, max_w, max_h; diff --git a/examples/ex_window_title.c b/examples/ex_window_title.c index 0344edae23..f95d3d91e3 100644 --- a/examples/ex_window_title.c +++ b/examples/ex_window_title.c @@ -20,10 +20,10 @@ int bmp_flag = 0; int main(int argc, char **argv) { - ALLEGRO_DISPLAY *display; - ALLEGRO_TIMER *timer; - ALLEGRO_EVENT_QUEUE *queue; - ALLEGRO_FONT *font; + A5O_DISPLAY *display; + A5O_TIMER *timer; + A5O_EVENT_QUEUE *queue; + A5O_FONT *font; int step = 0; const char *text; char title[TITLE_SIZE] = ""; @@ -74,7 +74,7 @@ int main(int argc, char **argv) while (!done) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (redraw && al_is_event_queue_empty(queue)) { al_clear_to_color(al_map_rgb_f(0, 0, 0)); @@ -85,18 +85,18 @@ int main(int argc, char **argv) al_wait_for_event(queue, &event); switch (event.type) { - case ALLEGRO_EVENT_KEY_DOWN: - if (event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + case A5O_EVENT_KEY_DOWN: + if (event.keyboard.keycode == A5O_KEY_ESCAPE) done = true; - else if (event.keyboard.keycode == ALLEGRO_KEY_SPACE) + else if (event.keyboard.keycode == A5O_KEY_SPACE) al_start_timer(timer); break; - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: done = true; break; - case ALLEGRO_EVENT_TIMER: + case A5O_EVENT_TIMER: redraw = true; step++; sprintf(title, "Title: %d", step); diff --git a/examples/ex_windows.c b/examples/ex_windows.c index dd8698cdd0..edf1c66076 100644 --- a/examples/ex_windows.c +++ b/examples/ex_windows.c @@ -1,4 +1,4 @@ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include "allegro5/allegro.h" #include "allegro5/allegro_font.h" #include @@ -12,15 +12,15 @@ const int H = 200; int main(int argc, char **argv) { - ALLEGRO_DISPLAY *displays[2]; - ALLEGRO_MONITOR_INFO *info; + A5O_DISPLAY *displays[2]; + A5O_MONITOR_INFO *info; int adapter_count; int x, y; int jump_x[2], jump_y[2], jump_adapter[2]; - ALLEGRO_FONT *myfont; - ALLEGRO_EVENT_QUEUE *events; - ALLEGRO_EVENT event; - ALLEGRO_TIMER *timer; + A5O_FONT *myfont; + A5O_EVENT_QUEUE *events; + A5O_EVENT event; + A5O_TIMER *timer; int i; (void)argc; @@ -43,7 +43,7 @@ int main(int argc, char **argv) abort_example("No adapters found!\n"); } - info = malloc(adapter_count * sizeof(ALLEGRO_MONITOR_INFO)); + info = malloc(adapter_count * sizeof(A5O_MONITOR_INFO)); for (i = 0; i < adapter_count; i++) { al_get_monitor_info(i, &info[i]); @@ -51,7 +51,7 @@ int main(int argc, char **argv) } // center the first window - ALLEGRO_MONITOR_INFO init_info = info[0]; + A5O_MONITOR_INFO init_info = info[0]; x = (init_info.x1 + init_info.x2 - W) / 2; y = (init_info.y1 + init_info.y2 - H) / 2; jump_x[0] = x; @@ -61,7 +61,7 @@ int main(int argc, char **argv) al_set_new_window_position(x, y); al_set_new_window_title("Window 1"); - al_set_new_display_flags(ALLEGRO_RESIZABLE); + al_set_new_display_flags(A5O_RESIZABLE); displays[0] = al_create_display(W, H); // use the default position for the second window @@ -94,33 +94,33 @@ int main(int argc, char **argv) for (i = 0; i < 2; i++) { int dx, dy, dw, dh; al_set_target_backbuffer(displays[i]); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); if (i == 0) al_clear_to_color(al_map_rgb(255, 0, 255)); else al_clear_to_color(al_map_rgb(155, 255, 0)); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); al_get_window_position(displays[i], &dx, &dy); dw = al_get_display_width(displays[i]); dh = al_get_display_height(displays[i]); - al_draw_textf(myfont, al_map_rgb(0, 0, 0), dw / 2, dh / 2 - 30, ALLEGRO_ALIGN_CENTRE, "Location: %d %d", dx, dy); + al_draw_textf(myfont, al_map_rgb(0, 0, 0), dw / 2, dh / 2 - 30, A5O_ALIGN_CENTRE, "Location: %d %d", dx, dy); if (jump_x[i] != INT_MAX && jump_y[i] != INT_MAX) { - al_draw_textf(myfont, al_map_rgb(0, 0, 0), dw / 2, dh / 2 - 15, ALLEGRO_ALIGN_CENTRE, + al_draw_textf(myfont, al_map_rgb(0, 0, 0), dw / 2, dh / 2 - 15, A5O_ALIGN_CENTRE, "Last jumped to: %d %d (adapter %d)", jump_x[i], jump_y[i], jump_adapter[i]); } else { - al_draw_textf(myfont, al_map_rgb(0, 0, 0), dw / 2, dh / 2 - 15, ALLEGRO_ALIGN_CENTRE, + al_draw_textf(myfont, al_map_rgb(0, 0, 0), dw / 2, dh / 2 - 15, A5O_ALIGN_CENTRE, "Last placed to default position (adapter %d)", jump_adapter[i]); } - al_draw_textf(myfont, al_map_rgb(0, 0, 0), dw / 2, dh / 2 + 0, ALLEGRO_ALIGN_CENTRE, "Size: %dx%d", dw, dh); + al_draw_textf(myfont, al_map_rgb(0, 0, 0), dw / 2, dh / 2 + 0, A5O_ALIGN_CENTRE, "Size: %dx%d", dw, dh); int bl = 0, bt = 0; bool b = al_get_window_borders(displays[i], &bl, &bt, NULL, NULL); if (b) - al_draw_textf(myfont, al_map_rgb(0, 0, 0), dw / 2, dh / 2 + 15, ALLEGRO_ALIGN_CENTRE, "Borders: left=%d top=%d", bl, bt); + al_draw_textf(myfont, al_map_rgb(0, 0, 0), dw / 2, dh / 2 + 15, A5O_ALIGN_CENTRE, "Borders: left=%d top=%d", bl, bt); else - al_draw_textf(myfont, al_map_rgb(0, 0, 0), dw / 2, dh / 2 + 15, ALLEGRO_ALIGN_CENTRE, "Borders: unknown"); - al_draw_textf(myfont, al_map_rgb(0, 0, 0), dw / 2, dh / 2 + 30, ALLEGRO_ALIGN_CENTRE, "Click left to jump!"); - al_draw_textf(myfont, al_map_rgb(0, 0, 0), dw / 2, dh / 2 + 45, ALLEGRO_ALIGN_CENTRE, "Click right to swap!"); + al_draw_textf(myfont, al_map_rgb(0, 0, 0), dw / 2, dh / 2 + 15, A5O_ALIGN_CENTRE, "Borders: unknown"); + al_draw_textf(myfont, al_map_rgb(0, 0, 0), dw / 2, dh / 2 + 30, A5O_ALIGN_CENTRE, "Click left to jump!"); + al_draw_textf(myfont, al_map_rgb(0, 0, 0), dw / 2, dh / 2 + 45, A5O_ALIGN_CENTRE, "Click right to swap!"); al_flip_display(); } @@ -128,10 +128,10 @@ int main(int argc, char **argv) } al_wait_for_event(events, &event); - if (event.type == ALLEGRO_EVENT_DISPLAY_CLOSE) { + if (event.type == A5O_EVENT_DISPLAY_CLOSE) { break; } - else if (event.type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN) { + else if (event.type == A5O_EVENT_MOUSE_BUTTON_DOWN) { if (event.mouse.button == 1) { int a = rand() % adapter_count; int w = info[a].x2 - info[a].x1; @@ -154,8 +154,8 @@ int main(int argc, char **argv) al_set_window_position(displays[1], jump_x[1], jump_y[1]); } } - else if (event.type == ALLEGRO_EVENT_KEY_DOWN) { - if (event.keyboard.keycode == ALLEGRO_KEY_SPACE) { + else if (event.type == A5O_EVENT_KEY_DOWN) { + if (event.keyboard.keycode == A5O_KEY_SPACE) { al_get_window_position(event.keyboard.display, &x, &y); int i = event.mouse.display == displays[0] ? 0 : 1; jump_x[i] = x; @@ -163,10 +163,10 @@ int main(int argc, char **argv) al_set_window_position(event.keyboard.display, x, y); } } - else if (event.type == ALLEGRO_EVENT_TIMER) { + else if (event.type == A5O_EVENT_TIMER) { redraw = true; } - else if (event.type == ALLEGRO_EVENT_DISPLAY_RESIZE) { + else if (event.type == A5O_EVENT_DISPLAY_RESIZE) { al_acknowledge_resize(event.display.source); } } diff --git a/examples/ex_winfull.c b/examples/ex_winfull.c index 8cb168f46f..c4a95c060e 100644 --- a/examples/ex_winfull.c +++ b/examples/ex_winfull.c @@ -4,9 +4,9 @@ int main(int argc, char **argv) { - ALLEGRO_DISPLAY *win, *full; - ALLEGRO_EVENT_QUEUE *events; - ALLEGRO_EVENT event; + A5O_DISPLAY *win, *full; + A5O_EVENT_QUEUE *events; + A5O_EVENT event; (void)argc; (void)argv; @@ -22,7 +22,7 @@ int main(int argc, char **argv) } al_set_new_display_adapter(1); - al_set_new_display_flags(ALLEGRO_WINDOWED); + al_set_new_display_flags(A5O_WINDOWED); win = al_create_display(640, 480); if (!win) { abort_example("Error creating windowed display on adapter 1 " @@ -30,7 +30,7 @@ int main(int argc, char **argv) } al_set_new_display_adapter(0); - al_set_new_display_flags(ALLEGRO_FULLSCREEN); + al_set_new_display_flags(A5O_FULLSCREEN); full = al_create_display(640, 480); if (!full) { abort_example("Error creating fullscreen display on adapter 0\n"); @@ -42,8 +42,8 @@ int main(int argc, char **argv) while (1) { while (!al_is_event_queue_empty(events)) { al_get_next_event(events, &event); - if (event.type == ALLEGRO_EVENT_KEY_DOWN && - event.keyboard.keycode == ALLEGRO_KEY_ESCAPE) + if (event.type == A5O_EVENT_KEY_DOWN && + event.keyboard.keycode == A5O_KEY_ESCAPE) goto done; } diff --git a/examples/nihgui.cpp b/examples/nihgui.cpp index df74fa7953..b985fa9f0e 100644 --- a/examples/nihgui.cpp +++ b/examples/nihgui.cpp @@ -8,7 +8,7 @@ #include #include -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include #include @@ -21,10 +21,10 @@ namespace { class SaveState { - ALLEGRO_STATE state; + A5O_STATE state; public: - SaveState(int save=ALLEGRO_STATE_ALL) + SaveState(int save=A5O_STATE_ALL) { al_store_state(&state, save); } @@ -36,11 +36,11 @@ class SaveState class UString { - ALLEGRO_USTR_INFO info; - const ALLEGRO_USTR *ustr; + A5O_USTR_INFO info; + const A5O_USTR *ustr; public: - UString(const ALLEGRO_USTR *s, int first, int end = -1) + UString(const A5O_USTR *s, int first, int end = -1) { if (end == -1) end = al_ustr_size(s); @@ -48,7 +48,7 @@ class UString } // Conversion - operator const ALLEGRO_USTR *() const + operator const A5O_USTR *() const { return ustr; } @@ -58,7 +58,7 @@ class UString /*---------------------------------------------------------------------------*/ -Theme::Theme(const ALLEGRO_FONT *font) +Theme::Theme(const A5O_FONT *font) { this->bg = al_map_rgb(255, 255, 255); this->fg = al_map_rgb(0, 0, 0); @@ -97,7 +97,7 @@ bool Widget::contains(int x, int y) /*---------------------------------------------------------------------------*/ -Dialog::Dialog(const Theme & theme, ALLEGRO_DISPLAY *display, +Dialog::Dialog(const Theme & theme, A5O_DISPLAY *display, int grid_m, int grid_n): theme(theme), display(display), @@ -157,7 +157,7 @@ void Dialog::prepare() /* XXX this isn't working right in X. The mouse position is reported as * (0,0) initially, until the mouse pointer is moved. */ - ALLEGRO_MOUSE_STATE mst; + A5O_MOUSE_STATE mst; al_get_mouse_state(&mst); this->check_mouse_over(mst.x, mst.y); } @@ -177,7 +177,7 @@ void Dialog::configure_all() void Dialog::run_step(bool block) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (block) { al_wait_for_event(event_queue, NULL); @@ -185,27 +185,27 @@ void Dialog::run_step(bool block) while (al_get_next_event(event_queue, &event)) { switch (event.type) { - case ALLEGRO_EVENT_DISPLAY_CLOSE: + case A5O_EVENT_DISPLAY_CLOSE: this->request_quit(); break; - case ALLEGRO_EVENT_KEY_CHAR: + case A5O_EVENT_KEY_CHAR: on_key_down(event.keyboard); break; - case ALLEGRO_EVENT_MOUSE_AXES: + case A5O_EVENT_MOUSE_AXES: on_mouse_axes(event.mouse); break; - case ALLEGRO_EVENT_MOUSE_BUTTON_DOWN: + case A5O_EVENT_MOUSE_BUTTON_DOWN: on_mouse_button_down(event.mouse); break; - case ALLEGRO_EVENT_MOUSE_BUTTON_UP: + case A5O_EVENT_MOUSE_BUTTON_UP: on_mouse_button_up(event.mouse); break; - case ALLEGRO_EVENT_DISPLAY_EXPOSE: + case A5O_EVENT_DISPLAY_EXPOSE: this->request_draw(); break; @@ -218,14 +218,14 @@ void Dialog::run_step(bool block) } } -void Dialog::on_key_down(const ALLEGRO_KEYBOARD_EVENT & event) +void Dialog::on_key_down(const A5O_KEYBOARD_EVENT & event) { if (event.display != this->display) { return; } // XXX think of something better when we need it - if (event.keycode == ALLEGRO_KEY_ESCAPE) { + if (event.keycode == A5O_KEY_ESCAPE) { this->request_quit(); } @@ -234,7 +234,7 @@ void Dialog::on_key_down(const ALLEGRO_KEYBOARD_EVENT & event) } } -void Dialog::on_mouse_axes(const ALLEGRO_MOUSE_EVENT & event) +void Dialog::on_mouse_axes(const A5O_MOUSE_EVENT & event) { const int mx = event.x; const int my = event.y; @@ -275,7 +275,7 @@ void Dialog::check_mouse_over(int mx, int my) } } -void Dialog::on_mouse_button_down(const ALLEGRO_MOUSE_EVENT & event) +void Dialog::on_mouse_button_down(const A5O_MOUSE_EVENT & event) { if (event.button != 1) return; @@ -303,7 +303,7 @@ void Dialog::on_mouse_button_down(const ALLEGRO_MOUSE_EVENT & event) } } -void Dialog::on_mouse_button_up(const ALLEGRO_MOUSE_EVENT & event) +void Dialog::on_mouse_button_up(const A5O_MOUSE_EVENT & event) { if (event.button != 1) return; @@ -361,7 +361,7 @@ const Theme & Dialog::get_theme() const return this->theme; } -void Dialog::register_event_source(ALLEGRO_EVENT_SOURCE *source) +void Dialog::register_event_source(A5O_EVENT_SOURCE *source) { al_register_event_source(this->event_queue, source); } @@ -383,16 +383,16 @@ void Label::draw() { const Theme & theme = this->dialog->get_theme(); SaveState state; - ALLEGRO_COLOR fg = theme.fg; + A5O_COLOR fg = theme.fg; if (is_disabled()) { fg = al_map_rgb(64, 64, 64); } - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); if (centred) { al_draw_text(theme.font, fg, (this->x1 + this->x2 + 1)/2, - this->y1, ALLEGRO_ALIGN_CENTRE, this->text.c_str()); + this->y1, A5O_ALIGN_CENTRE, this->text.c_str()); } else { al_draw_text(theme.font, fg, this->x1, this->y1, 0, this->text.c_str()); @@ -444,8 +444,8 @@ void Button::on_mouse_button_up(int mx, int my) void Button::draw() { const Theme & theme = this->dialog->get_theme(); - ALLEGRO_COLOR fg; - ALLEGRO_COLOR bg; + A5O_COLOR fg; + A5O_COLOR bg; SaveState state; double y; @@ -466,7 +466,7 @@ void Button::draw() this->x2, this->y2, bg); al_draw_rectangle(this->x1 + 0.5, this->y1 + 0.5, this->x2 - 0.5, this->y2 - 0.5, fg, 0); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); /* Center the text vertically in the button, taking the font size * into consideration. @@ -474,7 +474,7 @@ void Button::draw() y = (this->y1 + this->y2 - al_get_font_line_height(theme.font) - 1) / 2; al_draw_text(theme.font, fg, (this->x1 + this->x2 + 1)/2, - y, ALLEGRO_ALIGN_CENTRE, this->text.c_str()); + y, A5O_ALIGN_CENTRE, this->text.c_str()); } bool Button::get_pushed() @@ -532,20 +532,20 @@ bool List::want_key_focus() return !is_disabled(); } -void List::on_key_down(const ALLEGRO_KEYBOARD_EVENT & event) +void List::on_key_down(const A5O_KEYBOARD_EVENT & event) { if (is_disabled()) return; switch (event.keycode) { - case ALLEGRO_KEY_DOWN: + case A5O_KEY_DOWN: if (selected_item < items.size() - 1) { selected_item++; dialog->request_draw(); } break; - case ALLEGRO_KEY_UP: + case A5O_KEY_UP: if (selected_item > 0) { selected_item--; dialog->request_draw(); @@ -574,7 +574,7 @@ void List::draw() { const Theme & theme = dialog->get_theme(); SaveState state; - ALLEGRO_COLOR bg = theme.bg; + A5O_COLOR bg = theme.bg; if (is_disabled()) { bg = al_map_rgb(64, 64, 64); @@ -582,7 +582,7 @@ void List::draw() al_draw_filled_rectangle(x1 + 1, y1 + 1, x2 - 1, y2 - 1, bg); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); const int font_height = al_get_font_line_height(theme.font); for (unsigned i = 0; i < items.size(); i++) { int yi = y1 + i * font_height; @@ -652,7 +652,7 @@ void VSlider::on_mouse_button_hold(int mx, int my) void VSlider::draw() { const Theme & theme = dialog->get_theme(); - ALLEGRO_COLOR bg = theme.fg; + A5O_COLOR bg = theme.fg; float left = x1 + 0.5, top = y1 + 0.5; float right = x2 + 0.5, bottom = y2 + 0.5; SaveState state; @@ -717,7 +717,7 @@ void HSlider::draw() const Theme & theme = dialog->get_theme(); const int cy = (y1 + y2) / 2; SaveState state; - ALLEGRO_COLOR bg = theme.bg; + A5O_COLOR bg = theme.bg; if (is_disabled()) { bg = al_map_rgb(64, 64, 64); @@ -778,33 +778,33 @@ void TextEntry::lost_key_focus() dialog->request_draw(); } -void TextEntry::on_key_down(const ALLEGRO_KEYBOARD_EVENT & event) +void TextEntry::on_key_down(const A5O_KEYBOARD_EVENT & event) { if (is_disabled()) return; switch (event.keycode) { - case ALLEGRO_KEY_LEFT: + case A5O_KEY_LEFT: al_ustr_prev(text, &cursor_pos); break; - case ALLEGRO_KEY_RIGHT: + case A5O_KEY_RIGHT: al_ustr_next(text, &cursor_pos); break; - case ALLEGRO_KEY_HOME: + case A5O_KEY_HOME: cursor_pos = 0; break; - case ALLEGRO_KEY_END: + case A5O_KEY_END: cursor_pos = al_ustr_size(text); break; - case ALLEGRO_KEY_DELETE: + case A5O_KEY_DELETE: al_ustr_remove_chr(text, cursor_pos); break; - case ALLEGRO_KEY_BACKSPACE: + case A5O_KEY_BACKSPACE: if (al_ustr_prev(text, &cursor_pos)) al_ustr_remove_chr(text, cursor_pos); break; @@ -847,7 +847,7 @@ void TextEntry::draw() { const Theme & theme = dialog->get_theme(); SaveState state; - ALLEGRO_COLOR bg = theme.bg; + A5O_COLOR bg = theme.bg; if (is_disabled()) { bg = al_map_rgb(64, 64, 64); @@ -855,7 +855,7 @@ void TextEntry::draw() al_draw_filled_rectangle(x1, y1, x2, y2, bg); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); if (!focused) { al_draw_ustr(theme.font, theme.fg, x1, y1, 0, UString(text, left_pos)); diff --git a/examples/nihgui.hpp b/examples/nihgui.hpp index e4a2201ff7..0cd7079ee6 100644 --- a/examples/nihgui.hpp +++ b/examples/nihgui.hpp @@ -14,13 +14,13 @@ class Widget; class Theme { public: - ALLEGRO_COLOR bg; - ALLEGRO_COLOR fg; - ALLEGRO_COLOR highlight; - const ALLEGRO_FONT *font; + A5O_COLOR bg; + A5O_COLOR fg; + A5O_COLOR highlight; + const A5O_FONT *font; // Null font is fine if you don't use a widget that requires text. - explicit Theme(const ALLEGRO_FONT *font=NULL); + explicit Theme(const A5O_FONT *font=NULL); }; class Widget { @@ -59,7 +59,7 @@ class Widget { virtual bool want_key_focus() { return false; } virtual void got_key_focus() {} virtual void lost_key_focus() {} - virtual void on_key_down(const ALLEGRO_KEYBOARD_EVENT & event) { + virtual void on_key_down(const A5O_KEYBOARD_EVENT & event) { (void)event; } virtual void draw() = 0; @@ -72,14 +72,14 @@ class Widget { class EventHandler { public: virtual ~EventHandler() {} - virtual void handle_event(const ALLEGRO_EVENT & event) = 0; + virtual void handle_event(const A5O_EVENT & event) = 0; }; class Dialog { private: const Theme & theme; - ALLEGRO_DISPLAY * display; - ALLEGRO_EVENT_QUEUE *event_queue; + A5O_DISPLAY * display; + A5O_EVENT_QUEUE *event_queue; int grid_m; int grid_n; int x_padding; @@ -96,7 +96,7 @@ class Dialog { EventHandler * event_handler; public: - Dialog(const Theme & theme, ALLEGRO_DISPLAY *display, + Dialog(const Theme & theme, A5O_DISPLAY *display, int grid_m, int grid_n); ~Dialog(); @@ -112,16 +112,16 @@ class Dialog { void draw(); const Theme & get_theme() const; - void register_event_source(ALLEGRO_EVENT_SOURCE *source); + void register_event_source(A5O_EVENT_SOURCE *source); void set_event_handler(EventHandler *handler); private: void configure_all(); - void on_key_down(const ALLEGRO_KEYBOARD_EVENT & event); - void on_mouse_axes(const ALLEGRO_MOUSE_EVENT & event); + void on_key_down(const A5O_KEYBOARD_EVENT & event); + void on_mouse_axes(const A5O_MOUSE_EVENT & event); void check_mouse_over(int mx, int my); - void on_mouse_button_down(const ALLEGRO_MOUSE_EVENT & event); - void on_mouse_button_up(const ALLEGRO_MOUSE_EVENT & event); + void on_mouse_button_down(const A5O_MOUSE_EVENT & event); + void on_mouse_button_up(const A5O_MOUSE_EVENT & event); }; /*---------------------------------------------------------------------------*/ @@ -171,7 +171,7 @@ class List : public Widget { public: List(int initial_selection = 0); virtual bool want_key_focus(); - virtual void on_key_down(const ALLEGRO_KEYBOARD_EVENT & event); + virtual void on_key_down(const A5O_KEYBOARD_EVENT & event); virtual void on_click(int mx, int my); virtual void draw(); @@ -219,7 +219,7 @@ class TextEntry : public Widget { private: static const int CURSOR_WIDTH = 8; - ALLEGRO_USTR *text; + A5O_USTR *text; bool focused; int cursor_pos; int left_pos; @@ -231,7 +231,7 @@ class TextEntry : public Widget { virtual bool want_key_focus(); virtual void got_key_focus(); virtual void lost_key_focus(); - virtual void on_key_down(const ALLEGRO_KEYBOARD_EVENT & event); + virtual void on_key_down(const A5O_KEYBOARD_EVENT & event); virtual void draw(); const char * get_text(); diff --git a/include/allegro5/alcompat.h b/include/allegro5/alcompat.h index e0f6cef32d..e80649ca17 100644 --- a/include/allegro5/alcompat.h +++ b/include/allegro5/alcompat.h @@ -6,8 +6,8 @@ #endif -#define ALLEGRO_DST_COLOR (ALLEGRO_DEST_COLOR) -#define ALLEGRO_INVERSE_DST_COLOR (ALLEGRO_INVERSE_DEST_COLOR) +#define A5O_DST_COLOR (A5O_DEST_COLOR) +#define A5O_INVERSE_DST_COLOR (A5O_INVERSE_DEST_COLOR) #define al_convert_bitmaps() (al_convert_memory_bitmaps()) #define al_current_time() (al_get_time()) diff --git a/include/allegro5/allegro.h b/include/allegro5/allegro.h index 06d4098708..48af909159 100644 --- a/include/allegro5/allegro.h +++ b/include/allegro5/allegro.h @@ -64,13 +64,13 @@ #include "allegro5/utf8.h" -#ifndef ALLEGRO_NO_COMPATIBILITY +#ifndef A5O_NO_COMPATIBILITY #include "allegro5/alcompat.h" #endif -#ifdef ALLEGRO_EXTRA_HEADER - #include ALLEGRO_EXTRA_HEADER +#ifdef A5O_EXTRA_HEADER + #include A5O_EXTRA_HEADER #endif diff --git a/include/allegro5/allegro_android.h b/include/allegro5/allegro_android.h index 791eb13d4c..892e9cbafc 100644 --- a/include/allegro5/allegro_android.h +++ b/include/allegro5/allegro_android.h @@ -11,8 +11,8 @@ */ -#ifndef A5_ANDROID_ALLEGRO_H -#define A5_ANDROID_ALLEGRO_H +#ifndef A5_ANDROID_A5O_H +#define A5_ANDROID_A5O_H #include @@ -26,17 +26,17 @@ void al_android_set_apk_file_interface(void); const char *al_android_get_os_version(void); void al_android_set_apk_fs_interface(void); -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_SRC) JNIEnv *al_android_get_jni_env(void); jobject al_android_get_activity(void); int al_android_open_fd(const char *uri, const char *mode); #endif /* XXX decide if this should be public */ -void _al_android_set_capture_volume_keys(ALLEGRO_DISPLAY *display, bool onoff); +void _al_android_set_capture_volume_keys(A5O_DISPLAY *display, bool onoff); #ifdef __cplusplus } #endif -#endif /* A5_ANDROID_ALLEGRO_H */ +#endif /* A5_ANDROID_A5O_H */ diff --git a/include/allegro5/allegro_direct3d.h b/include/allegro5/allegro_direct3d.h index def3230e36..b5de71ab2e 100644 --- a/include/allegro5/allegro_direct3d.h +++ b/include/allegro5/allegro_direct3d.h @@ -18,7 +18,7 @@ #define __al_included_allegro5_allegro_direct3d_h #include -#if defined ALLEGRO_CFG_D3DX9 && defined __cplusplus +#if defined A5O_CFG_D3DX9 && defined __cplusplus #include #endif @@ -27,7 +27,7 @@ #include "allegro5/bitmap.h" /* Display creation flag. */ -#define ALLEGRO_DIRECT3D ALLEGRO_DIRECT3D_INTERNAL +#define A5O_DIRECT3D A5O_DIRECT3D_INTERNAL #ifdef __cplusplus extern "C" { @@ -37,16 +37,16 @@ * Public Direct3D-related API */ -AL_FUNC(LPDIRECT3DDEVICE9, al_get_d3d_device, (ALLEGRO_DISPLAY *)); -AL_FUNC(LPDIRECT3DTEXTURE9, al_get_d3d_system_texture, (ALLEGRO_BITMAP *)); -AL_FUNC(LPDIRECT3DTEXTURE9, al_get_d3d_video_texture, (ALLEGRO_BITMAP *)); +AL_FUNC(LPDIRECT3DDEVICE9, al_get_d3d_device, (A5O_DISPLAY *)); +AL_FUNC(LPDIRECT3DTEXTURE9, al_get_d3d_system_texture, (A5O_BITMAP *)); +AL_FUNC(LPDIRECT3DTEXTURE9, al_get_d3d_video_texture, (A5O_BITMAP *)); AL_FUNC(bool, al_have_d3d_non_pow2_texture_support, (void)); AL_FUNC(bool, al_have_d3d_non_square_texture_support, (void)); -AL_FUNC(void, al_get_d3d_texture_position, (ALLEGRO_BITMAP *bitmap, int *u, int *v)); -AL_FUNC(bool, al_get_d3d_texture_size, (ALLEGRO_BITMAP *bitmap, int *width, int *height)); -AL_FUNC(bool, al_is_d3d_device_lost, (ALLEGRO_DISPLAY *display)); -AL_FUNC(void, al_set_d3d_device_release_callback, (void (*callback)(ALLEGRO_DISPLAY *display))); -AL_FUNC(void, al_set_d3d_device_restore_callback, (void (*callback)(ALLEGRO_DISPLAY *display))); +AL_FUNC(void, al_get_d3d_texture_position, (A5O_BITMAP *bitmap, int *u, int *v)); +AL_FUNC(bool, al_get_d3d_texture_size, (A5O_BITMAP *bitmap, int *width, int *height)); +AL_FUNC(bool, al_is_d3d_device_lost, (A5O_DISPLAY *display)); +AL_FUNC(void, al_set_d3d_device_release_callback, (void (*callback)(A5O_DISPLAY *display))); +AL_FUNC(void, al_set_d3d_device_restore_callback, (void (*callback)(A5O_DISPLAY *display))); #ifdef __cplusplus } diff --git a/include/allegro5/allegro_iphone.h b/include/allegro5/allegro_iphone.h index eebf41e00e..063fae649c 100644 --- a/include/allegro5/allegro_iphone.h +++ b/include/allegro5/allegro_iphone.h @@ -11,8 +11,8 @@ */ -#ifndef A5_IPHONE_ALLEGRO_H -#define A5_IPHONE_ALLEGRO_H +#ifndef A5_IPHONE_A5O_H +#define A5_IPHONE_A5O_H #ifdef __cplusplus extern "C" { @@ -22,11 +22,11 @@ * Public iPhone-related API */ -enum ALLEGRO_IPHONE_STATUSBAR_ORIENTATION { - ALLEGRO_IPHONE_STATUSBAR_ORIENTATION_PORTRAIT = 0, - ALLEGRO_IPHONE_STATUSBAR_ORIENTATION_PORTRAIT_UPSIDE_DOWN, - ALLEGRO_IPHONE_STATUSBAR_ORIENTATION_LANDSCAPE_RIGHT, - ALLEGRO_IPHONE_STATUSBAR_ORIENTATION_LANDSCAPE_LEFT +enum A5O_IPHONE_STATUSBAR_ORIENTATION { + A5O_IPHONE_STATUSBAR_ORIENTATION_PORTRAIT = 0, + A5O_IPHONE_STATUSBAR_ORIENTATION_PORTRAIT_UPSIDE_DOWN, + A5O_IPHONE_STATUSBAR_ORIENTATION_LANDSCAPE_RIGHT, + A5O_IPHONE_STATUSBAR_ORIENTATION_LANDSCAPE_LEFT }; AL_FUNC(void, al_iphone_set_statusbar_orientation, (int orientation)); @@ -37,4 +37,4 @@ AL_FUNC(float, al_iphone_get_battery_level, (void)); } #endif -#endif /* A5_IPONE_ALLEGRO_H */ +#endif /* A5_IPONE_A5O_H */ diff --git a/include/allegro5/allegro_iphone_objc.h b/include/allegro5/allegro_iphone_objc.h index f405e70aae..b78eaadaab 100644 --- a/include/allegro5/allegro_iphone_objc.h +++ b/include/allegro5/allegro_iphone_objc.h @@ -11,8 +11,8 @@ */ -#ifndef A5_IPHONE_ALLEGRO_OBJC_H -#define A5_IPHONE_ALLEGRO_OBJC_H +#ifndef A5_IPHONE_A5O_OBJC_H +#define A5_IPHONE_A5O_OBJC_H /* * Public Objective-C iPhone-related API @@ -22,11 +22,11 @@ extern "C" { #endif -AL_FUNC(UIWindow *, al_iphone_get_window, (ALLEGRO_DISPLAY *d)); -AL_FUNC(UIView *, al_iphone_get_view, (ALLEGRO_DISPLAY *d)); +AL_FUNC(UIWindow *, al_iphone_get_window, (A5O_DISPLAY *d)); +AL_FUNC(UIView *, al_iphone_get_view, (A5O_DISPLAY *d)); #ifdef __cplusplus } #endif -#endif /* A5_IPHONE_ALLEGRO_OBJC_H */ +#endif /* A5_IPHONE_A5O_OBJC_H */ diff --git a/include/allegro5/allegro_opengl.h b/include/allegro5/allegro_opengl.h index 8206a4b4d5..6f8ff2d97a 100644 --- a/include/allegro5/allegro_opengl.h +++ b/include/allegro5/allegro_opengl.h @@ -22,24 +22,24 @@ extern "C" { #endif -#if defined(ALLEGRO_WINDOWS) +#if defined(A5O_WINDOWS) #include #endif -#if defined ALLEGRO_IPHONE +#if defined A5O_IPHONE -#ifdef ALLEGRO_CFG_OPENGLES1 +#ifdef A5O_CFG_OPENGLES1 #include #include -#elif defined(ALLEGRO_CFG_OPENGLES3) +#elif defined(A5O_CFG_OPENGLES3) #include #include -#elif defined(ALLEGRO_CFG_OPENGLES2) +#elif defined(A5O_CFG_OPENGLES2) #include #include #endif -#ifdef ALLEGRO_CFG_OPENGLES1 +#ifdef A5O_CFG_OPENGLES1 /* Apple defines OES versions for these - however the separated alpha ones * don't seem to work on the device and just crash. */ @@ -56,13 +56,13 @@ #define GL_FUNC_SUBTRACT GL_FUNC_SUBTRACT_OES #define GL_FUNC_REVERSE_SUBTRACT GL_FUNC_REVERSE_SUBTRACT_OES -#elif defined(ALLEGRO_CFG_OPENGLES3) +#elif defined(A5O_CFG_OPENGLES3) #define glRenderbufferStorageMultisampleEXT glRenderbufferStorageMultisample #endif -#elif defined(ALLEGRO_MACOSX) || defined(__APPLE__) +#elif defined(A5O_MACOSX) || defined(__APPLE__) #include #include @@ -72,7 +72,7 @@ #define GL_GLEXT_PROTOTYPES #endif -#elif defined(ALLEGRO_CFG_OPENGLES1) +#elif defined(A5O_CFG_OPENGLES1) #include #include @@ -95,7 +95,7 @@ #define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_OES #define GL_FRAMEBUFFER GL_FRAMEBUFFER_OES -#elif defined(ALLEGRO_CFG_OPENGLES3) +#elif defined(A5O_CFG_OPENGLES3) #include #include @@ -110,7 +110,7 @@ #define glRenderbufferStorageMultisampleEXT glRenderbufferStorageMultisample -#elif defined(ALLEGRO_CFG_OPENGLES2) +#elif defined(A5O_CFG_OPENGLES2) #include #include @@ -138,7 +138,7 @@ #endif -#ifdef ALLEGRO_RASPBERRYPI +#ifdef A5O_RASPBERRYPI #include #include #endif @@ -148,7 +148,7 @@ #include "allegro5/shader.h" #include "allegro5/opengl/gl_ext.h" -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS /* Missing #defines from Mingw */ #ifndef PFD_SWAP_LAYER_BUFFERS @@ -171,13 +171,13 @@ #define ENUM_CURRENT_SETTINGS ((DWORD)-1) #endif -#endif /* ALLEGRO_WINDOWS */ +#endif /* A5O_WINDOWS */ -#if defined ALLEGRO_WINDOWS - #define ALLEGRO_DEFINE_PROC_TYPE(type, name, args) \ +#if defined A5O_WINDOWS + #define A5O_DEFINE_PROC_TYPE(type, name, args) \ typedef type (APIENTRY * name) args; #else - #define ALLEGRO_DEFINE_PROC_TYPE(type, name, args) \ + #define A5O_DEFINE_PROC_TYPE(type, name, args) \ typedef type (*name) args; #endif @@ -185,26 +185,26 @@ * Public OpenGL-related API */ -/* ALLEGRO_OPENGL_VARIANT +/* A5O_OPENGL_VARIANT */ -typedef enum ALLEGRO_OPENGL_VARIANT { - ALLEGRO_DESKTOP_OPENGL = 0, - ALLEGRO_OPENGL_ES -} ALLEGRO_OPENGL_VARIANT; +typedef enum A5O_OPENGL_VARIANT { + A5O_DESKTOP_OPENGL = 0, + A5O_OPENGL_ES +} A5O_OPENGL_VARIANT; AL_FUNC(uint32_t, al_get_opengl_version, (void)); AL_FUNC(bool, al_have_opengl_extension, (const char *extension)); AL_FUNC(void*, al_get_opengl_proc_address, (const char *name)); -AL_FUNC(ALLEGRO_OGL_EXT_LIST*, al_get_opengl_extension_list, (void)); -AL_FUNC(GLuint, al_get_opengl_texture, (ALLEGRO_BITMAP *bitmap)); -AL_FUNC(void, al_remove_opengl_fbo, (ALLEGRO_BITMAP *bitmap)); -AL_FUNC(GLuint, al_get_opengl_fbo, (ALLEGRO_BITMAP *bitmap)); -AL_FUNC(bool, al_get_opengl_texture_size, (ALLEGRO_BITMAP *bitmap, +AL_FUNC(A5O_OGL_EXT_LIST*, al_get_opengl_extension_list, (void)); +AL_FUNC(GLuint, al_get_opengl_texture, (A5O_BITMAP *bitmap)); +AL_FUNC(void, al_remove_opengl_fbo, (A5O_BITMAP *bitmap)); +AL_FUNC(GLuint, al_get_opengl_fbo, (A5O_BITMAP *bitmap)); +AL_FUNC(bool, al_get_opengl_texture_size, (A5O_BITMAP *bitmap, int *w, int *h)); -AL_FUNC(void, al_get_opengl_texture_position, (ALLEGRO_BITMAP *bitmap, +AL_FUNC(void, al_get_opengl_texture_position, (A5O_BITMAP *bitmap, int *u, int *v)); -AL_FUNC(GLuint, al_get_opengl_program_object, (ALLEGRO_SHADER *shader)); -AL_FUNC(void, al_set_current_opengl_context, (ALLEGRO_DISPLAY *display)); +AL_FUNC(GLuint, al_get_opengl_program_object, (A5O_SHADER *shader)); +AL_FUNC(void, al_set_current_opengl_context, (A5O_DISPLAY *display)); AL_FUNC(int, al_get_opengl_variant, (void)); #ifdef __cplusplus diff --git a/include/allegro5/allegro_osx.h b/include/allegro5/allegro_osx.h index abbe2091a4..40bf4b51c1 100644 --- a/include/allegro5/allegro_osx.h +++ b/include/allegro5/allegro_osx.h @@ -11,8 +11,8 @@ */ -#ifndef A5_OSX_ALLEGRO_H -#define A5_OSX_ALLEGRO_H +#ifndef A5_OSX_A5O_H +#define A5_OSX_A5O_H /* * Public Objective-C OSX-related API @@ -21,10 +21,10 @@ extern "C" { #endif -AL_FUNC(NSWindow *, al_osx_get_window, (ALLEGRO_DISPLAY *d)); +AL_FUNC(NSWindow *, al_osx_get_window, (A5O_DISPLAY *d)); #ifdef __cplusplus } #endif -#endif /* A5_OSX_ALLEGRO_H */ +#endif /* A5_OSX_A5O_H */ diff --git a/include/allegro5/allegro_windows.h b/include/allegro5/allegro_windows.h index 1d0b7bfc3c..8e596d3717 100644 --- a/include/allegro5/allegro_windows.h +++ b/include/allegro5/allegro_windows.h @@ -30,12 +30,12 @@ * Public Windows-related API */ -AL_FUNC(HWND, al_get_win_window_handle, (ALLEGRO_DISPLAY *display)); -AL_FUNC(bool, al_win_add_window_callback, (ALLEGRO_DISPLAY *display, - bool (*callback)(ALLEGRO_DISPLAY *display, UINT message, WPARAM wparam, +AL_FUNC(HWND, al_get_win_window_handle, (A5O_DISPLAY *display)); +AL_FUNC(bool, al_win_add_window_callback, (A5O_DISPLAY *display, + bool (*callback)(A5O_DISPLAY *display, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result, void *userdata), void *userdata)); -AL_FUNC(bool, al_win_remove_window_callback, (ALLEGRO_DISPLAY *display, - bool (*callback)(ALLEGRO_DISPLAY *display, UINT message, WPARAM wparam, +AL_FUNC(bool, al_win_remove_window_callback, (A5O_DISPLAY *display, + bool (*callback)(A5O_DISPLAY *display, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result, void *userdata), void *userdata)); #ifdef __cplusplus diff --git a/include/allegro5/allegro_x.h b/include/allegro5/allegro_x.h index 6643e0ac93..6a71c67872 100644 --- a/include/allegro5/allegro_x.h +++ b/include/allegro5/allegro_x.h @@ -29,9 +29,9 @@ /* * Public X-related API */ -AL_FUNC(XID, al_get_x_window_id, (ALLEGRO_DISPLAY *display)); -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) -AL_FUNC(bool, al_x_set_initial_icon, (ALLEGRO_BITMAP *bitmap)); +AL_FUNC(XID, al_get_x_window_id, (A5O_DISPLAY *display)); +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_SRC) +AL_FUNC(bool, al_x_set_initial_icon, (A5O_BITMAP *bitmap)); #endif #ifdef __cplusplus diff --git a/include/allegro5/altime.h b/include/allegro5/altime.h index bb0e520d34..5ebe4b02bb 100644 --- a/include/allegro5/altime.h +++ b/include/allegro5/altime.h @@ -7,10 +7,10 @@ extern "C" { #endif -/* Type: ALLEGRO_TIMEOUT +/* Type: A5O_TIMEOUT */ -typedef struct ALLEGRO_TIMEOUT ALLEGRO_TIMEOUT; -struct ALLEGRO_TIMEOUT { +typedef struct A5O_TIMEOUT A5O_TIMEOUT; +struct A5O_TIMEOUT { uint64_t __pad1__; uint64_t __pad2__; }; @@ -19,7 +19,7 @@ struct ALLEGRO_TIMEOUT { AL_FUNC(double, al_get_time, (void)); AL_FUNC(void, al_rest, (double seconds)); -AL_FUNC(void, al_init_timeout, (ALLEGRO_TIMEOUT *timeout, double seconds)); +AL_FUNC(void, al_init_timeout, (A5O_TIMEOUT *timeout, double seconds)); diff --git a/include/allegro5/base.h b/include/allegro5/base.h index 317570eef6..4dfa5c3f80 100644 --- a/include/allegro5/base.h +++ b/include/allegro5/base.h @@ -19,7 +19,7 @@ #ifndef __al_included_allegro5_base_h #define __al_included_allegro5_base_h -#ifndef ALLEGRO_NO_STD_HEADERS +#ifndef A5O_NO_STD_HEADERS #include #ifdef _MSC_VER /* enable posix for limits.h and only limits.h @@ -53,20 +53,20 @@ extern "C" { #endif -#define ALLEGRO_VERSION 5 -#define ALLEGRO_SUB_VERSION 2 -#define ALLEGRO_WIP_VERSION 10 +#define A5O_VERSION 5 +#define A5O_SUB_VERSION 2 +#define A5O_WIP_VERSION 10 -#ifdef ALLEGRO_UNSTABLE +#ifdef A5O_UNSTABLE /* 1 << 31 represented as a signed int to match the arg type of * al_install_system. */ - #define ALLEGRO_UNSTABLE_BIT _ALLEGRO_UNSTABLE_BIT_SET + #define A5O_UNSTABLE_BIT _A5O_UNSTABLE_BIT_SET #else - #define ALLEGRO_UNSTABLE_BIT 0 + #define A5O_UNSTABLE_BIT 0 #endif -/* Not sure we need it, but since ALLEGRO_VERSION_STR contains it: +/* Not sure we need it, but since A5O_VERSION_STR contains it: * 0 = GIT * 1 = first release * 2... = hotfixes? @@ -74,15 +74,15 @@ * Note x.y.z (= x.y.z.0) has release number 1, and x.y.z.1 has release * number 2, just to confuse you. */ -#define ALLEGRO_RELEASE_NUMBER 0 +#define A5O_RELEASE_NUMBER 0 -#define ALLEGRO_VERSION_STR "5.2.10 (20231119)" -#define ALLEGRO_DATE_STR "2023" -#define ALLEGRO_DATE 20231119 /* yyyymmdd */ -#define ALLEGRO_VERSION_INT \ - ((ALLEGRO_VERSION << 24) | (ALLEGRO_SUB_VERSION << 16) | \ - (ALLEGRO_WIP_VERSION << 8) | ALLEGRO_RELEASE_NUMBER | \ - ALLEGRO_UNSTABLE_BIT) +#define A5O_VERSION_STR "5.2.10 (20231119)" +#define A5O_DATE_STR "2023" +#define A5O_DATE 20231119 /* yyyymmdd */ +#define A5O_VERSION_INT \ + ((A5O_VERSION << 24) | (A5O_SUB_VERSION << 16) | \ + (A5O_WIP_VERSION << 8) | A5O_RELEASE_NUMBER | \ + A5O_UNSTABLE_BIT) AL_FUNC(uint32_t, al_get_allegro_version, (void)); AL_FUNC(int, al_run_main, (int argc, char **argv, int (*)(int, char **))); @@ -91,9 +91,9 @@ AL_FUNC(int, al_run_main, (int argc, char **argv, int (*)(int, char **))); /************ Some global stuff ************/ /*******************************************/ -/* Type: ALLEGRO_PI +/* Type: A5O_PI */ -#define ALLEGRO_PI 3.14159265358979323846 +#define A5O_PI 3.14159265358979323846 #define AL_ID(a,b,c,d) (((a)<<24) | ((b)<<16) | ((c)<<8) | (d)) diff --git a/include/allegro5/bitmap.h b/include/allegro5/bitmap.h index c5d3a433f2..5373fb203d 100644 --- a/include/allegro5/bitmap.h +++ b/include/allegro5/bitmap.h @@ -7,37 +7,37 @@ extern "C" { #endif -/* Type: ALLEGRO_BITMAP +/* Type: A5O_BITMAP */ -typedef struct ALLEGRO_BITMAP ALLEGRO_BITMAP; +typedef struct A5O_BITMAP A5O_BITMAP; -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) -/* Enum: ALLEGRO_BITMAP_WRAP +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_SRC) +/* Enum: A5O_BITMAP_WRAP */ -typedef enum ALLEGRO_BITMAP_WRAP { - ALLEGRO_BITMAP_WRAP_DEFAULT = 0, - ALLEGRO_BITMAP_WRAP_REPEAT = 1, - ALLEGRO_BITMAP_WRAP_CLAMP = 2, - ALLEGRO_BITMAP_WRAP_MIRROR = 3, -} ALLEGRO_BITMAP_WRAP; +typedef enum A5O_BITMAP_WRAP { + A5O_BITMAP_WRAP_DEFAULT = 0, + A5O_BITMAP_WRAP_REPEAT = 1, + A5O_BITMAP_WRAP_CLAMP = 2, + A5O_BITMAP_WRAP_MIRROR = 3, +} A5O_BITMAP_WRAP; #endif /* * Bitmap flags */ enum { - ALLEGRO_MEMORY_BITMAP = 0x0001, - _ALLEGRO_KEEP_BITMAP_FORMAT = 0x0002, /* now a bitmap loader flag */ - ALLEGRO_FORCE_LOCKING = 0x0004, /* no longer honoured */ - ALLEGRO_NO_PRESERVE_TEXTURE = 0x0008, - _ALLEGRO_ALPHA_TEST = 0x0010, /* now a render state flag */ - _ALLEGRO_INTERNAL_OPENGL = 0x0020, - ALLEGRO_MIN_LINEAR = 0x0040, - ALLEGRO_MAG_LINEAR = 0x0080, - ALLEGRO_MIPMAP = 0x0100, - _ALLEGRO_NO_PREMULTIPLIED_ALPHA = 0x0200, /* now a bitmap loader flag */ - ALLEGRO_VIDEO_BITMAP = 0x0400, - ALLEGRO_CONVERT_BITMAP = 0x1000 + A5O_MEMORY_BITMAP = 0x0001, + _A5O_KEEP_BITMAP_FORMAT = 0x0002, /* now a bitmap loader flag */ + A5O_FORCE_LOCKING = 0x0004, /* no longer honoured */ + A5O_NO_PRESERVE_TEXTURE = 0x0008, + _A5O_ALPHA_TEST = 0x0010, /* now a render state flag */ + _A5O_INTERNAL_OPENGL = 0x0020, + A5O_MIN_LINEAR = 0x0040, + A5O_MAG_LINEAR = 0x0080, + A5O_MIPMAP = 0x0100, + _A5O_NO_PREMULTIPLIED_ALPHA = 0x0200, /* now a bitmap loader flag */ + A5O_VIDEO_BITMAP = 0x0400, + A5O_CONVERT_BITMAP = 0x1000 }; @@ -47,41 +47,41 @@ AL_FUNC(int, al_get_new_bitmap_format, (void)); AL_FUNC(int, al_get_new_bitmap_flags, (void)); AL_FUNC(void, al_add_new_bitmap_flag, (int flag)); -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_SRC) AL_FUNC(int, al_get_new_bitmap_depth, (void)); AL_FUNC(void, al_set_new_bitmap_depth, (int depth)); AL_FUNC(int, al_get_new_bitmap_samples, (void)); AL_FUNC(void, al_set_new_bitmap_samples, (int samples)); -AL_FUNC(void, al_get_new_bitmap_wrap, (ALLEGRO_BITMAP_WRAP *u, ALLEGRO_BITMAP_WRAP *v)); -AL_FUNC(void, al_set_new_bitmap_wrap, (ALLEGRO_BITMAP_WRAP u, ALLEGRO_BITMAP_WRAP v)); +AL_FUNC(void, al_get_new_bitmap_wrap, (A5O_BITMAP_WRAP *u, A5O_BITMAP_WRAP *v)); +AL_FUNC(void, al_set_new_bitmap_wrap, (A5O_BITMAP_WRAP u, A5O_BITMAP_WRAP v)); #endif -AL_FUNC(int, al_get_bitmap_width, (ALLEGRO_BITMAP *bitmap)); -AL_FUNC(int, al_get_bitmap_height, (ALLEGRO_BITMAP *bitmap)); -AL_FUNC(int, al_get_bitmap_format, (ALLEGRO_BITMAP *bitmap)); -AL_FUNC(int, al_get_bitmap_flags, (ALLEGRO_BITMAP *bitmap)); +AL_FUNC(int, al_get_bitmap_width, (A5O_BITMAP *bitmap)); +AL_FUNC(int, al_get_bitmap_height, (A5O_BITMAP *bitmap)); +AL_FUNC(int, al_get_bitmap_format, (A5O_BITMAP *bitmap)); +AL_FUNC(int, al_get_bitmap_flags, (A5O_BITMAP *bitmap)); -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) -AL_FUNC(int, al_get_bitmap_depth, (ALLEGRO_BITMAP *bitmap)); -AL_FUNC(int, al_get_bitmap_samples, (ALLEGRO_BITMAP *bitmap)); +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_SRC) +AL_FUNC(int, al_get_bitmap_depth, (A5O_BITMAP *bitmap)); +AL_FUNC(int, al_get_bitmap_samples, (A5O_BITMAP *bitmap)); #endif -AL_FUNC(ALLEGRO_BITMAP*, al_create_bitmap, (int w, int h)); -AL_FUNC(void, al_destroy_bitmap, (ALLEGRO_BITMAP *bitmap)); +AL_FUNC(A5O_BITMAP*, al_create_bitmap, (int w, int h)); +AL_FUNC(void, al_destroy_bitmap, (A5O_BITMAP *bitmap)); -AL_FUNC(void, al_put_pixel, (int x, int y, ALLEGRO_COLOR color)); -AL_FUNC(void, al_put_blended_pixel, (int x, int y, ALLEGRO_COLOR color)); -AL_FUNC(ALLEGRO_COLOR, al_get_pixel, (ALLEGRO_BITMAP *bitmap, int x, int y)); +AL_FUNC(void, al_put_pixel, (int x, int y, A5O_COLOR color)); +AL_FUNC(void, al_put_blended_pixel, (int x, int y, A5O_COLOR color)); +AL_FUNC(A5O_COLOR, al_get_pixel, (A5O_BITMAP *bitmap, int x, int y)); /* Masking */ -AL_FUNC(void, al_convert_mask_to_alpha, (ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR mask_color)); +AL_FUNC(void, al_convert_mask_to_alpha, (A5O_BITMAP *bitmap, A5O_COLOR mask_color)); /* Blending */ -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) -AL_FUNC(ALLEGRO_COLOR, al_get_bitmap_blend_color, (void)); +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_SRC) +AL_FUNC(A5O_COLOR, al_get_bitmap_blend_color, (void)); AL_FUNC(void, al_get_bitmap_blender, (int *op, int *src, int *dst)); AL_FUNC(void, al_get_separate_bitmap_blender, (int *op, int *src, int *dst, int *alpha_op, int *alpha_src, int *alpha_dst)); -AL_FUNC(void, al_set_bitmap_blend_color, (ALLEGRO_COLOR color)); +AL_FUNC(void, al_set_bitmap_blend_color, (A5O_COLOR color)); AL_FUNC(void, al_set_bitmap_blender, (int op, int src, int dst)); AL_FUNC(void, al_set_separate_bitmap_blender, (int op, int src, int dst, int alpha_op, int alpha_src, int alpha_dst)); AL_FUNC(void, al_reset_bitmap_blender, (void)); @@ -93,20 +93,20 @@ AL_FUNC(void, al_reset_clipping_rectangle, (void)); AL_FUNC(void, al_get_clipping_rectangle, (int *x, int *y, int *w, int *h)); /* Sub bitmaps */ -AL_FUNC(ALLEGRO_BITMAP *, al_create_sub_bitmap, (ALLEGRO_BITMAP *parent, int x, int y, int w, int h)); -AL_FUNC(bool, al_is_sub_bitmap, (ALLEGRO_BITMAP *bitmap)); -AL_FUNC(ALLEGRO_BITMAP *, al_get_parent_bitmap, (ALLEGRO_BITMAP *bitmap)); -AL_FUNC(int, al_get_bitmap_x, (ALLEGRO_BITMAP *bitmap)); -AL_FUNC(int, al_get_bitmap_y, (ALLEGRO_BITMAP *bitmap)); -AL_FUNC(void, al_reparent_bitmap, (ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP *parent, int x, int y, int w, int h)); +AL_FUNC(A5O_BITMAP *, al_create_sub_bitmap, (A5O_BITMAP *parent, int x, int y, int w, int h)); +AL_FUNC(bool, al_is_sub_bitmap, (A5O_BITMAP *bitmap)); +AL_FUNC(A5O_BITMAP *, al_get_parent_bitmap, (A5O_BITMAP *bitmap)); +AL_FUNC(int, al_get_bitmap_x, (A5O_BITMAP *bitmap)); +AL_FUNC(int, al_get_bitmap_y, (A5O_BITMAP *bitmap)); +AL_FUNC(void, al_reparent_bitmap, (A5O_BITMAP *bitmap, + A5O_BITMAP *parent, int x, int y, int w, int h)); /* Miscellaneous */ -AL_FUNC(ALLEGRO_BITMAP *, al_clone_bitmap, (ALLEGRO_BITMAP *bitmap)); -AL_FUNC(void, al_convert_bitmap, (ALLEGRO_BITMAP *bitmap)); +AL_FUNC(A5O_BITMAP *, al_clone_bitmap, (A5O_BITMAP *bitmap)); +AL_FUNC(void, al_convert_bitmap, (A5O_BITMAP *bitmap)); AL_FUNC(void, al_convert_memory_bitmaps, (void)); -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) -AL_FUNC(void, al_backup_dirty_bitmap, (ALLEGRO_BITMAP *bitmap)); +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_SRC) +AL_FUNC(void, al_backup_dirty_bitmap, (A5O_BITMAP *bitmap)); #endif #ifdef __cplusplus diff --git a/include/allegro5/bitmap_draw.h b/include/allegro5/bitmap_draw.h index 83e3e14493..ad9d37aeaf 100644 --- a/include/allegro5/bitmap_draw.h +++ b/include/allegro5/bitmap_draw.h @@ -10,27 +10,27 @@ /* Flags for the blitting functions */ enum { - ALLEGRO_FLIP_HORIZONTAL = 0x00001, - ALLEGRO_FLIP_VERTICAL = 0x00002 + A5O_FLIP_HORIZONTAL = 0x00001, + A5O_FLIP_VERTICAL = 0x00002 }; /* Blitting */ -AL_FUNC(void, al_draw_bitmap, (ALLEGRO_BITMAP *bitmap, float dx, float dy, int flags)); -AL_FUNC(void, al_draw_bitmap_region, (ALLEGRO_BITMAP *bitmap, float sx, float sy, float sw, float sh, float dx, float dy, int flags)); -AL_FUNC(void, al_draw_scaled_bitmap, (ALLEGRO_BITMAP *bitmap, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, int flags)); -AL_FUNC(void, al_draw_rotated_bitmap, (ALLEGRO_BITMAP *bitmap, float cx, float cy, float dx, float dy, float angle, int flags)); -AL_FUNC(void, al_draw_scaled_rotated_bitmap, (ALLEGRO_BITMAP *bitmap, float cx, float cy, float dx, float dy, float xscale, float yscale, float angle, int flags)); +AL_FUNC(void, al_draw_bitmap, (A5O_BITMAP *bitmap, float dx, float dy, int flags)); +AL_FUNC(void, al_draw_bitmap_region, (A5O_BITMAP *bitmap, float sx, float sy, float sw, float sh, float dx, float dy, int flags)); +AL_FUNC(void, al_draw_scaled_bitmap, (A5O_BITMAP *bitmap, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, int flags)); +AL_FUNC(void, al_draw_rotated_bitmap, (A5O_BITMAP *bitmap, float cx, float cy, float dx, float dy, float angle, int flags)); +AL_FUNC(void, al_draw_scaled_rotated_bitmap, (A5O_BITMAP *bitmap, float cx, float cy, float dx, float dy, float xscale, float yscale, float angle, int flags)); /* Tinted blitting */ -AL_FUNC(void, al_draw_tinted_bitmap, (ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR tint, float dx, float dy, int flags)); -AL_FUNC(void, al_draw_tinted_bitmap_region, (ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR tint, float sx, float sy, float sw, float sh, float dx, float dy, int flags)); -AL_FUNC(void, al_draw_tinted_scaled_bitmap, (ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR tint, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, int flags)); -AL_FUNC(void, al_draw_tinted_rotated_bitmap, (ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR tint, float cx, float cy, float dx, float dy, float angle, int flags)); -AL_FUNC(void, al_draw_tinted_scaled_rotated_bitmap, (ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR tint, float cx, float cy, float dx, float dy, float xscale, float yscale, float angle, int flags)); +AL_FUNC(void, al_draw_tinted_bitmap, (A5O_BITMAP *bitmap, A5O_COLOR tint, float dx, float dy, int flags)); +AL_FUNC(void, al_draw_tinted_bitmap_region, (A5O_BITMAP *bitmap, A5O_COLOR tint, float sx, float sy, float sw, float sh, float dx, float dy, int flags)); +AL_FUNC(void, al_draw_tinted_scaled_bitmap, (A5O_BITMAP *bitmap, A5O_COLOR tint, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, int flags)); +AL_FUNC(void, al_draw_tinted_rotated_bitmap, (A5O_BITMAP *bitmap, A5O_COLOR tint, float cx, float cy, float dx, float dy, float angle, int flags)); +AL_FUNC(void, al_draw_tinted_scaled_rotated_bitmap, (A5O_BITMAP *bitmap, A5O_COLOR tint, float cx, float cy, float dx, float dy, float xscale, float yscale, float angle, int flags)); AL_FUNC(void, al_draw_tinted_scaled_rotated_bitmap_region, ( - ALLEGRO_BITMAP *bitmap, + A5O_BITMAP *bitmap, float sx, float sy, float sw, float sh, - ALLEGRO_COLOR tint, + A5O_COLOR tint, float cx, float cy, float dx, float dy, float xscale, float yscale, float angle, int flags)); diff --git a/include/allegro5/bitmap_io.h b/include/allegro5/bitmap_io.h index 70ff94cd87..b6a9f99586 100644 --- a/include/allegro5/bitmap_io.h +++ b/include/allegro5/bitmap_io.h @@ -12,30 +12,30 @@ * Bitmap loader flag */ enum { - ALLEGRO_KEEP_BITMAP_FORMAT = 0x0002, /* was a bitmap flag in 5.0 */ - ALLEGRO_NO_PREMULTIPLIED_ALPHA = 0x0200, /* was a bitmap flag in 5.0 */ - ALLEGRO_KEEP_INDEX = 0x0800 + A5O_KEEP_BITMAP_FORMAT = 0x0002, /* was a bitmap flag in 5.0 */ + A5O_NO_PREMULTIPLIED_ALPHA = 0x0200, /* was a bitmap flag in 5.0 */ + A5O_KEEP_INDEX = 0x0800 }; -typedef ALLEGRO_BITMAP *(*ALLEGRO_IIO_LOADER_FUNCTION)(const char *filename, int flags); -typedef ALLEGRO_BITMAP *(*ALLEGRO_IIO_FS_LOADER_FUNCTION)(ALLEGRO_FILE *fp, int flags); -typedef bool (*ALLEGRO_IIO_SAVER_FUNCTION)(const char *filename, ALLEGRO_BITMAP *bitmap); -typedef bool (*ALLEGRO_IIO_FS_SAVER_FUNCTION)(ALLEGRO_FILE *fp, ALLEGRO_BITMAP *bitmap); -typedef bool (*ALLEGRO_IIO_IDENTIFIER_FUNCTION)(ALLEGRO_FILE *f); +typedef A5O_BITMAP *(*A5O_IIO_LOADER_FUNCTION)(const char *filename, int flags); +typedef A5O_BITMAP *(*A5O_IIO_FS_LOADER_FUNCTION)(A5O_FILE *fp, int flags); +typedef bool (*A5O_IIO_SAVER_FUNCTION)(const char *filename, A5O_BITMAP *bitmap); +typedef bool (*A5O_IIO_FS_SAVER_FUNCTION)(A5O_FILE *fp, A5O_BITMAP *bitmap); +typedef bool (*A5O_IIO_IDENTIFIER_FUNCTION)(A5O_FILE *f); -AL_FUNC(bool, al_register_bitmap_loader, (const char *ext, ALLEGRO_IIO_LOADER_FUNCTION loader)); -AL_FUNC(bool, al_register_bitmap_saver, (const char *ext, ALLEGRO_IIO_SAVER_FUNCTION saver)); -AL_FUNC(bool, al_register_bitmap_loader_f, (const char *ext, ALLEGRO_IIO_FS_LOADER_FUNCTION fs_loader)); -AL_FUNC(bool, al_register_bitmap_saver_f, (const char *ext, ALLEGRO_IIO_FS_SAVER_FUNCTION fs_saver)); +AL_FUNC(bool, al_register_bitmap_loader, (const char *ext, A5O_IIO_LOADER_FUNCTION loader)); +AL_FUNC(bool, al_register_bitmap_saver, (const char *ext, A5O_IIO_SAVER_FUNCTION saver)); +AL_FUNC(bool, al_register_bitmap_loader_f, (const char *ext, A5O_IIO_FS_LOADER_FUNCTION fs_loader)); +AL_FUNC(bool, al_register_bitmap_saver_f, (const char *ext, A5O_IIO_FS_SAVER_FUNCTION fs_saver)); AL_FUNC(bool, al_register_bitmap_identifier, (const char *ext, - ALLEGRO_IIO_IDENTIFIER_FUNCTION identifier)); -AL_FUNC(ALLEGRO_BITMAP *, al_load_bitmap, (const char *filename)); -AL_FUNC(ALLEGRO_BITMAP *, al_load_bitmap_flags, (const char *filename, int flags)); -AL_FUNC(ALLEGRO_BITMAP *, al_load_bitmap_f, (ALLEGRO_FILE *fp, const char *ident)); -AL_FUNC(ALLEGRO_BITMAP *, al_load_bitmap_flags_f, (ALLEGRO_FILE *fp, const char *ident, int flags)); -AL_FUNC(bool, al_save_bitmap, (const char *filename, ALLEGRO_BITMAP *bitmap)); -AL_FUNC(bool, al_save_bitmap_f, (ALLEGRO_FILE *fp, const char *ident, ALLEGRO_BITMAP *bitmap)); -AL_FUNC(char const *, al_identify_bitmap_f, (ALLEGRO_FILE *fp)); + A5O_IIO_IDENTIFIER_FUNCTION identifier)); +AL_FUNC(A5O_BITMAP *, al_load_bitmap, (const char *filename)); +AL_FUNC(A5O_BITMAP *, al_load_bitmap_flags, (const char *filename, int flags)); +AL_FUNC(A5O_BITMAP *, al_load_bitmap_f, (A5O_FILE *fp, const char *ident)); +AL_FUNC(A5O_BITMAP *, al_load_bitmap_flags_f, (A5O_FILE *fp, const char *ident, int flags)); +AL_FUNC(bool, al_save_bitmap, (const char *filename, A5O_BITMAP *bitmap)); +AL_FUNC(bool, al_save_bitmap_f, (A5O_FILE *fp, const char *ident, A5O_BITMAP *bitmap)); +AL_FUNC(char const *, al_identify_bitmap_f, (A5O_FILE *fp)); AL_FUNC(char const *, al_identify_bitmap, (char const *filename)); #ifdef __cplusplus diff --git a/include/allegro5/bitmap_lock.h b/include/allegro5/bitmap_lock.h index 198e58a072..6f0e842c34 100644 --- a/include/allegro5/bitmap_lock.h +++ b/include/allegro5/bitmap_lock.h @@ -12,16 +12,16 @@ * Locking flags */ enum { - ALLEGRO_LOCK_READWRITE = 0, - ALLEGRO_LOCK_READONLY = 1, - ALLEGRO_LOCK_WRITEONLY = 2 + A5O_LOCK_READWRITE = 0, + A5O_LOCK_READONLY = 1, + A5O_LOCK_WRITEONLY = 2 }; -/* Type: ALLEGRO_LOCKED_REGION +/* Type: A5O_LOCKED_REGION */ -typedef struct ALLEGRO_LOCKED_REGION ALLEGRO_LOCKED_REGION; -struct ALLEGRO_LOCKED_REGION { +typedef struct A5O_LOCKED_REGION A5O_LOCKED_REGION; +struct A5O_LOCKED_REGION { void *data; int format; int pitch; @@ -29,13 +29,13 @@ struct ALLEGRO_LOCKED_REGION { }; -AL_FUNC(ALLEGRO_LOCKED_REGION*, al_lock_bitmap, (ALLEGRO_BITMAP *bitmap, int format, int flags)); -AL_FUNC(ALLEGRO_LOCKED_REGION*, al_lock_bitmap_region, (ALLEGRO_BITMAP *bitmap, int x, int y, int width, int height, int format, int flags)); -AL_FUNC(ALLEGRO_LOCKED_REGION*, al_lock_bitmap_blocked, (ALLEGRO_BITMAP *bitmap, int flags)); -AL_FUNC(ALLEGRO_LOCKED_REGION*, al_lock_bitmap_region_blocked, (ALLEGRO_BITMAP *bitmap, int x_block, int y_block, +AL_FUNC(A5O_LOCKED_REGION*, al_lock_bitmap, (A5O_BITMAP *bitmap, int format, int flags)); +AL_FUNC(A5O_LOCKED_REGION*, al_lock_bitmap_region, (A5O_BITMAP *bitmap, int x, int y, int width, int height, int format, int flags)); +AL_FUNC(A5O_LOCKED_REGION*, al_lock_bitmap_blocked, (A5O_BITMAP *bitmap, int flags)); +AL_FUNC(A5O_LOCKED_REGION*, al_lock_bitmap_region_blocked, (A5O_BITMAP *bitmap, int x_block, int y_block, int width_block, int height_block, int flags)); -AL_FUNC(void, al_unlock_bitmap, (ALLEGRO_BITMAP *bitmap)); -AL_FUNC(bool, al_is_bitmap_locked, (ALLEGRO_BITMAP *bitmap)); +AL_FUNC(void, al_unlock_bitmap, (A5O_BITMAP *bitmap)); +AL_FUNC(bool, al_is_bitmap_locked, (A5O_BITMAP *bitmap)); #ifdef __cplusplus diff --git a/include/allegro5/blender.h b/include/allegro5/blender.h index a36a3a3a0c..90fc3d2d60 100644 --- a/include/allegro5/blender.h +++ b/include/allegro5/blender.h @@ -12,32 +12,32 @@ /* * Blending modes */ -enum ALLEGRO_BLEND_MODE { - ALLEGRO_ZERO = 0, - ALLEGRO_ONE = 1, - ALLEGRO_ALPHA = 2, - ALLEGRO_INVERSE_ALPHA = 3, - ALLEGRO_SRC_COLOR = 4, - ALLEGRO_DEST_COLOR = 5, - ALLEGRO_INVERSE_SRC_COLOR = 6, - ALLEGRO_INVERSE_DEST_COLOR = 7, - ALLEGRO_CONST_COLOR = 8, - ALLEGRO_INVERSE_CONST_COLOR = 9, - ALLEGRO_NUM_BLEND_MODES +enum A5O_BLEND_MODE { + A5O_ZERO = 0, + A5O_ONE = 1, + A5O_ALPHA = 2, + A5O_INVERSE_ALPHA = 3, + A5O_SRC_COLOR = 4, + A5O_DEST_COLOR = 5, + A5O_INVERSE_SRC_COLOR = 6, + A5O_INVERSE_DEST_COLOR = 7, + A5O_CONST_COLOR = 8, + A5O_INVERSE_CONST_COLOR = 9, + A5O_NUM_BLEND_MODES }; -enum ALLEGRO_BLEND_OPERATIONS { - ALLEGRO_ADD = 0, - ALLEGRO_SRC_MINUS_DEST = 1, - ALLEGRO_DEST_MINUS_SRC = 2, - ALLEGRO_NUM_BLEND_OPERATIONS +enum A5O_BLEND_OPERATIONS { + A5O_ADD = 0, + A5O_SRC_MINUS_DEST = 1, + A5O_DEST_MINUS_SRC = 2, + A5O_NUM_BLEND_OPERATIONS }; AL_FUNC(void, al_set_blender, (int op, int source, int dest)); -AL_FUNC(void, al_set_blend_color, (ALLEGRO_COLOR color)); +AL_FUNC(void, al_set_blend_color, (A5O_COLOR color)); AL_FUNC(void, al_get_blender, (int *op, int *source, int *dest)); -AL_FUNC(ALLEGRO_COLOR, al_get_blend_color, (void)); +AL_FUNC(A5O_COLOR, al_get_blend_color, (void)); AL_FUNC(void, al_set_separate_blender, (int op, int source, int dest, int alpha_op, int alpha_source, int alpha_dest)); AL_FUNC(void, al_get_separate_blender, (int *op, int *source, int *dest, diff --git a/include/allegro5/clipboard.h b/include/allegro5/clipboard.h index 46851fe48c..26cbf1fa7b 100644 --- a/include/allegro5/clipboard.h +++ b/include/allegro5/clipboard.h @@ -24,9 +24,9 @@ extern "C" { #endif -AL_FUNC(char *, al_get_clipboard_text, (ALLEGRO_DISPLAY *display)); -AL_FUNC(bool, al_set_clipboard_text, (ALLEGRO_DISPLAY *display, const char *text)); -AL_FUNC(bool, al_clipboard_has_text, (ALLEGRO_DISPLAY *display)); +AL_FUNC(char *, al_get_clipboard_text, (A5O_DISPLAY *display)); +AL_FUNC(bool, al_set_clipboard_text, (A5O_DISPLAY *display, const char *text)); +AL_FUNC(bool, al_clipboard_has_text, (A5O_DISPLAY *display)); #ifdef __cplusplus } diff --git a/include/allegro5/color.h b/include/allegro5/color.h index 41b94bfbb1..6cd8a1f521 100644 --- a/include/allegro5/color.h +++ b/include/allegro5/color.h @@ -8,70 +8,70 @@ #endif -/* Type: ALLEGRO_COLOR +/* Type: A5O_COLOR */ -typedef struct ALLEGRO_COLOR ALLEGRO_COLOR; +typedef struct A5O_COLOR A5O_COLOR; -struct ALLEGRO_COLOR +struct A5O_COLOR { float r, g, b, a; }; -/* Enum: ALLEGRO_PIXEL_FORMAT +/* Enum: A5O_PIXEL_FORMAT */ -typedef enum ALLEGRO_PIXEL_FORMAT +typedef enum A5O_PIXEL_FORMAT { - ALLEGRO_PIXEL_FORMAT_ANY = 0, - ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA = 1, - ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA = 2, - ALLEGRO_PIXEL_FORMAT_ANY_15_NO_ALPHA = 3, - ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA = 4, - ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA = 5, - ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA = 6, - ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA = 7, - ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA = 8, - ALLEGRO_PIXEL_FORMAT_ARGB_8888 = 9, - ALLEGRO_PIXEL_FORMAT_RGBA_8888 = 10, - ALLEGRO_PIXEL_FORMAT_ARGB_4444 = 11, - ALLEGRO_PIXEL_FORMAT_RGB_888 = 12, /* 24 bit format */ - ALLEGRO_PIXEL_FORMAT_RGB_565 = 13, - ALLEGRO_PIXEL_FORMAT_RGB_555 = 14, - ALLEGRO_PIXEL_FORMAT_RGBA_5551 = 15, - ALLEGRO_PIXEL_FORMAT_ARGB_1555 = 16, - ALLEGRO_PIXEL_FORMAT_ABGR_8888 = 17, - ALLEGRO_PIXEL_FORMAT_XBGR_8888 = 18, - ALLEGRO_PIXEL_FORMAT_BGR_888 = 19, /* 24 bit format */ - ALLEGRO_PIXEL_FORMAT_BGR_565 = 20, - ALLEGRO_PIXEL_FORMAT_BGR_555 = 21, - ALLEGRO_PIXEL_FORMAT_RGBX_8888 = 22, - ALLEGRO_PIXEL_FORMAT_XRGB_8888 = 23, - ALLEGRO_PIXEL_FORMAT_ABGR_F32 = 24, - ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE = 25, - ALLEGRO_PIXEL_FORMAT_RGBA_4444 = 26, - ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8 = 27, - ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1 = 28, - ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3 = 29, - ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5 = 30, - ALLEGRO_NUM_PIXEL_FORMATS -} ALLEGRO_PIXEL_FORMAT; + A5O_PIXEL_FORMAT_ANY = 0, + A5O_PIXEL_FORMAT_ANY_NO_ALPHA = 1, + A5O_PIXEL_FORMAT_ANY_WITH_ALPHA = 2, + A5O_PIXEL_FORMAT_ANY_15_NO_ALPHA = 3, + A5O_PIXEL_FORMAT_ANY_16_NO_ALPHA = 4, + A5O_PIXEL_FORMAT_ANY_16_WITH_ALPHA = 5, + A5O_PIXEL_FORMAT_ANY_24_NO_ALPHA = 6, + A5O_PIXEL_FORMAT_ANY_32_NO_ALPHA = 7, + A5O_PIXEL_FORMAT_ANY_32_WITH_ALPHA = 8, + A5O_PIXEL_FORMAT_ARGB_8888 = 9, + A5O_PIXEL_FORMAT_RGBA_8888 = 10, + A5O_PIXEL_FORMAT_ARGB_4444 = 11, + A5O_PIXEL_FORMAT_RGB_888 = 12, /* 24 bit format */ + A5O_PIXEL_FORMAT_RGB_565 = 13, + A5O_PIXEL_FORMAT_RGB_555 = 14, + A5O_PIXEL_FORMAT_RGBA_5551 = 15, + A5O_PIXEL_FORMAT_ARGB_1555 = 16, + A5O_PIXEL_FORMAT_ABGR_8888 = 17, + A5O_PIXEL_FORMAT_XBGR_8888 = 18, + A5O_PIXEL_FORMAT_BGR_888 = 19, /* 24 bit format */ + A5O_PIXEL_FORMAT_BGR_565 = 20, + A5O_PIXEL_FORMAT_BGR_555 = 21, + A5O_PIXEL_FORMAT_RGBX_8888 = 22, + A5O_PIXEL_FORMAT_XRGB_8888 = 23, + A5O_PIXEL_FORMAT_ABGR_F32 = 24, + A5O_PIXEL_FORMAT_ABGR_8888_LE = 25, + A5O_PIXEL_FORMAT_RGBA_4444 = 26, + A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8 = 27, + A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1 = 28, + A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3 = 29, + A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5 = 30, + A5O_NUM_PIXEL_FORMATS +} A5O_PIXEL_FORMAT; /* Pixel mapping */ -AL_FUNC(ALLEGRO_COLOR, al_map_rgb, (unsigned char r, unsigned char g, unsigned char b)); -AL_FUNC(ALLEGRO_COLOR, al_map_rgba, (unsigned char r, unsigned char g, unsigned char b, unsigned char a)); -AL_FUNC(ALLEGRO_COLOR, al_map_rgb_f, (float r, float g, float b)); -AL_FUNC(ALLEGRO_COLOR, al_map_rgba_f, (float r, float g, float b, float a)); -AL_FUNC(ALLEGRO_COLOR, al_premul_rgba, +AL_FUNC(A5O_COLOR, al_map_rgb, (unsigned char r, unsigned char g, unsigned char b)); +AL_FUNC(A5O_COLOR, al_map_rgba, (unsigned char r, unsigned char g, unsigned char b, unsigned char a)); +AL_FUNC(A5O_COLOR, al_map_rgb_f, (float r, float g, float b)); +AL_FUNC(A5O_COLOR, al_map_rgba_f, (float r, float g, float b, float a)); +AL_FUNC(A5O_COLOR, al_premul_rgba, (unsigned char r, unsigned char g, unsigned char b, unsigned char a)); -AL_FUNC(ALLEGRO_COLOR, al_premul_rgba_f, +AL_FUNC(A5O_COLOR, al_premul_rgba_f, (float r, float g, float b, float a)); /* Pixel unmapping */ -AL_FUNC(void, al_unmap_rgb, (ALLEGRO_COLOR color, unsigned char *r, unsigned char *g, unsigned char *b)); -AL_FUNC(void, al_unmap_rgba, (ALLEGRO_COLOR color, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a)); -AL_FUNC(void, al_unmap_rgb_f, (ALLEGRO_COLOR color, float *r, float *g, float *b)); -AL_FUNC(void, al_unmap_rgba_f, (ALLEGRO_COLOR color, float *r, float *g, float *b, float *a)); +AL_FUNC(void, al_unmap_rgb, (A5O_COLOR color, unsigned char *r, unsigned char *g, unsigned char *b)); +AL_FUNC(void, al_unmap_rgba, (A5O_COLOR color, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a)); +AL_FUNC(void, al_unmap_rgb_f, (A5O_COLOR color, float *r, float *g, float *b)); +AL_FUNC(void, al_unmap_rgba_f, (A5O_COLOR color, float *r, float *g, float *b, float *a)); /* Pixel formats */ AL_FUNC(int, al_get_pixel_size, (int format)); diff --git a/include/allegro5/config.h b/include/allegro5/config.h index 9402b00dca..9d4e9efbe6 100644 --- a/include/allegro5/config.h +++ b/include/allegro5/config.h @@ -7,40 +7,40 @@ extern "C" { #endif -/* Type: ALLEGRO_CONFIG +/* Type: A5O_CONFIG */ -typedef struct ALLEGRO_CONFIG ALLEGRO_CONFIG; +typedef struct A5O_CONFIG A5O_CONFIG; -/* Type: ALLEGRO_CONFIG_SECTION +/* Type: A5O_CONFIG_SECTION */ -typedef struct ALLEGRO_CONFIG_SECTION ALLEGRO_CONFIG_SECTION; +typedef struct A5O_CONFIG_SECTION A5O_CONFIG_SECTION; -/* Type: ALLEGRO_CONFIG_ENTRY +/* Type: A5O_CONFIG_ENTRY */ -typedef struct ALLEGRO_CONFIG_ENTRY ALLEGRO_CONFIG_ENTRY; - -AL_FUNC(ALLEGRO_CONFIG *, al_create_config, (void)); -AL_FUNC(void, al_add_config_section, (ALLEGRO_CONFIG *config, const char *name)); -AL_FUNC(void, al_set_config_value, (ALLEGRO_CONFIG *config, const char *section, const char *key, const char *value)); -AL_FUNC(void, al_add_config_comment, (ALLEGRO_CONFIG *config, const char *section, const char *comment)); -AL_FUNC(const char*, al_get_config_value, (const ALLEGRO_CONFIG *config, const char *section, const char *key)); -AL_FUNC(ALLEGRO_CONFIG*, al_load_config_file, (const char *filename)); -AL_FUNC(ALLEGRO_CONFIG*, al_load_config_file_f, (ALLEGRO_FILE *filename)); -AL_FUNC(bool, al_save_config_file, (const char *filename, const ALLEGRO_CONFIG *config)); -AL_FUNC(bool, al_save_config_file_f, (ALLEGRO_FILE *file, const ALLEGRO_CONFIG *config)); -AL_FUNC(void, al_merge_config_into, (ALLEGRO_CONFIG *master, const ALLEGRO_CONFIG *add)); -AL_FUNC(ALLEGRO_CONFIG *, al_merge_config, (const ALLEGRO_CONFIG *cfg1, const ALLEGRO_CONFIG *cfg2)); -AL_FUNC(void, al_destroy_config, (ALLEGRO_CONFIG *config)); -AL_FUNC(bool, al_remove_config_section, (ALLEGRO_CONFIG *config, +typedef struct A5O_CONFIG_ENTRY A5O_CONFIG_ENTRY; + +AL_FUNC(A5O_CONFIG *, al_create_config, (void)); +AL_FUNC(void, al_add_config_section, (A5O_CONFIG *config, const char *name)); +AL_FUNC(void, al_set_config_value, (A5O_CONFIG *config, const char *section, const char *key, const char *value)); +AL_FUNC(void, al_add_config_comment, (A5O_CONFIG *config, const char *section, const char *comment)); +AL_FUNC(const char*, al_get_config_value, (const A5O_CONFIG *config, const char *section, const char *key)); +AL_FUNC(A5O_CONFIG*, al_load_config_file, (const char *filename)); +AL_FUNC(A5O_CONFIG*, al_load_config_file_f, (A5O_FILE *filename)); +AL_FUNC(bool, al_save_config_file, (const char *filename, const A5O_CONFIG *config)); +AL_FUNC(bool, al_save_config_file_f, (A5O_FILE *file, const A5O_CONFIG *config)); +AL_FUNC(void, al_merge_config_into, (A5O_CONFIG *master, const A5O_CONFIG *add)); +AL_FUNC(A5O_CONFIG *, al_merge_config, (const A5O_CONFIG *cfg1, const A5O_CONFIG *cfg2)); +AL_FUNC(void, al_destroy_config, (A5O_CONFIG *config)); +AL_FUNC(bool, al_remove_config_section, (A5O_CONFIG *config, char const *section)); -AL_FUNC(bool, al_remove_config_key, (ALLEGRO_CONFIG *config, +AL_FUNC(bool, al_remove_config_key, (A5O_CONFIG *config, char const *section, char const *key)); -AL_FUNC(char const *, al_get_first_config_section, (ALLEGRO_CONFIG const *config, ALLEGRO_CONFIG_SECTION **iterator)); -AL_FUNC(char const *, al_get_next_config_section, (ALLEGRO_CONFIG_SECTION **iterator)); -AL_FUNC(char const *, al_get_first_config_entry, (ALLEGRO_CONFIG const *config, char const *section, - ALLEGRO_CONFIG_ENTRY **iterator)); -AL_FUNC(char const *, al_get_next_config_entry, (ALLEGRO_CONFIG_ENTRY **iterator)); +AL_FUNC(char const *, al_get_first_config_section, (A5O_CONFIG const *config, A5O_CONFIG_SECTION **iterator)); +AL_FUNC(char const *, al_get_next_config_section, (A5O_CONFIG_SECTION **iterator)); +AL_FUNC(char const *, al_get_first_config_entry, (A5O_CONFIG const *config, char const *section, + A5O_CONFIG_ENTRY **iterator)); +AL_FUNC(char const *, al_get_next_config_entry, (A5O_CONFIG_ENTRY **iterator)); #ifdef __cplusplus } diff --git a/include/allegro5/debug.h b/include/allegro5/debug.h index 4ce403df71..96128b4269 100644 --- a/include/allegro5/debug.h +++ b/include/allegro5/debug.h @@ -31,28 +31,28 @@ AL_FUNC(bool, _al_trace_prefix, (char const *channel, int level, AL_PRINTFUNC(void, _al_trace_suffix, (const char *msg, ...), 1, 2); -#if defined(DEBUGMODE) || defined(ALLEGRO_CFG_RELEASE_LOGGING) +#if defined(DEBUGMODE) || defined(A5O_CFG_RELEASE_LOGGING) /* Must not be used with a trailing semicolon. */ - #ifdef ALLEGRO_GCC - #define ALLEGRO_DEBUG_CHANNEL(x) \ + #ifdef A5O_GCC + #define A5O_DEBUG_CHANNEL(x) \ static char const *__al_debug_channel __attribute__((unused)) = x; #else - #define ALLEGRO_DEBUG_CHANNEL(x) \ + #define A5O_DEBUG_CHANNEL(x) \ static char const *__al_debug_channel = x; #endif - #define ALLEGRO_TRACE_CHANNEL_LEVEL(channel, level) \ + #define A5O_TRACE_CHANNEL_LEVEL(channel, level) \ !_al_trace_prefix(channel, level, __FILE__, __LINE__, __func__) \ ? (void)0 : _al_trace_suffix #else - #define ALLEGRO_TRACE_CHANNEL_LEVEL(channel, x) 1 ? (void) 0 : _al_trace_suffix - #define ALLEGRO_DEBUG_CHANNEL(x) + #define A5O_TRACE_CHANNEL_LEVEL(channel, x) 1 ? (void) 0 : _al_trace_suffix + #define A5O_DEBUG_CHANNEL(x) #endif -#define ALLEGRO_TRACE_LEVEL(x) ALLEGRO_TRACE_CHANNEL_LEVEL(__al_debug_channel, x) -#define ALLEGRO_DEBUG ALLEGRO_TRACE_LEVEL(0) -#define ALLEGRO_INFO ALLEGRO_TRACE_LEVEL(1) -#define ALLEGRO_WARN ALLEGRO_TRACE_LEVEL(2) -#define ALLEGRO_ERROR ALLEGRO_TRACE_LEVEL(3) +#define A5O_TRACE_LEVEL(x) A5O_TRACE_CHANNEL_LEVEL(__al_debug_channel, x) +#define A5O_DEBUG A5O_TRACE_LEVEL(0) +#define A5O_INFO A5O_TRACE_LEVEL(1) +#define A5O_WARN A5O_TRACE_LEVEL(2) +#define A5O_ERROR A5O_TRACE_LEVEL(3) /* Run-time assertions. */ AL_FUNCPTR(void, _al_user_assert_handler, (char const *expr, char const *file, @@ -66,12 +66,12 @@ AL_FUNC(void, al_register_trace_handler, (void (*handler)(char const *))); #ifdef __clang_analyzer__ /* Clang doesn't understand _al_user_assert_handler, so we simplify the * definition for analysis purposes. */ - #define ALLEGRO_ASSERT(e) assert(e) + #define A5O_ASSERT(e) assert(e) #else #ifdef NDEBUG - #define ALLEGRO_ASSERT(e) ((void)(0 && (e))) + #define A5O_ASSERT(e) ((void)(0 && (e))) #else - #define ALLEGRO_ASSERT(e) \ + #define A5O_ASSERT(e) \ ((e) ? (void) 0 \ : (_al_user_assert_handler) ? \ _al_user_assert_handler(#e, __FILE__, __LINE__, __func__) \ @@ -80,15 +80,15 @@ AL_FUNC(void, al_register_trace_handler, (void (*handler)(char const *))); #endif /* Compile time assertions. */ -#define ALLEGRO_ASSERT_CONCAT_(a, b) a##b -#define ALLEGRO_ASSERT_CONCAT(a, b) ALLEGRO_ASSERT_CONCAT_(a, b) -#define ALLEGRO_STATIC_ASSERT(module, e) \ - struct ALLEGRO_ASSERT_CONCAT(static_assert_##module##_line_, __LINE__) \ +#define A5O_ASSERT_CONCAT_(a, b) a##b +#define A5O_ASSERT_CONCAT(a, b) A5O_ASSERT_CONCAT_(a, b) +#define A5O_STATIC_ASSERT(module, e) \ + struct A5O_ASSERT_CONCAT(static_assert_##module##_line_, __LINE__) \ { unsigned int bf : !!(e); } /* We are lazy and use just ASSERT while Allegro itself is compiled. */ -#ifdef ALLEGRO_LIB_BUILD - #define ASSERT(x) ALLEGRO_ASSERT(x) +#ifdef A5O_LIB_BUILD + #define ASSERT(x) A5O_ASSERT(x) #endif #ifdef __cplusplus diff --git a/include/allegro5/display.h b/include/allegro5/display.h index ba5a577e79..404df98912 100644 --- a/include/allegro5/display.h +++ b/include/allegro5/display.h @@ -11,111 +11,111 @@ /* Possible bit combinations for the flags parameter of al_create_display. */ enum { - ALLEGRO_WINDOWED = 1 << 0, - ALLEGRO_FULLSCREEN = 1 << 1, - ALLEGRO_OPENGL = 1 << 2, - ALLEGRO_DIRECT3D_INTERNAL = 1 << 3, - ALLEGRO_RESIZABLE = 1 << 4, - ALLEGRO_FRAMELESS = 1 << 5, - ALLEGRO_NOFRAME = ALLEGRO_FRAMELESS, /* older synonym */ - ALLEGRO_GENERATE_EXPOSE_EVENTS = 1 << 6, - ALLEGRO_OPENGL_3_0 = 1 << 7, - ALLEGRO_OPENGL_FORWARD_COMPATIBLE = 1 << 8, - ALLEGRO_FULLSCREEN_WINDOW = 1 << 9, - ALLEGRO_MINIMIZED = 1 << 10, - ALLEGRO_PROGRAMMABLE_PIPELINE = 1 << 11, - ALLEGRO_GTK_TOPLEVEL_INTERNAL = 1 << 12, - ALLEGRO_MAXIMIZED = 1 << 13, - ALLEGRO_OPENGL_ES_PROFILE = 1 << 14, -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) - ALLEGRO_OPENGL_CORE_PROFILE = 1 << 15, - ALLEGRO_DRAG_AND_DROP = 1 << 16, + A5O_WINDOWED = 1 << 0, + A5O_FULLSCREEN = 1 << 1, + A5O_OPENGL = 1 << 2, + A5O_DIRECT3D_INTERNAL = 1 << 3, + A5O_RESIZABLE = 1 << 4, + A5O_FRAMELESS = 1 << 5, + A5O_NOFRAME = A5O_FRAMELESS, /* older synonym */ + A5O_GENERATE_EXPOSE_EVENTS = 1 << 6, + A5O_OPENGL_3_0 = 1 << 7, + A5O_OPENGL_FORWARD_COMPATIBLE = 1 << 8, + A5O_FULLSCREEN_WINDOW = 1 << 9, + A5O_MINIMIZED = 1 << 10, + A5O_PROGRAMMABLE_PIPELINE = 1 << 11, + A5O_GTK_TOPLEVEL_INTERNAL = 1 << 12, + A5O_MAXIMIZED = 1 << 13, + A5O_OPENGL_ES_PROFILE = 1 << 14, +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_SRC) + A5O_OPENGL_CORE_PROFILE = 1 << 15, + A5O_DRAG_AND_DROP = 1 << 16, #endif }; /* Possible parameters for al_set_display_option. - * Make sure to update ALLEGRO_EXTRA_DISPLAY_SETTINGS if you modify + * Make sure to update A5O_EXTRA_DISPLAY_SETTINGS if you modify * anything here. */ -enum ALLEGRO_DISPLAY_OPTIONS { - ALLEGRO_RED_SIZE = 0, - ALLEGRO_GREEN_SIZE = 1, - ALLEGRO_BLUE_SIZE = 2, - ALLEGRO_ALPHA_SIZE = 3, - ALLEGRO_RED_SHIFT = 4, - ALLEGRO_GREEN_SHIFT = 5, - ALLEGRO_BLUE_SHIFT = 6, - ALLEGRO_ALPHA_SHIFT = 7, - ALLEGRO_ACC_RED_SIZE = 8, - ALLEGRO_ACC_GREEN_SIZE = 9, - ALLEGRO_ACC_BLUE_SIZE = 10, - ALLEGRO_ACC_ALPHA_SIZE = 11, - ALLEGRO_STEREO = 12, - ALLEGRO_AUX_BUFFERS = 13, - ALLEGRO_COLOR_SIZE = 14, - ALLEGRO_DEPTH_SIZE = 15, - ALLEGRO_STENCIL_SIZE = 16, - ALLEGRO_SAMPLE_BUFFERS = 17, - ALLEGRO_SAMPLES = 18, - ALLEGRO_RENDER_METHOD = 19, - ALLEGRO_FLOAT_COLOR = 20, - ALLEGRO_FLOAT_DEPTH = 21, - ALLEGRO_SINGLE_BUFFER = 22, - ALLEGRO_SWAP_METHOD = 23, - ALLEGRO_COMPATIBLE_DISPLAY = 24, - ALLEGRO_UPDATE_DISPLAY_REGION = 25, - ALLEGRO_VSYNC = 26, - ALLEGRO_MAX_BITMAP_SIZE = 27, - ALLEGRO_SUPPORT_NPOT_BITMAP = 28, - ALLEGRO_CAN_DRAW_INTO_BITMAP = 29, - ALLEGRO_SUPPORT_SEPARATE_ALPHA = 30, - ALLEGRO_AUTO_CONVERT_BITMAPS = 31, - ALLEGRO_SUPPORTED_ORIENTATIONS = 32, - ALLEGRO_OPENGL_MAJOR_VERSION = 33, - ALLEGRO_OPENGL_MINOR_VERSION = 34, - ALLEGRO_DEFAULT_SHADER_PLATFORM = 35, - ALLEGRO_DISPLAY_OPTIONS_COUNT +enum A5O_DISPLAY_OPTIONS { + A5O_RED_SIZE = 0, + A5O_GREEN_SIZE = 1, + A5O_BLUE_SIZE = 2, + A5O_ALPHA_SIZE = 3, + A5O_RED_SHIFT = 4, + A5O_GREEN_SHIFT = 5, + A5O_BLUE_SHIFT = 6, + A5O_ALPHA_SHIFT = 7, + A5O_ACC_RED_SIZE = 8, + A5O_ACC_GREEN_SIZE = 9, + A5O_ACC_BLUE_SIZE = 10, + A5O_ACC_ALPHA_SIZE = 11, + A5O_STEREO = 12, + A5O_AUX_BUFFERS = 13, + A5O_COLOR_SIZE = 14, + A5O_DEPTH_SIZE = 15, + A5O_STENCIL_SIZE = 16, + A5O_SAMPLE_BUFFERS = 17, + A5O_SAMPLES = 18, + A5O_RENDER_METHOD = 19, + A5O_FLOAT_COLOR = 20, + A5O_FLOAT_DEPTH = 21, + A5O_SINGLE_BUFFER = 22, + A5O_SWAP_METHOD = 23, + A5O_COMPATIBLE_DISPLAY = 24, + A5O_UPDATE_DISPLAY_REGION = 25, + A5O_VSYNC = 26, + A5O_MAX_BITMAP_SIZE = 27, + A5O_SUPPORT_NPOT_BITMAP = 28, + A5O_CAN_DRAW_INTO_BITMAP = 29, + A5O_SUPPORT_SEPARATE_ALPHA = 30, + A5O_AUTO_CONVERT_BITMAPS = 31, + A5O_SUPPORTED_ORIENTATIONS = 32, + A5O_OPENGL_MAJOR_VERSION = 33, + A5O_OPENGL_MINOR_VERSION = 34, + A5O_DEFAULT_SHADER_PLATFORM = 35, + A5O_DISPLAY_OPTIONS_COUNT }; enum { - ALLEGRO_DONTCARE, - ALLEGRO_REQUIRE, - ALLEGRO_SUGGEST + A5O_DONTCARE, + A5O_REQUIRE, + A5O_SUGGEST }; -/* Bitflags so they can be used for the ALLEGRO_SUPPORTED_ORIENTATIONS option. */ -enum ALLEGRO_DISPLAY_ORIENTATION +/* Bitflags so they can be used for the A5O_SUPPORTED_ORIENTATIONS option. */ +enum A5O_DISPLAY_ORIENTATION { - ALLEGRO_DISPLAY_ORIENTATION_UNKNOWN = 0, - ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES = 1, - ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES = 2, - ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES = 4, - ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES = 8, - ALLEGRO_DISPLAY_ORIENTATION_PORTRAIT = 5, - ALLEGRO_DISPLAY_ORIENTATION_LANDSCAPE = 10, - ALLEGRO_DISPLAY_ORIENTATION_ALL = 15, - ALLEGRO_DISPLAY_ORIENTATION_FACE_UP = 16, - ALLEGRO_DISPLAY_ORIENTATION_FACE_DOWN = 32 + A5O_DISPLAY_ORIENTATION_UNKNOWN = 0, + A5O_DISPLAY_ORIENTATION_0_DEGREES = 1, + A5O_DISPLAY_ORIENTATION_90_DEGREES = 2, + A5O_DISPLAY_ORIENTATION_180_DEGREES = 4, + A5O_DISPLAY_ORIENTATION_270_DEGREES = 8, + A5O_DISPLAY_ORIENTATION_PORTRAIT = 5, + A5O_DISPLAY_ORIENTATION_LANDSCAPE = 10, + A5O_DISPLAY_ORIENTATION_ALL = 15, + A5O_DISPLAY_ORIENTATION_FACE_UP = 16, + A5O_DISPLAY_ORIENTATION_FACE_DOWN = 32 }; /* Formally part of the primitives addon. */ enum { - _ALLEGRO_PRIM_MAX_USER_ATTR = 10 + _A5O_PRIM_MAX_USER_ATTR = 10 }; -/* Type: ALLEGRO_DISPLAY +/* Type: A5O_DISPLAY */ -typedef struct ALLEGRO_DISPLAY ALLEGRO_DISPLAY; +typedef struct A5O_DISPLAY A5O_DISPLAY; -/* Enum: ALLEGRO_NEW_WINDOW_TITLE_MAX_SIZE +/* Enum: A5O_NEW_WINDOW_TITLE_MAX_SIZE */ -#define ALLEGRO_NEW_WINDOW_TITLE_MAX_SIZE 255 +#define A5O_NEW_WINDOW_TITLE_MAX_SIZE 255 AL_FUNC(void, al_set_new_display_refresh_rate, (int refresh_rate)); AL_FUNC(void, al_set_new_display_flags, (int flags)); @@ -125,67 +125,67 @@ AL_FUNC(int, al_get_new_display_flags, (void)); AL_FUNC(void, al_set_new_window_title, (const char *title)); AL_FUNC(const char *, al_get_new_window_title, (void)); -AL_FUNC(int, al_get_display_width, (ALLEGRO_DISPLAY *display)); -AL_FUNC(int, al_get_display_height, (ALLEGRO_DISPLAY *display)); -AL_FUNC(int, al_get_display_format, (ALLEGRO_DISPLAY *display)); -AL_FUNC(int, al_get_display_refresh_rate, (ALLEGRO_DISPLAY *display)); -AL_FUNC(int, al_get_display_flags, (ALLEGRO_DISPLAY *display)); -AL_FUNC(int, al_get_display_orientation, (ALLEGRO_DISPLAY* display)); -AL_FUNC(bool, al_set_display_flag, (ALLEGRO_DISPLAY *display, int flag, bool onoff)); - -AL_FUNC(ALLEGRO_DISPLAY*, al_create_display, (int w, int h)); -AL_FUNC(void, al_destroy_display, (ALLEGRO_DISPLAY *display)); -AL_FUNC(ALLEGRO_DISPLAY*, al_get_current_display, (void)); -AL_FUNC(void, al_set_target_bitmap, (ALLEGRO_BITMAP *bitmap)); -AL_FUNC(void, al_set_target_backbuffer, (ALLEGRO_DISPLAY *display)); -AL_FUNC(ALLEGRO_BITMAP*, al_get_backbuffer, (ALLEGRO_DISPLAY *display)); -AL_FUNC(ALLEGRO_BITMAP*, al_get_target_bitmap, (void)); - -AL_FUNC(bool, al_acknowledge_resize, (ALLEGRO_DISPLAY *display)); -AL_FUNC(bool, al_resize_display, (ALLEGRO_DISPLAY *display, int width, int height)); +AL_FUNC(int, al_get_display_width, (A5O_DISPLAY *display)); +AL_FUNC(int, al_get_display_height, (A5O_DISPLAY *display)); +AL_FUNC(int, al_get_display_format, (A5O_DISPLAY *display)); +AL_FUNC(int, al_get_display_refresh_rate, (A5O_DISPLAY *display)); +AL_FUNC(int, al_get_display_flags, (A5O_DISPLAY *display)); +AL_FUNC(int, al_get_display_orientation, (A5O_DISPLAY* display)); +AL_FUNC(bool, al_set_display_flag, (A5O_DISPLAY *display, int flag, bool onoff)); + +AL_FUNC(A5O_DISPLAY*, al_create_display, (int w, int h)); +AL_FUNC(void, al_destroy_display, (A5O_DISPLAY *display)); +AL_FUNC(A5O_DISPLAY*, al_get_current_display, (void)); +AL_FUNC(void, al_set_target_bitmap, (A5O_BITMAP *bitmap)); +AL_FUNC(void, al_set_target_backbuffer, (A5O_DISPLAY *display)); +AL_FUNC(A5O_BITMAP*, al_get_backbuffer, (A5O_DISPLAY *display)); +AL_FUNC(A5O_BITMAP*, al_get_target_bitmap, (void)); + +AL_FUNC(bool, al_acknowledge_resize, (A5O_DISPLAY *display)); +AL_FUNC(bool, al_resize_display, (A5O_DISPLAY *display, int width, int height)); AL_FUNC(void, al_flip_display, (void)); AL_FUNC(void, al_update_display_region, (int x, int y, int width, int height)); -AL_FUNC(bool, al_is_compatible_bitmap, (ALLEGRO_BITMAP *bitmap)); +AL_FUNC(bool, al_is_compatible_bitmap, (A5O_BITMAP *bitmap)); AL_FUNC(bool, al_wait_for_vsync, (void)); -AL_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_display_event_source, (ALLEGRO_DISPLAY *display)); +AL_FUNC(A5O_EVENT_SOURCE *, al_get_display_event_source, (A5O_DISPLAY *display)); -AL_FUNC(void, al_set_display_icon, (ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *icon)); -AL_FUNC(void, al_set_display_icons, (ALLEGRO_DISPLAY *display, int num_icons, ALLEGRO_BITMAP *icons[])); +AL_FUNC(void, al_set_display_icon, (A5O_DISPLAY *display, A5O_BITMAP *icon)); +AL_FUNC(void, al_set_display_icons, (A5O_DISPLAY *display, int num_icons, A5O_BITMAP *icons[])); /* Stuff for multihead/window management */ AL_FUNC(int, al_get_new_display_adapter, (void)); AL_FUNC(void, al_set_new_display_adapter, (int adapter)); AL_FUNC(void, al_set_new_window_position, (int x, int y)); AL_FUNC(void, al_get_new_window_position, (int *x, int *y)); -AL_FUNC(void, al_set_window_position, (ALLEGRO_DISPLAY *display, int x, int y)); -AL_FUNC(void, al_get_window_position, (ALLEGRO_DISPLAY *display, int *x, int *y)); -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) -AL_FUNC(bool, al_get_window_borders, (ALLEGRO_DISPLAY *display, int *left, int *top, int *right, int *bottom)); +AL_FUNC(void, al_set_window_position, (A5O_DISPLAY *display, int x, int y)); +AL_FUNC(void, al_get_window_position, (A5O_DISPLAY *display, int *x, int *y)); +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_SRC) +AL_FUNC(bool, al_get_window_borders, (A5O_DISPLAY *display, int *left, int *top, int *right, int *bottom)); #endif -AL_FUNC(bool, al_set_window_constraints, (ALLEGRO_DISPLAY *display, int min_w, int min_h, int max_w, int max_h)); -AL_FUNC(bool, al_get_window_constraints, (ALLEGRO_DISPLAY *display, int *min_w, int *min_h, int *max_w, int *max_h)); -AL_FUNC(void, al_apply_window_constraints, (ALLEGRO_DISPLAY *display, bool onoff)); +AL_FUNC(bool, al_set_window_constraints, (A5O_DISPLAY *display, int min_w, int min_h, int max_w, int max_h)); +AL_FUNC(bool, al_get_window_constraints, (A5O_DISPLAY *display, int *min_w, int *min_h, int *max_w, int *max_h)); +AL_FUNC(void, al_apply_window_constraints, (A5O_DISPLAY *display, bool onoff)); -AL_FUNC(void, al_set_window_title, (ALLEGRO_DISPLAY *display, const char *title)); +AL_FUNC(void, al_set_window_title, (A5O_DISPLAY *display, const char *title)); /* Defined in display_settings.c */ AL_FUNC(void, al_set_new_display_option, (int option, int value, int importance)); AL_FUNC(int, al_get_new_display_option, (int option, int *importance)); AL_FUNC(void, al_reset_new_display_options, (void)); -AL_FUNC(void, al_set_display_option, (ALLEGRO_DISPLAY *display, int option, int value)); -AL_FUNC(int, al_get_display_option, (ALLEGRO_DISPLAY *display, int option)); +AL_FUNC(void, al_set_display_option, (A5O_DISPLAY *display, int option, int value)); +AL_FUNC(int, al_get_display_option, (A5O_DISPLAY *display, int option)); /*Deferred drawing*/ AL_FUNC(void, al_hold_bitmap_drawing, (bool hold)); AL_FUNC(bool, al_is_bitmap_drawing_held, (void)); /* Miscellaneous */ -AL_FUNC(void, al_acknowledge_drawing_halt, (ALLEGRO_DISPLAY *display)); -AL_FUNC(void, al_acknowledge_drawing_resume, (ALLEGRO_DISPLAY *display)); -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) -AL_FUNC(void, al_backup_dirty_bitmaps, (ALLEGRO_DISPLAY *display)); +AL_FUNC(void, al_acknowledge_drawing_halt, (A5O_DISPLAY *display)); +AL_FUNC(void, al_acknowledge_drawing_resume, (A5O_DISPLAY *display)); +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_SRC) +AL_FUNC(void, al_backup_dirty_bitmaps, (A5O_DISPLAY *display)); #endif #ifdef __cplusplus diff --git a/include/allegro5/drawing.h b/include/allegro5/drawing.h index dd21dc6cd6..7483abd0a9 100644 --- a/include/allegro5/drawing.h +++ b/include/allegro5/drawing.h @@ -9,9 +9,9 @@ /* Drawing primitives */ -AL_FUNC(void, al_clear_to_color, (ALLEGRO_COLOR color)); +AL_FUNC(void, al_clear_to_color, (A5O_COLOR color)); AL_FUNC(void, al_clear_depth_buffer, (float x)); -AL_FUNC(void, al_draw_pixel, (float x, float y, ALLEGRO_COLOR color)); +AL_FUNC(void, al_draw_pixel, (float x, float y, A5O_COLOR color)); #ifdef __cplusplus diff --git a/include/allegro5/events.h b/include/allegro5/events.h index 0e571a1be6..2c28eb71ad 100644 --- a/include/allegro5/events.h +++ b/include/allegro5/events.h @@ -8,72 +8,72 @@ #endif -/* Type: ALLEGRO_EVENT_TYPE +/* Type: A5O_EVENT_TYPE */ -typedef unsigned int ALLEGRO_EVENT_TYPE; +typedef unsigned int A5O_EVENT_TYPE; enum { - ALLEGRO_EVENT_JOYSTICK_AXIS = 1, - ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN = 2, - ALLEGRO_EVENT_JOYSTICK_BUTTON_UP = 3, - ALLEGRO_EVENT_JOYSTICK_CONFIGURATION = 4, - - ALLEGRO_EVENT_KEY_DOWN = 10, - ALLEGRO_EVENT_KEY_CHAR = 11, - ALLEGRO_EVENT_KEY_UP = 12, - - ALLEGRO_EVENT_MOUSE_AXES = 20, - ALLEGRO_EVENT_MOUSE_BUTTON_DOWN = 21, - ALLEGRO_EVENT_MOUSE_BUTTON_UP = 22, - ALLEGRO_EVENT_MOUSE_ENTER_DISPLAY = 23, - ALLEGRO_EVENT_MOUSE_LEAVE_DISPLAY = 24, - ALLEGRO_EVENT_MOUSE_WARPED = 25, - - ALLEGRO_EVENT_TIMER = 30, - - ALLEGRO_EVENT_DISPLAY_EXPOSE = 40, - ALLEGRO_EVENT_DISPLAY_RESIZE = 41, - ALLEGRO_EVENT_DISPLAY_CLOSE = 42, - ALLEGRO_EVENT_DISPLAY_LOST = 43, - ALLEGRO_EVENT_DISPLAY_FOUND = 44, - ALLEGRO_EVENT_DISPLAY_SWITCH_IN = 45, - ALLEGRO_EVENT_DISPLAY_SWITCH_OUT = 46, - ALLEGRO_EVENT_DISPLAY_ORIENTATION = 47, - ALLEGRO_EVENT_DISPLAY_HALT_DRAWING = 48, - ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING = 49, - - ALLEGRO_EVENT_TOUCH_BEGIN = 50, - ALLEGRO_EVENT_TOUCH_END = 51, - ALLEGRO_EVENT_TOUCH_MOVE = 52, - ALLEGRO_EVENT_TOUCH_CANCEL = 53, + A5O_EVENT_JOYSTICK_AXIS = 1, + A5O_EVENT_JOYSTICK_BUTTON_DOWN = 2, + A5O_EVENT_JOYSTICK_BUTTON_UP = 3, + A5O_EVENT_JOYSTICK_CONFIGURATION = 4, + + A5O_EVENT_KEY_DOWN = 10, + A5O_EVENT_KEY_CHAR = 11, + A5O_EVENT_KEY_UP = 12, + + A5O_EVENT_MOUSE_AXES = 20, + A5O_EVENT_MOUSE_BUTTON_DOWN = 21, + A5O_EVENT_MOUSE_BUTTON_UP = 22, + A5O_EVENT_MOUSE_ENTER_DISPLAY = 23, + A5O_EVENT_MOUSE_LEAVE_DISPLAY = 24, + A5O_EVENT_MOUSE_WARPED = 25, + + A5O_EVENT_TIMER = 30, + + A5O_EVENT_DISPLAY_EXPOSE = 40, + A5O_EVENT_DISPLAY_RESIZE = 41, + A5O_EVENT_DISPLAY_CLOSE = 42, + A5O_EVENT_DISPLAY_LOST = 43, + A5O_EVENT_DISPLAY_FOUND = 44, + A5O_EVENT_DISPLAY_SWITCH_IN = 45, + A5O_EVENT_DISPLAY_SWITCH_OUT = 46, + A5O_EVENT_DISPLAY_ORIENTATION = 47, + A5O_EVENT_DISPLAY_HALT_DRAWING = 48, + A5O_EVENT_DISPLAY_RESUME_DRAWING = 49, + + A5O_EVENT_TOUCH_BEGIN = 50, + A5O_EVENT_TOUCH_END = 51, + A5O_EVENT_TOUCH_MOVE = 52, + A5O_EVENT_TOUCH_CANCEL = 53, - ALLEGRO_EVENT_DISPLAY_CONNECTED = 60, - ALLEGRO_EVENT_DISPLAY_DISCONNECTED = 61, + A5O_EVENT_DISPLAY_CONNECTED = 60, + A5O_EVENT_DISPLAY_DISCONNECTED = 61, - ALLEGRO_EVENT_DROP = 62, + A5O_EVENT_DROP = 62, }; -/* Function: ALLEGRO_EVENT_TYPE_IS_USER +/* Function: A5O_EVENT_TYPE_IS_USER * * 1 <= n < 512 - builtin events * 512 <= n < 1024 - reserved user events (for addons) * 1024 <= n - unreserved user events */ -#define ALLEGRO_EVENT_TYPE_IS_USER(t) ((t) >= 512) +#define A5O_EVENT_TYPE_IS_USER(t) ((t) >= 512) -/* Function: ALLEGRO_GET_EVENT_TYPE +/* Function: A5O_GET_EVENT_TYPE */ -#define ALLEGRO_GET_EVENT_TYPE(a, b, c, d) AL_ID(a, b, c, d) +#define A5O_GET_EVENT_TYPE(a, b, c, d) AL_ID(a, b, c, d) -/* Type: ALLEGRO_EVENT_SOURCE +/* Type: A5O_EVENT_SOURCE */ -typedef struct ALLEGRO_EVENT_SOURCE ALLEGRO_EVENT_SOURCE; +typedef struct A5O_EVENT_SOURCE A5O_EVENT_SOURCE; -struct ALLEGRO_EVENT_SOURCE +struct A5O_EVENT_SOURCE { int __pad[32]; }; @@ -95,54 +95,54 @@ struct ALLEGRO_EVENT_SOURCE */ #define _AL_EVENT_HEADER(srctype) \ - ALLEGRO_EVENT_TYPE type; \ + A5O_EVENT_TYPE type; \ srctype *source; \ double timestamp; -typedef struct ALLEGRO_ANY_EVENT +typedef struct A5O_ANY_EVENT { - _AL_EVENT_HEADER(ALLEGRO_EVENT_SOURCE) -} ALLEGRO_ANY_EVENT; + _AL_EVENT_HEADER(A5O_EVENT_SOURCE) +} A5O_ANY_EVENT; -typedef struct ALLEGRO_DISPLAY_EVENT +typedef struct A5O_DISPLAY_EVENT { - _AL_EVENT_HEADER(struct ALLEGRO_DISPLAY) + _AL_EVENT_HEADER(struct A5O_DISPLAY) int x, y; int width, height; int orientation; -} ALLEGRO_DISPLAY_EVENT; +} A5O_DISPLAY_EVENT; -typedef struct ALLEGRO_JOYSTICK_EVENT +typedef struct A5O_JOYSTICK_EVENT { - _AL_EVENT_HEADER(struct ALLEGRO_JOYSTICK) - struct ALLEGRO_JOYSTICK *id; + _AL_EVENT_HEADER(struct A5O_JOYSTICK) + struct A5O_JOYSTICK *id; int stick; int axis; float pos; int button; -} ALLEGRO_JOYSTICK_EVENT; +} A5O_JOYSTICK_EVENT; -typedef struct ALLEGRO_KEYBOARD_EVENT +typedef struct A5O_KEYBOARD_EVENT { - _AL_EVENT_HEADER(struct ALLEGRO_KEYBOARD) - struct ALLEGRO_DISPLAY *display; /* the window the key was pressed in */ + _AL_EVENT_HEADER(struct A5O_KEYBOARD) + struct A5O_DISPLAY *display; /* the window the key was pressed in */ int keycode; /* the physical key pressed */ int unichar; /* unicode character or negative */ unsigned int modifiers; /* bitfield */ bool repeat; /* auto-repeated or not */ -} ALLEGRO_KEYBOARD_EVENT; +} A5O_KEYBOARD_EVENT; -typedef struct ALLEGRO_MOUSE_EVENT +typedef struct A5O_MOUSE_EVENT { - _AL_EVENT_HEADER(struct ALLEGRO_MOUSE) - struct ALLEGRO_DISPLAY *display; + _AL_EVENT_HEADER(struct A5O_MOUSE) + struct A5O_DISPLAY *display; /* (display) Window the event originate from * (x, y) Primary mouse position * (z) Mouse wheel position (1D 'wheel'), or, @@ -153,23 +153,23 @@ typedef struct ALLEGRO_MOUSE_EVENT int dx, dy, dz, dw; unsigned int button; float pressure; -} ALLEGRO_MOUSE_EVENT; +} A5O_MOUSE_EVENT; -typedef struct ALLEGRO_TIMER_EVENT +typedef struct A5O_TIMER_EVENT { - _AL_EVENT_HEADER(struct ALLEGRO_TIMER) + _AL_EVENT_HEADER(struct A5O_TIMER) int64_t count; double error; -} ALLEGRO_TIMER_EVENT; +} A5O_TIMER_EVENT; -typedef struct ALLEGRO_TOUCH_EVENT +typedef struct A5O_TOUCH_EVENT { - _AL_EVENT_HEADER(struct ALLEGRO_TOUCH_INPUT) - struct ALLEGRO_DISPLAY *display; + _AL_EVENT_HEADER(struct A5O_TOUCH_INPUT) + struct A5O_DISPLAY *display; /* (id) Identifier of the event, always positive number. * (x, y) Touch position on the screen in 1:1 resolution. * (dx, dy) Relative touch position. @@ -179,18 +179,18 @@ typedef struct ALLEGRO_TOUCH_EVENT float x, y; float dx, dy; bool primary; -} ALLEGRO_TOUCH_EVENT; +} A5O_TOUCH_EVENT; -/* Type: ALLEGRO_USER_EVENT +/* Type: A5O_USER_EVENT */ -typedef struct ALLEGRO_USER_EVENT ALLEGRO_USER_EVENT; +typedef struct A5O_USER_EVENT A5O_USER_EVENT; -struct ALLEGRO_USER_EVENT +struct A5O_USER_EVENT { - _AL_EVENT_HEADER(struct ALLEGRO_EVENT_SOURCE) - struct ALLEGRO_USER_EVENT_DESCRIPTOR *__internal__descr; + _AL_EVENT_HEADER(struct A5O_EVENT_SOURCE) + struct A5O_USER_EVENT_DESCRIPTOR *__internal__descr; intptr_t data1; intptr_t data2; intptr_t data3; @@ -199,85 +199,85 @@ struct ALLEGRO_USER_EVENT -typedef struct ALLEGRO_DROP_EVENT +typedef struct A5O_DROP_EVENT { - _AL_EVENT_HEADER(struct ALLEGRO_DISPLAY) + _AL_EVENT_HEADER(struct A5O_DISPLAY) int x, y; int row; bool is_file; char *text; bool is_complete; -} ALLEGRO_DROP_EVENT; +} A5O_DROP_EVENT; -/* Type: ALLEGRO_EVENT +/* Type: A5O_EVENT */ -typedef union ALLEGRO_EVENT ALLEGRO_EVENT; +typedef union A5O_EVENT A5O_EVENT; -union ALLEGRO_EVENT +union A5O_EVENT { /* This must be the same as the first field of _AL_EVENT_HEADER. */ - ALLEGRO_EVENT_TYPE type; + A5O_EVENT_TYPE type; /* `any' is to allow the user to access the other fields which are * common to all event types, without using some specific type * structure. */ - ALLEGRO_ANY_EVENT any; - ALLEGRO_DISPLAY_EVENT display; - ALLEGRO_JOYSTICK_EVENT joystick; - ALLEGRO_KEYBOARD_EVENT keyboard; - ALLEGRO_MOUSE_EVENT mouse; - ALLEGRO_TIMER_EVENT timer; - ALLEGRO_TOUCH_EVENT touch; - ALLEGRO_USER_EVENT user; - ALLEGRO_DROP_EVENT drop; + A5O_ANY_EVENT any; + A5O_DISPLAY_EVENT display; + A5O_JOYSTICK_EVENT joystick; + A5O_KEYBOARD_EVENT keyboard; + A5O_MOUSE_EVENT mouse; + A5O_TIMER_EVENT timer; + A5O_TOUCH_EVENT touch; + A5O_USER_EVENT user; + A5O_DROP_EVENT drop; }; /* Event sources */ -AL_FUNC(void, al_init_user_event_source, (ALLEGRO_EVENT_SOURCE *)); -AL_FUNC(void, al_destroy_user_event_source, (ALLEGRO_EVENT_SOURCE *)); -/* The second argument is ALLEGRO_EVENT instead of ALLEGRO_USER_EVENT +AL_FUNC(void, al_init_user_event_source, (A5O_EVENT_SOURCE *)); +AL_FUNC(void, al_destroy_user_event_source, (A5O_EVENT_SOURCE *)); +/* The second argument is A5O_EVENT instead of A5O_USER_EVENT * to prevent users passing a pointer to a too-short structure. */ -AL_FUNC(bool, al_emit_user_event, (ALLEGRO_EVENT_SOURCE *, ALLEGRO_EVENT *, - void (*dtor)(ALLEGRO_USER_EVENT *))); -AL_FUNC(void, al_unref_user_event, (ALLEGRO_USER_EVENT *)); -AL_FUNC(void, al_set_event_source_data, (ALLEGRO_EVENT_SOURCE*, intptr_t data)); -AL_FUNC(intptr_t, al_get_event_source_data, (const ALLEGRO_EVENT_SOURCE*)); +AL_FUNC(bool, al_emit_user_event, (A5O_EVENT_SOURCE *, A5O_EVENT *, + void (*dtor)(A5O_USER_EVENT *))); +AL_FUNC(void, al_unref_user_event, (A5O_USER_EVENT *)); +AL_FUNC(void, al_set_event_source_data, (A5O_EVENT_SOURCE*, intptr_t data)); +AL_FUNC(intptr_t, al_get_event_source_data, (const A5O_EVENT_SOURCE*)); /* Event queues */ -/* Type: ALLEGRO_EVENT_QUEUE +/* Type: A5O_EVENT_QUEUE */ -typedef struct ALLEGRO_EVENT_QUEUE ALLEGRO_EVENT_QUEUE; - -AL_FUNC(ALLEGRO_EVENT_QUEUE*, al_create_event_queue, (void)); -AL_FUNC(void, al_destroy_event_queue, (ALLEGRO_EVENT_QUEUE*)); -AL_FUNC(bool, al_is_event_source_registered, (ALLEGRO_EVENT_QUEUE *, - ALLEGRO_EVENT_SOURCE *)); -AL_FUNC(void, al_register_event_source, (ALLEGRO_EVENT_QUEUE*, ALLEGRO_EVENT_SOURCE*)); -AL_FUNC(void, al_unregister_event_source, (ALLEGRO_EVENT_QUEUE*, ALLEGRO_EVENT_SOURCE*)); -AL_FUNC(void, al_pause_event_queue, (ALLEGRO_EVENT_QUEUE*, bool)); -AL_FUNC(bool, al_is_event_queue_paused, (const ALLEGRO_EVENT_QUEUE*)); -AL_FUNC(bool, al_is_event_queue_empty, (ALLEGRO_EVENT_QUEUE*)); -AL_FUNC(bool, al_get_next_event, (ALLEGRO_EVENT_QUEUE*, ALLEGRO_EVENT *ret_event)); -AL_FUNC(bool, al_peek_next_event, (ALLEGRO_EVENT_QUEUE*, ALLEGRO_EVENT *ret_event)); -AL_FUNC(bool, al_drop_next_event, (ALLEGRO_EVENT_QUEUE*)); -AL_FUNC(void, al_flush_event_queue, (ALLEGRO_EVENT_QUEUE*)); -AL_FUNC(void, al_wait_for_event, (ALLEGRO_EVENT_QUEUE*, - ALLEGRO_EVENT *ret_event)); -AL_FUNC(bool, al_wait_for_event_timed, (ALLEGRO_EVENT_QUEUE*, - ALLEGRO_EVENT *ret_event, +typedef struct A5O_EVENT_QUEUE A5O_EVENT_QUEUE; + +AL_FUNC(A5O_EVENT_QUEUE*, al_create_event_queue, (void)); +AL_FUNC(void, al_destroy_event_queue, (A5O_EVENT_QUEUE*)); +AL_FUNC(bool, al_is_event_source_registered, (A5O_EVENT_QUEUE *, + A5O_EVENT_SOURCE *)); +AL_FUNC(void, al_register_event_source, (A5O_EVENT_QUEUE*, A5O_EVENT_SOURCE*)); +AL_FUNC(void, al_unregister_event_source, (A5O_EVENT_QUEUE*, A5O_EVENT_SOURCE*)); +AL_FUNC(void, al_pause_event_queue, (A5O_EVENT_QUEUE*, bool)); +AL_FUNC(bool, al_is_event_queue_paused, (const A5O_EVENT_QUEUE*)); +AL_FUNC(bool, al_is_event_queue_empty, (A5O_EVENT_QUEUE*)); +AL_FUNC(bool, al_get_next_event, (A5O_EVENT_QUEUE*, A5O_EVENT *ret_event)); +AL_FUNC(bool, al_peek_next_event, (A5O_EVENT_QUEUE*, A5O_EVENT *ret_event)); +AL_FUNC(bool, al_drop_next_event, (A5O_EVENT_QUEUE*)); +AL_FUNC(void, al_flush_event_queue, (A5O_EVENT_QUEUE*)); +AL_FUNC(void, al_wait_for_event, (A5O_EVENT_QUEUE*, + A5O_EVENT *ret_event)); +AL_FUNC(bool, al_wait_for_event_timed, (A5O_EVENT_QUEUE*, + A5O_EVENT *ret_event, float secs)); -AL_FUNC(bool, al_wait_for_event_until, (ALLEGRO_EVENT_QUEUE *queue, - ALLEGRO_EVENT *ret_event, - ALLEGRO_TIMEOUT *timeout)); +AL_FUNC(bool, al_wait_for_event_until, (A5O_EVENT_QUEUE *queue, + A5O_EVENT *ret_event, + A5O_TIMEOUT *timeout)); #ifdef __cplusplus } diff --git a/include/allegro5/file.h b/include/allegro5/file.h index b1873e8ed3..c60624528d 100644 --- a/include/allegro5/file.h +++ b/include/allegro5/file.h @@ -10,92 +10,92 @@ #endif -/* Type: ALLEGRO_FILE +/* Type: A5O_FILE */ -typedef struct ALLEGRO_FILE ALLEGRO_FILE; +typedef struct A5O_FILE A5O_FILE; -/* Type: ALLEGRO_FILE_INTERFACE +/* Type: A5O_FILE_INTERFACE */ -typedef struct ALLEGRO_FILE_INTERFACE +typedef struct A5O_FILE_INTERFACE { AL_METHOD(void *, fi_fopen, (const char *path, const char *mode)); - AL_METHOD(bool, fi_fclose, (ALLEGRO_FILE *handle)); - AL_METHOD(size_t, fi_fread, (ALLEGRO_FILE *f, void *ptr, size_t size)); - AL_METHOD(size_t, fi_fwrite, (ALLEGRO_FILE *f, const void *ptr, size_t size)); - AL_METHOD(bool, fi_fflush, (ALLEGRO_FILE *f)); - AL_METHOD(int64_t, fi_ftell, (ALLEGRO_FILE *f)); - AL_METHOD(bool, fi_fseek, (ALLEGRO_FILE *f, int64_t offset, int whence)); - AL_METHOD(bool, fi_feof, (ALLEGRO_FILE *f)); - AL_METHOD(int, fi_ferror, (ALLEGRO_FILE *f)); - AL_METHOD(const char *, fi_ferrmsg, (ALLEGRO_FILE *f)); - AL_METHOD(void, fi_fclearerr, (ALLEGRO_FILE *f)); - AL_METHOD(int, fi_fungetc, (ALLEGRO_FILE *f, int c)); - AL_METHOD(off_t, fi_fsize, (ALLEGRO_FILE *f)); -} ALLEGRO_FILE_INTERFACE; - - -/* Enum: ALLEGRO_SEEK + AL_METHOD(bool, fi_fclose, (A5O_FILE *handle)); + AL_METHOD(size_t, fi_fread, (A5O_FILE *f, void *ptr, size_t size)); + AL_METHOD(size_t, fi_fwrite, (A5O_FILE *f, const void *ptr, size_t size)); + AL_METHOD(bool, fi_fflush, (A5O_FILE *f)); + AL_METHOD(int64_t, fi_ftell, (A5O_FILE *f)); + AL_METHOD(bool, fi_fseek, (A5O_FILE *f, int64_t offset, int whence)); + AL_METHOD(bool, fi_feof, (A5O_FILE *f)); + AL_METHOD(int, fi_ferror, (A5O_FILE *f)); + AL_METHOD(const char *, fi_ferrmsg, (A5O_FILE *f)); + AL_METHOD(void, fi_fclearerr, (A5O_FILE *f)); + AL_METHOD(int, fi_fungetc, (A5O_FILE *f, int c)); + AL_METHOD(off_t, fi_fsize, (A5O_FILE *f)); +} A5O_FILE_INTERFACE; + + +/* Enum: A5O_SEEK */ -typedef enum ALLEGRO_SEEK +typedef enum A5O_SEEK { - ALLEGRO_SEEK_SET = 0, - ALLEGRO_SEEK_CUR, - ALLEGRO_SEEK_END -} ALLEGRO_SEEK; + A5O_SEEK_SET = 0, + A5O_SEEK_CUR, + A5O_SEEK_END +} A5O_SEEK; /* The basic operations. */ -AL_FUNC(ALLEGRO_FILE*, al_fopen, (const char *path, const char *mode)); -AL_FUNC(ALLEGRO_FILE*, al_fopen_interface, (const ALLEGRO_FILE_INTERFACE *vt, const char *path, const char *mode)); -AL_FUNC(ALLEGRO_FILE*, al_create_file_handle, (const ALLEGRO_FILE_INTERFACE *vt, void *userdata)); -AL_FUNC(bool, al_fclose, (ALLEGRO_FILE *f)); -AL_FUNC(size_t, al_fread, (ALLEGRO_FILE *f, void *ptr, size_t size)); -AL_FUNC(size_t, al_fwrite, (ALLEGRO_FILE *f, const void *ptr, size_t size)); -AL_FUNC(bool, al_fflush, (ALLEGRO_FILE *f)); -AL_FUNC(int64_t, al_ftell, (ALLEGRO_FILE *f)); -AL_FUNC(bool, al_fseek, (ALLEGRO_FILE *f, int64_t offset, int whence)); -AL_FUNC(bool, al_feof, (ALLEGRO_FILE *f)); -AL_FUNC(int, al_ferror, (ALLEGRO_FILE *f)); -AL_FUNC(const char *, al_ferrmsg, (ALLEGRO_FILE *f)); -AL_FUNC(void, al_fclearerr, (ALLEGRO_FILE *f)); -AL_FUNC(int, al_fungetc, (ALLEGRO_FILE *f, int c)); -AL_FUNC(int64_t, al_fsize, (ALLEGRO_FILE *f)); +AL_FUNC(A5O_FILE*, al_fopen, (const char *path, const char *mode)); +AL_FUNC(A5O_FILE*, al_fopen_interface, (const A5O_FILE_INTERFACE *vt, const char *path, const char *mode)); +AL_FUNC(A5O_FILE*, al_create_file_handle, (const A5O_FILE_INTERFACE *vt, void *userdata)); +AL_FUNC(bool, al_fclose, (A5O_FILE *f)); +AL_FUNC(size_t, al_fread, (A5O_FILE *f, void *ptr, size_t size)); +AL_FUNC(size_t, al_fwrite, (A5O_FILE *f, const void *ptr, size_t size)); +AL_FUNC(bool, al_fflush, (A5O_FILE *f)); +AL_FUNC(int64_t, al_ftell, (A5O_FILE *f)); +AL_FUNC(bool, al_fseek, (A5O_FILE *f, int64_t offset, int whence)); +AL_FUNC(bool, al_feof, (A5O_FILE *f)); +AL_FUNC(int, al_ferror, (A5O_FILE *f)); +AL_FUNC(const char *, al_ferrmsg, (A5O_FILE *f)); +AL_FUNC(void, al_fclearerr, (A5O_FILE *f)); +AL_FUNC(int, al_fungetc, (A5O_FILE *f, int c)); +AL_FUNC(int64_t, al_fsize, (A5O_FILE *f)); /* Convenience functions. */ -AL_FUNC(int, al_fgetc, (ALLEGRO_FILE *f)); -AL_FUNC(int, al_fputc, (ALLEGRO_FILE *f, int c)); -AL_FUNC(int16_t, al_fread16le, (ALLEGRO_FILE *f)); -AL_FUNC(int16_t, al_fread16be, (ALLEGRO_FILE *f)); -AL_FUNC(size_t, al_fwrite16le, (ALLEGRO_FILE *f, int16_t w)); -AL_FUNC(size_t, al_fwrite16be, (ALLEGRO_FILE *f, int16_t w)); -AL_FUNC(int32_t, al_fread32le, (ALLEGRO_FILE *f)); -AL_FUNC(int32_t, al_fread32be, (ALLEGRO_FILE *f)); -AL_FUNC(size_t, al_fwrite32le, (ALLEGRO_FILE *f, int32_t l)); -AL_FUNC(size_t, al_fwrite32be, (ALLEGRO_FILE *f, int32_t l)); -AL_FUNC(char*, al_fgets, (ALLEGRO_FILE *f, char * const p, size_t max)); -AL_FUNC(ALLEGRO_USTR *, al_fget_ustr, (ALLEGRO_FILE *f)); -AL_FUNC(int, al_fputs, (ALLEGRO_FILE *f, const char *p)); -AL_FUNC(int, al_fprintf, (ALLEGRO_FILE *f, const char *format, ...)); -AL_FUNC(int, al_vfprintf, (ALLEGRO_FILE *f, const char* format, va_list args)); +AL_FUNC(int, al_fgetc, (A5O_FILE *f)); +AL_FUNC(int, al_fputc, (A5O_FILE *f, int c)); +AL_FUNC(int16_t, al_fread16le, (A5O_FILE *f)); +AL_FUNC(int16_t, al_fread16be, (A5O_FILE *f)); +AL_FUNC(size_t, al_fwrite16le, (A5O_FILE *f, int16_t w)); +AL_FUNC(size_t, al_fwrite16be, (A5O_FILE *f, int16_t w)); +AL_FUNC(int32_t, al_fread32le, (A5O_FILE *f)); +AL_FUNC(int32_t, al_fread32be, (A5O_FILE *f)); +AL_FUNC(size_t, al_fwrite32le, (A5O_FILE *f, int32_t l)); +AL_FUNC(size_t, al_fwrite32be, (A5O_FILE *f, int32_t l)); +AL_FUNC(char*, al_fgets, (A5O_FILE *f, char * const p, size_t max)); +AL_FUNC(A5O_USTR *, al_fget_ustr, (A5O_FILE *f)); +AL_FUNC(int, al_fputs, (A5O_FILE *f, const char *p)); +AL_FUNC(int, al_fprintf, (A5O_FILE *f, const char *format, ...)); +AL_FUNC(int, al_vfprintf, (A5O_FILE *f, const char* format, va_list args)); /* Specific to stdio backend. */ -AL_FUNC(ALLEGRO_FILE*, al_fopen_fd, (int fd, const char *mode)); -AL_FUNC(ALLEGRO_FILE*, al_make_temp_file, (const char *tmpl, - ALLEGRO_PATH **ret_path)); +AL_FUNC(A5O_FILE*, al_fopen_fd, (int fd, const char *mode)); +AL_FUNC(A5O_FILE*, al_make_temp_file, (const char *tmpl, + A5O_PATH **ret_path)); /* Specific to slices. */ -AL_FUNC(ALLEGRO_FILE*, al_fopen_slice, (ALLEGRO_FILE *fp, +AL_FUNC(A5O_FILE*, al_fopen_slice, (A5O_FILE *fp, size_t initial_size, const char *mode)); /* Thread-local state. */ -AL_FUNC(const ALLEGRO_FILE_INTERFACE *, al_get_new_file_interface, (void)); -AL_FUNC(void, al_set_new_file_interface, (const ALLEGRO_FILE_INTERFACE * +AL_FUNC(const A5O_FILE_INTERFACE *, al_get_new_file_interface, (void)); +AL_FUNC(void, al_set_new_file_interface, (const A5O_FILE_INTERFACE * file_interface)); AL_FUNC(void, al_set_standard_file_interface, (void)); -/* ALLEGRO_FILE field accessors */ -AL_FUNC(void *, al_get_file_userdata, (ALLEGRO_FILE *f)); +/* A5O_FILE field accessors */ +AL_FUNC(void *, al_get_file_userdata, (A5O_FILE *f)); #ifdef __cplusplus diff --git a/include/allegro5/fshook.h b/include/allegro5/fshook.h index dcd35b68d2..4f5d8da026 100644 --- a/include/allegro5/fshook.h +++ b/include/allegro5/fshook.h @@ -20,7 +20,7 @@ #include "allegro5/file.h" #include "allegro5/path.h" -#ifdef ALLEGRO_HAVE_SYS_TYPES_H +#ifdef A5O_HAVE_SYS_TYPES_H #include #else /* 4 Gig max offsets if sys/types doesn't exist. */ @@ -32,26 +32,26 @@ typedef unsigned int off_t; #endif -/* Type: ALLEGRO_FS_ENTRY +/* Type: A5O_FS_ENTRY */ -typedef struct ALLEGRO_FS_ENTRY ALLEGRO_FS_ENTRY; +typedef struct A5O_FS_ENTRY A5O_FS_ENTRY; -struct ALLEGRO_FS_ENTRY { - struct ALLEGRO_FS_INTERFACE const *vtable; +struct A5O_FS_ENTRY { + struct A5O_FS_INTERFACE const *vtable; }; -/* Enum: ALLEGRO_FILE_MODE +/* Enum: A5O_FILE_MODE */ -typedef enum ALLEGRO_FILE_MODE +typedef enum A5O_FILE_MODE { - ALLEGRO_FILEMODE_READ = 1, - ALLEGRO_FILEMODE_WRITE = 1 << 1, - ALLEGRO_FILEMODE_EXECUTE = 1 << 2, - ALLEGRO_FILEMODE_HIDDEN = 1 << 3, - ALLEGRO_FILEMODE_ISFILE = 1 << 4, - ALLEGRO_FILEMODE_ISDIR = 1 << 5 -} ALLEGRO_FILE_MODE; + A5O_FILEMODE_READ = 1, + A5O_FILEMODE_WRITE = 1 << 1, + A5O_FILEMODE_EXECUTE = 1 << 2, + A5O_FILEMODE_HIDDEN = 1 << 3, + A5O_FILEMODE_ISFILE = 1 << 4, + A5O_FILEMODE_ISDIR = 1 << 5 +} A5O_FILE_MODE; #ifndef EOF @@ -59,26 +59,26 @@ typedef enum ALLEGRO_FILE_MODE #endif -/* Type: ALLEGRO_FS_INTERFACE +/* Type: A5O_FS_INTERFACE */ -typedef struct ALLEGRO_FS_INTERFACE ALLEGRO_FS_INTERFACE; - -struct ALLEGRO_FS_INTERFACE { - AL_METHOD(ALLEGRO_FS_ENTRY *, fs_create_entry, (const char *path)); - AL_METHOD(void, fs_destroy_entry, (ALLEGRO_FS_ENTRY *e)); - AL_METHOD(const char *, fs_entry_name, (ALLEGRO_FS_ENTRY *e)); - AL_METHOD(bool, fs_update_entry, (ALLEGRO_FS_ENTRY *e)); - AL_METHOD(uint32_t, fs_entry_mode, (ALLEGRO_FS_ENTRY *e)); - AL_METHOD(time_t, fs_entry_atime, (ALLEGRO_FS_ENTRY *e)); - AL_METHOD(time_t, fs_entry_mtime, (ALLEGRO_FS_ENTRY *e)); - AL_METHOD(time_t, fs_entry_ctime, (ALLEGRO_FS_ENTRY *e)); - AL_METHOD(off_t, fs_entry_size, (ALLEGRO_FS_ENTRY *e)); - AL_METHOD(bool, fs_entry_exists, (ALLEGRO_FS_ENTRY *e)); - AL_METHOD(bool, fs_remove_entry, (ALLEGRO_FS_ENTRY *e)); - - AL_METHOD(bool, fs_open_directory, (ALLEGRO_FS_ENTRY *e)); - AL_METHOD(ALLEGRO_FS_ENTRY *, fs_read_directory,(ALLEGRO_FS_ENTRY *e)); - AL_METHOD(bool, fs_close_directory, (ALLEGRO_FS_ENTRY *e)); +typedef struct A5O_FS_INTERFACE A5O_FS_INTERFACE; + +struct A5O_FS_INTERFACE { + AL_METHOD(A5O_FS_ENTRY *, fs_create_entry, (const char *path)); + AL_METHOD(void, fs_destroy_entry, (A5O_FS_ENTRY *e)); + AL_METHOD(const char *, fs_entry_name, (A5O_FS_ENTRY *e)); + AL_METHOD(bool, fs_update_entry, (A5O_FS_ENTRY *e)); + AL_METHOD(uint32_t, fs_entry_mode, (A5O_FS_ENTRY *e)); + AL_METHOD(time_t, fs_entry_atime, (A5O_FS_ENTRY *e)); + AL_METHOD(time_t, fs_entry_mtime, (A5O_FS_ENTRY *e)); + AL_METHOD(time_t, fs_entry_ctime, (A5O_FS_ENTRY *e)); + AL_METHOD(off_t, fs_entry_size, (A5O_FS_ENTRY *e)); + AL_METHOD(bool, fs_entry_exists, (A5O_FS_ENTRY *e)); + AL_METHOD(bool, fs_remove_entry, (A5O_FS_ENTRY *e)); + + AL_METHOD(bool, fs_open_directory, (A5O_FS_ENTRY *e)); + AL_METHOD(A5O_FS_ENTRY *, fs_read_directory,(A5O_FS_ENTRY *e)); + AL_METHOD(bool, fs_close_directory, (A5O_FS_ENTRY *e)); AL_METHOD(bool, fs_filename_exists, (const char *path)); AL_METHOD(bool, fs_remove_filename, (const char *path)); @@ -86,25 +86,25 @@ struct ALLEGRO_FS_INTERFACE { AL_METHOD(bool, fs_change_directory, (const char *path)); AL_METHOD(bool, fs_make_directory, (const char *path)); - AL_METHOD(ALLEGRO_FILE *, fs_open_file, (ALLEGRO_FS_ENTRY *e, + AL_METHOD(A5O_FILE *, fs_open_file, (A5O_FS_ENTRY *e, const char *mode)); }; -AL_FUNC(ALLEGRO_FS_ENTRY *, al_create_fs_entry, (const char *path)); -AL_FUNC(void, al_destroy_fs_entry, (ALLEGRO_FS_ENTRY *e)); -AL_FUNC(const char *, al_get_fs_entry_name,(ALLEGRO_FS_ENTRY *e)); -AL_FUNC(bool, al_update_fs_entry, (ALLEGRO_FS_ENTRY *e)); -AL_FUNC(uint32_t, al_get_fs_entry_mode,(ALLEGRO_FS_ENTRY *e)); -AL_FUNC(time_t, al_get_fs_entry_atime,(ALLEGRO_FS_ENTRY *e)); -AL_FUNC(time_t, al_get_fs_entry_mtime,(ALLEGRO_FS_ENTRY *e)); -AL_FUNC(time_t, al_get_fs_entry_ctime,(ALLEGRO_FS_ENTRY *e)); -AL_FUNC(off_t, al_get_fs_entry_size,(ALLEGRO_FS_ENTRY *e)); -AL_FUNC(bool, al_fs_entry_exists, (ALLEGRO_FS_ENTRY *e)); -AL_FUNC(bool, al_remove_fs_entry, (ALLEGRO_FS_ENTRY *e)); - -AL_FUNC(bool, al_open_directory, (ALLEGRO_FS_ENTRY *e)); -AL_FUNC(ALLEGRO_FS_ENTRY *, al_read_directory, (ALLEGRO_FS_ENTRY *e)); -AL_FUNC(bool, al_close_directory, (ALLEGRO_FS_ENTRY *e)); +AL_FUNC(A5O_FS_ENTRY *, al_create_fs_entry, (const char *path)); +AL_FUNC(void, al_destroy_fs_entry, (A5O_FS_ENTRY *e)); +AL_FUNC(const char *, al_get_fs_entry_name,(A5O_FS_ENTRY *e)); +AL_FUNC(bool, al_update_fs_entry, (A5O_FS_ENTRY *e)); +AL_FUNC(uint32_t, al_get_fs_entry_mode,(A5O_FS_ENTRY *e)); +AL_FUNC(time_t, al_get_fs_entry_atime,(A5O_FS_ENTRY *e)); +AL_FUNC(time_t, al_get_fs_entry_mtime,(A5O_FS_ENTRY *e)); +AL_FUNC(time_t, al_get_fs_entry_ctime,(A5O_FS_ENTRY *e)); +AL_FUNC(off_t, al_get_fs_entry_size,(A5O_FS_ENTRY *e)); +AL_FUNC(bool, al_fs_entry_exists, (A5O_FS_ENTRY *e)); +AL_FUNC(bool, al_remove_fs_entry, (A5O_FS_ENTRY *e)); + +AL_FUNC(bool, al_open_directory, (A5O_FS_ENTRY *e)); +AL_FUNC(A5O_FS_ENTRY *, al_read_directory, (A5O_FS_ENTRY *e)); +AL_FUNC(bool, al_close_directory, (A5O_FS_ENTRY *e)); AL_FUNC(bool, al_filename_exists, (const char *path)); AL_FUNC(bool, al_remove_filename, (const char *path)); @@ -112,30 +112,30 @@ AL_FUNC(char *, al_get_current_directory, (void)); AL_FUNC(bool, al_change_directory, (const char *path)); AL_FUNC(bool, al_make_directory, (const char *path)); -AL_FUNC(ALLEGRO_FILE *, al_open_fs_entry, (ALLEGRO_FS_ENTRY *e, +AL_FUNC(A5O_FILE *, al_open_fs_entry, (A5O_FS_ENTRY *e, const char *mode)); /* Helper function for iterating over a directory using a callback. */ -/* Type: ALLEGRO_FOR_EACH_FS_ENTRY_RESULT +/* Type: A5O_FOR_EACH_FS_ENTRY_RESULT */ -typedef enum ALLEGRO_FOR_EACH_FS_ENTRY_RESULT { - ALLEGRO_FOR_EACH_FS_ENTRY_ERROR = -1, - ALLEGRO_FOR_EACH_FS_ENTRY_OK = 0, - ALLEGRO_FOR_EACH_FS_ENTRY_SKIP = 1, - ALLEGRO_FOR_EACH_FS_ENTRY_STOP = 2 -} ALLEGRO_FOR_EACH_FS_ENTRY_RESULT; - -AL_FUNC(int, al_for_each_fs_entry, (ALLEGRO_FS_ENTRY *dir, - int (*callback)(ALLEGRO_FS_ENTRY *entry, void *extra), +typedef enum A5O_FOR_EACH_FS_ENTRY_RESULT { + A5O_FOR_EACH_FS_ENTRY_ERROR = -1, + A5O_FOR_EACH_FS_ENTRY_OK = 0, + A5O_FOR_EACH_FS_ENTRY_SKIP = 1, + A5O_FOR_EACH_FS_ENTRY_STOP = 2 +} A5O_FOR_EACH_FS_ENTRY_RESULT; + +AL_FUNC(int, al_for_each_fs_entry, (A5O_FS_ENTRY *dir, + int (*callback)(A5O_FS_ENTRY *entry, void *extra), void *extra)); /* Thread-local state. */ -AL_FUNC(const ALLEGRO_FS_INTERFACE *, al_get_fs_interface, (void)); -AL_FUNC(void, al_set_fs_interface, (const ALLEGRO_FS_INTERFACE *vtable)); +AL_FUNC(const A5O_FS_INTERFACE *, al_get_fs_interface, (void)); +AL_FUNC(void, al_set_fs_interface, (const A5O_FS_INTERFACE *vtable)); AL_FUNC(void, al_set_standard_fs_interface, (void)); diff --git a/include/allegro5/fullscreen_mode.h b/include/allegro5/fullscreen_mode.h index c158ce918a..2347b84bef 100644 --- a/include/allegro5/fullscreen_mode.h +++ b/include/allegro5/fullscreen_mode.h @@ -8,20 +8,20 @@ #endif -/* Type: ALLEGRO_DISPLAY_MODE +/* Type: A5O_DISPLAY_MODE */ -typedef struct ALLEGRO_DISPLAY_MODE +typedef struct A5O_DISPLAY_MODE { int width; int height; int format; int refresh_rate; -} ALLEGRO_DISPLAY_MODE; +} A5O_DISPLAY_MODE; AL_FUNC(int, al_get_num_display_modes, (void)); -AL_FUNC(ALLEGRO_DISPLAY_MODE*, al_get_display_mode, (int index, - ALLEGRO_DISPLAY_MODE *mode)); +AL_FUNC(A5O_DISPLAY_MODE*, al_get_display_mode, (int index, + A5O_DISPLAY_MODE *mode)); #ifdef __cplusplus diff --git a/include/allegro5/haptic.h b/include/allegro5/haptic.h index 5de93967fa..2cfe2b12b4 100644 --- a/include/allegro5/haptic.h +++ b/include/allegro5/haptic.h @@ -30,54 +30,54 @@ extern "C" { #endif -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_SRC) -/* Enum: ALLEGRO_HAPTIC_CONSTANTS +/* Enum: A5O_HAPTIC_CONSTANTS */ -enum ALLEGRO_HAPTIC_CONSTANTS +enum A5O_HAPTIC_CONSTANTS { - ALLEGRO_HAPTIC_RUMBLE = 1 << 0, - ALLEGRO_HAPTIC_PERIODIC = 1 << 1, - ALLEGRO_HAPTIC_CONSTANT = 1 << 2, - ALLEGRO_HAPTIC_SPRING = 1 << 3, - ALLEGRO_HAPTIC_FRICTION = 1 << 4, - ALLEGRO_HAPTIC_DAMPER = 1 << 5, - ALLEGRO_HAPTIC_INERTIA = 1 << 6, - ALLEGRO_HAPTIC_RAMP = 1 << 7, - ALLEGRO_HAPTIC_SQUARE = 1 << 8, - ALLEGRO_HAPTIC_TRIANGLE = 1 << 9, - ALLEGRO_HAPTIC_SINE = 1 << 10, - ALLEGRO_HAPTIC_SAW_UP = 1 << 11, - ALLEGRO_HAPTIC_SAW_DOWN = 1 << 12, - ALLEGRO_HAPTIC_CUSTOM = 1 << 13, - ALLEGRO_HAPTIC_GAIN = 1 << 14, - ALLEGRO_HAPTIC_ANGLE = 1 << 15, - ALLEGRO_HAPTIC_RADIUS = 1 << 16, - ALLEGRO_HAPTIC_AZIMUTH = 1 << 17, - ALLEGRO_HAPTIC_AUTOCENTER= 1 << 18, + A5O_HAPTIC_RUMBLE = 1 << 0, + A5O_HAPTIC_PERIODIC = 1 << 1, + A5O_HAPTIC_CONSTANT = 1 << 2, + A5O_HAPTIC_SPRING = 1 << 3, + A5O_HAPTIC_FRICTION = 1 << 4, + A5O_HAPTIC_DAMPER = 1 << 5, + A5O_HAPTIC_INERTIA = 1 << 6, + A5O_HAPTIC_RAMP = 1 << 7, + A5O_HAPTIC_SQUARE = 1 << 8, + A5O_HAPTIC_TRIANGLE = 1 << 9, + A5O_HAPTIC_SINE = 1 << 10, + A5O_HAPTIC_SAW_UP = 1 << 11, + A5O_HAPTIC_SAW_DOWN = 1 << 12, + A5O_HAPTIC_CUSTOM = 1 << 13, + A5O_HAPTIC_GAIN = 1 << 14, + A5O_HAPTIC_ANGLE = 1 << 15, + A5O_HAPTIC_RADIUS = 1 << 16, + A5O_HAPTIC_AZIMUTH = 1 << 17, + A5O_HAPTIC_AUTOCENTER= 1 << 18, }; -/* Type: ALLEGRO_HAPTIC +/* Type: A5O_HAPTIC */ -typedef struct ALLEGRO_HAPTIC ALLEGRO_HAPTIC; +typedef struct A5O_HAPTIC A5O_HAPTIC; /* Direction of a haptic effect. Angle is a value between 0 and 2*M_PI. * An angle 0 means oriented towards the user, M_PI is away from the user * (towards the screen). Angle is only supported if the device capabilities - * include ALLEGRO_HAPTIC_ANGLE. + * include A5O_HAPTIC_ANGLE. * * Radius (if supported) is the distance of the effect from the user as a * value between 0 and 1. Normally it is zero. Radius is only supported if the - * device capabilities include ALLEGRO_HAPTIC_RADIUS. + * device capabilities include A5O_HAPTIC_RADIUS. * * Azimuth is the angle of elevation, between -M_PI/2 and M_PI/2. * Zero points to the horizontal plane, -M_PI/2 points down, and M_PI/2 points * up. Azimuth is only supported if the device capabilities include - * ALLEGRO_HAPTIC_AZIMUTH. + * A5O_HAPTIC_AZIMUTH. */ -struct ALLEGRO_HAPTIC_DIRECTION +struct A5O_HAPTIC_DIRECTION { double angle; double radius; @@ -90,14 +90,14 @@ struct ALLEGRO_HAPTIC_DIRECTION */ /* Delay to start the replay and duration of the replay, expressed in seconds. */ -struct ALLEGRO_HAPTIC_REPLAY +struct A5O_HAPTIC_REPLAY { double length; double delay; }; /* Envelope of the effect. */ -struct ALLEGRO_HAPTIC_ENVELOPE +struct A5O_HAPTIC_ENVELOPE { double attack_length; double attack_level; @@ -106,22 +106,22 @@ struct ALLEGRO_HAPTIC_ENVELOPE }; /* Constant effect. Level is between 0.0 and 1.0. */ -struct ALLEGRO_HAPTIC_CONSTANT_EFFECT +struct A5O_HAPTIC_CONSTANT_EFFECT { double level; - struct ALLEGRO_HAPTIC_ENVELOPE envelope; + struct A5O_HAPTIC_ENVELOPE envelope; }; /* Ramp effect. Both start_level and end level are between 0.0 and 1.0. */ -struct ALLEGRO_HAPTIC_RAMP_EFFECT +struct A5O_HAPTIC_RAMP_EFFECT { double start_level; double end_level; - struct ALLEGRO_HAPTIC_ENVELOPE envelope; + struct A5O_HAPTIC_ENVELOPE envelope; }; /* Condition effect. */ -struct ALLEGRO_HAPTIC_CONDITION_EFFECT +struct A5O_HAPTIC_CONDITION_EFFECT { double right_saturation; double left_saturation; @@ -132,7 +132,7 @@ struct ALLEGRO_HAPTIC_CONDITION_EFFECT }; /* Periodic (wave) effect. */ -struct ALLEGRO_HAPTIC_PERIODIC_EFFECT +struct A5O_HAPTIC_PERIODIC_EFFECT { int waveform; double period; @@ -140,7 +140,7 @@ struct ALLEGRO_HAPTIC_PERIODIC_EFFECT double offset; double phase; - struct ALLEGRO_HAPTIC_ENVELOPE envelope; + struct A5O_HAPTIC_ENVELOPE envelope; int custom_len; double *custom_data; }; @@ -148,43 +148,43 @@ struct ALLEGRO_HAPTIC_PERIODIC_EFFECT /* Simple rumble effect with a magnitude between 0.0 and 1.0 for both * the strong and the weak rumble motors in the haptic device. */ -struct ALLEGRO_HAPTIC_RUMBLE_EFFECT +struct A5O_HAPTIC_RUMBLE_EFFECT { double strong_magnitude; double weak_magnitude; }; -union ALLEGRO_HAPTIC_EFFECT_UNION +union A5O_HAPTIC_EFFECT_UNION { - struct ALLEGRO_HAPTIC_CONSTANT_EFFECT constant; - struct ALLEGRO_HAPTIC_RAMP_EFFECT ramp; - struct ALLEGRO_HAPTIC_PERIODIC_EFFECT periodic; - struct ALLEGRO_HAPTIC_CONDITION_EFFECT condition; - struct ALLEGRO_HAPTIC_RUMBLE_EFFECT rumble; + struct A5O_HAPTIC_CONSTANT_EFFECT constant; + struct A5O_HAPTIC_RAMP_EFFECT ramp; + struct A5O_HAPTIC_PERIODIC_EFFECT periodic; + struct A5O_HAPTIC_CONDITION_EFFECT condition; + struct A5O_HAPTIC_RUMBLE_EFFECT rumble; }; -/* Type: ALLEGRO_HAPTIC_EFFECT +/* Type: A5O_HAPTIC_EFFECT */ -struct ALLEGRO_HAPTIC_EFFECT +struct A5O_HAPTIC_EFFECT { int type; - struct ALLEGRO_HAPTIC_DIRECTION direction; - struct ALLEGRO_HAPTIC_REPLAY replay; - union ALLEGRO_HAPTIC_EFFECT_UNION data; + struct A5O_HAPTIC_DIRECTION direction; + struct A5O_HAPTIC_REPLAY replay; + union A5O_HAPTIC_EFFECT_UNION data; }; -typedef struct ALLEGRO_HAPTIC_EFFECT ALLEGRO_HAPTIC_EFFECT; +typedef struct A5O_HAPTIC_EFFECT A5O_HAPTIC_EFFECT; -/* Type: ALLEGRO_HAPTIC_EFFECT_ID +/* Type: A5O_HAPTIC_EFFECT_ID */ -typedef struct ALLEGRO_HAPTIC_EFFECT_ID ALLEGRO_HAPTIC_EFFECT_ID; +typedef struct A5O_HAPTIC_EFFECT_ID A5O_HAPTIC_EFFECT_ID; -struct ALLEGRO_HAPTIC_EFFECT_ID +struct A5O_HAPTIC_EFFECT_ID { - ALLEGRO_HAPTIC *_haptic; + A5O_HAPTIC *_haptic; int _id; int _handle; void * _pointer; @@ -200,41 +200,41 @@ AL_FUNC(bool, al_install_haptic, (void)); AL_FUNC(void, al_uninstall_haptic, (void)); AL_FUNC(bool, al_is_haptic_installed, (void)); -AL_FUNC(bool, al_is_mouse_haptic, (ALLEGRO_MOUSE *)); -AL_FUNC(bool, al_is_joystick_haptic, (ALLEGRO_JOYSTICK *)); -AL_FUNC(bool, al_is_keyboard_haptic, (ALLEGRO_KEYBOARD *)); -AL_FUNC(bool, al_is_display_haptic, (ALLEGRO_DISPLAY *)); -AL_FUNC(bool, al_is_touch_input_haptic, (ALLEGRO_TOUCH_INPUT *)); - -AL_FUNC(ALLEGRO_HAPTIC *, al_get_haptic_from_mouse, (ALLEGRO_MOUSE *)); -AL_FUNC(ALLEGRO_HAPTIC *, al_get_haptic_from_joystick, (ALLEGRO_JOYSTICK *)); -AL_FUNC(ALLEGRO_HAPTIC *, al_get_haptic_from_keyboard, (ALLEGRO_KEYBOARD *)); -AL_FUNC(ALLEGRO_HAPTIC *, al_get_haptic_from_display, (ALLEGRO_DISPLAY *)); -AL_FUNC(ALLEGRO_HAPTIC *, al_get_haptic_from_touch_input, (ALLEGRO_TOUCH_INPUT *)); - -AL_FUNC(bool, al_release_haptic, (ALLEGRO_HAPTIC *)); - -AL_FUNC(bool, al_is_haptic_active, (ALLEGRO_HAPTIC *)); -AL_FUNC(int, al_get_haptic_capabilities, (ALLEGRO_HAPTIC *)); -AL_FUNC(bool, al_is_haptic_capable, (ALLEGRO_HAPTIC *, int)); - -AL_FUNC(bool, al_set_haptic_gain, (ALLEGRO_HAPTIC *, double)); -AL_FUNC(double, al_get_haptic_gain, (ALLEGRO_HAPTIC *)); - -AL_FUNC(bool, al_set_haptic_autocenter, (ALLEGRO_HAPTIC *, double)); -AL_FUNC(double, al_get_haptic_autocenter, (ALLEGRO_HAPTIC *)); - - -AL_FUNC(int, al_get_max_haptic_effects, (ALLEGRO_HAPTIC *)); -AL_FUNC(bool, al_is_haptic_effect_ok, (ALLEGRO_HAPTIC *, ALLEGRO_HAPTIC_EFFECT *)); -AL_FUNC(bool, al_upload_haptic_effect, (ALLEGRO_HAPTIC *, ALLEGRO_HAPTIC_EFFECT *, ALLEGRO_HAPTIC_EFFECT_ID *)); -AL_FUNC(bool, al_play_haptic_effect, (ALLEGRO_HAPTIC_EFFECT_ID *, int)); -AL_FUNC(bool, al_upload_and_play_haptic_effect, (ALLEGRO_HAPTIC *, ALLEGRO_HAPTIC_EFFECT *, ALLEGRO_HAPTIC_EFFECT_ID *, int)); -AL_FUNC(bool, al_stop_haptic_effect, (ALLEGRO_HAPTIC_EFFECT_ID *)); -AL_FUNC(bool, al_is_haptic_effect_playing, (ALLEGRO_HAPTIC_EFFECT_ID *)); -AL_FUNC(bool, al_release_haptic_effect, (ALLEGRO_HAPTIC_EFFECT_ID *)); -AL_FUNC(double, al_get_haptic_effect_duration, (ALLEGRO_HAPTIC_EFFECT *)); -AL_FUNC(bool, al_rumble_haptic, (ALLEGRO_HAPTIC *, double, double, ALLEGRO_HAPTIC_EFFECT_ID *)); +AL_FUNC(bool, al_is_mouse_haptic, (A5O_MOUSE *)); +AL_FUNC(bool, al_is_joystick_haptic, (A5O_JOYSTICK *)); +AL_FUNC(bool, al_is_keyboard_haptic, (A5O_KEYBOARD *)); +AL_FUNC(bool, al_is_display_haptic, (A5O_DISPLAY *)); +AL_FUNC(bool, al_is_touch_input_haptic, (A5O_TOUCH_INPUT *)); + +AL_FUNC(A5O_HAPTIC *, al_get_haptic_from_mouse, (A5O_MOUSE *)); +AL_FUNC(A5O_HAPTIC *, al_get_haptic_from_joystick, (A5O_JOYSTICK *)); +AL_FUNC(A5O_HAPTIC *, al_get_haptic_from_keyboard, (A5O_KEYBOARD *)); +AL_FUNC(A5O_HAPTIC *, al_get_haptic_from_display, (A5O_DISPLAY *)); +AL_FUNC(A5O_HAPTIC *, al_get_haptic_from_touch_input, (A5O_TOUCH_INPUT *)); + +AL_FUNC(bool, al_release_haptic, (A5O_HAPTIC *)); + +AL_FUNC(bool, al_is_haptic_active, (A5O_HAPTIC *)); +AL_FUNC(int, al_get_haptic_capabilities, (A5O_HAPTIC *)); +AL_FUNC(bool, al_is_haptic_capable, (A5O_HAPTIC *, int)); + +AL_FUNC(bool, al_set_haptic_gain, (A5O_HAPTIC *, double)); +AL_FUNC(double, al_get_haptic_gain, (A5O_HAPTIC *)); + +AL_FUNC(bool, al_set_haptic_autocenter, (A5O_HAPTIC *, double)); +AL_FUNC(double, al_get_haptic_autocenter, (A5O_HAPTIC *)); + + +AL_FUNC(int, al_get_max_haptic_effects, (A5O_HAPTIC *)); +AL_FUNC(bool, al_is_haptic_effect_ok, (A5O_HAPTIC *, A5O_HAPTIC_EFFECT *)); +AL_FUNC(bool, al_upload_haptic_effect, (A5O_HAPTIC *, A5O_HAPTIC_EFFECT *, A5O_HAPTIC_EFFECT_ID *)); +AL_FUNC(bool, al_play_haptic_effect, (A5O_HAPTIC_EFFECT_ID *, int)); +AL_FUNC(bool, al_upload_and_play_haptic_effect, (A5O_HAPTIC *, A5O_HAPTIC_EFFECT *, A5O_HAPTIC_EFFECT_ID *, int)); +AL_FUNC(bool, al_stop_haptic_effect, (A5O_HAPTIC_EFFECT_ID *)); +AL_FUNC(bool, al_is_haptic_effect_playing, (A5O_HAPTIC_EFFECT_ID *)); +AL_FUNC(bool, al_release_haptic_effect, (A5O_HAPTIC_EFFECT_ID *)); +AL_FUNC(double, al_get_haptic_effect_duration, (A5O_HAPTIC_EFFECT *)); +AL_FUNC(bool, al_rumble_haptic, (A5O_HAPTIC *, double, double, A5O_HAPTIC_EFFECT_ID *)); #endif diff --git a/include/allegro5/inline/fmaths.inl b/include/allegro5/inline/fmaths.inl index 47b447e3f8..8d05fce42c 100644 --- a/include/allegro5/inline/fmaths.inl +++ b/include/allegro5/inline/fmaths.inl @@ -110,7 +110,7 @@ AL_INLINE(al_fixed, al_fixsub, (al_fixed x, al_fixed y), * * PS. Don't move the #ifs inside the AL_INLINE; BCC doesn't like it. */ -#if defined ALLEGRO_I386 +#if defined A5O_I386 AL_INLINE(al_fixed, al_fixmul, (al_fixed x, al_fixed y), { return al_ftofix(al_fixtof(x) * al_fixtof(y)); @@ -137,7 +137,7 @@ AL_INLINE(al_fixed, al_fixsub, (al_fixed x, al_fixed y), #endif /* al_fixmul() C implementations */ -#if defined ALLEGRO_CFG_NO_FPU +#if defined A5O_CFG_NO_FPU AL_INLINE(al_fixed, al_fixdiv, (al_fixed x, al_fixed y), { int64_t lres = x; diff --git a/include/allegro5/internal/aintern.h b/include/allegro5/internal/aintern.h index 4e4cb6d4b3..a88110d0f3 100644 --- a/include/allegro5/internal/aintern.h +++ b/include/allegro5/internal/aintern.h @@ -27,14 +27,14 @@ extern "C" { #endif -#define _ALLEGRO_MIN(x,y) (((x) < (y)) ? (x) : (y)) -#define _ALLEGRO_MAX(x,y) (((x) > (y)) ? (x) : (y)) -#define _ALLEGRO_CLAMP(x,y,z) _ALLEGRO_MAX((x), _ALLEGRO_MIN((y), (z))) +#define _A5O_MIN(x,y) (((x) < (y)) ? (x) : (y)) +#define _A5O_MAX(x,y) (((x) > (y)) ? (x) : (y)) +#define _A5O_CLAMP(x,y,z) _A5O_MAX((x), _A5O_MIN((y), (z))) int _al_get_least_multiple(int val, int mul); /* message stuff */ -#define ALLEGRO_MESSAGE_SIZE 4096 +#define A5O_MESSAGE_SIZE 4096 /* various libc stuff */ AL_FUNC(void *, _al_sane_realloc, (void *ptr, size_t size)); diff --git a/include/allegro5/internal/aintern_android.h b/include/allegro5/internal/aintern_android.h index 7c2974469e..21273b9b2c 100644 --- a/include/allegro5/internal/aintern_android.h +++ b/include/allegro5/internal/aintern_android.h @@ -1,5 +1,5 @@ -#ifndef ALLEGRO_AINTERN_ANDROID_H -#define ALLEGRO_AINTERN_ANDROID_H +#ifndef A5O_AINTERN_ANDROID_H +#define A5O_AINTERN_ANDROID_H #include "allegro5/allegro.h" #include "allegro5/internal/aintern_system.h" @@ -8,16 +8,16 @@ #include -typedef struct ALLEGRO_SYSTEM_ANDROID { - ALLEGRO_SYSTEM system; -} ALLEGRO_SYSTEM_ANDROID; +typedef struct A5O_SYSTEM_ANDROID { + A5O_SYSTEM system; +} A5O_SYSTEM_ANDROID; -typedef struct ALLEGRO_DISPLAY_ANDROID { - ALLEGRO_DISPLAY display; +typedef struct A5O_DISPLAY_ANDROID { + A5O_DISPLAY display; jobject surface_object; - ALLEGRO_COND *cond; - ALLEGRO_MUTEX *mutex; + A5O_COND *cond; + A5O_MUTEX *mutex; bool created; bool recreate; @@ -28,15 +28,15 @@ typedef struct ALLEGRO_DISPLAY_ANDROID { bool resumed; bool failed; bool is_destroy_display; -} ALLEGRO_DISPLAY_ANDROID; +} A5O_DISPLAY_ANDROID; -ALLEGRO_SYSTEM_INTERFACE *_al_system_android_interface(void); -const ALLEGRO_FILE_INTERFACE *_al_get_apk_file_vtable(void); +A5O_SYSTEM_INTERFACE *_al_system_android_interface(void); +const A5O_FILE_INTERFACE *_al_get_apk_file_vtable(void); -ALLEGRO_DISPLAY_INTERFACE *_al_get_android_display_driver(void); -ALLEGRO_KEYBOARD_DRIVER *_al_get_android_keyboard_driver(void); -ALLEGRO_MOUSE_DRIVER *_al_get_android_mouse_driver(void); -ALLEGRO_TOUCH_INPUT_DRIVER *_al_get_android_touch_input_driver(void); +A5O_DISPLAY_INTERFACE *_al_get_android_display_driver(void); +A5O_KEYBOARD_DRIVER *_al_get_android_keyboard_driver(void); +A5O_MOUSE_DRIVER *_al_get_android_mouse_driver(void); +A5O_TOUCH_INPUT_DRIVER *_al_get_android_touch_input_driver(void); int _al_android_get_display_orientation(void); @@ -65,7 +65,7 @@ void __jni_checkException(JNIEnv *env, const char *file, const char *fname, int name, sig); \ bool ret = false; \ if (method_id == NULL) { \ - ALLEGRO_DEBUG("couldn't find method %s", name); \ + A5O_DEBUG("couldn't find method %s", name); \ } \ else { \ ret = _jni_call(env, bool, CallBooleanMethod, obj, method_id, \ @@ -79,8 +79,8 @@ jobject _jni_callObjectMethod(JNIEnv *env, jobject object, const char *name, const char *sig); jobject _jni_callObjectMethodV(JNIEnv *env, jobject object, const char *name, const char *sig, ...); -ALLEGRO_USTR *_jni_getString(JNIEnv *env, jstring str_obj); -ALLEGRO_USTR *_jni_callStringMethod(JNIEnv *env, jobject obj, +A5O_USTR *_jni_getString(JNIEnv *env, jstring str_obj); +A5O_USTR *_jni_callStringMethod(JNIEnv *env, jobject obj, const char *name, const char *sig); jobject _jni_callStaticObjectMethodV(JNIEnv *env, jclass class_id, const char *name, const char *sig, ...); @@ -94,7 +94,7 @@ jint _jni_callStaticIntMethodV(JNIEnv *env, jclass cls, name, sig); \ int ret = -1; \ if (method_id == NULL) { \ - ALLEGRO_DEBUG("couldn't find method %s", #name); \ + A5O_DEBUG("couldn't find method %s", #name); \ } \ else { \ ret = _jni_call(env, int, CallIntMethod, obj, method_id, ##args); \ @@ -113,7 +113,7 @@ jint _jni_callStaticIntMethodV(JNIEnv *env, jclass cls, name, sig); \ long ret = -1; \ if (method_id == NULL) { \ - ALLEGRO_DEBUG("couldn't find method %s", name); \ + A5O_DEBUG("couldn't find method %s", name); \ } \ else { \ ret = _jni_call(env, long, CallLongMethod, obj, method_id, ##args); \ @@ -131,7 +131,7 @@ jint _jni_callStaticIntMethodV(JNIEnv *env, jclass cls, jmethodID method_id = _jni_call(env, jmethodID, GetMethodID, class_id, \ name, sig); \ if (method_id == NULL) { \ - ALLEGRO_ERROR("couldn't find method %s", name); \ + A5O_ERROR("couldn't find method %s", name); \ } else { \ _jni_callv(env, CallVoidMethod, obj, method_id, ##args); \ } \ @@ -141,13 +141,13 @@ jint _jni_callStaticIntMethodV(JNIEnv *env, jclass cls, #define _jni_callVoidMethod(env, obj, name) \ _jni_callVoidMethodV(env, obj, name, "()V"); -AL_VAR(struct ALLEGRO_JOYSTICK_DRIVER, _al_android_joystick_driver); +AL_VAR(struct A5O_JOYSTICK_DRIVER, _al_android_joystick_driver); void _al_android_create_surface(JNIEnv *env, bool post); void _al_android_destroy_surface(JNIEnv *env, jobject obj, bool post); -ALLEGRO_BITMAP *_al_android_load_image_f(ALLEGRO_FILE *fh, int flags); -ALLEGRO_BITMAP *_al_android_load_image(const char *filename, int flags); +A5O_BITMAP *_al_android_load_image_f(A5O_FILE *fh, int flags); +A5O_BITMAP *_al_android_load_image(const char *filename, int flags); jobject _al_android_activity_object(void); jclass _al_android_input_stream_class(void); @@ -157,8 +157,8 @@ jclass _al_android_clipboard_class(void); jclass _al_android_apk_fs_class(void); void _al_android_generate_mouse_event(unsigned int type, int x, int y, - unsigned int button, ALLEGRO_DISPLAY *d); -void _al_android_mouse_get_state(ALLEGRO_MOUSE_STATE *ret_state); + unsigned int button, A5O_DISPLAY *d); +void _al_android_mouse_get_state(A5O_MOUSE_STATE *ret_state); void _al_android_generate_accelerometer_event(float x, float y, float z); void _al_android_generate_joystick_axis_event(int index, int stick, int axis, float value); @@ -174,17 +174,17 @@ void _al_android_set_jnienv(JNIEnv *jnienv); JNIEnv *_al_android_get_jnienv(void); bool _al_android_is_paused(void); -void _al_android_add_clipboard_functions(ALLEGRO_DISPLAY_INTERFACE *vt); +void _al_android_add_clipboard_functions(A5O_DISPLAY_INTERFACE *vt); -#define ALLEGRO_ANDROID_PACKAGE_NAME org_liballeg_android -#define ALLEGRO_ANDROID_PACKAGE_NAME_SLASH "org/liballeg/android" +#define A5O_ANDROID_PACKAGE_NAME org_liballeg_android +#define A5O_ANDROID_PACKAGE_NAME_SLASH "org/liballeg/android" #define JNI_FUNC_PASTER(ret, cls, name, params, x) \ JNIEXPORT ret JNICALL Java_ ## x ## _ ## cls ## _ ## name params #define JNI_FUNC_EVALUATOR(ret, cls, name, params, x) \ JNI_FUNC_PASTER(ret, cls, name, params, x) #define JNI_FUNC(ret, cls, name, params) \ - JNI_FUNC_EVALUATOR(ret, cls, name, params, ALLEGRO_ANDROID_PACKAGE_NAME) + JNI_FUNC_EVALUATOR(ret, cls, name, params, A5O_ANDROID_PACKAGE_NAME) /* Functions called from Java code. */ extern JNI_FUNC(bool, AllegroActivity, nativeOnCreate, (JNIEnv *env, jobject obj)); @@ -221,6 +221,6 @@ extern JNI_FUNC(void, KeyListener, nativeOnJoystickButton, (JNIEnv *env, jobject extern JNI_FUNC(void, AllegroActivity, nativeSendJoystickConfigurationEvent, (JNIEnv *env, jobject obj)); -#endif /* ALLEGRO_AINTERN_ANDROID_H */ +#endif /* A5O_AINTERN_ANDROID_H */ /* vim: set sts=3 sw=3 et: */ diff --git a/include/allegro5/internal/aintern_atomicops.h b/include/allegro5/internal/aintern_atomicops.h index 50545521d2..4a4826a930 100644 --- a/include/allegro5/internal/aintern_atomicops.h +++ b/include/allegro5/internal/aintern_atomicops.h @@ -68,7 +68,7 @@ return InterlockedDecrement(ptr); }) -#elif defined(ALLEGRO_HAVE_OSATOMIC_H) +#elif defined(A5O_HAVE_OSATOMIC_H) /* OS X, GCC < 4.1 * These functions only work on Tiger (10.4) and above. diff --git a/include/allegro5/internal/aintern_bitmap.h b/include/allegro5/internal/aintern_bitmap.h index 443eaf569c..0d49947d7c 100644 --- a/include/allegro5/internal/aintern_bitmap.h +++ b/include/allegro5/internal/aintern_bitmap.h @@ -13,11 +13,11 @@ extern "C" { #endif -typedef struct ALLEGRO_BITMAP_INTERFACE ALLEGRO_BITMAP_INTERFACE; +typedef struct A5O_BITMAP_INTERFACE A5O_BITMAP_INTERFACE; -struct ALLEGRO_BITMAP +struct A5O_BITMAP { - ALLEGRO_BITMAP_INTERFACE *vt; + A5O_BITMAP_INTERFACE *vt; /* * When this is a sub-bitmap, these are inherited from the parent. Don't @@ -29,9 +29,9 @@ struct ALLEGRO_BITMAP int _flags; int _depth; int _samples; - ALLEGRO_DISPLAY *_display; - ALLEGRO_BITMAP_WRAP _wrap_u; - ALLEGRO_BITMAP_WRAP _wrap_v; + A5O_DISPLAY *_display; + A5O_BITMAP_WRAP _wrap_u; + A5O_BITMAP_WRAP _wrap_v; /* What format is used for the backing memory * (can be different from _format, for e.g. compressed bitmaps) */ int _memory_format; @@ -77,25 +77,25 @@ struct ALLEGRO_BITMAP int lock_h; void* lock_data; int lock_flags; - ALLEGRO_LOCKED_REGION locked_region; + A5O_LOCKED_REGION locked_region; /* Transformation for this bitmap */ - ALLEGRO_TRANSFORM transform; - ALLEGRO_TRANSFORM inverse_transform; + A5O_TRANSFORM transform; + A5O_TRANSFORM inverse_transform; bool inverse_transform_dirty; - ALLEGRO_TRANSFORM proj_transform; + A5O_TRANSFORM proj_transform; /* Blender for this bitmap (if not set, use TLS) */ bool use_bitmap_blender; - ALLEGRO_BLENDER blender; + A5O_BLENDER blender; /* Shader applied to this bitmap. Set this field with * _al_set_bitmap_shader_field to maintain invariants. */ - ALLEGRO_SHADER *shader; + A5O_SHADER *shader; /* Info for sub-bitmaps */ - ALLEGRO_BITMAP *parent; + A5O_BITMAP *parent; int xofs; int yofs; @@ -111,50 +111,50 @@ struct ALLEGRO_BITMAP bool dirty; }; -struct ALLEGRO_BITMAP_INTERFACE +struct A5O_BITMAP_INTERFACE { int id; - void (*draw_bitmap_region)(ALLEGRO_BITMAP *bitmap, - ALLEGRO_COLOR tint,float sx, float sy, + void (*draw_bitmap_region)(A5O_BITMAP *bitmap, + A5O_COLOR tint,float sx, float sy, float sw, float sh, int flags); /* After the memory-copy of the bitmap has been modified, need to call this * to update the display-specific copy. E.g. with an OpenGL driver, this * might create/update a texture. Returns false on failure. */ - bool (*upload_bitmap)(ALLEGRO_BITMAP *bitmap); + bool (*upload_bitmap)(A5O_BITMAP *bitmap); - void (*update_clipping_rectangle)(ALLEGRO_BITMAP *bitmap); + void (*update_clipping_rectangle)(A5O_BITMAP *bitmap); - void (*destroy_bitmap)(ALLEGRO_BITMAP *bitmap); + void (*destroy_bitmap)(A5O_BITMAP *bitmap); - ALLEGRO_LOCKED_REGION * (*lock_region)(ALLEGRO_BITMAP *bitmap, + A5O_LOCKED_REGION * (*lock_region)(A5O_BITMAP *bitmap, int x, int y, int w, int h, int format, int flags); - void (*unlock_region)(ALLEGRO_BITMAP *bitmap); + void (*unlock_region)(A5O_BITMAP *bitmap); - ALLEGRO_LOCKED_REGION * (*lock_compressed_region)(ALLEGRO_BITMAP *bitmap, + A5O_LOCKED_REGION * (*lock_compressed_region)(A5O_BITMAP *bitmap, int x, int y, int w, int h, int flags); - void (*unlock_compressed_region)(ALLEGRO_BITMAP *bitmap); + void (*unlock_compressed_region)(A5O_BITMAP *bitmap); /* Used to update any dangling pointers the bitmap driver might keep. */ - void (*bitmap_pointer_changed)(ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP *old); + void (*bitmap_pointer_changed)(A5O_BITMAP *bitmap, A5O_BITMAP *old); /* Back up texture to system RAM */ - void (*backup_dirty_bitmap)(ALLEGRO_BITMAP *bitmap); + void (*backup_dirty_bitmap)(A5O_BITMAP *bitmap); }; -ALLEGRO_BITMAP *_al_create_bitmap_params(ALLEGRO_DISPLAY *current_display, +A5O_BITMAP *_al_create_bitmap_params(A5O_DISPLAY *current_display, int w, int h, int format, int flags, int depth, int samples); -AL_FUNC(ALLEGRO_DISPLAY*, _al_get_bitmap_display, (ALLEGRO_BITMAP *bitmap)); -AL_FUNC(void, _al_get_bitmap_wrap, (ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_WRAP *wrap_u, ALLEGRO_BITMAP_WRAP *wrap_v)); +AL_FUNC(A5O_DISPLAY*, _al_get_bitmap_display, (A5O_BITMAP *bitmap)); +AL_FUNC(void, _al_get_bitmap_wrap, (A5O_BITMAP *bitmap, + A5O_BITMAP_WRAP *wrap_u, A5O_BITMAP_WRAP *wrap_v)); -extern void (*_al_convert_funcs[ALLEGRO_NUM_PIXEL_FORMATS] - [ALLEGRO_NUM_PIXEL_FORMATS])(const void *, int, void *, int, +extern void (*_al_convert_funcs[A5O_NUM_PIXEL_FORMATS] + [A5O_NUM_PIXEL_FORMATS])(const void *, int, void *, int, int, int, int, int, int, int); /* Bitmap conversion */ @@ -171,19 +171,19 @@ void _al_copy_bitmap_data( /* Bitmap type conversion */ void _al_init_convert_bitmap_list(void); -void _al_register_convert_bitmap(ALLEGRO_BITMAP *bitmap); -void _al_unregister_convert_bitmap(ALLEGRO_BITMAP *bitmap); -void _al_convert_to_display_bitmap(ALLEGRO_BITMAP *bitmap); -void _al_convert_to_memory_bitmap(ALLEGRO_BITMAP *bitmap); +void _al_register_convert_bitmap(A5O_BITMAP *bitmap); +void _al_unregister_convert_bitmap(A5O_BITMAP *bitmap); +void _al_convert_to_display_bitmap(A5O_BITMAP *bitmap); +void _al_convert_to_memory_bitmap(A5O_BITMAP *bitmap); /* Simple bitmap drawing */ -void _al_put_pixel(ALLEGRO_BITMAP *bitmap, int x, int y, ALLEGRO_COLOR color); +void _al_put_pixel(A5O_BITMAP *bitmap, int x, int y, A5O_COLOR color); /* Bitmap I/O */ void _al_init_iio_table(void); -int _al_get_bitmap_memory_format(ALLEGRO_BITMAP *bitmap); +int _al_get_bitmap_memory_format(A5O_BITMAP *bitmap); #ifdef __cplusplus } diff --git a/include/allegro5/internal/aintern_blend.h b/include/allegro5/internal/aintern_blend.h index f69d815d97..dcf708d2de 100644 --- a/include/allegro5/internal/aintern_blend.h +++ b/include/allegro5/internal/aintern_blend.h @@ -16,11 +16,11 @@ #define _AL_DEST_IS_ZERO \ - (dst_mode == ALLEGRO_ZERO && dst_alpha == ALLEGRO_ZERO && \ - op != ALLEGRO_DEST_MINUS_SRC && op_alpha != ALLEGRO_DEST_MINUS_SRC) + (dst_mode == A5O_ZERO && dst_alpha == A5O_ZERO && \ + op != A5O_DEST_MINUS_SRC && op_alpha != A5O_DEST_MINUS_SRC) #define _AL_SRC_NOT_MODIFIED \ - (src_mode == ALLEGRO_ONE && src_alpha == ALLEGRO_ONE) + (src_mode == A5O_ONE && src_alpha == A5O_ONE) #define _AL_SRC_NOT_MODIFIED_TINT_WHITE \ (_AL_SRC_NOT_MODIFIED && \ @@ -31,65 +31,65 @@ /* Only cares about alpha blending modes. */ static _AL_ALWAYS_INLINE float -get_alpha_factor(enum ALLEGRO_BLEND_MODE operation, float src_alpha, float dst_alpha, ALLEGRO_COLOR* const_alpha) +get_alpha_factor(enum A5O_BLEND_MODE operation, float src_alpha, float dst_alpha, A5O_COLOR* const_alpha) { switch (operation) { - case ALLEGRO_ZERO: return 0; - case ALLEGRO_ONE: return 1; - case ALLEGRO_ALPHA: return src_alpha; - case ALLEGRO_INVERSE_ALPHA: return 1 - src_alpha; - case ALLEGRO_SRC_COLOR: return src_alpha; - case ALLEGRO_DEST_COLOR: return dst_alpha; - case ALLEGRO_INVERSE_SRC_COLOR: return 1 - src_alpha; - case ALLEGRO_INVERSE_DEST_COLOR: return 1 - dst_alpha; - case ALLEGRO_CONST_COLOR: return const_alpha->a; - case ALLEGRO_INVERSE_CONST_COLOR: return 1 - const_alpha->a; + case A5O_ZERO: return 0; + case A5O_ONE: return 1; + case A5O_ALPHA: return src_alpha; + case A5O_INVERSE_ALPHA: return 1 - src_alpha; + case A5O_SRC_COLOR: return src_alpha; + case A5O_DEST_COLOR: return dst_alpha; + case A5O_INVERSE_SRC_COLOR: return 1 - src_alpha; + case A5O_INVERSE_DEST_COLOR: return 1 - dst_alpha; + case A5O_CONST_COLOR: return const_alpha->a; + case A5O_INVERSE_CONST_COLOR: return 1 - const_alpha->a; default: ASSERT(false); return 0; /* silence warning in release build */ } } -/* Puts the blending factor in an ALLEGRO_COLOR object. */ -static _AL_ALWAYS_INLINE void get_factor(enum ALLEGRO_BLEND_MODE operation, - const ALLEGRO_COLOR *source, const ALLEGRO_COLOR *dest, ALLEGRO_COLOR *constcol, - ALLEGRO_COLOR *factor) +/* Puts the blending factor in an A5O_COLOR object. */ +static _AL_ALWAYS_INLINE void get_factor(enum A5O_BLEND_MODE operation, + const A5O_COLOR *source, const A5O_COLOR *dest, A5O_COLOR *constcol, + A5O_COLOR *factor) { switch (operation) { - case ALLEGRO_ZERO: + case A5O_ZERO: factor->r = factor->g = factor->b = factor->a = 0; break; - case ALLEGRO_ONE: + case A5O_ONE: factor->r = factor->g = factor->b = factor->a = 1; break; - case ALLEGRO_ALPHA: + case A5O_ALPHA: factor->r = factor->g = factor->b = factor->a = source->a; break; - case ALLEGRO_INVERSE_ALPHA: + case A5O_INVERSE_ALPHA: factor->r = factor->g = factor->b = factor->a = 1 - source->a; break; - case ALLEGRO_SRC_COLOR: + case A5O_SRC_COLOR: *factor = *source; break; - case ALLEGRO_DEST_COLOR: + case A5O_DEST_COLOR: *factor = *dest; break; - case ALLEGRO_INVERSE_SRC_COLOR: + case A5O_INVERSE_SRC_COLOR: factor->r = 1 - source->r; factor->g = 1 - source->g; factor->b = 1 - source->b; factor->a = 1 - source->a; break; - case ALLEGRO_INVERSE_DEST_COLOR: + case A5O_INVERSE_DEST_COLOR: factor->r = 1 - dest->r; factor->g = 1 - dest->g; factor->b = 1 - dest->b; factor->a = 1 - dest->a; break; - case ALLEGRO_CONST_COLOR: + case A5O_CONST_COLOR: *factor = *constcol; break; - case ALLEGRO_INVERSE_CONST_COLOR: + case A5O_INVERSE_CONST_COLOR: factor->r = 1 - constcol->r; factor->g = 1 - constcol->g; factor->b = 1 - constcol->b; @@ -103,13 +103,13 @@ static _AL_ALWAYS_INLINE void get_factor(enum ALLEGRO_BLEND_MODE operation, } /* Only call this if the blend modes are one of: - * ALLEGRO_ONE, ALLEGRO_ZERO, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA + * A5O_ONE, A5O_ZERO, A5O_ALPHA, A5O_INVERSE_ALPHA */ static _AL_ALWAYS_INLINE void _al_blend_alpha_inline( - const ALLEGRO_COLOR *scol, const ALLEGRO_COLOR *dcol, + const A5O_COLOR *scol, const A5O_COLOR *dcol, int op, int src_, int dst_, int aop, int asrc_, int adst_, - ALLEGRO_COLOR *constcol, ALLEGRO_COLOR *result) + A5O_COLOR *constcol, A5O_COLOR *result) { float asrc, adst; float src, dst; @@ -127,22 +127,22 @@ void _al_blend_alpha_inline( #define BLEND(c, src, dst) \ result->c = OP(result->c * src, dcol->c * dst); switch (op) { - case ALLEGRO_ADD: - #define OP(x, y) _ALLEGRO_MIN(1, x + y) + case A5O_ADD: + #define OP(x, y) _A5O_MIN(1, x + y) BLEND(r, src, dst) BLEND(g, src, dst) BLEND(b, src, dst) #undef OP break; - case ALLEGRO_SRC_MINUS_DEST: - #define OP(x, y) _ALLEGRO_MAX(0, x - y) + case A5O_SRC_MINUS_DEST: + #define OP(x, y) _A5O_MAX(0, x - y) BLEND(r, src, dst) BLEND(g, src, dst) BLEND(b, src, dst) #undef OP break; - case ALLEGRO_DEST_MINUS_SRC: - #define OP(x, y) _ALLEGRO_MAX(0, y - x) + case A5O_DEST_MINUS_SRC: + #define OP(x, y) _A5O_MAX(0, y - x) BLEND(r, src, dst) BLEND(g, src, dst) BLEND(b, src, dst) @@ -151,18 +151,18 @@ void _al_blend_alpha_inline( } switch (aop) { - case ALLEGRO_ADD: - #define OP(x, y) _ALLEGRO_MIN(1, x + y) + case A5O_ADD: + #define OP(x, y) _A5O_MIN(1, x + y) BLEND(a, asrc, adst) #undef OP break; - case ALLEGRO_SRC_MINUS_DEST: - #define OP(x, y) _ALLEGRO_MAX(0, x - y) + case A5O_SRC_MINUS_DEST: + #define OP(x, y) _A5O_MAX(0, x - y) BLEND(a, asrc, adst) #undef OP break; - case ALLEGRO_DEST_MINUS_SRC: - #define OP(x, y) _ALLEGRO_MAX(0, y - x) + case A5O_DEST_MINUS_SRC: + #define OP(x, y) _A5O_MAX(0, y - x) BLEND(a, asrc, adst) #undef OP break; @@ -173,12 +173,12 @@ void _al_blend_alpha_inline( /* call this for general blending. its a little slower than just using alpha */ static _AL_ALWAYS_INLINE void _al_blend_inline( - const ALLEGRO_COLOR *scol, const ALLEGRO_COLOR *dcol, + const A5O_COLOR *scol, const A5O_COLOR *dcol, int op, int src_, int dst_, int aop, int asrc_, int adst_, - ALLEGRO_COLOR *constcol, ALLEGRO_COLOR *result) + A5O_COLOR *constcol, A5O_COLOR *result) { float asrc, adst; - ALLEGRO_COLOR src, dst; + A5O_COLOR src, dst; result->r = scol->r; result->g = scol->g; @@ -193,22 +193,22 @@ void _al_blend_inline( #define BLEND(c, src, dst) \ result->c = OP(result->c * src.c, dcol->c * dst.c); switch (op) { - case ALLEGRO_ADD: - #define OP(x, y) _ALLEGRO_MIN(1, x + y) + case A5O_ADD: + #define OP(x, y) _A5O_MIN(1, x + y) BLEND(r, src, dst) BLEND(g, src, dst) BLEND(b, src, dst) #undef OP break; - case ALLEGRO_SRC_MINUS_DEST: - #define OP(x, y) _ALLEGRO_MAX(0, x - y) + case A5O_SRC_MINUS_DEST: + #define OP(x, y) _A5O_MAX(0, x - y) BLEND(r, src, dst) BLEND(g, src, dst) BLEND(b, src, dst) #undef OP break; - case ALLEGRO_DEST_MINUS_SRC: - #define OP(x, y) _ALLEGRO_MAX(0, y - x) + case A5O_DEST_MINUS_SRC: + #define OP(x, y) _A5O_MAX(0, y - x) BLEND(r, src, dst) BLEND(g, src, dst) BLEND(b, src, dst) @@ -220,18 +220,18 @@ void _al_blend_inline( #define BLEND(c, src, dst) \ result->c = OP(result->c * src, dcol->c * dst); switch (aop) { - case ALLEGRO_ADD: - #define OP(x, y) _ALLEGRO_MIN(1, x + y) + case A5O_ADD: + #define OP(x, y) _A5O_MIN(1, x + y) BLEND(a, asrc, adst) #undef OP break; - case ALLEGRO_SRC_MINUS_DEST: - #define OP(x, y) _ALLEGRO_MAX(0, x - y) + case A5O_SRC_MINUS_DEST: + #define OP(x, y) _A5O_MAX(0, x - y) BLEND(a, asrc, adst) #undef OP break; - case ALLEGRO_DEST_MINUS_SRC: - #define OP(x, y) _ALLEGRO_MAX(0, y - x) + case A5O_DEST_MINUS_SRC: + #define OP(x, y) _A5O_MAX(0, y - x) BLEND(a, asrc, adst) #undef OP break; @@ -242,8 +242,8 @@ void _al_blend_inline( #endif -void _al_blend_memory(ALLEGRO_COLOR *src_color, ALLEGRO_BITMAP *dest, - int dx, int dy, ALLEGRO_COLOR *result); +void _al_blend_memory(A5O_COLOR *src_color, A5O_BITMAP *dest, + int dx, int dy, A5O_COLOR *result); #ifdef __cplusplus diff --git a/include/allegro5/internal/aintern_config.h b/include/allegro5/internal/aintern_config.h index 7551df5c33..4cf54d2efc 100644 --- a/include/allegro5/internal/aintern_config.h +++ b/include/allegro5/internal/aintern_config.h @@ -3,24 +3,24 @@ #include "allegro5/internal/aintern_aatree.h" -struct ALLEGRO_CONFIG_ENTRY { +struct A5O_CONFIG_ENTRY { bool is_comment; - ALLEGRO_USTR *key; /* comment if is_comment is true */ - ALLEGRO_USTR *value; - ALLEGRO_CONFIG_ENTRY *prev, *next; + A5O_USTR *key; /* comment if is_comment is true */ + A5O_USTR *value; + A5O_CONFIG_ENTRY *prev, *next; }; -struct ALLEGRO_CONFIG_SECTION { - ALLEGRO_USTR *name; - ALLEGRO_CONFIG_ENTRY *head; - ALLEGRO_CONFIG_ENTRY *last; +struct A5O_CONFIG_SECTION { + A5O_USTR *name; + A5O_CONFIG_ENTRY *head; + A5O_CONFIG_ENTRY *last; _AL_AATREE *tree; - ALLEGRO_CONFIG_SECTION *prev, *next; + A5O_CONFIG_SECTION *prev, *next; }; -struct ALLEGRO_CONFIG { - ALLEGRO_CONFIG_SECTION *head; - ALLEGRO_CONFIG_SECTION *last; +struct A5O_CONFIG { + A5O_CONFIG_SECTION *head; + A5O_CONFIG_SECTION *last; _AL_AATREE *tree; }; diff --git a/include/allegro5/internal/aintern_convert.h b/include/allegro5/internal/aintern_convert.h index 51eb8a7a39..f7ed181770 100644 --- a/include/allegro5/internal/aintern_convert.h +++ b/include/allegro5/internal/aintern_convert.h @@ -4,1610 +4,1610 @@ #include "allegro5/allegro.h" #include "allegro5/internal/aintern_pixels.h" -#define ALLEGRO_CONVERT_ARGB_8888_TO_RGBA_8888(x) \ +#define A5O_CONVERT_ARGB_8888_TO_RGBA_8888(x) \ ((((x) & 0xff000000) >> 24) /* A */ | \ (((x) & 0x00ffffff) << 8) /* BGR */) -#define ALLEGRO_CONVERT_ARGB_8888_TO_ARGB_4444(x) \ +#define A5O_CONVERT_ARGB_8888_TO_ARGB_4444(x) \ ((((x) & 0xf0000000) >> 16) /* A */ | \ (((x) & 0x000000f0) >> 4) /* B */ | \ (((x) & 0x0000f000) >> 8) /* G */ | \ (((x) & 0x00f00000) >> 12) /* R */) -#define ALLEGRO_CONVERT_ARGB_8888_TO_RGB_888(x) \ +#define A5O_CONVERT_ARGB_8888_TO_RGB_888(x) \ (((x) & 0x00ffffff) /* BGR */) -#define ALLEGRO_CONVERT_ARGB_8888_TO_RGB_565(x) \ +#define A5O_CONVERT_ARGB_8888_TO_RGB_565(x) \ ((((x) & 0x000000f8) >> 3) /* B */ | \ (((x) & 0x0000fc00) >> 5) /* G */ | \ (((x) & 0x00f80000) >> 8) /* R */) -#define ALLEGRO_CONVERT_ARGB_8888_TO_RGB_555(x) \ +#define A5O_CONVERT_ARGB_8888_TO_RGB_555(x) \ ((((x) & 0x000000f8) >> 3) /* B */ | \ (((x) & 0x0000f800) >> 6) /* G */ | \ (((x) & 0x00f80000) >> 9) /* R */) -#define ALLEGRO_CONVERT_ARGB_8888_TO_RGBA_5551(x) \ +#define A5O_CONVERT_ARGB_8888_TO_RGBA_5551(x) \ ((((x) & 0x80000000) >> 31) /* A */ | \ (((x) & 0x000000f8) >> 2) /* B */ | \ (((x) & 0x0000f800) >> 5) /* G */ | \ (((x) & 0x00f80000) >> 8) /* R */) -#define ALLEGRO_CONVERT_ARGB_8888_TO_ARGB_1555(x) \ +#define A5O_CONVERT_ARGB_8888_TO_ARGB_1555(x) \ ((((x) & 0x80000000) >> 16) /* A */ | \ (((x) & 0x000000f8) >> 3) /* B */ | \ (((x) & 0x0000f800) >> 6) /* G */ | \ (((x) & 0x00f80000) >> 9) /* R */) -#define ALLEGRO_CONVERT_ARGB_8888_TO_ABGR_8888(x) \ +#define A5O_CONVERT_ARGB_8888_TO_ABGR_8888(x) \ ((((x) & 0x000000ff) << 16) /* B */ | \ (((x) & 0x00ff0000) >> 16) /* R */ | \ ((x) & 0xff00ff00) /* AG */) -#define ALLEGRO_CONVERT_ARGB_8888_TO_XBGR_8888(x) \ +#define A5O_CONVERT_ARGB_8888_TO_XBGR_8888(x) \ ((((x) & 0x000000ff) << 16) /* B */ | \ ((x) & 0x0000ff00) /* G */ | \ (((x) & 0x00ff0000) >> 16) /* R */) -#define ALLEGRO_CONVERT_ARGB_8888_TO_BGR_888(x) \ +#define A5O_CONVERT_ARGB_8888_TO_BGR_888(x) \ ((((x) & 0x000000ff) << 16) /* B */ | \ ((x) & 0x0000ff00) /* G */ | \ (((x) & 0x00ff0000) >> 16) /* R */) -#define ALLEGRO_CONVERT_ARGB_8888_TO_BGR_565(x) \ +#define A5O_CONVERT_ARGB_8888_TO_BGR_565(x) \ ((((x) & 0x000000f8) << 8) /* B */ | \ (((x) & 0x0000fc00) >> 5) /* G */ | \ (((x) & 0x00f80000) >> 19) /* R */) -#define ALLEGRO_CONVERT_ARGB_8888_TO_BGR_555(x) \ +#define A5O_CONVERT_ARGB_8888_TO_BGR_555(x) \ ((((x) & 0x000000f8) << 7) /* B */ | \ (((x) & 0x0000f800) >> 6) /* G */ | \ (((x) & 0x00f80000) >> 19) /* R */) -#define ALLEGRO_CONVERT_ARGB_8888_TO_RGBX_8888(x) \ +#define A5O_CONVERT_ARGB_8888_TO_RGBX_8888(x) \ ((((x) & 0x00ffffff) << 8) /* BGR */) -#define ALLEGRO_CONVERT_ARGB_8888_TO_XRGB_8888(x) \ +#define A5O_CONVERT_ARGB_8888_TO_XRGB_8888(x) \ (((x) & 0x00ffffff) /* BGR */) -#define ALLEGRO_CONVERT_ARGB_8888_TO_ABGR_F32(x) \ +#define A5O_CONVERT_ARGB_8888_TO_ABGR_F32(x) \ al_map_rgba(((x) >> 16) & 255,\ ((x) >> 8) & 255,\ ((x) >> 0) & 255,\ ((x) >> 24) & 255) -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ARGB_8888_TO_ABGR_8888_LE(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ARGB_8888_TO_ABGR_8888_LE(x) \ ((((x) & 0xff000000) >> 24) /* A */ | \ (((x) & 0x00ffffff) << 8) /* BGR */) #else -#define ALLEGRO_CONVERT_ARGB_8888_TO_ABGR_8888_LE(x) \ +#define A5O_CONVERT_ARGB_8888_TO_ABGR_8888_LE(x) \ ((((x) & 0x000000ff) << 16) /* B */ | \ (((x) & 0x00ff0000) >> 16) /* R */ | \ ((x) & 0xff00ff00) /* AG */) #endif -#define ALLEGRO_CONVERT_ARGB_8888_TO_RGBA_4444(x) \ +#define A5O_CONVERT_ARGB_8888_TO_RGBA_4444(x) \ ((((x) & 0xf0000000) >> 28) /* A */ | \ ((x) & 0x000000f0) /* B */ | \ (((x) & 0x0000f000) >> 4) /* G */ | \ (((x) & 0x00f00000) >> 8) /* R */) -#define ALLEGRO_CONVERT_ARGB_8888_TO_SINGLE_CHANNEL_8(x) \ +#define A5O_CONVERT_ARGB_8888_TO_SINGLE_CHANNEL_8(x) \ (((x) >> 16) & 0xff) -#define ALLEGRO_CONVERT_RGBA_8888_TO_ARGB_8888(x) \ +#define A5O_CONVERT_RGBA_8888_TO_ARGB_8888(x) \ ((((x) & 0x000000ff) << 24) /* A */ | \ (((x) & 0xffffff00) >> 8) /* BGR */) -#define ALLEGRO_CONVERT_RGBA_8888_TO_ARGB_4444(x) \ +#define A5O_CONVERT_RGBA_8888_TO_ARGB_4444(x) \ ((((x) & 0x000000f0) << 8) /* A */ | \ (((x) & 0x0000f000) >> 12) /* B */ | \ (((x) & 0x00f00000) >> 16) /* G */ | \ (((x) & 0xf0000000) >> 20) /* R */) -#define ALLEGRO_CONVERT_RGBA_8888_TO_RGB_888(x) \ +#define A5O_CONVERT_RGBA_8888_TO_RGB_888(x) \ ((((x) & 0xffffff00) >> 8) /* BGR */) -#define ALLEGRO_CONVERT_RGBA_8888_TO_RGB_565(x) \ +#define A5O_CONVERT_RGBA_8888_TO_RGB_565(x) \ ((((x) & 0x0000f800) >> 11) /* B */ | \ (((x) & 0x00fc0000) >> 13) /* G */ | \ (((x) & 0xf8000000) >> 16) /* R */) -#define ALLEGRO_CONVERT_RGBA_8888_TO_RGB_555(x) \ +#define A5O_CONVERT_RGBA_8888_TO_RGB_555(x) \ ((((x) & 0x0000f800) >> 11) /* B */ | \ (((x) & 0x00f80000) >> 14) /* G */ | \ (((x) & 0xf8000000) >> 17) /* R */) -#define ALLEGRO_CONVERT_RGBA_8888_TO_RGBA_5551(x) \ +#define A5O_CONVERT_RGBA_8888_TO_RGBA_5551(x) \ ((((x) & 0x00000080) >> 7) /* A */ | \ (((x) & 0x0000f800) >> 10) /* B */ | \ (((x) & 0x00f80000) >> 13) /* G */ | \ (((x) & 0xf8000000) >> 16) /* R */) -#define ALLEGRO_CONVERT_RGBA_8888_TO_ARGB_1555(x) \ +#define A5O_CONVERT_RGBA_8888_TO_ARGB_1555(x) \ ((((x) & 0x00000080) << 8) /* A */ | \ (((x) & 0x0000f800) >> 11) /* B */ | \ (((x) & 0x00f80000) >> 14) /* G */ | \ (((x) & 0xf8000000) >> 17) /* R */) -#define ALLEGRO_CONVERT_RGBA_8888_TO_ABGR_8888(x) \ +#define A5O_CONVERT_RGBA_8888_TO_ABGR_8888(x) \ ((((x) & 0x000000ff) << 24) /* A */ | \ (((x) & 0x0000ff00) << 8) /* B */ | \ (((x) & 0x00ff0000) >> 8) /* G */ | \ (((x) & 0xff000000) >> 24) /* R */) -#define ALLEGRO_CONVERT_RGBA_8888_TO_XBGR_8888(x) \ +#define A5O_CONVERT_RGBA_8888_TO_XBGR_8888(x) \ ((((x) & 0x0000ff00) << 8) /* B */ | \ (((x) & 0x00ff0000) >> 8) /* G */ | \ (((x) & 0xff000000) >> 24) /* R */) -#define ALLEGRO_CONVERT_RGBA_8888_TO_BGR_888(x) \ +#define A5O_CONVERT_RGBA_8888_TO_BGR_888(x) \ ((((x) & 0x0000ff00) << 8) /* B */ | \ (((x) & 0x00ff0000) >> 8) /* G */ | \ (((x) & 0xff000000) >> 24) /* R */) -#define ALLEGRO_CONVERT_RGBA_8888_TO_BGR_565(x) \ +#define A5O_CONVERT_RGBA_8888_TO_BGR_565(x) \ (((x) & 0x0000f800) /* B */ | \ (((x) & 0x00fc0000) >> 13) /* G */ | \ (((x) & 0xf8000000) >> 27) /* R */) -#define ALLEGRO_CONVERT_RGBA_8888_TO_BGR_555(x) \ +#define A5O_CONVERT_RGBA_8888_TO_BGR_555(x) \ ((((x) & 0x0000f800) >> 1) /* B */ | \ (((x) & 0x00f80000) >> 14) /* G */ | \ (((x) & 0xf8000000) >> 27) /* R */) -#define ALLEGRO_CONVERT_RGBA_8888_TO_RGBX_8888(x) \ +#define A5O_CONVERT_RGBA_8888_TO_RGBX_8888(x) \ (((x) & 0xffffff00) /* BGR */) -#define ALLEGRO_CONVERT_RGBA_8888_TO_XRGB_8888(x) \ +#define A5O_CONVERT_RGBA_8888_TO_XRGB_8888(x) \ ((((x) & 0xffffff00) >> 8) /* BGR */) -#define ALLEGRO_CONVERT_RGBA_8888_TO_ABGR_F32(x) \ +#define A5O_CONVERT_RGBA_8888_TO_ABGR_F32(x) \ al_map_rgba(((x) >> 24) & 255,\ ((x) >> 16) & 255,\ ((x) >> 8) & 255,\ ((x) >> 0) & 255) -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_RGBA_8888_TO_ABGR_8888_LE(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_RGBA_8888_TO_ABGR_8888_LE(x) \ (((x) & 0xffffffff) /* ABGR */) #else -#define ALLEGRO_CONVERT_RGBA_8888_TO_ABGR_8888_LE(x) \ +#define A5O_CONVERT_RGBA_8888_TO_ABGR_8888_LE(x) \ ((((x) & 0x000000ff) << 24) /* A */ | \ (((x) & 0x0000ff00) << 8) /* B */ | \ (((x) & 0x00ff0000) >> 8) /* G */ | \ (((x) & 0xff000000) >> 24) /* R */) #endif -#define ALLEGRO_CONVERT_RGBA_8888_TO_RGBA_4444(x) \ +#define A5O_CONVERT_RGBA_8888_TO_RGBA_4444(x) \ ((((x) & 0x000000f0) >> 4) /* A */ | \ (((x) & 0x0000f000) >> 8) /* B */ | \ (((x) & 0x00f00000) >> 12) /* G */ | \ (((x) & 0xf0000000) >> 16) /* R */) -#define ALLEGRO_CONVERT_RGBA_8888_TO_SINGLE_CHANNEL_8(x) \ +#define A5O_CONVERT_RGBA_8888_TO_SINGLE_CHANNEL_8(x) \ (((x) >> 24) & 0xff) -#define ALLEGRO_CONVERT_ARGB_4444_TO_ARGB_8888(x) \ +#define A5O_CONVERT_ARGB_4444_TO_ARGB_8888(x) \ ((_al_rgb_scale_4[((x) & 0xf000) >> 12] << 24) /* A */ | \ (_al_rgb_scale_4[((x) & 0x000f) >> 0] ) /* B */ | \ (_al_rgb_scale_4[((x) & 0x00f0) >> 4] << 8) /* G */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] << 16) /* R */) -#define ALLEGRO_CONVERT_ARGB_4444_TO_RGBA_8888(x) \ +#define A5O_CONVERT_ARGB_4444_TO_RGBA_8888(x) \ ((_al_rgb_scale_4[((x) & 0xf000) >> 12] ) /* A */ | \ (_al_rgb_scale_4[((x) & 0x000f) >> 0] << 8) /* B */ | \ (_al_rgb_scale_4[((x) & 0x00f0) >> 4] << 16) /* G */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] << 24) /* R */) -#define ALLEGRO_CONVERT_ARGB_4444_TO_RGB_888(x) \ +#define A5O_CONVERT_ARGB_4444_TO_RGB_888(x) \ ((_al_rgb_scale_4[((x) & 0x000f) >> 0] ) /* B */ | \ (_al_rgb_scale_4[((x) & 0x00f0) >> 4] << 8) /* G */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] << 16) /* R */) -#define ALLEGRO_CONVERT_ARGB_4444_TO_RGB_565(x) \ +#define A5O_CONVERT_ARGB_4444_TO_RGB_565(x) \ ((((x) & 0x000f) << 1) /* B */ | \ (((x) & 0x00f0) << 3) /* G */ | \ (((x) & 0x0f00) << 4) /* R */) -#define ALLEGRO_CONVERT_ARGB_4444_TO_RGB_555(x) \ +#define A5O_CONVERT_ARGB_4444_TO_RGB_555(x) \ ((((x) & 0x000f) << 1) /* B */ | \ (((x) & 0x00f0) << 2) /* G */ | \ (((x) & 0x0f00) << 3) /* R */) -#define ALLEGRO_CONVERT_ARGB_4444_TO_RGBA_5551(x) \ +#define A5O_CONVERT_ARGB_4444_TO_RGBA_5551(x) \ ((((x) & 0x8000) >> 15) /* A */ | \ (((x) & 0x000f) << 2) /* B */ | \ (((x) & 0x00f0) << 3) /* G */ | \ (((x) & 0x0f00) << 4) /* R */) -#define ALLEGRO_CONVERT_ARGB_4444_TO_ARGB_1555(x) \ +#define A5O_CONVERT_ARGB_4444_TO_ARGB_1555(x) \ (((x) & 0x8000) /* A */ | \ (((x) & 0x000f) << 1) /* B */ | \ (((x) & 0x00f0) << 2) /* G */ | \ (((x) & 0x0f00) << 3) /* R */) -#define ALLEGRO_CONVERT_ARGB_4444_TO_ABGR_8888(x) \ +#define A5O_CONVERT_ARGB_4444_TO_ABGR_8888(x) \ ((_al_rgb_scale_4[((x) & 0xf000) >> 12] << 24) /* A */ | \ (_al_rgb_scale_4[((x) & 0x000f) >> 0] << 16) /* B */ | \ (_al_rgb_scale_4[((x) & 0x00f0) >> 4] << 8) /* G */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] ) /* R */) -#define ALLEGRO_CONVERT_ARGB_4444_TO_XBGR_8888(x) \ +#define A5O_CONVERT_ARGB_4444_TO_XBGR_8888(x) \ ((_al_rgb_scale_4[((x) & 0x000f) >> 0] << 16) /* B */ | \ (_al_rgb_scale_4[((x) & 0x00f0) >> 4] << 8) /* G */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] ) /* R */) -#define ALLEGRO_CONVERT_ARGB_4444_TO_BGR_888(x) \ +#define A5O_CONVERT_ARGB_4444_TO_BGR_888(x) \ ((_al_rgb_scale_4[((x) & 0x000f) >> 0] << 16) /* B */ | \ (_al_rgb_scale_4[((x) & 0x00f0) >> 4] << 8) /* G */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] ) /* R */) -#define ALLEGRO_CONVERT_ARGB_4444_TO_BGR_565(x) \ +#define A5O_CONVERT_ARGB_4444_TO_BGR_565(x) \ ((((x) & 0x000f) << 12) /* B */ | \ (((x) & 0x00f0) << 3) /* G */ | \ (((x) & 0x0f00) >> 7) /* R */) -#define ALLEGRO_CONVERT_ARGB_4444_TO_BGR_555(x) \ +#define A5O_CONVERT_ARGB_4444_TO_BGR_555(x) \ ((((x) & 0x000f) << 11) /* B */ | \ (((x) & 0x00f0) << 2) /* G */ | \ (((x) & 0x0f00) >> 7) /* R */) -#define ALLEGRO_CONVERT_ARGB_4444_TO_RGBX_8888(x) \ +#define A5O_CONVERT_ARGB_4444_TO_RGBX_8888(x) \ ((_al_rgb_scale_4[((x) & 0x000f) >> 0] << 8) /* B */ | \ (_al_rgb_scale_4[((x) & 0x00f0) >> 4] << 16) /* G */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] << 24) /* R */) -#define ALLEGRO_CONVERT_ARGB_4444_TO_XRGB_8888(x) \ +#define A5O_CONVERT_ARGB_4444_TO_XRGB_8888(x) \ ((_al_rgb_scale_4[((x) & 0x000f) >> 0] ) /* B */ | \ (_al_rgb_scale_4[((x) & 0x00f0) >> 4] << 8) /* G */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] << 16) /* R */) -#define ALLEGRO_CONVERT_ARGB_4444_TO_ABGR_F32(x) \ +#define A5O_CONVERT_ARGB_4444_TO_ABGR_F32(x) \ al_map_rgba(_al_rgb_scale_4[((x) >> 8) & 15],\ _al_rgb_scale_4[((x) >> 4) & 15],\ _al_rgb_scale_4[((x) >> 0) & 15],\ _al_rgb_scale_4[((x) >> 12) & 15]) -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ARGB_4444_TO_ABGR_8888_LE(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ARGB_4444_TO_ABGR_8888_LE(x) \ ((_al_rgb_scale_4[((x) & 0xf000) >> 12] ) /* A */ | \ (_al_rgb_scale_4[((x) & 0x000f) >> 0] << 8) /* B */ | \ (_al_rgb_scale_4[((x) & 0x00f0) >> 4] << 16) /* G */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] << 24) /* R */) #else -#define ALLEGRO_CONVERT_ARGB_4444_TO_ABGR_8888_LE(x) \ +#define A5O_CONVERT_ARGB_4444_TO_ABGR_8888_LE(x) \ ((_al_rgb_scale_4[((x) & 0xf000) >> 12] << 24) /* A */ | \ (_al_rgb_scale_4[((x) & 0x000f) >> 0] << 16) /* B */ | \ (_al_rgb_scale_4[((x) & 0x00f0) >> 4] << 8) /* G */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] ) /* R */) #endif -#define ALLEGRO_CONVERT_ARGB_4444_TO_RGBA_4444(x) \ +#define A5O_CONVERT_ARGB_4444_TO_RGBA_4444(x) \ ((((x) & 0xf000) >> 12) /* A */ | \ (((x) & 0x0fff) << 4) /* BGR */) -#define ALLEGRO_CONVERT_ARGB_4444_TO_SINGLE_CHANNEL_8(x) \ +#define A5O_CONVERT_ARGB_4444_TO_SINGLE_CHANNEL_8(x) \ (_al_rgb_scale_4[(((x) >> 8) & 0xf)]) -#define ALLEGRO_CONVERT_RGB_888_TO_ARGB_8888(x) \ +#define A5O_CONVERT_RGB_888_TO_ARGB_8888(x) \ ((0xff000000) /* A */ | \ ((x) & 0xffffff) /* BGR */) -#define ALLEGRO_CONVERT_RGB_888_TO_RGBA_8888(x) \ +#define A5O_CONVERT_RGB_888_TO_RGBA_8888(x) \ ((0x000000ff) /* A */ | \ (((x) & 0xffffff) << 8) /* BGR */) -#define ALLEGRO_CONVERT_RGB_888_TO_ARGB_4444(x) \ +#define A5O_CONVERT_RGB_888_TO_ARGB_4444(x) \ ((0xf000) /* A */ | \ (((x) & 0x0000f0) >> 4) /* B */ | \ (((x) & 0x00f000) >> 8) /* G */ | \ (((x) & 0xf00000) >> 12) /* R */) -#define ALLEGRO_CONVERT_RGB_888_TO_RGB_565(x) \ +#define A5O_CONVERT_RGB_888_TO_RGB_565(x) \ ((((x) & 0x0000f8) >> 3) /* B */ | \ (((x) & 0x00fc00) >> 5) /* G */ | \ (((x) & 0xf80000) >> 8) /* R */) -#define ALLEGRO_CONVERT_RGB_888_TO_RGB_555(x) \ +#define A5O_CONVERT_RGB_888_TO_RGB_555(x) \ ((((x) & 0x0000f8) >> 3) /* B */ | \ (((x) & 0x00f800) >> 6) /* G */ | \ (((x) & 0xf80000) >> 9) /* R */) -#define ALLEGRO_CONVERT_RGB_888_TO_RGBA_5551(x) \ +#define A5O_CONVERT_RGB_888_TO_RGBA_5551(x) \ ((0x0001) /* A */ | \ (((x) & 0x0000f8) >> 2) /* B */ | \ (((x) & 0x00f800) >> 5) /* G */ | \ (((x) & 0xf80000) >> 8) /* R */) -#define ALLEGRO_CONVERT_RGB_888_TO_ARGB_1555(x) \ +#define A5O_CONVERT_RGB_888_TO_ARGB_1555(x) \ ((0x8000) /* A */ | \ (((x) & 0x0000f8) >> 3) /* B */ | \ (((x) & 0x00f800) >> 6) /* G */ | \ (((x) & 0xf80000) >> 9) /* R */) -#define ALLEGRO_CONVERT_RGB_888_TO_ABGR_8888(x) \ +#define A5O_CONVERT_RGB_888_TO_ABGR_8888(x) \ ((0xff000000) /* A */ | \ (((x) & 0x0000ff) << 16) /* B */ | \ ((x) & 0x00ff00) /* G */ | \ (((x) & 0xff0000) >> 16) /* R */) -#define ALLEGRO_CONVERT_RGB_888_TO_XBGR_8888(x) \ +#define A5O_CONVERT_RGB_888_TO_XBGR_8888(x) \ ((((x) & 0x0000ff) << 16) /* B */ | \ ((x) & 0x00ff00) /* G */ | \ (((x) & 0xff0000) >> 16) /* R */) -#define ALLEGRO_CONVERT_RGB_888_TO_BGR_888(x) \ +#define A5O_CONVERT_RGB_888_TO_BGR_888(x) \ ((((x) & 0x0000ff) << 16) /* B */ | \ ((x) & 0x00ff00) /* G */ | \ (((x) & 0xff0000) >> 16) /* R */) -#define ALLEGRO_CONVERT_RGB_888_TO_BGR_565(x) \ +#define A5O_CONVERT_RGB_888_TO_BGR_565(x) \ ((((x) & 0x0000f8) << 8) /* B */ | \ (((x) & 0x00fc00) >> 5) /* G */ | \ (((x) & 0xf80000) >> 19) /* R */) -#define ALLEGRO_CONVERT_RGB_888_TO_BGR_555(x) \ +#define A5O_CONVERT_RGB_888_TO_BGR_555(x) \ ((((x) & 0x0000f8) << 7) /* B */ | \ (((x) & 0x00f800) >> 6) /* G */ | \ (((x) & 0xf80000) >> 19) /* R */) -#define ALLEGRO_CONVERT_RGB_888_TO_RGBX_8888(x) \ +#define A5O_CONVERT_RGB_888_TO_RGBX_8888(x) \ ((((x) & 0xffffff) << 8) /* BGR */) -#define ALLEGRO_CONVERT_RGB_888_TO_XRGB_8888(x) \ +#define A5O_CONVERT_RGB_888_TO_XRGB_8888(x) \ (((x) & 0xffffff) /* BGR */) -#define ALLEGRO_CONVERT_RGB_888_TO_ABGR_F32(x) \ +#define A5O_CONVERT_RGB_888_TO_ABGR_F32(x) \ al_map_rgb(((x) >> 16) & 255,\ ((x) >> 8) & 255,\ ((x) >> 0) & 255) -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_RGB_888_TO_ABGR_8888_LE(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_RGB_888_TO_ABGR_8888_LE(x) \ ((0x000000ff) /* A */ | \ (((x) & 0xffffff) << 8) /* BGR */) #else -#define ALLEGRO_CONVERT_RGB_888_TO_ABGR_8888_LE(x) \ +#define A5O_CONVERT_RGB_888_TO_ABGR_8888_LE(x) \ ((0xff000000) /* A */ | \ (((x) & 0x0000ff) << 16) /* B */ | \ ((x) & 0x00ff00) /* G */ | \ (((x) & 0xff0000) >> 16) /* R */) #endif -#define ALLEGRO_CONVERT_RGB_888_TO_RGBA_4444(x) \ +#define A5O_CONVERT_RGB_888_TO_RGBA_4444(x) \ ((0x000f) /* A */ | \ ((x) & 0x0000f0) /* B */ | \ (((x) & 0x00f000) >> 4) /* G */ | \ (((x) & 0xf00000) >> 8) /* R */) -#define ALLEGRO_CONVERT_RGB_888_TO_SINGLE_CHANNEL_8(x) \ +#define A5O_CONVERT_RGB_888_TO_SINGLE_CHANNEL_8(x) \ (((x) >> 16) & 0xff) -#define ALLEGRO_CONVERT_RGB_565_TO_ARGB_8888(x) \ +#define A5O_CONVERT_RGB_565_TO_ARGB_8888(x) \ ((0xff000000) /* A */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] ) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] << 16) /* R */) -#define ALLEGRO_CONVERT_RGB_565_TO_RGBA_8888(x) \ +#define A5O_CONVERT_RGB_565_TO_RGBA_8888(x) \ ((0x000000ff) /* A */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] << 8) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 16) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] << 24) /* R */) -#define ALLEGRO_CONVERT_RGB_565_TO_ARGB_4444(x) \ +#define A5O_CONVERT_RGB_565_TO_ARGB_4444(x) \ ((0xf000) /* A */ | \ (((x) & 0x001e) >> 1) /* B */ | \ (((x) & 0x0780) >> 3) /* G */ | \ (((x) & 0xf000) >> 4) /* R */) -#define ALLEGRO_CONVERT_RGB_565_TO_RGB_888(x) \ +#define A5O_CONVERT_RGB_565_TO_RGB_888(x) \ ((_al_rgb_scale_5[((x) & 0x001f) >> 0] ) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] << 16) /* R */) -#define ALLEGRO_CONVERT_RGB_565_TO_RGB_555(x) \ +#define A5O_CONVERT_RGB_565_TO_RGB_555(x) \ (((x) & 0x001f) /* B */ | \ (((x) & 0xffc0) >> 1) /* GR */) -#define ALLEGRO_CONVERT_RGB_565_TO_RGBA_5551(x) \ +#define A5O_CONVERT_RGB_565_TO_RGBA_5551(x) \ ((0x0001) /* A */ | \ (((x) & 0x001f) << 1) /* B */ | \ ((x) & 0xffc0) /* GR */) -#define ALLEGRO_CONVERT_RGB_565_TO_ARGB_1555(x) \ +#define A5O_CONVERT_RGB_565_TO_ARGB_1555(x) \ ((0x8000) /* A */ | \ ((x) & 0x001f) /* B */ | \ (((x) & 0xffc0) >> 1) /* GR */) -#define ALLEGRO_CONVERT_RGB_565_TO_ABGR_8888(x) \ +#define A5O_CONVERT_RGB_565_TO_ABGR_8888(x) \ ((0xff000000) /* A */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] << 16) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] ) /* R */) -#define ALLEGRO_CONVERT_RGB_565_TO_XBGR_8888(x) \ +#define A5O_CONVERT_RGB_565_TO_XBGR_8888(x) \ ((_al_rgb_scale_5[((x) & 0x001f) >> 0] << 16) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] ) /* R */) -#define ALLEGRO_CONVERT_RGB_565_TO_BGR_888(x) \ +#define A5O_CONVERT_RGB_565_TO_BGR_888(x) \ ((_al_rgb_scale_5[((x) & 0x001f) >> 0] << 16) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] ) /* R */) -#define ALLEGRO_CONVERT_RGB_565_TO_BGR_565(x) \ +#define A5O_CONVERT_RGB_565_TO_BGR_565(x) \ ((((x) & 0x001f) << 11) /* B */ | \ ((x) & 0x07e0) /* G */ | \ (((x) & 0xf800) >> 11) /* R */) -#define ALLEGRO_CONVERT_RGB_565_TO_BGR_555(x) \ +#define A5O_CONVERT_RGB_565_TO_BGR_555(x) \ ((((x) & 0x001f) << 10) /* B */ | \ (((x) & 0x07c0) >> 1) /* G */ | \ (((x) & 0xf800) >> 11) /* R */) -#define ALLEGRO_CONVERT_RGB_565_TO_RGBX_8888(x) \ +#define A5O_CONVERT_RGB_565_TO_RGBX_8888(x) \ ((_al_rgb_scale_5[((x) & 0x001f) >> 0] << 8) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 16) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] << 24) /* R */) -#define ALLEGRO_CONVERT_RGB_565_TO_XRGB_8888(x) \ +#define A5O_CONVERT_RGB_565_TO_XRGB_8888(x) \ ((_al_rgb_scale_5[((x) & 0x001f) >> 0] ) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] << 16) /* R */) -#define ALLEGRO_CONVERT_RGB_565_TO_ABGR_F32(x) \ +#define A5O_CONVERT_RGB_565_TO_ABGR_F32(x) \ al_map_rgb(_al_rgb_scale_5[((x) >> 11) & 31],\ _al_rgb_scale_6[((x) >> 5) & 63],\ _al_rgb_scale_5[((x) >> 0) & 31]) -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_RGB_565_TO_ABGR_8888_LE(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_RGB_565_TO_ABGR_8888_LE(x) \ ((0x000000ff) /* A */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] << 8) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 16) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] << 24) /* R */) #else -#define ALLEGRO_CONVERT_RGB_565_TO_ABGR_8888_LE(x) \ +#define A5O_CONVERT_RGB_565_TO_ABGR_8888_LE(x) \ ((0xff000000) /* A */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] << 16) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] ) /* R */) #endif -#define ALLEGRO_CONVERT_RGB_565_TO_RGBA_4444(x) \ +#define A5O_CONVERT_RGB_565_TO_RGBA_4444(x) \ ((0x000f) /* A */ | \ (((x) & 0x001e) << 3) /* B */ | \ (((x) & 0x0780) << 1) /* G */ | \ ((x) & 0xf000) /* R */) -#define ALLEGRO_CONVERT_RGB_565_TO_SINGLE_CHANNEL_8(x) \ +#define A5O_CONVERT_RGB_565_TO_SINGLE_CHANNEL_8(x) \ (_al_rgb_scale_5[(((x) >> 11) & 0x1f)]) -#define ALLEGRO_CONVERT_RGB_555_TO_ARGB_8888(x) \ +#define A5O_CONVERT_RGB_555_TO_ARGB_8888(x) \ ((0xff000000) /* A */ | \ (_al_rgb_scale_5[((x) & 0x01f) >> 0] ) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] << 16) /* R */) -#define ALLEGRO_CONVERT_RGB_555_TO_RGBA_8888(x) \ +#define A5O_CONVERT_RGB_555_TO_RGBA_8888(x) \ ((0x000000ff) /* A */ | \ (_al_rgb_scale_5[((x) & 0x01f) >> 0] << 8) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 16) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] << 24) /* R */) -#define ALLEGRO_CONVERT_RGB_555_TO_ARGB_4444(x) \ +#define A5O_CONVERT_RGB_555_TO_ARGB_4444(x) \ ((0xf000) /* A */ | \ (((x) & 0x01e) >> 1) /* B */ | \ (((x) & 0x3c0) >> 2) /* G */ | \ (((x) & 0x7800) >> 3) /* R */) -#define ALLEGRO_CONVERT_RGB_555_TO_RGB_888(x) \ +#define A5O_CONVERT_RGB_555_TO_RGB_888(x) \ ((_al_rgb_scale_5[((x) & 0x01f) >> 0] ) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] << 16) /* R */) -#define ALLEGRO_CONVERT_RGB_555_TO_RGB_565(x) \ +#define A5O_CONVERT_RGB_555_TO_RGB_565(x) \ (((x) & 0x01f) /* B */ | \ (((x) & 0x7fe0) << 1) /* GR */) -#define ALLEGRO_CONVERT_RGB_555_TO_RGBA_5551(x) \ +#define A5O_CONVERT_RGB_555_TO_RGBA_5551(x) \ ((0x0001) /* A */ | \ (((x) & 0x7fff) << 1) /* BGR */) -#define ALLEGRO_CONVERT_RGB_555_TO_ARGB_1555(x) \ +#define A5O_CONVERT_RGB_555_TO_ARGB_1555(x) \ ((0x8000) /* A */ | \ ((x) & 0x7fff) /* BGR */) -#define ALLEGRO_CONVERT_RGB_555_TO_ABGR_8888(x) \ +#define A5O_CONVERT_RGB_555_TO_ABGR_8888(x) \ ((0xff000000) /* A */ | \ (_al_rgb_scale_5[((x) & 0x01f) >> 0] << 16) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] ) /* R */) -#define ALLEGRO_CONVERT_RGB_555_TO_XBGR_8888(x) \ +#define A5O_CONVERT_RGB_555_TO_XBGR_8888(x) \ ((_al_rgb_scale_5[((x) & 0x01f) >> 0] << 16) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] ) /* R */) -#define ALLEGRO_CONVERT_RGB_555_TO_BGR_888(x) \ +#define A5O_CONVERT_RGB_555_TO_BGR_888(x) \ ((_al_rgb_scale_5[((x) & 0x01f) >> 0] << 16) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] ) /* R */) -#define ALLEGRO_CONVERT_RGB_555_TO_BGR_565(x) \ +#define A5O_CONVERT_RGB_555_TO_BGR_565(x) \ ((((x) & 0x01f) << 11) /* B */ | \ (((x) & 0x3e0) << 1) /* G */ | \ (((x) & 0x7c00) >> 10) /* R */) -#define ALLEGRO_CONVERT_RGB_555_TO_BGR_555(x) \ +#define A5O_CONVERT_RGB_555_TO_BGR_555(x) \ ((((x) & 0x01f) << 10) /* B */ | \ ((x) & 0x3e0) /* G */ | \ (((x) & 0x7c00) >> 10) /* R */) -#define ALLEGRO_CONVERT_RGB_555_TO_RGBX_8888(x) \ +#define A5O_CONVERT_RGB_555_TO_RGBX_8888(x) \ ((_al_rgb_scale_5[((x) & 0x01f) >> 0] << 8) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 16) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] << 24) /* R */) -#define ALLEGRO_CONVERT_RGB_555_TO_XRGB_8888(x) \ +#define A5O_CONVERT_RGB_555_TO_XRGB_8888(x) \ ((_al_rgb_scale_5[((x) & 0x01f) >> 0] ) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] << 16) /* R */) -#define ALLEGRO_CONVERT_RGB_555_TO_ABGR_F32(x) \ +#define A5O_CONVERT_RGB_555_TO_ABGR_F32(x) \ al_map_rgb(_al_rgb_scale_5[((x) >> 10) & 31],\ _al_rgb_scale_5[((x) >> 5) & 31],\ _al_rgb_scale_5[((x) >> 0) & 31]) -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_RGB_555_TO_ABGR_8888_LE(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_RGB_555_TO_ABGR_8888_LE(x) \ ((0x000000ff) /* A */ | \ (_al_rgb_scale_5[((x) & 0x01f) >> 0] << 8) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 16) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] << 24) /* R */) #else -#define ALLEGRO_CONVERT_RGB_555_TO_ABGR_8888_LE(x) \ +#define A5O_CONVERT_RGB_555_TO_ABGR_8888_LE(x) \ ((0xff000000) /* A */ | \ (_al_rgb_scale_5[((x) & 0x01f) >> 0] << 16) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] ) /* R */) #endif -#define ALLEGRO_CONVERT_RGB_555_TO_RGBA_4444(x) \ +#define A5O_CONVERT_RGB_555_TO_RGBA_4444(x) \ ((0x000f) /* A */ | \ (((x) & 0x01e) << 3) /* B */ | \ (((x) & 0x3c0) << 2) /* G */ | \ (((x) & 0x7800) << 1) /* R */) -#define ALLEGRO_CONVERT_RGB_555_TO_SINGLE_CHANNEL_8(x) \ +#define A5O_CONVERT_RGB_555_TO_SINGLE_CHANNEL_8(x) \ (_al_rgb_scale_5[(((x) >> 10) & 0x1f)]) -#define ALLEGRO_CONVERT_RGBA_5551_TO_ARGB_8888(x) \ +#define A5O_CONVERT_RGBA_5551_TO_ARGB_8888(x) \ ((_al_rgb_scale_1[((x) & 0x0001) >> 0] << 24) /* A */ | \ (_al_rgb_scale_5[((x) & 0x003e) >> 1] ) /* B */ | \ (_al_rgb_scale_5[((x) & 0x07c0) >> 6] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] << 16) /* R */) -#define ALLEGRO_CONVERT_RGBA_5551_TO_RGBA_8888(x) \ +#define A5O_CONVERT_RGBA_5551_TO_RGBA_8888(x) \ ((_al_rgb_scale_1[((x) & 0x0001) >> 0] ) /* A */ | \ (_al_rgb_scale_5[((x) & 0x003e) >> 1] << 8) /* B */ | \ (_al_rgb_scale_5[((x) & 0x07c0) >> 6] << 16) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] << 24) /* R */) -#define ALLEGRO_CONVERT_RGBA_5551_TO_ARGB_4444(x) \ +#define A5O_CONVERT_RGBA_5551_TO_ARGB_4444(x) \ ((((x) & 0x0001) << 15) /* A */ | \ (((x) & 0x003c) >> 2) /* B */ | \ (((x) & 0x0780) >> 3) /* G */ | \ (((x) & 0xf000) >> 4) /* R */) -#define ALLEGRO_CONVERT_RGBA_5551_TO_RGB_888(x) \ +#define A5O_CONVERT_RGBA_5551_TO_RGB_888(x) \ ((_al_rgb_scale_5[((x) & 0x003e) >> 1] ) /* B */ | \ (_al_rgb_scale_5[((x) & 0x07c0) >> 6] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] << 16) /* R */) -#define ALLEGRO_CONVERT_RGBA_5551_TO_RGB_565(x) \ +#define A5O_CONVERT_RGBA_5551_TO_RGB_565(x) \ ((((x) & 0x003e) >> 1) /* B */ | \ ((x) & 0xffc0) /* GR */) -#define ALLEGRO_CONVERT_RGBA_5551_TO_RGB_555(x) \ +#define A5O_CONVERT_RGBA_5551_TO_RGB_555(x) \ ((((x) & 0xfffe) >> 1) /* BGR */) -#define ALLEGRO_CONVERT_RGBA_5551_TO_ARGB_1555(x) \ +#define A5O_CONVERT_RGBA_5551_TO_ARGB_1555(x) \ ((((x) & 0x0001) << 15) /* A */ | \ (((x) & 0xfffe) >> 1) /* BGR */) -#define ALLEGRO_CONVERT_RGBA_5551_TO_ABGR_8888(x) \ +#define A5O_CONVERT_RGBA_5551_TO_ABGR_8888(x) \ ((_al_rgb_scale_1[((x) & 0x0001) >> 0] << 24) /* A */ | \ (_al_rgb_scale_5[((x) & 0x003e) >> 1] << 16) /* B */ | \ (_al_rgb_scale_5[((x) & 0x07c0) >> 6] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] ) /* R */) -#define ALLEGRO_CONVERT_RGBA_5551_TO_XBGR_8888(x) \ +#define A5O_CONVERT_RGBA_5551_TO_XBGR_8888(x) \ ((_al_rgb_scale_5[((x) & 0x003e) >> 1] << 16) /* B */ | \ (_al_rgb_scale_5[((x) & 0x07c0) >> 6] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] ) /* R */) -#define ALLEGRO_CONVERT_RGBA_5551_TO_BGR_888(x) \ +#define A5O_CONVERT_RGBA_5551_TO_BGR_888(x) \ ((_al_rgb_scale_5[((x) & 0x003e) >> 1] << 16) /* B */ | \ (_al_rgb_scale_5[((x) & 0x07c0) >> 6] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] ) /* R */) -#define ALLEGRO_CONVERT_RGBA_5551_TO_BGR_565(x) \ +#define A5O_CONVERT_RGBA_5551_TO_BGR_565(x) \ ((((x) & 0x003e) << 10) /* B */ | \ ((x) & 0x07c0) /* G */ | \ (((x) & 0xf800) >> 11) /* R */) -#define ALLEGRO_CONVERT_RGBA_5551_TO_BGR_555(x) \ +#define A5O_CONVERT_RGBA_5551_TO_BGR_555(x) \ ((((x) & 0x003e) << 9) /* B */ | \ (((x) & 0x07c0) >> 1) /* G */ | \ (((x) & 0xf800) >> 11) /* R */) -#define ALLEGRO_CONVERT_RGBA_5551_TO_RGBX_8888(x) \ +#define A5O_CONVERT_RGBA_5551_TO_RGBX_8888(x) \ ((_al_rgb_scale_5[((x) & 0x003e) >> 1] << 8) /* B */ | \ (_al_rgb_scale_5[((x) & 0x07c0) >> 6] << 16) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] << 24) /* R */) -#define ALLEGRO_CONVERT_RGBA_5551_TO_XRGB_8888(x) \ +#define A5O_CONVERT_RGBA_5551_TO_XRGB_8888(x) \ ((_al_rgb_scale_5[((x) & 0x003e) >> 1] ) /* B */ | \ (_al_rgb_scale_5[((x) & 0x07c0) >> 6] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] << 16) /* R */) -#define ALLEGRO_CONVERT_RGBA_5551_TO_ABGR_F32(x) \ +#define A5O_CONVERT_RGBA_5551_TO_ABGR_F32(x) \ al_map_rgba(_al_rgb_scale_5[((x) >> 11) & 31],\ _al_rgb_scale_5[((x) >> 6) & 31],\ _al_rgb_scale_5[((x) >> 1) & 31],\ _al_rgb_scale_1[((x) >> 0) & 1]) -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_RGBA_5551_TO_ABGR_8888_LE(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_RGBA_5551_TO_ABGR_8888_LE(x) \ ((_al_rgb_scale_1[((x) & 0x0001) >> 0] ) /* A */ | \ (_al_rgb_scale_5[((x) & 0x003e) >> 1] << 8) /* B */ | \ (_al_rgb_scale_5[((x) & 0x07c0) >> 6] << 16) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] << 24) /* R */) #else -#define ALLEGRO_CONVERT_RGBA_5551_TO_ABGR_8888_LE(x) \ +#define A5O_CONVERT_RGBA_5551_TO_ABGR_8888_LE(x) \ ((_al_rgb_scale_1[((x) & 0x0001) >> 0] << 24) /* A */ | \ (_al_rgb_scale_5[((x) & 0x003e) >> 1] << 16) /* B */ | \ (_al_rgb_scale_5[((x) & 0x07c0) >> 6] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] ) /* R */) #endif -#define ALLEGRO_CONVERT_RGBA_5551_TO_RGBA_4444(x) \ +#define A5O_CONVERT_RGBA_5551_TO_RGBA_4444(x) \ ((((x) & 0x0001) << 3) /* A */ | \ (((x) & 0x003c) << 2) /* B */ | \ (((x) & 0x0780) << 1) /* G */ | \ ((x) & 0xf000) /* R */) -#define ALLEGRO_CONVERT_RGBA_5551_TO_SINGLE_CHANNEL_8(x) \ +#define A5O_CONVERT_RGBA_5551_TO_SINGLE_CHANNEL_8(x) \ (_al_rgb_scale_5[(((x) >> 11) & 0x1f)]) -#define ALLEGRO_CONVERT_ARGB_1555_TO_ARGB_8888(x) \ +#define A5O_CONVERT_ARGB_1555_TO_ARGB_8888(x) \ ((_al_rgb_scale_1[((x) & 0x8000) >> 15] << 24) /* A */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] ) /* B */ | \ (_al_rgb_scale_5[((x) & 0x03e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] << 16) /* R */) -#define ALLEGRO_CONVERT_ARGB_1555_TO_RGBA_8888(x) \ +#define A5O_CONVERT_ARGB_1555_TO_RGBA_8888(x) \ ((_al_rgb_scale_1[((x) & 0x8000) >> 15] ) /* A */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] << 8) /* B */ | \ (_al_rgb_scale_5[((x) & 0x03e0) >> 5] << 16) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] << 24) /* R */) -#define ALLEGRO_CONVERT_ARGB_1555_TO_ARGB_4444(x) \ +#define A5O_CONVERT_ARGB_1555_TO_ARGB_4444(x) \ (((x) & 0x8000) /* A */ | \ (((x) & 0x001e) >> 1) /* B */ | \ (((x) & 0x03c0) >> 2) /* G */ | \ (((x) & 0x7800) >> 3) /* R */) -#define ALLEGRO_CONVERT_ARGB_1555_TO_RGB_888(x) \ +#define A5O_CONVERT_ARGB_1555_TO_RGB_888(x) \ ((_al_rgb_scale_5[((x) & 0x001f) >> 0] ) /* B */ | \ (_al_rgb_scale_5[((x) & 0x03e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] << 16) /* R */) -#define ALLEGRO_CONVERT_ARGB_1555_TO_RGB_565(x) \ +#define A5O_CONVERT_ARGB_1555_TO_RGB_565(x) \ (((x) & 0x001f) /* B */ | \ (((x) & 0x7fe0) << 1) /* GR */) -#define ALLEGRO_CONVERT_ARGB_1555_TO_RGB_555(x) \ +#define A5O_CONVERT_ARGB_1555_TO_RGB_555(x) \ (((x) & 0x7fff) /* BGR */) -#define ALLEGRO_CONVERT_ARGB_1555_TO_RGBA_5551(x) \ +#define A5O_CONVERT_ARGB_1555_TO_RGBA_5551(x) \ ((((x) & 0x8000) >> 15) /* A */ | \ (((x) & 0x7fff) << 1) /* BGR */) -#define ALLEGRO_CONVERT_ARGB_1555_TO_ABGR_8888(x) \ +#define A5O_CONVERT_ARGB_1555_TO_ABGR_8888(x) \ ((_al_rgb_scale_1[((x) & 0x8000) >> 15] << 24) /* A */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] << 16) /* B */ | \ (_al_rgb_scale_5[((x) & 0x03e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] ) /* R */) -#define ALLEGRO_CONVERT_ARGB_1555_TO_XBGR_8888(x) \ +#define A5O_CONVERT_ARGB_1555_TO_XBGR_8888(x) \ ((_al_rgb_scale_5[((x) & 0x001f) >> 0] << 16) /* B */ | \ (_al_rgb_scale_5[((x) & 0x03e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] ) /* R */) -#define ALLEGRO_CONVERT_ARGB_1555_TO_BGR_888(x) \ +#define A5O_CONVERT_ARGB_1555_TO_BGR_888(x) \ ((_al_rgb_scale_5[((x) & 0x001f) >> 0] << 16) /* B */ | \ (_al_rgb_scale_5[((x) & 0x03e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] ) /* R */) -#define ALLEGRO_CONVERT_ARGB_1555_TO_BGR_565(x) \ +#define A5O_CONVERT_ARGB_1555_TO_BGR_565(x) \ ((((x) & 0x001f) << 11) /* B */ | \ (((x) & 0x03e0) << 1) /* G */ | \ (((x) & 0x7c00) >> 10) /* R */) -#define ALLEGRO_CONVERT_ARGB_1555_TO_BGR_555(x) \ +#define A5O_CONVERT_ARGB_1555_TO_BGR_555(x) \ ((((x) & 0x001f) << 10) /* B */ | \ ((x) & 0x03e0) /* G */ | \ (((x) & 0x7c00) >> 10) /* R */) -#define ALLEGRO_CONVERT_ARGB_1555_TO_RGBX_8888(x) \ +#define A5O_CONVERT_ARGB_1555_TO_RGBX_8888(x) \ ((_al_rgb_scale_5[((x) & 0x001f) >> 0] << 8) /* B */ | \ (_al_rgb_scale_5[((x) & 0x03e0) >> 5] << 16) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] << 24) /* R */) -#define ALLEGRO_CONVERT_ARGB_1555_TO_XRGB_8888(x) \ +#define A5O_CONVERT_ARGB_1555_TO_XRGB_8888(x) \ ((_al_rgb_scale_5[((x) & 0x001f) >> 0] ) /* B */ | \ (_al_rgb_scale_5[((x) & 0x03e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] << 16) /* R */) -#define ALLEGRO_CONVERT_ARGB_1555_TO_ABGR_F32(x) \ +#define A5O_CONVERT_ARGB_1555_TO_ABGR_F32(x) \ al_map_rgba(_al_rgb_scale_5[((x) >> 10) & 31],\ _al_rgb_scale_5[((x) >> 5) & 31],\ _al_rgb_scale_5[((x) >> 0) & 31],\ _al_rgb_scale_1[((x) >> 15) & 1]) -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ARGB_1555_TO_ABGR_8888_LE(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ARGB_1555_TO_ABGR_8888_LE(x) \ ((_al_rgb_scale_1[((x) & 0x8000) >> 15] ) /* A */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] << 8) /* B */ | \ (_al_rgb_scale_5[((x) & 0x03e0) >> 5] << 16) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] << 24) /* R */) #else -#define ALLEGRO_CONVERT_ARGB_1555_TO_ABGR_8888_LE(x) \ +#define A5O_CONVERT_ARGB_1555_TO_ABGR_8888_LE(x) \ ((_al_rgb_scale_1[((x) & 0x8000) >> 15] << 24) /* A */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] << 16) /* B */ | \ (_al_rgb_scale_5[((x) & 0x03e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] ) /* R */) #endif -#define ALLEGRO_CONVERT_ARGB_1555_TO_RGBA_4444(x) \ +#define A5O_CONVERT_ARGB_1555_TO_RGBA_4444(x) \ ((((x) & 0x8000) >> 12) /* A */ | \ (((x) & 0x001e) << 3) /* B */ | \ (((x) & 0x03c0) << 2) /* G */ | \ (((x) & 0x7800) << 1) /* R */) -#define ALLEGRO_CONVERT_ARGB_1555_TO_SINGLE_CHANNEL_8(x) \ +#define A5O_CONVERT_ARGB_1555_TO_SINGLE_CHANNEL_8(x) \ (_al_rgb_scale_5[(((x) >> 10) & 0x1f)]) -#define ALLEGRO_CONVERT_ABGR_8888_TO_ARGB_8888(x) \ +#define A5O_CONVERT_ABGR_8888_TO_ARGB_8888(x) \ ((((x) & 0x00ff0000) >> 16) /* B */ | \ (((x) & 0x000000ff) << 16) /* R */ | \ ((x) & 0xff00ff00) /* AG */) -#define ALLEGRO_CONVERT_ABGR_8888_TO_RGBA_8888(x) \ +#define A5O_CONVERT_ABGR_8888_TO_RGBA_8888(x) \ ((((x) & 0xff000000) >> 24) /* A */ | \ (((x) & 0x00ff0000) >> 8) /* B */ | \ (((x) & 0x0000ff00) << 8) /* G */ | \ (((x) & 0x000000ff) << 24) /* R */) -#define ALLEGRO_CONVERT_ABGR_8888_TO_ARGB_4444(x) \ +#define A5O_CONVERT_ABGR_8888_TO_ARGB_4444(x) \ ((((x) & 0xf0000000) >> 16) /* A */ | \ (((x) & 0x00f00000) >> 20) /* B */ | \ (((x) & 0x0000f000) >> 8) /* G */ | \ (((x) & 0x000000f0) << 4) /* R */) -#define ALLEGRO_CONVERT_ABGR_8888_TO_RGB_888(x) \ +#define A5O_CONVERT_ABGR_8888_TO_RGB_888(x) \ ((((x) & 0x00ff0000) >> 16) /* B */ | \ ((x) & 0x0000ff00) /* G */ | \ (((x) & 0x000000ff) << 16) /* R */) -#define ALLEGRO_CONVERT_ABGR_8888_TO_RGB_565(x) \ +#define A5O_CONVERT_ABGR_8888_TO_RGB_565(x) \ ((((x) & 0x00f80000) >> 19) /* B */ | \ (((x) & 0x0000fc00) >> 5) /* G */ | \ (((x) & 0x000000f8) << 8) /* R */) -#define ALLEGRO_CONVERT_ABGR_8888_TO_RGB_555(x) \ +#define A5O_CONVERT_ABGR_8888_TO_RGB_555(x) \ ((((x) & 0x00f80000) >> 19) /* B */ | \ (((x) & 0x0000f800) >> 6) /* G */ | \ (((x) & 0x000000f8) << 7) /* R */) -#define ALLEGRO_CONVERT_ABGR_8888_TO_RGBA_5551(x) \ +#define A5O_CONVERT_ABGR_8888_TO_RGBA_5551(x) \ ((((x) & 0x80000000) >> 31) /* A */ | \ (((x) & 0x00f80000) >> 18) /* B */ | \ (((x) & 0x0000f800) >> 5) /* G */ | \ (((x) & 0x000000f8) << 8) /* R */) -#define ALLEGRO_CONVERT_ABGR_8888_TO_ARGB_1555(x) \ +#define A5O_CONVERT_ABGR_8888_TO_ARGB_1555(x) \ ((((x) & 0x80000000) >> 16) /* A */ | \ (((x) & 0x00f80000) >> 19) /* B */ | \ (((x) & 0x0000f800) >> 6) /* G */ | \ (((x) & 0x000000f8) << 7) /* R */) -#define ALLEGRO_CONVERT_ABGR_8888_TO_XBGR_8888(x) \ +#define A5O_CONVERT_ABGR_8888_TO_XBGR_8888(x) \ (((x) & 0x00ffffff) /* BGR */) -#define ALLEGRO_CONVERT_ABGR_8888_TO_BGR_888(x) \ +#define A5O_CONVERT_ABGR_8888_TO_BGR_888(x) \ (((x) & 0x00ffffff) /* BGR */) -#define ALLEGRO_CONVERT_ABGR_8888_TO_BGR_565(x) \ +#define A5O_CONVERT_ABGR_8888_TO_BGR_565(x) \ ((((x) & 0x00f80000) >> 8) /* B */ | \ (((x) & 0x0000fc00) >> 5) /* G */ | \ (((x) & 0x000000f8) >> 3) /* R */) -#define ALLEGRO_CONVERT_ABGR_8888_TO_BGR_555(x) \ +#define A5O_CONVERT_ABGR_8888_TO_BGR_555(x) \ ((((x) & 0x00f80000) >> 9) /* B */ | \ (((x) & 0x0000f800) >> 6) /* G */ | \ (((x) & 0x000000f8) >> 3) /* R */) -#define ALLEGRO_CONVERT_ABGR_8888_TO_RGBX_8888(x) \ +#define A5O_CONVERT_ABGR_8888_TO_RGBX_8888(x) \ ((((x) & 0x00ff0000) >> 8) /* B */ | \ (((x) & 0x0000ff00) << 8) /* G */ | \ (((x) & 0x000000ff) << 24) /* R */) -#define ALLEGRO_CONVERT_ABGR_8888_TO_XRGB_8888(x) \ +#define A5O_CONVERT_ABGR_8888_TO_XRGB_8888(x) \ ((((x) & 0x00ff0000) >> 16) /* B */ | \ ((x) & 0x0000ff00) /* G */ | \ (((x) & 0x000000ff) << 16) /* R */) -#define ALLEGRO_CONVERT_ABGR_8888_TO_ABGR_F32(x) \ +#define A5O_CONVERT_ABGR_8888_TO_ABGR_F32(x) \ al_map_rgba(((x) >> 0) & 255,\ ((x) >> 8) & 255,\ ((x) >> 16) & 255,\ ((x) >> 24) & 255) -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_8888_TO_ABGR_8888_LE(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_8888_TO_ABGR_8888_LE(x) \ ((((x) & 0xff000000) >> 24) /* A */ | \ (((x) & 0x00ff0000) >> 8) /* B */ | \ (((x) & 0x0000ff00) << 8) /* G */ | \ (((x) & 0x000000ff) << 24) /* R */) #else -#define ALLEGRO_CONVERT_ABGR_8888_TO_ABGR_8888_LE(x) \ +#define A5O_CONVERT_ABGR_8888_TO_ABGR_8888_LE(x) \ (((x) & 0xffffffff) /* ABGR */) #endif -#define ALLEGRO_CONVERT_ABGR_8888_TO_RGBA_4444(x) \ +#define A5O_CONVERT_ABGR_8888_TO_RGBA_4444(x) \ ((((x) & 0xf0000000) >> 28) /* A */ | \ (((x) & 0x00f00000) >> 16) /* B */ | \ (((x) & 0x0000f000) >> 4) /* G */ | \ (((x) & 0x000000f0) << 8) /* R */) -#define ALLEGRO_CONVERT_ABGR_8888_TO_SINGLE_CHANNEL_8(x) \ +#define A5O_CONVERT_ABGR_8888_TO_SINGLE_CHANNEL_8(x) \ (((x) >> 0) & 0xff) -#define ALLEGRO_CONVERT_XBGR_8888_TO_ARGB_8888(x) \ +#define A5O_CONVERT_XBGR_8888_TO_ARGB_8888(x) \ ((0xff000000) /* A */ | \ (((x) & 0x00ff0000) >> 16) /* B */ | \ ((x) & 0x0000ff00) /* G */ | \ (((x) & 0x000000ff) << 16) /* R */) -#define ALLEGRO_CONVERT_XBGR_8888_TO_RGBA_8888(x) \ +#define A5O_CONVERT_XBGR_8888_TO_RGBA_8888(x) \ ((0x000000ff) /* A */ | \ (((x) & 0x00ff0000) >> 8) /* B */ | \ (((x) & 0x0000ff00) << 8) /* G */ | \ (((x) & 0x000000ff) << 24) /* R */) -#define ALLEGRO_CONVERT_XBGR_8888_TO_ARGB_4444(x) \ +#define A5O_CONVERT_XBGR_8888_TO_ARGB_4444(x) \ ((0xf000) /* A */ | \ (((x) & 0x00f00000) >> 20) /* B */ | \ (((x) & 0x0000f000) >> 8) /* G */ | \ (((x) & 0x000000f0) << 4) /* R */) -#define ALLEGRO_CONVERT_XBGR_8888_TO_RGB_888(x) \ +#define A5O_CONVERT_XBGR_8888_TO_RGB_888(x) \ ((((x) & 0x00ff0000) >> 16) /* B */ | \ ((x) & 0x0000ff00) /* G */ | \ (((x) & 0x000000ff) << 16) /* R */) -#define ALLEGRO_CONVERT_XBGR_8888_TO_RGB_565(x) \ +#define A5O_CONVERT_XBGR_8888_TO_RGB_565(x) \ ((((x) & 0x00f80000) >> 19) /* B */ | \ (((x) & 0x0000fc00) >> 5) /* G */ | \ (((x) & 0x000000f8) << 8) /* R */) -#define ALLEGRO_CONVERT_XBGR_8888_TO_RGB_555(x) \ +#define A5O_CONVERT_XBGR_8888_TO_RGB_555(x) \ ((((x) & 0x00f80000) >> 19) /* B */ | \ (((x) & 0x0000f800) >> 6) /* G */ | \ (((x) & 0x000000f8) << 7) /* R */) -#define ALLEGRO_CONVERT_XBGR_8888_TO_RGBA_5551(x) \ +#define A5O_CONVERT_XBGR_8888_TO_RGBA_5551(x) \ ((0x0001) /* A */ | \ (((x) & 0x00f80000) >> 18) /* B */ | \ (((x) & 0x0000f800) >> 5) /* G */ | \ (((x) & 0x000000f8) << 8) /* R */) -#define ALLEGRO_CONVERT_XBGR_8888_TO_ARGB_1555(x) \ +#define A5O_CONVERT_XBGR_8888_TO_ARGB_1555(x) \ ((0x8000) /* A */ | \ (((x) & 0x00f80000) >> 19) /* B */ | \ (((x) & 0x0000f800) >> 6) /* G */ | \ (((x) & 0x000000f8) << 7) /* R */) -#define ALLEGRO_CONVERT_XBGR_8888_TO_ABGR_8888(x) \ +#define A5O_CONVERT_XBGR_8888_TO_ABGR_8888(x) \ ((0xff000000) /* A */ | \ ((x) & 0x00ffffff) /* BGR */) -#define ALLEGRO_CONVERT_XBGR_8888_TO_BGR_888(x) \ +#define A5O_CONVERT_XBGR_8888_TO_BGR_888(x) \ (((x) & 0x00ffffff) /* BGR */) -#define ALLEGRO_CONVERT_XBGR_8888_TO_BGR_565(x) \ +#define A5O_CONVERT_XBGR_8888_TO_BGR_565(x) \ ((((x) & 0x00f80000) >> 8) /* B */ | \ (((x) & 0x0000fc00) >> 5) /* G */ | \ (((x) & 0x000000f8) >> 3) /* R */) -#define ALLEGRO_CONVERT_XBGR_8888_TO_BGR_555(x) \ +#define A5O_CONVERT_XBGR_8888_TO_BGR_555(x) \ ((((x) & 0x00f80000) >> 9) /* B */ | \ (((x) & 0x0000f800) >> 6) /* G */ | \ (((x) & 0x000000f8) >> 3) /* R */) -#define ALLEGRO_CONVERT_XBGR_8888_TO_RGBX_8888(x) \ +#define A5O_CONVERT_XBGR_8888_TO_RGBX_8888(x) \ ((((x) & 0x00ff0000) >> 8) /* B */ | \ (((x) & 0x0000ff00) << 8) /* G */ | \ (((x) & 0x000000ff) << 24) /* R */) -#define ALLEGRO_CONVERT_XBGR_8888_TO_XRGB_8888(x) \ +#define A5O_CONVERT_XBGR_8888_TO_XRGB_8888(x) \ ((((x) & 0x00ff0000) >> 16) /* B */ | \ ((x) & 0x0000ff00) /* G */ | \ (((x) & 0x000000ff) << 16) /* R */) -#define ALLEGRO_CONVERT_XBGR_8888_TO_ABGR_F32(x) \ +#define A5O_CONVERT_XBGR_8888_TO_ABGR_F32(x) \ al_map_rgb(((x) >> 0) & 255,\ ((x) >> 8) & 255,\ ((x) >> 16) & 255) -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_XBGR_8888_TO_ABGR_8888_LE(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_XBGR_8888_TO_ABGR_8888_LE(x) \ ((0x000000ff) /* A */ | \ (((x) & 0x00ff0000) >> 8) /* B */ | \ (((x) & 0x0000ff00) << 8) /* G */ | \ (((x) & 0x000000ff) << 24) /* R */) #else -#define ALLEGRO_CONVERT_XBGR_8888_TO_ABGR_8888_LE(x) \ +#define A5O_CONVERT_XBGR_8888_TO_ABGR_8888_LE(x) \ ((0xff000000) /* A */ | \ ((x) & 0x00ffffff) /* BGR */) #endif -#define ALLEGRO_CONVERT_XBGR_8888_TO_RGBA_4444(x) \ +#define A5O_CONVERT_XBGR_8888_TO_RGBA_4444(x) \ ((0x000f) /* A */ | \ (((x) & 0x00f00000) >> 16) /* B */ | \ (((x) & 0x0000f000) >> 4) /* G */ | \ (((x) & 0x000000f0) << 8) /* R */) -#define ALLEGRO_CONVERT_XBGR_8888_TO_SINGLE_CHANNEL_8(x) \ +#define A5O_CONVERT_XBGR_8888_TO_SINGLE_CHANNEL_8(x) \ (((x) >> 0) & 0xff) -#define ALLEGRO_CONVERT_BGR_888_TO_ARGB_8888(x) \ +#define A5O_CONVERT_BGR_888_TO_ARGB_8888(x) \ ((0xff000000) /* A */ | \ (((x) & 0xff0000) >> 16) /* B */ | \ ((x) & 0x00ff00) /* G */ | \ (((x) & 0x0000ff) << 16) /* R */) -#define ALLEGRO_CONVERT_BGR_888_TO_RGBA_8888(x) \ +#define A5O_CONVERT_BGR_888_TO_RGBA_8888(x) \ ((0x000000ff) /* A */ | \ (((x) & 0xff0000) >> 8) /* B */ | \ (((x) & 0x00ff00) << 8) /* G */ | \ (((x) & 0x0000ff) << 24) /* R */) -#define ALLEGRO_CONVERT_BGR_888_TO_ARGB_4444(x) \ +#define A5O_CONVERT_BGR_888_TO_ARGB_4444(x) \ ((0xf000) /* A */ | \ (((x) & 0xf00000) >> 20) /* B */ | \ (((x) & 0x00f000) >> 8) /* G */ | \ (((x) & 0x0000f0) << 4) /* R */) -#define ALLEGRO_CONVERT_BGR_888_TO_RGB_888(x) \ +#define A5O_CONVERT_BGR_888_TO_RGB_888(x) \ ((((x) & 0xff0000) >> 16) /* B */ | \ ((x) & 0x00ff00) /* G */ | \ (((x) & 0x0000ff) << 16) /* R */) -#define ALLEGRO_CONVERT_BGR_888_TO_RGB_565(x) \ +#define A5O_CONVERT_BGR_888_TO_RGB_565(x) \ ((((x) & 0xf80000) >> 19) /* B */ | \ (((x) & 0x00fc00) >> 5) /* G */ | \ (((x) & 0x0000f8) << 8) /* R */) -#define ALLEGRO_CONVERT_BGR_888_TO_RGB_555(x) \ +#define A5O_CONVERT_BGR_888_TO_RGB_555(x) \ ((((x) & 0xf80000) >> 19) /* B */ | \ (((x) & 0x00f800) >> 6) /* G */ | \ (((x) & 0x0000f8) << 7) /* R */) -#define ALLEGRO_CONVERT_BGR_888_TO_RGBA_5551(x) \ +#define A5O_CONVERT_BGR_888_TO_RGBA_5551(x) \ ((0x0001) /* A */ | \ (((x) & 0xf80000) >> 18) /* B */ | \ (((x) & 0x00f800) >> 5) /* G */ | \ (((x) & 0x0000f8) << 8) /* R */) -#define ALLEGRO_CONVERT_BGR_888_TO_ARGB_1555(x) \ +#define A5O_CONVERT_BGR_888_TO_ARGB_1555(x) \ ((0x8000) /* A */ | \ (((x) & 0xf80000) >> 19) /* B */ | \ (((x) & 0x00f800) >> 6) /* G */ | \ (((x) & 0x0000f8) << 7) /* R */) -#define ALLEGRO_CONVERT_BGR_888_TO_ABGR_8888(x) \ +#define A5O_CONVERT_BGR_888_TO_ABGR_8888(x) \ ((0xff000000) /* A */ | \ ((x) & 0xffffff) /* BGR */) -#define ALLEGRO_CONVERT_BGR_888_TO_XBGR_8888(x) \ +#define A5O_CONVERT_BGR_888_TO_XBGR_8888(x) \ (((x) & 0xffffff) /* BGR */) -#define ALLEGRO_CONVERT_BGR_888_TO_BGR_565(x) \ +#define A5O_CONVERT_BGR_888_TO_BGR_565(x) \ ((((x) & 0xf80000) >> 8) /* B */ | \ (((x) & 0x00fc00) >> 5) /* G */ | \ (((x) & 0x0000f8) >> 3) /* R */) -#define ALLEGRO_CONVERT_BGR_888_TO_BGR_555(x) \ +#define A5O_CONVERT_BGR_888_TO_BGR_555(x) \ ((((x) & 0xf80000) >> 9) /* B */ | \ (((x) & 0x00f800) >> 6) /* G */ | \ (((x) & 0x0000f8) >> 3) /* R */) -#define ALLEGRO_CONVERT_BGR_888_TO_RGBX_8888(x) \ +#define A5O_CONVERT_BGR_888_TO_RGBX_8888(x) \ ((((x) & 0xff0000) >> 8) /* B */ | \ (((x) & 0x00ff00) << 8) /* G */ | \ (((x) & 0x0000ff) << 24) /* R */) -#define ALLEGRO_CONVERT_BGR_888_TO_XRGB_8888(x) \ +#define A5O_CONVERT_BGR_888_TO_XRGB_8888(x) \ ((((x) & 0xff0000) >> 16) /* B */ | \ ((x) & 0x00ff00) /* G */ | \ (((x) & 0x0000ff) << 16) /* R */) -#define ALLEGRO_CONVERT_BGR_888_TO_ABGR_F32(x) \ +#define A5O_CONVERT_BGR_888_TO_ABGR_F32(x) \ al_map_rgb(((x) >> 0) & 255,\ ((x) >> 8) & 255,\ ((x) >> 16) & 255) -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_BGR_888_TO_ABGR_8888_LE(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_BGR_888_TO_ABGR_8888_LE(x) \ ((0x000000ff) /* A */ | \ (((x) & 0xff0000) >> 8) /* B */ | \ (((x) & 0x00ff00) << 8) /* G */ | \ (((x) & 0x0000ff) << 24) /* R */) #else -#define ALLEGRO_CONVERT_BGR_888_TO_ABGR_8888_LE(x) \ +#define A5O_CONVERT_BGR_888_TO_ABGR_8888_LE(x) \ ((0xff000000) /* A */ | \ ((x) & 0xffffff) /* BGR */) #endif -#define ALLEGRO_CONVERT_BGR_888_TO_RGBA_4444(x) \ +#define A5O_CONVERT_BGR_888_TO_RGBA_4444(x) \ ((0x000f) /* A */ | \ (((x) & 0xf00000) >> 16) /* B */ | \ (((x) & 0x00f000) >> 4) /* G */ | \ (((x) & 0x0000f0) << 8) /* R */) -#define ALLEGRO_CONVERT_BGR_888_TO_SINGLE_CHANNEL_8(x) \ +#define A5O_CONVERT_BGR_888_TO_SINGLE_CHANNEL_8(x) \ (((x) >> 0) & 0xff) -#define ALLEGRO_CONVERT_BGR_565_TO_ARGB_8888(x) \ +#define A5O_CONVERT_BGR_565_TO_ARGB_8888(x) \ ((0xff000000) /* A */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] ) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] << 16) /* R */) -#define ALLEGRO_CONVERT_BGR_565_TO_RGBA_8888(x) \ +#define A5O_CONVERT_BGR_565_TO_RGBA_8888(x) \ ((0x000000ff) /* A */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] << 8) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 16) /* G */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] << 24) /* R */) -#define ALLEGRO_CONVERT_BGR_565_TO_ARGB_4444(x) \ +#define A5O_CONVERT_BGR_565_TO_ARGB_4444(x) \ ((0xf000) /* A */ | \ (((x) & 0xf000) >> 12) /* B */ | \ (((x) & 0x0780) >> 3) /* G */ | \ (((x) & 0x001e) << 7) /* R */) -#define ALLEGRO_CONVERT_BGR_565_TO_RGB_888(x) \ +#define A5O_CONVERT_BGR_565_TO_RGB_888(x) \ ((_al_rgb_scale_5[((x) & 0xf800) >> 11] ) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] << 16) /* R */) -#define ALLEGRO_CONVERT_BGR_565_TO_RGB_565(x) \ +#define A5O_CONVERT_BGR_565_TO_RGB_565(x) \ ((((x) & 0xf800) >> 11) /* B */ | \ ((x) & 0x07e0) /* G */ | \ (((x) & 0x001f) << 11) /* R */) -#define ALLEGRO_CONVERT_BGR_565_TO_RGB_555(x) \ +#define A5O_CONVERT_BGR_565_TO_RGB_555(x) \ ((((x) & 0xf800) >> 11) /* B */ | \ (((x) & 0x07c0) >> 1) /* G */ | \ (((x) & 0x001f) << 10) /* R */) -#define ALLEGRO_CONVERT_BGR_565_TO_RGBA_5551(x) \ +#define A5O_CONVERT_BGR_565_TO_RGBA_5551(x) \ ((0x0001) /* A */ | \ (((x) & 0xf800) >> 10) /* B */ | \ ((x) & 0x07c0) /* G */ | \ (((x) & 0x001f) << 11) /* R */) -#define ALLEGRO_CONVERT_BGR_565_TO_ARGB_1555(x) \ +#define A5O_CONVERT_BGR_565_TO_ARGB_1555(x) \ ((0x8000) /* A */ | \ (((x) & 0xf800) >> 11) /* B */ | \ (((x) & 0x07c0) >> 1) /* G */ | \ (((x) & 0x001f) << 10) /* R */) -#define ALLEGRO_CONVERT_BGR_565_TO_ABGR_8888(x) \ +#define A5O_CONVERT_BGR_565_TO_ABGR_8888(x) \ ((0xff000000) /* A */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] << 16) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] ) /* R */) -#define ALLEGRO_CONVERT_BGR_565_TO_XBGR_8888(x) \ +#define A5O_CONVERT_BGR_565_TO_XBGR_8888(x) \ ((_al_rgb_scale_5[((x) & 0xf800) >> 11] << 16) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] ) /* R */) -#define ALLEGRO_CONVERT_BGR_565_TO_BGR_888(x) \ +#define A5O_CONVERT_BGR_565_TO_BGR_888(x) \ ((_al_rgb_scale_5[((x) & 0xf800) >> 11] << 16) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] ) /* R */) -#define ALLEGRO_CONVERT_BGR_565_TO_BGR_555(x) \ +#define A5O_CONVERT_BGR_565_TO_BGR_555(x) \ (((x) & 0x001f) /* R */ | \ (((x) & 0xffc0) >> 1) /* BG */) -#define ALLEGRO_CONVERT_BGR_565_TO_RGBX_8888(x) \ +#define A5O_CONVERT_BGR_565_TO_RGBX_8888(x) \ ((_al_rgb_scale_5[((x) & 0xf800) >> 11] << 8) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 16) /* G */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] << 24) /* R */) -#define ALLEGRO_CONVERT_BGR_565_TO_XRGB_8888(x) \ +#define A5O_CONVERT_BGR_565_TO_XRGB_8888(x) \ ((_al_rgb_scale_5[((x) & 0xf800) >> 11] ) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] << 16) /* R */) -#define ALLEGRO_CONVERT_BGR_565_TO_ABGR_F32(x) \ +#define A5O_CONVERT_BGR_565_TO_ABGR_F32(x) \ al_map_rgb(_al_rgb_scale_5[((x) >> 0) & 31],\ _al_rgb_scale_6[((x) >> 5) & 63],\ _al_rgb_scale_5[((x) >> 11) & 31]) -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_BGR_565_TO_ABGR_8888_LE(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_BGR_565_TO_ABGR_8888_LE(x) \ ((0x000000ff) /* A */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] << 8) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 16) /* G */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] << 24) /* R */) #else -#define ALLEGRO_CONVERT_BGR_565_TO_ABGR_8888_LE(x) \ +#define A5O_CONVERT_BGR_565_TO_ABGR_8888_LE(x) \ ((0xff000000) /* A */ | \ (_al_rgb_scale_5[((x) & 0xf800) >> 11] << 16) /* B */ | \ (_al_rgb_scale_6[((x) & 0x07e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x001f) >> 0] ) /* R */) #endif -#define ALLEGRO_CONVERT_BGR_565_TO_RGBA_4444(x) \ +#define A5O_CONVERT_BGR_565_TO_RGBA_4444(x) \ ((0x000f) /* A */ | \ (((x) & 0xf000) >> 8) /* B */ | \ (((x) & 0x0780) << 1) /* G */ | \ (((x) & 0x001e) << 11) /* R */) -#define ALLEGRO_CONVERT_BGR_565_TO_SINGLE_CHANNEL_8(x) \ +#define A5O_CONVERT_BGR_565_TO_SINGLE_CHANNEL_8(x) \ (_al_rgb_scale_5[(((x) >> 0) & 0x1f)]) -#define ALLEGRO_CONVERT_BGR_555_TO_ARGB_8888(x) \ +#define A5O_CONVERT_BGR_555_TO_ARGB_8888(x) \ ((0xff000000) /* A */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] ) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x01f) >> 0] << 16) /* R */) -#define ALLEGRO_CONVERT_BGR_555_TO_RGBA_8888(x) \ +#define A5O_CONVERT_BGR_555_TO_RGBA_8888(x) \ ((0x000000ff) /* A */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] << 8) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 16) /* G */ | \ (_al_rgb_scale_5[((x) & 0x01f) >> 0] << 24) /* R */) -#define ALLEGRO_CONVERT_BGR_555_TO_ARGB_4444(x) \ +#define A5O_CONVERT_BGR_555_TO_ARGB_4444(x) \ ((0xf000) /* A */ | \ (((x) & 0x7800) >> 11) /* B */ | \ (((x) & 0x3c0) >> 2) /* G */ | \ (((x) & 0x01e) << 7) /* R */) -#define ALLEGRO_CONVERT_BGR_555_TO_RGB_888(x) \ +#define A5O_CONVERT_BGR_555_TO_RGB_888(x) \ ((_al_rgb_scale_5[((x) & 0x7c00) >> 10] ) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x01f) >> 0] << 16) /* R */) -#define ALLEGRO_CONVERT_BGR_555_TO_RGB_565(x) \ +#define A5O_CONVERT_BGR_555_TO_RGB_565(x) \ ((((x) & 0x7c00) >> 10) /* B */ | \ (((x) & 0x3e0) << 1) /* G */ | \ (((x) & 0x01f) << 11) /* R */) -#define ALLEGRO_CONVERT_BGR_555_TO_RGB_555(x) \ +#define A5O_CONVERT_BGR_555_TO_RGB_555(x) \ ((((x) & 0x7c00) >> 10) /* B */ | \ ((x) & 0x3e0) /* G */ | \ (((x) & 0x01f) << 10) /* R */) -#define ALLEGRO_CONVERT_BGR_555_TO_RGBA_5551(x) \ +#define A5O_CONVERT_BGR_555_TO_RGBA_5551(x) \ ((0x0001) /* A */ | \ (((x) & 0x7c00) >> 9) /* B */ | \ (((x) & 0x3e0) << 1) /* G */ | \ (((x) & 0x01f) << 11) /* R */) -#define ALLEGRO_CONVERT_BGR_555_TO_ARGB_1555(x) \ +#define A5O_CONVERT_BGR_555_TO_ARGB_1555(x) \ ((0x8000) /* A */ | \ (((x) & 0x7c00) >> 10) /* B */ | \ ((x) & 0x3e0) /* G */ | \ (((x) & 0x01f) << 10) /* R */) -#define ALLEGRO_CONVERT_BGR_555_TO_ABGR_8888(x) \ +#define A5O_CONVERT_BGR_555_TO_ABGR_8888(x) \ ((0xff000000) /* A */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] << 16) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x01f) >> 0] ) /* R */) -#define ALLEGRO_CONVERT_BGR_555_TO_XBGR_8888(x) \ +#define A5O_CONVERT_BGR_555_TO_XBGR_8888(x) \ ((_al_rgb_scale_5[((x) & 0x7c00) >> 10] << 16) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x01f) >> 0] ) /* R */) -#define ALLEGRO_CONVERT_BGR_555_TO_BGR_888(x) \ +#define A5O_CONVERT_BGR_555_TO_BGR_888(x) \ ((_al_rgb_scale_5[((x) & 0x7c00) >> 10] << 16) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x01f) >> 0] ) /* R */) -#define ALLEGRO_CONVERT_BGR_555_TO_BGR_565(x) \ +#define A5O_CONVERT_BGR_555_TO_BGR_565(x) \ (((x) & 0x01f) /* R */ | \ (((x) & 0x7fe0) << 1) /* BG */) -#define ALLEGRO_CONVERT_BGR_555_TO_RGBX_8888(x) \ +#define A5O_CONVERT_BGR_555_TO_RGBX_8888(x) \ ((_al_rgb_scale_5[((x) & 0x7c00) >> 10] << 8) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 16) /* G */ | \ (_al_rgb_scale_5[((x) & 0x01f) >> 0] << 24) /* R */) -#define ALLEGRO_CONVERT_BGR_555_TO_XRGB_8888(x) \ +#define A5O_CONVERT_BGR_555_TO_XRGB_8888(x) \ ((_al_rgb_scale_5[((x) & 0x7c00) >> 10] ) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x01f) >> 0] << 16) /* R */) -#define ALLEGRO_CONVERT_BGR_555_TO_ABGR_F32(x) \ +#define A5O_CONVERT_BGR_555_TO_ABGR_F32(x) \ al_map_rgb(_al_rgb_scale_5[((x) >> 0) & 31],\ _al_rgb_scale_5[((x) >> 5) & 31],\ _al_rgb_scale_5[((x) >> 10) & 31]) -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_BGR_555_TO_ABGR_8888_LE(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_BGR_555_TO_ABGR_8888_LE(x) \ ((0x000000ff) /* A */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] << 8) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 16) /* G */ | \ (_al_rgb_scale_5[((x) & 0x01f) >> 0] << 24) /* R */) #else -#define ALLEGRO_CONVERT_BGR_555_TO_ABGR_8888_LE(x) \ +#define A5O_CONVERT_BGR_555_TO_ABGR_8888_LE(x) \ ((0xff000000) /* A */ | \ (_al_rgb_scale_5[((x) & 0x7c00) >> 10] << 16) /* B */ | \ (_al_rgb_scale_5[((x) & 0x3e0) >> 5] << 8) /* G */ | \ (_al_rgb_scale_5[((x) & 0x01f) >> 0] ) /* R */) #endif -#define ALLEGRO_CONVERT_BGR_555_TO_RGBA_4444(x) \ +#define A5O_CONVERT_BGR_555_TO_RGBA_4444(x) \ ((0x000f) /* A */ | \ (((x) & 0x7800) >> 7) /* B */ | \ (((x) & 0x3c0) << 2) /* G */ | \ (((x) & 0x01e) << 11) /* R */) -#define ALLEGRO_CONVERT_BGR_555_TO_SINGLE_CHANNEL_8(x) \ +#define A5O_CONVERT_BGR_555_TO_SINGLE_CHANNEL_8(x) \ (_al_rgb_scale_5[(((x) >> 0) & 0x1f)]) -#define ALLEGRO_CONVERT_RGBX_8888_TO_ARGB_8888(x) \ +#define A5O_CONVERT_RGBX_8888_TO_ARGB_8888(x) \ ((0xff000000) /* A */ | \ (((x) & 0xffffff00) >> 8) /* BGR */) -#define ALLEGRO_CONVERT_RGBX_8888_TO_RGBA_8888(x) \ +#define A5O_CONVERT_RGBX_8888_TO_RGBA_8888(x) \ ((0x000000ff) /* A */ | \ ((x) & 0xffffff00) /* BGR */) -#define ALLEGRO_CONVERT_RGBX_8888_TO_ARGB_4444(x) \ +#define A5O_CONVERT_RGBX_8888_TO_ARGB_4444(x) \ ((0xf000) /* A */ | \ (((x) & 0x0000f000) >> 12) /* B */ | \ (((x) & 0x00f00000) >> 16) /* G */ | \ (((x) & 0xf0000000) >> 20) /* R */) -#define ALLEGRO_CONVERT_RGBX_8888_TO_RGB_888(x) \ +#define A5O_CONVERT_RGBX_8888_TO_RGB_888(x) \ ((((x) & 0xffffff00) >> 8) /* BGR */) -#define ALLEGRO_CONVERT_RGBX_8888_TO_RGB_565(x) \ +#define A5O_CONVERT_RGBX_8888_TO_RGB_565(x) \ ((((x) & 0x0000f800) >> 11) /* B */ | \ (((x) & 0x00fc0000) >> 13) /* G */ | \ (((x) & 0xf8000000) >> 16) /* R */) -#define ALLEGRO_CONVERT_RGBX_8888_TO_RGB_555(x) \ +#define A5O_CONVERT_RGBX_8888_TO_RGB_555(x) \ ((((x) & 0x0000f800) >> 11) /* B */ | \ (((x) & 0x00f80000) >> 14) /* G */ | \ (((x) & 0xf8000000) >> 17) /* R */) -#define ALLEGRO_CONVERT_RGBX_8888_TO_RGBA_5551(x) \ +#define A5O_CONVERT_RGBX_8888_TO_RGBA_5551(x) \ ((0x0001) /* A */ | \ (((x) & 0x0000f800) >> 10) /* B */ | \ (((x) & 0x00f80000) >> 13) /* G */ | \ (((x) & 0xf8000000) >> 16) /* R */) -#define ALLEGRO_CONVERT_RGBX_8888_TO_ARGB_1555(x) \ +#define A5O_CONVERT_RGBX_8888_TO_ARGB_1555(x) \ ((0x8000) /* A */ | \ (((x) & 0x0000f800) >> 11) /* B */ | \ (((x) & 0x00f80000) >> 14) /* G */ | \ (((x) & 0xf8000000) >> 17) /* R */) -#define ALLEGRO_CONVERT_RGBX_8888_TO_ABGR_8888(x) \ +#define A5O_CONVERT_RGBX_8888_TO_ABGR_8888(x) \ ((0xff000000) /* A */ | \ (((x) & 0x0000ff00) << 8) /* B */ | \ (((x) & 0x00ff0000) >> 8) /* G */ | \ (((x) & 0xff000000) >> 24) /* R */) -#define ALLEGRO_CONVERT_RGBX_8888_TO_XBGR_8888(x) \ +#define A5O_CONVERT_RGBX_8888_TO_XBGR_8888(x) \ ((((x) & 0x0000ff00) << 8) /* B */ | \ (((x) & 0x00ff0000) >> 8) /* G */ | \ (((x) & 0xff000000) >> 24) /* R */) -#define ALLEGRO_CONVERT_RGBX_8888_TO_BGR_888(x) \ +#define A5O_CONVERT_RGBX_8888_TO_BGR_888(x) \ ((((x) & 0x0000ff00) << 8) /* B */ | \ (((x) & 0x00ff0000) >> 8) /* G */ | \ (((x) & 0xff000000) >> 24) /* R */) -#define ALLEGRO_CONVERT_RGBX_8888_TO_BGR_565(x) \ +#define A5O_CONVERT_RGBX_8888_TO_BGR_565(x) \ (((x) & 0x0000f800) /* B */ | \ (((x) & 0x00fc0000) >> 13) /* G */ | \ (((x) & 0xf8000000) >> 27) /* R */) -#define ALLEGRO_CONVERT_RGBX_8888_TO_BGR_555(x) \ +#define A5O_CONVERT_RGBX_8888_TO_BGR_555(x) \ ((((x) & 0x0000f800) >> 1) /* B */ | \ (((x) & 0x00f80000) >> 14) /* G */ | \ (((x) & 0xf8000000) >> 27) /* R */) -#define ALLEGRO_CONVERT_RGBX_8888_TO_XRGB_8888(x) \ +#define A5O_CONVERT_RGBX_8888_TO_XRGB_8888(x) \ ((((x) & 0xffffff00) >> 8) /* BGR */) -#define ALLEGRO_CONVERT_RGBX_8888_TO_ABGR_F32(x) \ +#define A5O_CONVERT_RGBX_8888_TO_ABGR_F32(x) \ al_map_rgb(((x) >> 24) & 255,\ ((x) >> 16) & 255,\ ((x) >> 8) & 255) -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_RGBX_8888_TO_ABGR_8888_LE(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_RGBX_8888_TO_ABGR_8888_LE(x) \ ((0x000000ff) /* A */ | \ ((x) & 0xffffff00) /* BGR */) #else -#define ALLEGRO_CONVERT_RGBX_8888_TO_ABGR_8888_LE(x) \ +#define A5O_CONVERT_RGBX_8888_TO_ABGR_8888_LE(x) \ ((0xff000000) /* A */ | \ (((x) & 0x0000ff00) << 8) /* B */ | \ (((x) & 0x00ff0000) >> 8) /* G */ | \ (((x) & 0xff000000) >> 24) /* R */) #endif -#define ALLEGRO_CONVERT_RGBX_8888_TO_RGBA_4444(x) \ +#define A5O_CONVERT_RGBX_8888_TO_RGBA_4444(x) \ ((0x000f) /* A */ | \ (((x) & 0x0000f000) >> 8) /* B */ | \ (((x) & 0x00f00000) >> 12) /* G */ | \ (((x) & 0xf0000000) >> 16) /* R */) -#define ALLEGRO_CONVERT_RGBX_8888_TO_SINGLE_CHANNEL_8(x) \ +#define A5O_CONVERT_RGBX_8888_TO_SINGLE_CHANNEL_8(x) \ (((x) >> 24) & 0xff) -#define ALLEGRO_CONVERT_XRGB_8888_TO_ARGB_8888(x) \ +#define A5O_CONVERT_XRGB_8888_TO_ARGB_8888(x) \ ((0xff000000) /* A */ | \ ((x) & 0x00ffffff) /* BGR */) -#define ALLEGRO_CONVERT_XRGB_8888_TO_RGBA_8888(x) \ +#define A5O_CONVERT_XRGB_8888_TO_RGBA_8888(x) \ ((0x000000ff) /* A */ | \ (((x) & 0x00ffffff) << 8) /* BGR */) -#define ALLEGRO_CONVERT_XRGB_8888_TO_ARGB_4444(x) \ +#define A5O_CONVERT_XRGB_8888_TO_ARGB_4444(x) \ ((0xf000) /* A */ | \ (((x) & 0x000000f0) >> 4) /* B */ | \ (((x) & 0x0000f000) >> 8) /* G */ | \ (((x) & 0x00f00000) >> 12) /* R */) -#define ALLEGRO_CONVERT_XRGB_8888_TO_RGB_888(x) \ +#define A5O_CONVERT_XRGB_8888_TO_RGB_888(x) \ (((x) & 0x00ffffff) /* BGR */) -#define ALLEGRO_CONVERT_XRGB_8888_TO_RGB_565(x) \ +#define A5O_CONVERT_XRGB_8888_TO_RGB_565(x) \ ((((x) & 0x000000f8) >> 3) /* B */ | \ (((x) & 0x0000fc00) >> 5) /* G */ | \ (((x) & 0x00f80000) >> 8) /* R */) -#define ALLEGRO_CONVERT_XRGB_8888_TO_RGB_555(x) \ +#define A5O_CONVERT_XRGB_8888_TO_RGB_555(x) \ ((((x) & 0x000000f8) >> 3) /* B */ | \ (((x) & 0x0000f800) >> 6) /* G */ | \ (((x) & 0x00f80000) >> 9) /* R */) -#define ALLEGRO_CONVERT_XRGB_8888_TO_RGBA_5551(x) \ +#define A5O_CONVERT_XRGB_8888_TO_RGBA_5551(x) \ ((0x0001) /* A */ | \ (((x) & 0x000000f8) >> 2) /* B */ | \ (((x) & 0x0000f800) >> 5) /* G */ | \ (((x) & 0x00f80000) >> 8) /* R */) -#define ALLEGRO_CONVERT_XRGB_8888_TO_ARGB_1555(x) \ +#define A5O_CONVERT_XRGB_8888_TO_ARGB_1555(x) \ ((0x8000) /* A */ | \ (((x) & 0x000000f8) >> 3) /* B */ | \ (((x) & 0x0000f800) >> 6) /* G */ | \ (((x) & 0x00f80000) >> 9) /* R */) -#define ALLEGRO_CONVERT_XRGB_8888_TO_ABGR_8888(x) \ +#define A5O_CONVERT_XRGB_8888_TO_ABGR_8888(x) \ ((0xff000000) /* A */ | \ (((x) & 0x000000ff) << 16) /* B */ | \ ((x) & 0x0000ff00) /* G */ | \ (((x) & 0x00ff0000) >> 16) /* R */) -#define ALLEGRO_CONVERT_XRGB_8888_TO_XBGR_8888(x) \ +#define A5O_CONVERT_XRGB_8888_TO_XBGR_8888(x) \ ((((x) & 0x000000ff) << 16) /* B */ | \ ((x) & 0x0000ff00) /* G */ | \ (((x) & 0x00ff0000) >> 16) /* R */) -#define ALLEGRO_CONVERT_XRGB_8888_TO_BGR_888(x) \ +#define A5O_CONVERT_XRGB_8888_TO_BGR_888(x) \ ((((x) & 0x000000ff) << 16) /* B */ | \ ((x) & 0x0000ff00) /* G */ | \ (((x) & 0x00ff0000) >> 16) /* R */) -#define ALLEGRO_CONVERT_XRGB_8888_TO_BGR_565(x) \ +#define A5O_CONVERT_XRGB_8888_TO_BGR_565(x) \ ((((x) & 0x000000f8) << 8) /* B */ | \ (((x) & 0x0000fc00) >> 5) /* G */ | \ (((x) & 0x00f80000) >> 19) /* R */) -#define ALLEGRO_CONVERT_XRGB_8888_TO_BGR_555(x) \ +#define A5O_CONVERT_XRGB_8888_TO_BGR_555(x) \ ((((x) & 0x000000f8) << 7) /* B */ | \ (((x) & 0x0000f800) >> 6) /* G */ | \ (((x) & 0x00f80000) >> 19) /* R */) -#define ALLEGRO_CONVERT_XRGB_8888_TO_RGBX_8888(x) \ +#define A5O_CONVERT_XRGB_8888_TO_RGBX_8888(x) \ ((((x) & 0x00ffffff) << 8) /* BGR */) -#define ALLEGRO_CONVERT_XRGB_8888_TO_ABGR_F32(x) \ +#define A5O_CONVERT_XRGB_8888_TO_ABGR_F32(x) \ al_map_rgb(((x) >> 16) & 255,\ ((x) >> 8) & 255,\ ((x) >> 0) & 255) -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_XRGB_8888_TO_ABGR_8888_LE(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_XRGB_8888_TO_ABGR_8888_LE(x) \ ((0x000000ff) /* A */ | \ (((x) & 0x00ffffff) << 8) /* BGR */) #else -#define ALLEGRO_CONVERT_XRGB_8888_TO_ABGR_8888_LE(x) \ +#define A5O_CONVERT_XRGB_8888_TO_ABGR_8888_LE(x) \ ((0xff000000) /* A */ | \ (((x) & 0x000000ff) << 16) /* B */ | \ ((x) & 0x0000ff00) /* G */ | \ (((x) & 0x00ff0000) >> 16) /* R */) #endif -#define ALLEGRO_CONVERT_XRGB_8888_TO_RGBA_4444(x) \ +#define A5O_CONVERT_XRGB_8888_TO_RGBA_4444(x) \ ((0x000f) /* A */ | \ ((x) & 0x000000f0) /* B */ | \ (((x) & 0x0000f000) >> 4) /* G */ | \ (((x) & 0x00f00000) >> 8) /* R */) -#define ALLEGRO_CONVERT_XRGB_8888_TO_SINGLE_CHANNEL_8(x) \ +#define A5O_CONVERT_XRGB_8888_TO_SINGLE_CHANNEL_8(x) \ (((x) >> 16) & 0xff) -#define ALLEGRO_CONVERT_ABGR_F32_TO_ARGB_8888(x) \ +#define A5O_CONVERT_ABGR_F32_TO_ARGB_8888(x) \ (((uint32_t)((x).a * 255) << 24) | \ ((uint32_t)((x).b * 255) << 0) | \ ((uint32_t)((x).g * 255) << 8) | \ ((uint32_t)((x).r * 255) << 16)) -#define ALLEGRO_CONVERT_ABGR_F32_TO_RGBA_8888(x) \ +#define A5O_CONVERT_ABGR_F32_TO_RGBA_8888(x) \ (((uint32_t)((x).a * 255) << 0) | \ ((uint32_t)((x).b * 255) << 8) | \ ((uint32_t)((x).g * 255) << 16) | \ ((uint32_t)((x).r * 255) << 24)) -#define ALLEGRO_CONVERT_ABGR_F32_TO_ARGB_4444(x) \ +#define A5O_CONVERT_ABGR_F32_TO_ARGB_4444(x) \ (((uint32_t)((x).a * 15) << 12) | \ ((uint32_t)((x).b * 15) << 0) | \ ((uint32_t)((x).g * 15) << 4) | \ ((uint32_t)((x).r * 15) << 8)) -#define ALLEGRO_CONVERT_ABGR_F32_TO_RGB_888(x) \ +#define A5O_CONVERT_ABGR_F32_TO_RGB_888(x) \ (((uint32_t)((x).b * 255) << 0) | \ ((uint32_t)((x).g * 255) << 8) | \ ((uint32_t)((x).r * 255) << 16)) -#define ALLEGRO_CONVERT_ABGR_F32_TO_RGB_565(x) \ +#define A5O_CONVERT_ABGR_F32_TO_RGB_565(x) \ (((uint32_t)((x).b * 31) << 0) | \ ((uint32_t)((x).g * 63) << 5) | \ ((uint32_t)((x).r * 31) << 11)) -#define ALLEGRO_CONVERT_ABGR_F32_TO_RGB_555(x) \ +#define A5O_CONVERT_ABGR_F32_TO_RGB_555(x) \ (((uint32_t)((x).b * 31) << 0) | \ ((uint32_t)((x).g * 31) << 5) | \ ((uint32_t)((x).r * 31) << 10)) -#define ALLEGRO_CONVERT_ABGR_F32_TO_RGBA_5551(x) \ +#define A5O_CONVERT_ABGR_F32_TO_RGBA_5551(x) \ (((uint32_t)((x).a * 1) << 0) | \ ((uint32_t)((x).b * 31) << 1) | \ ((uint32_t)((x).g * 31) << 6) | \ ((uint32_t)((x).r * 31) << 11)) -#define ALLEGRO_CONVERT_ABGR_F32_TO_ARGB_1555(x) \ +#define A5O_CONVERT_ABGR_F32_TO_ARGB_1555(x) \ (((uint32_t)((x).a * 1) << 15) | \ ((uint32_t)((x).b * 31) << 0) | \ ((uint32_t)((x).g * 31) << 5) | \ ((uint32_t)((x).r * 31) << 10)) -#define ALLEGRO_CONVERT_ABGR_F32_TO_ABGR_8888(x) \ +#define A5O_CONVERT_ABGR_F32_TO_ABGR_8888(x) \ (((uint32_t)((x).a * 255) << 24) | \ ((uint32_t)((x).b * 255) << 16) | \ ((uint32_t)((x).g * 255) << 8) | \ ((uint32_t)((x).r * 255) << 0)) -#define ALLEGRO_CONVERT_ABGR_F32_TO_XBGR_8888(x) \ +#define A5O_CONVERT_ABGR_F32_TO_XBGR_8888(x) \ (((uint32_t)((x).b * 255) << 16) | \ ((uint32_t)((x).g * 255) << 8) | \ ((uint32_t)((x).r * 255) << 0)) -#define ALLEGRO_CONVERT_ABGR_F32_TO_BGR_888(x) \ +#define A5O_CONVERT_ABGR_F32_TO_BGR_888(x) \ (((uint32_t)((x).b * 255) << 16) | \ ((uint32_t)((x).g * 255) << 8) | \ ((uint32_t)((x).r * 255) << 0)) -#define ALLEGRO_CONVERT_ABGR_F32_TO_BGR_565(x) \ +#define A5O_CONVERT_ABGR_F32_TO_BGR_565(x) \ (((uint32_t)((x).b * 31) << 11) | \ ((uint32_t)((x).g * 63) << 5) | \ ((uint32_t)((x).r * 31) << 0)) -#define ALLEGRO_CONVERT_ABGR_F32_TO_BGR_555(x) \ +#define A5O_CONVERT_ABGR_F32_TO_BGR_555(x) \ (((uint32_t)((x).b * 31) << 10) | \ ((uint32_t)((x).g * 31) << 5) | \ ((uint32_t)((x).r * 31) << 0)) -#define ALLEGRO_CONVERT_ABGR_F32_TO_RGBX_8888(x) \ +#define A5O_CONVERT_ABGR_F32_TO_RGBX_8888(x) \ (((uint32_t)((x).b * 255) << 8) | \ ((uint32_t)((x).g * 255) << 16) | \ ((uint32_t)((x).r * 255) << 24)) -#define ALLEGRO_CONVERT_ABGR_F32_TO_XRGB_8888(x) \ +#define A5O_CONVERT_ABGR_F32_TO_XRGB_8888(x) \ (((uint32_t)((x).b * 255) << 0) | \ ((uint32_t)((x).g * 255) << 8) | \ ((uint32_t)((x).r * 255) << 16)) -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_F32_TO_ABGR_8888_LE(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_F32_TO_ABGR_8888_LE(x) \ (((uint32_t)((x).a * 255) << 0) | \ ((uint32_t)((x).b * 255) << 8) | \ ((uint32_t)((x).g * 255) << 16) | \ ((uint32_t)((x).r * 255) << 24)) #else -#define ALLEGRO_CONVERT_ABGR_F32_TO_ABGR_8888_LE(x) \ +#define A5O_CONVERT_ABGR_F32_TO_ABGR_8888_LE(x) \ (((uint32_t)((x).a * 255) << 24) | \ ((uint32_t)((x).b * 255) << 16) | \ ((uint32_t)((x).g * 255) << 8) | \ ((uint32_t)((x).r * 255) << 0)) #endif -#define ALLEGRO_CONVERT_ABGR_F32_TO_RGBA_4444(x) \ +#define A5O_CONVERT_ABGR_F32_TO_RGBA_4444(x) \ (((uint32_t)((x).a * 15) << 0) | \ ((uint32_t)((x).b * 15) << 4) | \ ((uint32_t)((x).g * 15) << 8) | \ ((uint32_t)((x).r * 15) << 12)) -#define ALLEGRO_CONVERT_ABGR_F32_TO_SINGLE_CHANNEL_8(x) \ +#define A5O_CONVERT_ABGR_F32_TO_SINGLE_CHANNEL_8(x) \ (uint32_t)((x).r * 255) -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_ARGB_8888(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_8888_LE_TO_ARGB_8888(x) \ ((((x) & 0x000000ff) << 24) /* A */ | \ (((x) & 0xffffff00) >> 8) /* BGR */) #else -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_ARGB_8888(x) \ +#define A5O_CONVERT_ABGR_8888_LE_TO_ARGB_8888(x) \ ((((x) & 0x00ff0000) >> 16) /* B */ | \ (((x) & 0x000000ff) << 16) /* R */ | \ ((x) & 0xff00ff00) /* AG */) #endif -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGBA_8888(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_8888_LE_TO_RGBA_8888(x) \ (((x) & 0xffffffff) /* ABGR */) #else -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGBA_8888(x) \ +#define A5O_CONVERT_ABGR_8888_LE_TO_RGBA_8888(x) \ ((((x) & 0xff000000) >> 24) /* A */ | \ (((x) & 0x00ff0000) >> 8) /* B */ | \ (((x) & 0x0000ff00) << 8) /* G */ | \ (((x) & 0x000000ff) << 24) /* R */) #endif -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_ARGB_4444(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_8888_LE_TO_ARGB_4444(x) \ ((((x) & 0x000000f0) << 8) /* A */ | \ (((x) & 0x0000f000) >> 12) /* B */ | \ (((x) & 0x00f00000) >> 16) /* G */ | \ (((x) & 0xf0000000) >> 20) /* R */) #else -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_ARGB_4444(x) \ +#define A5O_CONVERT_ABGR_8888_LE_TO_ARGB_4444(x) \ ((((x) & 0xf0000000) >> 16) /* A */ | \ (((x) & 0x00f00000) >> 20) /* B */ | \ (((x) & 0x0000f000) >> 8) /* G */ | \ (((x) & 0x000000f0) << 4) /* R */) #endif -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGB_888(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_8888_LE_TO_RGB_888(x) \ ((((x) & 0xffffff00) >> 8) /* BGR */) #else -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGB_888(x) \ +#define A5O_CONVERT_ABGR_8888_LE_TO_RGB_888(x) \ ((((x) & 0x00ff0000) >> 16) /* B */ | \ ((x) & 0x0000ff00) /* G */ | \ (((x) & 0x000000ff) << 16) /* R */) #endif -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGB_565(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_8888_LE_TO_RGB_565(x) \ ((((x) & 0x0000f800) >> 11) /* B */ | \ (((x) & 0x00fc0000) >> 13) /* G */ | \ (((x) & 0xf8000000) >> 16) /* R */) #else -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGB_565(x) \ +#define A5O_CONVERT_ABGR_8888_LE_TO_RGB_565(x) \ ((((x) & 0x00f80000) >> 19) /* B */ | \ (((x) & 0x0000fc00) >> 5) /* G */ | \ (((x) & 0x000000f8) << 8) /* R */) #endif -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGB_555(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_8888_LE_TO_RGB_555(x) \ ((((x) & 0x0000f800) >> 11) /* B */ | \ (((x) & 0x00f80000) >> 14) /* G */ | \ (((x) & 0xf8000000) >> 17) /* R */) #else -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGB_555(x) \ +#define A5O_CONVERT_ABGR_8888_LE_TO_RGB_555(x) \ ((((x) & 0x00f80000) >> 19) /* B */ | \ (((x) & 0x0000f800) >> 6) /* G */ | \ (((x) & 0x000000f8) << 7) /* R */) #endif -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGBA_5551(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_8888_LE_TO_RGBA_5551(x) \ ((((x) & 0x00000080) >> 7) /* A */ | \ (((x) & 0x0000f800) >> 10) /* B */ | \ (((x) & 0x00f80000) >> 13) /* G */ | \ (((x) & 0xf8000000) >> 16) /* R */) #else -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGBA_5551(x) \ +#define A5O_CONVERT_ABGR_8888_LE_TO_RGBA_5551(x) \ ((((x) & 0x80000000) >> 31) /* A */ | \ (((x) & 0x00f80000) >> 18) /* B */ | \ (((x) & 0x0000f800) >> 5) /* G */ | \ (((x) & 0x000000f8) << 8) /* R */) #endif -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_ARGB_1555(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_8888_LE_TO_ARGB_1555(x) \ ((((x) & 0x00000080) << 8) /* A */ | \ (((x) & 0x0000f800) >> 11) /* B */ | \ (((x) & 0x00f80000) >> 14) /* G */ | \ (((x) & 0xf8000000) >> 17) /* R */) #else -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_ARGB_1555(x) \ +#define A5O_CONVERT_ABGR_8888_LE_TO_ARGB_1555(x) \ ((((x) & 0x80000000) >> 16) /* A */ | \ (((x) & 0x00f80000) >> 19) /* B */ | \ (((x) & 0x0000f800) >> 6) /* G */ | \ (((x) & 0x000000f8) << 7) /* R */) #endif -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_ABGR_8888(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_8888_LE_TO_ABGR_8888(x) \ ((((x) & 0x000000ff) << 24) /* A */ | \ (((x) & 0x0000ff00) << 8) /* B */ | \ (((x) & 0x00ff0000) >> 8) /* G */ | \ (((x) & 0xff000000) >> 24) /* R */) #else -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_ABGR_8888(x) \ +#define A5O_CONVERT_ABGR_8888_LE_TO_ABGR_8888(x) \ (((x) & 0xffffffff) /* ABGR */) #endif -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_XBGR_8888(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_8888_LE_TO_XBGR_8888(x) \ ((((x) & 0x0000ff00) << 8) /* B */ | \ (((x) & 0x00ff0000) >> 8) /* G */ | \ (((x) & 0xff000000) >> 24) /* R */) #else -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_XBGR_8888(x) \ +#define A5O_CONVERT_ABGR_8888_LE_TO_XBGR_8888(x) \ (((x) & 0x00ffffff) /* BGR */) #endif -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_BGR_888(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_8888_LE_TO_BGR_888(x) \ ((((x) & 0x0000ff00) << 8) /* B */ | \ (((x) & 0x00ff0000) >> 8) /* G */ | \ (((x) & 0xff000000) >> 24) /* R */) #else -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_BGR_888(x) \ +#define A5O_CONVERT_ABGR_8888_LE_TO_BGR_888(x) \ (((x) & 0x00ffffff) /* BGR */) #endif -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_BGR_565(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_8888_LE_TO_BGR_565(x) \ (((x) & 0x0000f800) /* B */ | \ (((x) & 0x00fc0000) >> 13) /* G */ | \ (((x) & 0xf8000000) >> 27) /* R */) #else -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_BGR_565(x) \ +#define A5O_CONVERT_ABGR_8888_LE_TO_BGR_565(x) \ ((((x) & 0x00f80000) >> 8) /* B */ | \ (((x) & 0x0000fc00) >> 5) /* G */ | \ (((x) & 0x000000f8) >> 3) /* R */) #endif -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_BGR_555(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_8888_LE_TO_BGR_555(x) \ ((((x) & 0x0000f800) >> 1) /* B */ | \ (((x) & 0x00f80000) >> 14) /* G */ | \ (((x) & 0xf8000000) >> 27) /* R */) #else -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_BGR_555(x) \ +#define A5O_CONVERT_ABGR_8888_LE_TO_BGR_555(x) \ ((((x) & 0x00f80000) >> 9) /* B */ | \ (((x) & 0x0000f800) >> 6) /* G */ | \ (((x) & 0x000000f8) >> 3) /* R */) #endif -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGBX_8888(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_8888_LE_TO_RGBX_8888(x) \ (((x) & 0xffffff00) /* BGR */) #else -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGBX_8888(x) \ +#define A5O_CONVERT_ABGR_8888_LE_TO_RGBX_8888(x) \ ((((x) & 0x00ff0000) >> 8) /* B */ | \ (((x) & 0x0000ff00) << 8) /* G */ | \ (((x) & 0x000000ff) << 24) /* R */) #endif -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_XRGB_8888(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_8888_LE_TO_XRGB_8888(x) \ ((((x) & 0xffffff00) >> 8) /* BGR */) #else -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_XRGB_8888(x) \ +#define A5O_CONVERT_ABGR_8888_LE_TO_XRGB_8888(x) \ ((((x) & 0x00ff0000) >> 16) /* B */ | \ ((x) & 0x0000ff00) /* G */ | \ (((x) & 0x000000ff) << 16) /* R */) #endif -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_ABGR_F32(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_8888_LE_TO_ABGR_F32(x) \ al_map_rgba(((x) >> 24) & 255,\ ((x) >> 16) & 255,\ ((x) >> 8) & 255,\ ((x) >> 0) & 255) #else -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_ABGR_F32(x) \ +#define A5O_CONVERT_ABGR_8888_LE_TO_ABGR_F32(x) \ al_map_rgba(((x) >> 0) & 255,\ ((x) >> 8) & 255,\ ((x) >> 16) & 255,\ ((x) >> 24) & 255) #endif -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGBA_4444(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_8888_LE_TO_RGBA_4444(x) \ ((((x) & 0x000000f0) >> 4) /* A */ | \ (((x) & 0x0000f000) >> 8) /* B */ | \ (((x) & 0x00f00000) >> 12) /* G */ | \ (((x) & 0xf0000000) >> 16) /* R */) #else -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGBA_4444(x) \ +#define A5O_CONVERT_ABGR_8888_LE_TO_RGBA_4444(x) \ ((((x) & 0xf0000000) >> 28) /* A */ | \ (((x) & 0x00f00000) >> 16) /* B */ | \ (((x) & 0x0000f000) >> 4) /* G */ | \ (((x) & 0x000000f0) << 8) /* R */) #endif -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_SINGLE_CHANNEL_8(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_ABGR_8888_LE_TO_SINGLE_CHANNEL_8(x) \ (((x) >> 24) & 0xff) #else -#define ALLEGRO_CONVERT_ABGR_8888_LE_TO_SINGLE_CHANNEL_8(x) \ +#define A5O_CONVERT_ABGR_8888_LE_TO_SINGLE_CHANNEL_8(x) \ (((x) >> 0) & 0xff) #endif -#define ALLEGRO_CONVERT_RGBA_4444_TO_ARGB_8888(x) \ +#define A5O_CONVERT_RGBA_4444_TO_ARGB_8888(x) \ ((_al_rgb_scale_4[((x) & 0x000f) >> 0] << 24) /* A */ | \ (_al_rgb_scale_4[((x) & 0x00f0) >> 4] ) /* B */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] << 8) /* G */ | \ (_al_rgb_scale_4[((x) & 0xf000) >> 12] << 16) /* R */) -#define ALLEGRO_CONVERT_RGBA_4444_TO_RGBA_8888(x) \ +#define A5O_CONVERT_RGBA_4444_TO_RGBA_8888(x) \ ((_al_rgb_scale_4[((x) & 0x000f) >> 0] ) /* A */ | \ (_al_rgb_scale_4[((x) & 0x00f0) >> 4] << 8) /* B */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] << 16) /* G */ | \ (_al_rgb_scale_4[((x) & 0xf000) >> 12] << 24) /* R */) -#define ALLEGRO_CONVERT_RGBA_4444_TO_ARGB_4444(x) \ +#define A5O_CONVERT_RGBA_4444_TO_ARGB_4444(x) \ ((((x) & 0x000f) << 12) /* A */ | \ (((x) & 0xfff0) >> 4) /* BGR */) -#define ALLEGRO_CONVERT_RGBA_4444_TO_RGB_888(x) \ +#define A5O_CONVERT_RGBA_4444_TO_RGB_888(x) \ ((_al_rgb_scale_4[((x) & 0x00f0) >> 4] ) /* B */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] << 8) /* G */ | \ (_al_rgb_scale_4[((x) & 0xf000) >> 12] << 16) /* R */) -#define ALLEGRO_CONVERT_RGBA_4444_TO_RGB_565(x) \ +#define A5O_CONVERT_RGBA_4444_TO_RGB_565(x) \ ((((x) & 0x00f0) >> 3) /* B */ | \ (((x) & 0x0f00) >> 1) /* G */ | \ ((x) & 0xf000) /* R */) -#define ALLEGRO_CONVERT_RGBA_4444_TO_RGB_555(x) \ +#define A5O_CONVERT_RGBA_4444_TO_RGB_555(x) \ ((((x) & 0x00f0) >> 3) /* B */ | \ (((x) & 0x0f00) >> 2) /* G */ | \ (((x) & 0xf000) >> 1) /* R */) -#define ALLEGRO_CONVERT_RGBA_4444_TO_RGBA_5551(x) \ +#define A5O_CONVERT_RGBA_4444_TO_RGBA_5551(x) \ ((((x) & 0x0008) >> 3) /* A */ | \ (((x) & 0x00f0) >> 2) /* B */ | \ (((x) & 0x0f00) >> 1) /* G */ | \ ((x) & 0xf000) /* R */) -#define ALLEGRO_CONVERT_RGBA_4444_TO_ARGB_1555(x) \ +#define A5O_CONVERT_RGBA_4444_TO_ARGB_1555(x) \ ((((x) & 0x0008) << 12) /* A */ | \ (((x) & 0x00f0) >> 3) /* B */ | \ (((x) & 0x0f00) >> 2) /* G */ | \ (((x) & 0xf000) >> 1) /* R */) -#define ALLEGRO_CONVERT_RGBA_4444_TO_ABGR_8888(x) \ +#define A5O_CONVERT_RGBA_4444_TO_ABGR_8888(x) \ ((_al_rgb_scale_4[((x) & 0x000f) >> 0] << 24) /* A */ | \ (_al_rgb_scale_4[((x) & 0x00f0) >> 4] << 16) /* B */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] << 8) /* G */ | \ (_al_rgb_scale_4[((x) & 0xf000) >> 12] ) /* R */) -#define ALLEGRO_CONVERT_RGBA_4444_TO_XBGR_8888(x) \ +#define A5O_CONVERT_RGBA_4444_TO_XBGR_8888(x) \ ((_al_rgb_scale_4[((x) & 0x00f0) >> 4] << 16) /* B */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] << 8) /* G */ | \ (_al_rgb_scale_4[((x) & 0xf000) >> 12] ) /* R */) -#define ALLEGRO_CONVERT_RGBA_4444_TO_BGR_888(x) \ +#define A5O_CONVERT_RGBA_4444_TO_BGR_888(x) \ ((_al_rgb_scale_4[((x) & 0x00f0) >> 4] << 16) /* B */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] << 8) /* G */ | \ (_al_rgb_scale_4[((x) & 0xf000) >> 12] ) /* R */) -#define ALLEGRO_CONVERT_RGBA_4444_TO_BGR_565(x) \ +#define A5O_CONVERT_RGBA_4444_TO_BGR_565(x) \ ((((x) & 0x00f0) << 8) /* B */ | \ (((x) & 0x0f00) >> 1) /* G */ | \ (((x) & 0xf000) >> 11) /* R */) -#define ALLEGRO_CONVERT_RGBA_4444_TO_BGR_555(x) \ +#define A5O_CONVERT_RGBA_4444_TO_BGR_555(x) \ ((((x) & 0x00f0) << 7) /* B */ | \ (((x) & 0x0f00) >> 2) /* G */ | \ (((x) & 0xf000) >> 11) /* R */) -#define ALLEGRO_CONVERT_RGBA_4444_TO_RGBX_8888(x) \ +#define A5O_CONVERT_RGBA_4444_TO_RGBX_8888(x) \ ((_al_rgb_scale_4[((x) & 0x00f0) >> 4] << 8) /* B */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] << 16) /* G */ | \ (_al_rgb_scale_4[((x) & 0xf000) >> 12] << 24) /* R */) -#define ALLEGRO_CONVERT_RGBA_4444_TO_XRGB_8888(x) \ +#define A5O_CONVERT_RGBA_4444_TO_XRGB_8888(x) \ ((_al_rgb_scale_4[((x) & 0x00f0) >> 4] ) /* B */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] << 8) /* G */ | \ (_al_rgb_scale_4[((x) & 0xf000) >> 12] << 16) /* R */) -#define ALLEGRO_CONVERT_RGBA_4444_TO_ABGR_F32(x) \ +#define A5O_CONVERT_RGBA_4444_TO_ABGR_F32(x) \ al_map_rgba(_al_rgb_scale_4[((x) >> 12) & 15],\ _al_rgb_scale_4[((x) >> 8) & 15],\ _al_rgb_scale_4[((x) >> 4) & 15],\ _al_rgb_scale_4[((x) >> 0) & 15]) -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_RGBA_4444_TO_ABGR_8888_LE(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_RGBA_4444_TO_ABGR_8888_LE(x) \ ((_al_rgb_scale_4[((x) & 0x000f) >> 0] ) /* A */ | \ (_al_rgb_scale_4[((x) & 0x00f0) >> 4] << 8) /* B */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] << 16) /* G */ | \ (_al_rgb_scale_4[((x) & 0xf000) >> 12] << 24) /* R */) #else -#define ALLEGRO_CONVERT_RGBA_4444_TO_ABGR_8888_LE(x) \ +#define A5O_CONVERT_RGBA_4444_TO_ABGR_8888_LE(x) \ ((_al_rgb_scale_4[((x) & 0x000f) >> 0] << 24) /* A */ | \ (_al_rgb_scale_4[((x) & 0x00f0) >> 4] << 16) /* B */ | \ (_al_rgb_scale_4[((x) & 0x0f00) >> 8] << 8) /* G */ | \ (_al_rgb_scale_4[((x) & 0xf000) >> 12] ) /* R */) #endif -#define ALLEGRO_CONVERT_RGBA_4444_TO_SINGLE_CHANNEL_8(x) \ +#define A5O_CONVERT_RGBA_4444_TO_SINGLE_CHANNEL_8(x) \ (_al_rgb_scale_4[(((x) >> 12) & 0xf)]) -#define ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_ARGB_8888(x) \ +#define A5O_CONVERT_SINGLE_CHANNEL_8_TO_ARGB_8888(x) \ (0xff000000 | \ (((x) << 16) & 0xff0000)) -#define ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_RGBA_8888(x) \ +#define A5O_CONVERT_SINGLE_CHANNEL_8_TO_RGBA_8888(x) \ (0xff | \ (((x) << 24) & 0xff000000)) -#define ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_ARGB_4444(x) \ +#define A5O_CONVERT_SINGLE_CHANNEL_8_TO_ARGB_4444(x) \ (0xf000 | \ (((x) << 4) & 0xf00)) -#define ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_RGB_888(x) \ +#define A5O_CONVERT_SINGLE_CHANNEL_8_TO_RGB_888(x) \ ((((x) << 16) & 0xff0000)) -#define ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_RGB_565(x) \ +#define A5O_CONVERT_SINGLE_CHANNEL_8_TO_RGB_565(x) \ ((((x) << 8) & 0xf800)) -#define ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_RGB_555(x) \ +#define A5O_CONVERT_SINGLE_CHANNEL_8_TO_RGB_555(x) \ ((((x) << 7) & 0x7c00)) -#define ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_RGBA_5551(x) \ +#define A5O_CONVERT_SINGLE_CHANNEL_8_TO_RGBA_5551(x) \ (0x1 | \ (((x) << 8) & 0xf800)) -#define ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_ARGB_1555(x) \ +#define A5O_CONVERT_SINGLE_CHANNEL_8_TO_ARGB_1555(x) \ (0x8000 | \ (((x) << 7) & 0x7c00)) -#define ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_ABGR_8888(x) \ +#define A5O_CONVERT_SINGLE_CHANNEL_8_TO_ABGR_8888(x) \ (0xff000000 | \ ((x) & 0xff)) -#define ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_XBGR_8888(x) \ +#define A5O_CONVERT_SINGLE_CHANNEL_8_TO_XBGR_8888(x) \ (((x) & 0xff)) -#define ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_BGR_888(x) \ +#define A5O_CONVERT_SINGLE_CHANNEL_8_TO_BGR_888(x) \ (((x) & 0xff)) -#define ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_BGR_565(x) \ +#define A5O_CONVERT_SINGLE_CHANNEL_8_TO_BGR_565(x) \ ((((x) >> 3) & 0x1f)) -#define ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_BGR_555(x) \ +#define A5O_CONVERT_SINGLE_CHANNEL_8_TO_BGR_555(x) \ ((((x) >> 3) & 0x1f)) -#define ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_RGBX_8888(x) \ +#define A5O_CONVERT_SINGLE_CHANNEL_8_TO_RGBX_8888(x) \ ((((x) << 24) & 0xff000000)) -#define ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_XRGB_8888(x) \ +#define A5O_CONVERT_SINGLE_CHANNEL_8_TO_XRGB_8888(x) \ ((((x) << 16) & 0xff0000)) -#define ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_ABGR_F32(x) \ +#define A5O_CONVERT_SINGLE_CHANNEL_8_TO_ABGR_F32(x) \ al_map_rgb(x, 0, 0) -#ifdef ALLEGRO_BIG_ENDIAN -#define ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_ABGR_8888_LE(x) \ +#ifdef A5O_BIG_ENDIAN +#define A5O_CONVERT_SINGLE_CHANNEL_8_TO_ABGR_8888_LE(x) \ (0xff | \ (((x) << 24) & 0xff000000)) #else -#define ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_ABGR_8888_LE(x) \ +#define A5O_CONVERT_SINGLE_CHANNEL_8_TO_ABGR_8888_LE(x) \ (0xff000000 | \ ((x) & 0xff)) #endif -#define ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_RGBA_4444(x) \ +#define A5O_CONVERT_SINGLE_CHANNEL_8_TO_RGBA_4444(x) \ (0xf | \ (((x) << 8) & 0xf000)) #endif diff --git a/include/allegro5/internal/aintern_direct3d.h b/include/allegro5/internal/aintern_direct3d.h index 9e12d65e87..5420fec990 100644 --- a/include/allegro5/internal/aintern_direct3d.h +++ b/include/allegro5/internal/aintern_direct3d.h @@ -9,7 +9,7 @@ extern "C" { #endif -typedef struct ALLEGRO_BITMAP_EXTRA_D3D +typedef struct A5O_BITMAP_EXTRA_D3D { /* Driver specifics. */ @@ -25,16 +25,16 @@ typedef struct ALLEGRO_BITMAP_EXTRA_D3D D3DLOCKED_RECT locked_rect; - struct ALLEGRO_DISPLAY_D3D *display; + struct A5O_DISPLAY_D3D *display; IDirect3DSurface9 *render_target; bool dirty; -} ALLEGRO_BITMAP_EXTRA_D3D; +} A5O_BITMAP_EXTRA_D3D; -typedef struct ALLEGRO_DISPLAY_D3D +typedef struct A5O_DISPLAY_D3D { - ALLEGRO_DISPLAY_WIN win_display; /* This must be the first member. */ + A5O_DISPLAY_WIN win_display; /* This must be the first member. */ bool es_inited; /* Driver specifics */ @@ -45,11 +45,11 @@ typedef struct ALLEGRO_DISPLAY_D3D bool reset_done; bool reset_success; - ALLEGRO_BITMAP backbuffer_bmp; - ALLEGRO_BITMAP_EXTRA_D3D backbuffer_bmp_extra; + A5O_BITMAP backbuffer_bmp; + A5O_BITMAP_EXTRA_D3D backbuffer_bmp_extra; /* Contains the target video bitmap for this display. */ - ALLEGRO_BITMAP* target_bitmap; + A5O_BITMAP* target_bitmap; bool device_lost; bool suppress_lost_events; @@ -75,38 +75,38 @@ typedef struct ALLEGRO_DISPLAY_D3D RECT scissor_state; -#ifdef ALLEGRO_CFG_SHADER_HLSL +#ifdef A5O_CFG_SHADER_HLSL LPD3DXEFFECT effect; #endif -} ALLEGRO_DISPLAY_D3D; +} A5O_DISPLAY_D3D; -AL_FUNC(void, _al_d3d_set_blender, (ALLEGRO_DISPLAY_D3D *disp)); +AL_FUNC(void, _al_d3d_set_blender, (A5O_DISPLAY_D3D *disp)); AL_FUNC(void, _al_set_d3d_sampler_state, (IDirect3DDevice9* device, - int sampler, ALLEGRO_BITMAP* bitmap, bool prim_default)); + int sampler, A5O_BITMAP* bitmap, bool prim_default)); -void _al_d3d_destroy_bitmap(ALLEGRO_BITMAP *bitmap); -void _al_d3d_update_render_state(ALLEGRO_DISPLAY *display); +void _al_d3d_destroy_bitmap(A5O_BITMAP *bitmap); +void _al_d3d_update_render_state(A5O_DISPLAY *display); -#ifdef ALLEGRO_CFG_SHADER_HLSL +#ifdef A5O_CFG_SHADER_HLSL bool _al_hlsl_set_projview_matrix(LPD3DXEFFECT effect, - const ALLEGRO_TRANSFORM *t); + const A5O_TRANSFORM *t); #endif -#ifdef ALLEGRO_CFG_D3DX9 - typedef HRESULT (WINAPI *_ALLEGRO_D3DXLSFLSPROC)(LPDIRECT3DSURFACE9, const PALETTEENTRY*, +#ifdef A5O_CFG_D3DX9 + typedef HRESULT (WINAPI *_A5O_D3DXLSFLSPROC)(LPDIRECT3DSURFACE9, const PALETTEENTRY*, const RECT*, LPDIRECT3DSURFACE9, const PALETTEENTRY*, const RECT*, DWORD, D3DCOLOR); - typedef HRESULT (WINAPI *_ALLEGRO_D3DXCREATEEFFECTPROC)(LPDIRECT3DDEVICE9, LPCVOID, UINT, + typedef HRESULT (WINAPI *_A5O_D3DXCREATEEFFECTPROC)(LPDIRECT3DDEVICE9, LPCVOID, UINT, CONST D3DXMACRO*, LPD3DXINCLUDE, DWORD, LPD3DXEFFECTPOOL, LPD3DXEFFECT*, LPD3DXBUFFER*); bool _al_load_d3dx9_module(); void _al_unload_d3dx9_module(); - extern _ALLEGRO_D3DXLSFLSPROC _al_imp_D3DXLoadSurfaceFromSurface; - extern _ALLEGRO_D3DXCREATEEFFECTPROC _al_imp_D3DXCreateEffect; + extern _A5O_D3DXLSFLSPROC _al_imp_D3DXLoadSurfaceFromSurface; + extern _A5O_D3DXCREATEEFFECTPROC _al_imp_D3DXCreateEffect; #endif #ifdef __cplusplus diff --git a/include/allegro5/internal/aintern_display.h b/include/allegro5/internal/aintern_display.h index 9eb88da3ac..276925aa00 100644 --- a/include/allegro5/internal/aintern_display.h +++ b/include/allegro5/internal/aintern_display.h @@ -11,85 +11,85 @@ extern "C" { #endif -typedef struct ALLEGRO_DISPLAY_INTERFACE ALLEGRO_DISPLAY_INTERFACE; +typedef struct A5O_DISPLAY_INTERFACE A5O_DISPLAY_INTERFACE; -struct ALLEGRO_DISPLAY_INTERFACE +struct A5O_DISPLAY_INTERFACE { int id; - ALLEGRO_DISPLAY *(*create_display)(int w, int h); - void (*destroy_display)(ALLEGRO_DISPLAY *display); - bool (*set_current_display)(ALLEGRO_DISPLAY *d); - void (*unset_current_display)(ALLEGRO_DISPLAY *d); - void (*clear)(ALLEGRO_DISPLAY *d, ALLEGRO_COLOR *color); - void (*draw_pixel)(ALLEGRO_DISPLAY *d, float x, float y, ALLEGRO_COLOR *color); - void (*flip_display)(ALLEGRO_DISPLAY *d); - void (*update_display_region)(ALLEGRO_DISPLAY *d, int x, int y, + A5O_DISPLAY *(*create_display)(int w, int h); + void (*destroy_display)(A5O_DISPLAY *display); + bool (*set_current_display)(A5O_DISPLAY *d); + void (*unset_current_display)(A5O_DISPLAY *d); + void (*clear)(A5O_DISPLAY *d, A5O_COLOR *color); + void (*draw_pixel)(A5O_DISPLAY *d, float x, float y, A5O_COLOR *color); + void (*flip_display)(A5O_DISPLAY *d); + void (*update_display_region)(A5O_DISPLAY *d, int x, int y, int width, int height); - bool (*acknowledge_resize)(ALLEGRO_DISPLAY *d); - bool (*resize_display)(ALLEGRO_DISPLAY *d, int width, int height); - void (*quick_size)(ALLEGRO_DISPLAY *d); - int (*get_orientation)(ALLEGRO_DISPLAY *d); + bool (*acknowledge_resize)(A5O_DISPLAY *d); + bool (*resize_display)(A5O_DISPLAY *d, int width, int height); + void (*quick_size)(A5O_DISPLAY *d); + int (*get_orientation)(A5O_DISPLAY *d); - ALLEGRO_BITMAP *(*create_bitmap)(ALLEGRO_DISPLAY *d, + A5O_BITMAP *(*create_bitmap)(A5O_DISPLAY *d, int w, int h, int format, int flags); - void (*set_target_bitmap)(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap); - ALLEGRO_BITMAP *(*get_backbuffer)(ALLEGRO_DISPLAY *d); + void (*set_target_bitmap)(A5O_DISPLAY *display, A5O_BITMAP *bitmap); + A5O_BITMAP *(*get_backbuffer)(A5O_DISPLAY *d); - bool (*is_compatible_bitmap)(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap); - void (*switch_out)(ALLEGRO_DISPLAY *display); - void (*switch_in)(ALLEGRO_DISPLAY *display); + bool (*is_compatible_bitmap)(A5O_DISPLAY *display, A5O_BITMAP *bitmap); + void (*switch_out)(A5O_DISPLAY *display); + void (*switch_in)(A5O_DISPLAY *display); - void (*draw_memory_bitmap_region)(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap, + void (*draw_memory_bitmap_region)(A5O_DISPLAY *display, A5O_BITMAP *bitmap, float sx, float sy, float sw, float sh, int flags); - bool (*wait_for_vsync)(ALLEGRO_DISPLAY *display); + bool (*wait_for_vsync)(A5O_DISPLAY *display); - bool (*set_mouse_cursor)(ALLEGRO_DISPLAY *display, - ALLEGRO_MOUSE_CURSOR *cursor); - bool (*set_system_mouse_cursor)(ALLEGRO_DISPLAY *display, - ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id); - bool (*show_mouse_cursor)(ALLEGRO_DISPLAY *display); - bool (*hide_mouse_cursor)(ALLEGRO_DISPLAY *display); + bool (*set_mouse_cursor)(A5O_DISPLAY *display, + A5O_MOUSE_CURSOR *cursor); + bool (*set_system_mouse_cursor)(A5O_DISPLAY *display, + A5O_SYSTEM_MOUSE_CURSOR cursor_id); + bool (*show_mouse_cursor)(A5O_DISPLAY *display); + bool (*hide_mouse_cursor)(A5O_DISPLAY *display); - void (*set_icons)(ALLEGRO_DISPLAY *display, int num_icons, ALLEGRO_BITMAP *bitmap[]); + void (*set_icons)(A5O_DISPLAY *display, int num_icons, A5O_BITMAP *bitmap[]); - void (*set_window_position)(ALLEGRO_DISPLAY *display, int x, int y); - void (*get_window_position)(ALLEGRO_DISPLAY *display, int *x, int *y); - bool (*get_window_borders)(ALLEGRO_DISPLAY *display, int *left, int *top, int *right, int *bottom); - bool (*set_window_constraints)(ALLEGRO_DISPLAY *display, int min_w, int min_h, int max_w, int max_h); - bool (*get_window_constraints)(ALLEGRO_DISPLAY *display, int *min_w, int *min_h, int *max_w, int *max_h); - bool (*set_display_flag)(ALLEGRO_DISPLAY *display, int flag, bool onoff); - void (*set_window_title)(ALLEGRO_DISPLAY *display, const char *title); + void (*set_window_position)(A5O_DISPLAY *display, int x, int y); + void (*get_window_position)(A5O_DISPLAY *display, int *x, int *y); + bool (*get_window_borders)(A5O_DISPLAY *display, int *left, int *top, int *right, int *bottom); + bool (*set_window_constraints)(A5O_DISPLAY *display, int min_w, int min_h, int max_w, int max_h); + bool (*get_window_constraints)(A5O_DISPLAY *display, int *min_w, int *min_h, int *max_w, int *max_h); + bool (*set_display_flag)(A5O_DISPLAY *display, int flag, bool onoff); + void (*set_window_title)(A5O_DISPLAY *display, const char *title); - void (*flush_vertex_cache)(ALLEGRO_DISPLAY *d); - void* (*prepare_vertex_cache)(ALLEGRO_DISPLAY *d, int num_new_vertices); + void (*flush_vertex_cache)(A5O_DISPLAY *d); + void* (*prepare_vertex_cache)(A5O_DISPLAY *d, int num_new_vertices); - void (*update_transformation)(ALLEGRO_DISPLAY* d, ALLEGRO_BITMAP *target); + void (*update_transformation)(A5O_DISPLAY* d, A5O_BITMAP *target); /* Unused */ void (*shutdown)(void); - void (*acknowledge_drawing_halt)(ALLEGRO_DISPLAY *d); - void (*acknowledge_drawing_resume)(ALLEGRO_DISPLAY *d); + void (*acknowledge_drawing_halt)(A5O_DISPLAY *d); + void (*acknowledge_drawing_resume)(A5O_DISPLAY *d); - void (*set_display_option)(ALLEGRO_DISPLAY *display, int option, int val); + void (*set_display_option)(A5O_DISPLAY *display, int option, int val); - void (*clear_depth_buffer)(ALLEGRO_DISPLAY *display, float x); - void (*update_render_state)(ALLEGRO_DISPLAY *display); + void (*clear_depth_buffer)(A5O_DISPLAY *display, float x); + void (*update_render_state)(A5O_DISPLAY *display); - char *(*get_clipboard_text)(ALLEGRO_DISPLAY *display); - bool (*set_clipboard_text)(ALLEGRO_DISPLAY *display, const char *text); - bool (*has_clipboard_text)(ALLEGRO_DISPLAY *display); + char *(*get_clipboard_text)(A5O_DISPLAY *display); + bool (*set_clipboard_text)(A5O_DISPLAY *display, const char *text); + bool (*has_clipboard_text)(A5O_DISPLAY *display); /* Issue #725 */ - void (*apply_window_constraints)(ALLEGRO_DISPLAY *display, bool onoff); + void (*apply_window_constraints)(A5O_DISPLAY *display, bool onoff); }; -struct ALLEGRO_OGL_EXTRAS; +struct A5O_OGL_EXTRAS; -typedef struct ALLEGRO_BLENDER +typedef struct A5O_BLENDER { int blend_op; int blend_source; @@ -97,45 +97,45 @@ typedef struct ALLEGRO_BLENDER int blend_alpha_op; int blend_alpha_source; int blend_alpha_dest; - ALLEGRO_COLOR blend_color; -} ALLEGRO_BLENDER; + A5O_COLOR blend_color; +} A5O_BLENDER; -typedef struct _ALLEGRO_RENDER_STATE { +typedef struct _A5O_RENDER_STATE { int write_mask; int depth_test, depth_function; int alpha_test, alpha_function, alpha_test_value; -} _ALLEGRO_RENDER_STATE; +} _A5O_RENDER_STATE; /* These are settings Allegro itself doesn't really care about on its * own, but which users may want to specify for a display anyway. */ -ALLEGRO_STATIC_ASSERT(aintern_display, ALLEGRO_DISPLAY_OPTIONS_COUNT <= 64); +A5O_STATIC_ASSERT(aintern_display, A5O_DISPLAY_OPTIONS_COUNT <= 64); typedef struct { int64_t required, suggested; /* Bitfields. */ - int settings[ALLEGRO_DISPLAY_OPTIONS_COUNT]; + int settings[A5O_DISPLAY_OPTIONS_COUNT]; /* These are come in handy when creating a context. */ void *info; int index, score; -} ALLEGRO_EXTRA_DISPLAY_SETTINGS; +} A5O_EXTRA_DISPLAY_SETTINGS; -struct ALLEGRO_DISPLAY +struct A5O_DISPLAY { /* Must be first, so the display can be used as event source. */ - ALLEGRO_EVENT_SOURCE es; - ALLEGRO_DISPLAY_INTERFACE *vt; + A5O_EVENT_SOURCE es; + A5O_DISPLAY_INTERFACE *vt; int refresh_rate; int flags; int w, h; int min_w, min_h; int max_w, max_h; - int backbuffer_format; /* ALLEGRO_PIXELFORMAT */ + int backbuffer_format; /* A5O_PIXELFORMAT */ - ALLEGRO_EXTRA_DISPLAY_SETTINGS extra_settings; - struct ALLEGRO_OGL_EXTRAS *ogl_extras; + A5O_EXTRA_DISPLAY_SETTINGS extra_settings; + struct A5O_OGL_EXTRAS *ogl_extras; /* A list of bitmaps created for this display, sub-bitmaps not included. */ _AL_VECTOR bitmaps; @@ -146,13 +146,13 @@ struct ALLEGRO_DISPLAY void* vertex_cache; uintptr_t cache_texture; - ALLEGRO_BLENDER cur_blender; + A5O_BLENDER cur_blender; - ALLEGRO_SHADER* default_shader; + A5O_SHADER* default_shader; - ALLEGRO_TRANSFORM projview_transform; + A5O_TRANSFORM projview_transform; - _ALLEGRO_RENDER_STATE render_state; + _A5O_RENDER_STATE render_state; _AL_VECTOR display_invalidated_callbacks; _AL_VECTOR display_validated_callbacks; @@ -161,29 +161,29 @@ struct ALLEGRO_DISPLAY bool use_constraints; }; -int _al_score_display_settings(ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds, ALLEGRO_EXTRA_DISPLAY_SETTINGS *ref); -void _al_fill_display_settings(ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds); -void _al_set_color_components(int format, ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds, int importance); -int _al_deduce_color_format(ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds); +int _al_score_display_settings(A5O_EXTRA_DISPLAY_SETTINGS *eds, A5O_EXTRA_DISPLAY_SETTINGS *ref); +void _al_fill_display_settings(A5O_EXTRA_DISPLAY_SETTINGS *eds); +void _al_set_color_components(int format, A5O_EXTRA_DISPLAY_SETTINGS *eds, int importance); +int _al_deduce_color_format(A5O_EXTRA_DISPLAY_SETTINGS *eds); int _al_display_settings_sorter(const void *p0, const void *p1); -int _al_get_suggested_display_option(ALLEGRO_DISPLAY *d, +int _al_get_suggested_display_option(A5O_DISPLAY *d, int option, int default_value); /* This is called from the primitives addon and for shaders. */ -AL_FUNC(void, _al_add_display_invalidated_callback, (ALLEGRO_DISPLAY *display, - void (*display_invalidated)(ALLEGRO_DISPLAY*))); -AL_FUNC(void, _al_add_display_validated_callback, (ALLEGRO_DISPLAY *display, - void (*display_validated)(ALLEGRO_DISPLAY*))); -AL_FUNC(void, _al_remove_display_invalidated_callback, (ALLEGRO_DISPLAY *display, - void (*display_invalidated)(ALLEGRO_DISPLAY*))); -AL_FUNC(void, _al_remove_display_validated_callback, (ALLEGRO_DISPLAY *display, - void (*display_validated)(ALLEGRO_DISPLAY*))); +AL_FUNC(void, _al_add_display_invalidated_callback, (A5O_DISPLAY *display, + void (*display_invalidated)(A5O_DISPLAY*))); +AL_FUNC(void, _al_add_display_validated_callback, (A5O_DISPLAY *display, + void (*display_validated)(A5O_DISPLAY*))); +AL_FUNC(void, _al_remove_display_invalidated_callback, (A5O_DISPLAY *display, + void (*display_invalidated)(A5O_DISPLAY*))); +AL_FUNC(void, _al_remove_display_validated_callback, (A5O_DISPLAY *display, + void (*display_validated)(A5O_DISPLAY*))); /* Defined in tls.c */ -bool _al_set_current_display_only(ALLEGRO_DISPLAY *display); -void _al_set_new_display_settings(ALLEGRO_EXTRA_DISPLAY_SETTINGS *settings); -ALLEGRO_EXTRA_DISPLAY_SETTINGS *_al_get_new_display_settings(void); +bool _al_set_current_display_only(A5O_DISPLAY *display); +void _al_set_new_display_settings(A5O_EXTRA_DISPLAY_SETTINGS *settings); +A5O_EXTRA_DISPLAY_SETTINGS *_al_get_new_display_settings(void); #ifdef __cplusplus diff --git a/include/allegro5/internal/aintern_events.h b/include/allegro5/internal/aintern_events.h index f555554670..cb3a8bad0c 100644 --- a/include/allegro5/internal/aintern_events.h +++ b/include/allegro5/internal/aintern_events.h @@ -9,34 +9,34 @@ #endif -typedef struct ALLEGRO_EVENT_SOURCE_REAL ALLEGRO_EVENT_SOURCE_REAL; +typedef struct A5O_EVENT_SOURCE_REAL A5O_EVENT_SOURCE_REAL; -struct ALLEGRO_EVENT_SOURCE_REAL +struct A5O_EVENT_SOURCE_REAL { _AL_MUTEX mutex; _AL_VECTOR queues; intptr_t data; }; -typedef struct ALLEGRO_USER_EVENT_DESCRIPTOR +typedef struct A5O_USER_EVENT_DESCRIPTOR { - void (*dtor)(ALLEGRO_USER_EVENT *event); + void (*dtor)(A5O_USER_EVENT *event); int refcount; -} ALLEGRO_USER_EVENT_DESCRIPTOR; +} A5O_USER_EVENT_DESCRIPTOR; void _al_init_events(void); -void _al_event_source_init(ALLEGRO_EVENT_SOURCE*); -void _al_event_source_free(ALLEGRO_EVENT_SOURCE*); -void _al_event_source_lock(ALLEGRO_EVENT_SOURCE*); -void _al_event_source_unlock(ALLEGRO_EVENT_SOURCE*); -void _al_event_source_on_registration_to_queue(ALLEGRO_EVENT_SOURCE*, ALLEGRO_EVENT_QUEUE*); -void _al_event_source_on_unregistration_from_queue(ALLEGRO_EVENT_SOURCE*, ALLEGRO_EVENT_QUEUE*); -bool _al_event_source_needs_to_generate_event(ALLEGRO_EVENT_SOURCE*); -void _al_event_source_emit_event(ALLEGRO_EVENT_SOURCE *, ALLEGRO_EVENT*); +void _al_event_source_init(A5O_EVENT_SOURCE*); +void _al_event_source_free(A5O_EVENT_SOURCE*); +void _al_event_source_lock(A5O_EVENT_SOURCE*); +void _al_event_source_unlock(A5O_EVENT_SOURCE*); +void _al_event_source_on_registration_to_queue(A5O_EVENT_SOURCE*, A5O_EVENT_QUEUE*); +void _al_event_source_on_unregistration_from_queue(A5O_EVENT_SOURCE*, A5O_EVENT_QUEUE*); +bool _al_event_source_needs_to_generate_event(A5O_EVENT_SOURCE*); +void _al_event_source_emit_event(A5O_EVENT_SOURCE *, A5O_EVENT*); -void _al_event_queue_push_event(ALLEGRO_EVENT_QUEUE*, const ALLEGRO_EVENT*); +void _al_event_queue_push_event(A5O_EVENT_QUEUE*, const A5O_EVENT*); #ifdef __cplusplus diff --git a/include/allegro5/internal/aintern_file.h b/include/allegro5/internal/aintern_file.h index 81a7fe5685..618ef4f3d7 100644 --- a/include/allegro5/internal/aintern_file.h +++ b/include/allegro5/internal/aintern_file.h @@ -6,15 +6,15 @@ #endif -extern const ALLEGRO_FILE_INTERFACE _al_file_interface_stdio; +extern const A5O_FILE_INTERFACE _al_file_interface_stdio; -#define ALLEGRO_UNGETC_SIZE 16 +#define A5O_UNGETC_SIZE 16 -struct ALLEGRO_FILE +struct A5O_FILE { - const ALLEGRO_FILE_INTERFACE *vtable; + const A5O_FILE_INTERFACE *vtable; void *userdata; - unsigned char ungetc[ALLEGRO_UNGETC_SIZE]; + unsigned char ungetc[A5O_UNGETC_SIZE]; int ungetc_len; }; diff --git a/include/allegro5/internal/aintern_fshook.h b/include/allegro5/internal/aintern_fshook.h index e159d57a22..d74155c50e 100644 --- a/include/allegro5/internal/aintern_fshook.h +++ b/include/allegro5/internal/aintern_fshook.h @@ -23,7 +23,7 @@ #endif -extern struct ALLEGRO_FS_INTERFACE _al_fs_interface_stdio; +extern struct A5O_FS_INTERFACE _al_fs_interface_stdio; #ifdef __cplusplus diff --git a/include/allegro5/internal/aintern_gp2xwiz.h b/include/allegro5/internal/aintern_gp2xwiz.h index be73164bc2..3207a71111 100644 --- a/include/allegro5/internal/aintern_gp2xwiz.h +++ b/include/allegro5/internal/aintern_gp2xwiz.h @@ -11,21 +11,21 @@ #include -typedef struct ALLEGRO_SYSTEM_GP2XWIZ ALLEGRO_SYSTEM_GP2XWIZ; -typedef struct ALLEGRO_DISPLAY_GP2XWIZ_OGL ALLEGRO_DISPLAY_GP2XWIZ_OGL; -typedef struct ALLEGRO_DISPLAY_GP2XWIZ_FB ALLEGRO_DISPLAY_GP2XWIZ_FB; +typedef struct A5O_SYSTEM_GP2XWIZ A5O_SYSTEM_GP2XWIZ; +typedef struct A5O_DISPLAY_GP2XWIZ_OGL A5O_DISPLAY_GP2XWIZ_OGL; +typedef struct A5O_DISPLAY_GP2XWIZ_FB A5O_DISPLAY_GP2XWIZ_FB; -struct ALLEGRO_SYSTEM_GP2XWIZ +struct A5O_SYSTEM_GP2XWIZ { - ALLEGRO_SYSTEM system; /* This must be the first member, we "derive" from it. */ + A5O_SYSTEM system; /* This must be the first member, we "derive" from it. */ - ALLEGRO_EXTRA_DISPLAY_SETTINGS extras; + A5O_EXTRA_DISPLAY_SETTINGS extras; }; -/* This is our version of ALLEGRO_DISPLAY with driver specific extra data. */ -struct ALLEGRO_DISPLAY_GP2XWIZ_OGL +/* This is our version of A5O_DISPLAY with driver specific extra data. */ +struct A5O_DISPLAY_GP2XWIZ_OGL { - ALLEGRO_DISPLAY display; /* This must be the first member. */ + A5O_DISPLAY display; /* This must be the first member. */ EGLDisplay egl_display; EGLConfig egl_config; @@ -34,12 +34,12 @@ struct ALLEGRO_DISPLAY_GP2XWIZ_OGL NativeWindowType hNativeWnd; }; -/* This is our version of ALLEGRO_DISPLAY with driver specific extra data. */ -struct ALLEGRO_DISPLAY_GP2XWIZ_FB +/* This is our version of A5O_DISPLAY with driver specific extra data. */ +struct A5O_DISPLAY_GP2XWIZ_FB { - ALLEGRO_DISPLAY display; /* This must be the first member. */ + A5O_DISPLAY display; /* This must be the first member. */ - ALLEGRO_BITMAP *backbuffer; + A5O_BITMAP *backbuffer; /* * We create the backbuffer bitmap then points it's ->memory at * lc_fb1 (initialized with libcastor. This is a backup of the diff --git a/include/allegro5/internal/aintern_haptic.h b/include/allegro5/internal/aintern_haptic.h index 581a5a7397..bf5c4489f8 100644 --- a/include/allegro5/internal/aintern_haptic.h +++ b/include/allegro5/internal/aintern_haptic.h @@ -11,9 +11,9 @@ extern "C" { #endif -#if defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) +#if defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_SRC) -typedef struct ALLEGRO_HAPTIC_DRIVER +typedef struct A5O_HAPTIC_DRIVER { int hapdrv_id; const char *hapdrv_name; @@ -22,38 +22,38 @@ typedef struct ALLEGRO_HAPTIC_DRIVER AL_METHOD(bool, init_haptic, (void)); AL_METHOD(void, exit_haptic, (void)); - AL_METHOD(bool, is_mouse_haptic, (ALLEGRO_MOUSE *)); - AL_METHOD(bool, is_joystick_haptic, (ALLEGRO_JOYSTICK *)); - AL_METHOD(bool, is_keyboard_haptic, (ALLEGRO_KEYBOARD *)); - AL_METHOD(bool, is_display_haptic, (ALLEGRO_DISPLAY *)); - AL_METHOD(bool, is_touch_input_haptic, (ALLEGRO_TOUCH_INPUT *)); - - AL_METHOD(ALLEGRO_HAPTIC *, get_from_mouse, (ALLEGRO_MOUSE *)); - AL_METHOD(ALLEGRO_HAPTIC *, get_from_joystick, (ALLEGRO_JOYSTICK *)); - AL_METHOD(ALLEGRO_HAPTIC *, get_from_keyboard, (ALLEGRO_KEYBOARD *)); - AL_METHOD(ALLEGRO_HAPTIC *, get_from_display, (ALLEGRO_DISPLAY *)); - AL_METHOD(ALLEGRO_HAPTIC *, get_from_touch_input, (ALLEGRO_TOUCH_INPUT *)); - - AL_METHOD(bool, get_active, (ALLEGRO_HAPTIC *)); - AL_METHOD(int, get_capabilities, (ALLEGRO_HAPTIC *)); - AL_METHOD(double, get_gain, (ALLEGRO_HAPTIC *)); - AL_METHOD(bool, set_gain, (ALLEGRO_HAPTIC *, double)); - AL_METHOD(int, get_max_effects, (ALLEGRO_HAPTIC *)); - - AL_METHOD(bool, is_effect_ok, (ALLEGRO_HAPTIC *, ALLEGRO_HAPTIC_EFFECT *)); - AL_METHOD(bool, upload_effect, (ALLEGRO_HAPTIC *, ALLEGRO_HAPTIC_EFFECT *, - ALLEGRO_HAPTIC_EFFECT_ID *)); - AL_METHOD(bool, play_effect, (ALLEGRO_HAPTIC_EFFECT_ID *, int)); - AL_METHOD(bool, stop_effect, (ALLEGRO_HAPTIC_EFFECT_ID *)); - AL_METHOD(bool, is_effect_playing, (ALLEGRO_HAPTIC_EFFECT_ID *)); - AL_METHOD(bool, release_effect, (ALLEGRO_HAPTIC_EFFECT_ID *)); - AL_METHOD(bool, release, (ALLEGRO_HAPTIC *)); - AL_METHOD(double, get_autocenter, (ALLEGRO_HAPTIC *)); - AL_METHOD(bool, set_autocenter, (ALLEGRO_HAPTIC *, double)); -} ALLEGRO_HAPTIC_DRIVER; - - -enum ALLEGRO_HAPTIC_PARENT + AL_METHOD(bool, is_mouse_haptic, (A5O_MOUSE *)); + AL_METHOD(bool, is_joystick_haptic, (A5O_JOYSTICK *)); + AL_METHOD(bool, is_keyboard_haptic, (A5O_KEYBOARD *)); + AL_METHOD(bool, is_display_haptic, (A5O_DISPLAY *)); + AL_METHOD(bool, is_touch_input_haptic, (A5O_TOUCH_INPUT *)); + + AL_METHOD(A5O_HAPTIC *, get_from_mouse, (A5O_MOUSE *)); + AL_METHOD(A5O_HAPTIC *, get_from_joystick, (A5O_JOYSTICK *)); + AL_METHOD(A5O_HAPTIC *, get_from_keyboard, (A5O_KEYBOARD *)); + AL_METHOD(A5O_HAPTIC *, get_from_display, (A5O_DISPLAY *)); + AL_METHOD(A5O_HAPTIC *, get_from_touch_input, (A5O_TOUCH_INPUT *)); + + AL_METHOD(bool, get_active, (A5O_HAPTIC *)); + AL_METHOD(int, get_capabilities, (A5O_HAPTIC *)); + AL_METHOD(double, get_gain, (A5O_HAPTIC *)); + AL_METHOD(bool, set_gain, (A5O_HAPTIC *, double)); + AL_METHOD(int, get_max_effects, (A5O_HAPTIC *)); + + AL_METHOD(bool, is_effect_ok, (A5O_HAPTIC *, A5O_HAPTIC_EFFECT *)); + AL_METHOD(bool, upload_effect, (A5O_HAPTIC *, A5O_HAPTIC_EFFECT *, + A5O_HAPTIC_EFFECT_ID *)); + AL_METHOD(bool, play_effect, (A5O_HAPTIC_EFFECT_ID *, int)); + AL_METHOD(bool, stop_effect, (A5O_HAPTIC_EFFECT_ID *)); + AL_METHOD(bool, is_effect_playing, (A5O_HAPTIC_EFFECT_ID *)); + AL_METHOD(bool, release_effect, (A5O_HAPTIC_EFFECT_ID *)); + AL_METHOD(bool, release, (A5O_HAPTIC *)); + AL_METHOD(double, get_autocenter, (A5O_HAPTIC *)); + AL_METHOD(bool, set_autocenter, (A5O_HAPTIC *, double)); +} A5O_HAPTIC_DRIVER; + + +enum A5O_HAPTIC_PARENT { _AL_HAPTIC_FROM_JOYSTICK = 1, _AL_HAPTIC_FROM_MOUSE, @@ -63,13 +63,13 @@ enum ALLEGRO_HAPTIC_PARENT }; /* haptic has a driver field for per-device drivers on some platforms. */ -struct ALLEGRO_HAPTIC +struct A5O_HAPTIC { - enum ALLEGRO_HAPTIC_PARENT from; + enum A5O_HAPTIC_PARENT from; void *device; double gain; double autocenter; - ALLEGRO_HAPTIC_DRIVER *driver; + A5O_HAPTIC_DRIVER *driver; }; /* Haptic driver list. */ @@ -85,8 +85,8 @@ extern const _AL_DRIVER_INFO _al_haptic_driver_list[]; #else -/* Forward declare it for ALLEGRO_SYSTEM_INTERFACE. */ -typedef struct ALLEGRO_HAPTIC_DRIVER ALLEGRO_HAPTIC_DRIVER; +/* Forward declare it for A5O_SYSTEM_INTERFACE. */ +typedef struct A5O_HAPTIC_DRIVER A5O_HAPTIC_DRIVER; #endif diff --git a/include/allegro5/internal/aintern_iphone.h b/include/allegro5/internal/aintern_iphone.h index 9bebc5a17a..a3533e1e7b 100644 --- a/include/allegro5/internal/aintern_iphone.h +++ b/include/allegro5/internal/aintern_iphone.h @@ -1,46 +1,46 @@ -#ifndef ALLEGRO_INTERNAL_IPHONE -#define ALLEGRO_INTERNAL_IPHONE +#ifndef A5O_INTERNAL_IPHONE +#define A5O_INTERNAL_IPHONE #include "allegro5/allegro.h" #include #include -typedef struct ALLEGRO_SYSTEM_IPHONE { - ALLEGRO_SYSTEM system; +typedef struct A5O_SYSTEM_IPHONE { + A5O_SYSTEM system; - ALLEGRO_MUTEX *mutex; - ALLEGRO_COND *cond; + A5O_MUTEX *mutex; + A5O_COND *cond; bool has_shutdown, wants_shutdown; int visuals_count; - ALLEGRO_EXTRA_DISPLAY_SETTINGS **visuals; -} ALLEGRO_SYSTEM_IPHONE; + A5O_EXTRA_DISPLAY_SETTINGS **visuals; +} A5O_SYSTEM_IPHONE; -typedef struct ALLEGRO_DISPLAY_IPHONE_EXTRA ALLEGRO_DISPLAY_IPHONE_EXTRA; +typedef struct A5O_DISPLAY_IPHONE_EXTRA A5O_DISPLAY_IPHONE_EXTRA; -typedef struct ALLEGRO_DISPLAY_IPHONE { - ALLEGRO_DISPLAY display; - ALLEGRO_DISPLAY_IPHONE_EXTRA *extra; -} ALLEGRO_DISPLAY_IPHONE; +typedef struct A5O_DISPLAY_IPHONE { + A5O_DISPLAY display; + A5O_DISPLAY_IPHONE_EXTRA *extra; +} A5O_DISPLAY_IPHONE; void _al_iphone_init_path(void); -bool _al_iphone_add_view(ALLEGRO_DISPLAY *d); -void _al_iphone_make_view_current(ALLEGRO_DISPLAY *display); -void _al_iphone_flip_view(ALLEGRO_DISPLAY *display); -void _al_iphone_reset_framebuffer(ALLEGRO_DISPLAY *display); -void _al_iphone_recreate_framebuffer(ALLEGRO_DISPLAY *); -void _al_iphone_destroy_screen(ALLEGRO_DISPLAY *display); -ALLEGRO_SYSTEM_INTERFACE *_al_get_iphone_system_interface(void); -ALLEGRO_DISPLAY_INTERFACE *_al_get_iphone_display_interface(void); -ALLEGRO_KEYBOARD_DRIVER *_al_get_iphone_keyboard_driver(void); -ALLEGRO_MOUSE_DRIVER *_al_get_iphone_mouse_driver(void); -ALLEGRO_TOUCH_INPUT_DRIVER *_al_get_iphone_touch_input_driver(void); -ALLEGRO_JOYSTICK_DRIVER *_al_get_iphone_joystick_driver(void); -void _al_iphone_setup_opengl_view(ALLEGRO_DISPLAY *d, bool manage_backbuffer); +bool _al_iphone_add_view(A5O_DISPLAY *d); +void _al_iphone_make_view_current(A5O_DISPLAY *display); +void _al_iphone_flip_view(A5O_DISPLAY *display); +void _al_iphone_reset_framebuffer(A5O_DISPLAY *display); +void _al_iphone_recreate_framebuffer(A5O_DISPLAY *); +void _al_iphone_destroy_screen(A5O_DISPLAY *display); +A5O_SYSTEM_INTERFACE *_al_get_iphone_system_interface(void); +A5O_DISPLAY_INTERFACE *_al_get_iphone_display_interface(void); +A5O_KEYBOARD_DRIVER *_al_get_iphone_keyboard_driver(void); +A5O_MOUSE_DRIVER *_al_get_iphone_mouse_driver(void); +A5O_TOUCH_INPUT_DRIVER *_al_get_iphone_touch_input_driver(void); +A5O_JOYSTICK_DRIVER *_al_get_iphone_joystick_driver(void); +void _al_iphone_setup_opengl_view(A5O_DISPLAY *d, bool manage_backbuffer); //void _al_iphone_generate_mouse_event(unsigned int type, -// int x, int y, unsigned int button, ALLEGRO_DISPLAY *d); -//void _al_iphone_generate_touch_event(unsigned int type, double timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY *d); +// int x, int y, unsigned int button, A5O_DISPLAY *d); +//void _al_iphone_generate_touch_event(unsigned int type, double timestamp, float x, float y, bool primary, A5O_DISPLAY *d); void _al_iphone_update_visuals(void); void _al_iphone_accelerometer_control(int frequency); void _al_iphone_generate_joystick_event(float x, float y, float z); @@ -48,16 +48,16 @@ void _al_iphone_await_termination(void); void _al_iphone_get_screen_size(int adapter, int *w, int *h); int _al_iphone_get_num_video_adapters(void); int _al_iphone_get_orientation(); -void _al_iphone_translate_from_screen(ALLEGRO_DISPLAY *d, int *x, int *y); -void _al_iphone_translate_to_screen(ALLEGRO_DISPLAY *d, int *x, int *y); -void _al_iphone_clip(ALLEGRO_BITMAP const *bitmap, int x_1, int y_1, int x_2, int y_2); +void _al_iphone_translate_from_screen(A5O_DISPLAY *d, int *x, int *y); +void _al_iphone_translate_to_screen(A5O_DISPLAY *d, int *x, int *y); +void _al_iphone_clip(A5O_BITMAP const *bitmap, int x_1, int y_1, int x_2, int y_2); -void _al_iphone_touch_input_handle_begin(int id, double timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY *disp); -void _al_iphone_touch_input_handle_end(int id, double timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY *disp); -void _al_iphone_touch_input_handle_move(int id, double timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY *disp); -void _al_iphone_touch_input_handle_cancel(int id, double timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY *disp); +void _al_iphone_touch_input_handle_begin(int id, double timestamp, float x, float y, bool primary, A5O_DISPLAY *disp); +void _al_iphone_touch_input_handle_end(int id, double timestamp, float x, float y, bool primary, A5O_DISPLAY *disp); +void _al_iphone_touch_input_handle_move(int id, double timestamp, float x, float y, bool primary, A5O_DISPLAY *disp); +void _al_iphone_touch_input_handle_cancel(int id, double timestamp, float x, float y, bool primary, A5O_DISPLAY *disp); -void _al_iphone_disconnect(ALLEGRO_DISPLAY *display); -void _al_iphone_add_clipboard_functions(ALLEGRO_DISPLAY_INTERFACE *vt); +void _al_iphone_disconnect(A5O_DISPLAY *display); +void _al_iphone_add_clipboard_functions(A5O_DISPLAY_INTERFACE *vt); -#endif // ALLEGRO_INTERNAL_IPHONE +#endif // A5O_INTERNAL_IPHONE diff --git a/include/allegro5/internal/aintern_joystick.h b/include/allegro5/internal/aintern_joystick.h index ef313150ee..5943637ccd 100644 --- a/include/allegro5/internal/aintern_joystick.h +++ b/include/allegro5/internal/aintern_joystick.h @@ -9,7 +9,7 @@ #endif -typedef struct ALLEGRO_JOYSTICK_DRIVER +typedef struct A5O_JOYSTICK_DRIVER { int joydrv_id; const char *joydrv_name; @@ -19,12 +19,12 @@ typedef struct ALLEGRO_JOYSTICK_DRIVER AL_METHOD(void, exit_joystick, (void)); AL_METHOD(bool, reconfigure_joysticks, (void)); AL_METHOD(int, num_joysticks, (void)); - AL_METHOD(ALLEGRO_JOYSTICK *, get_joystick, (int joyn)); - AL_METHOD(void, release_joystick, (ALLEGRO_JOYSTICK *joy)); - AL_METHOD(void, get_joystick_state, (ALLEGRO_JOYSTICK *joy, ALLEGRO_JOYSTICK_STATE *ret_state)); - AL_METHOD(const char *, get_name, (ALLEGRO_JOYSTICK *joy)); - AL_METHOD(bool, get_active, (ALLEGRO_JOYSTICK *joy)); -} ALLEGRO_JOYSTICK_DRIVER; + AL_METHOD(A5O_JOYSTICK *, get_joystick, (int joyn)); + AL_METHOD(void, release_joystick, (A5O_JOYSTICK *joy)); + AL_METHOD(void, get_joystick_state, (A5O_JOYSTICK *joy, A5O_JOYSTICK_STATE *ret_state)); + AL_METHOD(const char *, get_name, (A5O_JOYSTICK *joy)); + AL_METHOD(bool, get_active, (A5O_JOYSTICK *joy)); +} A5O_JOYSTICK_DRIVER; extern _AL_DRIVER_INFO _al_joystick_driver_list[]; @@ -76,13 +76,13 @@ typedef struct _AL_JOYSTICK_INFO /* Joystick has a driver field for per-device drivers, * needed on some platforms. */ -struct ALLEGRO_JOYSTICK +struct A5O_JOYSTICK { _AL_JOYSTICK_INFO info; - ALLEGRO_JOYSTICK_DRIVER * driver; + A5O_JOYSTICK_DRIVER * driver; }; -void _al_generate_joystick_event(ALLEGRO_EVENT *event); +void _al_generate_joystick_event(A5O_EVENT *event); #ifdef __cplusplus } diff --git a/include/allegro5/internal/aintern_keyboard.h b/include/allegro5/internal/aintern_keyboard.h index dd939225aa..e9b71a3d66 100644 --- a/include/allegro5/internal/aintern_keyboard.h +++ b/include/allegro5/internal/aintern_keyboard.h @@ -8,7 +8,7 @@ #endif -typedef struct ALLEGRO_KEYBOARD_DRIVER +typedef struct A5O_KEYBOARD_DRIVER { int keydrv_id; const char *keydrv_name; @@ -16,12 +16,12 @@ typedef struct ALLEGRO_KEYBOARD_DRIVER const char *keydrv_ascii_name; AL_METHOD(bool, init_keyboard, (void)); AL_METHOD(void, exit_keyboard, (void)); - AL_METHOD(ALLEGRO_KEYBOARD*, get_keyboard, (void)); + AL_METHOD(A5O_KEYBOARD*, get_keyboard, (void)); AL_METHOD(bool, set_keyboard_leds, (int leds)); AL_METHOD(const char *, keycode_to_name, (int keycode)); - AL_METHOD(void, get_keyboard_state, (ALLEGRO_KEYBOARD_STATE *ret_state)); + AL_METHOD(void, get_keyboard_state, (A5O_KEYBOARD_STATE *ret_state)); AL_METHOD(void, clear_keyboard_state, (void)); -} ALLEGRO_KEYBOARD_DRIVER; +} A5O_KEYBOARD_DRIVER; extern _AL_DRIVER_INFO _al_keyboard_driver_list[]; @@ -31,9 +31,9 @@ extern const char *_al_keyboard_common_names[]; int _al_parse_key_binding(const char *s, unsigned int *modifiers); -struct ALLEGRO_KEYBOARD +struct A5O_KEYBOARD { - ALLEGRO_EVENT_SOURCE es; + A5O_EVENT_SOURCE es; }; diff --git a/include/allegro5/internal/aintern_ljoynu.h b/include/allegro5/internal/aintern_ljoynu.h index 355bc320c6..21eb197f89 100644 --- a/include/allegro5/internal/aintern_ljoynu.h +++ b/include/allegro5/internal/aintern_ljoynu.h @@ -50,19 +50,19 @@ typedef struct { } BUTTON_MAPPING; -typedef struct ALLEGRO_JOYSTICK_LINUX +typedef struct A5O_JOYSTICK_LINUX { - ALLEGRO_JOYSTICK parent; + A5O_JOYSTICK parent; int config_state; bool marked; int fd; - ALLEGRO_USTR *device_name; + A5O_USTR *device_name; AXIS_MAPPING axis_mapping[TOTAL_JOYSTICK_AXES]; BUTTON_MAPPING button_mapping[_AL_MAX_JOYSTICK_BUTTONS]; - ALLEGRO_JOYSTICK_STATE joystate; + A5O_JOYSTICK_STATE joystate; char name[100]; -} ALLEGRO_JOYSTICK_LINUX; +} A5O_JOYSTICK_LINUX; #endif diff --git a/include/allegro5/internal/aintern_memblit.h b/include/allegro5/internal/aintern_memblit.h index 0e6bed2d0c..ec6d7315b2 100644 --- a/include/allegro5/internal/aintern_memblit.h +++ b/include/allegro5/internal/aintern_memblit.h @@ -6,8 +6,8 @@ #endif -void _al_draw_bitmap_region_memory(ALLEGRO_BITMAP *bitmap, - ALLEGRO_COLOR tint, +void _al_draw_bitmap_region_memory(A5O_BITMAP *bitmap, + A5O_COLOR tint, int sx, int sy, int sw, int sh, int dx, int dy, int flags); diff --git a/include/allegro5/internal/aintern_memdraw.h b/include/allegro5/internal/aintern_memdraw.h index adb2956708..162a860cdb 100644 --- a/include/allegro5/internal/aintern_memdraw.h +++ b/include/allegro5/internal/aintern_memdraw.h @@ -6,8 +6,8 @@ #endif -void _al_clear_bitmap_by_locking(ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR *color); -void _al_draw_pixel_memory(ALLEGRO_BITMAP *bmp, float x, float y, ALLEGRO_COLOR *color); +void _al_clear_bitmap_by_locking(A5O_BITMAP *bitmap, A5O_COLOR *color); +void _al_draw_pixel_memory(A5O_BITMAP *bmp, float x, float y, A5O_COLOR *color); #ifdef __cplusplus diff --git a/include/allegro5/internal/aintern_mouse.h b/include/allegro5/internal/aintern_mouse.h index cdbe0467ad..5f79e4a711 100644 --- a/include/allegro5/internal/aintern_mouse.h +++ b/include/allegro5/internal/aintern_mouse.h @@ -9,7 +9,7 @@ #endif -typedef struct ALLEGRO_MOUSE_DRIVER +typedef struct A5O_MOUSE_DRIVER { int msedrv_id; const char *msedrv_name; @@ -17,21 +17,21 @@ typedef struct ALLEGRO_MOUSE_DRIVER const char *msedrv_ascii_name; AL_METHOD(bool, init_mouse, (void)); AL_METHOD(void, exit_mouse, (void)); - AL_METHOD(ALLEGRO_MOUSE*, get_mouse, (void)); + AL_METHOD(A5O_MOUSE*, get_mouse, (void)); AL_METHOD(unsigned int, get_mouse_num_buttons, (void)); AL_METHOD(unsigned int, get_mouse_num_axes, (void)); - AL_METHOD(bool, set_mouse_xy, (ALLEGRO_DISPLAY *display, int x, int y)); + AL_METHOD(bool, set_mouse_xy, (A5O_DISPLAY *display, int x, int y)); AL_METHOD(bool, set_mouse_axis, (int which, int value)); - AL_METHOD(void, get_mouse_state, (ALLEGRO_MOUSE_STATE *ret_state)); -} ALLEGRO_MOUSE_DRIVER; + AL_METHOD(void, get_mouse_state, (A5O_MOUSE_STATE *ret_state)); +} A5O_MOUSE_DRIVER; extern _AL_DRIVER_INFO _al_mouse_driver_list[]; -struct ALLEGRO_MOUSE +struct A5O_MOUSE { - ALLEGRO_EVENT_SOURCE es; + A5O_EVENT_SOURCE es; }; diff --git a/include/allegro5/internal/aintern_opengl.h b/include/allegro5/internal/aintern_opengl.h index fd42be4179..ab04ad8a15 100644 --- a/include/allegro5/internal/aintern_opengl.h +++ b/include/allegro5/internal/aintern_opengl.h @@ -11,24 +11,24 @@ extern "C" { enum { - _ALLEGRO_OPENGL_VERSION_0 = 0, /* dummy */ - _ALLEGRO_OPENGL_VERSION_1_0 = 0x01000000, - _ALLEGRO_OPENGL_VERSION_1_1 = 0x01010000, - _ALLEGRO_OPENGL_VERSION_1_2 = 0x01020000, - _ALLEGRO_OPENGL_VERSION_1_2_1 = 0x01020100, - _ALLEGRO_OPENGL_VERSION_1_3 = 0x01030000, - _ALLEGRO_OPENGL_VERSION_1_4 = 0x01040000, - _ALLEGRO_OPENGL_VERSION_1_5 = 0x01050000, - _ALLEGRO_OPENGL_VERSION_2_0 = 0x02000000, - _ALLEGRO_OPENGL_VERSION_2_1 = 0x02010000, - _ALLEGRO_OPENGL_VERSION_3_0 = 0x03000000, - _ALLEGRO_OPENGL_VERSION_3_1 = 0x03010000, - _ALLEGRO_OPENGL_VERSION_3_2 = 0x03020000, - _ALLEGRO_OPENGL_VERSION_3_3 = 0x03030000, - _ALLEGRO_OPENGL_VERSION_4_0 = 0x04000000 + _A5O_OPENGL_VERSION_0 = 0, /* dummy */ + _A5O_OPENGL_VERSION_1_0 = 0x01000000, + _A5O_OPENGL_VERSION_1_1 = 0x01010000, + _A5O_OPENGL_VERSION_1_2 = 0x01020000, + _A5O_OPENGL_VERSION_1_2_1 = 0x01020100, + _A5O_OPENGL_VERSION_1_3 = 0x01030000, + _A5O_OPENGL_VERSION_1_4 = 0x01040000, + _A5O_OPENGL_VERSION_1_5 = 0x01050000, + _A5O_OPENGL_VERSION_2_0 = 0x02000000, + _A5O_OPENGL_VERSION_2_1 = 0x02010000, + _A5O_OPENGL_VERSION_3_0 = 0x03000000, + _A5O_OPENGL_VERSION_3_1 = 0x03010000, + _A5O_OPENGL_VERSION_3_2 = 0x03020000, + _A5O_OPENGL_VERSION_3_3 = 0x03030000, + _A5O_OPENGL_VERSION_4_0 = 0x04000000 }; -#define ALLEGRO_MAX_OPENGL_FBOS 8 +#define A5O_MAX_OPENGL_FBOS 8 enum { FBO_INFO_UNUSED = 0, @@ -36,11 +36,11 @@ enum { FBO_INFO_PERSISTENT = 2 /* exclusive to the owner bitmap */ }; -typedef struct ALLEGRO_FBO_BUFFERS +typedef struct A5O_FBO_BUFFERS { /* It is not easy to determine the best lifetime for these. Unlike * FBOs they are heavy objects and re-creating them can be costly. - * However if we make them part of ALLEGRO_BITMAP_EXTRA_OPENGL + * However if we make them part of A5O_BITMAP_EXTRA_OPENGL * below, there is no way to release them. I.e. if you create * many bitmaps in the beginning of your game and need depth and/or * multisampling for them, the only way to free the buffers would be @@ -56,20 +56,20 @@ typedef struct ALLEGRO_FBO_BUFFERS GLuint multisample_buffer; int mw, mh, samples; -} ALLEGRO_FBO_BUFFERS; +} A5O_FBO_BUFFERS; -typedef struct ALLEGRO_FBO_INFO +typedef struct A5O_FBO_INFO { int fbo_state; GLuint fbo; - ALLEGRO_FBO_BUFFERS buffers; + A5O_FBO_BUFFERS buffers; - ALLEGRO_BITMAP *owner; + A5O_BITMAP *owner; double last_use_time; -} ALLEGRO_FBO_INFO; +} A5O_FBO_INFO; -typedef struct ALLEGRO_BITMAP_EXTRA_OPENGL +typedef struct A5O_BITMAP_EXTRA_OPENGL { /* Driver specifics. */ @@ -78,7 +78,7 @@ typedef struct ALLEGRO_BITMAP_EXTRA_OPENGL GLuint texture; /* 0 means, not uploaded yet. */ - ALLEGRO_FBO_INFO *fbo_info; + A5O_FBO_INFO *fbo_info; /* When an OpenGL bitmap is locked, the locked region is usually backed by a * temporary memory buffer pointed to by lock_buffer. @@ -88,11 +88,11 @@ typedef struct ALLEGRO_BITMAP_EXTRA_OPENGL * bitmap is drawn onto the backbuffer. */ unsigned char *lock_buffer; - ALLEGRO_BITMAP *lock_proxy; + A5O_BITMAP *lock_proxy; float left, top, right, bottom; /* Texture coordinates. */ bool is_backbuffer; /* This is not a real bitmap, but the backbuffer. */ -} ALLEGRO_BITMAP_EXTRA_OPENGL; +} A5O_BITMAP_EXTRA_OPENGL; typedef struct OPENGL_INFO { uint32_t version; /* OpenGL version */ @@ -108,7 +108,7 @@ typedef struct OPENGL_INFO { } OPENGL_INFO; -typedef struct ALLEGRO_OGL_VARLOCS +typedef struct A5O_OGL_VARLOCS { /* Cached shader variable locations. */ GLint pos_loc; @@ -122,107 +122,107 @@ typedef struct ALLEGRO_OGL_VARLOCS GLint alpha_test_loc; GLint alpha_func_loc; GLint alpha_test_val_loc; - GLint user_attr_loc[_ALLEGRO_PRIM_MAX_USER_ATTR]; -} ALLEGRO_OGL_VARLOCS; + GLint user_attr_loc[_A5O_PRIM_MAX_USER_ATTR]; +} A5O_OGL_VARLOCS; -typedef struct ALLEGRO_OGL_EXTRAS +typedef struct A5O_OGL_EXTRAS { /* A list of extensions supported by Allegro, for this context. */ - ALLEGRO_OGL_EXT_LIST *extension_list; + A5O_OGL_EXT_LIST *extension_list; /* A list of extension API, loaded by Allegro, for this context. */ - ALLEGRO_OGL_EXT_API *extension_api; + A5O_OGL_EXT_API *extension_api; /* Various info about OpenGL implementation. */ OPENGL_INFO ogl_info; - ALLEGRO_BITMAP *opengl_target; + A5O_BITMAP *opengl_target; - ALLEGRO_BITMAP *backbuffer; + A5O_BITMAP *backbuffer; /* True if display resources are shared among displays. */ bool is_shared; - ALLEGRO_FBO_INFO fbos[ALLEGRO_MAX_OPENGL_FBOS]; + A5O_FBO_INFO fbos[A5O_MAX_OPENGL_FBOS]; /* In non-programmable pipe mode this should be zero. * In programmable pipeline mode this should be non-zero. */ GLuint program_object; - ALLEGRO_OGL_VARLOCS varlocs; + A5O_OGL_VARLOCS varlocs; /* For OpenGL 3.0+ we use a single vao and vbo. */ GLuint vao, vbo; -} ALLEGRO_OGL_EXTRAS; +} A5O_OGL_EXTRAS; -typedef struct ALLEGRO_OGL_BITMAP_VERTEX +typedef struct A5O_OGL_BITMAP_VERTEX { float x, y, z; float tx, ty; float r, g, b, a; -} ALLEGRO_OGL_BITMAP_VERTEX; +} A5O_OGL_BITMAP_VERTEX; /* extensions */ int _al_ogl_look_for_an_extension(const char *name, const GLubyte *extensions); -void _al_ogl_set_extensions(ALLEGRO_OGL_EXT_API *ext); -void _al_ogl_manage_extensions(ALLEGRO_DISPLAY *disp); -void _al_ogl_unmanage_extensions(ALLEGRO_DISPLAY *disp); +void _al_ogl_set_extensions(A5O_OGL_EXT_API *ext); +void _al_ogl_manage_extensions(A5O_DISPLAY *disp); +void _al_ogl_unmanage_extensions(A5O_DISPLAY *disp); /* bitmap */ int _al_ogl_get_glformat(int format, int component); -ALLEGRO_BITMAP *_al_ogl_create_bitmap(ALLEGRO_DISPLAY *d, int w, int h, +A5O_BITMAP *_al_ogl_create_bitmap(A5O_DISPLAY *d, int w, int h, int format, int flags); -void _al_ogl_upload_bitmap_memory(ALLEGRO_BITMAP *bitmap, int format, void *ptr); +void _al_ogl_upload_bitmap_memory(A5O_BITMAP *bitmap, int format, void *ptr); /* locking */ -#ifndef ALLEGRO_CFG_OPENGLES - ALLEGRO_LOCKED_REGION *_al_ogl_lock_region_new(ALLEGRO_BITMAP *bitmap, +#ifndef A5O_CFG_OPENGLES + A5O_LOCKED_REGION *_al_ogl_lock_region_new(A5O_BITMAP *bitmap, int x, int y, int w, int h, int format, int flags); - void _al_ogl_unlock_region_new(ALLEGRO_BITMAP *bitmap); + void _al_ogl_unlock_region_new(A5O_BITMAP *bitmap); #else - ALLEGRO_LOCKED_REGION *_al_ogl_lock_region_gles(ALLEGRO_BITMAP *bitmap, + A5O_LOCKED_REGION *_al_ogl_lock_region_gles(A5O_BITMAP *bitmap, int x, int y, int w, int h, int format, int flags); - void _al_ogl_unlock_region_gles(ALLEGRO_BITMAP *bitmap); + void _al_ogl_unlock_region_gles(A5O_BITMAP *bitmap); #endif int _al_ogl_pixel_alignment(int pixel_size, bool compressed); /* framebuffer objects */ GLint _al_ogl_bind_framebuffer(GLint fbo); -void _al_ogl_reset_fbo_info(ALLEGRO_FBO_INFO *info); -bool _al_ogl_create_persistent_fbo(ALLEGRO_BITMAP *bitmap); -ALLEGRO_FBO_INFO *_al_ogl_persist_fbo(ALLEGRO_DISPLAY *display, - ALLEGRO_FBO_INFO *transient_fbo_info); -void _al_ogl_setup_fbo(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap); -bool _al_ogl_setup_fbo_non_backbuffer(ALLEGRO_DISPLAY *display, - ALLEGRO_BITMAP *bitmap); -void _al_ogl_del_fbo(ALLEGRO_FBO_INFO *info); +void _al_ogl_reset_fbo_info(A5O_FBO_INFO *info); +bool _al_ogl_create_persistent_fbo(A5O_BITMAP *bitmap); +A5O_FBO_INFO *_al_ogl_persist_fbo(A5O_DISPLAY *display, + A5O_FBO_INFO *transient_fbo_info); +void _al_ogl_setup_fbo(A5O_DISPLAY *display, A5O_BITMAP *bitmap); +bool _al_ogl_setup_fbo_non_backbuffer(A5O_DISPLAY *display, + A5O_BITMAP *bitmap); +void _al_ogl_del_fbo(A5O_FBO_INFO *info); /* common driver */ -void _al_ogl_setup_gl(ALLEGRO_DISPLAY *d); -void _al_ogl_set_target_bitmap(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap); -void _al_ogl_unset_target_bitmap(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap); -void _al_ogl_finalize_fbo(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap); -void _al_ogl_setup_bitmap_clipping(const ALLEGRO_BITMAP *bitmap); -ALLEGRO_BITMAP *_al_ogl_get_backbuffer(ALLEGRO_DISPLAY *d); -ALLEGRO_BITMAP* _al_ogl_create_backbuffer(ALLEGRO_DISPLAY *disp); -void _al_ogl_destroy_backbuffer(ALLEGRO_BITMAP *b); -bool _al_ogl_resize_backbuffer(ALLEGRO_BITMAP *b, int w, int h); -void _al_opengl_backup_dirty_bitmaps(ALLEGRO_DISPLAY *d, bool flip); +void _al_ogl_setup_gl(A5O_DISPLAY *d); +void _al_ogl_set_target_bitmap(A5O_DISPLAY *display, A5O_BITMAP *bitmap); +void _al_ogl_unset_target_bitmap(A5O_DISPLAY *display, A5O_BITMAP *bitmap); +void _al_ogl_finalize_fbo(A5O_DISPLAY *display, A5O_BITMAP *bitmap); +void _al_ogl_setup_bitmap_clipping(const A5O_BITMAP *bitmap); +A5O_BITMAP *_al_ogl_get_backbuffer(A5O_DISPLAY *d); +A5O_BITMAP* _al_ogl_create_backbuffer(A5O_DISPLAY *disp); +void _al_ogl_destroy_backbuffer(A5O_BITMAP *b); +bool _al_ogl_resize_backbuffer(A5O_BITMAP *b, int w, int h); +void _al_opengl_backup_dirty_bitmaps(A5O_DISPLAY *d, bool flip); /* draw */ -struct ALLEGRO_DISPLAY_INTERFACE; -void _al_ogl_add_drawing_functions(struct ALLEGRO_DISPLAY_INTERFACE *vt); +struct A5O_DISPLAY_INTERFACE; +void _al_ogl_add_drawing_functions(struct A5O_DISPLAY_INTERFACE *vt); -AL_FUNC(bool, _al_opengl_set_blender, (ALLEGRO_DISPLAY *disp)); +AL_FUNC(bool, _al_opengl_set_blender, (A5O_DISPLAY *disp)); AL_FUNC(char const *, _al_gl_error_string, (GLenum e)); -void _al_ogl_update_render_state(ALLEGRO_DISPLAY *display); +void _al_ogl_update_render_state(A5O_DISPLAY *display); /* shader */ -#ifdef ALLEGRO_CFG_SHADER_GLSL +#ifdef A5O_CFG_SHADER_GLSL bool _al_glsl_set_projview_matrix(GLint projview_matrix_loc, - const ALLEGRO_TRANSFORM *t); + const A5O_TRANSFORM *t); void _al_glsl_init_shaders(void); void _al_glsl_shutdown_shaders(void); void _al_glsl_unuse_shaders(void); diff --git a/include/allegro5/internal/aintern_osxclipboard.h b/include/allegro5/internal/aintern_osxclipboard.h index a2eae18c56..c84a24f93a 100644 --- a/include/allegro5/internal/aintern_osxclipboard.h +++ b/include/allegro5/internal/aintern_osxclipboard.h @@ -9,7 +9,7 @@ extern "C" { #endif -void _al_osx_add_clipboard_functions(ALLEGRO_DISPLAY_INTERFACE *vt); +void _al_osx_add_clipboard_functions(A5O_DISPLAY_INTERFACE *vt); #ifdef __cplusplus } diff --git a/include/allegro5/internal/aintern_path.h b/include/allegro5/internal/aintern_path.h index a0d51c7260..92334d9229 100644 --- a/include/allegro5/internal/aintern_path.h +++ b/include/allegro5/internal/aintern_path.h @@ -1,12 +1,12 @@ #ifndef __al_included_allegro5_aintern_path_h #define __al_included_allegro5_aintern_path_h -struct ALLEGRO_PATH { - ALLEGRO_USTR *drive; - ALLEGRO_USTR *filename; - _AL_VECTOR segments; /* vector of ALLEGRO_USTR * */ - ALLEGRO_USTR *basename; - ALLEGRO_USTR *full_string; +struct A5O_PATH { + A5O_USTR *drive; + A5O_USTR *filename; + _AL_VECTOR segments; /* vector of A5O_USTR * */ + A5O_USTR *basename; + A5O_USTR *full_string; }; #endif diff --git a/include/allegro5/internal/aintern_pixels.h b/include/allegro5/internal/aintern_pixels.h index e85f7096e7..6bb9de4a20 100644 --- a/include/allegro5/internal/aintern_pixels.h +++ b/include/allegro5/internal/aintern_pixels.h @@ -20,7 +20,7 @@ #define _AL_INLINE_GET_PIXEL(format, data, color, advance) \ do { \ switch (format) { \ - case ALLEGRO_PIXEL_FORMAT_ARGB_8888: { \ + case A5O_PIXEL_FORMAT_ARGB_8888: { \ uint32_t _gp_pixel = *(uint32_t *)(data); \ _AL_MAP_RGBA(color, \ (_gp_pixel & 0x00FF0000) >> 16, \ @@ -32,7 +32,7 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_RGBA_8888: { \ + case A5O_PIXEL_FORMAT_RGBA_8888: { \ uint32_t _gp_pixel = *(uint32_t *)(data); \ _AL_MAP_RGBA(color, \ (_gp_pixel & 0xFF000000) >> 24, \ @@ -44,7 +44,7 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_ARGB_4444: { \ + case A5O_PIXEL_FORMAT_ARGB_4444: { \ uint16_t _gp_pixel = *(uint16_t *)(data); \ _AL_MAP_RGBA(color, \ _al_rgb_scale_4[(_gp_pixel & 0x0F00) >> 8], \ @@ -56,7 +56,7 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_RGB_888: { \ + case A5O_PIXEL_FORMAT_RGB_888: { \ uint32_t _gp_pixel = _AL_READ3BYTES(data); \ _AL_MAP_RGBA(color, \ (_gp_pixel & 0xFF0000) >> 16, \ @@ -68,7 +68,7 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_RGB_565: { \ + case A5O_PIXEL_FORMAT_RGB_565: { \ uint16_t _gp_pixel = *(uint16_t *)(data); \ _AL_MAP_RGBA(color, \ _al_rgb_scale_5[(_gp_pixel & 0xF800) >> 11], \ @@ -80,7 +80,7 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_RGB_555: { \ + case A5O_PIXEL_FORMAT_RGB_555: { \ uint16_t _gp_pixel = *(uint16_t *)(data); \ _AL_MAP_RGBA(color, \ _al_rgb_scale_5[(_gp_pixel & 0x7C00) >> 10], \ @@ -92,7 +92,7 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_RGBA_5551: { \ + case A5O_PIXEL_FORMAT_RGBA_5551: { \ uint16_t _gp_pixel = *(uint16_t *)(data); \ _AL_MAP_RGBA(color, \ _al_rgb_scale_5[(_gp_pixel & 0xF800) >> 11], \ @@ -104,7 +104,7 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_ARGB_1555: { \ + case A5O_PIXEL_FORMAT_ARGB_1555: { \ uint16_t _gp_pixel = *(uint16_t *)(data); \ _AL_MAP_RGBA(color, \ _al_rgb_scale_5[(_gp_pixel & 0x7C00) >> 10], \ @@ -116,7 +116,7 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_ABGR_8888: { \ + case A5O_PIXEL_FORMAT_ABGR_8888: { \ uint32_t _gp_pixel = *(uint32_t *)(data); \ _AL_MAP_RGBA(color, \ (_gp_pixel & 0x000000FF) >> 0, \ @@ -128,7 +128,7 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_XBGR_8888: { \ + case A5O_PIXEL_FORMAT_XBGR_8888: { \ uint32_t _gp_pixel = *(uint32_t *)(data); \ _AL_MAP_RGBA(color, \ (_gp_pixel & 0x000000FF) >> 0, \ @@ -140,7 +140,7 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_BGR_888: { \ + case A5O_PIXEL_FORMAT_BGR_888: { \ uint32_t _gp_pixel = _AL_READ3BYTES(data); \ _AL_MAP_RGBA(color, \ (_gp_pixel & 0x000000FF) >> 0, \ @@ -152,7 +152,7 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_BGR_565: { \ + case A5O_PIXEL_FORMAT_BGR_565: { \ uint16_t _gp_pixel = *(uint16_t *)(data); \ _AL_MAP_RGBA(color, \ _al_rgb_scale_5[(_gp_pixel & 0x001F)], \ @@ -164,7 +164,7 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_BGR_555: { \ + case A5O_PIXEL_FORMAT_BGR_555: { \ uint16_t _gp_pixel = *(uint16_t *)(data); \ _AL_MAP_RGBA(color, \ _al_rgb_scale_5[(_gp_pixel & 0x001F)], \ @@ -176,7 +176,7 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_RGBX_8888: { \ + case A5O_PIXEL_FORMAT_RGBX_8888: { \ uint32_t _gp_pixel = *(uint32_t *)(data); \ _AL_MAP_RGBA(color, \ (_gp_pixel & 0xFF000000) >> 24, \ @@ -188,7 +188,7 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_XRGB_8888: { \ + case A5O_PIXEL_FORMAT_XRGB_8888: { \ uint32_t _gp_pixel = *(uint32_t *)(data); \ _AL_MAP_RGBA(color, \ (_gp_pixel & 0x00FF0000) >> 16, \ @@ -200,7 +200,7 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_ABGR_F32: { \ + case A5O_PIXEL_FORMAT_ABGR_F32: { \ float *f = (float *)data; \ color.r = f[0]; \ color.g = f[1]; \ @@ -211,7 +211,7 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE: { \ + case A5O_PIXEL_FORMAT_ABGR_8888_LE: { \ uint8_t *p = (uint8_t *)data; \ _AL_MAP_RGBA(color, *p, *(p + 1), *(p + 2), *(p + 3)); \ if (advance) \ @@ -219,7 +219,7 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_RGBA_4444: { \ + case A5O_PIXEL_FORMAT_RGBA_4444: { \ uint16_t _gp_pixel = *(uint16_t *)(data); \ _AL_MAP_RGBA(color, \ _al_rgb_scale_4[(_gp_pixel & 0xF000) >> 12], \ @@ -231,7 +231,7 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8: { \ + case A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8: { \ uint8_t c = *(uint8_t *)(data); \ _AL_MAP_RGBA(color, c, c, c, 255); \ if (advance) \ @@ -239,29 +239,29 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_ANY: \ - case ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA: \ - case ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA: \ - case ALLEGRO_PIXEL_FORMAT_ANY_15_NO_ALPHA: \ - case ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA: \ - case ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA: \ - case ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA: \ - case ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA: \ - case ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA: \ - ALLEGRO_ERROR("INLINE_GET got fake pixel format: %d\n", format); \ + case A5O_PIXEL_FORMAT_ANY: \ + case A5O_PIXEL_FORMAT_ANY_NO_ALPHA: \ + case A5O_PIXEL_FORMAT_ANY_WITH_ALPHA: \ + case A5O_PIXEL_FORMAT_ANY_15_NO_ALPHA: \ + case A5O_PIXEL_FORMAT_ANY_16_NO_ALPHA: \ + case A5O_PIXEL_FORMAT_ANY_16_WITH_ALPHA: \ + case A5O_PIXEL_FORMAT_ANY_24_NO_ALPHA: \ + case A5O_PIXEL_FORMAT_ANY_32_NO_ALPHA: \ + case A5O_PIXEL_FORMAT_ANY_32_WITH_ALPHA: \ + A5O_ERROR("INLINE_GET got fake pixel format: %d\n", format); \ abort(); \ break; \ \ - case ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1: \ - case ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3: \ - case ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5: \ - ALLEGRO_ERROR("INLINE_GET got compressed format: %d\n", format); \ + case A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1: \ + case A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3: \ + case A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5: \ + A5O_ERROR("INLINE_GET got compressed format: %d\n", format); \ abort(); \ break; \ \ - case ALLEGRO_NUM_PIXEL_FORMATS: \ + case A5O_NUM_PIXEL_FORMATS: \ default: \ - ALLEGRO_ERROR("INLINE_GET got non pixel format: %d\n", format); \ + A5O_ERROR("INLINE_GET got non pixel format: %d\n", format); \ abort(); \ break; \ } \ @@ -272,7 +272,7 @@ do { \ uint32_t _pp_pixel; \ switch (format) { \ - case ALLEGRO_PIXEL_FORMAT_ARGB_8888: \ + case A5O_PIXEL_FORMAT_ARGB_8888: \ _pp_pixel = _al_fast_float_to_int(color.a * 255) << 24; \ _pp_pixel |= _al_fast_float_to_int(color.r * 255) << 16; \ _pp_pixel |= _al_fast_float_to_int(color.g * 255) << 8; \ @@ -282,7 +282,7 @@ data += 4; \ break; \ \ - case ALLEGRO_PIXEL_FORMAT_RGBA_8888: \ + case A5O_PIXEL_FORMAT_RGBA_8888: \ _pp_pixel = _al_fast_float_to_int(color.r * 255) << 24; \ _pp_pixel |= _al_fast_float_to_int(color.g * 255) << 16; \ _pp_pixel |= _al_fast_float_to_int(color.b * 255) << 8; \ @@ -292,7 +292,7 @@ data += 4; \ break; \ \ - case ALLEGRO_PIXEL_FORMAT_ARGB_4444: \ + case A5O_PIXEL_FORMAT_ARGB_4444: \ _pp_pixel = _al_fast_float_to_int(color.a * 15) << 12; \ _pp_pixel |= _al_fast_float_to_int(color.r * 15) << 8; \ _pp_pixel |= _al_fast_float_to_int(color.g * 15) << 4; \ @@ -302,7 +302,7 @@ data += 2; \ break; \ \ - case ALLEGRO_PIXEL_FORMAT_RGB_888: \ + case A5O_PIXEL_FORMAT_RGB_888: \ _pp_pixel = _al_fast_float_to_int(color.r * 255) << 16; \ _pp_pixel |= _al_fast_float_to_int(color.g * 255) << 8; \ _pp_pixel |= _al_fast_float_to_int(color.b * 255); \ @@ -311,7 +311,7 @@ data += 3; \ break; \ \ - case ALLEGRO_PIXEL_FORMAT_RGB_565: \ + case A5O_PIXEL_FORMAT_RGB_565: \ _pp_pixel = _al_fast_float_to_int(color.r * 0x1f) << 11; \ _pp_pixel |= _al_fast_float_to_int(color.g * 0x3f) << 5; \ _pp_pixel |= _al_fast_float_to_int(color.b * 0x1f); \ @@ -320,7 +320,7 @@ data += 2; \ break; \ \ - case ALLEGRO_PIXEL_FORMAT_RGB_555: \ + case A5O_PIXEL_FORMAT_RGB_555: \ _pp_pixel = _al_fast_float_to_int(color.r * 0x1f) << 10; \ _pp_pixel |= _al_fast_float_to_int(color.g * 0x1f) << 5; \ _pp_pixel |= _al_fast_float_to_int(color.b * 0x1f); \ @@ -329,7 +329,7 @@ data += 2; \ break; \ \ - case ALLEGRO_PIXEL_FORMAT_RGBA_5551: \ + case A5O_PIXEL_FORMAT_RGBA_5551: \ _pp_pixel = _al_fast_float_to_int(color.r * 0x1f) << 11; \ _pp_pixel |= _al_fast_float_to_int(color.g * 0x1f) << 6; \ _pp_pixel |= _al_fast_float_to_int(color.b * 0x1f) << 1; \ @@ -339,7 +339,7 @@ data += 2; \ break; \ \ - case ALLEGRO_PIXEL_FORMAT_ARGB_1555: \ + case A5O_PIXEL_FORMAT_ARGB_1555: \ _pp_pixel = _al_fast_float_to_int(color.a) << 15; \ _pp_pixel |= _al_fast_float_to_int(color.r * 0x1f) << 10; \ _pp_pixel |= _al_fast_float_to_int(color.g * 0x1f) << 5; \ @@ -349,7 +349,7 @@ data += 2; \ break; \ \ - case ALLEGRO_PIXEL_FORMAT_ABGR_8888: \ + case A5O_PIXEL_FORMAT_ABGR_8888: \ _pp_pixel = _al_fast_float_to_int(color.a * 0xff) << 24; \ _pp_pixel |= _al_fast_float_to_int(color.b * 0xff) << 16; \ _pp_pixel |= _al_fast_float_to_int(color.g * 0xff) << 8; \ @@ -359,7 +359,7 @@ data += 4; \ break; \ \ - case ALLEGRO_PIXEL_FORMAT_XBGR_8888: \ + case A5O_PIXEL_FORMAT_XBGR_8888: \ _pp_pixel = 0xff000000; \ _pp_pixel |= _al_fast_float_to_int(color.b * 0xff) << 16; \ _pp_pixel |= _al_fast_float_to_int(color.g * 0xff) << 8; \ @@ -369,7 +369,7 @@ data += 4; \ break; \ \ - case ALLEGRO_PIXEL_FORMAT_BGR_888: \ + case A5O_PIXEL_FORMAT_BGR_888: \ _pp_pixel = _al_fast_float_to_int(color.b * 0xff) << 16; \ _pp_pixel |= _al_fast_float_to_int(color.g * 0xff) << 8; \ _pp_pixel |= _al_fast_float_to_int(color.r * 0xff); \ @@ -378,7 +378,7 @@ data += 3; \ break; \ \ - case ALLEGRO_PIXEL_FORMAT_BGR_565: \ + case A5O_PIXEL_FORMAT_BGR_565: \ _pp_pixel = _al_fast_float_to_int(color.b * 0x1f) << 11; \ _pp_pixel |= _al_fast_float_to_int(color.g * 0x3f) << 5; \ _pp_pixel |= _al_fast_float_to_int(color.r * 0x1f); \ @@ -387,7 +387,7 @@ data += 2; \ break; \ \ - case ALLEGRO_PIXEL_FORMAT_BGR_555: \ + case A5O_PIXEL_FORMAT_BGR_555: \ _pp_pixel = _al_fast_float_to_int(color.b * 0x1f) << 10; \ _pp_pixel |= _al_fast_float_to_int(color.g * 0x1f) << 5; \ _pp_pixel |= _al_fast_float_to_int(color.r * 0x1f); \ @@ -396,7 +396,7 @@ data += 2; \ break; \ \ - case ALLEGRO_PIXEL_FORMAT_RGBX_8888: \ + case A5O_PIXEL_FORMAT_RGBX_8888: \ _pp_pixel = 0xff; \ _pp_pixel |= _al_fast_float_to_int(color.r * 0xff) << 24; \ _pp_pixel |= _al_fast_float_to_int(color.g * 0xff) << 16; \ @@ -406,7 +406,7 @@ data += 4; \ break; \ \ - case ALLEGRO_PIXEL_FORMAT_XRGB_8888: \ + case A5O_PIXEL_FORMAT_XRGB_8888: \ _pp_pixel = 0xff000000; \ _pp_pixel |= _al_fast_float_to_int(color.r * 0xff) << 16; \ _pp_pixel |= _al_fast_float_to_int(color.g * 0xff) << 8; \ @@ -416,7 +416,7 @@ data += 4; \ break; \ \ - case ALLEGRO_PIXEL_FORMAT_ABGR_F32: { \ + case A5O_PIXEL_FORMAT_ABGR_F32: { \ float *f = (float *)data; \ f[0] = color.r; \ f[1] = color.g; \ @@ -427,7 +427,7 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE: \ + case A5O_PIXEL_FORMAT_ABGR_8888_LE: \ *((uint8_t *)data + 0) = _al_fast_float_to_int(color.r * 0xff); \ *((uint8_t *)data + 1) = _al_fast_float_to_int(color.g * 0xff); \ *((uint8_t *)data + 2) = _al_fast_float_to_int(color.b * 0xff); \ @@ -436,7 +436,7 @@ data += 4; \ break; \ \ - case ALLEGRO_PIXEL_FORMAT_RGBA_4444: \ + case A5O_PIXEL_FORMAT_RGBA_4444: \ _pp_pixel = _al_fast_float_to_int(color.a * 15); \ _pp_pixel |= _al_fast_float_to_int(color.r * 15) << 12; \ _pp_pixel |= _al_fast_float_to_int(color.g * 15) << 8; \ @@ -446,7 +446,7 @@ data += 2; \ break; \ \ - case ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8: { \ + case A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8: { \ uint8_t c = color.r; \ *(uint8_t *)data = c; \ if (advance) \ @@ -454,28 +454,28 @@ break; \ } \ \ - case ALLEGRO_PIXEL_FORMAT_ANY: \ - case ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA: \ - case ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA: \ - case ALLEGRO_PIXEL_FORMAT_ANY_15_NO_ALPHA: \ - case ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA: \ - case ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA: \ - case ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA: \ - case ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA: \ - case ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA: \ - ALLEGRO_ERROR("INLINE_PUT got fake _pp_pixel format: %d\n", format); \ + case A5O_PIXEL_FORMAT_ANY: \ + case A5O_PIXEL_FORMAT_ANY_NO_ALPHA: \ + case A5O_PIXEL_FORMAT_ANY_WITH_ALPHA: \ + case A5O_PIXEL_FORMAT_ANY_15_NO_ALPHA: \ + case A5O_PIXEL_FORMAT_ANY_16_NO_ALPHA: \ + case A5O_PIXEL_FORMAT_ANY_16_WITH_ALPHA: \ + case A5O_PIXEL_FORMAT_ANY_24_NO_ALPHA: \ + case A5O_PIXEL_FORMAT_ANY_32_NO_ALPHA: \ + case A5O_PIXEL_FORMAT_ANY_32_WITH_ALPHA: \ + A5O_ERROR("INLINE_PUT got fake _pp_pixel format: %d\n", format); \ abort(); \ break; \ \ - case ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1: \ - case ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3: \ - case ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5: \ - ALLEGRO_ERROR("INLINE_PUT got compressed format: %d\n", format); \ + case A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1: \ + case A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3: \ + case A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5: \ + A5O_ERROR("INLINE_PUT got compressed format: %d\n", format); \ abort(); \ break; \ \ - case ALLEGRO_NUM_PIXEL_FORMATS: \ - ALLEGRO_ERROR("INLINE_PUT got non _pp_pixel format: %d\n", format); \ + case A5O_NUM_PIXEL_FORMATS: \ + A5O_ERROR("INLINE_PUT got non _pp_pixel format: %d\n", format); \ abort(); \ break; \ } \ @@ -491,8 +491,8 @@ AL_FUNC(bool, _al_pixel_format_has_alpha, (int format)); AL_FUNC(bool, _al_pixel_format_is_real, (int format)); AL_FUNC(bool, _al_pixel_format_is_video_only, (int format)); AL_FUNC(bool, _al_pixel_format_is_compressed, (int format)); -AL_FUNC(int, _al_get_real_pixel_format, (ALLEGRO_DISPLAY *display, int format)); -AL_FUNC(char const*, _al_pixel_format_name, (ALLEGRO_PIXEL_FORMAT format)); +AL_FUNC(int, _al_get_real_pixel_format, (A5O_DISPLAY *display, int format)); +AL_FUNC(char const*, _al_pixel_format_name, (A5O_PIXEL_FORMAT format)); #ifdef __cplusplus diff --git a/include/allegro5/internal/aintern_raspberrypi.h b/include/allegro5/internal/aintern_raspberrypi.h index defd81e230..8d909a1cd3 100644 --- a/include/allegro5/internal/aintern_raspberrypi.h +++ b/include/allegro5/internal/aintern_raspberrypi.h @@ -1,5 +1,5 @@ -#ifndef _ALLEGRO_INTERNAL_RASPBERRYPI_SYSTEM -#define _ALLEGRO_INTERNAL_RASPBERRYPI_SYSTEM +#ifndef _A5O_INTERNAL_RASPBERRYPI_SYSTEM +#define _A5O_INTERNAL_RASPBERRYPI_SYSTEM #include "allegro5/allegro.h" #include @@ -8,22 +8,22 @@ #include -typedef struct ALLEGRO_SYSTEM_RASPBERRYPI { - ALLEGRO_SYSTEM system; +typedef struct A5O_SYSTEM_RASPBERRYPI { + A5O_SYSTEM system; Display *x11display; _AL_MUTEX lock; /* thread lock for whenever we access internals. */ _AL_THREAD thread; /* background thread. */ - ALLEGRO_DISPLAY *mouse_grab_display; /* Best effort: may be inaccurate. */ + A5O_DISPLAY *mouse_grab_display; /* Best effort: may be inaccurate. */ bool inhibit_screensaver; /* Should we inhibit the screensaver? */ Atom AllegroAtom; -} ALLEGRO_SYSTEM_RASPBERRYPI; +} A5O_SYSTEM_RASPBERRYPI; -typedef struct ALLEGRO_DISPLAY_RASPBERRYPI_EXTRA - ALLEGRO_DISPLAY_RASPBERRYPI_EXTRA; +typedef struct A5O_DISPLAY_RASPBERRYPI_EXTRA + A5O_DISPLAY_RASPBERRYPI_EXTRA; -typedef struct ALLEGRO_DISPLAY_RASPBERRYPI { - ALLEGRO_DISPLAY display; - ALLEGRO_DISPLAY_RASPBERRYPI_EXTRA *extra; +typedef struct A5O_DISPLAY_RASPBERRYPI { + A5O_DISPLAY display; + A5O_DISPLAY_RASPBERRYPI_EXTRA *extra; Window window; /* Physical size of display in pixels (gets scaled) */ int screen_width, screen_height; @@ -34,20 +34,20 @@ typedef struct ALLEGRO_DISPLAY_RASPBERRYPI { int cursor_height; int cursor_offset_x, cursor_offset_y; Atom wm_delete_window_atom; -} ALLEGRO_DISPLAY_RASPBERRYPI; +} A5O_DISPLAY_RASPBERRYPI; -typedef struct ALLEGRO_MOUSE_CURSOR_RASPBERRYPI { - ALLEGRO_BITMAP *bitmap; -} ALLEGRO_MOUSE_CURSOR_RASPBERRYPI; +typedef struct A5O_MOUSE_CURSOR_RASPBERRYPI { + A5O_BITMAP *bitmap; +} A5O_MOUSE_CURSOR_RASPBERRYPI; -ALLEGRO_SYSTEM_INTERFACE *_al_system_raspberrypi_driver(void); -ALLEGRO_DISPLAY_INTERFACE *_al_get_raspberrypi_display_interface(void); +A5O_SYSTEM_INTERFACE *_al_system_raspberrypi_driver(void); +A5O_DISPLAY_INTERFACE *_al_get_raspberrypi_display_interface(void); void _al_raspberrypi_get_screen_info(int *dx, int *dy, int *screen_width, int *screen_height); bool _al_evdev_set_mouse_range(int x1, int y1, int x2, int y2); // used by console mouse driver void _al_raspberrypi_get_mouse_scale_ratios(float *x, float *y); // used by X mouse driver -ALLEGRO_MOUSE_DRIVER _al_mousedrv_linux_evdev; +A5O_MOUSE_DRIVER _al_mousedrv_linux_evdev; #endif diff --git a/include/allegro5/internal/aintern_shader.h b/include/allegro5/internal/aintern_shader.h index fa97e4ce5b..ce4e4f242c 100644 --- a/include/allegro5/internal/aintern_shader.h +++ b/include/allegro5/internal/aintern_shader.h @@ -8,59 +8,59 @@ extern "C" { #endif -typedef struct ALLEGRO_SHADER_INTERFACE ALLEGRO_SHADER_INTERFACE; +typedef struct A5O_SHADER_INTERFACE A5O_SHADER_INTERFACE; -struct ALLEGRO_SHADER_INTERFACE +struct A5O_SHADER_INTERFACE { - bool (*attach_shader_source)(ALLEGRO_SHADER *shader, - ALLEGRO_SHADER_TYPE type, const char *source); - bool (*build_shader)(ALLEGRO_SHADER *shader); - bool (*use_shader)(ALLEGRO_SHADER *shader, ALLEGRO_DISPLAY *dpy, + bool (*attach_shader_source)(A5O_SHADER *shader, + A5O_SHADER_TYPE type, const char *source); + bool (*build_shader)(A5O_SHADER *shader); + bool (*use_shader)(A5O_SHADER *shader, A5O_DISPLAY *dpy, bool set_projview_matrix_from_display); - void (*unuse_shader)(ALLEGRO_SHADER *shader, ALLEGRO_DISPLAY *dpy); - void (*destroy_shader)(ALLEGRO_SHADER *shader); - void (*on_lost_device)(ALLEGRO_SHADER *shader); - void (*on_reset_device)(ALLEGRO_SHADER *shader); + void (*unuse_shader)(A5O_SHADER *shader, A5O_DISPLAY *dpy); + void (*destroy_shader)(A5O_SHADER *shader); + void (*on_lost_device)(A5O_SHADER *shader); + void (*on_reset_device)(A5O_SHADER *shader); - bool (*set_shader_sampler)(ALLEGRO_SHADER *shader, const char *name, - ALLEGRO_BITMAP *bitmap, int unit); - bool (*set_shader_matrix)(ALLEGRO_SHADER *shader, const char *name, - const ALLEGRO_TRANSFORM *matrix); - bool (*set_shader_int)(ALLEGRO_SHADER *shader, const char *name, int i); - bool (*set_shader_float)(ALLEGRO_SHADER *shader, const char *name, float f); - bool (*set_shader_int_vector)(ALLEGRO_SHADER *shader, const char *name, + bool (*set_shader_sampler)(A5O_SHADER *shader, const char *name, + A5O_BITMAP *bitmap, int unit); + bool (*set_shader_matrix)(A5O_SHADER *shader, const char *name, + const A5O_TRANSFORM *matrix); + bool (*set_shader_int)(A5O_SHADER *shader, const char *name, int i); + bool (*set_shader_float)(A5O_SHADER *shader, const char *name, float f); + bool (*set_shader_int_vector)(A5O_SHADER *shader, const char *name, int elem_size, const int *i, int num_elems); - bool (*set_shader_float_vector)(ALLEGRO_SHADER *shader, const char *name, + bool (*set_shader_float_vector)(A5O_SHADER *shader, const char *name, int elem_size, const float *f, int num_elems); - bool (*set_shader_bool)(ALLEGRO_SHADER *shader, const char *name, bool b); + bool (*set_shader_bool)(A5O_SHADER *shader, const char *name, bool b); }; -struct ALLEGRO_SHADER +struct A5O_SHADER { - ALLEGRO_USTR *vertex_copy; - ALLEGRO_USTR *pixel_copy; - ALLEGRO_USTR *log; - ALLEGRO_SHADER_PLATFORM platform; - ALLEGRO_SHADER_INTERFACE *vt; - _AL_VECTOR bitmaps; /* of ALLEGRO_BITMAP pointers */ + A5O_USTR *vertex_copy; + A5O_USTR *pixel_copy; + A5O_USTR *log; + A5O_SHADER_PLATFORM platform; + A5O_SHADER_INTERFACE *vt; + _AL_VECTOR bitmaps; /* of A5O_BITMAP pointers */ _AL_LIST_ITEM *dtor_item; }; /* In most cases you should use _al_set_bitmap_shader_field. */ -void _al_set_bitmap_shader_field(ALLEGRO_BITMAP *bmp, ALLEGRO_SHADER *shader); -void _al_register_shader_bitmap(ALLEGRO_SHADER *shader, ALLEGRO_BITMAP *bmp); -void _al_unregister_shader_bitmap(ALLEGRO_SHADER *shader, ALLEGRO_BITMAP *bmp); +void _al_set_bitmap_shader_field(A5O_BITMAP *bmp, A5O_SHADER *shader); +void _al_register_shader_bitmap(A5O_SHADER *shader, A5O_BITMAP *bmp); +void _al_unregister_shader_bitmap(A5O_SHADER *shader, A5O_BITMAP *bmp); -ALLEGRO_SHADER *_al_create_default_shader(ALLEGRO_DISPLAY *display); +A5O_SHADER *_al_create_default_shader(A5O_DISPLAY *display); -#ifdef ALLEGRO_CFG_SHADER_GLSL -ALLEGRO_SHADER *_al_create_shader_glsl(ALLEGRO_SHADER_PLATFORM platform); -void _al_set_shader_glsl(ALLEGRO_DISPLAY *display, ALLEGRO_SHADER *shader); +#ifdef A5O_CFG_SHADER_GLSL +A5O_SHADER *_al_create_shader_glsl(A5O_SHADER_PLATFORM platform); +void _al_set_shader_glsl(A5O_DISPLAY *display, A5O_SHADER *shader); #endif -#ifdef ALLEGRO_CFG_SHADER_HLSL -ALLEGRO_SHADER *_al_create_shader_hlsl(ALLEGRO_SHADER_PLATFORM platform, int shader_model); -void _al_set_shader_hlsl(ALLEGRO_DISPLAY *display, ALLEGRO_SHADER *shader); +#ifdef A5O_CFG_SHADER_HLSL +A5O_SHADER *_al_create_shader_hlsl(A5O_SHADER_PLATFORM platform, int shader_model); +void _al_set_shader_hlsl(A5O_DISPLAY *display, A5O_SHADER *shader); #endif diff --git a/include/allegro5/internal/aintern_system.h b/include/allegro5/internal/aintern_system.h index 90f4756d62..3f5e48d446 100644 --- a/include/allegro5/internal/aintern_system.h +++ b/include/allegro5/internal/aintern_system.h @@ -16,34 +16,34 @@ extern "C" { #endif -typedef struct ALLEGRO_SYSTEM_INTERFACE ALLEGRO_SYSTEM_INTERFACE; +typedef struct A5O_SYSTEM_INTERFACE A5O_SYSTEM_INTERFACE; -struct ALLEGRO_SYSTEM_INTERFACE +struct A5O_SYSTEM_INTERFACE { - ALLEGRO_SYSTEM_ID id; - ALLEGRO_SYSTEM *(*initialize)(int flags); - ALLEGRO_DISPLAY_INTERFACE *(*get_display_driver)(void); - ALLEGRO_KEYBOARD_DRIVER *(*get_keyboard_driver)(void); - ALLEGRO_MOUSE_DRIVER *(*get_mouse_driver)(void); - ALLEGRO_TOUCH_INPUT_DRIVER *(*get_touch_input_driver)(void); - ALLEGRO_JOYSTICK_DRIVER *(*get_joystick_driver)(void); - ALLEGRO_HAPTIC_DRIVER *(*get_haptic_driver)(void); + A5O_SYSTEM_ID id; + A5O_SYSTEM *(*initialize)(int flags); + A5O_DISPLAY_INTERFACE *(*get_display_driver)(void); + A5O_KEYBOARD_DRIVER *(*get_keyboard_driver)(void); + A5O_MOUSE_DRIVER *(*get_mouse_driver)(void); + A5O_TOUCH_INPUT_DRIVER *(*get_touch_input_driver)(void); + A5O_JOYSTICK_DRIVER *(*get_joystick_driver)(void); + A5O_HAPTIC_DRIVER *(*get_haptic_driver)(void); int (*get_num_display_modes)(void); - ALLEGRO_DISPLAY_MODE *(*get_display_mode)(int index, ALLEGRO_DISPLAY_MODE *mode); + A5O_DISPLAY_MODE *(*get_display_mode)(int index, A5O_DISPLAY_MODE *mode); void (*shutdown_system)(void); int (*get_num_video_adapters)(void); - bool (*get_monitor_info)(int adapter, ALLEGRO_MONITOR_INFO *info); + bool (*get_monitor_info)(int adapter, A5O_MONITOR_INFO *info); int (*get_monitor_refresh_rate)(int adapter); int (*get_monitor_dpi)(int adapter); - ALLEGRO_MOUSE_CURSOR *(*create_mouse_cursor)(ALLEGRO_BITMAP *bmp, int x_focus, int y_focus); - void (*destroy_mouse_cursor)(ALLEGRO_MOUSE_CURSOR *cursor); + A5O_MOUSE_CURSOR *(*create_mouse_cursor)(A5O_BITMAP *bmp, int x_focus, int y_focus); + void (*destroy_mouse_cursor)(A5O_MOUSE_CURSOR *cursor); bool (*get_cursor_position)(int *ret_x, int *ret_y); - bool (*grab_mouse)(ALLEGRO_DISPLAY *display); + bool (*grab_mouse)(A5O_DISPLAY *display); bool (*ungrab_mouse)(void); - ALLEGRO_PATH *(*get_path)(int id); + A5O_PATH *(*get_path)(int id); bool (*inhibit_screensaver)(bool inhibit); - void (*thread_init)(ALLEGRO_THREAD *thread); - void (*thread_exit)(ALLEGRO_THREAD *thread); + void (*thread_init)(A5O_THREAD *thread); + void (*thread_exit)(A5O_THREAD *thread); void *(*open_library)(const char *filename); void *(*import_symbol)(void *library, const char *symbol); void (*close_library)(void *handle); @@ -51,14 +51,14 @@ struct ALLEGRO_SYSTEM_INTERFACE void (*heartbeat_init)(void); double (*get_time)(void); void (*rest)(double seconds); - void (*init_timeout)(ALLEGRO_TIMEOUT *timeout, double seconds); + void (*init_timeout)(A5O_TIMEOUT *timeout, double seconds); }; -struct ALLEGRO_SYSTEM +struct A5O_SYSTEM { - ALLEGRO_SYSTEM_INTERFACE *vt; + A5O_SYSTEM_INTERFACE *vt; _AL_VECTOR displays; /* Keep a list of all displays attached to us. */ - ALLEGRO_PATH *user_exe_path; + A5O_PATH *user_exe_path; int mouse_wheel_precision; int min_bitmap_size; bool installed; diff --git a/include/allegro5/internal/aintern_thread.h b/include/allegro5/internal/aintern_thread.h index b27ad49f65..d069d6a77b 100644 --- a/include/allegro5/internal/aintern_thread.h +++ b/include/allegro5/internal/aintern_thread.h @@ -1,7 +1,7 @@ #ifndef __al_included_allegro5_aintern_thread_h #define __al_included_allegro5_aintern_thread_h -#include ALLEGRO_INTERNAL_THREAD_HEADER +#include A5O_INTERNAL_THREAD_HEADER #ifdef __cplusplus extern "C" { @@ -31,7 +31,7 @@ void _al_mutex_destroy(_AL_MUTEX*); * FIXME: Why are they all inline? And if they have to be, why not treat them * the same as the two functions above? */ -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS void _al_cond_init(_AL_COND*); void _al_cond_destroy(_AL_COND*); void _al_cond_wait(_AL_COND*, _AL_MUTEX*); @@ -39,7 +39,7 @@ void _al_cond_broadcast(_AL_COND*); void _al_cond_signal(_AL_COND*); #endif -int _al_cond_timedwait(_AL_COND*, _AL_MUTEX*, const ALLEGRO_TIMEOUT *timeout); +int _al_cond_timedwait(_AL_COND*, _AL_MUTEX*, const A5O_TIMEOUT *timeout); #ifdef __cplusplus diff --git a/include/allegro5/internal/aintern_touch_input.h b/include/allegro5/internal/aintern_touch_input.h index 90d084a935..b1ec249153 100644 --- a/include/allegro5/internal/aintern_touch_input.h +++ b/include/allegro5/internal/aintern_touch_input.h @@ -9,22 +9,22 @@ #endif -typedef struct ALLEGRO_TOUCH_INPUT_DRIVER +typedef struct A5O_TOUCH_INPUT_DRIVER { int id; AL_METHOD(bool, init_touch_input, (void)); AL_METHOD(void, exit_touch_input, (void)); - AL_METHOD(ALLEGRO_TOUCH_INPUT*, get_touch_input, (void)); - AL_METHOD(void, get_touch_input_state, (ALLEGRO_TOUCH_INPUT_STATE *ret_state)); + AL_METHOD(A5O_TOUCH_INPUT*, get_touch_input, (void)); + AL_METHOD(void, get_touch_input_state, (A5O_TOUCH_INPUT_STATE *ret_state)); AL_METHOD(void, set_mouse_emulation_mode, (int mode)); AL_METHOD(int, get_mouse_emulation_mode, (void)); -} ALLEGRO_TOUCH_INPUT_DRIVER; +} A5O_TOUCH_INPUT_DRIVER; -struct ALLEGRO_TOUCH_INPUT +struct A5O_TOUCH_INPUT { - ALLEGRO_EVENT_SOURCE es; - ALLEGRO_EVENT_SOURCE mouse_emulation_es; + A5O_EVENT_SOURCE es; + A5O_EVENT_SOURCE mouse_emulation_es; int mouse_emulation_mode; }; diff --git a/include/allegro5/internal/aintern_transform.h b/include/allegro5/internal/aintern_transform.h index 022c263af8..b200bedc5c 100644 --- a/include/allegro5/internal/aintern_transform.h +++ b/include/allegro5/internal/aintern_transform.h @@ -2,7 +2,7 @@ #define __al_included_allegro5_aintern_transform_h -bool _al_transform_is_translation(const ALLEGRO_TRANSFORM* trans, +bool _al_transform_is_translation(const A5O_TRANSFORM* trans, float *dx, float *dy); diff --git a/include/allegro5/internal/aintern_tri_soft.h b/include/allegro5/internal/aintern_tri_soft.h index eef14fe75b..d1172a79c6 100644 --- a/include/allegro5/internal/aintern_tri_soft.h +++ b/include/allegro5/internal/aintern_tri_soft.h @@ -1,25 +1,25 @@ #ifndef __al_included_allegro5_aintern_tri_soft_h #define __al_included_allegro5_aintern_tri_soft_h -struct ALLEGRO_BITMAP; +struct A5O_BITMAP; /* Duplicated in allegro_primitives.h */ -#ifndef _ALLEGRO_VERTEX_DEFINED -#define _ALLEGRO_VERTEX_DEFINED +#ifndef _A5O_VERTEX_DEFINED +#define _A5O_VERTEX_DEFINED -typedef struct ALLEGRO_VERTEX ALLEGRO_VERTEX; +typedef struct A5O_VERTEX A5O_VERTEX; -struct ALLEGRO_VERTEX { +struct A5O_VERTEX { float x, y, z; float u, v; - ALLEGRO_COLOR color; + A5O_COLOR color; }; #endif -AL_FUNC(void, _al_triangle_2d, (ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, ALLEGRO_VERTEX* v3)); +AL_FUNC(void, _al_triangle_2d, (A5O_BITMAP* texture, A5O_VERTEX* v1, A5O_VERTEX* v2, A5O_VERTEX* v3)); AL_FUNC(void, _al_draw_soft_triangle, ( - ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, ALLEGRO_VERTEX* v3, uintptr_t state, - void (*init)(uintptr_t, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*), + A5O_VERTEX* v1, A5O_VERTEX* v2, A5O_VERTEX* v3, uintptr_t state, + void (*init)(uintptr_t, A5O_VERTEX*, A5O_VERTEX*, A5O_VERTEX*), void (*first)(uintptr_t, int, int, int, int), void (*step)(uintptr_t, int), void (*draw)(uintptr_t, int, int, int))); diff --git a/include/allegro5/internal/aintern_wclipboard.h b/include/allegro5/internal/aintern_wclipboard.h index 03895f73de..a97c436ae2 100644 --- a/include/allegro5/internal/aintern_wclipboard.h +++ b/include/allegro5/internal/aintern_wclipboard.h @@ -9,7 +9,7 @@ extern "C" { #endif -void _al_win_add_clipboard_functions(ALLEGRO_DISPLAY_INTERFACE *vt); +void _al_win_add_clipboard_functions(A5O_DISPLAY_INTERFACE *vt); #ifdef __cplusplus } diff --git a/include/allegro5/internal/aintern_wjoyall.h b/include/allegro5/internal/aintern_wjoyall.h index 67d7151b74..b31ea1a16c 100644 --- a/include/allegro5/internal/aintern_wjoyall.h +++ b/include/allegro5/internal/aintern_wjoyall.h @@ -5,13 +5,13 @@ /** Part of the Windows joystick wrapper driver * types are shared here for use by the haptic susbystem. */ -typedef struct ALLEGRO_JOYSTICK_WINDOWS_ALL { - ALLEGRO_JOYSTICK parent; /* must be first */ +typedef struct A5O_JOYSTICK_WINDOWS_ALL { + A5O_JOYSTICK parent; /* must be first */ bool active; int index; - ALLEGRO_JOYSTICK * handle; - ALLEGRO_JOYSTICK_DRIVER * driver; -} ALLEGRO_JOYSTICK_WINDOWS_ALL; + A5O_JOYSTICK * handle; + A5O_JOYSTICK_DRIVER * driver; +} A5O_JOYSTICK_WINDOWS_ALL; #endif diff --git a/include/allegro5/internal/aintern_wjoydxnu.h b/include/allegro5/internal/aintern_wjoydxnu.h index eeb31e4cee..f75b3aad33 100644 --- a/include/allegro5/internal/aintern_wjoydxnu.h +++ b/include/allegro5/internal/aintern_wjoydxnu.h @@ -18,8 +18,8 @@ /* make sure all the constants add up */ /* the first two sticks are (x,y,z) and (rx,ry,rz) */ -ALLEGRO_STATIC_ASSERT(wjoydxnu, _AL_MAX_JOYSTICK_STICKS >= (2 + MAX_SLIDERS + MAX_POVS)); -ALLEGRO_STATIC_ASSERT(wjoydxnu, _AL_MAX_JOYSTICK_BUTTONS >= MAX_BUTTONS); +A5O_STATIC_ASSERT(wjoydxnu, _AL_MAX_JOYSTICK_STICKS >= (2 + MAX_SLIDERS + MAX_POVS)); +A5O_STATIC_ASSERT(wjoydxnu, _AL_MAX_JOYSTICK_BUTTONS >= MAX_BUTTONS); #define GUID_EQUAL(a, b) (0 == memcmp(&(a), &(b), sizeof(GUID))) @@ -61,9 +61,9 @@ typedef struct } AXIS_MAPPING; -typedef struct ALLEGRO_JOYSTICK_DIRECTX +typedef struct A5O_JOYSTICK_DIRECTX { - ALLEGRO_JOYSTICK parent; /* must be first */ + A5O_JOYSTICK parent; /* must be first */ CONFIG_STATE config_state; bool marked; LPDIRECTINPUTDEVICE2 device; @@ -71,7 +71,7 @@ typedef struct ALLEGRO_JOYSTICK_DIRECTX GUID product_guid; HANDLE waker_event; - ALLEGRO_JOYSTICK_STATE joystate; + A5O_JOYSTICK_STATE joystate; AXIS_MAPPING x_mapping; AXIS_MAPPING y_mapping; AXIS_MAPPING z_mapping; @@ -82,7 +82,7 @@ typedef struct ALLEGRO_JOYSTICK_DIRECTX int pov_mapping_stick[MAX_POVS]; char name[80]; char all_names[512]; /* button/stick/axis names with NUL terminators */ -} ALLEGRO_JOYSTICK_DIRECTX; +} A5O_JOYSTICK_DIRECTX; diff --git a/include/allegro5/internal/aintern_wjoyxi.h b/include/allegro5/internal/aintern_wjoyxi.h index 51f588d83f..aa442b3a72 100644 --- a/include/allegro5/internal/aintern_wjoyxi.h +++ b/include/allegro5/internal/aintern_wjoyxi.h @@ -18,8 +18,8 @@ /* make sure all the constants add up */ /* the first two sticks are (x,y,z) and (rx,ry,rz) */ -ALLEGRO_STATIC_ASSERT(wjoydxnu, _AL_MAX_JOYSTICK_STICKS >= (2 + MAX_TRIGGERS + MAX_STICKS)); -ALLEGRO_STATIC_ASSERT(wjoydxnu, _AL_MAX_JOYSTICK_BUTTONS >= MAX_BUTTONS); +A5O_STATIC_ASSERT(wjoydxnu, _AL_MAX_JOYSTICK_STICKS >= (2 + MAX_TRIGGERS + MAX_STICKS)); +A5O_STATIC_ASSERT(wjoydxnu, _AL_MAX_JOYSTICK_BUTTONS >= MAX_BUTTONS); typedef enum { @@ -31,18 +31,18 @@ typedef enum ((st) == STATE_ACTIVE) -typedef struct ALLEGRO_JOYSTICK_XINPUT +typedef struct A5O_JOYSTICK_XINPUT { - ALLEGRO_JOYSTICK parent; /* must be first */ + A5O_JOYSTICK parent; /* must be first */ bool active; - ALLEGRO_JOYSTICK_STATE joystate; + A5O_JOYSTICK_STATE joystate; DWORD index; XINPUT_STATE state; XINPUT_CAPABILITIES capabilities; XINPUT_VIBRATION vibration; char name[80]; char all_names[512]; /* button/stick/axis names with NUL terminators */ -} ALLEGRO_JOYSTICK_XINPUT; +} A5O_JOYSTICK_XINPUT; #endif diff --git a/include/allegro5/internal/aintern_wunicode.h b/include/allegro5/internal/aintern_wunicode.h index d29987d851..bb2e255b97 100644 --- a/include/allegro5/internal/aintern_wunicode.h +++ b/include/allegro5/internal/aintern_wunicode.h @@ -1,7 +1,7 @@ #ifndef __al_included_allegro5_aintern_wunicode_h #define __al_included_allegro5_aintern_wunicode_h -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS #include @@ -10,8 +10,8 @@ #endif -AL_FUNC(wchar_t *, _al_win_ustr_to_utf16, (const ALLEGRO_USTR *u)); -AL_FUNC(char *, _al_win_ustr_to_ansi, (const ALLEGRO_USTR *u)); +AL_FUNC(wchar_t *, _al_win_ustr_to_utf16, (const A5O_USTR *u)); +AL_FUNC(char *, _al_win_ustr_to_ansi, (const A5O_USTR *u)); AL_FUNC(wchar_t *, _al_win_utf8_to_utf16, (const char *us)); AL_FUNC(char *, _al_win_utf16_to_utf8, (const wchar_t *ws)); AL_FUNC(char *, _al_win_utf8_to_ansi, (const char* us)); diff --git a/include/allegro5/internal/aintern_x.h b/include/allegro5/internal/aintern_x.h index f405a89059..a1c9a840e4 100644 --- a/include/allegro5/internal/aintern_x.h +++ b/include/allegro5/internal/aintern_x.h @@ -3,7 +3,7 @@ #include -typedef struct ALLEGRO_SYSTEM_XGLX ALLEGRO_SYSTEM_XGLX; -typedef struct ALLEGRO_DISPLAY_XGLX ALLEGRO_DISPLAY_XGLX; +typedef struct A5O_SYSTEM_XGLX A5O_SYSTEM_XGLX; +typedef struct A5O_DISPLAY_XGLX A5O_DISPLAY_XGLX; #endif diff --git a/include/allegro5/internal/aintern_xclipboard.h b/include/allegro5/internal/aintern_xclipboard.h index ff065edd6c..84f8ceb304 100644 --- a/include/allegro5/internal/aintern_xclipboard.h +++ b/include/allegro5/internal/aintern_xclipboard.h @@ -4,9 +4,9 @@ #include "allegro5/internal/aintern_display.h" -void _al_xwin_display_selection_notify(ALLEGRO_DISPLAY *display, XSelectionEvent *xselection); -void _al_xwin_display_selection_request(ALLEGRO_DISPLAY *display, XSelectionRequestEvent *xselectionrequest); -void _al_xwin_add_clipboard_functions(ALLEGRO_DISPLAY_INTERFACE *vt); +void _al_xwin_display_selection_notify(A5O_DISPLAY *display, XSelectionEvent *xselection); +void _al_xwin_display_selection_request(A5O_DISPLAY *display, XSelectionRequestEvent *xselectionrequest); +void _al_xwin_add_clipboard_functions(A5O_DISPLAY_INTERFACE *vt); #endif diff --git a/include/allegro5/internal/aintern_xcursor.h b/include/allegro5/internal/aintern_xcursor.h index 5e2f4db34c..26a7641246 100644 --- a/include/allegro5/internal/aintern_xcursor.h +++ b/include/allegro5/internal/aintern_xcursor.h @@ -1,23 +1,23 @@ #ifndef __al_included_allegro5_aintern_xcursor_h #define __al_included_allegro5_aintern_xcursor_h -#ifdef ALLEGRO_XWINDOWS_WITH_XCURSOR +#ifdef A5O_XWINDOWS_WITH_XCURSOR #include #endif #include "allegro5/internal/aintern_display.h" -typedef struct ALLEGRO_MOUSE_CURSOR_XWIN ALLEGRO_MOUSE_CURSOR_XWIN; +typedef struct A5O_MOUSE_CURSOR_XWIN A5O_MOUSE_CURSOR_XWIN; -struct ALLEGRO_MOUSE_CURSOR_XWIN +struct A5O_MOUSE_CURSOR_XWIN { Cursor cursor; }; -ALLEGRO_MOUSE_CURSOR *_al_xwin_create_mouse_cursor(ALLEGRO_BITMAP *bmp, +A5O_MOUSE_CURSOR *_al_xwin_create_mouse_cursor(A5O_BITMAP *bmp, int x_focus, int y_focus); -void _al_xwin_destroy_mouse_cursor(ALLEGRO_MOUSE_CURSOR *cursor); -void _al_xwin_add_cursor_functions(ALLEGRO_DISPLAY_INTERFACE *vt); +void _al_xwin_destroy_mouse_cursor(A5O_MOUSE_CURSOR *cursor); +void _al_xwin_add_cursor_functions(A5O_DISPLAY_INTERFACE *vt); #endif diff --git a/include/allegro5/internal/aintern_xdisplay.h b/include/allegro5/internal/aintern_xdisplay.h index 8bbe19f770..77e768a3aa 100644 --- a/include/allegro5/internal/aintern_xdisplay.h +++ b/include/allegro5/internal/aintern_xdisplay.h @@ -2,28 +2,28 @@ #define __al_included_allegro5_aintern_xdisplay_h /* XXX The Raspberry Pi port does not use GLX. It currently substitutes its own - * ALLEGRO_DISPLAY_RASPBERRYPI for ALLEGRO_DISPLAY_XGLX by a macro renaming + * A5O_DISPLAY_RASPBERRYPI for A5O_DISPLAY_XGLX by a macro renaming * hack. */ -#ifndef ALLEGRO_RASPBERRYPI +#ifndef A5O_RASPBERRYPI #include #include "allegro5/internal/aintern_display.h" #include "allegro5/internal/aintern_x.h" -typedef struct ALLEGRO_DISPLAY_XGLX_GTK ALLEGRO_DISPLAY_XGLX_GTK; -typedef struct ALLEGRO_XWIN_DISPLAY_OVERRIDABLE_INTERFACE ALLEGRO_XWIN_DISPLAY_OVERRIDABLE_INTERFACE; +typedef struct A5O_DISPLAY_XGLX_GTK A5O_DISPLAY_XGLX_GTK; +typedef struct A5O_XWIN_DISPLAY_OVERRIDABLE_INTERFACE A5O_XWIN_DISPLAY_OVERRIDABLE_INTERFACE; -/* This is our version of ALLEGRO_DISPLAY with driver specific extra data. */ -struct ALLEGRO_DISPLAY_XGLX +/* This is our version of A5O_DISPLAY with driver specific extra data. */ +struct A5O_DISPLAY_XGLX { /* This must be the first member. */ - ALLEGRO_DISPLAY display; + A5O_DISPLAY display; /* Driver specifics. */ - const struct ALLEGRO_XWIN_DISPLAY_OVERRIDABLE_INTERFACE *overridable_vt; + const struct A5O_XWIN_DISPLAY_OVERRIDABLE_INTERFACE *overridable_vt; Window window; int xscreen; /* X Screen ID */ @@ -38,7 +38,7 @@ struct ALLEGRO_DISPLAY_XGLX /* Points to a structure if this display is contained by a GTK top-level * window, otherwise it is NULL. */ - ALLEGRO_DISPLAY_XGLX_GTK *gtk; + A5O_DISPLAY_XGLX_GTK *gtk; /* If our window is embedded by the XEmbed protocol, this gives * the window ID of the embedder; Otherwise None. @@ -73,35 +73,35 @@ struct ALLEGRO_DISPLAY_XGLX }; -void _al_display_xglx_await_resize(ALLEGRO_DISPLAY *d, int old_resize_count, bool delay_hack); -void _al_xglx_display_configure(ALLEGRO_DISPLAY *d, int x, int y, int width, int height, bool setglxy); -void _al_xglx_display_configure_event(ALLEGRO_DISPLAY *d, XEvent *event); -void _al_xwin_display_switch_handler(ALLEGRO_DISPLAY *d, +void _al_display_xglx_await_resize(A5O_DISPLAY *d, int old_resize_count, bool delay_hack); +void _al_xglx_display_configure(A5O_DISPLAY *d, int x, int y, int width, int height, bool setglxy); +void _al_xglx_display_configure_event(A5O_DISPLAY *d, XEvent *event); +void _al_xwin_display_switch_handler(A5O_DISPLAY *d, XFocusChangeEvent *event); -void _al_xwin_display_switch_handler_inner(ALLEGRO_DISPLAY *d, bool focus_in); -void _al_xwin_display_expose(ALLEGRO_DISPLAY *display, XExposeEvent *xevent); +void _al_xwin_display_switch_handler_inner(A5O_DISPLAY *d, bool focus_in); +void _al_xwin_display_expose(A5O_DISPLAY *display, XExposeEvent *xevent); /* An ad-hoc interface to allow the GTK backend to override some of the * normal X display interface implementation. */ -struct ALLEGRO_XWIN_DISPLAY_OVERRIDABLE_INTERFACE +struct A5O_XWIN_DISPLAY_OVERRIDABLE_INTERFACE { - bool (*create_display_hook)(ALLEGRO_DISPLAY *d, int w, int h); - void (*destroy_display_hook)(ALLEGRO_DISPLAY *d, bool is_last); - bool (*resize_display)(ALLEGRO_DISPLAY *d, int w, int h); - void (*set_window_title)(ALLEGRO_DISPLAY *display, const char *title); - void (*set_fullscreen_window)(ALLEGRO_DISPLAY *display, bool onoff); - void (*set_window_position)(ALLEGRO_DISPLAY *display, int x, int y); - bool (*set_window_constraints)(ALLEGRO_DISPLAY *display, int min_w, int min_h, int max_w, int max_h); - bool (*set_display_flag)(ALLEGRO_DISPLAY *display, int flag, bool onoff); - void (*check_maximized)(ALLEGRO_DISPLAY *display); + bool (*create_display_hook)(A5O_DISPLAY *d, int w, int h); + void (*destroy_display_hook)(A5O_DISPLAY *d, bool is_last); + bool (*resize_display)(A5O_DISPLAY *d, int w, int h); + void (*set_window_title)(A5O_DISPLAY *display, const char *title); + void (*set_fullscreen_window)(A5O_DISPLAY *display, bool onoff); + void (*set_window_position)(A5O_DISPLAY *display, int x, int y); + bool (*set_window_constraints)(A5O_DISPLAY *display, int min_w, int min_h, int max_w, int max_h); + bool (*set_display_flag)(A5O_DISPLAY *display, int flag, bool onoff); + void (*check_maximized)(A5O_DISPLAY *display); }; bool _al_xwin_set_gtk_display_overridable_interface(uint32_t check_version, - const ALLEGRO_XWIN_DISPLAY_OVERRIDABLE_INTERFACE *vt); + const A5O_XWIN_DISPLAY_OVERRIDABLE_INTERFACE *vt); -#endif /* !ALLEGRO_RASPBERRYPI */ +#endif /* !A5O_RASPBERRYPI */ #endif diff --git a/include/allegro5/internal/aintern_xdnd.h b/include/allegro5/internal/aintern_xdnd.h index 49b89fe431..698e5d5199 100644 --- a/include/allegro5/internal/aintern_xdnd.h +++ b/include/allegro5/internal/aintern_xdnd.h @@ -17,12 +17,12 @@ typedef struct { Window xdnd_source; } DndInfo; -void _al_display_xglx_init_dnd_atoms(ALLEGRO_SYSTEM_XGLX *s); -void _al_xwin_accept_drag_and_drop(ALLEGRO_DISPLAY *display, bool accept); -bool _al_display_xglx_handle_drag_and_drop(ALLEGRO_SYSTEM_XGLX *s, - ALLEGRO_DISPLAY_XGLX *allegro_display, XEvent *event); -bool _al_display_xglx_handle_drag_and_drop_selection(ALLEGRO_SYSTEM_XGLX *s, - ALLEGRO_DISPLAY_XGLX *allegro_display, XEvent *xevent); +void _al_display_xglx_init_dnd_atoms(A5O_SYSTEM_XGLX *s); +void _al_xwin_accept_drag_and_drop(A5O_DISPLAY *display, bool accept); +bool _al_display_xglx_handle_drag_and_drop(A5O_SYSTEM_XGLX *s, + A5O_DISPLAY_XGLX *allegro_display, XEvent *event); +bool _al_display_xglx_handle_drag_and_drop_selection(A5O_SYSTEM_XGLX *s, + A5O_DISPLAY_XGLX *allegro_display, XEvent *xevent); #endif diff --git a/include/allegro5/internal/aintern_xevents.h b/include/allegro5/internal/aintern_xevents.h index 11c8d1f637..6d05add242 100644 --- a/include/allegro5/internal/aintern_xevents.h +++ b/include/allegro5/internal/aintern_xevents.h @@ -5,6 +5,6 @@ void _al_xwin_background_thread(_AL_THREAD *self, void *arg); -void _al_display_xglx_closebutton(ALLEGRO_DISPLAY *d, XEvent *xevent); +void _al_display_xglx_closebutton(A5O_DISPLAY *d, XEvent *xevent); #endif diff --git a/include/allegro5/internal/aintern_xfullscreen.h b/include/allegro5/internal/aintern_xfullscreen.h index 5f553d531f..d71f8cc53f 100644 --- a/include/allegro5/internal/aintern_xfullscreen.h +++ b/include/allegro5/internal/aintern_xfullscreen.h @@ -3,62 +3,62 @@ /* fullscreen and multi monitor stuff */ -typedef struct _ALLEGRO_XGLX_MMON_INTERFACE _ALLEGRO_XGLX_MMON_INTERFACE; - -struct _ALLEGRO_XGLX_MMON_INTERFACE { - int (*get_num_display_modes)(ALLEGRO_SYSTEM_XGLX *s, int adapter); - ALLEGRO_DISPLAY_MODE *(*get_display_mode)(ALLEGRO_SYSTEM_XGLX *s, int, int, ALLEGRO_DISPLAY_MODE*); - bool (*set_mode)(ALLEGRO_SYSTEM_XGLX *, ALLEGRO_DISPLAY_XGLX *, int, int, int, int); - void (*store_mode)(ALLEGRO_SYSTEM_XGLX *); - void (*restore_mode)(ALLEGRO_SYSTEM_XGLX *, int); - void (*get_display_offset)(ALLEGRO_SYSTEM_XGLX *, int, int *, int *); - int (*get_num_adapters)(ALLEGRO_SYSTEM_XGLX *); - bool (*get_monitor_info)(ALLEGRO_SYSTEM_XGLX *, int, ALLEGRO_MONITOR_INFO *); - int (*get_default_adapter)(ALLEGRO_SYSTEM_XGLX *); - int (*get_adapter)(ALLEGRO_SYSTEM_XGLX *, ALLEGRO_DISPLAY_XGLX *); - int (*get_xscreen)(ALLEGRO_SYSTEM_XGLX *, int); - void (*post_setup)(ALLEGRO_SYSTEM_XGLX *, ALLEGRO_DISPLAY_XGLX *); - void (*handle_xevent)(ALLEGRO_SYSTEM_XGLX *, ALLEGRO_DISPLAY_XGLX *, XEvent *e); +typedef struct _A5O_XGLX_MMON_INTERFACE _A5O_XGLX_MMON_INTERFACE; + +struct _A5O_XGLX_MMON_INTERFACE { + int (*get_num_display_modes)(A5O_SYSTEM_XGLX *s, int adapter); + A5O_DISPLAY_MODE *(*get_display_mode)(A5O_SYSTEM_XGLX *s, int, int, A5O_DISPLAY_MODE*); + bool (*set_mode)(A5O_SYSTEM_XGLX *, A5O_DISPLAY_XGLX *, int, int, int, int); + void (*store_mode)(A5O_SYSTEM_XGLX *); + void (*restore_mode)(A5O_SYSTEM_XGLX *, int); + void (*get_display_offset)(A5O_SYSTEM_XGLX *, int, int *, int *); + int (*get_num_adapters)(A5O_SYSTEM_XGLX *); + bool (*get_monitor_info)(A5O_SYSTEM_XGLX *, int, A5O_MONITOR_INFO *); + int (*get_default_adapter)(A5O_SYSTEM_XGLX *); + int (*get_adapter)(A5O_SYSTEM_XGLX *, A5O_DISPLAY_XGLX *); + int (*get_xscreen)(A5O_SYSTEM_XGLX *, int); + void (*post_setup)(A5O_SYSTEM_XGLX *, A5O_DISPLAY_XGLX *); + void (*handle_xevent)(A5O_SYSTEM_XGLX *, A5O_DISPLAY_XGLX *, XEvent *e); }; -extern _ALLEGRO_XGLX_MMON_INTERFACE _al_xglx_mmon_interface; +extern _A5O_XGLX_MMON_INTERFACE _al_xglx_mmon_interface; -int _al_xsys_mheadx_get_default_adapter(ALLEGRO_SYSTEM_XGLX *s); -int _al_xsys_mheadx_get_xscreen(ALLEGRO_SYSTEM_XGLX *s, int adapter); -void _al_xsys_get_active_window_center(ALLEGRO_SYSTEM_XGLX *s, int *x, int *y); +int _al_xsys_mheadx_get_default_adapter(A5O_SYSTEM_XGLX *s); +int _al_xsys_mheadx_get_xscreen(A5O_SYSTEM_XGLX *s, int adapter); +void _al_xsys_get_active_window_center(A5O_SYSTEM_XGLX *s, int *x, int *y); -void _al_xsys_mmon_exit(ALLEGRO_SYSTEM_XGLX *s); +void _al_xsys_mmon_exit(A5O_SYSTEM_XGLX *s); -int _al_xglx_get_num_display_modes(ALLEGRO_SYSTEM_XGLX *s, int adapter); -ALLEGRO_DISPLAY_MODE *_al_xglx_get_display_mode( - ALLEGRO_SYSTEM_XGLX *s, int adapter, int index, ALLEGRO_DISPLAY_MODE *mode); -bool _al_xglx_fullscreen_set_mode(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, int w, int h, +int _al_xglx_get_num_display_modes(A5O_SYSTEM_XGLX *s, int adapter); +A5O_DISPLAY_MODE *_al_xglx_get_display_mode( + A5O_SYSTEM_XGLX *s, int adapter, int index, A5O_DISPLAY_MODE *mode); +bool _al_xglx_fullscreen_set_mode(A5O_SYSTEM_XGLX *s, A5O_DISPLAY_XGLX *d, int w, int h, int format, int refresh_rate); -void _al_xglx_store_video_mode(ALLEGRO_SYSTEM_XGLX *s); -void _al_xglx_restore_video_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter); -void _al_xglx_fullscreen_to_display(ALLEGRO_SYSTEM_XGLX *s, - ALLEGRO_DISPLAY_XGLX *d); -void _al_xglx_set_fullscreen_window(ALLEGRO_DISPLAY *display, int value); -void _al_xglx_get_display_offset(ALLEGRO_SYSTEM_XGLX *s, int adapter, int *x, int *y); +void _al_xglx_store_video_mode(A5O_SYSTEM_XGLX *s); +void _al_xglx_restore_video_mode(A5O_SYSTEM_XGLX *s, int adapter); +void _al_xglx_fullscreen_to_display(A5O_SYSTEM_XGLX *s, + A5O_DISPLAY_XGLX *d); +void _al_xglx_set_fullscreen_window(A5O_DISPLAY *display, int value); +void _al_xglx_get_display_offset(A5O_SYSTEM_XGLX *s, int adapter, int *x, int *y); -int _al_xglx_fullscreen_select_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter, int w, int h, int format, int refresh_rate); +int _al_xglx_fullscreen_select_mode(A5O_SYSTEM_XGLX *s, int adapter, int w, int h, int format, int refresh_rate); -bool _al_xglx_get_monitor_info(ALLEGRO_SYSTEM_XGLX *s, int adapter, ALLEGRO_MONITOR_INFO *info); -int _al_xglx_get_num_video_adapters(ALLEGRO_SYSTEM_XGLX *s); +bool _al_xglx_get_monitor_info(A5O_SYSTEM_XGLX *s, int adapter, A5O_MONITOR_INFO *info); +int _al_xglx_get_num_video_adapters(A5O_SYSTEM_XGLX *s); -int _al_xglx_get_default_adapter(ALLEGRO_SYSTEM_XGLX *s); -int _al_xglx_get_xscreen(ALLEGRO_SYSTEM_XGLX *s, int adapter); +int _al_xglx_get_default_adapter(A5O_SYSTEM_XGLX *s); +int _al_xglx_get_xscreen(A5O_SYSTEM_XGLX *s, int adapter); -void _al_xglx_set_above(ALLEGRO_DISPLAY *display, int value); +void _al_xglx_set_above(A5O_DISPLAY *display, int value); -int _al_xglx_get_adapter(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, bool recalc); +int _al_xglx_get_adapter(A5O_SYSTEM_XGLX *s, A5O_DISPLAY_XGLX *d, bool recalc); -void _al_xglx_handle_mmon_event(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, XEvent *e); +void _al_xglx_handle_mmon_event(A5O_SYSTEM_XGLX *s, A5O_DISPLAY_XGLX *d, XEvent *e); -#ifdef ALLEGRO_XWINDOWS_WITH_XRANDR -void _al_xsys_xrandr_init(ALLEGRO_SYSTEM_XGLX *s); -void _al_xsys_xrandr_exit(ALLEGRO_SYSTEM_XGLX *s); -#endif /* ALLEGRO_XWINDOWS_WITH_XRANDR */ +#ifdef A5O_XWINDOWS_WITH_XRANDR +void _al_xsys_xrandr_init(A5O_SYSTEM_XGLX *s); +void _al_xsys_xrandr_exit(A5O_SYSTEM_XGLX *s); +#endif /* A5O_XWINDOWS_WITH_XRANDR */ #endif diff --git a/include/allegro5/internal/aintern_xglx_config.h b/include/allegro5/internal/aintern_xglx_config.h index c23802c243..d5472b7dcf 100644 --- a/include/allegro5/internal/aintern_xglx_config.h +++ b/include/allegro5/internal/aintern_xglx_config.h @@ -3,7 +3,7 @@ #include "allegro5/internal/aintern_x.h" -void _al_xglx_config_select_visual(ALLEGRO_DISPLAY_XGLX *glx); -bool _al_xglx_config_create_context(ALLEGRO_DISPLAY_XGLX *glx); +void _al_xglx_config_select_visual(A5O_DISPLAY_XGLX *glx); +bool _al_xglx_config_create_context(A5O_DISPLAY_XGLX *glx); #endif diff --git a/include/allegro5/internal/aintern_xkeyboard.h b/include/allegro5/internal/aintern_xkeyboard.h index d02d4dfd97..e5cb109d29 100644 --- a/include/allegro5/internal/aintern_xkeyboard.h +++ b/include/allegro5/internal/aintern_xkeyboard.h @@ -3,9 +3,9 @@ #include "allegro5/internal/aintern_keyboard.h" -ALLEGRO_KEYBOARD_DRIVER *_al_xwin_keyboard_driver(void); -void _al_xwin_keyboard_handler(XKeyEvent *event, ALLEGRO_DISPLAY *display); -void _al_xwin_keyboard_switch_handler(ALLEGRO_DISPLAY *display, bool focus_in); +A5O_KEYBOARD_DRIVER *_al_xwin_keyboard_driver(void); +void _al_xwin_keyboard_handler(XKeyEvent *event, A5O_DISPLAY *display); +void _al_xwin_keyboard_switch_handler(A5O_DISPLAY *display, bool focus_in); #endif diff --git a/include/allegro5/internal/aintern_xmouse.h b/include/allegro5/internal/aintern_xmouse.h index 842f79438b..3a29cef815 100644 --- a/include/allegro5/internal/aintern_xmouse.h +++ b/include/allegro5/internal/aintern_xmouse.h @@ -3,13 +3,13 @@ #include "allegro5/internal/aintern_mouse.h" -ALLEGRO_MOUSE_DRIVER *_al_xwin_mouse_driver(void); -void _al_xwin_mouse_button_press_handler(int button, ALLEGRO_DISPLAY *display); -void _al_xwin_mouse_button_release_handler(int button, ALLEGRO_DISPLAY *d); -void _al_xwin_mouse_motion_notify_handler(int x, int y, ALLEGRO_DISPLAY *d); -void _al_xwin_mouse_switch_handler(ALLEGRO_DISPLAY *display, +A5O_MOUSE_DRIVER *_al_xwin_mouse_driver(void); +void _al_xwin_mouse_button_press_handler(int button, A5O_DISPLAY *display); +void _al_xwin_mouse_button_release_handler(int button, A5O_DISPLAY *d); +void _al_xwin_mouse_motion_notify_handler(int x, int y, A5O_DISPLAY *d); +void _al_xwin_mouse_switch_handler(A5O_DISPLAY *display, const XCrossingEvent *event); -bool _al_xwin_grab_mouse(ALLEGRO_DISPLAY *display); +bool _al_xwin_grab_mouse(A5O_DISPLAY *display); bool _al_xwin_ungrab_mouse(void); #endif diff --git a/include/allegro5/internal/aintern_xsystem.h b/include/allegro5/internal/aintern_xsystem.h index 8baf038e92..31906fdbab 100644 --- a/include/allegro5/internal/aintern_xsystem.h +++ b/include/allegro5/internal/aintern_xsystem.h @@ -1,30 +1,30 @@ #ifndef __al_included_allegro5_aintern_xsystem_h #define __al_included_allegro5_aintern_xsystem_h -#ifdef ALLEGRO_XWINDOWS_WITH_XF86VIDMODE +#ifdef A5O_XWINDOWS_WITH_XF86VIDMODE #include #endif -#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA +#ifdef A5O_XWINDOWS_WITH_XINERAMA #include #endif -#ifdef ALLEGRO_XWINDOWS_WITH_XRANDR +#ifdef A5O_XWINDOWS_WITH_XRANDR #include #endif -#ifdef ALLEGRO_XWINDOWS_WITH_XSCREENSAVER +#ifdef A5O_XWINDOWS_WITH_XSCREENSAVER #include #endif #include "allegro5/internal/aintern_system.h" #include "allegro5/internal/aintern_xdnd.h" -/* This is our version of ALLEGRO_SYSTEM with driver specific extra data. */ -struct ALLEGRO_SYSTEM_XGLX +/* This is our version of A5O_SYSTEM with driver specific extra data. */ +struct A5O_SYSTEM_XGLX { /* This must be the first member, we "derive" from it. */ - ALLEGRO_SYSTEM system; + A5O_SYSTEM system; /* Driver specifics. */ @@ -61,19 +61,19 @@ struct ALLEGRO_SYSTEM_XGLX _AL_MUTEX lock; /* thread lock for whenever we access internals. */ // FIXME: One condition variable really would be enough. _AL_COND resized; /* Condition variable to wait for resizing a window. */ - ALLEGRO_DISPLAY *mouse_grab_display; /* Best effort: may be inaccurate. */ + A5O_DISPLAY *mouse_grab_display; /* Best effort: may be inaccurate. */ int toggle_mouse_grab_keycode; /* Disabled if zero */ unsigned int toggle_mouse_grab_modifiers; bool inhibit_screensaver; /* Should we inhibit the screensaver? */ bool screen_saver_query_available; bool mmon_interface_inited; -#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA +#ifdef A5O_XWINDOWS_WITH_XINERAMA int xinerama_available; int xinerama_screen_count; XineramaScreenInfo *xinerama_screen_info; #endif -#ifdef ALLEGRO_XWINDOWS_WITH_XF86VIDMODE +#ifdef A5O_XWINDOWS_WITH_XF86VIDMODE /* For VidMode extension. */ int xfvm_available; int xfvm_screen_count; @@ -83,7 +83,7 @@ struct ALLEGRO_SYSTEM_XGLX XF86VidModeModeInfo *original_mode; } *xfvm_screen; #endif -#ifdef ALLEGRO_XWINDOWS_WITH_XRANDR +#ifdef A5O_XWINDOWS_WITH_XRANDR int xrandr_available; int xrandr_event_base; _AL_VECTOR xrandr_screens; diff --git a/include/allegro5/internal/aintern_xtouch.h b/include/allegro5/internal/aintern_xtouch.h index 2984adc638..cd35a00bf8 100644 --- a/include/allegro5/internal/aintern_xtouch.h +++ b/include/allegro5/internal/aintern_xtouch.h @@ -3,6 +3,6 @@ #include "allegro5/internal/aintern_touch_input.h" -void _al_x_handle_touch_event(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, XEvent *e); +void _al_x_handle_touch_event(A5O_SYSTEM_XGLX *s, A5O_DISPLAY_XGLX *d, XEvent *e); #endif diff --git a/include/allegro5/internal/aintern_xwindow.h b/include/allegro5/internal/aintern_xwindow.h index 58e3d3da2a..17e3bfe666 100644 --- a/include/allegro5/internal/aintern_xwindow.h +++ b/include/allegro5/internal/aintern_xwindow.h @@ -1,16 +1,16 @@ #ifndef __al_included_allegro5_aintern_xwindow_h #define __al_included_allegro5_aintern_xwindow_h -void _al_xwin_set_size_hints(ALLEGRO_DISPLAY *d, int x_off, int y_off); -void _al_xwin_reset_size_hints(ALLEGRO_DISPLAY *d); -void _al_xwin_set_fullscreen_window(ALLEGRO_DISPLAY *display, int value); -void _al_xwin_set_above(ALLEGRO_DISPLAY *display, int value); -void _al_xwin_set_frame(ALLEGRO_DISPLAY *display, bool frame_on); -void _al_xwin_set_icons(ALLEGRO_DISPLAY *d, - int num_icons, ALLEGRO_BITMAP *bitmaps[]); -void _al_xwin_maximize(ALLEGRO_DISPLAY *d, bool maximized); -void _al_xwin_check_maximized(ALLEGRO_DISPLAY *display); -void _al_xwin_get_borders(ALLEGRO_DISPLAY *display); +void _al_xwin_set_size_hints(A5O_DISPLAY *d, int x_off, int y_off); +void _al_xwin_reset_size_hints(A5O_DISPLAY *d); +void _al_xwin_set_fullscreen_window(A5O_DISPLAY *display, int value); +void _al_xwin_set_above(A5O_DISPLAY *display, int value); +void _al_xwin_set_frame(A5O_DISPLAY *display, bool frame_on); +void _al_xwin_set_icons(A5O_DISPLAY *d, + int num_icons, A5O_BITMAP *bitmaps[]); +void _al_xwin_maximize(A5O_DISPLAY *d, bool maximized); +void _al_xwin_check_maximized(A5O_DISPLAY *display); +void _al_xwin_get_borders(A5O_DISPLAY *display); #endif diff --git a/include/allegro5/internal/alconfig.h b/include/allegro5/internal/alconfig.h index 50367595a9..bd4a52385c 100644 --- a/include/allegro5/internal/alconfig.h +++ b/include/allegro5/internal/alconfig.h @@ -18,8 +18,8 @@ /* for backward compatibility */ #ifdef USE_CONSOLE - #define ALLEGRO_NO_MAGIC_MAIN - #define ALLEGRO_USE_CONSOLE + #define A5O_NO_MAGIC_MAIN + #define A5O_USE_CONSOLE #endif @@ -29,25 +29,25 @@ -#if defined ALLEGRO_WATCOM +#if defined A5O_WATCOM #include "allegro5/platform/alwatcom.h" -#elif defined ALLEGRO_MINGW32 +#elif defined A5O_MINGW32 #include "allegro5/platform/almngw32.h" -#elif defined ALLEGRO_BCC32 +#elif defined A5O_BCC32 #include "allegro5/platform/albcc32.h" -#elif defined ALLEGRO_MSVC +#elif defined A5O_MSVC #include "allegro5/platform/almsvc.h" -#elif defined ALLEGRO_IPHONE +#elif defined A5O_IPHONE #include "allegro5/platform/aliphonecfg.h" -#elif defined ALLEGRO_MACOSX +#elif defined A5O_MACOSX #include "allegro5/platform/alosxcfg.h" -#elif defined ALLEGRO_ANDROID +#elif defined A5O_ANDROID #include "allegro5/platform/alandroidcfg.h" -#elif defined ALLEGRO_RASPBERRYPI +#elif defined A5O_RASPBERRYPI #include "allegro5/platform/alraspberrypicfg.h" -#elif defined ALLEGRO_UNIX +#elif defined A5O_UNIX #include "allegro5/platform/alucfg.h" -#elif defined ALLEGRO_SDL +#elif defined A5O_SDL #include "allegro5/platform/allegro_sdl_config.h" #else #error platform not supported @@ -59,11 +59,11 @@ /* 1 << 31 represented as a signed int */ -#define _ALLEGRO_UNSTABLE_BIT_SET INT32_MIN +#define _A5O_UNSTABLE_BIT_SET INT32_MIN /* special definitions for the GCC compiler */ #ifdef __GNUC__ - #define ALLEGRO_GCC + #define A5O_GCC #ifndef AL_INLINE #ifdef __cplusplus @@ -109,21 +109,21 @@ #endif #endif - #ifdef ALLEGRO_GUESS_INTTYPES_OK + #ifdef A5O_GUESS_INTTYPES_OK #define int64_t signed long long #define uint64_t unsigned long long #endif #ifdef __i386__ - #define ALLEGRO_I386 + #define A5O_I386 #endif #ifdef __amd64__ - #define ALLEGRO_AMD64 + #define A5O_AMD64 #endif #ifdef __arm__ - #define ALLEGRO_ARM + #define A5O_ARM #endif #ifndef AL_FUNC_DEPRECATED @@ -225,7 +225,7 @@ #endif /* endian-independent 3-byte accessor macros */ -#ifdef ALLEGRO_LITTLE_ENDIAN +#ifdef A5O_LITTLE_ENDIAN #define _AL_READ3BYTES(p) ((*(unsigned char *)(p)) \ | (*((unsigned char *)(p) + 1) << 8) \ @@ -235,7 +235,7 @@ (*((unsigned char *)(p) + 1) = (c) >> 8), \ (*((unsigned char *)(p) + 2) = (c) >> 16)) -#elif defined ALLEGRO_BIG_ENDIAN +#elif defined A5O_BIG_ENDIAN #define _AL_READ3BYTES(p) ((*(unsigned char *)(p) << 16) \ | (*((unsigned char *)(p) + 1) << 8) \ diff --git a/include/allegro5/joystick.h b/include/allegro5/joystick.h index 52e19725aa..258f12f188 100644 --- a/include/allegro5/joystick.h +++ b/include/allegro5/joystick.h @@ -26,7 +26,7 @@ /* internal values */ #define _AL_MAX_JOYSTICK_AXES 3 #define _AL_MAX_JOYSTICK_STICKS 16 -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID #define _AL_MAX_JOYSTICK_BUTTONS 36 #else #define _AL_MAX_JOYSTICK_BUTTONS 32 @@ -34,17 +34,17 @@ -/* Type: ALLEGRO_JOYSTICK +/* Type: A5O_JOYSTICK */ -typedef struct ALLEGRO_JOYSTICK ALLEGRO_JOYSTICK; +typedef struct A5O_JOYSTICK A5O_JOYSTICK; -/* Type: ALLEGRO_JOYSTICK_STATE +/* Type: A5O_JOYSTICK_STATE */ -typedef struct ALLEGRO_JOYSTICK_STATE ALLEGRO_JOYSTICK_STATE; +typedef struct A5O_JOYSTICK_STATE A5O_JOYSTICK_STATE; -struct ALLEGRO_JOYSTICK_STATE +struct A5O_JOYSTICK_STATE { struct { float axis[_AL_MAX_JOYSTICK_AXES]; /* -1.0 to 1.0 */ @@ -53,12 +53,12 @@ struct ALLEGRO_JOYSTICK_STATE }; -/* Enum: ALLEGRO_JOYFLAGS +/* Enum: A5O_JOYFLAGS */ -enum ALLEGRO_JOYFLAGS +enum A5O_JOYFLAGS { - ALLEGRO_JOYFLAG_DIGITAL = 0x01, - ALLEGRO_JOYFLAG_ANALOGUE = 0x02 + A5O_JOYFLAG_DIGITAL = 0x01, + A5O_JOYFLAG_ANALOGUE = 0x02 }; @@ -69,24 +69,24 @@ AL_FUNC(bool, al_is_joystick_installed, (void)); AL_FUNC(bool, al_reconfigure_joysticks, (void)); AL_FUNC(int, al_get_num_joysticks, (void)); -AL_FUNC(ALLEGRO_JOYSTICK *, al_get_joystick, (int joyn)); -AL_FUNC(void, al_release_joystick, (ALLEGRO_JOYSTICK *)); -AL_FUNC(bool, al_get_joystick_active, (ALLEGRO_JOYSTICK *)); -AL_FUNC(const char*, al_get_joystick_name, (ALLEGRO_JOYSTICK *)); +AL_FUNC(A5O_JOYSTICK *, al_get_joystick, (int joyn)); +AL_FUNC(void, al_release_joystick, (A5O_JOYSTICK *)); +AL_FUNC(bool, al_get_joystick_active, (A5O_JOYSTICK *)); +AL_FUNC(const char*, al_get_joystick_name, (A5O_JOYSTICK *)); -AL_FUNC(int, al_get_joystick_num_sticks, (ALLEGRO_JOYSTICK *)); -AL_FUNC(int, al_get_joystick_stick_flags, (ALLEGRO_JOYSTICK *, int stick)); /* junk? */ -AL_FUNC(const char*, al_get_joystick_stick_name, (ALLEGRO_JOYSTICK *, int stick)); +AL_FUNC(int, al_get_joystick_num_sticks, (A5O_JOYSTICK *)); +AL_FUNC(int, al_get_joystick_stick_flags, (A5O_JOYSTICK *, int stick)); /* junk? */ +AL_FUNC(const char*, al_get_joystick_stick_name, (A5O_JOYSTICK *, int stick)); -AL_FUNC(int, al_get_joystick_num_axes, (ALLEGRO_JOYSTICK *, int stick)); -AL_FUNC(const char*, al_get_joystick_axis_name, (ALLEGRO_JOYSTICK *, int stick, int axis)); +AL_FUNC(int, al_get_joystick_num_axes, (A5O_JOYSTICK *, int stick)); +AL_FUNC(const char*, al_get_joystick_axis_name, (A5O_JOYSTICK *, int stick, int axis)); -AL_FUNC(int, al_get_joystick_num_buttons, (ALLEGRO_JOYSTICK *)); -AL_FUNC(const char*, al_get_joystick_button_name, (ALLEGRO_JOYSTICK *, int buttonn)); +AL_FUNC(int, al_get_joystick_num_buttons, (A5O_JOYSTICK *)); +AL_FUNC(const char*, al_get_joystick_button_name, (A5O_JOYSTICK *, int buttonn)); -AL_FUNC(void, al_get_joystick_state, (ALLEGRO_JOYSTICK *, ALLEGRO_JOYSTICK_STATE *ret_state)); +AL_FUNC(void, al_get_joystick_state, (A5O_JOYSTICK *, A5O_JOYSTICK_STATE *ret_state)); -AL_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_joystick_event_source, (void)); +AL_FUNC(A5O_EVENT_SOURCE *, al_get_joystick_event_source, (void)); #ifdef __cplusplus } diff --git a/include/allegro5/keyboard.h b/include/allegro5/keyboard.h index 4823cef8f4..1eb2e0ac2c 100644 --- a/include/allegro5/keyboard.h +++ b/include/allegro5/keyboard.h @@ -24,19 +24,19 @@ extern "C" { #endif -typedef struct ALLEGRO_KEYBOARD ALLEGRO_KEYBOARD; +typedef struct A5O_KEYBOARD A5O_KEYBOARD; -/* Type: ALLEGRO_KEYBOARD_STATE +/* Type: A5O_KEYBOARD_STATE */ -typedef struct ALLEGRO_KEYBOARD_STATE ALLEGRO_KEYBOARD_STATE; +typedef struct A5O_KEYBOARD_STATE A5O_KEYBOARD_STATE; -struct ALLEGRO_KEYBOARD_STATE +struct A5O_KEYBOARD_STATE { - struct ALLEGRO_DISPLAY *display; /* public */ + struct A5O_DISPLAY *display; /* public */ /* internal */ - unsigned int __key_down__internal__[(ALLEGRO_KEY_MAX + 31) / 32]; + unsigned int __key_down__internal__[(A5O_KEY_MAX + 31) / 32]; }; @@ -49,13 +49,13 @@ AL_FUNC(bool, al_set_keyboard_leds, (int leds)); AL_FUNC(const char *, al_keycode_to_name, (int keycode)); -AL_FUNC(void, al_get_keyboard_state, (ALLEGRO_KEYBOARD_STATE *ret_state)); -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) -AL_FUNC(void, al_clear_keyboard_state, (ALLEGRO_DISPLAY *display)); +AL_FUNC(void, al_get_keyboard_state, (A5O_KEYBOARD_STATE *ret_state)); +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_SRC) +AL_FUNC(void, al_clear_keyboard_state, (A5O_DISPLAY *display)); #endif -AL_FUNC(bool, al_key_down, (const ALLEGRO_KEYBOARD_STATE *, int keycode)); +AL_FUNC(bool, al_key_down, (const A5O_KEYBOARD_STATE *, int keycode)); -AL_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_keyboard_event_source, (void)); +AL_FUNC(A5O_EVENT_SOURCE *, al_get_keyboard_event_source, (void)); #ifdef __cplusplus } diff --git a/include/allegro5/keycodes.h b/include/allegro5/keycodes.h index 0a89901762..36a202dc8e 100644 --- a/include/allegro5/keycodes.h +++ b/include/allegro5/keycodes.h @@ -22,191 +22,191 @@ /* Note these values are deliberately the same as in Allegro 4.1.x */ 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_PAD_0 = 37, - ALLEGRO_KEY_PAD_1 = 38, - ALLEGRO_KEY_PAD_2 = 39, - ALLEGRO_KEY_PAD_3 = 40, - ALLEGRO_KEY_PAD_4 = 41, - ALLEGRO_KEY_PAD_5 = 42, - ALLEGRO_KEY_PAD_6 = 43, - ALLEGRO_KEY_PAD_7 = 44, - ALLEGRO_KEY_PAD_8 = 45, - ALLEGRO_KEY_PAD_9 = 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_ESCAPE = 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_SEMICOLON = 68, - ALLEGRO_KEY_QUOTE = 69, - ALLEGRO_KEY_BACKSLASH = 70, - ALLEGRO_KEY_BACKSLASH2 = 71, /* DirectInput calls this DIK_OEM_102: "< > | on UK/Germany keyboards" */ - ALLEGRO_KEY_COMMA = 72, - ALLEGRO_KEY_FULLSTOP = 73, - ALLEGRO_KEY_SLASH = 74, - ALLEGRO_KEY_SPACE = 75, - - ALLEGRO_KEY_INSERT = 76, - ALLEGRO_KEY_DELETE = 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_PAD_SLASH = 86, - ALLEGRO_KEY_PAD_ASTERISK = 87, - ALLEGRO_KEY_PAD_MINUS = 88, - ALLEGRO_KEY_PAD_PLUS = 89, - ALLEGRO_KEY_PAD_DELETE = 90, - ALLEGRO_KEY_PAD_ENTER = 91, - - ALLEGRO_KEY_PRINTSCREEN = 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_PAD_EQUALS = 103, /* MacOS X */ - ALLEGRO_KEY_BACKQUOTE = 104, /* MacOS X */ - ALLEGRO_KEY_SEMICOLON2 = 105, /* MacOS X -- TODO: ask lillo what this should be */ - ALLEGRO_KEY_COMMAND = 106, /* MacOS X */ + A5O_KEY_A = 1, + A5O_KEY_B = 2, + A5O_KEY_C = 3, + A5O_KEY_D = 4, + A5O_KEY_E = 5, + A5O_KEY_F = 6, + A5O_KEY_G = 7, + A5O_KEY_H = 8, + A5O_KEY_I = 9, + A5O_KEY_J = 10, + A5O_KEY_K = 11, + A5O_KEY_L = 12, + A5O_KEY_M = 13, + A5O_KEY_N = 14, + A5O_KEY_O = 15, + A5O_KEY_P = 16, + A5O_KEY_Q = 17, + A5O_KEY_R = 18, + A5O_KEY_S = 19, + A5O_KEY_T = 20, + A5O_KEY_U = 21, + A5O_KEY_V = 22, + A5O_KEY_W = 23, + A5O_KEY_X = 24, + A5O_KEY_Y = 25, + A5O_KEY_Z = 26, + + A5O_KEY_0 = 27, + A5O_KEY_1 = 28, + A5O_KEY_2 = 29, + A5O_KEY_3 = 30, + A5O_KEY_4 = 31, + A5O_KEY_5 = 32, + A5O_KEY_6 = 33, + A5O_KEY_7 = 34, + A5O_KEY_8 = 35, + A5O_KEY_9 = 36, + + A5O_KEY_PAD_0 = 37, + A5O_KEY_PAD_1 = 38, + A5O_KEY_PAD_2 = 39, + A5O_KEY_PAD_3 = 40, + A5O_KEY_PAD_4 = 41, + A5O_KEY_PAD_5 = 42, + A5O_KEY_PAD_6 = 43, + A5O_KEY_PAD_7 = 44, + A5O_KEY_PAD_8 = 45, + A5O_KEY_PAD_9 = 46, + + A5O_KEY_F1 = 47, + A5O_KEY_F2 = 48, + A5O_KEY_F3 = 49, + A5O_KEY_F4 = 50, + A5O_KEY_F5 = 51, + A5O_KEY_F6 = 52, + A5O_KEY_F7 = 53, + A5O_KEY_F8 = 54, + A5O_KEY_F9 = 55, + A5O_KEY_F10 = 56, + A5O_KEY_F11 = 57, + A5O_KEY_F12 = 58, + + A5O_KEY_ESCAPE = 59, + A5O_KEY_TILDE = 60, + A5O_KEY_MINUS = 61, + A5O_KEY_EQUALS = 62, + A5O_KEY_BACKSPACE = 63, + A5O_KEY_TAB = 64, + A5O_KEY_OPENBRACE = 65, + A5O_KEY_CLOSEBRACE = 66, + A5O_KEY_ENTER = 67, + A5O_KEY_SEMICOLON = 68, + A5O_KEY_QUOTE = 69, + A5O_KEY_BACKSLASH = 70, + A5O_KEY_BACKSLASH2 = 71, /* DirectInput calls this DIK_OEM_102: "< > | on UK/Germany keyboards" */ + A5O_KEY_COMMA = 72, + A5O_KEY_FULLSTOP = 73, + A5O_KEY_SLASH = 74, + A5O_KEY_SPACE = 75, + + A5O_KEY_INSERT = 76, + A5O_KEY_DELETE = 77, + A5O_KEY_HOME = 78, + A5O_KEY_END = 79, + A5O_KEY_PGUP = 80, + A5O_KEY_PGDN = 81, + A5O_KEY_LEFT = 82, + A5O_KEY_RIGHT = 83, + A5O_KEY_UP = 84, + A5O_KEY_DOWN = 85, + + A5O_KEY_PAD_SLASH = 86, + A5O_KEY_PAD_ASTERISK = 87, + A5O_KEY_PAD_MINUS = 88, + A5O_KEY_PAD_PLUS = 89, + A5O_KEY_PAD_DELETE = 90, + A5O_KEY_PAD_ENTER = 91, + + A5O_KEY_PRINTSCREEN = 92, + A5O_KEY_PAUSE = 93, + + A5O_KEY_ABNT_C1 = 94, + A5O_KEY_YEN = 95, + A5O_KEY_KANA = 96, + A5O_KEY_CONVERT = 97, + A5O_KEY_NOCONVERT = 98, + A5O_KEY_AT = 99, + A5O_KEY_CIRCUMFLEX = 100, + A5O_KEY_COLON2 = 101, + A5O_KEY_KANJI = 102, + + A5O_KEY_PAD_EQUALS = 103, /* MacOS X */ + A5O_KEY_BACKQUOTE = 104, /* MacOS X */ + A5O_KEY_SEMICOLON2 = 105, /* MacOS X -- TODO: ask lillo what this should be */ + A5O_KEY_COMMAND = 106, /* MacOS X */ - ALLEGRO_KEY_BACK = 107, /* Android back key */ - ALLEGRO_KEY_VOLUME_UP = 108, - ALLEGRO_KEY_VOLUME_DOWN = 109, + A5O_KEY_BACK = 107, /* Android back key */ + A5O_KEY_VOLUME_UP = 108, + A5O_KEY_VOLUME_DOWN = 109, /* Android game keys */ - ALLEGRO_KEY_SEARCH = 110, - ALLEGRO_KEY_DPAD_CENTER = 111, - ALLEGRO_KEY_BUTTON_X = 112, - ALLEGRO_KEY_BUTTON_Y = 113, - ALLEGRO_KEY_DPAD_UP = 114, - ALLEGRO_KEY_DPAD_DOWN = 115, - ALLEGRO_KEY_DPAD_LEFT = 116, - ALLEGRO_KEY_DPAD_RIGHT = 117, - ALLEGRO_KEY_SELECT = 118, - ALLEGRO_KEY_START = 119, - ALLEGRO_KEY_BUTTON_L1 = 120, - ALLEGRO_KEY_BUTTON_R1 = 121, - ALLEGRO_KEY_BUTTON_L2 = 122, - ALLEGRO_KEY_BUTTON_R2 = 123, - ALLEGRO_KEY_BUTTON_A = 124, - ALLEGRO_KEY_BUTTON_B = 125, - ALLEGRO_KEY_THUMBL = 126, - ALLEGRO_KEY_THUMBR = 127, + A5O_KEY_SEARCH = 110, + A5O_KEY_DPAD_CENTER = 111, + A5O_KEY_BUTTON_X = 112, + A5O_KEY_BUTTON_Y = 113, + A5O_KEY_DPAD_UP = 114, + A5O_KEY_DPAD_DOWN = 115, + A5O_KEY_DPAD_LEFT = 116, + A5O_KEY_DPAD_RIGHT = 117, + A5O_KEY_SELECT = 118, + A5O_KEY_START = 119, + A5O_KEY_BUTTON_L1 = 120, + A5O_KEY_BUTTON_R1 = 121, + A5O_KEY_BUTTON_L2 = 122, + A5O_KEY_BUTTON_R2 = 123, + A5O_KEY_BUTTON_A = 124, + A5O_KEY_BUTTON_B = 125, + A5O_KEY_THUMBL = 126, + A5O_KEY_THUMBR = 127, - ALLEGRO_KEY_UNKNOWN = 128, + A5O_KEY_UNKNOWN = 128, - /* All codes up to before ALLEGRO_KEY_MODIFIERS can be freely + /* All codes up to before A5O_KEY_MODIFIERS can be freely * assignedas additional unknown keys, like various multimedia * and application keys keyboards may have. */ - ALLEGRO_KEY_MODIFIERS = 215, - - ALLEGRO_KEY_LSHIFT = 215, - ALLEGRO_KEY_RSHIFT = 216, - ALLEGRO_KEY_LCTRL = 217, - ALLEGRO_KEY_RCTRL = 218, - ALLEGRO_KEY_ALT = 219, - ALLEGRO_KEY_ALTGR = 220, - ALLEGRO_KEY_LWIN = 221, - ALLEGRO_KEY_RWIN = 222, - ALLEGRO_KEY_MENU = 223, - ALLEGRO_KEY_SCROLLLOCK = 224, - ALLEGRO_KEY_NUMLOCK = 225, - ALLEGRO_KEY_CAPSLOCK = 226, - - ALLEGRO_KEY_MAX + A5O_KEY_MODIFIERS = 215, + + A5O_KEY_LSHIFT = 215, + A5O_KEY_RSHIFT = 216, + A5O_KEY_LCTRL = 217, + A5O_KEY_RCTRL = 218, + A5O_KEY_ALT = 219, + A5O_KEY_ALTGR = 220, + A5O_KEY_LWIN = 221, + A5O_KEY_RWIN = 222, + A5O_KEY_MENU = 223, + A5O_KEY_SCROLLLOCK = 224, + A5O_KEY_NUMLOCK = 225, + A5O_KEY_CAPSLOCK = 226, + + A5O_KEY_MAX }; enum { - ALLEGRO_KEYMOD_SHIFT = 0x00001, - ALLEGRO_KEYMOD_CTRL = 0x00002, - ALLEGRO_KEYMOD_ALT = 0x00004, - ALLEGRO_KEYMOD_LWIN = 0x00008, - ALLEGRO_KEYMOD_RWIN = 0x00010, - ALLEGRO_KEYMOD_MENU = 0x00020, - ALLEGRO_KEYMOD_ALTGR = 0x00040, - ALLEGRO_KEYMOD_COMMAND = 0x00080, - ALLEGRO_KEYMOD_SCROLLLOCK = 0x00100, - ALLEGRO_KEYMOD_NUMLOCK = 0x00200, - ALLEGRO_KEYMOD_CAPSLOCK = 0x00400, - ALLEGRO_KEYMOD_INALTSEQ = 0x00800, - ALLEGRO_KEYMOD_ACCENT1 = 0x01000, - ALLEGRO_KEYMOD_ACCENT2 = 0x02000, - ALLEGRO_KEYMOD_ACCENT3 = 0x04000, - ALLEGRO_KEYMOD_ACCENT4 = 0x08000 + A5O_KEYMOD_SHIFT = 0x00001, + A5O_KEYMOD_CTRL = 0x00002, + A5O_KEYMOD_ALT = 0x00004, + A5O_KEYMOD_LWIN = 0x00008, + A5O_KEYMOD_RWIN = 0x00010, + A5O_KEYMOD_MENU = 0x00020, + A5O_KEYMOD_ALTGR = 0x00040, + A5O_KEYMOD_COMMAND = 0x00080, + A5O_KEYMOD_SCROLLLOCK = 0x00100, + A5O_KEYMOD_NUMLOCK = 0x00200, + A5O_KEYMOD_CAPSLOCK = 0x00400, + A5O_KEYMOD_INALTSEQ = 0x00800, + A5O_KEYMOD_ACCENT1 = 0x01000, + A5O_KEYMOD_ACCENT2 = 0x02000, + A5O_KEYMOD_ACCENT3 = 0x04000, + A5O_KEYMOD_ACCENT4 = 0x08000 }; diff --git a/include/allegro5/memory.h b/include/allegro5/memory.h index 869f6c26dd..bf50eb960f 100644 --- a/include/allegro5/memory.h +++ b/include/allegro5/memory.h @@ -23,18 +23,18 @@ #endif -/* Type: ALLEGRO_MEMORY_INTERFACE +/* Type: A5O_MEMORY_INTERFACE */ -typedef struct ALLEGRO_MEMORY_INTERFACE ALLEGRO_MEMORY_INTERFACE; +typedef struct A5O_MEMORY_INTERFACE A5O_MEMORY_INTERFACE; -struct ALLEGRO_MEMORY_INTERFACE { +struct A5O_MEMORY_INTERFACE { void *(*mi_malloc)(size_t n, int line, const char *file, const char *func); void (*mi_free)(void *ptr, int line, const char *file, const char *func); void *(*mi_realloc)(void *ptr, size_t n, int line, const char *file, const char *func); void *(*mi_calloc)(size_t count, size_t n, int line, const char *file, const char *func); }; -AL_FUNC(void, al_set_memory_interface, (ALLEGRO_MEMORY_INTERFACE *iface)); +AL_FUNC(void, al_set_memory_interface, (A5O_MEMORY_INTERFACE *iface)); /* Function: al_malloc diff --git a/include/allegro5/monitor.h b/include/allegro5/monitor.h index efa1c975e3..91dfd5a752 100644 --- a/include/allegro5/monitor.h +++ b/include/allegro5/monitor.h @@ -8,24 +8,24 @@ #endif -/* Type: ALLEGRO_MONITOR_INFO +/* Type: A5O_MONITOR_INFO */ -typedef struct ALLEGRO_MONITOR_INFO +typedef struct A5O_MONITOR_INFO { int x1; int y1; int x2; int y2; -} ALLEGRO_MONITOR_INFO; +} A5O_MONITOR_INFO; enum { - ALLEGRO_DEFAULT_DISPLAY_ADAPTER = -1 + A5O_DEFAULT_DISPLAY_ADAPTER = -1 }; AL_FUNC(int, al_get_num_video_adapters, (void)); -AL_FUNC(bool, al_get_monitor_info, (int adapter, ALLEGRO_MONITOR_INFO *info)); +AL_FUNC(bool, al_get_monitor_info, (int adapter, A5O_MONITOR_INFO *info)); AL_FUNC(int, al_get_monitor_dpi, (int adapter)); -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_SRC) AL_FUNC(int, al_get_monitor_refresh_rate, (int adapter)); #endif diff --git a/include/allegro5/mouse.h b/include/allegro5/mouse.h index 21c79a2498..699f0f9af3 100644 --- a/include/allegro5/mouse.h +++ b/include/allegro5/mouse.h @@ -24,17 +24,17 @@ #endif /* Allow up to four extra axes for future expansion. */ -#define ALLEGRO_MOUSE_MAX_EXTRA_AXES 4 +#define A5O_MOUSE_MAX_EXTRA_AXES 4 -typedef struct ALLEGRO_MOUSE ALLEGRO_MOUSE; +typedef struct A5O_MOUSE A5O_MOUSE; -/* Type: ALLEGRO_MOUSE_STATE +/* Type: A5O_MOUSE_STATE */ -typedef struct ALLEGRO_MOUSE_STATE ALLEGRO_MOUSE_STATE; +typedef struct A5O_MOUSE_STATE A5O_MOUSE_STATE; -struct ALLEGRO_MOUSE_STATE +struct A5O_MOUSE_STATE { /* (x, y) Primary mouse position * (z) Mouse wheel position (1D 'wheel'), or, @@ -46,10 +46,10 @@ struct ALLEGRO_MOUSE_STATE int y; int z; int w; - int more_axes[ALLEGRO_MOUSE_MAX_EXTRA_AXES]; + int more_axes[A5O_MOUSE_MAX_EXTRA_AXES]; int buttons; float pressure; - struct ALLEGRO_DISPLAY *display; + struct A5O_DISPLAY *display; }; @@ -58,21 +58,21 @@ AL_FUNC(bool, al_install_mouse, (void)); AL_FUNC(void, al_uninstall_mouse, (void)); AL_FUNC(unsigned int, al_get_mouse_num_buttons, (void)); AL_FUNC(unsigned int, al_get_mouse_num_axes, (void)); -AL_FUNC(bool, al_set_mouse_xy, (struct ALLEGRO_DISPLAY *display, int x, int y)); +AL_FUNC(bool, al_set_mouse_xy, (struct A5O_DISPLAY *display, int x, int y)); AL_FUNC(bool, al_set_mouse_z, (int z)); AL_FUNC(bool, al_set_mouse_w, (int w)); AL_FUNC(bool, al_set_mouse_axis, (int axis, int value)); -AL_FUNC(void, al_get_mouse_state, (ALLEGRO_MOUSE_STATE *ret_state)); -AL_FUNC(bool, al_mouse_button_down, (const ALLEGRO_MOUSE_STATE *state, int button)); -AL_FUNC(int, al_get_mouse_state_axis, (const ALLEGRO_MOUSE_STATE *state, int axis)); +AL_FUNC(void, al_get_mouse_state, (A5O_MOUSE_STATE *ret_state)); +AL_FUNC(bool, al_mouse_button_down, (const A5O_MOUSE_STATE *state, int button)); +AL_FUNC(int, al_get_mouse_state_axis, (const A5O_MOUSE_STATE *state, int axis)); AL_FUNC(bool, al_can_get_mouse_cursor_position, (void)); AL_FUNC(bool, al_get_mouse_cursor_position, (int *ret_x, int *ret_y)); -AL_FUNC(bool, al_grab_mouse, (struct ALLEGRO_DISPLAY *display)); +AL_FUNC(bool, al_grab_mouse, (struct A5O_DISPLAY *display)); AL_FUNC(bool, al_ungrab_mouse, (void)); AL_FUNC(void, al_set_mouse_wheel_precision, (int precision)); AL_FUNC(int, al_get_mouse_wheel_precision, (void)); -AL_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_mouse_event_source, (void)); +AL_FUNC(A5O_EVENT_SOURCE *, al_get_mouse_event_source, (void)); #ifdef __cplusplus } diff --git a/include/allegro5/mouse_cursor.h b/include/allegro5/mouse_cursor.h index 69c7043c4c..e07e14a145 100644 --- a/include/allegro5/mouse_cursor.h +++ b/include/allegro5/mouse_cursor.h @@ -7,46 +7,46 @@ extern "C" { #endif -typedef struct ALLEGRO_MOUSE_CURSOR ALLEGRO_MOUSE_CURSOR; +typedef struct A5O_MOUSE_CURSOR A5O_MOUSE_CURSOR; -typedef enum ALLEGRO_SYSTEM_MOUSE_CURSOR +typedef enum A5O_SYSTEM_MOUSE_CURSOR { - ALLEGRO_SYSTEM_MOUSE_CURSOR_NONE = 0, - ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT = 1, - ALLEGRO_SYSTEM_MOUSE_CURSOR_ARROW = 2, - ALLEGRO_SYSTEM_MOUSE_CURSOR_BUSY = 3, - ALLEGRO_SYSTEM_MOUSE_CURSOR_QUESTION = 4, - ALLEGRO_SYSTEM_MOUSE_CURSOR_EDIT = 5, - ALLEGRO_SYSTEM_MOUSE_CURSOR_MOVE = 6, - ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_N = 7, - ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_W = 8, - ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_S = 9, - ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_E = 10, - ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NW = 11, - ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_SW = 12, - ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_SE = 13, - ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NE = 14, - ALLEGRO_SYSTEM_MOUSE_CURSOR_PROGRESS = 15, - ALLEGRO_SYSTEM_MOUSE_CURSOR_PRECISION = 16, - ALLEGRO_SYSTEM_MOUSE_CURSOR_LINK = 17, - ALLEGRO_SYSTEM_MOUSE_CURSOR_ALT_SELECT = 18, - ALLEGRO_SYSTEM_MOUSE_CURSOR_UNAVAILABLE = 19, - ALLEGRO_NUM_SYSTEM_MOUSE_CURSORS -} ALLEGRO_SYSTEM_MOUSE_CURSOR; - -struct ALLEGRO_BITMAP; -struct ALLEGRO_DISPLAY; - - -AL_FUNC(ALLEGRO_MOUSE_CURSOR *, al_create_mouse_cursor, ( - struct ALLEGRO_BITMAP *sprite, int xfocus, int yfocus)); -AL_FUNC(void, al_destroy_mouse_cursor, (ALLEGRO_MOUSE_CURSOR *)); -AL_FUNC(bool, al_set_mouse_cursor, (struct ALLEGRO_DISPLAY *display, - ALLEGRO_MOUSE_CURSOR *cursor)); -AL_FUNC(bool, al_set_system_mouse_cursor, (struct ALLEGRO_DISPLAY *display, - ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id)); -AL_FUNC(bool, al_show_mouse_cursor, (struct ALLEGRO_DISPLAY *display)); -AL_FUNC(bool, al_hide_mouse_cursor, (struct ALLEGRO_DISPLAY *display)); + A5O_SYSTEM_MOUSE_CURSOR_NONE = 0, + A5O_SYSTEM_MOUSE_CURSOR_DEFAULT = 1, + A5O_SYSTEM_MOUSE_CURSOR_ARROW = 2, + A5O_SYSTEM_MOUSE_CURSOR_BUSY = 3, + A5O_SYSTEM_MOUSE_CURSOR_QUESTION = 4, + A5O_SYSTEM_MOUSE_CURSOR_EDIT = 5, + A5O_SYSTEM_MOUSE_CURSOR_MOVE = 6, + A5O_SYSTEM_MOUSE_CURSOR_RESIZE_N = 7, + A5O_SYSTEM_MOUSE_CURSOR_RESIZE_W = 8, + A5O_SYSTEM_MOUSE_CURSOR_RESIZE_S = 9, + A5O_SYSTEM_MOUSE_CURSOR_RESIZE_E = 10, + A5O_SYSTEM_MOUSE_CURSOR_RESIZE_NW = 11, + A5O_SYSTEM_MOUSE_CURSOR_RESIZE_SW = 12, + A5O_SYSTEM_MOUSE_CURSOR_RESIZE_SE = 13, + A5O_SYSTEM_MOUSE_CURSOR_RESIZE_NE = 14, + A5O_SYSTEM_MOUSE_CURSOR_PROGRESS = 15, + A5O_SYSTEM_MOUSE_CURSOR_PRECISION = 16, + A5O_SYSTEM_MOUSE_CURSOR_LINK = 17, + A5O_SYSTEM_MOUSE_CURSOR_ALT_SELECT = 18, + A5O_SYSTEM_MOUSE_CURSOR_UNAVAILABLE = 19, + A5O_NUM_SYSTEM_MOUSE_CURSORS +} A5O_SYSTEM_MOUSE_CURSOR; + +struct A5O_BITMAP; +struct A5O_DISPLAY; + + +AL_FUNC(A5O_MOUSE_CURSOR *, al_create_mouse_cursor, ( + struct A5O_BITMAP *sprite, int xfocus, int yfocus)); +AL_FUNC(void, al_destroy_mouse_cursor, (A5O_MOUSE_CURSOR *)); +AL_FUNC(bool, al_set_mouse_cursor, (struct A5O_DISPLAY *display, + A5O_MOUSE_CURSOR *cursor)); +AL_FUNC(bool, al_set_system_mouse_cursor, (struct A5O_DISPLAY *display, + A5O_SYSTEM_MOUSE_CURSOR cursor_id)); +AL_FUNC(bool, al_show_mouse_cursor, (struct A5O_DISPLAY *display)); +AL_FUNC(bool, al_hide_mouse_cursor, (struct A5O_DISPLAY *display)); #ifdef __cplusplus diff --git a/include/allegro5/opengl/GLext/gl_ext_alias.h b/include/allegro5/opengl/GLext/gl_ext_alias.h index 4e077647a6..7824b1ba78 100644 --- a/include/allegro5/opengl/GLext/gl_ext_alias.h +++ b/include/allegro5/opengl/GLext/gl_ext_alias.h @@ -1,7 +1,7 @@ /*Automatically generated by gl_mkalias.sh DO NOT EDIT!*/ /**/ -#ifdef _ALLEGRO_GL_VERSION_1_2 +#ifdef _A5O_GL_VERSION_1_2 #define glBlendColor _al_glBlendColor #define glBlendEquation _al_glBlendEquation #define glDrawRangeElements _al_glDrawRangeElements @@ -19,7 +19,7 @@ #define glCopyTexSubImage3D _al_glCopyTexSubImage3D #endif -#if defined _ALLEGRO_GL_ARB_imaging +#if defined _A5O_GL_ARB_imaging #define glConvolutionFilter1D _al_glConvolutionFilter1D #define glConvolutionFilter2D _al_glConvolutionFilter2D #define glConvolutionParameterf _al_glConvolutionParameterf @@ -45,7 +45,7 @@ #define glResetMinmax _al_glResetMinmax #endif -#if defined _ALLEGRO_GL_VERSION_1_3 +#if defined _A5O_GL_VERSION_1_3 #define glActiveTexture _al_glActiveTexture #define glClientActiveTexture _al_glClientActiveTexture #define glMultiTexCoord1d _al_glMultiTexCoord1d @@ -94,7 +94,7 @@ #define glGetCompressedTexImage _al_glGetCompressedTexImage #endif -#if defined _ALLEGRO_GL_VERSION_1_4 +#if defined _A5O_GL_VERSION_1_4 #define glBlendFuncSeparate _al_glBlendFuncSeparate #define glFogCoordf _al_glFogCoordf #define glFogCoordfv _al_glFogCoordfv @@ -143,7 +143,7 @@ #endif -#if defined _ALLEGRO_GL_VERSION_1_5 +#if defined _A5O_GL_VERSION_1_5 #define glBindBuffer _al_glBindBuffer #define glDeleteBuffers _al_glDeleteBuffers #define glGenBuffers _al_glGenBuffers @@ -166,7 +166,7 @@ #endif -#if defined _ALLEGRO_GL_VERSION_2_0 +#if defined _A5O_GL_VERSION_2_0 #define glBlendEquationSeparate _al_glBlendEquationSeparate #define glCreateProgram _al_glCreateProgram #define glCreateShader _al_glCreateShader @@ -269,7 +269,7 @@ #endif -#if defined _ALLEGRO_GL_VERSION_2_1 +#if defined _A5O_GL_VERSION_2_1 #define glUniformMatrix2x3fv _al_glUniformMatrix2x3fv #define glUniformMatrix3x2fv _al_glUniformMatrix3x2fv #define glUniformMatrix2x4fv _al_glUniformMatrix2x4fv @@ -278,7 +278,7 @@ #define glUniformMatrix4x3fv _al_glUniformMatrix4x3fv #endif -#if defined _ALLEGRO_GL_VERSION_3_0 +#if defined _A5O_GL_VERSION_3_0 /*OpenGL3.0alsoreusesentrypointsfromtheseextensions:*/ /*ARB_framebuffer_object*/ /*ARB_map_buffer_range*/ @@ -344,7 +344,7 @@ #endif -#if defined _ALLEGRO_GL_VERSION_3_1 +#if defined _A5O_GL_VERSION_3_1 /*OpenGL3.1alsoreusesentrypointsfromtheseextensions:*/ /*ARB_copy_buffer*/ /*ARB_uniform_buffer_object*/ @@ -354,7 +354,7 @@ #define glPrimitiveRestartIndex _al_glPrimitiveRestartIndex #endif -#if defined _ALLEGRO_GL_VERSION_3_2 +#if defined _A5O_GL_VERSION_3_2 /*OpenGL3.2alsoreusesentrypointsfromtheseextensions:*/ /*ARB_draw_elements_base_vertex*/ /*ARB_provoking_vertex*/ @@ -366,7 +366,7 @@ #define glFramebufferTexture _al_glFramebufferTexture #endif -#if defined _ALLEGRO_GL_VERSION_3_3 +#if defined _A5O_GL_VERSION_3_3 /*OpenGL3.3alsoreusesentrypointsfromtheseextensions:*/ /*ARB_blend_func_extended*/ /*ARB_sampler_objects*/ @@ -379,7 +379,7 @@ /*ARB_vertex_type_2_10_10_10_rev*/ #endif -#if defined _ALLEGRO_GL_VERSION_4_3 +#if defined _A5O_GL_VERSION_4_3 #define glClearBufferData _al_glClearBufferData #define glClearBufferSubData _al_glClearBufferSubData #define glDispatchCompute _al_glDispatchCompute @@ -429,7 +429,7 @@ /**/ /**/ -#ifdef _ALLEGRO_GL_ARB_multitexture +#ifdef _A5O_GL_ARB_multitexture #define glActiveTextureARB _al_glActiveTextureARB #define glClientActiveTextureARB _al_glClientActiveTextureARB #define glMultiTexCoord1dARB _al_glMultiTexCoord1dARB @@ -466,18 +466,18 @@ #define glMultiTexCoord4svARB _al_glMultiTexCoord4svARB #endif -#if defined _ALLEGRO_GL_ARB_transpose_matrix +#if defined _A5O_GL_ARB_transpose_matrix #define glLoadTransposeMatrixfARB _al_glLoadTransposeMatrixfARB #define glLoadTransposeMatrixdARB _al_glLoadTransposeMatrixdARB #define glMultTransposeMatrixfARB _al_glMultTransposeMatrixfARB #define glMultTransposeMatrixdARB _al_glMultTransposeMatrixdARB #endif -#if defined _ALLEGRO_GL_ARB_multisample +#if defined _A5O_GL_ARB_multisample #define glSampleCoverageARB _al_glSampleCoverageARB #endif -#if defined _ALLEGRO_GL_ARB_texture_compression +#if defined _A5O_GL_ARB_texture_compression #define glCompressedTexImage3DARB _al_glCompressedTexImage3DARB #define glCompressedTexImage2DARB _al_glCompressedTexImage2DARB #define glCompressedTexImage1DARB _al_glCompressedTexImage1DARB @@ -487,12 +487,12 @@ #define glGetCompressedTexImageARB _al_glGetCompressedTexImageARB #endif -#if defined _ALLEGRO_GL_ARB_point_parameters +#if defined _A5O_GL_ARB_point_parameters #define glPointParameterfARB _al_glPointParameterfARB #define glPointParameterfvARB _al_glPointParameterfvARB #endif -#if defined _ALLEGRO_GL_ARB_vertex_blend +#if defined _A5O_GL_ARB_vertex_blend #define glWeightbvARB _al_glWeightbvARB #define glWeightsvARB _al_glWeightsvARB #define glWeightivARB _al_glWeightivARB @@ -505,7 +505,7 @@ #define glVertexBlendARB _al_glVertexBlendARB #endif -#if defined _ALLEGRO_GL_ARB_matrix_palette +#if defined _A5O_GL_ARB_matrix_palette #define glCurrentPaletteMatrixARB _al_glCurrentPaletteMatrixARB #define glMatrixIndexubvARB _al_glMatrixIndexubvARB #define glMatrixIndexusvARB _al_glMatrixIndexusvARB @@ -513,7 +513,7 @@ #define glMatrixIndexPointerARB _al_glMatrixIndexPointerARB #endif -#if defined _ALLEGRO_GL_ARB_window_pos +#if defined _A5O_GL_ARB_window_pos #define glWindowPos2dARB _al_glWindowPos2dARB #define glWindowPos2dvARB _al_glWindowPos2dvARB #define glWindowPos2fARB _al_glWindowPos2fARB @@ -532,7 +532,7 @@ #define glWindowPos3svARB _al_glWindowPos3svARB #endif -#if defined _ALLEGRO_GL_ARB_vertex_program +#if defined _A5O_GL_ARB_vertex_program #define glVertexAttrib1dARB _al_glVertexAttrib1dARB #define glVertexAttrib1dvARB _al_glVertexAttrib1dvARB #define glVertexAttrib1fARB _al_glVertexAttrib1fARB @@ -597,7 +597,7 @@ #define glIsProgramARB _al_glIsProgramARB #endif -#if defined _ALLEGRO_GL_ARB_vertex_buffer_object +#if defined _A5O_GL_ARB_vertex_buffer_object #define glBindBufferARB _al_glBindBufferARB #define glDeleteBuffersARB _al_glDeleteBuffersARB #define glGenBuffersARB _al_glGenBuffersARB @@ -611,7 +611,7 @@ #define glGetBufferPointervARB _al_glGetBufferPointervARB #endif -#if defined _ALLEGRO_GL_ARB_occlusion_query +#if defined _A5O_GL_ARB_occlusion_query #define glGenQueriesARB _al_glGenQueriesARB #define glDeleteQueriesARB _al_glDeleteQueriesARB #define glIsQueryARB _al_glIsQueryARB @@ -622,7 +622,7 @@ #define glGetQueryObjectuivARB _al_glGetQueryObjectuivARB #endif -#if defined _ALLEGRO_GL_ARB_shader_objects +#if defined _A5O_GL_ARB_shader_objects #define glDeleteObjectARB _al_glDeleteObjectARB #define glGetHandleARB _al_glGetHandleARB #define glDetachObjectARB _al_glDetachObjectARB @@ -664,7 +664,7 @@ #define glGetShaderSourceARB _al_glGetShaderSourceARB #endif -#ifdef _ALLEGRO_GL_ARB_vertex_shader +#ifdef _A5O_GL_ARB_vertex_shader #ifndef GL_ARB_vertex_program #define glVertexAttrib1fARB _al_glVertexAttrib1fARB #define glVertexAttrib1sARB _al_glVertexAttrib1sARB @@ -717,20 +717,20 @@ #endif #endif -#if defined _ALLEGRO_GL_ARB_draw_buffers +#if defined _A5O_GL_ARB_draw_buffers #define glDrawBuffersARB _al_glDrawBuffersARB #endif -#if defined _ALLEGRO_GL_ARB_color_buffer_float +#if defined _A5O_GL_ARB_color_buffer_float #define glClampColorARB _al_glClampColorARB #endif -#if defined _ALLEGRO_GL_ARB_draw_instanced +#if defined _A5O_GL_ARB_draw_instanced #define glDrawArraysInstancedARB _al_glDrawArraysInstancedARB #define glDrawElementsInstancedARB _al_glDrawElementsInstancedARB #endif -#if defined _ALLEGRO_GL_ARB_framebuffer_object +#if defined _A5O_GL_ARB_framebuffer_object #define glIsRenderbuffer _al_glIsRenderbuffer #define glBindRenderbuffer _al_glBindRenderbuffer #define glDeleteRenderbuffers _al_glDeleteRenderbuffers @@ -753,34 +753,34 @@ #define glFramebufferTextureLayer _al_glFramebufferTextureLayer #endif -#if defined _ALLEGRO_GL_ARB_geometry_shader4 +#if defined _A5O_GL_ARB_geometry_shader4 #define glProgramParameteriARB _al_glProgramParameteriARB #define glFramebufferTextureARB _al_glFramebufferTextureARB #define glFramebufferTextureLayerARB _al_glFramebufferTextureLayerARB #define glFramebufferTextureFaceARB _al_glFramebufferTextureFaceARB #endif -#if defined _ALLEGRO_GL_ARB_instanced_arrays +#if defined _A5O_GL_ARB_instanced_arrays #define glVertexAttribDivisor _al_glVertexAttribDivisor #endif -#if defined _ALLEGRO_GL_ARB_map_buffer_range +#if defined _A5O_GL_ARB_map_buffer_range #define glMapBufferRange _al_glMapBufferRange #define glFlushMappedBufferRange _al_glFlushMappedBufferRange #endif -#if defined _ALLEGRO_GL_ARB_texture_buffer_object +#if defined _A5O_GL_ARB_texture_buffer_object #define glTexBufferARB _al_glTexBufferARB #endif -#if defined _ALLEGRO_GL_ARB_vertex_array_object +#if defined _A5O_GL_ARB_vertex_array_object #define glBindVertexArray _al_glBindVertexArray #define glDeleteVertexArrays _al_glDeleteVertexArrays #define glGenVertexArrays _al_glGenVertexArrays #define glIsVertexArray _al_glIsVertexArray #endif -#if defined _ALLEGRO_GL_ARB_uniform_buffer_object +#if defined _A5O_GL_ARB_uniform_buffer_object #define glGetUniformIndices _al_glGetUniformIndices #define glGetActiveUniformsiv _al_glGetActiveUniformsiv #define glGetActiveUniformName _al_glGetActiveUniformName @@ -790,23 +790,23 @@ #define glUniformBlockBinding _al_glUniformBlockBinding #endif -#if defined _ALLEGRO_GL_ARB_copy_buffer +#if defined _A5O_GL_ARB_copy_buffer #define glCopyBufferSubData _al_glCopyBufferSubData #endif -#if defined _ALLEGRO_GL_ARB_draw_elements_base_vertex +#if defined _A5O_GL_ARB_draw_elements_base_vertex #define glDrawElementsBaseVertex _al_glDrawElementsBaseVertex #define glDrawRangeElementsBaseVertex _al_glDrawRangeElementsBaseVertex #define glDrawElementsInstancedBaseVertex _al_glDrawElementsInstancedBaseVertex #define glMultiDrawElementsBaseVertex _al_glMultiDrawElementsBaseVertex #endif -#if defined _ALLEGRO_GL_ARB_provoking_vertex +#if defined _A5O_GL_ARB_provoking_vertex #define glProvokingVertex _al_glProvokingVertex #endif -#if defined _ALLEGRO_GL_ARB_sync +#if defined _A5O_GL_ARB_sync #define glFenceSync _al_glFenceSync #define glIsSync _al_glIsSync #define glDeleteSync _al_glDeleteSync @@ -816,25 +816,25 @@ #define glGetSynciv _al_glGetSynciv #endif -#if defined _ALLEGRO_GL_ARB_texture_multisample +#if defined _A5O_GL_ARB_texture_multisample #define glTexImage2DMultisample _al_glTexImage2DMultisample #define glTexImage3DMultisample _al_glTexImage3DMultisample #define glGetMultisamplefv _al_glGetMultisamplefv #define glSampleMaski _al_glSampleMaski #endif -#if defined _ALLEGRO_GL_ARB_draw_buffers_blend +#if defined _A5O_GL_ARB_draw_buffers_blend #define glBlendEquationi _al_glBlendEquationi #define glBlendEquationSeparatei _al_glBlendEquationSeparatei #define glBlendFunci _al_glBlendFunci #define glBlendFuncSeparatei _al_glBlendFuncSeparatei #endif -#if defined _ALLEGRO_GL_ARB_sample_shading +#if defined _A5O_GL_ARB_sample_shading #define glMinSampleShading _al_glMinSampleShading #endif -#if defined _ALLEGRO_GL_ARB_shading_language_include +#if defined _A5O_GL_ARB_shading_language_include #define glNamedStringARB _al_glNamedStringARB #define glDeleteNamedStringARB _al_glDeleteNamedStringARB #define glCompileShaderIncludeARB _al_glCompileShaderIncludeARB @@ -843,12 +843,12 @@ #define glGetNamedStringivARB _al_glGetNamedStringivARB #endif -#if defined _ALLEGRO_GL_ARB_blend_func_extended +#if defined _A5O_GL_ARB_blend_func_extended #define glBindFragDataLocationIndexed _al_glBindFragDataLocationIndexed #define glGetFragDataIndex _al_glGetFragDataIndex #endif -#if defined _ALLEGRO_GL_ARB_sampler_objects +#if defined _A5O_GL_ARB_sampler_objects #define glGenSamplers _al_glGenSamplers #define glDeleteSamplers _al_glDeleteSamplers #define glIsSampler _al_glIsSampler @@ -865,13 +865,13 @@ #define glGetSamplerParameterIfv _al_glGetSamplerParameterIfv #endif -#if defined _ALLEGRO_GL_ARB_timer_query +#if defined _A5O_GL_ARB_timer_query #define glQueryCounter _al_glQueryCounter #define glGetQueryObjecti64v _al_glGetQueryObjecti64v #define glGetQueryObjectui64v _al_glGetQueryObjectui64v #endif -#if defined _ALLEGRO_GL_ARB_vertex_type_2_10_10_10_rev +#if defined _A5O_GL_ARB_vertex_type_2_10_10_10_rev #define glVertexP2ui _al_glVertexP2ui #define glVertexP2uiv _al_glVertexP2uiv #define glVertexP3ui _al_glVertexP3ui @@ -912,12 +912,12 @@ #define glVertexAttribP4uiv _al_glVertexAttribP4uiv #endif -#if defined _ALLEGRO_GL_ARB_draw_indirect +#if defined _A5O_GL_ARB_draw_indirect #define glDrawArraysIndirect _al_glDrawArraysIndirect #define glDrawElementsIndirect _al_glDrawElementsIndirect #endif -#if defined _ALLEGRO_GL_ARB_gpu_shader_fp64 +#if defined _A5O_GL_ARB_gpu_shader_fp64 #define glUniform1d _al_glUniform1d #define glUniform2d _al_glUniform2d #define glUniform3d _al_glUniform3d @@ -955,7 +955,7 @@ #define glProgramUniformMatrix4x3dvEXT _al_glProgramUniformMatrix4x3dvEXT #endif -#if defined _ALLEGRO_GL_ARB_shader_subroutine +#if defined _A5O_GL_ARB_shader_subroutine #define glGetSubroutineUniformLocation _al_glGetSubroutineUniformLocation #define glGetSubroutineIndex _al_glGetSubroutineIndex #define glGetActiveSubroutineUniformiv _al_glGetActiveSubroutineUniformiv @@ -966,12 +966,12 @@ #define glGetProgramStageiv _al_glGetProgramStageiv #endif -#if defined _ALLEGRO_GL_ARB_tessellation_shader +#if defined _A5O_GL_ARB_tessellation_shader #define glPatchParameteri _al_glPatchParameteri #define glPatchParameterfv _al_glPatchParameterfv #endif -#if defined _ALLEGRO_GL_ARB_transform_feedback2 +#if defined _A5O_GL_ARB_transform_feedback2 #define glBindTransformFeedback _al_glBindTransformFeedback #define glDeleteTransformFeedbacks _al_glDeleteTransformFeedbacks #define glGenTransformFeedbacks _al_glGenTransformFeedbacks @@ -981,7 +981,7 @@ #define glDrawTransformFeedback _al_glDrawTransformFeedback #endif -#if defined _ALLEGRO_GL_ARB_transform_feedback3 +#if defined _A5O_GL_ARB_transform_feedback3 #define glDrawTransformFeedbackStream _al_glDrawTransformFeedbackStream #define glBeginQueryIndexed _al_glBeginQueryIndexed #define glEndQueryIndexed _al_glEndQueryIndexed @@ -992,30 +992,30 @@ /**/ -#if defined _ALLEGRO_GL_EXT_blend_color +#if defined _A5O_GL_EXT_blend_color #define glBlendColorEXT _al_glBlendColorEXT #endif -#if defined _ALLEGRO_GL_EXT_polygon_offset +#if defined _A5O_GL_EXT_polygon_offset #define glPolygonOffsetEXT _al_glPolygonOffsetEXT #endif -#if defined _ALLEGRO_GL_EXT_texture3D +#if defined _A5O_GL_EXT_texture3D #define glTexImage3DEXT _al_glTexImage3DEXT #define glTexSubImage3DEXT _al_glTexSubImage3DEXT #endif -#if defined _ALLEGRO_GL_SGIS_texture_filter4 +#if defined _A5O_GL_SGIS_texture_filter4 #define glGetTexFilterFuncSGIS _al_glGetTexFilterFuncSGIS #define glTexFilterFuncSGIS _al_glTexFilterFuncSGIS #endif -#if defined _ALLEGRO_GL_EXT_subtexture +#if defined _A5O_GL_EXT_subtexture #define glTexSubImage1DEXT _al_glTexSubImage1DEXT #define glTexSubImage2DEXT _al_glTexSubImage2DEXT #endif -#if defined _ALLEGRO_GL_EXT_copy_texture +#if defined _A5O_GL_EXT_copy_texture #define glCopyTexImage1DEXT _al_glCopyTexImage1DEXT #define glCopyTexImage2DEXT _al_glCopyTexImage2DEXT #define glCopyTexSubImage1DEXT _al_glCopyTexSubImage1DEXT @@ -1023,7 +1023,7 @@ #define glCopyTexSubImage3DEXT _al_glCopyTexSubImage3DEXT #endif -#if defined _ALLEGRO_GL_EXT_histogram +#if defined _A5O_GL_EXT_histogram #define glGetHistogramEXT _al_glGetHistogramEXT #define glGetHistogramParameterfvEXT _al_glGetHistogramParameterfvEXT #define glGetHistogramParameterivEXT _al_glGetHistogramParameterivEXT @@ -1036,7 +1036,7 @@ #define glResetMinmaxEXT _al_glResetMinmaxEXT #endif -#if defined _ALLEGRO_GL_EXT_convolution +#if defined _A5O_GL_EXT_convolution #define glConvolutionFilter1DEXT _al_glConvolutionFilter1DEXT #define glConvolutionFilter2DEXT _al_glConvolutionFilter2DEXT #define glConvolutionParameterfEXT _al_glConvolutionParameterfEXT @@ -1052,7 +1052,7 @@ #define glSeparableFilter2DEXT _al_glSeparableFilter2DEXT #endif -#if defined _ALLEGRO_GL_SGI_color_table +#if defined _A5O_GL_SGI_color_table #define glColorTableSGI _al_glColorTableSGI #define glColorTableParameterfvSGI _al_glColorTableParameterfvSGI #define glColorTableParameterivSGI _al_glColorTableParameterivSGI @@ -1062,11 +1062,11 @@ #define glGetColorTableParameterivSGI _al_glGetColorTableParameterivSGI #endif -#if defined _ALLEGRO_GL_SGIX_pixel_texture +#if defined _A5O_GL_SGIX_pixel_texture #define glPixelTexGenSGIX _al_glPixelTexGenSGIX #endif -#if defined _ALLEGRO_GL_SGIS_pixel_texture +#if defined _A5O_GL_SGIS_pixel_texture #define glPixelTexGenParameteriSGIS _al_glPixelTexGenParameteriSGIS #define glPixelTexGenParameterivSGIS _al_glPixelTexGenParameterivSGIS #define glPixelTexGenParameterfSGIS _al_glPixelTexGenParameterfSGIS @@ -1075,12 +1075,12 @@ #define glGetPixelTexGenParameterfvSGIS _al_glGetPixelTexGenParameterfvSGIS #endif -#if defined _ALLEGRO_GL_SGIS_texture4D +#if defined _A5O_GL_SGIS_texture4D #define glTexImage4DSGIS _al_glTexImage4DSGIS #define glTexSubImage4DSGIS _al_glTexSubImage4DSGIS #endif -#if defined _ALLEGRO_GL_EXT_texture_object +#if defined _A5O_GL_EXT_texture_object #define glAreTexturesResidentEXT _al_glAreTexturesResidentEXT #define glBindTextureEXT _al_glBindTextureEXT #define glDeleteTexturesEXT _al_glDeleteTexturesEXT @@ -1089,22 +1089,22 @@ #define glPrioritizeTexturesEXT _al_glPrioritizeTexturesEXT #endif -#if defined _ALLEGRO_GL_SGIS_detail_texture +#if defined _A5O_GL_SGIS_detail_texture #define glDetailTexFuncSGIS _al_glDetailTexFuncSGIS #define glGetDetailTexFuncSGIS _al_glGetDetailTexFuncSGIS #endif -#if defined _ALLEGRO_GL_SGIS_sharpen_texture +#if defined _A5O_GL_SGIS_sharpen_texture #define glSharpenTexFuncSGIS _al_glSharpenTexFuncSGIS #define glGetSharpenTexFuncSGIS _al_glGetSharpenTexFuncSGIS #endif -#if defined _ALLEGRO_GL_SGIS_multisample +#if defined _A5O_GL_SGIS_multisample #define glSampleMaskSGIS _al_glSampleMaskSGIS #define glSamplePatternSGIS _al_glSamplePatternSGIS #endif -#if defined _ALLEGRO_GL_EXT_vertex_array +#if defined _A5O_GL_EXT_vertex_array #define glArrayElementEXT _al_glArrayElementEXT #define glColorPointerEXT _al_glColorPointerEXT #define glDrawArraysEXT _al_glDrawArraysEXT @@ -1116,28 +1116,28 @@ #define glVertexPointerEXT _al_glVertexPointerEXT #endif -#if defined _ALLEGRO_GL_EXT_blend_minmax +#if defined _A5O_GL_EXT_blend_minmax #define glBlendEquationEXT _al_glBlendEquationEXT #endif -#if defined _ALLEGRO_GL_SGIX_sprite +#if defined _A5O_GL_SGIX_sprite #define glSpriteParameterfSGIX _al_glSpriteParameterfSGIX #define glSpriteParameterfvSGIX _al_glSpriteParameterfvSGIX #define glSpriteParameteriSGIX _al_glSpriteParameteriSGIX #define glSpriteParameterivSGIX _al_glSpriteParameterivSGIX #endif -#if defined _ALLEGRO_GL_EXT_point_parameters +#if defined _A5O_GL_EXT_point_parameters #define glPointParameterfEXT _al_glPointParameterfEXT #define glPointParameterfvEXT _al_glPointParameterfvEXT #endif -#if defined _ALLEGRO_GL_SGIS_point_parameters +#if defined _A5O_GL_SGIS_point_parameters #define glPointParameterfSGIS _al_glPointParameterfSGIS #define glPointParameterfvSGIS _al_glPointParameterfvSGIS #endif -#if defined _ALLEGRO_GL_SGIX_instruments +#if defined _A5O_GL_SGIX_instruments #define glGetInstrumentsSGIX _al_glGetInstrumentsSGIX #define glInstrumentsBufferSGIX _al_glInstrumentsBufferSGIX #define glPollInstrumentsSGIX _al_glPollInstrumentsSGIX @@ -1146,35 +1146,35 @@ #define glStopInstrumentsSGIX _al_glStopInstrumentsSGIX #endif -#if defined _ALLEGRO_GL_SGIX_framezoom +#if defined _A5O_GL_SGIX_framezoom #define glFrameZoomSGIX _al_glFrameZoomSGIX #endif -#if defined _ALLEGRO_GL_SGIX_tag_sample_buffer +#if defined _A5O_GL_SGIX_tag_sample_buffer #define glTagSampleBufferSGIX _al_glTagSampleBufferSGIX #endif -#if defined _ALLEGRO_GL_SGIX_polynomial_ffd +#if defined _A5O_GL_SGIX_polynomial_ffd #define glDeformationMap3dSGIX _al_glDeformationMap3dSGIX #define glDeformationMap3fSGIX _al_glDeformationMap3fSGIX #define glDeformSGIX _al_glDeformSGIX #define glLoadIdentityDeformationMapSGIX _al_glLoadIdentityDeformationMapSGIX #endif -#if defined _ALLEGRO_GL_SGIX_reference_plane +#if defined _A5O_GL_SGIX_reference_plane #define glReferencePlaneSGIX _al_glReferencePlaneSGIX #endif -#if defined _ALLEGRO_GL_SGIX_flush_raster +#if defined _A5O_GL_SGIX_flush_raster #define glFlushRasterSGIX _al_glFlushRasterSGIX #endif -#if defined _ALLEGRO_GL_SGIS_fog_function +#if defined _A5O_GL_SGIS_fog_function #define glFogFuncSGIS _al_glFogFuncSGIS #define glGetFogFuncSGIS _al_glGetFogFuncSGIS #endif -#if defined _ALLEGRO_GL_HP_image_transform +#if defined _A5O_GL_HP_image_transform #define glImageTransformParameteriHP _al_glImageTransformParameteriHP #define glImageTransformParameterfHP _al_glImageTransformParameterfHP #define glImageTransformParameterivHP _al_glImageTransformParameterivHP @@ -1183,25 +1183,25 @@ #define glGetImageTransformParameterfvHP _al_glGetImageTransformParameterfvHP #endif -#if defined _ALLEGRO_GL_EXT_color_subtable +#if defined _A5O_GL_EXT_color_subtable #ifndef GL_EXT_paletted_texture #define glColorSubTableEXT _al_glColorSubTableEXT #endif #define glCopyColorSubTableEXT _al_glCopyColorSubTableEXT #endif -#if defined _ALLEGRO_GL_PGI_misc_hints +#if defined _A5O_GL_PGI_misc_hints #define glHintPGI _al_glHintPGI #endif -#if defined _ALLEGRO_GL_EXT_paletted_texture +#if defined _A5O_GL_EXT_paletted_texture #define glColorTableEXT _al_glColorTableEXT #define glGetColorTableEXT _al_glGetColorTableEXT #define glGetColorTableParameterivEXT _al_glGetColorTableParameterivEXT #define glGetColorTableParameterfvEXT _al_glGetColorTableParameterfvEXT #endif -#if defined _ALLEGRO_GL_SGIX_list_priority +#if defined _A5O_GL_SGIX_list_priority #define glGetListParameterfvSGIX _al_glGetListParameterfvSGIX #define glGetListParameterivSGIX _al_glGetListParameterivSGIX #define glListParameterfSGIX _al_glListParameterfSGIX @@ -1210,25 +1210,25 @@ #define glListParameterivSGIX _al_glListParameterivSGIX #endif -#if defined _ALLEGRO_GL_EXT_index_material +#if defined _A5O_GL_EXT_index_material #define glIndexMaterialEXT _al_glIndexMaterialEXT #endif -#if defined _ALLEGRO_GL_EXT_index_func +#if defined _A5O_GL_EXT_index_func #define glIndexFuncEXT _al_glIndexFuncEXT #endif -#if defined _ALLEGRO_GL_EXT_compiled_vertex_array +#if defined _A5O_GL_EXT_compiled_vertex_array #define glLockArraysEXT _al_glLockArraysEXT #define glUnlockArraysEXT _al_glUnlockArraysEXT #endif -#if defined _ALLEGRO_GL_EXT_cull_vertex +#if defined _A5O_GL_EXT_cull_vertex #define glCullParameterdvEXT _al_glCullParameterdvEXT #define glCullParameterfvEXT _al_glCullParameterfvEXT #endif -#if defined _ALLEGRO_GL_SGIX_fragment_lighting +#if defined _A5O_GL_SGIX_fragment_lighting #define glFragmentColorMaterialSGIX _al_glFragmentColorMaterialSGIX #define glFragmentLightfSGIX _al_glFragmentLightfSGIX #define glFragmentLightfvSGIX _al_glFragmentLightfvSGIX @@ -1249,17 +1249,17 @@ #define glLightEnviSGIX _al_glLightEnviSGIX #endif -#if defined _ALLEGRO_GL_EXT_draw_range_elements +#if defined _A5O_GL_EXT_draw_range_elements #define glDrawRangeElementsEXT _al_glDrawRangeElementsEXT #endif -#if defined _ALLEGRO_GL_EXT_light_texture +#if defined _A5O_GL_EXT_light_texture #define glApplyTextureEXT _al_glApplyTextureEXT #define glTextureLightEXT _al_glTextureLightEXT #define glTextureMaterialEXT _al_glTextureMaterialEXT #endif -#if defined _ALLEGRO_GL_SGIX_async +#if defined _A5O_GL_SGIX_async #define glAsyncMarkerSGIX _al_glAsyncMarkerSGIX #define glFinishAsyncSGIX _al_glFinishAsyncSGIX #define glPollAsyncSGIX _al_glPollAsyncSGIX @@ -1268,21 +1268,21 @@ #define glIsAsyncMarkerSGIX _al_glIsAsyncMarkerSGIX #endif -#if defined _ALLEGRO_GL_INTEL_parallel_arrays +#if defined _A5O_GL_INTEL_parallel_arrays #define glVertexPointervINTEL _al_glVertexPointervINTEL #define glNormalPointervINTEL _al_glNormalPointervINTEL #define glColorPointervINTEL _al_glColorPointervINTEL #define glTexCoordPointervINTEL _al_glTexCoordPointervINTEL #endif -#if defined _ALLEGRO_GL_EXT_pixel_transform +#if defined _A5O_GL_EXT_pixel_transform #define glPixelTransformParameteriEXT _al_glPixelTransformParameteriEXT #define glPixelTransformParameterfEXT _al_glPixelTransformParameterfEXT #define glPixelTransformParameterivEXT _al_glPixelTransformParameterivEXT #define glPixelTransformParameterfvEXT _al_glPixelTransformParameterfvEXT #endif -#if defined _ALLEGRO_GL_EXT_secondary_color +#if defined _A5O_GL_EXT_secondary_color #define glSecondaryColor3bEXT _al_glSecondaryColor3bEXT #define glSecondaryColor3bvEXT _al_glSecondaryColor3bvEXT #define glSecondaryColor3dEXT _al_glSecondaryColor3dEXT @@ -1302,16 +1302,16 @@ #define glSecondaryColorPointerEXT _al_glSecondaryColorPointerEXT #endif -#if defined _ALLEGRO_GL_EXT_texture_perturb_normal +#if defined _A5O_GL_EXT_texture_perturb_normal #define glTextureNormalEXT _al_glTextureNormalEXT #endif -#if defined _ALLEGRO_GL_EXT_multi_draw_arrays +#if defined _A5O_GL_EXT_multi_draw_arrays #define glMultiDrawArraysEXT _al_glMultiDrawArraysEXT #define glMultiDrawElementsEXT _al_glMultiDrawElementsEXT #endif -#if defined _ALLEGRO_GL_EXT_fog_coord +#if defined _A5O_GL_EXT_fog_coord #define glFogCoordfEXT _al_glFogCoordfEXT #define glFogCoordfvEXT _al_glFogCoordfvEXT #define glFogCoorddEXT _al_glFogCoorddEXT @@ -1319,7 +1319,7 @@ #define glFogCoordPointerEXT _al_glFogCoordPointerEXT #endif -#if defined _ALLEGRO_GL_EXT_coordinate_frame +#if defined _A5O_GL_EXT_coordinate_frame #define glTangent3bEXT _al_glTangent3bEXT #define glTangent3bvEXT _al_glTangent3bvEXT #define glTangent3dEXT _al_glTangent3dEXT @@ -1344,11 +1344,11 @@ #define glBinormalPointerEXT _al_glBinormalPointerEXT #endif -#if defined _ALLEGRO_GL_SUNX_constant_data +#if defined _A5O_GL_SUNX_constant_data #define glFinishTextureSUNX _al_glFinishTextureSUNX #endif -#if defined _ALLEGRO_GL_SUN_global_alpha +#if defined _A5O_GL_SUN_global_alpha #define glGlobalAlphaFactorbSUN _al_glGlobalAlphaFactorbSUN #define glGlobalAlphaFactorsSUN _al_glGlobalAlphaFactorsSUN #define glGlobalAlphaFactoriSUN _al_glGlobalAlphaFactoriSUN @@ -1359,7 +1359,7 @@ #define glGlobalAlphaFactoruiSUN _al_glGlobalAlphaFactoruiSUN #endif -#if defined _ALLEGRO_GL_SUN_triangle_list +#if defined _A5O_GL_SUN_triangle_list #define glReplacementCodeuiSUN _al_glReplacementCodeuiSUN #define glReplacementCodeusSUN _al_glReplacementCodeusSUN #define glReplacementCodeubSUN _al_glReplacementCodeubSUN @@ -1369,7 +1369,7 @@ #define glReplacementCodePointerSUN _al_glReplacementCodePointerSUN #endif -#if defined _ALLEGRO_GL_SUN_vertex +#if defined _A5O_GL_SUN_vertex #define glColor4ubVertex2fSUN _al_glColor4ubVertex2fSUN #define glColor4ubVertex2fvSUN _al_glColor4ubVertex2fvSUN #define glColor4ubVertex3fSUN _al_glColor4ubVertex3fSUN @@ -1412,26 +1412,26 @@ #define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN _al_glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN #endif -#if defined _ALLEGRO_GL_EXT_blend_func_separate +#if defined _A5O_GL_EXT_blend_func_separate #define glBlendFuncSeparateEXT _al_glBlendFuncSeparateEXT #endif -#if defined _ALLEGRO_GL_INGR_blend_func_separate +#if defined _A5O_GL_INGR_blend_func_separate #define glBlendFuncSeparateINGR _al_glBlendFuncSeparateINGR #endif -#if defined _ALLEGRO_GL_EXT_vertex_weighting +#if defined _A5O_GL_EXT_vertex_weighting #define glVertexWeightfEXT _al_glVertexWeightfEXT #define glVertexWeightfvEXT _al_glVertexWeightfvEXT #define glVertexWeightPointerEXT _al_glVertexWeightPointerEXT #endif -#if defined _ALLEGRO_GL_NV_vertex_array_range +#if defined _A5O_GL_NV_vertex_array_range #define glFlushVertexArrayRangeNV _al_glFlushVertexArrayRangeNV #define glVertexArrayRangeNV _al_glVertexArrayRangeNV #endif -#if defined _ALLEGRO_GL_NV_register_combiners +#if defined _A5O_GL_NV_register_combiners #define glCombinerParameterfvNV _al_glCombinerParameterfvNV #define glCombinerParameterfNV _al_glCombinerParameterfNV #define glCombinerParameterivNV _al_glCombinerParameterivNV @@ -1447,11 +1447,11 @@ #define glGetFinalCombinerInputParameterivNV _al_glGetFinalCombinerInputParameterivNV #endif -#if defined _ALLEGRO_GL_MESA_resize_buffers +#if defined _A5O_GL_MESA_resize_buffers #define glResizeBuffersMESA _al_glResizeBuffersMESA #endif -#if defined _ALLEGRO_GL_MESA_window_pos +#if defined _A5O_GL_MESA_window_pos #define glWindowPos2dMESA _al_glWindowPos2dMESA #define glWindowPos2dvMESA _al_glWindowPos2dvMESA #define glWindowPos2fMESA _al_glWindowPos2fMESA @@ -1478,7 +1478,7 @@ #define glWindowPos4svMESA _al_glWindowPos4svMESA #endif -#if defined _ALLEGRO_GL_IBM_multimode_draw_arrays +#if defined _A5O_GL_IBM_multimode_draw_arrays #define glMultiModeDrawArraysIBM _al_glMultiModeDrawArraysIBM #define glMultiModeDrawElementsIBM _al_glMultiModeDrawElementsIBM #endif @@ -1494,24 +1494,24 @@ #define glVertexPointerListIBM _al_glVertexPointerListIBM #endif -#if defined _ALLEGRO_GL_3DFX_tbuffer +#if defined _A5O_GL_3DFX_tbuffer #define glTbufferMask3DFX _al_glTbufferMask3DFX #endif -#if defined _ALLEGRO_GL_EXT_multisample +#if defined _A5O_GL_EXT_multisample #define glSampleMaskEXT _al_glSampleMaskEXT #define glSamplePatternEXT _al_glSamplePatternEXT #endif -#if defined _ALLEGRO_GL_SGIS_texture_color_mask +#if defined _A5O_GL_SGIS_texture_color_mask #define glTextureColorMaskSGIS _al_glTextureColorMaskSGIS #endif -#if defined _ALLEGRO_GL_SGIX_igloo_interface +#if defined _A5O_GL_SGIX_igloo_interface #define glIglooInterfaceSGIX _al_glIglooInterfaceSGIX #endif -#if defined _ALLEGRO_GL_NV_fence +#if defined _A5O_GL_NV_fence #define glDeleteFencesNV _al_glDeleteFencesNV #define glGenFencesNV _al_glGenFencesNV #define glIsFenceNV _al_glIsFenceNV @@ -1521,7 +1521,7 @@ #define glSetFenceNV _al_glSetFenceNV #endif -#if defined _ALLEGRO_GL_NV_evaluators +#if defined _A5O_GL_NV_evaluators #define glMapControlPointsNV _al_glMapControlPointsNV #define glMapParameterivNV _al_glMapParameterivNV #define glMapParameterfvNV _al_glMapParameterfvNV @@ -1533,12 +1533,12 @@ #define glEvalMapsNV _al_glEvalMapsNV #endif -#if defined _ALLEGRO_GL_NV_register_combiners2 +#if defined _A5O_GL_NV_register_combiners2 #define glCombinerStageParameterfvNV _al_glCombinerStageParameterfvNV #define glGetCombinerStageParameterfvNV _al_glGetCombinerStageParameterfvNV #endif -#if defined _ALLEGRO_GL_NV_vertex_program +#if defined _A5O_GL_NV_vertex_program #define glAreProgramsResidentNV _al_glAreProgramsResidentNV #define glBindProgramNV _al_glBindProgramNV #define glDeleteProgramsNV _al_glDeleteProgramsNV @@ -1605,14 +1605,14 @@ #define glVertexAttribs4ubvNV _al_glVertexAttribs4ubvNV #endif -#if defined _ALLEGRO_GL_ATI_envmap_bumpmap +#if defined _A5O_GL_ATI_envmap_bumpmap #define glTexBumpParameterivATI _al_glTexBumpParameterivATI #define glTexBumpParameterfvATI _al_glTexBumpParameterfvATI #define glGetTexBumpParameterivATI _al_glGetTexBumpParameterivATI #define glGetTexBumpParameterfvATI _al_glGetTexBumpParameterfvATI #endif -#if defined _ALLEGRO_GL_ATI_fragment_shader +#if defined _A5O_GL_ATI_fragment_shader #define glGenFragmentShadersATI _al_glGenFragmentShadersATI #define glBindFragmentShaderATI _al_glBindFragmentShaderATI #define glDeleteFragmentShaderATI _al_glDeleteFragmentShaderATI @@ -1629,12 +1629,12 @@ #define glSetFragmentShaderConstantATI _al_glSetFragmentShaderConstantATI #endif -#if defined _ALLEGRO_GL_ATI_pn_triangles +#if defined _A5O_GL_ATI_pn_triangles #define glPNTrianglesiATI _al_glPNTrianglesiATI #define glPNTrianglesfATI _al_glPNTrianglesfATI #endif -#if defined _ALLEGRO_GL_ATI_vertex_array_object +#if defined _A5O_GL_ATI_vertex_array_object #define glNewObjectBufferATI _al_glNewObjectBufferATI #define glIsObjectBufferATI _al_glIsObjectBufferATI #define glUpdateObjectBufferATI _al_glUpdateObjectBufferATI @@ -1649,7 +1649,7 @@ #define glGetVariantArrayObjectivATI _al_glGetVariantArrayObjectivATI #endif -#if defined _ALLEGRO_GL_EXT_vertex_shader +#if defined _A5O_GL_EXT_vertex_shader #define glBeginVertexShaderEXT _al_glBeginVertexShaderEXT #define glEndVertexShaderEXT _al_glEndVertexShaderEXT #define glBindVertexShaderEXT _al_glBindVertexShaderEXT @@ -1694,7 +1694,7 @@ #define glGetLocalConstantFloatvEXT _al_glGetLocalConstantFloatvEXT #endif -#if defined _ALLEGRO_GL_ATI_vertex_streams +#if defined _A5O_GL_ATI_vertex_streams #define glVertexStream1sATI _al_glVertexStream1sATI #define glVertexStream1svATI _al_glVertexStream1svATI #define glVertexStream1iATI _al_glVertexStream1iATI @@ -1742,17 +1742,17 @@ #define glVertexBlendEnvfATI _al_glVertexBlendEnvfATI #endif -#if defined _ALLEGRO_GL_ATI_element_array +#if defined _A5O_GL_ATI_element_array #define glElementPointerATI _al_glElementPointerATI #define glDrawElementArrayATI _al_glDrawElementArrayATI #define glDrawRangeElementArrayATI _al_glDrawRangeElementArrayATI #endif -#if defined _ALLEGRO_GL_SUN_mesh_array +#if defined _A5O_GL_SUN_mesh_array #define glDrawMeshArraysSUN _al_glDrawMeshArraysSUN #endif -#if defined _ALLEGRO_GL_NV_occlusion_query +#if defined _A5O_GL_NV_occlusion_query #define glGenOcclusionQueriesNV _al_glGenOcclusionQueriesNV #define glDeleteOcclusionQueriesNV _al_glDeleteOcclusionQueriesNV #define glIsOcclusionQueryNV _al_glIsOcclusionQueryNV @@ -1762,16 +1762,16 @@ #define glGetOcclusionQueryuivNV _al_glGetOcclusionQueryuivNV #endif -#if defined _ALLEGRO_GL_NV_point_sprite +#if defined _A5O_GL_NV_point_sprite #define glPointParameteriNV _al_glPointParameteriNV #define glPointParameterivNV _al_glPointParameterivNV #endif -#if defined _ALLEGRO_GL_EXT_stencil_two_side +#if defined _A5O_GL_EXT_stencil_two_side #define glActiveStencilFaceEXT _al_glActiveStencilFaceEXT #endif -#if defined _ALLEGRO_GL_APPLE_element_array +#if defined _A5O_GL_APPLE_element_array #define glElementPointerAPPLE _al_glElementPointerAPPLE #define glDrawElementArrayAPPLE _al_glDrawElementArrayAPPLE #define glDrawRangeElementArrayAPPLE _al_glDrawRangeElementArrayAPPLE @@ -1779,7 +1779,7 @@ #define glMultiDrawRangeElementArrayAPPLE _al_glMultiDrawRangeElementArrayAPPLE #endif -#if defined _ALLEGRO_GL_APPLE_fence +#if defined _A5O_GL_APPLE_fence #define glGenFencesAPPLE _al_glGenFencesAPPLE #define glDeleteFencesAPPLE _al_glDeleteFencesAPPLE #define glSetFenceAPPLE _al_glSetFenceAPPLE @@ -1790,24 +1790,24 @@ #define glFinishObjectAPPLE _al_glFinishObjectAPPLE #endif -#if defined _ALLEGRO_GL_APPLE_vertex_array_object +#if defined _A5O_GL_APPLE_vertex_array_object #define glBindVertexArrayAPPLE _al_glBindVertexArrayAPPLE #define glDeleteVertexArraysAPPLE _al_glDeleteVertexArraysAPPLE #define glGenVertexArraysAPPLE _al_glGenVertexArraysAPPLE #define glIsVertexArrayAPPLE _al_glIsVertexArrayAPPLE #endif -#if defined _ALLEGRO_GL_APPLE_vertex_array_range +#if defined _A5O_GL_APPLE_vertex_array_range #define glVertexArrayRangeAPPLE _al_glVertexArrayRangeAPPLE #define glFlushVertexArrayRangeAPPLE _al_glFlushVertexArrayRangeAPPLE #define glVertexArrayParameteriAPPLE _al_glVertexArrayParameteriAPPLE #endif -#if defined _ALLEGRO_GL_ATI_draw_buffers +#if defined _A5O_GL_ATI_draw_buffers #define glDrawBuffersATI _al_glDrawBuffersATI #endif -#if defined _ALLEGRO_GL_NV_fragment_program +#if defined _A5O_GL_NV_fragment_program #define glProgramNamedParameter4fNV _al_glProgramNamedParameter4fNV #define glProgramNamedParameter4dNV _al_glProgramNamedParameter4dNV #define glProgramNamedParameter4fvNV _al_glProgramNamedParameter4fvNV @@ -1816,7 +1816,7 @@ #define glGetProgramNamedParameterdvNV _al_glGetProgramNamedParameterdvNV #endif -#if defined _ALLEGRO_GL_NV_half_float +#if defined _A5O_GL_NV_half_float #define glVertex2hNV _al_glVertex2hNV #define glVertex2hvNV _al_glVertex2hvNV #define glVertex3hNV _al_glVertex3hNV @@ -1865,33 +1865,33 @@ #define glVertexAttribs4hvNV _al_glVertexAttribs4hvNV #endif -#if defined _ALLEGRO_GL_NV_pixel_data_range +#if defined _A5O_GL_NV_pixel_data_range #define glPixelDataRangeNV _al_glPixelDataRangeNV #define glFlushPixelDataRangeNV _al_glFlushPixelDataRangeNV #endif -#if defined _ALLEGRO_GL_NV_primitive_restart +#if defined _A5O_GL_NV_primitive_restart #define glPrimitiveRestartNV _al_glPrimitiveRestartNV #define glPrimitiveRestartIndexNV _al_glPrimitiveRestartIndexNV #endif -#if defined _ALLEGRO_GL_ATI_map_object_buffer +#if defined _A5O_GL_ATI_map_object_buffer #define glMapObjectBufferATI _al_glMapObjectBufferATI #define glUnmapObjectBufferATI _al_glUnmapObjectBufferATI #endif -#if defined _ALLEGRO_GL_ATI_separate_stencil +#if defined _A5O_GL_ATI_separate_stencil #define glStencilOpSeparateATI _al_glStencilOpSeparateATI #define glStencilFuncSeparateATI _al_glStencilFuncSeparateATI #endif -#if defined _ALLEGRO_GL_ATI_vertex_attrib_array_object +#if defined _A5O_GL_ATI_vertex_attrib_array_object #define glVertexAttribArrayObjectATI _al_glVertexAttribArrayObjectATI #define glGetVertexAttribArrayObjectfvATI _al_glGetVertexAttribArrayObjectfvATI #define glGetVertexAttribArrayObjectivATI _al_glGetVertexAttribArrayObjectivATI #endif -#if defined _ALLEGRO_GL_OES_byte_coordinates +#if defined _A5O_GL_OES_byte_coordinates #define glVertex2bOES _al_glVertex2bOES #define glVertex3bOES _al_glVertex3bOES #define glVertex4bOES _al_glVertex4bOES @@ -1916,7 +1916,7 @@ #define glMultiTexCoord4bvOES _al_glMultiTexCoord4bvOES #endif -#if defined _ALLEGRO_GL_OES_fixed_point +#if defined _A5O_GL_OES_fixed_point #define glVertex2xOES _al_glVertex2xOES #define glVertex3xOES _al_glVertex3xOES #define glVertex4xOES _al_glVertex4xOES @@ -2022,7 +2022,7 @@ #define glGetFixedvOES _al_glGetFixedvOES #endif -#if defined _ALLEGRO_GL_OES_single_precision +#if defined _A5O_GL_OES_single_precision #define glDepthRangefOES _al_glDepthRangefOES #define glFrustumfOES _al_glFrustumfOES #define glOrthofOES _al_glOrthofOES @@ -2031,21 +2031,21 @@ #define glClearDepthfOES _al_glClearDepthfOES #endif -#if defined _ALLEGRO_GL_OES_query_matrix +#if defined _A5O_GL_OES_query_matrix #define glQueryMatrixxOES _al_glQueryMatrixxOES #endif -#if defined _ALLEGRO_GL_EXT_depth_bounds_test +#if defined _A5O_GL_EXT_depth_bounds_test #define glDepthBoundsEXT _al_glDepthBoundsEXT #endif -#if defined _ALLEGRO_GL_EXT_blend_equation_separate +#if defined _A5O_GL_EXT_blend_equation_separate #define glBlendEquationSeparateEXT _al_glBlendEquationSeparateEXT #endif -#if defined _ALLEGRO_GL_EXT_framebuffer_object +#if defined _A5O_GL_EXT_framebuffer_object #define glIsRenderbufferEXT _al_glIsRenderbufferEXT #define glBindRenderbufferEXT _al_glBindRenderbufferEXT #define glDeleteRenderbuffersEXT _al_glDeleteRenderbuffersEXT @@ -2065,44 +2065,44 @@ #define glGenerateMipmapEXT _al_glGenerateMipmapEXT #endif -#if defined _ALLEGRO_GL_GREMEDY_string_marker +#if defined _A5O_GL_GREMEDY_string_marker #define glStringMarkerGREMEDY _al_glStringMarkerGREMEDY #endif -#if defined _ALLEGRO_GL_EXT_stencil_clear_tag +#if defined _A5O_GL_EXT_stencil_clear_tag #define glStencilClearTagEXT _al_glStencilClearTagEXT #endif -#if defined _ALLEGRO_GL_EXT_framebuffer_blit +#if defined _A5O_GL_EXT_framebuffer_blit #define glBlitFramebufferEXT _al_glBlitFramebufferEXT #endif -#if defined _ALLEGRO_GL_EXT_framebuffer_multisample +#if defined _A5O_GL_EXT_framebuffer_multisample #define glRenderbufferStorageMultisampleEXT _al_glRenderbufferStorageMultisampleEXT #endif -#if defined _ALLEGRO_GL_EXT_timer_query +#if defined _A5O_GL_EXT_timer_query #define glGetQueryObjecti64vEXT _al_glGetQueryObjecti64vEXT #define glGetQueryObjectui64vEXT _al_glGetQueryObjectui64vEXT #endif -#if defined _ALLEGRO_GL_EXT_gpu_program_parameters +#if defined _A5O_GL_EXT_gpu_program_parameters #define glProgramEnvParameters4fvEXT _al_glProgramEnvParameters4fvEXT #define glProgramLocalParameters4fvEXT _al_glProgramLocalParameters4fvEXT #endif -#if defined _ALLEGRO_GL_APPLE_flush_buffer_range +#if defined _A5O_GL_APPLE_flush_buffer_range #define glBufferParameteriAPPLE _al_glBufferParameteriAPPLE #define glFlushMappedBufferRangeAPPLE _al_glFlushMappedBufferRangeAPPLE #endif -#if defined _ALLEGRO_GL_EXT_bindable_uniform +#if defined _A5O_GL_EXT_bindable_uniform #define glUniformBufferEXT _al_glUniformBufferEXT #define glGetUniformBufferSizeEXT _al_glGetUniformBufferSizeEXT #define glGetUniformOffsetEXT _al_glGetUniformOffsetEXT #endif -#if defined _ALLEGRO_GL_EXT_draw_buffers2 +#if defined _A5O_GL_EXT_draw_buffers2 #define glColorMaskIndexedEXT _al_glColorMaskIndexedEXT #define glGetBooleanIndexedvEXT _al_glGetBooleanIndexedvEXT #define glGetIntegerIndexedvEXT _al_glGetIntegerIndexedvEXT @@ -2111,21 +2111,21 @@ #define glIsEnabledIndexedEXT _al_glIsEnabledIndexedEXT #endif -#if defined _ALLEGRO_GL_EXT_draw_instanced +#if defined _A5O_GL_EXT_draw_instanced #define glDrawArraysInstancedEXT _al_glDrawArraysInstancedEXT #define glDrawElementsInstancedEXT _al_glDrawElementsInstancedEXT #endif -#if defined _ALLEGRO_GL_EXT_geometry_shader4 +#if defined _A5O_GL_EXT_geometry_shader4 #define glProgramParameteriEXT _al_glProgramParameteriEXT #define glFramebufferTextureEXT _al_glFramebufferTextureEXT -#if !defined _ALLEGRO_GL_EXT_texture_array +#if !defined _A5O_GL_EXT_texture_array #define glFramebufferTextureLayerEXT _al_glFramebufferTextureLayerEXT #endif #define glFramebufferTextureFaceEXT _al_glFramebufferTextureFaceEXT #endif -#if defined _ALLEGRO_GL_EXT_gpu_shader4 +#if defined _A5O_GL_EXT_gpu_shader4 #define glVertexAttribI1iEXT _al_glVertexAttribI1iEXT #define glVertexAttribI2iEXT _al_glVertexAttribI2iEXT #define glVertexAttribI3iEXT _al_glVertexAttribI3iEXT @@ -2162,15 +2162,15 @@ #define glGetFragDataLocationEXT _al_glGetFragDataLocationEXT #endif -#if defined _ALLEGRO_GL_EXT_texture_array +#if defined _A5O_GL_EXT_texture_array #define glFramebufferTextureLayerEXT _al_glFramebufferTextureLayerEXT #endif -#if defined _ALLEGRO_GL_EXT_texture_buffer_object +#if defined _A5O_GL_EXT_texture_buffer_object #define glTexBufferEXT _al_glTexBufferEXT #endif -#if defined _ALLEGRO_GL_texture_integer +#if defined _A5O_GL_texture_integer #define glClearColorIiEXT _al_glClearColorIiEXT #define glClearColorIuiEXT _al_glClearColorIuiEXT #define glTexParameterIivEXT _al_glTexParameterIivEXT @@ -2179,27 +2179,27 @@ #define glGetTexParameterIiuvEXT _al_glGetTexParameterIiuvEXT #endif -#if defined _ALLEGRO_GL_NV_depth_buffer_float +#if defined _A5O_GL_NV_depth_buffer_float #define glDepthRangedNV _al_glDepthRangedNV #define glClearDepthdNV _al_glClearDepthdNV #define glDepthBoundsdNV _al_glDepthBoundsdNV #endif -#if defined _ALLEGRO_GL_NV_framebuffer_multisample_coverage +#if defined _A5O_GL_NV_framebuffer_multisample_coverage #define glRenderbufferStorageMultsampleCoverageNV _al_glRenderbufferStorageMultsampleCoverageNV #endif -#if defined _ALLEGRO_GL_NV_geometry_program4 +#if defined _A5O_GL_NV_geometry_program4 #define glProgramVertexLimitNV _al_glProgramVertexLimitNV -#if !defined _ALLEGRO_GL_EXT_geometry_shader4 +#if !defined _A5O_GL_EXT_geometry_shader4 #define glFramebufferTextureEXT _al_glFramebufferTextureEXT -#if !defined _ALLEGRO_GL_EXT_texture_array +#if !defined _A5O_GL_EXT_texture_array #define glFramebufferTextureLayerEXT _al_glFramebufferTextureLayerEXT #endif #endif #endif -#if defined _ALLEGRO_GL_NV_gpu_program4 +#if defined _A5O_GL_NV_gpu_program4 #define glProgramLocalParameterI4iNV _al_glProgramLocalParameterI4iNV #define glProgramLocalParameterI4ivNV _al_glProgramLocalParameterI4ivNV #define glProgramLocalParametersI4ivNV _al_glProgramLocalParametersI4ivNV @@ -2218,8 +2218,8 @@ #define glGetProgramEnvParameterIuivNV _al_glGetProgramEnvParameterIuivNV #endif -#if defined _ALLEGRO_GL_NV_parameter_buffer_object -#if !defined _ALLEGRO_GL_NV_transform_feedback +#if defined _A5O_GL_NV_parameter_buffer_object +#if !defined _A5O_GL_NV_transform_feedback #define glBindBufferRangeNV _al_glBindBufferRangeNV #define glBindBufferOffsetNV _al_glBindBufferOffsetNV #define glBindBufferBaseNV _al_glBindBufferBaseNV @@ -2227,12 +2227,12 @@ #define glProgramBufferParametersfvNV _al_glProgramBufferParametersfvNV #define glProgramBufferParametersIivNV _al_glProgramBufferParametersIivNV #define glProgramBufferParametersIuivNV _al_glProgramBufferParametersIuivNV -#if !defined _ALLEGRO_GL_EXT_draw_buffers2 +#if !defined _A5O_GL_EXT_draw_buffers2 #define glGetIntegerIndexedvEXT _al_glGetIntegerIndexedvEXT #endif #endif -#if defined _ALLEGRO_GL_NV_transform_feedback +#if defined _A5O_GL_NV_transform_feedback #define glBindBufferRangeNV _al_glBindBufferRangeNV #define glBindBufferOffsetNV _al_glBindBufferOffsetNV #define glBindBufferBaseNV _al_glBindBufferBaseNV @@ -2244,14 +2244,14 @@ #define glGetActiveVaryingNV _al_glGetActiveVaryingNV #define glActiveVaryingNV _al_glActiveVaryingNV #define glGetTransformFeedbackVaryingNV _al_glGetTransformFeedbackVaryingNV -#if !defined _ALLEGRO_GL_EXT_draw_buffers2 +#if !defined _A5O_GL_EXT_draw_buffers2 #define glGetBooleanIndexedvEXT _al_glGetBooleanIndexedvEXT /*AGL_API(void,GetIntegerIndexedvEXT,(GLenum,GLuint,GLint*))*/ #endif #endif -#if defined _ALLEGRO_GL_NV_vertex_program4 -#ifndef _ALLEGRO_GL_EXT_gpu_shader4 +#if defined _A5O_GL_NV_vertex_program4 +#ifndef _A5O_GL_EXT_gpu_shader4 #define glVertexAttribI1iEXT _al_glVertexAttribI1iEXT #define glVertexAttribI2iEXT _al_glVertexAttribI2iEXT #define glVertexAttribI3iEXT _al_glVertexAttribI3iEXT @@ -2278,16 +2278,16 @@ #endif #endif -#if defined _ALLEGRO_GL_GREMEDY_frame_terminator +#if defined _A5O_GL_GREMEDY_frame_terminator #define glFrameTerminatorGREMEDY _al_glFrameTerminatorGREMEDY #endif -#if defined _ALLEGRO_GL_NV_conditional_render +#if defined _A5O_GL_NV_conditional_render #define glBeginConditionalRenderNV _al_glBeginConditionalRenderNV #define glEndConditionalRenderNV _al_glEndConditionalRenderNV #endif -#if defined _ALLEGRO_GL_EXT_transform_feedback +#if defined _A5O_GL_EXT_transform_feedback #define glBeginTransformFeedbackEXT _al_glBeginTransformFeedbackEXT #define glEndTransformFeedbackEXT _al_glEndTransformFeedbackEXT #define glBindBufferRangeEXT _al_glBindBufferRangeEXT @@ -2297,7 +2297,7 @@ #define glGetTransformFeedbackVaryingEXT _al_glGetTransformFeedbackVaryingEXT #endif -#if defined _ALLEGRO_GL_EXT_direct_state_access +#if defined _A5O_GL_EXT_direct_state_access #define glClientAttribDefaultEXT _al_glClientAttribDefaultEXT #define glPushClientAttribDefaultEXT _al_glPushClientAttribDefaultEXT #define glMatrixLoadfEXT _al_glMatrixLoadfEXT @@ -2486,13 +2486,13 @@ #define glMultiTexRenderbufferEXT _al_glMultiTexRenderbufferEXT #endif -#if defined _ALLEGRO_GL_NV_explicit_multisample +#if defined _A5O_GL_NV_explicit_multisample #define glGetMultisamplefvNV _al_glGetMultisamplefvNV #define glSampleMaskIndexedNV _al_glSampleMaskIndexedNV #define glTexRenderbufferNV _al_glTexRenderbufferNV #endif -#if defined _ALLEGRO_GL_NV_transform_feedback2 +#if defined _A5O_GL_NV_transform_feedback2 #define glBindTransformFeedbackNV _al_glBindTransformFeedbackNV #define glDeleteTransformFeedbacksNV _al_glDeleteTransformFeedbacksNV #define glGenTransformFeedbacksNV _al_glGenTransformFeedbacksNV @@ -2502,7 +2502,7 @@ #define glDrawTransformFeedbackNV _al_glDrawTransformFeedbackNV #endif -#if defined _ALLEGRO_GL_AMD_performance_monitor +#if defined _A5O_GL_AMD_performance_monitor #define glGetPerfMonitorGroupsAMD _al_glGetPerfMonitorGroupsAMD #define glGetPerfMonitorCountersAMD _al_glGetPerfMonitorCountersAMD #define glGetPerfMonitorGroupStringAMD _al_glGetPerfMonitorGroupStringAMD @@ -2516,28 +2516,28 @@ #define glGetPerfMonitorCounterDataAMD _al_glGetPerfMonitorCounterDataAMD #endif -#if defined _ALLEGRO_GL_AMD_vertex_shader_tesselator +#if defined _A5O_GL_AMD_vertex_shader_tesselator #define glTessellationFactorAMD _al_glTessellationFactorAMD #define glTessellationModeAMD _al_glTessellationModeAMD #endif -#if defined _ALLEGRO_GL_EXT_provoking_vertex +#if defined _A5O_GL_EXT_provoking_vertex #define glProvokingVertexEXT _al_glProvokingVertexEXT #endif -#if defined _ALLEGRO_GL_AMD_draw_buffers_blend +#if defined _A5O_GL_AMD_draw_buffers_blend #define glBlendFuncIndexedAMD _al_glBlendFuncIndexedAMD #define glBlendFuncSeparateIndexedAMD _al_glBlendFuncSeparateIndexedAMD #define glBlendEquationIndexedAMD _al_glBlendEquationIndexedAMD #define glBlendEquationSeparateIndexedAMD _al_glBlendEquationSeparateIndexedAMD #endif -#if defined _ALLEGRO_GL_APPLE_texture_range +#if defined _A5O_GL_APPLE_texture_range #define glTextureRangeAPPLE _al_glTextureRangeAPPLE #define glGetTexParameterPointervAPPLE _al_glGetTexParameterPointervAPPLE #endif -#if defined _ALLEGRO_GL_APPLE_vertex_program_evaluators +#if defined _A5O_GL_APPLE_vertex_program_evaluators #define glEnableVertexAttribAPPLE _al_glEnableVertexAttribAPPLE #define glDisableVertexAttribAPPLE _al_glDisableVertexAttribAPPLE #define glIsVertexAttribEnabledAPPLE _al_glIsVertexAttribEnabledAPPLE @@ -2547,13 +2547,13 @@ #define glMapVertexAttrib2fAPPLE _al_glMapVertexAttrib2fAPPLE #endif -#if defined _ALLEGRO_GL_APPLE_object_purgeable +#if defined _A5O_GL_APPLE_object_purgeable #define glObjectPurgeableAPPLE _al_glObjectPurgeableAPPLE #define glObjectUnpurgeableAPPLE _al_glObjectUnpurgeableAPPLE #define glGetObjectParameterivAPPLE _al_glGetObjectParameterivAPPLE #endif -#if defined _ALLEGRO_GL_NV_video_capture +#if defined _A5O_GL_NV_video_capture #define glBeginVideoCaptureNV _al_glBeginVideoCaptureNV #define glBindVideoCaptureStreamBufferNV _al_glBindVideoCaptureStreamBufferNV #define glBindVideoCaptureStreamTextureNV _al_glBindVideoCaptureStreamTextureNV @@ -2568,13 +2568,13 @@ #define glVideoCaptureStreamParameterdvNV _al_glVideoCaptureStreamParameterdvNV #endif -#if defined _ALLEGRO_GL_EXT_separate_shader_objects +#if defined _A5O_GL_EXT_separate_shader_objects #define glUseShaderProgramEXT _al_glUseShaderProgramEXT #define glActiveProgramEXT _al_glActiveProgramEXT #define glCreateShaderProgramEXT _al_glCreateShaderProgramEXT #endif -#if defined _ALLEGRO_GL_NV_shader_buffer_load +#if defined _A5O_GL_NV_shader_buffer_load #define glMakeBufferResidentNV _al_glMakeBufferResidentNV #define glMakeBufferNonResidentNV _al_glMakeBufferNonResidentNV #define glIsBufferResidentNV _al_glIsBufferResidentNV @@ -2591,7 +2591,7 @@ #define glProgramUniformui64vNV _al_glProgramUniformui64vNV #endif -#if defined _ALLEGRO_GL_NV_vertex_buffer_unified_memory +#if defined _A5O_GL_NV_vertex_buffer_unified_memory #define glBufferAddressRangeNV _al_glBufferAddressRangeNV #define glVertexFormatNV _al_glVertexFormatNV #define glNormalFormatNV _al_glNormalFormatNV @@ -2606,6 +2606,6 @@ #define glGetIntegerui64i_vNV _al_glGetIntegerui64i_vNV #endif -#if defined _ALLEGRO_GL_NV_texture_barrier +#if defined _A5O_GL_NV_texture_barrier #define glTextureBarrierNV _al_glTextureBarrierNV #endif diff --git a/include/allegro5/opengl/GLext/gl_ext_api.h b/include/allegro5/opengl/GLext/gl_ext_api.h index 633f1e41de..e99690aa1f 100644 --- a/include/allegro5/opengl/GLext/gl_ext_api.h +++ b/include/allegro5/opengl/GLext/gl_ext_api.h @@ -1,6 +1,6 @@ /* */ -#ifdef _ALLEGRO_GL_VERSION_1_2 +#ifdef _A5O_GL_VERSION_1_2 AGL_API(void, BlendColor, (GLclampf, GLclampf, GLclampf, GLclampf)) AGL_API(void, BlendEquation, (GLenum)) AGL_API(void, DrawRangeElements, (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *)) @@ -18,7 +18,7 @@ AGL_API(void, TexSubImage3D, (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsiz AGL_API(void, CopyTexSubImage3D, (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei)) #endif -#if defined _ALLEGRO_GL_ARB_imaging +#if defined _A5O_GL_ARB_imaging AGL_API(void, ConvolutionFilter1D, (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *)) AGL_API(void, ConvolutionFilter2D, (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) AGL_API(void, ConvolutionParameterf, (GLenum, GLenum, GLfloat)) @@ -44,7 +44,7 @@ AGL_API(void, ResetHistogram, (GLenum)) AGL_API(void, ResetMinmax, (GLenum)) #endif -#if defined _ALLEGRO_GL_VERSION_1_3 +#if defined _A5O_GL_VERSION_1_3 AGL_API(void, ActiveTexture, (GLenum)) AGL_API(void, ClientActiveTexture, (GLenum)) AGL_API(void, MultiTexCoord1d, (GLenum, GLdouble)) @@ -93,7 +93,7 @@ AGL_API(void, CompressedTexSubImage1D, (GLenum, GLint, GLint, GLsizei, GLenum, G AGL_API(void, GetCompressedTexImage, (GLenum, GLint, GLvoid *)) #endif -#if defined _ALLEGRO_GL_VERSION_1_4 +#if defined _A5O_GL_VERSION_1_4 AGL_API(void, BlendFuncSeparate, (GLenum, GLenum, GLenum, GLenum)) AGL_API(void, FogCoordf, (GLfloat)) AGL_API(void, FogCoordfv, (const GLfloat *)) @@ -142,7 +142,7 @@ AGL_API(void, WindowPos3sv, (const GLshort *)) #endif -#if defined _ALLEGRO_GL_VERSION_1_5 +#if defined _A5O_GL_VERSION_1_5 AGL_API(void, BindBuffer, (GLenum, GLuint)) AGL_API(void, DeleteBuffers, (GLsizei, const GLuint *)) AGL_API(void, GenBuffers, (GLsizei, GLuint *)) @@ -165,7 +165,7 @@ AGL_API(void, GetQueryObjectuiv, (GLuint, GLenum, GLuint *)) #endif -#if defined _ALLEGRO_GL_VERSION_2_0 +#if defined _A5O_GL_VERSION_2_0 AGL_API(void, BlendEquationSeparate, (GLenum, GLenum)) AGL_API(GLuint, CreateProgram, (void)) AGL_API(GLuint, CreateShader, (GLenum)) @@ -268,7 +268,7 @@ AGL_API(void, StencilMaskSeparate, (GLenum, GLuint)) #endif -#if defined _ALLEGRO_GL_VERSION_2_1 +#if defined _A5O_GL_VERSION_2_1 AGL_API(void, UniformMatrix2x3fv, (GLint, GLsizei, GLboolean, const GLfloat *)) AGL_API(void, UniformMatrix3x2fv, (GLint, GLsizei, GLboolean, const GLfloat *)) AGL_API(void, UniformMatrix2x4fv, (GLint, GLsizei, GLboolean, const GLfloat *)) @@ -277,7 +277,7 @@ AGL_API(void, UniformMatrix3x4fv, (GLint, GLsizei, GLboolean, const GLfloat *)) AGL_API(void, UniformMatrix4x3fv, (GLint, GLsizei, GLboolean, const GLfloat *)) #endif -#if defined _ALLEGRO_GL_VERSION_3_0 +#if defined _A5O_GL_VERSION_3_0 /* OpenGL 3.0 also reuses entry points from these extensions: */ /* ARB_framebuffer_object */ /* ARB_map_buffer_range */ @@ -343,7 +343,7 @@ AGL_API(const GLubyte *, GetStringi, (GLenum, GLuint)) #endif -#if defined _ALLEGRO_GL_VERSION_3_1 +#if defined _A5O_GL_VERSION_3_1 /* OpenGL 3.1 also reuses entry points from these extensions: */ /* ARB_copy_buffer */ /* ARB_uniform_buffer_object */ @@ -353,7 +353,7 @@ AGL_API(void, TexBuffer, (GLenum, GLenum, GLuint)) AGL_API(void, PrimitiveRestartIndex, (GLuint)) #endif -#if defined _ALLEGRO_GL_VERSION_3_2 +#if defined _A5O_GL_VERSION_3_2 /* OpenGL 3.2 also reuses entry points from these extensions: */ /* ARB_draw_elements_base_vertex */ /* ARB_provoking_vertex */ @@ -365,7 +365,7 @@ AGL_API(void, ProgramParameteri, (GLuint program, GLenum pname, GLint value)) AGL_API(void, FramebufferTexture, (GLenum target, GLenum attachment, GLuint texture, GLint level)) #endif -#if defined _ALLEGRO_GL_VERSION_3_3 +#if defined _A5O_GL_VERSION_3_3 /* OpenGL 3.3 also reuses entry points from these extensions: */ /* ARB_blend_func_extended */ /* ARB_sampler_objects */ @@ -378,7 +378,7 @@ AGL_API(void, FramebufferTexture, (GLenum target, GLenum attachment, GLuint text /* ARB_vertex_type_2_10_10_10_rev */ #endif -#if defined _ALLEGRO_GL_VERSION_4_3 +#if defined _A5O_GL_VERSION_4_3 AGL_API(void, ClearBufferData, (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data)) AGL_API(void, ClearBufferSubData, (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data)) AGL_API(void, DispatchCompute, (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z)) @@ -428,7 +428,7 @@ AGL_API(void, GetObjectPtrLabel, (const void *ptr, GLsizei bufSize, GLsizei *len /* */ /* */ -#ifdef _ALLEGRO_GL_ARB_multitexture +#ifdef _A5O_GL_ARB_multitexture AGL_API(void, ActiveTextureARB, (GLenum)) AGL_API(void, ClientActiveTextureARB, (GLenum)) AGL_API(void, MultiTexCoord1dARB, (GLenum, GLdouble)) @@ -465,18 +465,18 @@ AGL_API(void, MultiTexCoord4sARB, (GLenum, GLshort, GLshort, GLshort, GLshort)) AGL_API(void, MultiTexCoord4svARB, (GLenum, const GLshort *)) #endif -#if defined _ALLEGRO_GL_ARB_transpose_matrix +#if defined _A5O_GL_ARB_transpose_matrix AGL_API(void, LoadTransposeMatrixfARB, (const GLfloat *)) AGL_API(void, LoadTransposeMatrixdARB, (const GLdouble *)) AGL_API(void, MultTransposeMatrixfARB, (const GLfloat *)) AGL_API(void, MultTransposeMatrixdARB, (const GLdouble *)) #endif -#if defined _ALLEGRO_GL_ARB_multisample +#if defined _A5O_GL_ARB_multisample AGL_API(void, SampleCoverageARB, (GLclampf, GLboolean)) #endif -#if defined _ALLEGRO_GL_ARB_texture_compression +#if defined _A5O_GL_ARB_texture_compression AGL_API(void, CompressedTexImage3DARB, (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)) AGL_API(void, CompressedTexImage2DARB, (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)) AGL_API(void, CompressedTexImage1DARB, (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *)) @@ -486,12 +486,12 @@ AGL_API(void, CompressedTexSubImage1DARB, (GLenum, GLint, GLint, GLsizei, GLenum AGL_API(void, GetCompressedTexImageARB, (GLenum, GLint, GLvoid *)) #endif -#if defined _ALLEGRO_GL_ARB_point_parameters +#if defined _A5O_GL_ARB_point_parameters AGL_API(void, PointParameterfARB, (GLenum, GLfloat)) AGL_API(void, PointParameterfvARB, (GLenum, const GLfloat *)) #endif -#if defined _ALLEGRO_GL_ARB_vertex_blend +#if defined _A5O_GL_ARB_vertex_blend AGL_API(void, WeightbvARB, (GLint, const GLbyte *)) AGL_API(void, WeightsvARB, (GLint, const GLshort *)) AGL_API(void, WeightivARB, (GLint, const GLint *)) @@ -504,7 +504,7 @@ AGL_API(void, WeightPointerARB, (GLint, GLenum, GLsizei, const GLvoid *)) AGL_API(void, VertexBlendARB, (GLint)) #endif -#if defined _ALLEGRO_GL_ARB_matrix_palette +#if defined _A5O_GL_ARB_matrix_palette AGL_API(void, CurrentPaletteMatrixARB, (GLint)) AGL_API(void, MatrixIndexubvARB, (GLint, const GLubyte *)) AGL_API(void, MatrixIndexusvARB, (GLint, const GLushort *)) @@ -512,7 +512,7 @@ AGL_API(void, MatrixIndexuivARB, (GLint, const GLuint *)) AGL_API(void, MatrixIndexPointerARB, (GLint, GLenum, GLsizei, const GLvoid *)) #endif -#if defined _ALLEGRO_GL_ARB_window_pos +#if defined _A5O_GL_ARB_window_pos AGL_API(void, WindowPos2dARB, (GLdouble, GLdouble)) AGL_API(void, WindowPos2dvARB, (const GLdouble *)) AGL_API(void, WindowPos2fARB, (GLfloat, GLfloat)) @@ -531,7 +531,7 @@ AGL_API(void, WindowPos3sARB, (GLshort, GLshort, GLshort)) AGL_API(void, WindowPos3svARB, (const GLshort *)) #endif -#if defined _ALLEGRO_GL_ARB_vertex_program +#if defined _A5O_GL_ARB_vertex_program AGL_API(void, VertexAttrib1dARB, (GLuint, GLdouble)) AGL_API(void, VertexAttrib1dvARB, (GLuint, const GLdouble *)) AGL_API(void, VertexAttrib1fARB, (GLuint, GLfloat)) @@ -596,7 +596,7 @@ AGL_API(void, GetVertexAttribPointervARB, (GLuint, GLenum, GLvoid* *)) AGL_API(GLboolean, IsProgramARB, (GLuint)) #endif -#if defined _ALLEGRO_GL_ARB_vertex_buffer_object +#if defined _A5O_GL_ARB_vertex_buffer_object AGL_API(void, BindBufferARB, (GLenum, GLuint)) AGL_API(void, DeleteBuffersARB, (GLsizei, const GLuint *)) AGL_API(void, GenBuffersARB, (GLsizei, GLuint *)) @@ -610,7 +610,7 @@ AGL_API(void, GetBufferParameterivARB, (GLenum, GLenum, GLint *)) AGL_API(void, GetBufferPointervARB, (GLenum, GLenum, GLvoid* *)) #endif -#if defined _ALLEGRO_GL_ARB_occlusion_query +#if defined _A5O_GL_ARB_occlusion_query AGL_API(void, GenQueriesARB, (GLsizei, GLuint *)) AGL_API(void, DeleteQueriesARB, (GLsizei, const GLuint *)) AGL_API(GLboolean, IsQueryARB, (GLuint)) @@ -621,7 +621,7 @@ AGL_API(void, GetQueryObjectivARB, (GLuint, GLenum, GLint *)) AGL_API(void, GetQueryObjectuivARB, (GLuint, GLenum, GLuint *)) #endif -#if defined _ALLEGRO_GL_ARB_shader_objects +#if defined _A5O_GL_ARB_shader_objects AGL_API(void, DeleteObjectARB, (GLhandleARB)) AGL_API(GLhandleARB, GetHandleARB, (GLenum)) AGL_API(void, DetachObjectARB, (GLhandleARB, GLhandleARB)) @@ -663,7 +663,7 @@ AGL_API(void, GetUniformivARB, (GLhandleARB, GLint, GLint *)) AGL_API(void, GetShaderSourceARB, (GLhandleARB, GLsizei, GLsizei *, GLcharARB *)) #endif -#ifdef _ALLEGRO_GL_ARB_vertex_shader +#ifdef _A5O_GL_ARB_vertex_shader #ifndef GL_ARB_vertex_program AGL_API(void, VertexAttrib1fARB, (GLuint, GLfloat)) AGL_API(void, VertexAttrib1sARB, (GLuint, GLshort)) @@ -716,20 +716,20 @@ AGL_API(void, GetVertexAttribPointervARB, (GLuint, GLenum, GLvoid **)) #endif #endif -#if defined _ALLEGRO_GL_ARB_draw_buffers +#if defined _A5O_GL_ARB_draw_buffers AGL_API(void, DrawBuffersARB, (GLsizei n, const GLenum *bufs)) #endif -#if defined _ALLEGRO_GL_ARB_color_buffer_float +#if defined _A5O_GL_ARB_color_buffer_float AGL_API(void, ClampColorARB, (GLenum, GLenum clamp)) #endif -#if defined _ALLEGRO_GL_ARB_draw_instanced +#if defined _A5O_GL_ARB_draw_instanced AGL_API(void, DrawArraysInstancedARB, (GLenum, GLint, GLsizei, GLsizei)) AGL_API(void, DrawElementsInstancedARB, (GLenum, GLsizei, GLenum, const GLvoid *, GLsizei)) #endif -#if defined _ALLEGRO_GL_ARB_framebuffer_object +#if defined _A5O_GL_ARB_framebuffer_object AGL_API(GLboolean, IsRenderbuffer, (GLuint)) AGL_API(void, BindRenderbuffer, (GLenum, GLuint)) AGL_API(void, DeleteRenderbuffers, (GLsizei, const GLuint *)) @@ -752,34 +752,34 @@ AGL_API(void, RenderbufferStorageMultisample, (GLenum, GLsizei, GLenum, GLsizei, AGL_API(void, FramebufferTextureLayer, (GLenum, GLenum, GLuint, GLint, GLint)) #endif -#if defined _ALLEGRO_GL_ARB_geometry_shader4 +#if defined _A5O_GL_ARB_geometry_shader4 AGL_API(void, ProgramParameteriARB, (GLuint, GLenum, GLint)) AGL_API(void, FramebufferTextureARB, (GLenum, GLenum, GLuint, GLint)) AGL_API(void, FramebufferTextureLayerARB, (GLenum, GLenum, GLuint, GLint, GLint)) AGL_API(void, FramebufferTextureFaceARB, (GLenum, GLenum, GLuint, GLint, GLenum)) #endif -#if defined _ALLEGRO_GL_ARB_instanced_arrays +#if defined _A5O_GL_ARB_instanced_arrays AGL_API(void, VertexAttribDivisor, (GLuint, GLuint)) #endif -#if defined _ALLEGRO_GL_ARB_map_buffer_range +#if defined _A5O_GL_ARB_map_buffer_range AGL_API(void, MapBufferRange, (GLenum, GLintptr, GLsizeiptr, GLbitfield)) AGL_API(void, FlushMappedBufferRange, (GLenum, GLintptr, GLsizeiptr)) #endif -#if defined _ALLEGRO_GL_ARB_texture_buffer_object +#if defined _A5O_GL_ARB_texture_buffer_object AGL_API(void, TexBufferARB, (GLenum, GLenum, GLuint)) #endif -#if defined _ALLEGRO_GL_ARB_vertex_array_object +#if defined _A5O_GL_ARB_vertex_array_object AGL_API(void, BindVertexArray, (GLuint)) AGL_API(void, DeleteVertexArrays, (GLsizei, const GLuint *)) AGL_API(void, GenVertexArrays, (GLsizei, GLuint *)) AGL_API(GLboolean, IsVertexArray, (GLuint)) #endif -#if defined _ALLEGRO_GL_ARB_uniform_buffer_object +#if defined _A5O_GL_ARB_uniform_buffer_object AGL_API(void, GetUniformIndices, (GLuint, GLsizei, const GLchar* *, GLuint *)) AGL_API(void, GetActiveUniformsiv, (GLuint, GLsizei, const GLuint *, GLenum, GLint *)) AGL_API(void, GetActiveUniformName, (GLuint, GLuint, GLsizei, GLsizei *, GLchar *)) @@ -789,23 +789,23 @@ AGL_API(void, GetActiveUniformBlockName, (GLuint, GLuint, GLsizei, GLsizei *, GL AGL_API(void, UniformBlockBinding, (GLuint, GLuint, GLuint)) #endif -#if defined _ALLEGRO_GL_ARB_copy_buffer +#if defined _A5O_GL_ARB_copy_buffer AGL_API(void, CopyBufferSubData, (GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr)) #endif -#if defined _ALLEGRO_GL_ARB_draw_elements_base_vertex +#if defined _A5O_GL_ARB_draw_elements_base_vertex AGL_API(void, DrawElementsBaseVertex, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)) AGL_API(void, DrawRangeElementsBaseVertex, (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex)) AGL_API(void, DrawElementsInstancedBaseVertex, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount, GLint basevertex)) AGL_API(void, MultiDrawElementsBaseVertex, (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount, const GLint *basevertex)) #endif -#if defined _ALLEGRO_GL_ARB_provoking_vertex +#if defined _A5O_GL_ARB_provoking_vertex AGL_API(void, ProvokingVertex, (GLenum mode)) #endif -#if defined _ALLEGRO_GL_ARB_sync +#if defined _A5O_GL_ARB_sync AGL_API(GLsync, FenceSync, (GLenum condition, GLbitfield flags)) AGL_API(GLboolean, IsSync, (GLsync sync)) AGL_API(void, DeleteSync, (GLsync sync)) @@ -815,25 +815,25 @@ AGL_API(void, GetInteger64v, (GLenum pname, GLint64 *params)) AGL_API(void, GetSynciv, (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)) #endif -#if defined _ALLEGRO_GL_ARB_texture_multisample +#if defined _A5O_GL_ARB_texture_multisample AGL_API(void, TexImage2DMultisample, (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations)) AGL_API(void, TexImage3DMultisample, (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations)) AGL_API(void, GetMultisamplefv, (GLenum pname, GLuint index, GLfloat *val)) AGL_API(void, SampleMaski, (GLuint index, GLbitfield mask)) #endif -#if defined _ALLEGRO_GL_ARB_draw_buffers_blend +#if defined _A5O_GL_ARB_draw_buffers_blend AGL_API(void, BlendEquationi, (GLuint buf, GLenum mode)) AGL_API(void, BlendEquationSeparatei, (GLuint buf, GLenum modeRGB, GLenum modeAlpha)) AGL_API(void, BlendFunci, (GLuint buf, GLenum src, GLenum dst)) AGL_API(void, BlendFuncSeparatei, (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)) #endif -#if defined _ALLEGRO_GL_ARB_sample_shading +#if defined _A5O_GL_ARB_sample_shading AGL_API(void, MinSampleShading, (GLclampf value)) #endif -#if defined _ALLEGRO_GL_ARB_shading_language_include +#if defined _A5O_GL_ARB_shading_language_include AGL_API(void, NamedStringARB, (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string)) AGL_API(void, DeleteNamedStringARB, (GLint namelen, const GLchar *name)) AGL_API(void, CompileShaderIncludeARB, (GLuint shader, GLsizei count, const GLchar* *path, const GLint *length)) @@ -842,12 +842,12 @@ AGL_API(void, GetNamedStringARB, (GLint namelen, const GLchar *name, GLsizei buf AGL_API(void, GetNamedStringivARB, (GLint namelen, const GLchar *name, GLenum pname, GLint *params)) #endif -#if defined _ALLEGRO_GL_ARB_blend_func_extended +#if defined _A5O_GL_ARB_blend_func_extended AGL_API(void, BindFragDataLocationIndexed, (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name)) AGL_API(GLint, GetFragDataIndex, (GLuint program, const GLchar *name)) #endif -#if defined _ALLEGRO_GL_ARB_sampler_objects +#if defined _A5O_GL_ARB_sampler_objects AGL_API(void, GenSamplers, (GLsizei count, GLuint *samplers)) AGL_API(void, DeleteSamplers, (GLsizei count, const GLuint *samplers)) AGL_API(GLboolean, IsSampler, (GLuint sampler)) @@ -864,13 +864,13 @@ AGL_API(void, GetSamplerParameterfv, (GLuint sampler, GLenum pname, GLfloat *par AGL_API(void, GetSamplerParameterIfv, (GLuint sampler, GLenum pname, GLfloat *params)) #endif -#if defined _ALLEGRO_GL_ARB_timer_query +#if defined _A5O_GL_ARB_timer_query AGL_API(void, QueryCounter, (GLuint id, GLenum target)) AGL_API(void, GetQueryObjecti64v, (GLuint id, GLenum pname, GLint64 *params)) AGL_API(void, GetQueryObjectui64v, (GLuint id, GLenum pname, GLuint64 *params)) #endif -#if defined _ALLEGRO_GL_ARB_vertex_type_2_10_10_10_rev +#if defined _A5O_GL_ARB_vertex_type_2_10_10_10_rev AGL_API(void, VertexP2ui, (GLenum type, GLuint value)) AGL_API(void, VertexP2uiv, (GLenum type, const GLuint *value)) AGL_API(void, VertexP3ui, (GLenum type, GLuint value)) @@ -911,12 +911,12 @@ AGL_API(void, VertexAttribP4ui, (GLuint index, GLenum type, GLboolean normalized AGL_API(void, VertexAttribP4uiv, (GLuint index, GLenum type, GLboolean normalized, const GLuint *value)) #endif -#if defined _ALLEGRO_GL_ARB_draw_indirect +#if defined _A5O_GL_ARB_draw_indirect AGL_API(void, DrawArraysIndirect, (GLenum mode, const GLvoid *indirect)) AGL_API(void, DrawElementsIndirect, (GLenum mode, GLenum type, const GLvoid *indirect)) #endif -#if defined _ALLEGRO_GL_ARB_gpu_shader_fp64 +#if defined _A5O_GL_ARB_gpu_shader_fp64 AGL_API(void, Uniform1d, (GLint location, GLdouble x)) AGL_API(void, Uniform2d, (GLint location, GLdouble x, GLdouble y)) AGL_API(void, Uniform3d, (GLint location, GLdouble x, GLdouble y, GLdouble z)) @@ -954,7 +954,7 @@ AGL_API(void, ProgramUniformMatrix4x2dvEXT, (GLuint program, GLint location, GLs AGL_API(void, ProgramUniformMatrix4x3dvEXT, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value)) #endif -#if defined _ALLEGRO_GL_ARB_shader_subroutine +#if defined _A5O_GL_ARB_shader_subroutine AGL_API(GLint, GetSubroutineUniformLocation, (GLuint program, GLenum shadertype, const GLchar *name)) AGL_API(GLuint, GetSubroutineIndex, (GLuint program, GLenum shadertype, const GLchar *name)) AGL_API(void, GetActiveSubroutineUniformiv, (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values)) @@ -965,12 +965,12 @@ AGL_API(void, GetUniformSubroutineuiv, (GLenum shadertype, GLint location, GLuin AGL_API(void, GetProgramStageiv, (GLuint program, GLenum shadertype, GLenum pname, GLint *values)) #endif -#if defined _ALLEGRO_GL_ARB_tessellation_shader +#if defined _A5O_GL_ARB_tessellation_shader AGL_API(void, PatchParameteri, (GLenum pname, GLint value)) AGL_API(void, PatchParameterfv, (GLenum pname, const GLfloat *values)) #endif -#if defined _ALLEGRO_GL_ARB_transform_feedback2 +#if defined _A5O_GL_ARB_transform_feedback2 AGL_API(void, BindTransformFeedback, (GLenum target, GLuint id)) AGL_API(void, DeleteTransformFeedbacks, (GLsizei n, const GLuint *ids)) AGL_API(void, GenTransformFeedbacks, (GLsizei n, GLuint *ids)) @@ -980,7 +980,7 @@ AGL_API(void, ResumeTransformFeedback, (void)) AGL_API(void, DrawTransformFeedback, (GLenum mode, GLuint id)) #endif -#if defined _ALLEGRO_GL_ARB_transform_feedback3 +#if defined _A5O_GL_ARB_transform_feedback3 AGL_API(void, DrawTransformFeedbackStream, (GLenum mode, GLuint id, GLuint stream)) AGL_API(void, BeginQueryIndexed, (GLenum target, GLuint index, GLuint id)) AGL_API(void, EndQueryIndexed, (GLenum target, GLuint index)) @@ -991,30 +991,30 @@ AGL_API(void, GetQueryIndexediv, (GLenum target, GLuint index, GLenum pname, GLi /* */ -#if defined _ALLEGRO_GL_EXT_blend_color +#if defined _A5O_GL_EXT_blend_color AGL_API(void, BlendColorEXT, (GLclampf, GLclampf, GLclampf, GLclampf)) #endif -#if defined _ALLEGRO_GL_EXT_polygon_offset +#if defined _A5O_GL_EXT_polygon_offset AGL_API(void, PolygonOffsetEXT, (GLfloat, GLfloat)) #endif -#if defined _ALLEGRO_GL_EXT_texture3D +#if defined _A5O_GL_EXT_texture3D AGL_API(void, TexImage3DEXT, (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *)) AGL_API(void, TexSubImage3DEXT, (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) #endif -#if defined _ALLEGRO_GL_SGIS_texture_filter4 +#if defined _A5O_GL_SGIS_texture_filter4 AGL_API(void, GetTexFilterFuncSGIS, (GLenum, GLenum, GLfloat *)) AGL_API(void, TexFilterFuncSGIS, (GLenum, GLenum, GLsizei, const GLfloat *)) #endif -#if defined _ALLEGRO_GL_EXT_subtexture +#if defined _A5O_GL_EXT_subtexture AGL_API(void, TexSubImage1DEXT, (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *)) AGL_API(void, TexSubImage2DEXT, (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) #endif -#if defined _ALLEGRO_GL_EXT_copy_texture +#if defined _A5O_GL_EXT_copy_texture AGL_API(void, CopyTexImage1DEXT, (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint)) AGL_API(void, CopyTexImage2DEXT, (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint)) AGL_API(void, CopyTexSubImage1DEXT, (GLenum, GLint, GLint, GLint, GLint, GLsizei)) @@ -1022,7 +1022,7 @@ AGL_API(void, CopyTexSubImage2DEXT, (GLenum, GLint, GLint, GLint, GLint, GLint, AGL_API(void, CopyTexSubImage3DEXT, (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei)) #endif -#if defined _ALLEGRO_GL_EXT_histogram +#if defined _A5O_GL_EXT_histogram AGL_API(void, GetHistogramEXT, (GLenum, GLboolean, GLenum, GLenum, GLvoid *)) AGL_API(void, GetHistogramParameterfvEXT, (GLenum, GLenum, GLfloat *)) AGL_API(void, GetHistogramParameterivEXT, (GLenum, GLenum, GLint *)) @@ -1035,7 +1035,7 @@ AGL_API(void, ResetHistogramEXT, (GLenum)) AGL_API(void, ResetMinmaxEXT, (GLenum)) #endif -#if defined _ALLEGRO_GL_EXT_convolution +#if defined _A5O_GL_EXT_convolution AGL_API(void, ConvolutionFilter1DEXT, (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *)) AGL_API(void, ConvolutionFilter2DEXT, (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) AGL_API(void, ConvolutionParameterfEXT, (GLenum, GLenum, GLfloat)) @@ -1051,7 +1051,7 @@ AGL_API(void, GetSeparableFilterEXT, (GLenum, GLenum, GLenum, GLvoid *, GLvoid * AGL_API(void, SeparableFilter2DEXT, (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *)) #endif -#if defined _ALLEGRO_GL_SGI_color_table +#if defined _A5O_GL_SGI_color_table AGL_API(void, ColorTableSGI, (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *)) AGL_API(void, ColorTableParameterfvSGI, (GLenum, GLenum, const GLfloat *)) AGL_API(void, ColorTableParameterivSGI, (GLenum, GLenum, const GLint *)) @@ -1061,11 +1061,11 @@ AGL_API(void, GetColorTableParameterfvSGI, (GLenum, GLenum, GLfloat *)) AGL_API(void, GetColorTableParameterivSGI, (GLenum, GLenum, GLint *)) #endif -#if defined _ALLEGRO_GL_SGIX_pixel_texture +#if defined _A5O_GL_SGIX_pixel_texture AGL_API(void, PixelTexGenSGIX, (GLenum)) #endif -#if defined _ALLEGRO_GL_SGIS_pixel_texture +#if defined _A5O_GL_SGIS_pixel_texture AGL_API(void, PixelTexGenParameteriSGIS, (GLenum, GLint)) AGL_API(void, PixelTexGenParameterivSGIS, (GLenum, const GLint *)) AGL_API(void, PixelTexGenParameterfSGIS, (GLenum, GLfloat)) @@ -1074,12 +1074,12 @@ AGL_API(void, GetPixelTexGenParameterivSGIS, (GLenum, GLint *)) AGL_API(void, GetPixelTexGenParameterfvSGIS, (GLenum, GLfloat *)) #endif -#if defined _ALLEGRO_GL_SGIS_texture4D +#if defined _A5O_GL_SGIS_texture4D AGL_API(void, TexImage4DSGIS, (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *)) AGL_API(void, TexSubImage4DSGIS, (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) #endif -#if defined _ALLEGRO_GL_EXT_texture_object +#if defined _A5O_GL_EXT_texture_object AGL_API(GLboolean, AreTexturesResidentEXT, (GLsizei, const GLuint *, GLboolean *)) AGL_API(void, BindTextureEXT, (GLenum, GLuint)) AGL_API(void, DeleteTexturesEXT, (GLsizei, const GLuint *)) @@ -1088,22 +1088,22 @@ AGL_API(GLboolean, IsTextureEXT, (GLuint)) AGL_API(void, PrioritizeTexturesEXT, (GLsizei, const GLuint *, const GLclampf *)) #endif -#if defined _ALLEGRO_GL_SGIS_detail_texture +#if defined _A5O_GL_SGIS_detail_texture AGL_API(void, DetailTexFuncSGIS, (GLenum, GLsizei, const GLfloat *)) AGL_API(void, GetDetailTexFuncSGIS, (GLenum, GLfloat *)) #endif -#if defined _ALLEGRO_GL_SGIS_sharpen_texture +#if defined _A5O_GL_SGIS_sharpen_texture AGL_API(void, SharpenTexFuncSGIS, (GLenum, GLsizei, const GLfloat *)) AGL_API(void, GetSharpenTexFuncSGIS, (GLenum, GLfloat *)) #endif -#if defined _ALLEGRO_GL_SGIS_multisample +#if defined _A5O_GL_SGIS_multisample AGL_API(void, SampleMaskSGIS, (GLclampf, GLboolean)) AGL_API(void, SamplePatternSGIS, (GLenum)) #endif -#if defined _ALLEGRO_GL_EXT_vertex_array +#if defined _A5O_GL_EXT_vertex_array AGL_API(void, ArrayElementEXT, (GLint)) AGL_API(void, ColorPointerEXT, (GLint, GLenum, GLsizei, GLsizei, const GLvoid *)) AGL_API(void, DrawArraysEXT, (GLenum, GLint, GLsizei)) @@ -1115,28 +1115,28 @@ AGL_API(void, TexCoordPointerEXT, (GLint, GLenum, GLsizei, GLsizei, const GLvoid AGL_API(void, VertexPointerEXT, (GLint, GLenum, GLsizei, GLsizei, const GLvoid *)) #endif -#if defined _ALLEGRO_GL_EXT_blend_minmax +#if defined _A5O_GL_EXT_blend_minmax AGL_API(void, BlendEquationEXT, (GLenum)) #endif -#if defined _ALLEGRO_GL_SGIX_sprite +#if defined _A5O_GL_SGIX_sprite AGL_API(void, SpriteParameterfSGIX, (GLenum, GLfloat)) AGL_API(void, SpriteParameterfvSGIX, (GLenum, const GLfloat *)) AGL_API(void, SpriteParameteriSGIX, (GLenum, GLint)) AGL_API(void, SpriteParameterivSGIX, (GLenum, const GLint *)) #endif -#if defined _ALLEGRO_GL_EXT_point_parameters +#if defined _A5O_GL_EXT_point_parameters AGL_API(void, PointParameterfEXT, (GLenum, GLfloat)) AGL_API(void, PointParameterfvEXT, (GLenum, const GLfloat *)) #endif -#if defined _ALLEGRO_GL_SGIS_point_parameters +#if defined _A5O_GL_SGIS_point_parameters AGL_API(void, PointParameterfSGIS, (GLenum, GLfloat)) AGL_API(void, PointParameterfvSGIS, (GLenum, const GLfloat *)) #endif -#if defined _ALLEGRO_GL_SGIX_instruments +#if defined _A5O_GL_SGIX_instruments AGL_API(GLint, GetInstrumentsSGIX, (void)) AGL_API(void, InstrumentsBufferSGIX, (GLsizei, GLint *)) AGL_API(GLint, PollInstrumentsSGIX, (GLint *)) @@ -1145,35 +1145,35 @@ AGL_API(void, StartInstrumentsSGIX, (void)) AGL_API(void, StopInstrumentsSGIX, (GLint)) #endif -#if defined _ALLEGRO_GL_SGIX_framezoom +#if defined _A5O_GL_SGIX_framezoom AGL_API(void, FrameZoomSGIX, (GLint)) #endif -#if defined _ALLEGRO_GL_SGIX_tag_sample_buffer +#if defined _A5O_GL_SGIX_tag_sample_buffer AGL_API(void, TagSampleBufferSGIX, (void)) #endif -#if defined _ALLEGRO_GL_SGIX_polynomial_ffd +#if defined _A5O_GL_SGIX_polynomial_ffd AGL_API(void, DeformationMap3dSGIX, (GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *)) AGL_API(void, DeformationMap3fSGIX, (GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *)) AGL_API(void, DeformSGIX, (GLbitfield)) AGL_API(void, LoadIdentityDeformationMapSGIX, (GLbitfield)) #endif -#if defined _ALLEGRO_GL_SGIX_reference_plane +#if defined _A5O_GL_SGIX_reference_plane AGL_API(void, ReferencePlaneSGIX, (const GLdouble *)) #endif -#if defined _ALLEGRO_GL_SGIX_flush_raster +#if defined _A5O_GL_SGIX_flush_raster AGL_API(void, FlushRasterSGIX, (void)) #endif -#if defined _ALLEGRO_GL_SGIS_fog_function +#if defined _A5O_GL_SGIS_fog_function AGL_API(void, FogFuncSGIS, (GLsizei, const GLfloat *)) AGL_API(void, GetFogFuncSGIS, (GLfloat *)) #endif -#if defined _ALLEGRO_GL_HP_image_transform +#if defined _A5O_GL_HP_image_transform AGL_API(void, ImageTransformParameteriHP, (GLenum, GLenum, GLint)) AGL_API(void, ImageTransformParameterfHP, (GLenum, GLenum, GLfloat)) AGL_API(void, ImageTransformParameterivHP, (GLenum, GLenum, const GLint *)) @@ -1182,25 +1182,25 @@ AGL_API(void, GetImageTransformParameterivHP, (GLenum, GLenum, GLint *)) AGL_API(void, GetImageTransformParameterfvHP, (GLenum, GLenum, GLfloat *)) #endif -#if defined _ALLEGRO_GL_EXT_color_subtable +#if defined _A5O_GL_EXT_color_subtable #ifndef GL_EXT_paletted_texture AGL_API(void, ColorSubTableEXT, (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) #endif AGL_API(void, CopyColorSubTableEXT, (GLenum, GLsizei, GLint, GLint, GLsizei)) #endif -#if defined _ALLEGRO_GL_PGI_misc_hints +#if defined _A5O_GL_PGI_misc_hints AGL_API(void, HintPGI, (GLenum, GLint)) #endif -#if defined _ALLEGRO_GL_EXT_paletted_texture +#if defined _A5O_GL_EXT_paletted_texture AGL_API(void, ColorTableEXT, (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *)) AGL_API(void, GetColorTableEXT, (GLenum, GLenum, GLenum, GLvoid *)) AGL_API(void, GetColorTableParameterivEXT, (GLenum, GLenum, GLint *)) AGL_API(void, GetColorTableParameterfvEXT, (GLenum, GLenum, GLfloat *)) #endif -#if defined _ALLEGRO_GL_SGIX_list_priority +#if defined _A5O_GL_SGIX_list_priority AGL_API(void, GetListParameterfvSGIX, (GLuint, GLenum, GLfloat *)) AGL_API(void, GetListParameterivSGIX, (GLuint, GLenum, GLint *)) AGL_API(void, ListParameterfSGIX, (GLuint, GLenum, GLfloat)) @@ -1209,25 +1209,25 @@ AGL_API(void, ListParameteriSGIX, (GLuint, GLenum, GLint)) AGL_API(void, ListParameterivSGIX, (GLuint, GLenum, const GLint *)) #endif -#if defined _ALLEGRO_GL_EXT_index_material +#if defined _A5O_GL_EXT_index_material AGL_API(void, IndexMaterialEXT, (GLenum, GLenum)) #endif -#if defined _ALLEGRO_GL_EXT_index_func +#if defined _A5O_GL_EXT_index_func AGL_API(void, IndexFuncEXT, (GLenum, GLclampf)) #endif -#if defined _ALLEGRO_GL_EXT_compiled_vertex_array +#if defined _A5O_GL_EXT_compiled_vertex_array AGL_API(void, LockArraysEXT, (GLint, GLsizei)) AGL_API(void, UnlockArraysEXT, (void)) #endif -#if defined _ALLEGRO_GL_EXT_cull_vertex +#if defined _A5O_GL_EXT_cull_vertex AGL_API(void, CullParameterdvEXT, (GLenum, GLdouble *)) AGL_API(void, CullParameterfvEXT, (GLenum, GLfloat *)) #endif -#if defined _ALLEGRO_GL_SGIX_fragment_lighting +#if defined _A5O_GL_SGIX_fragment_lighting AGL_API(void, FragmentColorMaterialSGIX, (GLenum, GLenum)) AGL_API(void, FragmentLightfSGIX, (GLenum, GLenum, GLfloat)) AGL_API(void, FragmentLightfvSGIX, (GLenum, GLenum, const GLfloat *)) @@ -1248,17 +1248,17 @@ AGL_API(void, GetFragmentMaterialivSGIX, (GLenum, GLenum, GLint *)) AGL_API(void, LightEnviSGIX, (GLenum, GLint)) #endif -#if defined _ALLEGRO_GL_EXT_draw_range_elements +#if defined _A5O_GL_EXT_draw_range_elements AGL_API(void, DrawRangeElementsEXT, (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *)) #endif -#if defined _ALLEGRO_GL_EXT_light_texture +#if defined _A5O_GL_EXT_light_texture AGL_API(void, ApplyTextureEXT, (GLenum)) AGL_API(void, TextureLightEXT, (GLenum)) AGL_API(void, TextureMaterialEXT, (GLenum, GLenum)) #endif -#if defined _ALLEGRO_GL_SGIX_async +#if defined _A5O_GL_SGIX_async AGL_API(void, AsyncMarkerSGIX, (GLuint)) AGL_API(GLint, FinishAsyncSGIX, (GLuint *)) AGL_API(GLint, PollAsyncSGIX, (GLuint *)) @@ -1267,21 +1267,21 @@ AGL_API(void, DeleteAsyncMarkersSGIX, (GLuint, GLsizei)) AGL_API(GLboolean, IsAsyncMarkerSGIX, (GLuint)) #endif -#if defined _ALLEGRO_GL_INTEL_parallel_arrays +#if defined _A5O_GL_INTEL_parallel_arrays AGL_API(void, VertexPointervINTEL, (GLint, GLenum, const GLvoid* *)) AGL_API(void, NormalPointervINTEL, (GLenum, const GLvoid* *)) AGL_API(void, ColorPointervINTEL, (GLint, GLenum, const GLvoid* *)) AGL_API(void, TexCoordPointervINTEL, (GLint, GLenum, const GLvoid* *)) #endif -#if defined _ALLEGRO_GL_EXT_pixel_transform +#if defined _A5O_GL_EXT_pixel_transform AGL_API(void, PixelTransformParameteriEXT, (GLenum, GLenum, GLint)) AGL_API(void, PixelTransformParameterfEXT, (GLenum, GLenum, GLfloat)) AGL_API(void, PixelTransformParameterivEXT, (GLenum, GLenum, const GLint *)) AGL_API(void, PixelTransformParameterfvEXT, (GLenum, GLenum, const GLfloat *)) #endif -#if defined _ALLEGRO_GL_EXT_secondary_color +#if defined _A5O_GL_EXT_secondary_color AGL_API(void, SecondaryColor3bEXT, (GLbyte, GLbyte, GLbyte)) AGL_API(void, SecondaryColor3bvEXT, (const GLbyte *)) AGL_API(void, SecondaryColor3dEXT, (GLdouble, GLdouble, GLdouble)) @@ -1301,16 +1301,16 @@ AGL_API(void, SecondaryColor3usvEXT, (const GLushort *)) AGL_API(void, SecondaryColorPointerEXT, (GLint, GLenum, GLsizei, const GLvoid *)) #endif -#if defined _ALLEGRO_GL_EXT_texture_perturb_normal +#if defined _A5O_GL_EXT_texture_perturb_normal AGL_API(void, TextureNormalEXT, (GLenum)) #endif -#if defined _ALLEGRO_GL_EXT_multi_draw_arrays +#if defined _A5O_GL_EXT_multi_draw_arrays AGL_API(void, MultiDrawArraysEXT, (GLenum, GLint *, GLsizei *, GLsizei)) AGL_API(void, MultiDrawElementsEXT, (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei)) #endif -#if defined _ALLEGRO_GL_EXT_fog_coord +#if defined _A5O_GL_EXT_fog_coord AGL_API(void, FogCoordfEXT, (GLfloat)) AGL_API(void, FogCoordfvEXT, (const GLfloat *)) AGL_API(void, FogCoorddEXT, (GLdouble)) @@ -1318,7 +1318,7 @@ AGL_API(void, FogCoorddvEXT, (const GLdouble *)) AGL_API(void, FogCoordPointerEXT, (GLenum, GLsizei, const GLvoid *)) #endif -#if defined _ALLEGRO_GL_EXT_coordinate_frame +#if defined _A5O_GL_EXT_coordinate_frame AGL_API(void, Tangent3bEXT, (GLbyte, GLbyte, GLbyte)) AGL_API(void, Tangent3bvEXT, (const GLbyte *)) AGL_API(void, Tangent3dEXT, (GLdouble, GLdouble, GLdouble)) @@ -1343,11 +1343,11 @@ AGL_API(void, TangentPointerEXT, (GLenum, GLsizei, const GLvoid *)) AGL_API(void, BinormalPointerEXT, (GLenum, GLsizei, const GLvoid *)) #endif -#if defined _ALLEGRO_GL_SUNX_constant_data +#if defined _A5O_GL_SUNX_constant_data AGL_API(void, FinishTextureSUNX, (void)) #endif -#if defined _ALLEGRO_GL_SUN_global_alpha +#if defined _A5O_GL_SUN_global_alpha AGL_API(void, GlobalAlphaFactorbSUN, (GLbyte)) AGL_API(void, GlobalAlphaFactorsSUN, (GLshort)) AGL_API(void, GlobalAlphaFactoriSUN, (GLint)) @@ -1358,7 +1358,7 @@ AGL_API(void, GlobalAlphaFactorusSUN, (GLushort)) AGL_API(void, GlobalAlphaFactoruiSUN, (GLuint)) #endif -#if defined _ALLEGRO_GL_SUN_triangle_list +#if defined _A5O_GL_SUN_triangle_list AGL_API(void, ReplacementCodeuiSUN, (GLuint)) AGL_API(void, ReplacementCodeusSUN, (GLushort)) AGL_API(void, ReplacementCodeubSUN, (GLubyte)) @@ -1368,7 +1368,7 @@ AGL_API(void, ReplacementCodeubvSUN, (const GLubyte *)) AGL_API(void, ReplacementCodePointerSUN, (GLenum, GLsizei, const GLvoid* *)) #endif -#if defined _ALLEGRO_GL_SUN_vertex +#if defined _A5O_GL_SUN_vertex AGL_API(void, Color4ubVertex2fSUN, (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat)) AGL_API(void, Color4ubVertex2fvSUN, (const GLubyte *, const GLfloat *)) AGL_API(void, Color4ubVertex3fSUN, (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat)) @@ -1411,26 +1411,26 @@ AGL_API(void, ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN, (GLuint, GL AGL_API(void, ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN, (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *)) #endif -#if defined _ALLEGRO_GL_EXT_blend_func_separate +#if defined _A5O_GL_EXT_blend_func_separate AGL_API(void, BlendFuncSeparateEXT, (GLenum, GLenum, GLenum, GLenum)) #endif -#if defined _ALLEGRO_GL_INGR_blend_func_separate +#if defined _A5O_GL_INGR_blend_func_separate AGL_API(void, BlendFuncSeparateINGR, (GLenum, GLenum, GLenum, GLenum)) #endif -#if defined _ALLEGRO_GL_EXT_vertex_weighting +#if defined _A5O_GL_EXT_vertex_weighting AGL_API(void, VertexWeightfEXT, (GLfloat)) AGL_API(void, VertexWeightfvEXT, (const GLfloat *)) AGL_API(void, VertexWeightPointerEXT, (GLsizei, GLenum, GLsizei, const GLvoid *)) #endif -#if defined _ALLEGRO_GL_NV_vertex_array_range +#if defined _A5O_GL_NV_vertex_array_range AGL_API(void, FlushVertexArrayRangeNV, (void)) AGL_API(void, VertexArrayRangeNV, (GLsizei, const GLvoid *)) #endif -#if defined _ALLEGRO_GL_NV_register_combiners +#if defined _A5O_GL_NV_register_combiners AGL_API(void, CombinerParameterfvNV, (GLenum, const GLfloat *)) AGL_API(void, CombinerParameterfNV, (GLenum, GLfloat)) AGL_API(void, CombinerParameterivNV, (GLenum, const GLint *)) @@ -1446,11 +1446,11 @@ AGL_API(void, GetFinalCombinerInputParameterfvNV, (GLenum, GLenum, GLfloat *)) AGL_API(void, GetFinalCombinerInputParameterivNV, (GLenum, GLenum, GLint *)) #endif -#if defined _ALLEGRO_GL_MESA_resize_buffers +#if defined _A5O_GL_MESA_resize_buffers AGL_API(void, ResizeBuffersMESA, (void)) #endif -#if defined _ALLEGRO_GL_MESA_window_pos +#if defined _A5O_GL_MESA_window_pos AGL_API(void, WindowPos2dMESA, (GLdouble, GLdouble)) AGL_API(void, WindowPos2dvMESA, (const GLdouble *)) AGL_API(void, WindowPos2fMESA, (GLfloat, GLfloat)) @@ -1477,7 +1477,7 @@ AGL_API(void, WindowPos4sMESA, (GLshort, GLshort, GLshort, GLshort)) AGL_API(void, WindowPos4svMESA, (const GLshort *)) #endif -#if defined _ALLEGRO_GL_IBM_multimode_draw_arrays +#if defined _A5O_GL_IBM_multimode_draw_arrays AGL_API(void, MultiModeDrawArraysIBM, (GLenum, const GLint *, const GLsizei *, GLsizei, GLint)) AGL_API(void, MultiModeDrawElementsIBM, (const GLenum *, const GLsizei *, GLenum, const GLvoid* *, GLsizei, GLint)) #endif @@ -1493,24 +1493,24 @@ AGL_API(void, TexCoordPointerListIBM, (GLint, GLenum, GLint, const GLvoid* *, GL AGL_API(void, VertexPointerListIBM, (GLint, GLenum, GLint, const GLvoid* *, GLint)) #endif -#if defined _ALLEGRO_GL_3DFX_tbuffer +#if defined _A5O_GL_3DFX_tbuffer AGL_API(void, TbufferMask3DFX, (GLuint)) #endif -#if defined _ALLEGRO_GL_EXT_multisample +#if defined _A5O_GL_EXT_multisample AGL_API(void, SampleMaskEXT, (GLclampf, GLboolean)) AGL_API(void, SamplePatternEXT, (GLenum)) #endif -#if defined _ALLEGRO_GL_SGIS_texture_color_mask +#if defined _A5O_GL_SGIS_texture_color_mask AGL_API(void, TextureColorMaskSGIS, (GLboolean, GLboolean, GLboolean, GLboolean)) #endif -#if defined _ALLEGRO_GL_SGIX_igloo_interface +#if defined _A5O_GL_SGIX_igloo_interface AGL_API(void, IglooInterfaceSGIX, (GLenum, const GLvoid *)) #endif -#if defined _ALLEGRO_GL_NV_fence +#if defined _A5O_GL_NV_fence AGL_API(void, DeleteFencesNV, (GLsizei, const GLuint *)) AGL_API(void, GenFencesNV, (GLsizei, GLuint *)) AGL_API(GLboolean, IsFenceNV, (GLuint)) @@ -1520,7 +1520,7 @@ AGL_API(void, FinishFenceNV, (GLuint)) AGL_API(void, SetFenceNV, (GLuint, GLenum)) #endif -#if defined _ALLEGRO_GL_NV_evaluators +#if defined _A5O_GL_NV_evaluators AGL_API(void, MapControlPointsNV, (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLint, GLint, GLboolean, const GLvoid *)) AGL_API(void, MapParameterivNV, (GLenum, GLenum, const GLint *)) AGL_API(void, MapParameterfvNV, (GLenum, GLenum, const GLfloat *)) @@ -1532,12 +1532,12 @@ AGL_API(void, GetMapAttribParameterfvNV, (GLenum, GLuint, GLenum, GLfloat *)) AGL_API(void, EvalMapsNV, (GLenum, GLenum)) #endif -#if defined _ALLEGRO_GL_NV_register_combiners2 +#if defined _A5O_GL_NV_register_combiners2 AGL_API(void, CombinerStageParameterfvNV, (GLenum, GLenum, const GLfloat *)) AGL_API(void, GetCombinerStageParameterfvNV, (GLenum, GLenum, GLfloat *)) #endif -#if defined _ALLEGRO_GL_NV_vertex_program +#if defined _A5O_GL_NV_vertex_program AGL_API(GLboolean, AreProgramsResidentNV, (GLsizei, const GLuint *, GLboolean *)) AGL_API(void, BindProgramNV, (GLenum, GLuint)) AGL_API(void, DeleteProgramsNV, (GLsizei, const GLuint *)) @@ -1604,14 +1604,14 @@ AGL_API(void, VertexAttribs4svNV, (GLuint, GLsizei, const GLshort *)) AGL_API(void, VertexAttribs4ubvNV, (GLuint, GLsizei, const GLubyte *)) #endif -#if defined _ALLEGRO_GL_ATI_envmap_bumpmap +#if defined _A5O_GL_ATI_envmap_bumpmap AGL_API(void, TexBumpParameterivATI, (GLenum, const GLint *)) AGL_API(void, TexBumpParameterfvATI, (GLenum, const GLfloat *)) AGL_API(void, GetTexBumpParameterivATI, (GLenum, GLint *)) AGL_API(void, GetTexBumpParameterfvATI, (GLenum, GLfloat *)) #endif -#if defined _ALLEGRO_GL_ATI_fragment_shader +#if defined _A5O_GL_ATI_fragment_shader AGL_API(GLuint, GenFragmentShadersATI, (GLuint)) AGL_API(void, BindFragmentShaderATI, (GLuint)) AGL_API(void, DeleteFragmentShaderATI, (GLuint)) @@ -1628,12 +1628,12 @@ AGL_API(void, AlphaFragmentOp3ATI, (GLenum, GLuint, GLuint, GLuint, GLuint, GLui AGL_API(void, SetFragmentShaderConstantATI, (GLuint, const GLfloat *)) #endif -#if defined _ALLEGRO_GL_ATI_pn_triangles +#if defined _A5O_GL_ATI_pn_triangles AGL_API(void, PNTrianglesiATI, (GLenum, GLint)) AGL_API(void, PNTrianglesfATI, (GLenum, GLfloat)) #endif -#if defined _ALLEGRO_GL_ATI_vertex_array_object +#if defined _A5O_GL_ATI_vertex_array_object AGL_API(GLuint, NewObjectBufferATI, (GLsizei, const GLvoid *, GLenum)) AGL_API(GLboolean, IsObjectBufferATI, (GLuint)) AGL_API(void, UpdateObjectBufferATI, (GLuint, GLuint, GLsizei, const GLvoid *, GLenum)) @@ -1648,7 +1648,7 @@ AGL_API(void, GetVariantArrayObjectfvATI, (GLuint, GLenum, GLfloat *)) AGL_API(void, GetVariantArrayObjectivATI, (GLuint, GLenum, GLint *)) #endif -#if defined _ALLEGRO_GL_EXT_vertex_shader +#if defined _A5O_GL_EXT_vertex_shader AGL_API(void, BeginVertexShaderEXT, (void)) AGL_API(void, EndVertexShaderEXT, (void)) AGL_API(void, BindVertexShaderEXT, (GLuint)) @@ -1693,7 +1693,7 @@ AGL_API(void, GetLocalConstantIntegervEXT, (GLuint, GLenum, GLint *)) AGL_API(void, GetLocalConstantFloatvEXT, (GLuint, GLenum, GLfloat *)) #endif -#if defined _ALLEGRO_GL_ATI_vertex_streams +#if defined _A5O_GL_ATI_vertex_streams AGL_API(void, VertexStream1sATI, (GLenum, GLshort)) AGL_API(void, VertexStream1svATI, (GLenum, const GLshort *)) AGL_API(void, VertexStream1iATI, (GLenum, GLint)) @@ -1741,17 +1741,17 @@ AGL_API(void, VertexBlendEnviATI, (GLenum, GLint)) AGL_API(void, VertexBlendEnvfATI, (GLenum, GLfloat)) #endif -#if defined _ALLEGRO_GL_ATI_element_array +#if defined _A5O_GL_ATI_element_array AGL_API(void, ElementPointerATI, (GLenum, const GLvoid *)) AGL_API(void, DrawElementArrayATI, (GLenum, GLsizei)) AGL_API(void, DrawRangeElementArrayATI, (GLenum, GLuint, GLuint, GLsizei)) #endif -#if defined _ALLEGRO_GL_SUN_mesh_array +#if defined _A5O_GL_SUN_mesh_array AGL_API(void, DrawMeshArraysSUN, (GLenum, GLint, GLsizei, GLsizei)) #endif -#if defined _ALLEGRO_GL_NV_occlusion_query +#if defined _A5O_GL_NV_occlusion_query AGL_API(void, GenOcclusionQueriesNV, (GLsizei, GLuint *)) AGL_API(void, DeleteOcclusionQueriesNV, (GLsizei, const GLuint *)) AGL_API(GLboolean, IsOcclusionQueryNV, (GLuint)) @@ -1761,16 +1761,16 @@ AGL_API(void, GetOcclusionQueryivNV, (GLuint, GLenum, GLint *)) AGL_API(void, GetOcclusionQueryuivNV, (GLuint, GLenum, GLuint *)) #endif -#if defined _ALLEGRO_GL_NV_point_sprite +#if defined _A5O_GL_NV_point_sprite AGL_API(void, PointParameteriNV, (GLenum, GLint)) AGL_API(void, PointParameterivNV, (GLenum, const GLint *)) #endif -#if defined _ALLEGRO_GL_EXT_stencil_two_side +#if defined _A5O_GL_EXT_stencil_two_side AGL_API(void, ActiveStencilFaceEXT, (GLenum)) #endif -#if defined _ALLEGRO_GL_APPLE_element_array +#if defined _A5O_GL_APPLE_element_array AGL_API(void, ElementPointerAPPLE, (GLenum, const GLvoid *)) AGL_API(void, DrawElementArrayAPPLE, (GLenum, GLint, GLsizei)) AGL_API(void, DrawRangeElementArrayAPPLE, (GLenum, GLuint, GLuint, GLint, GLsizei)) @@ -1778,7 +1778,7 @@ AGL_API(void, MultiDrawElementArrayAPPLE, (GLenum, const GLint *, const GLsizei AGL_API(void, MultiDrawRangeElementArrayAPPLE, (GLenum, GLuint, GLuint, const GLint *, const GLsizei *, GLsizei)) #endif -#if defined _ALLEGRO_GL_APPLE_fence +#if defined _A5O_GL_APPLE_fence AGL_API(void, GenFencesAPPLE, (GLsizei, GLuint *)) AGL_API(void, DeleteFencesAPPLE, (GLsizei, const GLuint *)) AGL_API(void, SetFenceAPPLE, (GLuint)) @@ -1789,24 +1789,24 @@ AGL_API(GLboolean, TestObjectAPPLE, (GLenum, GLuint)) AGL_API(void, FinishObjectAPPLE, (GLenum, GLint)) #endif -#if defined _ALLEGRO_GL_APPLE_vertex_array_object +#if defined _A5O_GL_APPLE_vertex_array_object AGL_API(void, BindVertexArrayAPPLE, (GLuint)) AGL_API(void, DeleteVertexArraysAPPLE, (GLsizei, const GLuint *)) AGL_API(void, GenVertexArraysAPPLE, (GLsizei, const GLuint *)) AGL_API(GLboolean, IsVertexArrayAPPLE, (GLuint)) #endif -#if defined _ALLEGRO_GL_APPLE_vertex_array_range +#if defined _A5O_GL_APPLE_vertex_array_range AGL_API(void, VertexArrayRangeAPPLE, (GLsizei, GLvoid *)) AGL_API(void, FlushVertexArrayRangeAPPLE, (GLsizei, GLvoid *)) AGL_API(void, VertexArrayParameteriAPPLE, (GLenum, GLint)) #endif -#if defined _ALLEGRO_GL_ATI_draw_buffers +#if defined _A5O_GL_ATI_draw_buffers AGL_API(void, DrawBuffersATI, (GLsizei, const GLenum *)) #endif -#if defined _ALLEGRO_GL_NV_fragment_program +#if defined _A5O_GL_NV_fragment_program AGL_API(void, ProgramNamedParameter4fNV, (GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat)) AGL_API(void, ProgramNamedParameter4dNV, (GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble)) AGL_API(void, ProgramNamedParameter4fvNV, (GLuint, GLsizei, const GLubyte *, const GLfloat *)) @@ -1815,7 +1815,7 @@ AGL_API(void, GetProgramNamedParameterfvNV, (GLuint, GLsizei, const GLubyte *, G AGL_API(void, GetProgramNamedParameterdvNV, (GLuint, GLsizei, const GLubyte *, GLdouble *)) #endif -#if defined _ALLEGRO_GL_NV_half_float +#if defined _A5O_GL_NV_half_float AGL_API(void, Vertex2hNV, (GLhalfNV, GLhalfNV)) AGL_API(void, Vertex2hvNV, (const GLhalfNV *)) AGL_API(void, Vertex3hNV, (GLhalfNV, GLhalfNV, GLhalfNV)) @@ -1864,33 +1864,33 @@ AGL_API(void, VertexAttribs3hvNV, (GLuint, GLsizei, const GLhalfNV *)) AGL_API(void, VertexAttribs4hvNV, (GLuint, GLsizei, const GLhalfNV *)) #endif -#if defined _ALLEGRO_GL_NV_pixel_data_range +#if defined _A5O_GL_NV_pixel_data_range AGL_API(void, PixelDataRangeNV, (GLenum, GLsizei, GLvoid *)) AGL_API(void, FlushPixelDataRangeNV, (GLenum)) #endif -#if defined _ALLEGRO_GL_NV_primitive_restart +#if defined _A5O_GL_NV_primitive_restart AGL_API(void, PrimitiveRestartNV, (void)) AGL_API(void, PrimitiveRestartIndexNV, (GLuint)) #endif -#if defined _ALLEGRO_GL_ATI_map_object_buffer +#if defined _A5O_GL_ATI_map_object_buffer AGL_API(GLvoid*, MapObjectBufferATI, (GLuint)) AGL_API(void, UnmapObjectBufferATI, (GLuint)) #endif -#if defined _ALLEGRO_GL_ATI_separate_stencil +#if defined _A5O_GL_ATI_separate_stencil AGL_API(void, StencilOpSeparateATI, (GLenum, GLenum, GLenum, GLenum)) AGL_API(void, StencilFuncSeparateATI, (GLenum, GLenum, GLint, GLuint)) #endif -#if defined _ALLEGRO_GL_ATI_vertex_attrib_array_object +#if defined _A5O_GL_ATI_vertex_attrib_array_object AGL_API(void, VertexAttribArrayObjectATI, (GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint, GLuint)) AGL_API(void, GetVertexAttribArrayObjectfvATI, (GLuint, GLenum, GLfloat *)) AGL_API(void, GetVertexAttribArrayObjectivATI, (GLuint, GLenum, GLint *)) #endif -#if defined _ALLEGRO_GL_OES_byte_coordinates +#if defined _A5O_GL_OES_byte_coordinates AGL_API(void, Vertex2bOES, ( GLbyte, GLbyte )) AGL_API(void, Vertex3bOES, ( GLbyte, GLbyte, GLbyte )) AGL_API(void, Vertex4bOES, ( GLbyte, GLbyte, GLbyte, GLbyte )) @@ -1915,7 +1915,7 @@ AGL_API(void, MultiTexCoord3bvOES, ( GLenum texture, const GLbyte * )) AGL_API(void, MultiTexCoord4bvOES, ( GLenum texture, const GLbyte * )) #endif -#if defined _ALLEGRO_GL_OES_fixed_point +#if defined _A5O_GL_OES_fixed_point AGL_API(void, Vertex2xOES, (GLfixed, GLfixed)) AGL_API(void, Vertex3xOES, (GLfixed, GLfixed, GLfixed)) AGL_API(void, Vertex4xOES, (GLfixed, GLfixed, GLfixed, GLfixed)) @@ -2021,7 +2021,7 @@ AGL_API(void, PassThroughxOES, (GLfixed)) AGL_API(void, GetFixedvOES, (GLenum, GLfixed *)) #endif -#if defined _ALLEGRO_GL_OES_single_precision +#if defined _A5O_GL_OES_single_precision AGL_API(void, DepthRangefOES, (GLclampf, GLclampf)) AGL_API(void, FrustumfOES, (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat)) AGL_API(void, OrthofOES, (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat)) @@ -2030,21 +2030,21 @@ AGL_API(void, GetClipPlanefOES, (GLenum, GLfloat*)) AGL_API(void, ClearDepthfOES, (GLclampd)) #endif -#if defined _ALLEGRO_GL_OES_query_matrix +#if defined _A5O_GL_OES_query_matrix AGL_API(GLbitfield, QueryMatrixxOES, (GLfixed [16], GLint [16] )) #endif -#if defined _ALLEGRO_GL_EXT_depth_bounds_test +#if defined _A5O_GL_EXT_depth_bounds_test AGL_API(void, DepthBoundsEXT, (GLclampd, GLclampd)) #endif -#if defined _ALLEGRO_GL_EXT_blend_equation_separate +#if defined _A5O_GL_EXT_blend_equation_separate AGL_API(void, BlendEquationSeparateEXT, (GLenum, GLenum)) #endif -#if defined _ALLEGRO_GL_EXT_framebuffer_object +#if defined _A5O_GL_EXT_framebuffer_object AGL_API(GLboolean, IsRenderbufferEXT, (GLuint)) AGL_API(void, BindRenderbufferEXT, (GLenum, GLuint)) AGL_API(void, DeleteRenderbuffersEXT, (GLsizei, const GLuint *)) @@ -2064,44 +2064,44 @@ AGL_API(void, GetFramebufferAttachmentParameterivEXT, (GLenum, GLenum, GLenum, G AGL_API(void, GenerateMipmapEXT, (GLenum)) #endif -#if defined _ALLEGRO_GL_GREMEDY_string_marker +#if defined _A5O_GL_GREMEDY_string_marker AGL_API(void, StringMarkerGREMEDY, (GLsizei, const GLvoid *)) #endif -#if defined _ALLEGRO_GL_EXT_stencil_clear_tag +#if defined _A5O_GL_EXT_stencil_clear_tag AGL_API(void, StencilClearTagEXT, (GLsizei, GLuint)) #endif -#if defined _ALLEGRO_GL_EXT_framebuffer_blit +#if defined _A5O_GL_EXT_framebuffer_blit AGL_API(void, BlitFramebufferEXT, (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum)) #endif -#if defined _ALLEGRO_GL_EXT_framebuffer_multisample +#if defined _A5O_GL_EXT_framebuffer_multisample AGL_API(void, RenderbufferStorageMultisampleEXT, (GLenum, GLsizei, GLenum, GLsizei, GLsizei)) #endif -#if defined _ALLEGRO_GL_EXT_timer_query +#if defined _A5O_GL_EXT_timer_query AGL_API(void, GetQueryObjecti64vEXT, (GLuint, GLenum, GLint64EXT *)) AGL_API(void, GetQueryObjectui64vEXT, (GLuint, GLenum, GLuint64EXT *)) #endif -#if defined _ALLEGRO_GL_EXT_gpu_program_parameters +#if defined _A5O_GL_EXT_gpu_program_parameters AGL_API(void, ProgramEnvParameters4fvEXT, (GLenum, GLuint, GLsizei, const GLfloat *)) AGL_API(void, ProgramLocalParameters4fvEXT, (GLenum, GLuint, GLsizei, const GLfloat *)) #endif -#if defined _ALLEGRO_GL_APPLE_flush_buffer_range +#if defined _A5O_GL_APPLE_flush_buffer_range AGL_API(void, BufferParameteriAPPLE, (GLenum, GLenum, GLint)) AGL_API(void, FlushMappedBufferRangeAPPLE, (GLenum, GLintptr, GLsizeiptr)) #endif -#if defined _ALLEGRO_GL_EXT_bindable_uniform +#if defined _A5O_GL_EXT_bindable_uniform AGL_API(void, UniformBufferEXT, (GLuint, GLint, GLuint)) AGL_API(GLint, GetUniformBufferSizeEXT, (GLuint, GLint)) AGL_API(GLintptr, GetUniformOffsetEXT, (GLuint program, GLint)) #endif -#if defined _ALLEGRO_GL_EXT_draw_buffers2 +#if defined _A5O_GL_EXT_draw_buffers2 AGL_API(void, ColorMaskIndexedEXT, (GLuint, GLboolean, GLboolean, GLboolean, GLboolean)) AGL_API(void, GetBooleanIndexedvEXT, (GLenum, GLuint, GLboolean *)) AGL_API(void, GetIntegerIndexedvEXT, (GLenum, GLuint, GLint *)) @@ -2110,21 +2110,21 @@ AGL_API(void, DisableIndexedEXT, (GLenum, GLuint)) AGL_API(GLboolean, IsEnabledIndexedEXT, (GLenum, GLuint)) #endif -#if defined _ALLEGRO_GL_EXT_draw_instanced +#if defined _A5O_GL_EXT_draw_instanced AGL_API(void, DrawArraysInstancedEXT, (GLenum, GLint, GLsizei, GLsizei)) AGL_API(void, DrawElementsInstancedEXT, (GLenum, GLsizei, GLenum, const GLvoid *, GLsizei)) #endif -#if defined _ALLEGRO_GL_EXT_geometry_shader4 +#if defined _A5O_GL_EXT_geometry_shader4 AGL_API(void, ProgramParameteriEXT, (GLuint, GLenum, GLint)) AGL_API(void, FramebufferTextureEXT, (GLenum, GLenum, GLuint, GLint)) -#if !defined _ALLEGRO_GL_EXT_texture_array +#if !defined _A5O_GL_EXT_texture_array AGL_API(void, FramebufferTextureLayerEXT, (GLenum, GLenum, GLuint, GLint, GLint)) #endif AGL_API(void, FramebufferTextureFaceEXT, (GLenum, GLenum, GLuint, GLint, GLenum)) #endif -#if defined _ALLEGRO_GL_EXT_gpu_shader4 +#if defined _A5O_GL_EXT_gpu_shader4 AGL_API(void, VertexAttribI1iEXT, (GLuint, GLint)) AGL_API(void, VertexAttribI2iEXT, (GLuint, GLint, GLint)) AGL_API(void, VertexAttribI3iEXT, (GLuint, GLint, GLint, GLint)) @@ -2161,15 +2161,15 @@ AGL_API(void, BindFragDataLocationEXT, (GLuint, GLuint, const GLchar *)) AGL_API(GLint, GetFragDataLocationEXT, (GLuint, const GLchar *)) #endif -#if defined _ALLEGRO_GL_EXT_texture_array +#if defined _A5O_GL_EXT_texture_array AGL_API(void, FramebufferTextureLayerEXT, (GLenum, GLenum, GLuint, GLint, GLint)) #endif -#if defined _ALLEGRO_GL_EXT_texture_buffer_object +#if defined _A5O_GL_EXT_texture_buffer_object AGL_API(void, TexBufferEXT, (GLenum, GLenum, GLuint)) #endif -#if defined _ALLEGRO_GL_texture_integer +#if defined _A5O_GL_texture_integer AGL_API(void, ClearColorIiEXT, (GLint, GLint, GLint, GLint)) AGL_API(void, ClearColorIuiEXT, (GLuint, GLuint, GLuint, GLuint)) AGL_API(void, TexParameterIivEXT, (GLenum, GLenum, GLint *)) @@ -2178,27 +2178,27 @@ AGL_API(void, GetTexParameterIivEXT, (GLenum, GLenum, GLint *)) AGL_API(void, GetTexParameterIiuvEXT, (GLenum, GLenum, GLuint *)) #endif -#if defined _ALLEGRO_GL_NV_depth_buffer_float +#if defined _A5O_GL_NV_depth_buffer_float AGL_API(void, DepthRangedNV, (GLdouble, GLdouble)) AGL_API(void, ClearDepthdNV, (GLdouble)) AGL_API(void, DepthBoundsdNV, (GLdouble, GLdouble)) #endif -#if defined _ALLEGRO_GL_NV_framebuffer_multisample_coverage +#if defined _A5O_GL_NV_framebuffer_multisample_coverage AGL_API(void, RenderbufferStorageMultsampleCoverageNV, (GLenum, GLsizei, GLsizei, GLenum, GLsizei, GLsizei)) #endif -#if defined _ALLEGRO_GL_NV_geometry_program4 +#if defined _A5O_GL_NV_geometry_program4 AGL_API(void, ProgramVertexLimitNV, (GLenum, GLint)) -#if !defined _ALLEGRO_GL_EXT_geometry_shader4 +#if !defined _A5O_GL_EXT_geometry_shader4 AGL_API(void, FramebufferTextureEXT, (GLenum, GLenum, GLuint, GLint)) -#if !defined _ALLEGRO_GL_EXT_texture_array +#if !defined _A5O_GL_EXT_texture_array AGL_API(void, FramebufferTextureLayerEXT, (GLenum, GLenum, GLuint, GLint, GLint)) #endif #endif #endif -#if defined _ALLEGRO_GL_NV_gpu_program4 +#if defined _A5O_GL_NV_gpu_program4 AGL_API(void, ProgramLocalParameterI4iNV, (GLenum, GLuint, GLint, GLint, GLint, GLint)) AGL_API(void, ProgramLocalParameterI4ivNV, (GLenum, GLuint, const GLint *)) AGL_API(void, ProgramLocalParametersI4ivNV, (GLenum, GLuint, GLsizei, const GLint *)) @@ -2217,8 +2217,8 @@ AGL_API(void, GetProgramEnvParameterIivNV, (GLenum, GLuint, GLint *)) AGL_API(void, GetProgramEnvParameterIuivNV, (GLenum, GLuint, GLuint *)) #endif -#if defined _ALLEGRO_GL_NV_parameter_buffer_object -#if !defined _ALLEGRO_GL_NV_transform_feedback +#if defined _A5O_GL_NV_parameter_buffer_object +#if !defined _A5O_GL_NV_transform_feedback AGL_API(void, BindBufferRangeNV, (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr)) AGL_API(void, BindBufferOffsetNV,(GLenum, GLuint, GLuint, GLintptr)) AGL_API(void, BindBufferBaseNV, (GLenum, GLuint, GLuint)) @@ -2226,12 +2226,12 @@ AGL_API(void, BindBufferBaseNV, (GLenum, GLuint, GLuint)) AGL_API(void, ProgramBufferParametersfvNV, (GLenum, GLuint, GLuint, GLsizei, const GLfloat *)) AGL_API(void, ProgramBufferParametersIivNV, (GLenum, GLuint, GLuint, GLsizei, const GLint *)) AGL_API(void, ProgramBufferParametersIuivNV,(GLenum, GLuint, GLuint, GLuint, const GLuint *)) -#if !defined _ALLEGRO_GL_EXT_draw_buffers2 +#if !defined _A5O_GL_EXT_draw_buffers2 AGL_API(void, GetIntegerIndexedvEXT, (GLenum, GLuint, GLboolean *)) #endif #endif -#if defined _ALLEGRO_GL_NV_transform_feedback +#if defined _A5O_GL_NV_transform_feedback AGL_API(void, BindBufferRangeNV, (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr)) AGL_API(void, BindBufferOffsetNV,(GLenum, GLuint, GLuint, GLintptr)) AGL_API(void, BindBufferBaseNV, (GLenum, GLuint, GLuint)) @@ -2243,14 +2243,14 @@ AGL_API(GLint, GetVaryingLocationNV, (GLuint, const GLchar *)) AGL_API(void, GetActiveVaryingNV, (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *)) AGL_API(void, ActiveVaryingNV, (GLuint, const GLchar *)) AGL_API(void, GetTransformFeedbackVaryingNV, (GLuint, GLuint, GLint *)) -#if !defined _ALLEGRO_GL_EXT_draw_buffers2 +#if !defined _A5O_GL_EXT_draw_buffers2 AGL_API(void, GetBooleanIndexedvEXT, (GLenum, GLuint, GLboolean *)) /*AGL_API(void, GetIntegerIndexedvEXT, (GLenum, GLuint, GLint *))*/ #endif #endif -#if defined _ALLEGRO_GL_NV_vertex_program4 -#ifndef _ALLEGRO_GL_EXT_gpu_shader4 +#if defined _A5O_GL_NV_vertex_program4 +#ifndef _A5O_GL_EXT_gpu_shader4 AGL_API(void, VertexAttribI1iEXT, (GLuint, GLint)) AGL_API(void, VertexAttribI2iEXT, (GLuint, GLint, GLint)) AGL_API(void, VertexAttribI3iEXT, (GLuint, GLint, GLint, GLint)) @@ -2277,16 +2277,16 @@ AGL_API(void, GetVertexAttribIuivEXT, (GLuint, GLenum, GLint *)) #endif #endif -#if defined _ALLEGRO_GL_GREMEDY_frame_terminator +#if defined _A5O_GL_GREMEDY_frame_terminator AGL_API(void, FrameTerminatorGREMEDY, (void)) #endif -#if defined _ALLEGRO_GL_NV_conditional_render +#if defined _A5O_GL_NV_conditional_render AGL_API(void, BeginConditionalRenderNV, (GLuint, GLenum)) AGL_API(void, EndConditionalRenderNV, (void)) #endif -#if defined _ALLEGRO_GL_EXT_transform_feedback +#if defined _A5O_GL_EXT_transform_feedback AGL_API(void, BeginTransformFeedbackEXT, (GLenum)) AGL_API(void, EndTransformFeedbackEXT, (void)) AGL_API(void, BindBufferRangeEXT, (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr)) @@ -2296,7 +2296,7 @@ AGL_API(void, TransformFeedbackVaryingsEXT, (GLuint, GLsizei, const GLint *, GLe AGL_API(void, GetTransformFeedbackVaryingEXT, (GLuint, GLuint, GLint *)) #endif -#if defined _ALLEGRO_GL_EXT_direct_state_access +#if defined _A5O_GL_EXT_direct_state_access AGL_API(void, ClientAttribDefaultEXT, (GLbitfield)) AGL_API(void, PushClientAttribDefaultEXT, (GLbitfield)) AGL_API(void, MatrixLoadfEXT, (GLenum, const GLfloat *)) @@ -2485,13 +2485,13 @@ AGL_API(void, TextureRenderbufferEXT, (GLuint, GLenum, GLuint)) AGL_API(void, MultiTexRenderbufferEXT, (GLenum, GLenum, GLuint)) #endif -#if defined _ALLEGRO_GL_NV_explicit_multisample +#if defined _A5O_GL_NV_explicit_multisample AGL_API(void, GetMultisamplefvNV, (GLenum, GLuint, GLfloat *)) AGL_API(void, SampleMaskIndexedNV, (GLuint, GLbitfield)) AGL_API(void, TexRenderbufferNV, (GLenum, GLuint)) #endif -#if defined _ALLEGRO_GL_NV_transform_feedback2 +#if defined _A5O_GL_NV_transform_feedback2 AGL_API(void, BindTransformFeedbackNV, (GLenum, GLuint)) AGL_API(void, DeleteTransformFeedbacksNV, (GLsizei, const GLuint *)) AGL_API(void, GenTransformFeedbacksNV, (GLsizei, GLuint *)) @@ -2501,7 +2501,7 @@ AGL_API(void, ResumeTransformFeedbackNV, (void)) AGL_API(void, DrawTransformFeedbackNV, (GLenum, GLuint)) #endif -#if defined _ALLEGRO_GL_AMD_performance_monitor +#if defined _A5O_GL_AMD_performance_monitor AGL_API(void, GetPerfMonitorGroupsAMD, (GLint *, GLsizei, GLuint *)) AGL_API(void, GetPerfMonitorCountersAMD, (GLuint, GLint *, GLint *, GLsizei, GLuint *)) AGL_API(void, GetPerfMonitorGroupStringAMD, (GLuint, GLsizei, GLsizei *, GLchar *)) @@ -2515,28 +2515,28 @@ AGL_API(void, EndPerfMonitorAMD, (GLuint)) AGL_API(void, GetPerfMonitorCounterDataAMD, (GLuint, GLenum, GLsizei, GLuint *, GLint *)) #endif -#if defined _ALLEGRO_GL_AMD_vertex_shader_tesselator +#if defined _A5O_GL_AMD_vertex_shader_tesselator AGL_API(void, TessellationFactorAMD, (GLfloat)) AGL_API(void, TessellationModeAMD, (GLenum)) #endif -#if defined _ALLEGRO_GL_EXT_provoking_vertex +#if defined _A5O_GL_EXT_provoking_vertex AGL_API(void, ProvokingVertexEXT, (GLenum)) #endif -#if defined _ALLEGRO_GL_AMD_draw_buffers_blend +#if defined _A5O_GL_AMD_draw_buffers_blend AGL_API(void, BlendFuncIndexedAMD, (GLuint buf, GLenum src, GLenum dst)) AGL_API(void, BlendFuncSeparateIndexedAMD, (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)) AGL_API(void, BlendEquationIndexedAMD, (GLuint buf, GLenum mode)) AGL_API(void, BlendEquationSeparateIndexedAMD, (GLuint buf, GLenum modeRGB, GLenum modeAlpha)) #endif -#if defined _ALLEGRO_GL_APPLE_texture_range +#if defined _A5O_GL_APPLE_texture_range AGL_API(void, TextureRangeAPPLE, (GLenum target, GLsizei length, const GLvoid *pointer)) AGL_API(void, GetTexParameterPointervAPPLE, (GLenum target, GLenum pname, GLvoid* *params)) #endif -#if defined _ALLEGRO_GL_APPLE_vertex_program_evaluators +#if defined _A5O_GL_APPLE_vertex_program_evaluators AGL_API(void, EnableVertexAttribAPPLE, (GLuint index, GLenum pname)) AGL_API(void, DisableVertexAttribAPPLE, (GLuint index, GLenum pname)) AGL_API(GLboolean, IsVertexAttribEnabledAPPLE, (GLuint index, GLenum pname)) @@ -2546,13 +2546,13 @@ AGL_API(void, MapVertexAttrib2dAPPLE, (GLuint index, GLuint size, GLdouble u1, G AGL_API(void, MapVertexAttrib2fAPPLE, (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)) #endif -#if defined _ALLEGRO_GL_APPLE_object_purgeable +#if defined _A5O_GL_APPLE_object_purgeable AGL_API(GLenum, ObjectPurgeableAPPLE, (GLenum objectType, GLuint name, GLenum option)) AGL_API(GLenum, ObjectUnpurgeableAPPLE, (GLenum objectType, GLuint name, GLenum option)) AGL_API(void, GetObjectParameterivAPPLE, (GLenum objectType, GLuint name, GLenum pname, GLint *params)) #endif -#if defined _ALLEGRO_GL_NV_video_capture +#if defined _A5O_GL_NV_video_capture AGL_API(void, BeginVideoCaptureNV, (GLuint video_capture_slot)) AGL_API(void, BindVideoCaptureStreamBufferNV, (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset)) AGL_API(void, BindVideoCaptureStreamTextureNV, (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture)) @@ -2567,13 +2567,13 @@ AGL_API(void, VideoCaptureStreamParameterfvNV, (GLuint video_capture_slot, GLuin AGL_API(void, VideoCaptureStreamParameterdvNV, (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params)) #endif -#if defined _ALLEGRO_GL_EXT_separate_shader_objects +#if defined _A5O_GL_EXT_separate_shader_objects AGL_API(void, UseShaderProgramEXT, (GLenum type, GLuint program)) AGL_API(void, ActiveProgramEXT, (GLuint program)) AGL_API(GLuint, CreateShaderProgramEXT, (GLenum type, const GLchar *string)) #endif -#if defined _ALLEGRO_GL_NV_shader_buffer_load +#if defined _A5O_GL_NV_shader_buffer_load AGL_API(void, MakeBufferResidentNV, (GLenum target, GLenum access)) AGL_API(void, MakeBufferNonResidentNV, (GLenum target)) AGL_API(GLboolean, IsBufferResidentNV, (GLenum target)) @@ -2590,7 +2590,7 @@ AGL_API(void, ProgramUniformui64NV, (GLuint program, GLint location, GLuint64EXT AGL_API(void, ProgramUniformui64vNV, (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value)) #endif -#if defined _ALLEGRO_GL_NV_vertex_buffer_unified_memory +#if defined _A5O_GL_NV_vertex_buffer_unified_memory AGL_API(void, BufferAddressRangeNV, (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length)) AGL_API(void, VertexFormatNV, (GLint size, GLenum type, GLsizei stride)) AGL_API(void, NormalFormatNV, (GLenum type, GLsizei stride)) @@ -2605,6 +2605,6 @@ AGL_API(void, VertexAttribIFormatNV, (GLuint index, GLint size, GLenum type, GLs AGL_API(void, GetIntegerui64i_vNV, (GLenum value, GLuint index, GLuint64EXT *result)) #endif -#if defined _ALLEGRO_GL_NV_texture_barrier +#if defined _A5O_GL_NV_texture_barrier AGL_API(void, TextureBarrierNV, (void)) #endif diff --git a/include/allegro5/opengl/GLext/gl_ext_defs.h b/include/allegro5/opengl/GLext/gl_ext_defs.h index f8d3a90441..083ae18894 100644 --- a/include/allegro5/opengl/GLext/gl_ext_defs.h +++ b/include/allegro5/opengl/GLext/gl_ext_defs.h @@ -10,7 +10,7 @@ typedef uint64_t GLuint64; #ifndef GL_VERSION_1_2 #define GL_VERSION_1_2 1 -#define _ALLEGRO_GL_VERSION_1_2 +#define _A5O_GL_VERSION_1_2 #define GL_UNSIGNED_BYTE_3_3_2 0x8032 #define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 @@ -56,7 +56,7 @@ typedef uint64_t GLuint64; #ifndef GL_ARB_imaging #define GL_ARB_imaging -#define _ALLEGRO_GL_ARB_imaging +#define _A5O_GL_ARB_imaging #define GL_CONSTANT_COLOR 0x8001 #define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 #define GL_CONSTANT_ALPHA 0x8003 @@ -136,7 +136,7 @@ typedef uint64_t GLuint64; #ifndef GL_VERSION_1_3 #define GL_VERSION_1_3 1 -#define _ALLEGRO_GL_VERSION_1_3 +#define _A5O_GL_VERSION_1_3 #define GL_TEXTURE0 0x84C0 #define GL_TEXTURE1 0x84C1 #define GL_TEXTURE2 0x84C2 @@ -238,7 +238,7 @@ typedef uint64_t GLuint64; #ifndef GL_VERSION_1_4 #define GL_VERSION_1_4 1 -#define _ALLEGRO_GL_VERSION_1_4 +#define _A5O_GL_VERSION_1_4 #define GL_BLEND_DST_RGB 0x80C8 #define GL_BLEND_SRC_RGB 0x80C9 #define GL_BLEND_DST_ALPHA 0x80CA @@ -282,7 +282,7 @@ typedef uint64_t GLuint64; #ifndef GL_VERSION_1_5 #define GL_VERSION_1_5 1 -#define _ALLEGRO_GL_VERSION_1_5 +#define _A5O_GL_VERSION_1_5 /* New types */ #include typedef ptrdiff_t GLintptr; @@ -343,7 +343,7 @@ typedef ptrdiff_t GLsizeiptr; #ifndef GL_VERSION_2_0 #define GL_VERSION_2_0 1 -#define _ALLEGRO_GL_VERSION_2_0 +#define _A5O_GL_VERSION_2_0 /* New types */ typedef char GLchar; @@ -436,7 +436,7 @@ typedef char GLchar; #ifndef GL_VERSION_2_1 #define GL_VERSION_2_1 1 -#define _ALLEGRO_GL_VERSION_2_1 +#define _A5O_GL_VERSION_2_1 #define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F #define GL_PIXEL_PACK_BUFFER 0x88EB #define GL_PIXEL_UNPACK_BUFFER 0x88EC @@ -464,7 +464,7 @@ typedef char GLchar; #ifndef GL_VERSION_3_0 #define GL_VERSION_3_0 -#define _ALLEGRO_GL_VERSION_3_0 +#define _A5O_GL_VERSION_3_0 #define GL_COMPARE_REF_TO_TEXTURE GL_COMPARE_R_TO_TEXTURE_ARB #define GL_CLIP_DISTANCE0 GL_CLIP_PLANE0 #define GL_CLIP_DISTANCE1 GL_CLIP_PLANE1 @@ -577,7 +577,7 @@ typedef char GLchar; #ifndef GL_VERSION_3_0_DEPRECATED #define GL_VERSION_3_0_DEPRECATED -#define _ALLEGRO_GL_VERSION_3_0_DEPRECATED +#define _A5O_GL_VERSION_3_0_DEPRECATED #define GL_CLAMP_VERTEX_COLOR 0x891A #define GL_CLAMP_FRAGMENT_COLOR 0x891B #define GL_ALPHA_INTEGER 0x8D97 @@ -589,7 +589,7 @@ typedef char GLchar; #ifndef GL_VERSION_3_1 #define GL_VERSION_3_1 -#define _ALLEGRO_GL_VERSION_3_1 +#define _A5O_GL_VERSION_3_1 #define GL_SAMPLER_2D_RECT 0x8B63 #define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 #define GL_SAMPLER_BUFFER 0x8DC2 @@ -625,7 +625,7 @@ typedef char GLchar; #ifndef GL_VERSION_3_2 #define GL_VERSION_3_2 -#define _ALLEGRO_GL_VERSION_3_2 +#define _A5O_GL_VERSION_3_2 #define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 #define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 #define GL_LINES_ADJACENCY 0x000A @@ -652,12 +652,12 @@ typedef char GLchar; #ifndef GL_VERSION_3_3 #define GL_VERSION_3_3 -#define _ALLEGRO_GL_VERSION_3_3 +#define _A5O_GL_VERSION_3_3 #endif #ifndef GL_VERSION_4_3 #define GL_VERSION_4_3 -#define _ALLEGRO_GL_VERSION_4_3 +#define _A5O_GL_VERSION_4_3 typedef void (*GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); #define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9 #define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E @@ -969,7 +969,7 @@ typedef void (PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLs #ifndef GL_ARB_multitexture #define GL_ARB_multitexture -#define _ALLEGRO_GL_ARB_multitexture +#define _A5O_GL_ARB_multitexture #define GL_TEXTURE0_ARB 0x84C0 #define GL_TEXTURE1_ARB 0x84C1 #define GL_TEXTURE2_ARB 0x84C2 @@ -1009,7 +1009,7 @@ typedef void (PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLs #ifndef GL_ARB_transpose_matrix #define GL_ARB_transpose_matrix -#define _ALLEGRO_GL_ARB_transpose_matrix +#define _A5O_GL_ARB_transpose_matrix #define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 #define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 #define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 @@ -1018,7 +1018,7 @@ typedef void (PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLs #ifndef GL_ARB_multisample #define GL_ARB_multisample -#define _ALLEGRO_GL_ARB_multisample +#define _A5O_GL_ARB_multisample #define GL_MULTISAMPLE_ARB 0x809D #define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E #define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F @@ -1032,7 +1032,7 @@ typedef void (PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLs #ifndef GL_ARB_texture_cube_map #define GL_ARB_texture_cube_map -#define _ALLEGRO_GL_ARB_texture_cube_map +#define _A5O_GL_ARB_texture_cube_map #define GL_NORMAL_MAP_ARB 0x8511 #define GL_REFLECTION_MAP_ARB 0x8512 #define GL_TEXTURE_CUBE_MAP_ARB 0x8513 @@ -1049,7 +1049,7 @@ typedef void (PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLs #ifndef GL_ARB_texture_compression #define GL_ARB_texture_compression -#define _ALLEGRO_GL_ARB_texture_compression +#define _A5O_GL_ARB_texture_compression #define GL_COMPRESSED_ALPHA_ARB 0x84E9 #define GL_COMPRESSED_LUMINANCE_ARB 0x84EA #define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB @@ -1065,13 +1065,13 @@ typedef void (PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLs #ifndef GL_ARB_texture_border_clamp #define GL_ARB_texture_border_clamp -#define _ALLEGRO_GL_ARB_texture_border_clamp +#define _A5O_GL_ARB_texture_border_clamp #define GL_CLAMP_TO_BORDER_ARB 0x812D #endif #ifndef GL_ARB_point_parameters #define GL_ARB_point_parameters -#define _ALLEGRO_GL_ARB_point_parameters +#define _A5O_GL_ARB_point_parameters #define GL_POINT_SIZE_MIN_ARB 0x8126 #define GL_POINT_SIZE_MAX_ARB 0x8127 #define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 @@ -1080,7 +1080,7 @@ typedef void (PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLs #ifndef GL_ARB_vertex_blend #define GL_ARB_vertex_blend -#define _ALLEGRO_GL_ARB_vertex_blend +#define _A5O_GL_ARB_vertex_blend #define GL_MAX_VERTEX_UNITS_ARB 0x86A4 #define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 #define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 @@ -1127,7 +1127,7 @@ typedef void (PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLs #ifndef GL_ARB_matrix_palette #define GL_ARB_matrix_palette -#define _ALLEGRO_GL_ARB_matrix_palette +#define _A5O_GL_ARB_matrix_palette #define GL_MATRIX_PALETTE_ARB 0x8840 #define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 #define GL_MAX_PALETTE_MATRICES_ARB 0x8842 @@ -1142,7 +1142,7 @@ typedef void (PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLs #ifndef GL_ARB_texture_env_combine #define GL_ARB_texture_env_combine -#define _ALLEGRO_GL_ARB_texture_env_combine +#define _A5O_GL_ARB_texture_env_combine #define GL_COMBINE_ARB 0x8570 #define GL_COMBINE_RGB_ARB 0x8571 #define GL_COMBINE_ALPHA_ARB 0x8572 @@ -1169,20 +1169,20 @@ typedef void (PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLs #ifndef GL_ARB_texture_env_dot3 #define GL_ARB_texture_env_dot3 -#define _ALLEGRO_GL_ARB_texture_env_dot3 +#define _A5O_GL_ARB_texture_env_dot3 #define GL_DOT3_RGB_ARB 0x86AE #define GL_DOT3_RGBA_ARB 0x86AF #endif #ifndef GL_ARB_texture_mirrored_repeat #define GL_ARB_texture_mirrored_repeat -#define _ALLEGRO_GL_ARB_texture_mirrored_repeat +#define _A5O_GL_ARB_texture_mirrored_repeat #define GL_MIRRORED_REPEAT_ARB 0x8370 #endif #ifndef GL_ARB_depth_texture #define GL_ARB_depth_texture -#define _ALLEGRO_GL_ARB_depth_texture +#define _A5O_GL_ARB_depth_texture #define GL_DEPTH_COMPONENT16_ARB 0x81A5 #define GL_DEPTH_COMPONENT24_ARB 0x81A6 #define GL_DEPTH_COMPONENT32_ARB 0x81A7 @@ -1192,12 +1192,12 @@ typedef void (PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLs #ifndef GL_ARB_window_pos #define GL_ARB_window_pos -#define _ALLEGRO_GL_ARB_window_pos +#define _A5O_GL_ARB_window_pos #endif #ifndef GL_ARB_shadow #define GL_ARB_shadow -#define _ALLEGRO_GL_ARB_shadow +#define _A5O_GL_ARB_shadow #define GL_TEXTURE_COMPARE_MODE_ARB 0x884C #define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D #define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E @@ -1205,13 +1205,13 @@ typedef void (PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLs #ifndef GL_ARB_shadow_ambient #define GL_ARB_shadow_ambient -#define _ALLEGRO_GL_ARB_shadow_ambient +#define _A5O_GL_ARB_shadow_ambient #define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF #endif #ifndef GL_ARB_vertex_program #define GL_ARB_vertex_program -#define _ALLEGRO_GL_ARB_vertex_program +#define _A5O_GL_ARB_vertex_program #define GL_COLOR_SUM_ARB 0x8458 #define GL_VERTEX_PROGRAM_ARB 0x8620 #define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 @@ -1295,7 +1295,7 @@ typedef void (PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLs #ifndef GL_ARB_fragment_program #define GL_ARB_fragment_program -#define _ALLEGRO_GL_ARB_fragment_program +#define _A5O_GL_ARB_fragment_program #define GL_FRAGMENT_PROGRAM_ARB 0x8804 #define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 #define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 @@ -1315,7 +1315,7 @@ typedef void (PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLs #ifndef GL_ARB_vertex_buffer_object #define GL_ARB_vertex_buffer_object -#define _ALLEGRO_GL_ARB_vertex_buffer_object +#define _A5O_GL_ARB_vertex_buffer_object #include typedef ptrdiff_t GLintptrARB; typedef ptrdiff_t GLsizeiptrARB; @@ -1354,7 +1354,7 @@ typedef ptrdiff_t GLsizeiptrARB; #ifndef GL_ARB_occlusion_query #define GL_ARB_occlusion_query -#define _ALLEGRO_GL_ARB_occlusion_query +#define _A5O_GL_ARB_occlusion_query #define GL_SAMPLES_PASSED_ARB 0x8914 #define GL_QUERY_COUNTER_BITS_ARB 0x8864 #define GL_CURRENT_QUERY_ARB 0x8865 @@ -1364,7 +1364,7 @@ typedef ptrdiff_t GLsizeiptrARB; #ifndef GL_ARB_shader_objects #define GL_ARB_shader_objects -#define _ALLEGRO_GL_ARB_shader_objects +#define _A5O_GL_ARB_shader_objects typedef char GLcharARB; typedef unsigned long GLhandleARB; #define GL_PROGRAM_OBJECT_ARB 0x8B40 @@ -1408,7 +1408,7 @@ typedef unsigned long GLhandleARB; #ifndef GL_ARB_vertex_shader #define GL_ARB_vertex_shader -#define _ALLEGRO_GL_ARB_vertex_shader +#define _A5O_GL_ARB_vertex_shader #define GL_VERTEX_SHADER_ARB 0x8B31 #define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A #define GL_MAX_VARYING_FLOATS_ARB 0x8B4B @@ -1448,7 +1448,7 @@ typedef unsigned long GLhandleARB; #ifndef GL_ARB_fragment_shader #define GL_ARB_fragment_shader -#define _ALLEGRO_GL_ARB_fragment_shader +#define _A5O_GL_ARB_fragment_shader #define GL_FRAGMENT_SHADER_ARB 0x8B30 #define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 #define GL_MAX_TEXTURE_COORDS_ARB 0x8871 @@ -1462,17 +1462,17 @@ typedef unsigned long GLhandleARB; #ifndef GL_ARB_shading_language_100 #define GL_ARB_shading_language_100 -#define _ALLEGRO_GL_ARB_shading_language_100 +#define _A5O_GL_ARB_shading_language_100 #endif #ifndef GL_ARB_texture_non_power_of_two #define GL_ARB_texture_non_power_of_two -#define _ALLEGRO_GL_ARB_texture_non_power_of_two +#define _A5O_GL_ARB_texture_non_power_of_two #endif #ifndef GL_ARB_point_sprite #define GL_ARB_point_sprite -#define _ALLEGRO_GL_ARB_point_sprite +#define _A5O_GL_ARB_point_sprite #define GL_POINT_SPRITE_ARB 0x8861 #define GL_COORD_REPLACE_ARB 0x8862 /* GL_FALSE */ @@ -1482,7 +1482,7 @@ typedef unsigned long GLhandleARB; #ifndef GL_ARB_draw_buffers #define GL_ARB_draw_buffers -#define _ALLEGRO_GL_ARB_draw_buffers +#define _A5O_GL_ARB_draw_buffers #define GL_MAX_DRAW_BUFFERS_ARB 0x8824 #define GL_DRAW_BUFFER0_ARB 0x8825 #define GL_DRAW_BUFFER1_ARB 0x8826 @@ -1505,16 +1505,16 @@ typedef unsigned long GLhandleARB; #ifndef GL_ARB_texture_rectangle #define GL_ARB_texture_rectangle -#define _ALLEGRO_GL_ARB_texture_rectangle +#define _A5O_GL_ARB_texture_rectangle #define GL_TEXTURE_RECTANGLE_ARB 0x84F5 #define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 #define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 #define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 #endif -#ifdef ALLEGRO_MACOSX +#ifdef A5O_MACOSX #ifndef GL_EXT_texture_rectangle #define GL_EXT_texture_rectangle -#define _ALLEGRO_GL_EXT_texture_rectangle +#define _A5O_GL_EXT_texture_rectangle #define GL_TEXTURE_RECTANGLE_EXT 0x84F5 #define GL_TEXTURE_BINDING_RECTANGLE_EXT 0x84F6 #define GL_PROXY_TEXTURE_RECTANGLE_EXT 0x84F7 @@ -1524,7 +1524,7 @@ typedef unsigned long GLhandleARB; #ifndef GL_ARB_color_buffer_float #define GL_ARB_color_buffer_float -#define _ALLEGRO_GL_ARB_color_buffer_float +#define _A5O_GL_ARB_color_buffer_float #define GL_RGBA_FLOAT_MODE_ARB 0x8820 #define GL_CLAMP_VERTEX_COLOR_ARB 0x891A #define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B @@ -1535,14 +1535,14 @@ typedef unsigned long GLhandleARB; #ifndef GL_ARB_half_float_pixel #define GL_ARB_half_float_pixel -#define _ALLEGRO_GL_ARB_half_float_pixel +#define _A5O_GL_ARB_half_float_pixel #define GL_HALF_FLOAT_ARB 0x140B #endif #ifndef GL_ARB_texture_float #define GL_ARB_texture_float -#define _ALLEGRO_GL_ARB_texture_float +#define _A5O_GL_ARB_texture_float #define GL_TEXTURE_RED_TYPE_ARB 0x8C10 #define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 #define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 @@ -1567,7 +1567,7 @@ typedef unsigned long GLhandleARB; #ifndef GL_ARB_pixel_buffer_object #define GL_ARB_pixel_buffer_object -#define _ALLEGRO_GL_ARB_pixel_buffer_object +#define _A5O_GL_ARB_pixel_buffer_object #define GL_PIXEL_PACK_BUFFER_ARB 0x88EB #define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC #define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED @@ -1576,7 +1576,7 @@ typedef unsigned long GLhandleARB; #ifndef GL_ARB_depth_buffer_float #define GL_ARB_depth_buffer_float -#define _ALLEGRO_GL_ARB_depth_buffer_float +#define _A5O_GL_ARB_depth_buffer_float #define GL_DEPTH_COMPONENT32F 0x8CAC #define GL_DEPTH32F_STENCIL8 0x8CAD #define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD @@ -1584,12 +1584,12 @@ typedef unsigned long GLhandleARB; #ifndef GL_ARB_draw_instanced #define GL_ARB_draw_instanced -#define _ALLEGRO_GL_ARB_draw_instanced +#define _A5O_GL_ARB_draw_instanced #endif #ifndef GL_ARB_framebuffer_object #define GL_ARB_framebuffer_object -#define _ALLEGRO_GL_ARB_framebuffer_object +#define _A5O_GL_ARB_framebuffer_object #define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 #define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 #define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 @@ -1666,13 +1666,13 @@ typedef unsigned long GLhandleARB; #ifndef GL_ARB_framebuffer_sRGB #define GL_ARB_framebuffer_sRGB -#define _ALLEGRO_GL_ARB_framebuffer_sRGB +#define _A5O_GL_ARB_framebuffer_sRGB #define GL_FRAMEBUFFER_SRGB 0x8DB9 #endif #ifndef GL_ARB_geometry_shader4 #define GL_ARB_geometry_shader4 -#define _ALLEGRO_GL_ARB_geometry_shader4 +#define _A5O_GL_ARB_geometry_shader4 #define GL_LINES_ADJACENCY_ARB 0x000A #define GL_LINE_STRIP_ADJACENCY_ARB 0x000B #define GL_TRIANGLES_ADJACENCY_ARB 0x000C @@ -1697,18 +1697,18 @@ typedef unsigned long GLhandleARB; #ifndef GL_ARB_half_float_vertex #define GL_ARB_half_float_vertex -#define _ALLEGRO_GL_ARB_half_float_vertex +#define _A5O_GL_ARB_half_float_vertex #define GL_HALF_FLOAT 0x140B #endif #ifndef GL_ARB_instanced_arrays #define GL_ARB_instanced_arrays -#define _ALLEGRO_GL_ARB_instanced_arrays +#define _A5O_GL_ARB_instanced_arrays #endif #ifndef GL_ARB_map_buffer_range #define GL_ARB_map_buffer_range -#define _ALLEGRO_GL_ARB_map_buffer_range +#define _A5O_GL_ARB_map_buffer_range #define GL_MAP_READ_BIT 0x0001 #define GL_MAP_WRITE_BIT 0x0002 #define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 @@ -1719,7 +1719,7 @@ typedef unsigned long GLhandleARB; #ifndef GL_ARB_texture_buffer_object #define GL_ARB_texture_buffer_object -#define _ALLEGRO_GL_ARB_texture_buffer_object +#define _A5O_GL_ARB_texture_buffer_object #define GL_TEXTURE_BUFFER_ARB 0x8C2A #define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B #define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C @@ -1729,7 +1729,7 @@ typedef unsigned long GLhandleARB; #ifndef GL_ARB_texture_compression_rgtc #define GL_ARB_texture_compression_rgtc -#define _ALLEGRO_GL_ARB_texture_compression_rgtc +#define _A5O_GL_ARB_texture_compression_rgtc #define GL_COMPRESSED_RED_RGTC1 0x8DBB #define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC #define GL_COMPRESSED_RG_RGTC2 0x8DBD @@ -1738,7 +1738,7 @@ typedef unsigned long GLhandleARB; #ifndef GL_ARB_texture_rg #define GL_ARB_texture_rg -#define _ALLEGRO_GL_ARB_texture_rg +#define _A5O_GL_ARB_texture_rg #define GL_RG 0x8227 #define GL_RG_INTEGER 0x8228 #define GL_R8 0x8229 @@ -1765,13 +1765,13 @@ typedef unsigned long GLhandleARB; #ifndef GL_ARB_vertex_array_object #define GL_ARB_vertex_array_object -#define _ALLEGRO_GL_ARB_vertex_array_object +#define _A5O_GL_ARB_vertex_array_object #define GL_VERTEX_ARRAY_BINDING 0x85B5 #endif #ifndef GL_ARB_uniform_buffer_object #define GL_ARB_uniform_buffer_object -#define _ALLEGRO_GL_ARB_uniform_buffer_object +#define _A5O_GL_ARB_uniform_buffer_object #define GL_UNIFORM_BUFFER 0x8A11 #define GL_UNIFORM_BUFFER_BINDING 0x8A28 #define GL_UNIFORM_BUFFER_START 0x8A29 @@ -1809,41 +1809,41 @@ typedef unsigned long GLhandleARB; #ifndef GL_ARB_compatibility #define GL_ARB_compatibility -#define _ALLEGRO_GL_ARB_compatibility +#define _A5O_GL_ARB_compatibility /* ARB_compatibility just defines tokens from core 3.0 */ #endif #ifndef GL_ARB_copy_buffer #define GL_ARB_copy_buffer -#define _ALLEGRO_GL_ARB_copy_buffer +#define _A5O_GL_ARB_copy_buffer #define GL_COPY_READ_BUFFER 0x8F36 #define GL_COPY_WRITE_BUFFER 0x8F37 #endif #ifndef GL_ARB_shader_texture_lod #define GL_ARB_shader_texture_lod -#define _ALLEGRO_GL_ARB_shader_texture_lod +#define _A5O_GL_ARB_shader_texture_lod #endif #ifndef GL_ARB_depth_clamp #define GL_ARB_depth_clamp -#define _ALLEGRO_GL_ARB_depth_clamp +#define _A5O_GL_ARB_depth_clamp #define GL_DEPTH_CLAMP 0x864F #endif #ifndef GL_ARB_draw_elements_base_vertex #define GL_ARB_draw_elements_base_vertex -#define _ALLEGRO_GL_ARB_draw_elements_base_vertex +#define _A5O_GL_ARB_draw_elements_base_vertex #endif #ifndef GL_ARB_fragment_coord_conventions #define GL_ARB_fragment_coord_conventions -#define _ALLEGRO_GL_ARB_fragment_coord_conventions +#define _A5O_GL_ARB_fragment_coord_conventions #endif #ifndef GL_ARB_provoking_vertex #define GL_ARB_provoking_vertex -#define _ALLEGRO_GL_ARB_provoking_vertex +#define _A5O_GL_ARB_provoking_vertex #define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C #define GL_FIRST_VERTEX_CONVENTION 0x8E4D #define GL_LAST_VERTEX_CONVENTION 0x8E4E @@ -1852,13 +1852,13 @@ typedef unsigned long GLhandleARB; #ifndef GL_ARB_seamless_cube_map #define GL_ARB_seamless_cube_map -#define _ALLEGRO_GL_ARB_seamless_cube_map +#define _A5O_GL_ARB_seamless_cube_map #define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F #endif #ifndef GL_ARB_sync #define GL_ARB_sync -#define _ALLEGRO_GL_ARB_sync +#define _A5O_GL_ARB_sync typedef struct __GLsync *GLsync; #define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 #define GL_OBJECT_TYPE 0x9112 @@ -1879,7 +1879,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_ARB_texture_multisample #define GL_ARB_texture_multisample -#define _ALLEGRO_GL_ARB_texture_multisample +#define _A5O_GL_ARB_texture_multisample #define GL_SAMPLE_POSITION 0x8E50 #define GL_SAMPLE_MASK 0x8E51 #define GL_SAMPLE_MASK_VALUE 0x8E52 @@ -1905,25 +1905,25 @@ typedef struct __GLsync *GLsync; #ifndef GL_ARB_vertex_array_bgra #define GL_ARB_vertex_array_bgra -#define _ALLEGRO_GL_ARB_vertex_array_bgra +#define _A5O_GL_ARB_vertex_array_bgra /* reuse GL_BGRA */ #endif #ifndef GL_ARB_draw_buffers_blend #define GL_ARB_draw_buffers_blend -#define _ALLEGRO_GL_ARB_draw_buffers_blend +#define _A5O_GL_ARB_draw_buffers_blend #endif #ifndef GL_ARB_sample_shading #define GL_ARB_sample_shading -#define _ALLEGRO_GL_ARB_sample_shading +#define _A5O_GL_ARB_sample_shading #define GL_SAMPLE_SHADING 0x8C36 #define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 #endif #ifndef GL_ARB_texture_cube_map_array #define GL_ARB_texture_cube_map_array -#define _ALLEGRO_GL_ARB_texture_cube_map_array +#define _A5O_GL_ARB_texture_cube_map_array #define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 #define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A #define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B @@ -1935,19 +1935,19 @@ typedef struct __GLsync *GLsync; #ifndef GL_ARB_texture_gather #define GL_ARB_texture_gather -#define _ALLEGRO_GL_ARB_texture_gather +#define _A5O_GL_ARB_texture_gather #define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E #define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F #endif #ifndef GL_ARB_texture_query_lod #define GL_ARB_texture_query_lod -#define _ALLEGRO_GL_ARB_texture_query_lod +#define _A5O_GL_ARB_texture_query_lod #endif #ifndef GL_ARB_shading_language_include #define GL_ARB_shading_language_include -#define _ALLEGRO_GL_ARB_shading_language_include +#define _A5O_GL_ARB_shading_language_include #define GL_SHADER_INCLUDE_ARB 0x8DAE #define GL_NAMED_STRING_LENGTH_ARB 0x8DE9 #define GL_NAMED_STRING_TYPE_ARB 0x8DEA @@ -1955,7 +1955,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_ARB_texture_compression_bptc #define GL_ARB_texture_compression_bptc -#define _ALLEGRO_GL_ARB_texture_compression_bptc +#define _A5O_GL_ARB_texture_compression_bptc #define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C #define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D #define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E @@ -1964,7 +1964,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_ARB_blend_func_extended #define GL_ARB_blend_func_extended -#define _ALLEGRO_GL_ARB_blend_func_extended +#define _A5O_GL_ARB_blend_func_extended #define GL_SRC1_COLOR 0x88F9 /* reuse GL_SRC1_ALPHA */ #define GL_ONE_MINUS_SRC1_COLOR 0x88FA @@ -1974,35 +1974,35 @@ typedef struct __GLsync *GLsync; #ifndef GL_ARB_explicit_attrib_location #define GL_ARB_explicit_attrib_location -#define _ALLEGRO_GL_ARB_explicit_attrib_location +#define _A5O_GL_ARB_explicit_attrib_location #endif #ifndef GL_ARB_occlusion_query2 #define GL_ARB_occlusion_query2 -#define _ALLEGRO_GL_ARB_occlusion_query2 +#define _A5O_GL_ARB_occlusion_query2 #define GL_ANY_SAMPLES_PASSED 0x8C2F #endif #ifndef GL_ARB_sampler_objects #define GL_ARB_sampler_objects -#define _ALLEGRO_GL_ARB_sampler_objects +#define _A5O_GL_ARB_sampler_objects #define GL_SAMPLER_BINDING 0x8919 #endif #ifndef GL_ARB_shader_bit_encoding #define GL_ARB_shader_bit_encoding -#define _ALLEGRO_GL_ARB_shader_bit_encoding +#define _A5O_GL_ARB_shader_bit_encoding #endif #ifndef GL_ARB_texture_rgb10_a2ui #define GL_ARB_texture_rgb10_a2ui -#define _ALLEGRO_GL_ARB_texture_rgb10_a2ui +#define _A5O_GL_ARB_texture_rgb10_a2ui #define GL_RGB10_A2UI 0x906F #endif #ifndef GL_ARB_texture_swizzle #define GL_ARB_texture_swizzle -#define _ALLEGRO_GL_ARB_texture_swizzle +#define _A5O_GL_ARB_texture_swizzle #define GL_TEXTURE_SWIZZLE_R 0x8E42 #define GL_TEXTURE_SWIZZLE_G 0x8E43 #define GL_TEXTURE_SWIZZLE_B 0x8E44 @@ -2012,28 +2012,28 @@ typedef struct __GLsync *GLsync; #ifndef GL_ARB_timer_query #define GL_ARB_timer_query -#define _ALLEGRO_GL_ARB_timer_query +#define _A5O_GL_ARB_timer_query #define GL_TIME_ELAPSED 0x88BF #define GL_TIMESTAMP 0x8E28 #endif #ifndef GL_ARB_vertex_type_2_10_10_10_rev #define GL_ARB_vertex_type_2_10_10_10_rev -#define _ALLEGRO_GL_ARB_vertex_type_2_10_10_10_rev +#define _A5O_GL_ARB_vertex_type_2_10_10_10_rev /* reuse GL_UNSIGNED_INT_2_10_10_10_REV */ #define GL_INT_2_10_10_10_REV 0x8D9F #endif #ifndef GL_ARB_draw_indirect #define GL_ARB_draw_indirect -#define _ALLEGRO_GL_ARB_draw_indirect +#define _A5O_GL_ARB_draw_indirect #define GL_DRAW_INDIRECT_BUFFER 0x8F3F #define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 #endif #ifndef GL_ARB_gpu_shader5 #define GL_ARB_gpu_shader5 -#define _ALLEGRO_GL_ARB_gpu_shader5 +#define _A5O_GL_ARB_gpu_shader5 #define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F #define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A #define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B @@ -2044,7 +2044,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_ARB_gpu_shader_fp64 #define GL_ARB_gpu_shader_fp64 -#define _ALLEGRO_GL_ARB_gpu_shader_fp64 +#define _A5O_GL_ARB_gpu_shader_fp64 /* reuse GL_DOUBLE */ #define GL_DOUBLE_VEC2 0x8FFC #define GL_DOUBLE_VEC3 0x8FFD @@ -2062,7 +2062,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_ARB_shader_subroutine #define GL_ARB_shader_subroutine -#define _ALLEGRO_GL_ARB_shader_subroutine +#define _A5O_GL_ARB_shader_subroutine #define GL_ACTIVE_SUBROUTINES 0x8DE5 #define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6 #define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47 @@ -2078,7 +2078,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_ARB_tessellation_shader #define GL_ARB_tessellation_shader -#define _ALLEGRO_GL_ARB_tessellation_shader +#define _A5O_GL_ARB_tessellation_shader #define GL_PATCHES 0x000E #define GL_PATCH_VERTICES 0x8E72 #define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73 @@ -2120,7 +2120,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_ARB_texture_buffer_object_rgb32 #define GL_ARB_texture_buffer_object_rgb32 -#define _ALLEGRO_GL_ARB_texture_buffer_object_rgb32 +#define _A5O_GL_ARB_texture_buffer_object_rgb32 /* reuse GL_RGB32F */ /* reuse GL_RGB32UI */ /* reuse GL_RGB32I */ @@ -2128,7 +2128,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_ARB_transform_feedback2 #define GL_ARB_transform_feedback2 -#define _ALLEGRO_GL_ARB_transform_feedback2 +#define _A5O_GL_ARB_transform_feedback2 #define GL_TRANSFORM_FEEDBACK 0x8E22 #define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23 #define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24 @@ -2137,7 +2137,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_ARB_transform_feedback3 #define GL_ARB_transform_feedback3 -#define _ALLEGRO_GL_ARB_transform_feedback3 +#define _A5O_GL_ARB_transform_feedback3 #define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70 #endif @@ -2147,13 +2147,13 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_abgr #define GL_EXT_abgr -#define _ALLEGRO_GL_EXT_abgr +#define _A5O_GL_EXT_abgr #define GL_ABGR_EXT 0x8000 #endif #ifndef GL_EXT_blend_color #define GL_EXT_blend_color -#define _ALLEGRO_GL_EXT_blend_color +#define _A5O_GL_EXT_blend_color #define GL_CONSTANT_COLOR_EXT 0x8001 #define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 #define GL_CONSTANT_ALPHA_EXT 0x8003 @@ -2163,7 +2163,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_polygon_offset #define GL_EXT_polygon_offset -#define _ALLEGRO_GL_EXT_polygon_offset +#define _A5O_GL_EXT_polygon_offset #define GL_POLYGON_OFFSET_EXT 0x8037 #define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 #define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 @@ -2171,7 +2171,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_texture #define GL_EXT_texture -#define _ALLEGRO_GL_EXT_texture +#define _A5O_GL_EXT_texture #define GL_ALPHA4_EXT 0x803B #define GL_ALPHA8_EXT 0x803C #define GL_ALPHA12_EXT 0x803D @@ -2219,7 +2219,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_texture3D #define GL_EXT_texture3D -#define _ALLEGRO_GL_EXT_texture3D +#define _A5O_GL_EXT_texture3D #define GL_PACK_SKIP_IMAGES_EXT 0x806B #define GL_PACK_IMAGE_HEIGHT_EXT 0x806C #define GL_UNPACK_SKIP_IMAGES_EXT 0x806D @@ -2233,14 +2233,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIS_texture_filter4 #define GL_SGIS_texture_filter4 -#define _ALLEGRO_GL_SGIS_texture_filter4 +#define _A5O_GL_SGIS_texture_filter4 #define GL_FILTER4_SGIS 0x8146 #define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 #endif #ifndef GL_EXT_histogram #define GL_EXT_histogram -#define _ALLEGRO_GL_EXT_histogram +#define _A5O_GL_EXT_histogram #define GL_HISTOGRAM_EXT 0x8024 #define GL_PROXY_HISTOGRAM_EXT 0x8025 #define GL_HISTOGRAM_WIDTH_EXT 0x8026 @@ -2259,25 +2259,25 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_subtexture #define GL_EXT_subtexture -#define _ALLEGRO_GL_EXT_subtexture +#define _A5O_GL_EXT_subtexture #endif #ifndef GL_EXT_copy_texture #define GL_EXT_copy_texture /* NV's headers don't define EXT_copy_texture yet provide the API */ -#ifndef ALLEGRO_GL_HEADER_NV -#define _ALLEGRO_GL_EXT_copy_texture +#ifndef A5O_GL_HEADER_NV +#define _A5O_GL_EXT_copy_texture #endif #endif #ifndef GL_EXT_histogram #define GL_EXT_histogram -#define _ALLEGRO_GL_EXT_histogram +#define _A5O_GL_EXT_histogram #endif #ifndef GL_EXT_convolution #define GL_EXT_convolution -#define _ALLEGRO_GL_EXT_convolution +#define _A5O_GL_EXT_convolution #define GL_CONVOLUTION_1D_EXT 0x8010 #define GL_CONVOLUTION_2D_EXT 0x8011 #define GL_SEPARABLE_2D_EXT 0x8012 @@ -2302,7 +2302,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGI_color_matrix #define GL_SGI_color_matrix -#define _ALLEGRO_GL_SGI_color_matrix +#define _A5O_GL_SGI_color_matrix #define GL_COLOR_MATRIX_SGI 0x80B1 #define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 #define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 @@ -2318,7 +2318,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGI_color_table #define GL_SGI_color_table -#define _ALLEGRO_GL_SGI_color_table +#define _A5O_GL_SGI_color_table #define GL_COLOR_TABLE_SGI 0x80D0 #define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 #define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 @@ -2339,7 +2339,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIS_pixel_texture #define GL_SGIS_pixel_texture -#define _ALLEGRO_GL_SGIS_pixel_texture +#define _A5O_GL_SGIS_pixel_texture #define GL_PIXEL_TEXTURE_SGIS 0x8353 #define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 #define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 @@ -2348,14 +2348,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIX_pixel_texture #define GL_SGIX_pixel_texture -#define _ALLEGRO_GL_SGIX_pixel_texture +#define _A5O_GL_SGIX_pixel_texture #define GL_PIXEL_TEX_GEN_SGIX 0x8139 #define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B #endif #ifndef GL_SGIS_texture4D #define GL_SGIS_texture4D -#define _ALLEGRO_GL_SGIS_texture4D +#define _A5O_GL_SGIS_texture4D #define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 #define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 #define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 @@ -2370,14 +2370,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGI_texture_color_table #define GL_SGI_texture_color_table -#define _ALLEGRO_GL_SGI_texture_color_table +#define _A5O_GL_SGI_texture_color_table #define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC #define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD #endif #ifndef GL_EXT_cmyka #define GL_EXT_cmyka -#define _ALLEGRO_GL_EXT_cmyka +#define _A5O_GL_EXT_cmyka #define GL_CMYK_EXT 0x800C #define GL_CMYKA_EXT 0x800D #define GL_PACK_CMYK_HINT_EXT 0x800E @@ -2386,7 +2386,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_texture_object #define GL_EXT_texture_object -#define _ALLEGRO_GL_EXT_texture_object +#define _A5O_GL_EXT_texture_object #define GL_TEXTURE_PRIORITY_EXT 0x8066 #define GL_TEXTURE_RESIDENT_EXT 0x8067 #define GL_TEXTURE_1D_BINDING_EXT 0x8068 @@ -2396,7 +2396,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIS_detail_texture #define GL_SGIS_detail_texture -#define _ALLEGRO_GL_SGIS_detail_texture +#define _A5O_GL_SGIS_detail_texture #define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 #define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 #define GL_LINEAR_DETAIL_SGIS 0x8097 @@ -2409,7 +2409,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIS_sharpen_texture #define GL_SGIS_sharpen_texture -#define _ALLEGRO_GL_SGIS_sharpen_texture +#define _A5O_GL_SGIS_sharpen_texture #define GL_LINEAR_SHARPEN_SGIS 0x80AD #define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE #define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF @@ -2418,7 +2418,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_packed_pixels #define GL_EXT_packed_pixels -#define _ALLEGRO_GL_EXT_packed_pixels +#define _A5O_GL_EXT_packed_pixels #define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 #define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 #define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 @@ -2428,7 +2428,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIS_texture_lod #define GL_SGIS_texture_lod -#define _ALLEGRO_GL_SGIS_texture_lod +#define _A5O_GL_SGIS_texture_lod #define GL_TEXTURE_MIN_LOD_SGIS 0x813A #define GL_TEXTURE_MAX_LOD_SGIS 0x813B #define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C @@ -2437,7 +2437,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIS_multisample #define GL_SGIS_multisample -#define _ALLEGRO_GL_SGIS_multisample +#define _A5O_GL_SGIS_multisample #define GL_MULTISAMPLE_SGIS 0x809D #define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E #define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F @@ -2458,13 +2458,13 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_rescale_normal #define GL_EXT_rescale_normal -#define _ALLEGRO_GL_EXT_rescale_normal +#define _A5O_GL_EXT_rescale_normal #define GL_RESCALE_NORMAL_EXT 0x803A #endif #ifndef GL_EXT_vertex_array #define GL_EXT_vertex_array -#define _ALLEGRO_GL_EXT_vertex_array +#define _A5O_GL_EXT_vertex_array #define GL_VERTEX_ARRAY_EXT 0x8074 #define GL_NORMAL_ARRAY_EXT 0x8075 #define GL_COLOR_ARRAY_EXT 0x8076 @@ -2501,14 +2501,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIS_generate_mipmap #define GL_SGIS_generate_mipmap -#define _ALLEGRO_GL_SGIS_generate_mipmap +#define _A5O_GL_SGIS_generate_mipmap #define GL_GENERATE_MIPMAP_SGIS 0x8191 #define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 #endif #ifndef GL_SGIX_clipmap #define GL_SGIX_clipmap -#define _ALLEGRO_GL_SGIX_clipmap +#define _A5O_GL_SGIX_clipmap #define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 #define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 #define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 @@ -2525,7 +2525,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIX_shadow #define GL_SGIX_shadow -#define _ALLEGRO_GL_SGIX_shadow +#define _A5O_GL_SGIX_shadow #define GL_TEXTURE_COMPARE_SGIX 0x819A #define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B #define GL_TEXTURE_LEQUAL_R_SGIX 0x819C @@ -2534,13 +2534,13 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIS_texture_edge_clamp #define GL_SGIS_texture_edge_clamp -#define _ALLEGRO_GL_SGIS_texture_edge_clamp +#define _A5O_GL_SGIS_texture_edge_clamp #define GL_CLAMP_TO_EDGE_SGIS 0x812F #endif #ifndef GL_EXT_blend_minmax #define GL_EXT_blend_minmax -#define _ALLEGRO_GL_EXT_blend_minmax +#define _A5O_GL_EXT_blend_minmax #define GL_FUNC_ADD_EXT 0x8006 #define GL_MIN_EXT 0x8007 #define GL_MAX_EXT 0x8008 @@ -2549,20 +2549,20 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_blend_subtract #define GL_EXT_blend_subtract -#define _ALLEGRO_GL_EXT_blend_subtract +#define _A5O_GL_EXT_blend_subtract #define GL_FUNC_SUBTRACT_EXT 0x800A #define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B #endif #ifndef GL_SGIX_interlace #define GL_SGIX_interlace -#define _ALLEGRO_GL_SGIX_interlace +#define _A5O_GL_SGIX_interlace #define GL_INTERLACE_SGIX 0x8094 #endif #ifndef GL_SGIX_pixel_tiles #define GL_SGIX_pixel_tiles -#define _ALLEGRO_GL_SGIX_pixel_tiles +#define _A5O_GL_SGIX_pixel_tiles #define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E #define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F #define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 @@ -2575,7 +2575,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIS_texture_select #define GL_SGIS_texture_select -#define _ALLEGRO_GL_SGIS_texture_select +#define _A5O_GL_SGIS_texture_select #define GL_DUAL_ALPHA4_SGIS 0x8110 #define GL_DUAL_ALPHA8_SGIS 0x8111 #define GL_DUAL_ALPHA12_SGIS 0x8112 @@ -2602,7 +2602,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIX_sprite #define GL_SGIX_sprite -#define _ALLEGRO_GL_SGIX_sprite +#define _A5O_GL_SGIX_sprite #define GL_SPRITE_SGIX 0x8148 #define GL_SPRITE_MODE_SGIX 0x8149 #define GL_SPRITE_AXIS_SGIX 0x814A @@ -2614,13 +2614,13 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIX_texture_multi_buffer #define GL_SGIX_texture_multi_buffer -#define _ALLEGRO_GL_SGIX_texture_multi_buffer +#define _A5O_GL_SGIX_texture_multi_buffer #define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E #endif #ifndef GL_EXT_point_parameters #define GL_EXT_point_parameters -#define _ALLEGRO_GL_EXT_point_parameters +#define _A5O_GL_EXT_point_parameters #define GL_POINT_SIZE_MIN_EXT 0x8126 #define GL_POINT_SIZE_MAX_EXT 0x8127 #define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 @@ -2629,7 +2629,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIS_point_parameters #define GL_SGIS_point_parameters -#define _ALLEGRO_GL_SGIS_point_parameters +#define _A5O_GL_SGIS_point_parameters #define GL_POINT_SIZE_MIN_SGIS 0x8126 #define GL_POINT_SIZE_MAX_SGIS 0x8127 #define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 @@ -2638,14 +2638,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIX_instruments #define GL_SGIX_instruments -#define _ALLEGRO_GL_SGIX_instruments +#define _A5O_GL_SGIX_instruments #define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 #define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 #endif #ifndef GL_SGIX_texture_scale_bias #define GL_SGIX_texture_scale_bias -#define _ALLEGRO_GL_SGIX_texture_scale_bias +#define _A5O_GL_SGIX_texture_scale_bias #define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 #define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A #define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B @@ -2654,7 +2654,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIX_framezoom #define GL_SGIX_framezoom -#define _ALLEGRO_GL_SGIX_framezoom +#define _A5O_GL_SGIX_framezoom #define GL_FRAMEZOOM_SGIX 0x818B #define GL_FRAMEZOOM_FACTOR_SGIX 0x818C #define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D @@ -2662,19 +2662,19 @@ typedef struct __GLsync *GLsync; #ifndef GL_FfdMaskSGIX #define GL_FfdMaskSGIX -#define _ALLEGRO_GL_FfdMaskSGIX +#define _A5O_GL_FfdMaskSGIX #define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 #define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 #endif #ifndef GL_SGIX_tag_sample_buffer #define GL_SGIX_tag_sample_buffer -#define _ALLEGRO_GL_SGIX_tag_sample_buffer +#define _A5O_GL_SGIX_tag_sample_buffer #endif #ifndef GL_SGIX_polynomial_ffd #define GL_SGIX_polynomial_ffd -#define _ALLEGRO_GL_SGIX_polynomial_ffd +#define _A5O_GL_SGIX_polynomial_ffd #define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 #define GL_TEXTURE_DEFORMATION_SGIX 0x8195 #define GL_DEFORMATIONS_MASK_SGIX 0x8196 @@ -2683,14 +2683,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIX_reference_plane #define GL_SGIX_reference_plane -#define _ALLEGRO_GL_SGIX_reference_plane +#define _A5O_GL_SGIX_reference_plane #define GL_REFERENCE_PLANE_SGIX 0x817D #define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E #endif #ifndef GL_SGIX_depth_texture #define GL_SGIX_depth_texture -#define _ALLEGRO_GL_SGIX_depth_texture +#define _A5O_GL_SGIX_depth_texture #define GL_DEPTH_COMPONENT16_SGIX 0x81A5 #define GL_DEPTH_COMPONENT24_SGIX 0x81A6 #define GL_DEPTH_COMPONENT32_SGIX 0x81A7 @@ -2698,12 +2698,12 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIX_flush_raster #define GL_SGIX_flush_raster -#define _ALLEGRO_GL_SGIX_flush_raster +#define _A5O_GL_SGIX_flush_raster #endif #ifndef GL_SGIS_fog_function #define GL_SGIS_fog_function -#define _ALLEGRO_GL_SGIS_fog_function +#define _A5O_GL_SGIS_fog_function #define GL_FOG_FUNC_SGIS 0x812A #define GL_FOG_FUNC_POINTS_SGIS 0x812B #define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C @@ -2711,14 +2711,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIX_fog_offset #define GL_SGIX_fog_offset -#define _ALLEGRO_GL_SGIX_fog_offset +#define _A5O_GL_SGIX_fog_offset #define GL_FOG_OFFSET_SGIX 0x8198 #define GL_FOG_OFFSET_VALUE_SGIX 0x8199 #endif #ifndef GL_HP_image_transform #define GL_HP_image_transform -#define _ALLEGRO_GL_HP_image_transform +#define _A5O_GL_HP_image_transform #define GL_IMAGE_SCALE_X_HP 0x8155 #define GL_IMAGE_SCALE_Y_HP 0x8156 #define GL_IMAGE_TRANSLATE_X_HP 0x8157 @@ -2738,7 +2738,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_HP_convolution_border_modes #define GL_HP_convolution_border_modes -#define _ALLEGRO_GL_HP_convolution_border_modes +#define _A5O_GL_HP_convolution_border_modes #define GL_IGNORE_BORDER_HP 0x8150 #define GL_CONSTANT_BORDER_HP 0x8151 #define GL_REPLICATE_BORDER_HP 0x8153 @@ -2747,18 +2747,18 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIX_texture_add_env #define GL_SGIX_texture_add_env -#define _ALLEGRO_GL_SGIX_texture_add_env +#define _A5O_GL_SGIX_texture_add_env #define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE #endif #ifndef GL_EXT_color_subtable #define GL_EXT_color_subtable -#define _ALLEGRO_GL_EXT_color_subtable +#define _A5O_GL_EXT_color_subtable #endif #ifndef GL_PGI_vertex_hints #define GL_PGI_vertex_hints -#define _ALLEGRO_GL_PGI_vertex_hints +#define _A5O_GL_PGI_vertex_hints #define GL_VERTEX_DATA_HINT_PGI 0x1A22A #define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B #define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C @@ -2785,7 +2785,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_PGI_misc_hints #define GL_PGI_misc_hints -#define _ALLEGRO_GL_PGI_misc_hints +#define _A5O_GL_PGI_misc_hints #define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 #define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD #define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE @@ -2810,7 +2810,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_paletted_texture #define GL_EXT_paletted_texture -#define _ALLEGRO_GL_EXT_paletted_texture +#define _A5O_GL_EXT_paletted_texture #define GL_COLOR_INDEX1_EXT 0x80E2 #define GL_COLOR_INDEX2_EXT 0x80E3 #define GL_COLOR_INDEX4_EXT 0x80E4 @@ -2822,31 +2822,31 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_clip_volume_hint #define GL_EXT_clip_volume_hint -#define _ALLEGRO_GL_EXT_clip_volume_hint +#define _A5O_GL_EXT_clip_volume_hint #define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 #endif #ifndef GL_SGIX_list_priority #define GL_SGIX_list_priority -#define _ALLEGRO_GL_SGIX_list_priority +#define _A5O_GL_SGIX_list_priority #define GL_LIST_PRIORITY_SGIX 0x8182 #endif #ifndef GL_SGIX_ir_instrument1 #define GL_SGIX_ir_instrument1 -#define _ALLEGRO_GL_SGIX_ir_instrument1 +#define _A5O_GL_SGIX_ir_instrument1 #define GL_IR_INSTRUMENT1_SGIX 0x817F #endif #ifndef GL_SGIX_calligraphic_fragment #define GL_SGIX_calligraphic_fragment -#define _ALLEGRO_GL_SGIX_calligraphic_fragment +#define _A5O_GL_SGIX_calligraphic_fragment #define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 #endif #ifndef GL_SGIX_texture_lod_bias #define GL_SGIX_texture_lod_bias -#define _ALLEGRO_GL_SGIX_texture_lod_bias +#define _A5O_GL_SGIX_texture_lod_bias #define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E #define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F #define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 @@ -2854,13 +2854,13 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIX_shadow_ambient #define GL_SGIX_shadow_ambient -#define _ALLEGRO_GL_SGIX_shadow_ambient +#define _A5O_GL_SGIX_shadow_ambient #define GL_SHADOW_AMBIENT_SGIX 0x80BF #endif #ifndef GL_EXT_index_material #define GL_EXT_index_material -#define _ALLEGRO_GL_EXT_index_material +#define _A5O_GL_EXT_index_material #define GL_INDEX_MATERIAL_EXT 0x81B8 #define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 #define GL_INDEX_MATERIAL_FACE_EXT 0x81BA @@ -2868,7 +2868,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_index_func #define GL_EXT_index_func -#define _ALLEGRO_GL_EXT_index_func +#define _A5O_GL_EXT_index_func #define GL_INDEX_TEST_EXT 0x81B5 #define GL_INDEX_TEST_FUNC_EXT 0x81B6 #define GL_INDEX_TEST_REF_EXT 0x81B7 @@ -2876,7 +2876,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_index_array_formats #define GL_EXT_index_array_formats -#define _ALLEGRO_GL_EXT_index_array_formats +#define _A5O_GL_EXT_index_array_formats #define GL_IUI_V2F_EXT 0x81AD #define GL_IUI_V3F_EXT 0x81AE #define GL_IUI_N3F_V2F_EXT 0x81AF @@ -2889,14 +2889,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_compiled_vertex_array #define GL_EXT_compiled_vertex_array -#define _ALLEGRO_GL_EXT_compiled_vertex_array +#define _A5O_GL_EXT_compiled_vertex_array #define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 #define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 #endif #ifndef GL_EXT_cull_vertex #define GL_EXT_cull_vertex -#define _ALLEGRO_GL_EXT_cull_vertex +#define _A5O_GL_EXT_cull_vertex #define GL_CULL_VERTEX_EXT 0x81AA #define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB #define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC @@ -2904,14 +2904,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIX_ycrcb #define GL_SGIX_ycrcb -#define _ALLEGRO_GL_SGIX_ycrcb +#define _A5O_GL_SGIX_ycrcb #define GL_YCRCB_422_SGIX 0x81BB #define GL_YCRCB_444_SGIX 0x81BC #endif #ifndef GL_SGIX_fragment_lighting #define GL_SGIX_fragment_lighting -#define _ALLEGRO_GL_SGIX_fragment_lighting +#define _A5O_GL_SGIX_fragment_lighting #define GL_FRAGMENT_LIGHTING_SGIX 0x8400 #define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 #define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 @@ -2936,13 +2936,13 @@ typedef struct __GLsync *GLsync; #ifndef GL_IBM_rasterpos_clip #define GL_IBM_rasterpos_clip -#define _ALLEGRO_GL_IBM_rasterpos_clip +#define _A5O_GL_IBM_rasterpos_clip #define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 #endif #ifndef GL_HP_texture_lighting #define GL_HP_texture_lighting -#define _ALLEGRO_GL_HP_texture_lighting +#define _A5O_GL_HP_texture_lighting #define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 #define GL_TEXTURE_POST_SPECULAR_HP 0x8168 #define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 @@ -2950,27 +2950,27 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_draw_range_elements #define GL_EXT_draw_range_elements -#define _ALLEGRO_GL_EXT_draw_range_elements +#define _A5O_GL_EXT_draw_range_elements #define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 #define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 #endif #ifndef GL_WIN_phong_shading #define GL_WIN_phong_shading -#define _ALLEGRO_GL_WIN_phong_shading +#define _A5O_GL_WIN_phong_shading #define GL_PHONG_WIN 0x80EA #define GL_PHONG_HINT_WIN 0x80EB #endif #ifndef GL_WIN_specular_fog #define GL_WIN_specular_fog -#define _ALLEGRO_GL_WIN_specular_fog +#define _A5O_GL_WIN_specular_fog #define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC #endif #ifndef GL_EXT_light_texture #define GL_EXT_light_texture -#define _ALLEGRO_GL_EXT_light_texture +#define _A5O_GL_EXT_light_texture #define GL_FRAGMENT_MATERIAL_EXT 0x8349 #define GL_FRAGMENT_NORMAL_EXT 0x834A #define GL_FRAGMENT_COLOR_EXT 0x834C @@ -2987,14 +2987,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIX_blend_alpha_minmax #define GL_SGIX_blend_alpha_minmax -#define _ALLEGRO_GL_SGIX_blend_alpha_minmax +#define _A5O_GL_SGIX_blend_alpha_minmax #define GL_ALPHA_MIN_SGIX 0x8320 #define GL_ALPHA_MAX_SGIX 0x8321 #endif #ifndef GL_SGIX_impact_pixel_texture #define GL_SGIX_impact_pixel_texture -#define _ALLEGRO_GL_SGIX_impact_pixel_texture +#define _A5O_GL_SGIX_impact_pixel_texture #define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184 #define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185 #define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186 @@ -3006,20 +3006,20 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_bgra #define GL_EXT_bgra -#define _ALLEGRO_GL_EXT_bgra +#define _A5O_GL_EXT_bgra #define GL_BGR_EXT 0x80E0 #define GL_BGRA_EXT 0x80E1 #endif #ifndef GL_SGIX_async #define GL_SGIX_async -#define _ALLEGRO_GL_SGIX_async +#define _A5O_GL_SGIX_async #define GL_ASYNC_MARKER_SGIX 0x8329 #endif #ifndef GL_SGIX_async_pixel #define GL_SGIX_async_pixel -#define _ALLEGRO_GL_SGIX_async_pixel +#define _A5O_GL_SGIX_async_pixel #define GL_ASYNC_TEX_IMAGE_SGIX 0x835C #define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D #define GL_ASYNC_READ_PIXELS_SGIX 0x835E @@ -3030,14 +3030,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIX_async_histogram #define GL_SGIX_async_histogram -#define _ALLEGRO_GL_SGIX_async_histogram +#define _A5O_GL_SGIX_async_histogram #define GL_ASYNC_HISTOGRAM_SGIX 0x832C #define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D #endif #ifndef GL_INTEL_parallel_arrays #define GL_INTEL_parallel_arrays -#define _ALLEGRO_GL_INTEL_parallel_arrays +#define _A5O_GL_INTEL_parallel_arrays #define GL_PARALLEL_ARRAYS_INTEL 0x83F4 #define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 #define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 @@ -3047,14 +3047,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_HP_occlusion_test #define GL_HP_occlusion_test -#define _ALLEGRO_GL_HP_occlusion_test +#define _A5O_GL_HP_occlusion_test #define GL_OCCLUSION_TEST_HP 0x8165 #define GL_OCCLUSION_TEST_RESULT_HP 0x8166 #endif #ifndef GL_EXT_pixel_transform #define GL_EXT_pixel_transform -#define _ALLEGRO_GL_EXT_pixel_transform +#define _A5O_GL_EXT_pixel_transform #define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 #define GL_PIXEL_MAG_FILTER_EXT 0x8331 #define GL_PIXEL_MIN_FILTER_EXT 0x8332 @@ -3068,13 +3068,13 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_shared_texture_palette #define GL_EXT_shared_texture_palette -#define _ALLEGRO_GL_EXT_shared_texture_palette +#define _A5O_GL_EXT_shared_texture_palette #define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB #endif #ifndef GL_EXT_separate_specular_color #define GL_EXT_separate_specular_color -#define _ALLEGRO_GL_EXT_separate_specular_color +#define _A5O_GL_EXT_separate_specular_color #define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 #define GL_SINGLE_COLOR_EXT 0x81F9 #define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA @@ -3082,7 +3082,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_secondary_color #define GL_EXT_secondary_color -#define _ALLEGRO_GL_EXT_secondary_color +#define _A5O_GL_EXT_secondary_color #define GL_COLOR_SUM_EXT 0x8458 #define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 #define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A @@ -3094,19 +3094,19 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_texture_perturb_normal #define GL_EXT_texture_perturb_normal -#define _ALLEGRO_GL_EXT_texture_perturb_normal +#define _A5O_GL_EXT_texture_perturb_normal #define GL_PERTURB_EXT 0x85AE #define GL_TEXTURE_NORMAL_EXT 0x85AF #endif #ifndef GL_EXT_multi_draw_arrays #define GL_EXT_multi_draw_arrays -#define _ALLEGRO_GL_EXT_multi_draw_arrays +#define _A5O_GL_EXT_multi_draw_arrays #endif #ifndef GL_EXT_fog_coord #define GL_EXT_fog_coord -#define _ALLEGRO_GL_EXT_fog_coord +#define _A5O_GL_EXT_fog_coord #define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 #define GL_FOG_COORDINATE_EXT 0x8451 #define GL_FRAGMENT_DEPTH_EXT 0x8452 @@ -3119,14 +3119,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_REND_screen_coordinates #define GL_REND_screen_coordinates -#define _ALLEGRO_GL_REND_screen_coordinates +#define _A5O_GL_REND_screen_coordinates #define GL_SCREEN_COORDINATES_REND 0x8490 #define GL_INVERTED_SCREEN_W_REND 0x8491 #endif #ifndef GL_EXT_coordinate_frame #define GL_EXT_coordinate_frame -#define _ALLEGRO_GL_EXT_coordinate_frame +#define _A5O_GL_EXT_coordinate_frame #define GL_TANGENT_ARRAY_EXT 0x8439 #define GL_BINORMAL_ARRAY_EXT 0x843A #define GL_CURRENT_TANGENT_EXT 0x843B @@ -3145,7 +3145,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_texture_env_combine #define GL_EXT_texture_env_combine -#define _ALLEGRO_GL_EXT_texture_env_combine +#define _A5O_GL_EXT_texture_env_combine #define GL_COMBINE_EXT 0x8570 #define GL_COMBINE_RGB_EXT 0x8571 #define GL_COMBINE_ALPHA_EXT 0x8572 @@ -3171,40 +3171,40 @@ typedef struct __GLsync *GLsync; #ifndef GL_APPLE_specular_vector #define GL_APPLE_specular_vector -#define _ALLEGRO_GL_APPLE_specular_vector +#define _A5O_GL_APPLE_specular_vector #define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 #endif #ifndef GL_APPLE_transform_hint #define GL_APPLE_transform_hint -#define _ALLEGRO_GL_APPLE_transform_hint +#define _A5O_GL_APPLE_transform_hint #define GL_TRANSFORM_HINT_APPLE 0x85B1 #endif #ifndef GL_SGIX_fog_scale #define GL_SGIX_fog_scale -#define _ALLEGRO_GL_SGIX_fog_scale +#define _A5O_GL_SGIX_fog_scale #define GL_FOG_SCALE_SGIX 0x81FC #define GL_FOG_SCALE_VALUE_SGIX 0x81FD #endif #ifndef GL_SUNX_constant_data #define GL_SUNX_constant_data -#define _ALLEGRO_GL_SUNX_constant_data +#define _A5O_GL_SUNX_constant_data #define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 #define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 #endif #ifndef GL_SUN_global_alpha #define GL_SUN_global_alpha -#define _ALLEGRO_GL_SUN_global_alpha +#define _A5O_GL_SUN_global_alpha #define GL_GLOBAL_ALPHA_SUN 0x81D9 #define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA #endif #ifndef GL_SUN_triangle_list #define GL_SUN_triangle_list -#define _ALLEGRO_GL_SUN_triangle_list +#define _A5O_GL_SUN_triangle_list #define GL_RESTART_SUN 0x0001 #define GL_REPLACE_MIDDLE_SUN 0x0002 #define GL_REPLACE_OLDEST_SUN 0x0003 @@ -3226,12 +3226,12 @@ typedef struct __GLsync *GLsync; #ifndef GL_SUN_vertex #define GL_SUN_vertex -#define _ALLEGRO_GL_SUN_vertex +#define _A5O_GL_SUN_vertex #endif #ifndef GL_EXT_blend_func_separate #define GL_EXT_blend_func_separate -#define _ALLEGRO_GL_EXT_blend_func_separate +#define _A5O_GL_EXT_blend_func_separate #define GL_BLEND_DST_RGB_EXT 0x80C8 #define GL_BLEND_SRC_RGB_EXT 0x80C9 #define GL_BLEND_DST_ALPHA_EXT 0x80CA @@ -3240,7 +3240,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_INGR_color_clamp #define GL_INGR_color_clamp -#define _ALLEGRO_GL_INGR_color_clamp +#define _A5O_GL_INGR_color_clamp #define GL_RED_MIN_CLAMP_INGR 0x8560 #define GL_GREEN_MIN_CLAMP_INGR 0x8561 #define GL_BLUE_MIN_CLAMP_INGR 0x8562 @@ -3253,25 +3253,25 @@ typedef struct __GLsync *GLsync; #ifndef GL_INGR_blend_func_separate #define GL_INGR_blend_func_separate -#define _ALLEGRO_GL_INGR_blend_func_separate +#define _A5O_GL_INGR_blend_func_separate #endif #ifndef GL_INGR_interlace_read #define GL_INGR_interlace_read -#define _ALLEGRO_GL_INGR_interlace_read +#define _A5O_GL_INGR_interlace_read #define GL_INTERLACE_READ_INGR 0x8568 #endif #ifndef GL_EXT_stencil_wrap #define GL_EXT_stencil_wrap -#define _ALLEGRO_GL_EXT_stencil_wrap +#define _A5O_GL_EXT_stencil_wrap #define GL_INCR_WRAP_EXT 0x8507 #define GL_DECR_WRAP_EXT 0x8508 #endif #ifndef GL_EXT_422_pixels #define GL_EXT_422_pixels -#define _ALLEGRO_GL_EXT_422_pixels +#define _A5O_GL_EXT_422_pixels #define GL_422_EXT 0x80CC #define GL_422_REV_EXT 0x80CD #define GL_422_AVERAGE_EXT 0x80CE @@ -3280,14 +3280,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_NV_texgen_reflection #define GL_NV_texgen_reflection -#define _ALLEGRO_GL_NV_texgen_reflection +#define _A5O_GL_NV_texgen_reflection #define GL_NORMAL_MAP_NV 0x8511 #define GL_REFLECTION_MAP_NV 0x8512 #endif #ifndef GL_EXT_texture_cube_map #define GL_EXT_texture_cube_map -#define _ALLEGRO_GL_EXT_texture_cube_map +#define _A5O_GL_EXT_texture_cube_map #define GL_NORMAL_MAP_EXT 0x8511 #define GL_REFLECTION_MAP_EXT 0x8512 #define GL_TEXTURE_CUBE_MAP_EXT 0x8513 @@ -3304,13 +3304,13 @@ typedef struct __GLsync *GLsync; #ifndef GL_SUN_convolution_border_modes #define GL_SUN_convolution_border_modes -#define _ALLEGRO_GL_SUN_convolution_border_modes +#define _A5O_GL_SUN_convolution_border_modes #define GL_WRAP_BORDER_SUN 0x81D4 #endif #ifndef GL_EXT_texture_lod_bias #define GL_EXT_texture_lod_bias -#define _ALLEGRO_GL_EXT_texture_lod_bias +#define _A5O_GL_EXT_texture_lod_bias #define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD #define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 #define GL_TEXTURE_LOD_BIAS_EXT 0x8501 @@ -3318,14 +3318,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_texture_filter_anisotropic #define GL_EXT_texture_filter_anisotropic -#define _ALLEGRO_GL_EXT_texture_filter_anisotropic +#define _A5O_GL_EXT_texture_filter_anisotropic #define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE #define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF #endif #ifndef GL_EXT_vertex_weighting #define GL_EXT_vertex_weighting -#define _ALLEGRO_GL_EXT_vertex_weighting +#define _A5O_GL_EXT_vertex_weighting #define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH #define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 #define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX @@ -3343,14 +3343,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_NV_light_max_exponent #define GL_NV_light_max_exponent -#define _ALLEGRO_GL_NV_light_max_exponent +#define _A5O_GL_NV_light_max_exponent #define GL_MAX_SHININESS_NV 0x8504 #define GL_MAX_SPOT_EXPONENT_NV 0x8505 #endif #ifndef GL_NV_vertex_array_range #define GL_NV_vertex_array_range -#define _ALLEGRO_GL_NV_vertex_array_range +#define _A5O_GL_NV_vertex_array_range #define GL_VERTEX_ARRAY_RANGE_NV 0x851D #define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E #define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F @@ -3360,7 +3360,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_NV_register_combiners #define GL_NV_register_combiners -#define _ALLEGRO_GL_NV_register_combiners +#define _A5O_GL_NV_register_combiners #define GL_REGISTER_COMBINERS_NV 0x8522 #define GL_VARIABLE_A_NV 0x8523 #define GL_VARIABLE_B_NV 0x8524 @@ -3421,7 +3421,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_NV_fog_distance #define GL_NV_fog_distance -#define _ALLEGRO_GL_NV_fog_distance +#define _A5O_GL_NV_fog_distance #define GL_FOG_DISTANCE_MODE_NV 0x855A #define GL_EYE_RADIAL_NV 0x855B #define GL_EYE_PLANE_ABSOLUTE_NV 0x855C @@ -3430,7 +3430,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_NV_texgen_emboss #define GL_NV_texgen_emboss -#define _ALLEGRO_GL_NV_texgen_emboss +#define _A5O_GL_NV_texgen_emboss #define GL_EMBOSS_LIGHT_NV 0x855D #define GL_EMBOSS_CONSTANT_NV 0x855E #define GL_EMBOSS_MAP_NV 0x855F @@ -3438,7 +3438,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_NV_texture_env_combine4 #define GL_NV_texture_env_combine4 -#define _ALLEGRO_GL_NV_texture_env_combine4 +#define _A5O_GL_NV_texture_env_combine4 #define GL_COMBINE4_NV 0x8503 #define GL_SOURCE3_RGB_NV 0x8583 #define GL_SOURCE3_ALPHA_NV 0x858B @@ -3448,7 +3448,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_texture_compression_s3tc #define GL_EXT_texture_compression_s3tc -#define _ALLEGRO_GL_EXT_texture_compression_s3tc +#define _A5O_GL_EXT_texture_compression_s3tc #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 #define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 #define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 @@ -3457,28 +3457,28 @@ typedef struct __GLsync *GLsync; #ifndef GL_MESA_resize_buffers #define GL_MESA_resize_buffers -#define _ALLEGRO_GL_MESA_resize_buffers +#define _A5O_GL_MESA_resize_buffers #endif #ifndef GL_MESA_window_pos #define GL_MESA_window_pos -#define _ALLEGRO_GL_MESA_window_pos +#define _A5O_GL_MESA_window_pos #endif #ifndef GL_IBM_cull_vertex #define GL_IBM_cull_vertex -#define _ALLEGRO_GL_IBM_cull_vertex +#define _A5O_GL_IBM_cull_vertex #define GL_CULL_VERTEX_IBM 103050 #endif #ifndef GL_IBM_multimode_draw_arrays #define GL_IBM_multimode_draw_arrays -#define _ALLEGRO_GL_IBM_multimode_draw_arrays +#define _A5O_GL_IBM_multimode_draw_arrays #endif #ifndef GL_IBM_vertex_array_lists #define GL_IBM_vertex_array_lists -#define _ALLEGRO_GL_IBM_vertex_array_lists +#define _A5O_GL_IBM_vertex_array_lists #define GL_VERTEX_ARRAY_LIST_IBM 103070 #define GL_NORMAL_ARRAY_LIST_IBM 103071 #define GL_COLOR_ARRAY_LIST_IBM 103072 @@ -3499,7 +3499,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIX_subsample #define GL_SGIX_subsample -#define _ALLEGRO_GL_SGIX_subsample +#define _A5O_GL_SGIX_subsample #define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 #define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 #define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 @@ -3509,14 +3509,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIX_ycrcba #define GL_SGIX_ycrcba -#define _ALLEGRO_GL_SGIX_ycrcba +#define _A5O_GL_SGIX_ycrcba #define GL_YCRCB_SGIX 0x8318 #define GL_YCRCBA_SGIX 0x8319 #endif #ifndef GL_SGI_depth_pass_instrument #define GL_SGI_depth_pass_instrument -#define _ALLEGRO_GL_SGI_depth_pass_instrument +#define _A5O_GL_SGI_depth_pass_instrument #define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 #define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 #define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 @@ -3524,14 +3524,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_3DFX_texture_compression_FXT1 #define GL_3DFX_texture_compression_FXT1 -#define _ALLEGRO_GL_3DFX_texture_compression_FXT1 +#define _A5O_GL_3DFX_texture_compression_FXT1 #define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 #define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 #endif #ifndef GL_3DFX_multisample #define GL_3DFX_multisample -#define _ALLEGRO_GL_3DFX_multisample +#define _A5O_GL_3DFX_multisample #define GL_MULTISAMPLE_3DFX 0x86B2 #define GL_SAMPLE_BUFFERS_3DFX 0x86B3 #define GL_SAMPLES_3DFX 0x86B4 @@ -3540,14 +3540,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_3DFX_tbuffer #define GL_3DFX_tbuffer -#ifndef ALLEGRO_GL_HEADER_NV -#define _ALLEGRO_GL_3DFX_tbuffer +#ifndef A5O_GL_HEADER_NV +#define _A5O_GL_3DFX_tbuffer #endif #endif #ifndef GL_EXT_multisample #define GL_EXT_multisample -#define _ALLEGRO_GL_EXT_multisample +#define _A5O_GL_EXT_multisample #define GL_MULTISAMPLE_EXT 0x809D #define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E #define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F @@ -3569,20 +3569,20 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIX_vertex_preclip #define GL_SGIX_vertex_preclip -#define _ALLEGRO_GL_SGIX_vertex_preclip +#define _A5O_GL_SGIX_vertex_preclip #define GL_VERTEX_PRECLIP_SGIX 0x83EE #define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF #endif #ifndef GL_SGIX_convolution_accuracy #define GL_SGIX_convolution_accuracy -#define _ALLEGRO_GL_SGIX_convolution_accuracy +#define _A5O_GL_SGIX_convolution_accuracy #define GL_CONVOLUTION_HINT_SGIX 0x8316 #endif #ifndef GL_SGIX_resample #define GL_SGIX_resample -#define _ALLEGRO_GL_SGIX_resample +#define _A5O_GL_SGIX_resample #define GL_PACK_RESAMPLE_SGIX 0x842C #define GL_UNPACK_RESAMPLE_SGIX 0x842D #define GL_RESAMPLE_REPLICATE_SGIX 0x842E @@ -3592,7 +3592,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIS_point_line_texgen #define GL_SGIS_point_line_texgen -#define _ALLEGRO_GL_SGIS_point_line_texgen +#define _A5O_GL_SGIS_point_line_texgen #define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 #define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 #define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 @@ -3605,34 +3605,34 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIS_texture_color_mask #define GL_SGIS_texture_color_mask -#ifndef ALLEGRO_GL_HEADER_NV -#define _ALLEGRO_GL_SGIS_texture_color_mask +#ifndef A5O_GL_HEADER_NV +#define _A5O_GL_SGIS_texture_color_mask #define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF #endif #endif #ifndef GL_SGIX_igloo_interface #define GL_SGIX_igloo_interface -#define _ALLEGRO_GL_SGIX_igloo_interface +#define _A5O_GL_SGIX_igloo_interface #endif #ifndef GL_EXT_texture_env_dot3 #define GL_EXT_texture_env_dot3 -#define _ALLEGRO_GL_EXT_texture_env_dot3 +#define _A5O_GL_EXT_texture_env_dot3 /* GL_DOT3_RGB_EXT */ /* GL_DOT3_RGBA_EXT */ #endif #ifndef GL_ATI_texture_mirror_once #define GL_ATI_texture_mirror_once -#define _ALLEGRO_GL_ATI_texture_mirror_once +#define _A5O_GL_ATI_texture_mirror_once #define GL_MIRROR_CLAMP_ATI 0x8742 #define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 #endif #ifndef GL_NV_fence #define GL_NV_fence -#define _ALLEGRO_GL_NV_fence +#define _A5O_GL_NV_fence #define GL_ALL_COMPLETED_NV 0x84F2 #define GL_FENCE_STATUS_NV 0x84F3 #define GL_FENCE_CONDITION_NV 0x84F4 @@ -3640,13 +3640,13 @@ typedef struct __GLsync *GLsync; #ifndef GL_IBM_texture_mirrored_repeat #define GL_IBM_texture_mirrored_repeat -#define _ALLEGRO_GL_IBM_texture_mirrored_repeat +#define _A5O_GL_IBM_texture_mirrored_repeat #define GL_MIRRORED_REPEAT_IBM 0x8370 #endif #ifndef GL_NV_evaluators #define GL_NV_evaluators -#define _ALLEGRO_GL_NV_evaluators +#define _A5O_GL_NV_evaluators #define GL_EVAL_2D_NV 0x86C0 #define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 #define GL_MAP_TESSELLATION_NV 0x86C2 @@ -3675,20 +3675,20 @@ typedef struct __GLsync *GLsync; #ifndef GL_NV_packed_depth_stencil #define GL_NV_packed_depth_stencil -#define _ALLEGRO_GL_NV_packed_depth_stencil +#define _A5O_GL_NV_packed_depth_stencil #define GL_DEPTH_STENCIL_NV 0x84F9 #define GL_UNSIGNED_INT_24_8_NV 0x84FA #endif #ifndef GL_NV_register_combiners2 #define GL_NV_register_combiners2 -#define _ALLEGRO_GL_NV_register_combiners2 +#define _A5O_GL_NV_register_combiners2 #define GL_PER_STAGE_CONSTANTS_NV 0x8535 #endif #ifndef GL_NV_texture_rectangle #define GL_NV_texture_rectangle -#define _ALLEGRO_GL_NV_texture_rectangle +#define _A5O_GL_NV_texture_rectangle #define GL_TEXTURE_RECTANGLE_NV 0x84F5 #define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 #define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 @@ -3697,7 +3697,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_NV_texture_shader #define GL_NV_texture_shader -#define _ALLEGRO_GL_NV_texture_shader +#define _A5O_GL_NV_texture_shader #define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C #define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D #define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E @@ -3775,19 +3775,19 @@ typedef struct __GLsync *GLsync; #ifndef GL_NV_texture_shader2 #define GL_NV_texture_shader2 -#define _ALLEGRO_GL_NV_texture_shader2 +#define _A5O_GL_NV_texture_shader2 #define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF #endif #ifndef GL_NV_vertex_array_range2 #define GL_NV_vertex_array_range2 -#define _ALLEGRO_GL_NV_vertex_array_range2 +#define _A5O_GL_NV_vertex_array_range2 #define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 #endif #ifndef GL_NV_vertex_program #define GL_NV_vertex_program -#define _ALLEGRO_GL_NV_vertex_program +#define _A5O_GL_NV_vertex_program #define GL_VERTEX_PROGRAM_NV 0x8620 #define GL_VERTEX_STATE_PROGRAM_NV 0x8621 #define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 @@ -3875,7 +3875,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIX_texture_coordinate_clamp #define GL_SGIX_texture_coordinate_clamp -#define _ALLEGRO_GL_SGIX_texture_coordinate_clamp +#define _A5O_GL_SGIX_texture_coordinate_clamp #define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 #define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A #define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B @@ -3883,27 +3883,27 @@ typedef struct __GLsync *GLsync; #ifndef GL_SGIX_scalebias_hint #define GL_SGIX_scalebias_hint -#define _ALLEGRO_GL_SGIX_scalebias_hint +#define _A5O_GL_SGIX_scalebias_hint #define GL_SCALEBIAS_HINT_SGIX 0x8322 #endif #ifndef GL_OML_interlace #define GL_OML_interlace -#define _ALLEGRO_GL_OML_interlace +#define _A5O_GL_OML_interlace #define GL_INTERLACE_OML 0x8980 #define GL_INTERLACE_READ_OML 0x8981 #endif #ifndef GL_OML_subsample #define GL_OML_subsample -#define _ALLEGRO_GL_OML_subsample +#define _A5O_GL_OML_subsample #define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 #define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 #endif #ifndef GL_OML_resample #define GL_OML_resample -#define _ALLEGRO_GL_OML_resample +#define _A5O_GL_OML_resample #define GL_PACK_RESAMPLE_OML 0x8984 #define GL_UNPACK_RESAMPLE_OML 0x8985 #define GL_RESAMPLE_REPLICATE_OML 0x8986 @@ -3914,14 +3914,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_NV_copy_depth_to_color #define GL_NV_copy_depth_to_color -#define _ALLEGRO_GL_NV_copy_depth_to_color +#define _A5O_GL_NV_copy_depth_to_color #define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E #define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F #endif #ifndef GL_ATI_envmap_bumpmap #define GL_ATI_envmap_bumpmap -#define _ALLEGRO_GL_ATI_envmap_bumpmap +#define _A5O_GL_ATI_envmap_bumpmap #define GL_BUMP_ROT_MATRIX_ATI 0x8775 #define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 #define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 @@ -3934,7 +3934,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_ATI_fragment_shader #define GL_ATI_fragment_shader -#define _ALLEGRO_GL_ATI_fragment_shader +#define _A5O_GL_ATI_fragment_shader #define GL_FRAGMENT_SHADER_ATI 0x8920 #define GL_REG_0_ATI 0x8921 #define GL_REG_1_ATI 0x8922 @@ -4043,7 +4043,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_ATI_pn_triangles #define GL_ATI_pn_triangles -#define _ALLEGRO_GL_ATI_pn_triangles +#define _A5O_GL_ATI_pn_triangles #define GL_PN_TRIANGLES_ATI 0x87F0 #define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 #define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 @@ -4057,7 +4057,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_ATI_vertex_array_object #define GL_ATI_vertex_array_object -#define _ALLEGRO_GL_ATI_vertex_array_object +#define _A5O_GL_ATI_vertex_array_object #define GL_STATIC_ATI 0x8760 #define GL_DYNAMIC_ATI 0x8761 #define GL_PRESERVE_ATI 0x8762 @@ -4070,7 +4070,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_vertex_shader #define GL_EXT_vertex_shader -#define _ALLEGRO_GL_EXT_vertex_shader +#define _A5O_GL_EXT_vertex_shader #define GL_VERTEX_SHADER_EXT 0x8780 #define GL_VERTEX_SHADER_BINDING_EXT 0x8781 #define GL_OP_INDEX_EXT 0x8782 @@ -4185,7 +4185,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_ATI_vertex_streams #define GL_ATI_vertex_streams -#define _ALLEGRO_GL_ATI_vertex_streams +#define _A5O_GL_ATI_vertex_streams #define GL_MAX_VERTEX_STREAMS_ATI 0x876B #define GL_VERTEX_STREAM0_ATI 0x876C #define GL_VERTEX_STREAM1_ATI 0x876D @@ -4200,7 +4200,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_ATI_element_array #define GL_ATI_element_array -#define _ALLEGRO_GL_ATI_element_array +#define _A5O_GL_ATI_element_array #define GL_ELEMENT_ARRAY_ATI 0x8768 #define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 #define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A @@ -4208,32 +4208,32 @@ typedef struct __GLsync *GLsync; #ifndef GL_SUN_mesh_array #define GL_SUN_mesh_array -#define _ALLEGRO_GL_SUN_mesh_array +#define _A5O_GL_SUN_mesh_array #define GL_QUAD_MESH_SUN 0x8614 #define GL_TRIANGLE_MESH_SUN 0x8615 #endif #ifndef GL_SUN_slice_accum #define GL_SUN_slice_accum -#define _ALLEGRO_GL_SUN_slice_accum +#define _A5O_GL_SUN_slice_accum #define GL_SLICE_ACCUM_SUN 0x85CC #endif #ifndef GL_NV_multisample_filter_hint #define GL_NV_multisample_filter_hint -#define _ALLEGRO_GL_NV_multisample_filter_hint +#define _A5O_GL_NV_multisample_filter_hint #define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 #endif #ifndef GL_NV_depth_clamp #define GL_NV_depth_clamp -#define _ALLEGRO_GL_NV_depth_clamp +#define _A5O_GL_NV_depth_clamp #define GL_DEPTH_CLAMP_NV 0x864F #endif #ifndef GL_NV_occlusion_query #define GL_NV_occlusion_query -#define _ALLEGRO_GL_NV_occlusion_query +#define _A5O_GL_NV_occlusion_query #define GL_PIXEL_COUNTER_BITS_NV 0x8864 #define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 #define GL_PIXEL_COUNT_NV 0x8866 @@ -4242,7 +4242,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_NV_point_sprite #define GL_NV_point_sprite -#define _ALLEGRO_GL_NV_point_sprite +#define _A5O_GL_NV_point_sprite #define GL_POINT_SPRITE_NV 0x8861 #define GL_COORD_REPLACE_NV 0x8862 #define GL_POINT_SPRITE_R_MODE_NV 0x8863 @@ -4250,7 +4250,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_NV_texture_shader3 #define GL_NV_texture_shader3 -#define _ALLEGRO_GL_NV_texture_shader3 +#define _A5O_GL_NV_texture_shader3 #define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 #define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 #define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 @@ -4272,26 +4272,26 @@ typedef struct __GLsync *GLsync; #ifndef GL_EXT_stencil_two_side #define GL_EXT_stencil_two_side -#define _ALLEGRO_GL_EXT_stencil_two_side +#define _A5O_GL_EXT_stencil_two_side #define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 #define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 #endif #ifndef GL_ATI_text_fragment_shader #define GL_ATI_text_fragment_shader -#define _ALLEGRO_GL_ATI_text_fragment_shader +#define _A5O_GL_ATI_text_fragment_shader #define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 #endif #ifndef GL_APPLE_client_storage #define GL_APPLE_client_storage -#define _ALLEGRO_GL_APPLE_client_storage +#define _A5O_GL_APPLE_client_storage #define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 #endif #ifndef GL_APPLE_element_array #define GL_APPLE_element_array -#define _ALLEGRO_GL_APPLE_element_array +#define _A5O_GL_APPLE_element_array #define GL_ELEMENT_ARRAY_APPLE 0x8768 #define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8769 #define GL_ELEMENT_ARRAY_POINTER_APPLE 0x876A @@ -4299,20 +4299,20 @@ typedef struct __GLsync *GLsync; #ifndef GL_APPLE_fence #define GL_APPLE_fence -#define _ALLEGRO_GL_APPLE_fence +#define _A5O_GL_APPLE_fence #define GL_DRAW_PIXELS_APPLE 0x8A0A #define GL_FENCE_APPLE 0x8A0B #endif #ifndef GL_APPLE_vertex_array_object #define GL_APPLE_vertex_array_object -#define _ALLEGRO_GL_APPLE_vertex_array_object +#define _A5O_GL_APPLE_vertex_array_object #define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 #endif #ifndef GL_APPLE_vertex_array_range #define GL_APPLE_vertex_array_range -#define _ALLEGRO_GL_APPLE_vertex_array_range +#define _A5O_GL_APPLE_vertex_array_range #define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D #define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E #define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F @@ -4323,7 +4323,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_APPLE_ycbcr_422 #define GL_APPLE_ycbcr_422 -#define _ALLEGRO_GL_APPLE_ycbcr_422 +#define _A5O_GL_APPLE_ycbcr_422 #define GL_YCBCR_422_APPLE 0x85B9 #define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA #define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB @@ -4331,7 +4331,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_S3_s3tc #define GL_S3_s3tc -#define _ALLEGRO_GL_S3_s3tc +#define _A5O_GL_S3_s3tc #define GL_RGB_S3TC 0x83A0 #define GL_RGB4_S3TC 0x83A1 #define GL_RGBA_S3TC 0x83A2 @@ -4340,7 +4340,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_ATI_draw_buffers #define GL_ATI_draw_buffers -#define _ALLEGRO_GL_ATI_draw_buffers +#define _A5O_GL_ATI_draw_buffers #define GL_MAX_DRAW_BUFFERS_ATI 0x8824 #define GL_DRAW_BUFFER0_ATI 0x8825 #define GL_DRAW_BUFFER1_ATI 0x8826 @@ -4362,7 +4362,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_ATI_texture_env_combine3 #define GL_ATI_texture_env_combine3 -#define _ALLEGRO_GL_ATI_texture_env_combine3 +#define _A5O_GL_ATI_texture_env_combine3 #define GL_MODULATE_ADD_ATI 0x8744 #define GL_MODULATE_SIGNED_ADD_ATI 0x8745 #define GL_MODULATE_SUBTRACT_ATI 0x8746 @@ -4370,7 +4370,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_ATI_texture_float #define GL_ATI_texture_float -#define _ALLEGRO_GL_ATI_texture_float +#define _A5O_GL_ATI_texture_float #define GL_RGBA_FLOAT32_ATI 0x8814 #define GL_RGB_FLOAT32_ATI 0x8815 #define GL_ALPHA_FLOAT32_ATI 0x8816 @@ -4387,7 +4387,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_NV_float_buffer #define GL_NV_float_buffer -#define _ALLEGRO_GL_NV_float_buffer +#define _A5O_GL_NV_float_buffer #define GL_FLOAT_R_NV 0x8880 #define GL_FLOAT_RG_NV 0x8881 #define GL_FLOAT_RGB_NV 0x8882 @@ -4407,7 +4407,7 @@ typedef struct __GLsync *GLsync; #ifndef GL_NV_fragment_program #define GL_NV_fragment_program -#define _ALLEGRO_GL_NV_fragment_program +#define _A5O_GL_NV_fragment_program #define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 #define GL_FRAGMENT_PROGRAM_NV 0x8870 #define GL_MAX_TEXTURE_COORDS_NV 0x8871 @@ -4418,14 +4418,14 @@ typedef struct __GLsync *GLsync; #ifndef GL_NV_half_float #define GL_NV_half_float -#define _ALLEGRO_GL_NV_half_float +#define _A5O_GL_NV_half_float typedef short GLhalfNV; #define GL_HALF_FLOAT_NV 0x140B #endif #ifndef GL_NV_pixel_data_range #define GL_NV_pixel_data_range -#define _ALLEGRO_GL_NV_pixel_data_range +#define _A5O_GL_NV_pixel_data_range #define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 #define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 #define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A @@ -4436,20 +4436,20 @@ typedef short GLhalfNV; #ifndef GL_NV_primitive_restart #define GL_NV_primitive_restart -#define _ALLEGRO_GL_NV_primitive_restart +#define _A5O_GL_NV_primitive_restart #define GL_PRIMITIVE_RESTART_NV 0x8558 #define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 #endif #ifndef GL_NV_texture_expand_normal #define GL_NV_texture_expand_normal -#define _ALLEGRO_GL_NV_texture_expand_normal +#define _A5O_GL_NV_texture_expand_normal #define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F #endif #ifndef GL_ATI_map_object_buffer #define GL_ATI_map_object_buffer -#define _ALLEGRO_GL_ATI_map_object_buffer +#define _A5O_GL_ATI_map_object_buffer #endif #ifndef GL_ATI_separate_stencil @@ -4462,18 +4462,18 @@ typedef short GLhalfNV; #ifndef GL_ATI_vertex_attrib_array_object #define GL_ATI_vertex_attrib_array_object -#define _ALLEGRO_GL_ATI_vertex_attrib_array_object +#define _A5O_GL_ATI_vertex_attrib_array_object #endif #ifndef GL_OES_byte_coordinates #define GL_OES_byte_coordinates -#define _ALLEGRO_GL_OES_byte_coordinates +#define _A5O_GL_OES_byte_coordinates /* GL_BYTE */ #endif #ifndef GL_OES_fixed_point #define GL_OES_fixed_point -#define _ALLEGRO_GL_OES_fixed_point +#define _A5O_GL_OES_fixed_point typedef int GLfixed; typedef int GLclampx; #define GL_FIXED_OES 0x140C @@ -4481,12 +4481,12 @@ typedef int GLclampx; #ifndef GL_OES_single_precision #define GL_OES_single_precision -#define _ALLEGRO_GL_OES_single_precision +#define _A5O_GL_OES_single_precision #endif #ifndef GL_OES_compressed_paletted_texture #define GL_OES_compressed_paletted_texture -#define _ALLEGRO_GL_OES_compressed_paletted_texture +#define _A5O_GL_OES_compressed_paletted_texture #define GL_PALETTE4_RGB8_OES 0x8B90 #define GL_PALETTE4_RGBA8_OES 0x8B91 #define GL_PALETTE4_R5_G6_B5_OES 0x8B92 @@ -4501,14 +4501,14 @@ typedef int GLclampx; #ifndef GL_OES_read_format #define GL_OES_read_format -#define _ALLEGRO_GL_OES_read_format +#define _A5O_GL_OES_read_format #define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A #define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B #endif #ifndef GL_OES_query_matrix #define GL_OES_query_matrix -#define _ALLEGRO_GL_OES_query_matrix +#define _A5O_GL_OES_query_matrix #endif #ifndef GL_OES_framebuffer_object @@ -4561,14 +4561,14 @@ typedef int GLclampx; #ifndef GL_EXT_depth_bounds_test #define GL_EXT_depth_bounds_test -#define _ALLEGRO_GL_EXT_depth_bounds_test +#define _A5O_GL_EXT_depth_bounds_test #define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 #define GL_DEPTH_BOUNDS_EXT 0x8891 #endif #ifndef GL_EXT_texture_mirror_clamp #define GL_EXT_texture_mirror_clamp -#define _ALLEGRO_GL_EXT_texture_mirror_clamp +#define _A5O_GL_EXT_texture_mirror_clamp #define GL_MIRROR_CLAMP_EXT 0x8742 #define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 #define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 @@ -4576,20 +4576,20 @@ typedef int GLclampx; #ifndef GL_EXT_blend_equation_separate #define GL_EXT_blend_equation_separate -#define _ALLEGRO_GL_EXT_blend_equation_separate +#define _A5O_GL_EXT_blend_equation_separate #define GL_BLEND_EQUATION_RGB_EXT 0x8009 /* Same as GL_BLEND_EQUATION */ #define GL_BLEND_EQUATION_ALPHA_EXT 0x883D #endif #ifndef GL_MESA_pack_invert #define GL_MESA_pack_invert -#define _ALLEGRO_GL_MESA_pack_invert +#define _A5O_GL_MESA_pack_invert #define GL_PACK_INVERT_MESA 0x8758 #endif #ifndef GL_MESA_ycbcr_texture #define GL_MESA_ycbcr_texture -#define _ALLEGRO_GL_MESA_ycbcr_texture +#define _A5O_GL_MESA_ycbcr_texture #define GL_YCBCR_MESA 0x8757 /* Same as GL_UNSIGNED_SHORT_8_8_APPLE and GL_UNSIGNED_SHORT_8_8_REV_APPLE */ #define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA @@ -4599,7 +4599,7 @@ typedef int GLclampx; #ifndef GL_EXT_pixel_buffer_object #define GL_EXT_pixel_buffer_object -#define _ALLEGRO_GL_EXT_pixel_buffer_object +#define _A5O_GL_EXT_pixel_buffer_object #define GL_PIXEL_PACK_BUFFER_EXT 0x88EB #define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC #define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED @@ -4610,14 +4610,14 @@ typedef int GLclampx; #ifndef GL_NV_fragment_program_option #define GL_NV_fragment_program_option -#define _ALLEGRO_GL_NV_fragment_program_option +#define _A5O_GL_NV_fragment_program_option #endif #ifndef GL_NV_fragment_program2 #define GL_NV_fragment_program2 -#define _ALLEGRO_GL_NV_fragment_program2 +#define _A5O_GL_NV_fragment_program2 #define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 #define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 #define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 @@ -4629,7 +4629,7 @@ typedef int GLclampx; #ifndef GL_NV_vertex_program2_option #define GL_NV_vertex_program2_option -#define _ALLEGRO_GL_NV_vertex_program2_option +#define _A5O_GL_NV_vertex_program2_option #define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 #define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 #endif @@ -4638,15 +4638,15 @@ typedef int GLclampx; #ifndef GL_NV_vertex_program3 #define GL_NV_vertex_program3 -#define _ALLEGRO_GL_NV_vertex_program3 +#define _A5O_GL_NV_vertex_program3 #define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C #endif #ifndef GL_EXT_texture_compression_dxt1 #define GL_EXT_texture_compression_dxt1 -#define _ALLEGRO_GL_EXT_texture_compression_dxt1 -#ifndef ALLEGRO_GL_EXT_texture_compression_s3tc +#define _A5O_GL_EXT_texture_compression_dxt1 +#ifndef A5O_GL_EXT_texture_compression_s3tc #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 #define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 #endif @@ -4655,7 +4655,7 @@ typedef int GLclampx; #ifndef GL_EXT_framebuffer_object #define GL_EXT_framebuffer_object -#define _ALLEGRO_GL_EXT_framebuffer_object +#define _A5O_GL_EXT_framebuffer_object #define GL_FRAMEBUFFER_EXT 0x8D40 #define GL_RENDERBUFFER_EXT 0x8D41 #define GL_STENCIL_INDEX_EXT 0x8D45 @@ -4709,13 +4709,13 @@ typedef int GLclampx; #ifndef GL_GREMEDY_string_marker #define GL_GREMEDY_string_marker -#define _ALLEGRO_GL_GREMEDY_string_marker +#define _A5O_GL_GREMEDY_string_marker #endif #ifndef GL_EXT_packed_depth_stencil #define GL_EXT_packed_depth_stencil -#define _ALLEGRO_GL_EXT_packed_depth_stencil +#define _A5O_GL_EXT_packed_depth_stencil #define GL_DEPTH_STENCIL_EXT 0x84F9 #define GL_UNSIGNED_INT_24_8_EXT 0x84FA #define GL_DEPTH24_STENCIL8_EXT 0x88F0 @@ -4724,14 +4724,14 @@ typedef int GLclampx; #ifndef GL_EXT_stencil_clear_tag #define GL_EXT_stencil_clear_tag -#define _ALLEGRO_GL_EXT_stencil_clear_tag +#define _A5O_GL_EXT_stencil_clear_tag #define GL_STENCIL_TAG_BITS_EXT 0x88F2 #define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3 #endif #ifndef GL_EXT_texture_sRGB #define GL_EXT_texture_sRGB -#define _ALLEGRO_GL_EXT_texture_sRGB +#define _A5O_GL_EXT_texture_sRGB #define GL_SRGB_EXT 0x8C40 #define GL_SRGB8_EXT 0x8C41 #define GL_SRGB_ALPHA_EXT 0x8C42 @@ -4752,7 +4752,7 @@ typedef int GLclampx; #ifndef GL_EXT_framebuffer_blit #define GL_EXT_framebuffer_blit -#define _ALLEGRO_GL_EXT_framebuffer_blit +#define _A5O_GL_EXT_framebuffer_blit #define GL_READ_FRAMEBUFFER_EXT 0x8CA8 #define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9 #define GL_READ_FRAMEBUFFER_BINDING_EXT GL_FRAMEBUFFER_BINDING_EXT @@ -4761,7 +4761,7 @@ typedef int GLclampx; #ifndef GL_EXT_framebuffer_multisample #define GL_EXT_framebuffer_multisample -#define _ALLEGRO_GL_EXT_framebuffer_multisample +#define _A5O_GL_EXT_framebuffer_multisample #define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 #define GL_MAX_SAMPLES_EXT 0x8D57 @@ -4769,7 +4769,7 @@ typedef int GLclampx; #ifndef GL_MESAX_texture_stack #define GL_MESAX_texture_stack -#define _ALLEGRO_GL_MESAX_texture_stack +#define _A5O_GL_MESAX_texture_stack #define GL_TEXTURE_1D_STACK_MESAX 0x8759 #define GL_TEXTURE_2D_STACK_MESAX 0x875A #define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B @@ -4780,7 +4780,7 @@ typedef int GLclampx; #ifndef GL_EXT_timer_query #define GL_EXT_timer_query -#define _ALLEGRO_GL_EXT_timer_query +#define _A5O_GL_EXT_timer_query #if (defined _MSC_VER) && (_MSC_VER < 1400) typedef __int64 GLint64EXT; typedef unsigned __int64 GLuint64EXT; @@ -4793,19 +4793,19 @@ typedef uint64_t GLuint64EXT; #ifndef GL_EXT_gpu_program_parameters #define GL_EXT_gpu_program_parameters -#define _ALLEGRO_GL_EXT_gpu_program_parameters +#define _A5O_GL_EXT_gpu_program_parameters #endif #ifndef GL_APPLE_flush_buffer_range #define GL_APPLE_flush_buffer_range -#define _ALLEGRO_GL_APPLE_flush_buffer_range +#define _A5O_GL_APPLE_flush_buffer_range #define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12 #define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13 #endif #ifndef GL_EXT_bindable_uniform #define GL_EXT_bindable_uniform -#define _ALLEGRO_GL_EXT_bindable_uniform +#define _A5O_GL_EXT_bindable_uniform #define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2 #define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3 #define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4 @@ -4816,24 +4816,24 @@ typedef uint64_t GLuint64EXT; #ifndef GL_EXT_draw_buffers2 #define GL_EXT_draw_buffers2 -#define _ALLEGRO_GL_EXT_draw_buffers2 +#define _A5O_GL_EXT_draw_buffers2 #endif #ifndef GL_EXT_draw_instanced #define GL_EXT_draw_instanced -#define _ALLEGRO_GL_EXT_draw_instanced +#define _A5O_GL_EXT_draw_instanced #endif #ifndef GL_EXT_framebuffer_sRGB #define GL_EXT_framebuffer_sRGB -#define _ALLEGRO_GL_EXT_framebuffer_sRGB +#define _A5O_GL_EXT_framebuffer_sRGB #define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 #define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA #endif #ifndef GL_EXT_geometry_shader4 #define GL_EXT_geometry_shader4 -#define _ALLEGRO_GL_EXT_geometry_shader4 +#define _A5O_GL_EXT_geometry_shader4 #define GL_GEOMETRY_SHADER_EXT 0x8DD9 #define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA #define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB @@ -4858,7 +4858,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_EXT_gpu_shader4 #define GL_EXT_gpu_shader4 -#define _ALLEGRO_GL_EXT_gpu_shader4 +#define _A5O_GL_EXT_gpu_shader4 #define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88FD #define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0 #define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1 @@ -4892,7 +4892,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_EXT_packed_float #define GL_EXT_packed_float -#define _ALLEGRO_GL_EXT_packed_float +#define _A5O_GL_EXT_packed_float #define GL_R11F_G11F_B10F_EXT 0x8C3A #define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B #define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C @@ -4900,7 +4900,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_EXT_texture_array #define GL_EXT_texture_array -#define _ALLEGRO_GL_EXT_texture_array +#define _A5O_GL_EXT_texture_array #define GL_TEXTURE_1D_ARRAY_EXT 0x8C18 #define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A #define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B @@ -4918,7 +4918,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_EXT_texture_buffer_object #define GL_EXT_texture_buffer_object -#define _ALLEGRO_GL_EXT_texture_buffer_object +#define _A5O_GL_EXT_texture_buffer_object #define GL_TEXTURE_BUFFER_EXT 0x8C2A #define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B #define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C @@ -4928,7 +4928,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_EXT_texture_compression_latc #define GL_EXT_texture_compression_latc -#define _ALLEGRO_GL_EXT_texture_compression_latc +#define _A5O_GL_EXT_texture_compression_latc #define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70 #define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71 #define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72 @@ -4937,7 +4937,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_EXT_texture_compression_rgtc #define GL_EXT_texture_compression_rgtc -#define _ALLEGRO_GL_EXT_texture_compression_rgtc +#define _A5O_GL_EXT_texture_compression_rgtc #define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB #define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC #define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD @@ -4946,7 +4946,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_EXT_texture_integer #define GL_EXT_texture_integer -#define _ALLEGRO_GL_EXT_texture_integer +#define _A5O_GL_EXT_texture_integer #define GL_RGBA_INTEGER_MODE_EXT 0x8D9E #define GL_RGBA32UI_EXT 0x8D70 #define GL_RGB32UI_EXT 0x8D71 @@ -4998,7 +4998,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_EXT_texture_shared_exponent #define GL_EXT_texture_shared_exponent -#define _ALLEGRO_GL_EXT_texture_shared_exponent +#define _A5O_GL_EXT_texture_shared_exponent #define GL_RGB9_E5_EXT 0x8C3D #define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E #define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F @@ -5006,7 +5006,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_NV_depth_buffer_float #define GL_NV_depth_buffer_float -#define _ALLEGRO_GL_NV_depth_buffer_float +#define _A5O_GL_NV_depth_buffer_float #define GL_DEPTH_COMPONENT32F_NV 0x8DAB #define GL_DEPTH32F_STENCIL8_NV 0x8DAC #define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD @@ -5015,19 +5015,19 @@ typedef uint64_t GLuint64EXT; #ifndef GL_NV_fragment_program4 #define GL_NV_fragment_program4 -#define _ALLEGRO_GL_NV_fragment_program4 +#define _A5O_GL_NV_fragment_program4 #endif #ifndef GL_NV_framebuffer_multisample_coverage #define GL_NV_framebuffer_multisample_coverage -#define _ALLEGRO_GL_NV_framebuffer_multisample_coverage +#define _A5O_GL_NV_framebuffer_multisample_coverage #define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB #define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10 #endif #ifndef GL_NV_geometry_program4 #define GL_NV_geometry_program4 -#define _ALLEGRO_GL_NV_geometry_program4 +#define _A5O_GL_NV_geometry_program4 #define GL_GEOMETRY_PROGRAM_NV 0x8C26 #define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27 #define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28 @@ -5050,7 +5050,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_NV_gpu_program4 #define GL_NV_gpu_program4 -#define _ALLEGRO_GL_NV_gpu_program4 +#define _A5O_GL_NV_gpu_program4 #define GL_MIN_PROGRAM_TEXEL_OFFSET_EXT 0x8904 #define GL_MAX_PROGRAM_TEXEL_OFFSET_EXT 0x8905 #define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906 @@ -5063,7 +5063,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_NV_parameter_buffer_object #define GL_NV_parameter_buffer_object -#define _ALLEGRO_GL_NV_parameter_buffer_object +#define _A5O_GL_NV_parameter_buffer_object #define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0 #define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1 #define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2 @@ -5073,7 +5073,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_NV_transform_feedback #define GL_NV_transform_feedback -#define _ALLEGRO_GL_NV_transform_feedback +#define _A5O_GL_NV_transform_feedback #define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E #define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84 #define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85 @@ -5111,7 +5111,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_NV_vertex_program4 #define GL_NV_vertex_program4 -#define _ALLEGRO_GL_NV_vertex_program4 +#define _A5O_GL_NV_vertex_program4 #if !defined GL_EXT_vertex_shader4 #define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88FD #endif @@ -5119,12 +5119,12 @@ typedef uint64_t GLuint64EXT; #ifndef GL_GREMEDY_frame_terminator #define GL_GREMEDY_frame_terminator -#define _ALLEGRO_GL_GREMEDY_frame_terminator +#define _A5O_GL_GREMEDY_frame_terminator #endif #ifndef GL_NV_conditional_render #define GL_NV_conditional_render -#define _ALLEGRO_GL_NV_conditional_render +#define _A5O_GL_NV_conditional_render #define GL_QUERY_WAIT_NV 0x8E13 #define GL_QUERY_NO_WAIT_NV 0x8E14 #define GL_QUERY_BY_REGION_WAIT_NV 0x8E15 @@ -5133,7 +5133,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_NV_present_video #define GL_NV_present_video -#define _ALLEGRO_GL_NV_present_video +#define _A5O_GL_NV_present_video #define GL_FRAME_NV 0x8E26 #define GL_FIELDS_NV 0x8E27 #define GL_CURRENT_TIME_NV 0x8E28 @@ -5144,7 +5144,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_EXT_transform_feedback #define GL_EXT_transform_feedback -#define _ALLEGRO_GL_EXT_transform_feedback +#define _A5O_GL_EXT_transform_feedback #define GL_TRANSFORM_FEEDBACK_BUFFER_EXT 0x8C8E #define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84 #define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85 @@ -5164,7 +5164,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_EXT_direct_state_access #define GL_EXT_direct_state_access -#define _ALLEGRO_GL_EXT_direct_state_access +#define _A5O_GL_EXT_direct_state_access #define GL_PROGRAM_MATRIX_EXT 0x8E2D #define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E #define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F @@ -5172,7 +5172,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_EXT_texture_swizzle #define GL_EXT_texture_swizzle -#define _ALLEGRO_GL_EXT_texture_swizzle +#define _A5O_GL_EXT_texture_swizzle #define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42 #define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43 #define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44 @@ -5182,7 +5182,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_NV_explicit_multisample #define GL_NV_explicit_multisample -#define _ALLEGRO_GL_NV_explicit_multisample +#define _A5O_GL_NV_explicit_multisample #define GL_SAMPLE_POSITION_NV 0x8E50 #define GL_SAMPLE_MASK_NV 0x8E51 #define GL_SAMPLE_MASK_VALUE_NV 0x8E52 @@ -5197,7 +5197,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_NV_transform_feedback2 #define GL_NV_transform_feedback2 -#define _ALLEGRO_GL_NV_transform_feedback2 +#define _A5O_GL_NV_transform_feedback2 #define GL_TRANSFORM_FEEDBACK_NV 0x8E22 #define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23 #define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24 @@ -5206,7 +5206,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_ATI_meminfo #define GL_ATI_meminfo -#define _ALLEGRO_GL_ATI_meminfo +#define _A5O_GL_ATI_meminfo #define GL_VBO_FREE_MEMORY_ATI 0x87FB #define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC #define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD @@ -5214,7 +5214,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_AMD_performance_monitor #define GL_AMD_performance_monitor -#define _ALLEGRO_GL_AMD_performance_monitor +#define _A5O_GL_AMD_performance_monitor #define GL_COUNTER_TYPE_AMD 0x8BC0 #define GL_COUNTER_RANGE_AMD 0x8BC1 #define GL_UNSIGNED_INT64_AMD 0x8BC2 @@ -5226,12 +5226,12 @@ typedef uint64_t GLuint64EXT; #ifndef GL_AMD_texture_texture4 #define GL_AMD_texture_texture4 -#define _ALLEGRO_GL_AMD_texture_texture4 +#define _A5O_GL_AMD_texture_texture4 #endif #ifndef GL_AMD_vertex_shader_tesselator #define GL_AMD_vertex_shader_tesselator -#define _ALLEGRO_GL_AMD_vertex_shader_tesselator +#define _A5O_GL_AMD_vertex_shader_tesselator #define GL_SAMPLER_BUFFER_AMD 0x9001 #define GL_INT_SAMPLER_BUFFER_AMD 0x9002 #define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003 @@ -5243,7 +5243,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_EXT_provoking_vertex #define GL_EXT_provoking_vertex -#define _ALLEGRO_GL_EXT_provoking_vertex +#define _A5O_GL_EXT_provoking_vertex #define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C #define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D #define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E @@ -5252,7 +5252,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_EXT_texture_snorm #define GL_EXT_texture_snorm -#define _ALLEGRO_GL_EXT_texture_snorm +#define _A5O_GL_EXT_texture_snorm #define GL_ALPHA_SNORM 0x9010 #define GL_LUMINANCE_SNORM 0x9011 #define GL_LUMINANCE_ALPHA_SNORM 0x9012 @@ -5282,12 +5282,12 @@ typedef uint64_t GLuint64EXT; #ifndef GL_AMD_draw_buffers_blend #define GL_AMD_draw_buffers_blend -#define _ALLEGRO_GL_AMD_draw_buffers_blend +#define _A5O_GL_AMD_draw_buffers_blend #endif #ifndef GL_APPLE_texture_range #define GL_APPLE_texture_range -#define _ALLEGRO_GL_APPLE_texture_range +#define _A5O_GL_APPLE_texture_range #define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7 #define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8 #define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC @@ -5298,7 +5298,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_APPLE_float_pixels #define GL_APPLE_float_pixels -#define _ALLEGRO_GL_APPLE_float_pixels +#define _A5O_GL_APPLE_float_pixels #define GL_HALF_APPLE 0x140B #define GL_RGBA_FLOAT32_APPLE 0x8814 #define GL_RGB_FLOAT32_APPLE 0x8815 @@ -5317,7 +5317,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_APPLE_vertex_program_evaluators #define GL_APPLE_vertex_program_evaluators -#define _ALLEGRO_GL_APPLE_vertex_program_evaluators +#define _A5O_GL_APPLE_vertex_program_evaluators #define GL_VERTEX_ATTRIB_MAP1_APPLE 0x8A00 #define GL_VERTEX_ATTRIB_MAP2_APPLE 0x8A01 #define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE 0x8A02 @@ -5332,13 +5332,13 @@ typedef uint64_t GLuint64EXT; #ifndef GL_APPLE_aux_depth_stencil #define GL_APPLE_aux_depth_stencil -#define _ALLEGRO_GL_APPLE_aux_depth_stencil +#define _A5O_GL_APPLE_aux_depth_stencil #define GL_AUX_DEPTH_STENCIL_APPLE 0x8A14 #endif #ifndef GL_APPLE_object_purgeable #define GL_APPLE_object_purgeable -#define _ALLEGRO_GL_APPLE_object_purgeable +#define _A5O_GL_APPLE_object_purgeable #define GL_BUFFER_OBJECT_APPLE 0x85B3 #define GL_RELEASED_APPLE 0x8A19 #define GL_VOLATILE_APPLE 0x8A1A @@ -5349,14 +5349,14 @@ typedef uint64_t GLuint64EXT; #ifndef GL_APPLE_row_bytes #define GL_APPLE_row_bytes -#define _ALLEGRO_GL_APPLE_row_bytes +#define _A5O_GL_APPLE_row_bytes #define GL_PACK_ROW_BYTES_APPLE 0x8A15 #define GL_UNPACK_ROW_BYTES_APPLE 0x8A16 #endif #ifndef GL_APPLE_rgb_422 #define GL_APPLE_rgb_422 -#define _ALLEGRO_GL_APPLE_rgb_422 +#define _A5O_GL_APPLE_rgb_422 #define GL_RGB_422_APPLE 0x8A1F /* reuse GL_UNSIGNED_SHORT_8_8_APPLE */ /* reuse GL_UNSIGNED_SHORT_8_8_REV_APPLE */ @@ -5364,7 +5364,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_NV_video_capture #define GL_NV_video_capture -#define _ALLEGRO_GL_NV_video_capture +#define _A5O_GL_NV_video_capture #define GL_VIDEO_BUFFER_NV 0x9020 #define GL_VIDEO_BUFFER_BINDING_NV 0x9021 #define GL_FIELD_UPPER_NV 0x9022 @@ -5398,18 +5398,18 @@ typedef uint64_t GLuint64EXT; #ifndef GL_EXT_separate_shader_objects #define GL_EXT_separate_shader_objects -#define _ALLEGRO_GL_EXT_separate_shader_objects +#define _A5O_GL_EXT_separate_shader_objects #define GL_ACTIVE_PROGRAM_EXT 0x8B8D #endif #ifndef GL_NV_parameter_buffer_object2 #define GL_NV_parameter_buffer_object2 -#define _ALLEGRO_GL_NV_parameter_buffer_object2 +#define _A5O_GL_NV_parameter_buffer_object2 #endif #ifndef GL_NV_shader_buffer_load #define GL_NV_shader_buffer_load -#define _ALLEGRO_GL_NV_shader_buffer_load +#define _A5O_GL_NV_shader_buffer_load #define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D #define GL_GPU_ADDRESS_NV 0x8F34 #define GL_MAX_SHADER_BUFFER_ADDRESS_NV 0x8F35 @@ -5417,7 +5417,7 @@ typedef uint64_t GLuint64EXT; #ifndef GL_NV_vertex_buffer_unified_memory #define GL_NV_vertex_buffer_unified_memory -#define _ALLEGRO_GL_NV_vertex_buffer_unified_memory +#define _A5O_GL_NV_vertex_buffer_unified_memory #define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E #define GL_ELEMENT_ARRAY_UNIFIED_NV 0x8F1F #define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20 @@ -5444,21 +5444,21 @@ typedef uint64_t GLuint64EXT; #ifndef GL_NV_texture_barrier #define GL_NV_texture_barrier -#define _ALLEGRO_GL_NV_texture_barrier +#define _A5O_GL_NV_texture_barrier #endif #ifndef GL_AMD_shader_stencil_export #define GL_AMD_shader_stencil_export -#define _ALLEGRO_GL_AMD_shader_stencil_export +#define _A5O_GL_AMD_shader_stencil_export #endif #ifndef GL_AMD_seamless_cubemap_per_texture #define GL_AMD_seamless_cubemap_per_texture -#define _ALLEGRO_GL_AMD_seamless_cubemap_per_texture +#define _A5O_GL_AMD_seamless_cubemap_per_texture /* reuse GL_TEXTURE_CUBE_MAP_SEAMLESS_ARB */ #endif #ifndef GL_AMD_conservative_depth #define GL_AMD_conservative_depth -#define _ALLEGRO_GL_AMD_conservative_depth +#define _A5O_GL_AMD_conservative_depth #endif diff --git a/include/allegro5/opengl/GLext/gl_ext_list.h b/include/allegro5/opengl/GLext/gl_ext_list.h index e4e4b3422f..fa2fc95764 100644 --- a/include/allegro5/opengl/GLext/gl_ext_list.h +++ b/include/allegro5/opengl/GLext/gl_ext_list.h @@ -302,7 +302,7 @@ AGL_EXT(MESAX_texture_stack, 0) AGL_EXT(EXT_timer_query, 0) AGL_EXT(EXT_gpu_program_parameters, 0) AGL_EXT(APPLE_flush_buffer_range, 0) -#ifdef ALLEGRO_MACOSX +#ifdef A5O_MACOSX AGL_EXT(EXT_texture_rectangle, 0) #endif AGL_EXT(EXT_bindable_uniform, 0) diff --git a/include/allegro5/opengl/GLext/glx_ext_alias.h b/include/allegro5/opengl/GLext/glx_ext_alias.h index 0194ccba9d..23a83a0557 100644 --- a/include/allegro5/opengl/GLext/glx_ext_alias.h +++ b/include/allegro5/opengl/GLext/glx_ext_alias.h @@ -1,5 +1,5 @@ /*Automatically generated by gl_mkalias.sh DO NOT EDIT!*/ -#ifdef _ALLEGRO_GLX_VERSION_1_3 +#ifdef _A5O_GLX_VERSION_1_3 /*GLX1.3*/ #define glXGetFBConfigs _al_glXGetFBConfigs #define glXChooseFBConfig _al_glXChooseFBConfig @@ -20,38 +20,38 @@ #define glXSelectEvent _al_glXSelectEvent #define glXGetSelectedEvent _al_glXGetSelectedEvent #endif -#ifdef _ALLEGRO_GLX_VERSION_1_4 +#ifdef _A5O_GLX_VERSION_1_4 /*GLX1.4*/ #define glXGetProcAddress _al_glXGetProcAddress #endif -#ifdef _ALLEGRO_GLX_ARB_get_proc_address +#ifdef _A5O_GLX_ARB_get_proc_address /*GLX_ARB_get_proc_address*/ #define glXGetProcAddressARB _al_glXGetProcAddressARB #endif -#ifdef _ALLEGRO_GLX_ARB_create_context +#ifdef _A5O_GLX_ARB_create_context #define glXCreateContextAttribsARB _al_glXCreateContextAttribsARB #endif -#ifdef _ALLEGRO_GLX_SGI_swap_control +#ifdef _A5O_GLX_SGI_swap_control /*GLX_SGI_swap_control*/ #define glXSwapIntervalSGI _al_glXSwapIntervalSGI #endif -#ifdef _ALLEGRO_GLX_SGI_video_sync +#ifdef _A5O_GLX_SGI_video_sync /*GLX_SGI_video_sync*/ #define glXGetVideoSyncSGI _al_glXGetVideoSyncSGI #define glXWaitVideoSyncSGI _al_glXWaitVideoSyncSGI #endif -#ifdef _ALLEGRO_GLX_SGI_make_current_read +#ifdef _A5O_GLX_SGI_make_current_read /*GLX_SGI_make_current_read*/ #define glXMakeCurrentReadSGI _al_glXMakeCurrentReadSGI #define glXGetCurrentReadDrawableSGI _al_glXGetCurrentReadDrawableSGI #endif -#ifdef _ALLEGRO_GLX_SGIX_video_source +#ifdef _A5O_GLX_SGIX_video_source /*GLX_SGIX_video_source*/ /*ThisoneneedsSGI'sheaderfiletobeincludedfirst*/ #ifdef _VL_H_ @@ -60,7 +60,7 @@ #endif #endif -#ifdef _ALLEGRO_GLX_EXT_import_context +#ifdef _A5O_GLX_EXT_import_context /*GLX_EXT_import_context*/ #define glXGetCurrentDisplayEXT _al_glXGetCurrentDisplayEXT #define glXQueryContextInfoEXT _al_glXQueryContextInfoEXT @@ -69,7 +69,7 @@ #define glXFreeContextEXT _al_glXFreeContextEXT #endif -#ifdef _ALLEGRO_GLX_SGIX_fbconfig +#ifdef _A5O_GLX_SGIX_fbconfig /*GLX_SGIX_fbconfig*/ #define glXGetFBConfigAttribSGIX _al_glXGetFBConfigAttribSGIX #define glXChooseFBConfigSGIX _al_glXChooseFBConfigSGIX @@ -79,7 +79,7 @@ #define glXGetFBConfigFromVisualSGIX _al_glXGetFBConfigFromVisualSGIX #endif -#ifdef _ALLEGRO_GLX_SGIX_pbuffer +#ifdef _A5O_GLX_SGIX_pbuffer /*GLX_SGIX_pbuffer*/ #define glXCreateGLXPbufferSGIX _al_glXCreateGLXPbufferSGIX #define glXDestroyGLXPbufferSGIX _al_glXDestroyGLXPbufferSGIX @@ -88,12 +88,12 @@ #define glXGetSelectedEventSGIX _al_glXGetSelectedEventSGIX #endif -#ifdef _ALLEGRO_GLX_SGI_cushion +#ifdef _A5O_GLX_SGI_cushion /*GLX_SGI_cushion*/ #define glXCushionSGI _al_glXCushionSGI #endif -#ifdef _ALLEGRO_GLX_SGIX_video_resize +#ifdef _A5O_GLX_SGIX_video_resize /*GLX_SGIX_video_resize*/ #define glXBindChannelToWindowSGIX _al_glXBindChannelToWindowSGIX #define glXChannelRectSGIX _al_glXChannelRectSGIX @@ -102,7 +102,7 @@ #define glXChannelRectSyncSGIX _al_glXChannelRectSyncSGIX #endif -#ifdef _ALLEGRO_GLX_SGIX_dmbuffer +#ifdef _A5O_GLX_SGIX_dmbuffer /*GLX_SGIX_dmbuffer*/ /*ThisoneneedsSGI'sheaderfiletobeincludedfirst*/ #ifdef _DM_BUFFER_H_ @@ -110,43 +110,43 @@ #endif #endif -#ifdef _ALLEGRO_GLX_SGIX_swap_group +#ifdef _A5O_GLX_SGIX_swap_group /*GLX_SGIX_swap_group*/ #define glXJoinSwapGroupSGIX _al_glXJoinSwapGroupSGIX #endif -#ifdef _ALLEGRO_GLX_SGIX_swap_barrier +#ifdef _A5O_GLX_SGIX_swap_barrier /*GLX_SGIX_swap_barrier*/ #define glXBindSwapBarrierSGIX _al_glXBindSwapBarrierSGIX #define glXQueryMaxSwapBarriersSGIX _al_glXQueryMaxSwapBarriersSGIX #endif -#ifdef _ALLEGRO_GLX_SUN_get_transparent_index +#ifdef _A5O_GLX_SUN_get_transparent_index /*GLX_SUN_get_transparent_index*/ #define glXGetTransparentIndexSUN _al_glXGetTransparentIndexSUN #endif -#ifdef _ALLEGRO_GLX_MESA_copy_sub_buffer +#ifdef _A5O_GLX_MESA_copy_sub_buffer /*GLX_MESA_copy_sub_buffer*/ #define glXCopySubBufferMESA _al_glXCopySubBufferMESA #endif -#ifdef _ALLEGRO_GLX_MESA_pixmap_colormap +#ifdef _A5O_GLX_MESA_pixmap_colormap /*GLX_MESA_pixmap_colormap*/ #define glXCreateGLXPixmapMESA _al_glXCreateGLXPixmapMESA #endif -#ifdef _ALLEGRO_GLX_MESA_release_buffers +#ifdef _A5O_GLX_MESA_release_buffers /*GLX_MESA_release_buffers*/ #define glXReleaseBuffersMESA _al_glXReleaseBuffersMESA #endif -#ifdef _ALLEGRO_GLX_MESA_set_3dfx_mode +#ifdef _A5O_GLX_MESA_set_3dfx_mode /*GLX_MESA_set_3dfx_mode*/ #define glXSet3DfxModeMESA _al_glXSet3DfxModeMESA #endif -#ifdef _ALLEGRO_GLX_OML_sync_control +#ifdef _A5O_GLX_OML_sync_control /*GLX_OML_sync_control*/ #define glXGetSyncValuesOML _al_glXGetSyncValuesOML #define glXGetMscRateOML _al_glXGetMscRateOML @@ -156,7 +156,7 @@ #endif -#ifdef _ALLEGRO_GLX_SGIX_hyperpipe +#ifdef _A5O_GLX_SGIX_hyperpipe #define glXQueryHyperpipeNetworkSGIX _al_glXQueryHyperpipeNetworkSGIX #define glXHyperpipeConfigSGIX _al_glXHyperpipeConfigSGIX #define glXQueryHyperpipeConfigSGIX _al_glXQueryHyperpipeConfigSGIX @@ -168,17 +168,17 @@ #endif -#ifdef _ALLEGRO_GLX_MESA_agp_offset +#ifdef _A5O_GLX_MESA_agp_offset #define glXGetAGPOffsetMESA _al_glXGetAGPOffsetMESA #endif -#ifdef _ALLEGRO_GLX_EXT_texture_from_pixmap +#ifdef _A5O_GLX_EXT_texture_from_pixmap #define glXBindTexImageEXT _al_glXBindTexImageEXT #define glXReleaseTextImageEXT _al_glXReleaseTextImageEXT #endif -#ifdef _ALLEGRO_GLX_NV_video_output +#ifdef _A5O_GLX_NV_video_output #define glXGetVideoDeviceNV _al_glXGetVideoDeviceNV #define glXReleaseVideoDeviceNV _al_glXReleaseVideoDeviceNV #define glXBindVideoImageNV _al_glXBindVideoImageNV @@ -187,7 +187,7 @@ #define glXGetVideoInfoNV _al_glXGetVideoInfoNV #endif -#ifdef _ALLEGRO_GLX_NV_swap_group +#ifdef _A5O_GLX_NV_swap_group #define glXJoinSwapGroupNV _al_glXJoinSwapGroupNV #define glXBindSwapBarrierNV _al_glXBindSwapBarrierNV #define glXQuerySwapGroupNV _al_glXQuerySwapGroupNV @@ -196,7 +196,7 @@ #define glXResetFrameCountNV _al_glXResetFrameCountNV #endif -#ifdef _ALLEGRO_GLX_NV_video_capture +#ifdef _A5O_GLX_NV_video_capture #define glXBindVideoCaptureDeviceNV _al_glXBindVideoCaptureDeviceNV #define glXEnumerateVideoCaptureDevicesNV _al_glXEnumerateVideoCaptureDevicesNV #define glXLockVideoCaptureDeviceNV _al_glXLockVideoCaptureDeviceNV @@ -204,14 +204,14 @@ #define glXReleaseVideoCaptureDeviceNV _al_glXReleaseVideoCaptureDeviceNV #endif -#ifdef _ALLEGRO_GLX_EXT_swap_control +#ifdef _A5O_GLX_EXT_swap_control #define glXSwapIntervalEXT _al_glXSwapIntervalEXT #endif -#ifdef _ALLEGRO_GLX_NV_copy_image +#ifdef _A5O_GLX_NV_copy_image #define glXCopyImageSubDataNV _al_glXCopyImageSubDataNV #endif -#ifdef _ALLEGRO_GLX_EXT_create_context_es_profile +#ifdef _A5O_GLX_EXT_create_context_es_profile //nofunctions #endif diff --git a/include/allegro5/opengl/GLext/glx_ext_api.h b/include/allegro5/opengl/GLext/glx_ext_api.h index 8694bc2f4a..91a87736d5 100644 --- a/include/allegro5/opengl/GLext/glx_ext_api.h +++ b/include/allegro5/opengl/GLext/glx_ext_api.h @@ -1,4 +1,4 @@ -#ifdef _ALLEGRO_GLX_VERSION_1_3 +#ifdef _A5O_GLX_VERSION_1_3 /* GLX 1.3 */ AGL_API(GLXFBConfig *, GetFBConfigs, (Display *, int, int *)) AGL_API(GLXFBConfig *, ChooseFBConfig, (Display *, int, const int *, int *)) @@ -19,38 +19,38 @@ AGL_API(int, QueryContext, (Display *, GLXContext, int, int *)) AGL_API(void, SelectEvent, (Display *, GLXDrawable, unsigned long)) AGL_API(void, GetSelectedEvent, (Display *, GLXDrawable, unsigned long *)) #endif -#ifdef _ALLEGRO_GLX_VERSION_1_4 +#ifdef _A5O_GLX_VERSION_1_4 /* GLX 1.4 */ AGL_API(__GLXextFuncPtr, GetProcAddress, (const GLubyte *)) #endif -#ifdef _ALLEGRO_GLX_ARB_get_proc_address +#ifdef _A5O_GLX_ARB_get_proc_address /* GLX_ARB_get_proc_address */ AGL_API(__GLXextFuncPtr, GetProcAddressARB, (const GLubyte *)) #endif -#ifdef _ALLEGRO_GLX_ARB_create_context +#ifdef _A5O_GLX_ARB_create_context AGL_API(GLXContext, CreateContextAttribsARB, (Display *, GLXFBConfig, GLXContext, Bool, const int *)) #endif -#ifdef _ALLEGRO_GLX_SGI_swap_control +#ifdef _A5O_GLX_SGI_swap_control /* GLX_SGI_swap_control */ AGL_API(int, SwapIntervalSGI, (int)) #endif -#ifdef _ALLEGRO_GLX_SGI_video_sync +#ifdef _A5O_GLX_SGI_video_sync /* GLX_SGI_video_sync */ AGL_API(int, GetVideoSyncSGI, (unsigned int *)) AGL_API(int, WaitVideoSyncSGI, (int, int, unsigned int *)) #endif -#ifdef _ALLEGRO_GLX_SGI_make_current_read +#ifdef _A5O_GLX_SGI_make_current_read /* GLX_SGI_make_current_read */ AGL_API(Bool, MakeCurrentReadSGI, (Display *, GLXDrawable, GLXDrawable, GLXContext)) AGL_API(GLXDrawable, GetCurrentReadDrawableSGI, (void)) #endif -#ifdef _ALLEGRO_GLX_SGIX_video_source +#ifdef _A5O_GLX_SGIX_video_source /* GLX_SGIX_video_source */ /* This one needs SGI's header file to be included first */ #ifdef _VL_H_ @@ -59,7 +59,7 @@ AGL_API(void, DestroyGLXVideoSourceSGIX, (Display *, GLXVideoSourceSGIX)) #endif #endif -#ifdef _ALLEGRO_GLX_EXT_import_context +#ifdef _A5O_GLX_EXT_import_context /* GLX_EXT_import_context */ AGL_API(Display *, GetCurrentDisplayEXT, (void)) AGL_API(int, QueryContextInfoEXT, (Display *, GLXContext, int, int *)) @@ -68,7 +68,7 @@ AGL_API(GLXContext, ImportContextEXT, (Display *, GLXContextID)) AGL_API(void, FreeContextEXT, (Display *, GLXContext)) #endif -#ifdef _ALLEGRO_GLX_SGIX_fbconfig +#ifdef _A5O_GLX_SGIX_fbconfig /* GLX_SGIX_fbconfig */ AGL_API(int, GetFBConfigAttribSGIX, (Display *, GLXFBConfigSGIX, int, int *)) AGL_API(GLXFBConfigSGIX *, ChooseFBConfigSGIX, (Display *, int, int *, int *)) @@ -78,7 +78,7 @@ AGL_API(XVisualInfo *, GetVisualFromFBConfigSGIX, (Display *, GLXFBConfigSGIX)) AGL_API(GLXFBConfigSGIX, GetFBConfigFromVisualSGIX, (Display *, XVisualInfo *)) #endif -#ifdef _ALLEGRO_GLX_SGIX_pbuffer +#ifdef _A5O_GLX_SGIX_pbuffer /* GLX_SGIX_pbuffer */ AGL_API(GLXPbufferSGIX, CreateGLXPbufferSGIX, (Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *)) AGL_API(void, DestroyGLXPbufferSGIX, (Display *, GLXPbufferSGIX)) @@ -87,12 +87,12 @@ AGL_API(void, SelectEventSGIX, (Display *, GLXDrawable, unsigned long)) AGL_API(void, GetSelectedEventSGIX, (Display *, GLXDrawable, unsigned long *)) #endif -#ifdef _ALLEGRO_GLX_SGI_cushion +#ifdef _A5O_GLX_SGI_cushion /* GLX_SGI_cushion */ AGL_API(void, CushionSGI, (Display *, Window, float)) #endif -#ifdef _ALLEGRO_GLX_SGIX_video_resize +#ifdef _A5O_GLX_SGIX_video_resize /* GLX_SGIX_video_resize */ AGL_API(int, BindChannelToWindowSGIX, (Display *, int, int, Window)) AGL_API(int, ChannelRectSGIX, (Display *, int, int, int, int, int, int)) @@ -101,7 +101,7 @@ AGL_API(int, QueryChannelDeltasSGIX, (Display *, int, int, int *, int *, int *, AGL_API(int, ChannelRectSyncSGIX, (Display *, int, int, GLenum)) #endif -#ifdef _ALLEGRO_GLX_SGIX_dmbuffer +#ifdef _A5O_GLX_SGIX_dmbuffer /* GLX_SGIX_dmbuffer */ /* This one needs SGI's header file to be included first */ #ifdef _DM_BUFFER_H_ @@ -109,43 +109,43 @@ AGL_API(Bool, AssociateDMPbufferSGIX, (Display *, GLXPbufferSGIX, DMparams *, DM #endif #endif -#ifdef _ALLEGRO_GLX_SGIX_swap_group +#ifdef _A5O_GLX_SGIX_swap_group /* GLX_SGIX_swap_group */ AGL_API(void, JoinSwapGroupSGIX, (Display *, GLXDrawable, GLXDrawable)) #endif -#ifdef _ALLEGRO_GLX_SGIX_swap_barrier +#ifdef _A5O_GLX_SGIX_swap_barrier /* GLX_SGIX_swap_barrier */ AGL_API(void, BindSwapBarrierSGIX, (Display *, GLXDrawable, int)) AGL_API(Bool, QueryMaxSwapBarriersSGIX, (Display *, int, int *)) #endif -#ifdef _ALLEGRO_GLX_SUN_get_transparent_index +#ifdef _A5O_GLX_SUN_get_transparent_index /* GLX_SUN_get_transparent_index */ AGL_API(Status, GetTransparentIndexSUN, (Display *, Window, Window, long *)) #endif -#ifdef _ALLEGRO_GLX_MESA_copy_sub_buffer +#ifdef _A5O_GLX_MESA_copy_sub_buffer /* GLX_MESA_copy_sub_buffer */ AGL_API(void, CopySubBufferMESA, (Display *, GLXDrawable, int, int, int, int)) #endif -#ifdef _ALLEGRO_GLX_MESA_pixmap_colormap +#ifdef _A5O_GLX_MESA_pixmap_colormap /* GLX_MESA_pixmap_colormap */ AGL_API(GLXPixmap, CreateGLXPixmapMESA, (Display *, XVisualInfo *, Pixmap, Colormap)) #endif -#ifdef _ALLEGRO_GLX_MESA_release_buffers +#ifdef _A5O_GLX_MESA_release_buffers /* GLX_MESA_release_buffers */ AGL_API(Bool, ReleaseBuffersMESA, (Display *, GLXDrawable)) #endif -#ifdef _ALLEGRO_GLX_MESA_set_3dfx_mode +#ifdef _A5O_GLX_MESA_set_3dfx_mode /* GLX_MESA_set_3dfx_mode */ AGL_API(Bool, Set3DfxModeMESA, (int)) #endif -#ifdef _ALLEGRO_GLX_OML_sync_control +#ifdef _A5O_GLX_OML_sync_control /* GLX_OML_sync_control */ AGL_API(Bool, GetSyncValuesOML, (Display *, GLXDrawable, int64_t *, int64_t *, int64_t *)) AGL_API(Bool, GetMscRateOML, (Display *, GLXDrawable, int32_t *, int32_t *)) @@ -155,7 +155,7 @@ AGL_API(Bool, WaitForSbcOML, (Display *, GLXDrawable, int64_t, int64_t *, int64_ #endif -#ifdef _ALLEGRO_GLX_SGIX_hyperpipe +#ifdef _A5O_GLX_SGIX_hyperpipe AGL_API(GLXHyperpipeNetworkSGIX *, QueryHyperpipeNetworkSGIX, (Display *dpy, int *npipes)) AGL_API(int, HyperpipeConfigSGIX, (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId)) AGL_API(GLXHyperpipeConfigSGIX *, QueryHyperpipeConfigSGIX, (Display *dpy, int hpId, int *npipes)) @@ -167,17 +167,17 @@ AGL_API(int, QueryHyperpipeAttribSGIX, (Display *dpy, int timeSlice, int attrib, #endif -#ifdef _ALLEGRO_GLX_MESA_agp_offset +#ifdef _A5O_GLX_MESA_agp_offset AGL_API(unsigned int, GetAGPOffsetMESA, (const void *pointer)) #endif -#ifdef _ALLEGRO_GLX_EXT_texture_from_pixmap +#ifdef _A5O_GLX_EXT_texture_from_pixmap AGL_API(void, BindTexImageEXT, (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list)) AGL_API(void, ReleaseTextImageEXT, (Display *dpy, GLXDrawable drawable, int buffer)) #endif -#ifdef _ALLEGRO_GLX_NV_video_output +#ifdef _A5O_GLX_NV_video_output AGL_API(int, GetVideoDeviceNV, (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice)) AGL_API(int, ReleaseVideoDeviceNV, (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice)) AGL_API(int, BindVideoImageNV, (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer)) @@ -186,7 +186,7 @@ AGL_API(int, SendPbufferToVideoNV, (Display *dpy, GLXPbuffer pbuf, int iBufferTy AGL_API(int, GetVideoInfoNV, (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputVideo, unsigned long *pulCounterOutputPbuffer)) #endif -#ifdef _ALLEGRO_GLX_NV_swap_group +#ifdef _A5O_GLX_NV_swap_group AGL_API(Bool, JoinSwapGroupNV, (Display *dpy, GLXDrawable drawable, GLuint group)) AGL_API(Bool, BindSwapBarrierNV, (Display *dpy, GLuint group, GLuint barrier)) AGL_API(Bool, QuerySwapGroupNV, (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier)) @@ -195,7 +195,7 @@ AGL_API(Bool, QueryFrameCountNV, (Display *dpy, int screen, GLuint *count)) AGL_API(Bool, ResetFrameCountNV, (Display *dpy, int screen)) #endif -#ifdef _ALLEGRO_GLX_NV_video_capture +#ifdef _A5O_GLX_NV_video_capture AGL_API(int, BindVideoCaptureDeviceNV, (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device)) AGL_API(GLXVideoCaptureDeviceNV *, EnumerateVideoCaptureDevicesNV, (Display *dpy, int screen, int *nelements)) AGL_API(void, LockVideoCaptureDeviceNV, (Display *dpy, GLXVideoCaptureDeviceNV device)) @@ -203,14 +203,14 @@ AGL_API(int, QueryVideoCaptureDeviceNV, (Display *dpy, GLXVideoCaptureDeviceNV d AGL_API(void, ReleaseVideoCaptureDeviceNV, (Display *dpy, GLXVideoCaptureDeviceNV device)) #endif -#ifdef _ALLEGRO_GLX_EXT_swap_control +#ifdef _A5O_GLX_EXT_swap_control AGL_API(int, SwapIntervalEXT, (Display *dpy, GLXDrawable drawable, int interval)) #endif -#ifdef _ALLEGRO_GLX_NV_copy_image +#ifdef _A5O_GLX_NV_copy_image AGL_API(void, CopyImageSubDataNV, (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth)) #endif -#ifdef _ALLEGRO_GLX_EXT_create_context_es_profile +#ifdef _A5O_GLX_EXT_create_context_es_profile // no functions #endif diff --git a/include/allegro5/opengl/GLext/glx_ext_defs.h b/include/allegro5/opengl/GLext/glx_ext_defs.h index fba8aea5de..5fe24b11bd 100644 --- a/include/allegro5/opengl/GLext/glx_ext_defs.h +++ b/include/allegro5/opengl/GLext/glx_ext_defs.h @@ -6,7 +6,7 @@ #undef __glx_glxext_h_ #ifndef GLX_VERSION_1_3 -#define _ALLEGRO_GLX_VERSION_1_3 +#define _A5O_GLX_VERSION_1_3 #define GLX_VERSION_1_3 #define GLX_WINDOW_BIT 0x00000001 #define GLX_PIXMAP_BIT 0x00000002 @@ -67,20 +67,20 @@ #endif #ifndef GLX_VERSION_1_4 -#define _ALLEGRO_GLX_VERSION_1_4 +#define _A5O_GLX_VERSION_1_4 #define GLX_VERSION_1_4 #define GLX_SAMPLE_BUFFERS 100000 #define GLX_SAMPLES 100001 #endif #ifndef GLX_ARB_get_proc_address -#define _ALLEGRO_GLX_ARB_get_proc_address +#define _A5O_GLX_ARB_get_proc_address #define GLX_ARB_get_proc_address typedef void (*__GLXextFuncPtr)(void); #endif #ifndef GLX_ARB_multisample -#define _ALLEGRO_GLX_ARB_multisample +#define _A5O_GLX_ARB_multisample #define GLX_ARB_multisample #define GLX_SAMPLE_BUFFERS_ARB 100000 #define GLX_SAMPLES_ARB 100001 @@ -88,20 +88,20 @@ typedef void (*__GLXextFuncPtr)(void); #ifndef GLX_ARB_vertex_buffer_object #define GLX_ARB_vertex_buffer_object -#define _ALLEGRO_GLX_ARB_vertex_buffer_object +#define _A5O_GLX_ARB_vertex_buffer_object #define GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 0x2095 #endif #ifndef GLX_ARB_fbconfig_float #define GLX_ARB_fbconfig_float -#define _ALLEGRO_GLX_ARB_fbconfig_float +#define _A5O_GLX_ARB_fbconfig_float #define GLX_RGBA_FLOAT_TYPE_ARB 0x20B9 #define GLX_RGBA_FLOAT_BIT_ARB 0x00000004 #endif #ifndef GLX_ARB_create_context #define GLX_ARB_create_context -#define _ALLEGRO_GLX_ARB_create_context +#define _A5O_GLX_ARB_create_context #define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001 #define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 #define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 @@ -111,14 +111,14 @@ typedef void (*__GLXextFuncPtr)(void); #ifndef GLX_ARB_create_context_profile #define GLX_ARB_create_context_profile -#define _ALLEGRO_GLX_ARB_create_context_profile +#define _A5O_GLX_ARB_create_context_profile #define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 #define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 #define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 #endif #ifndef GLX_SGIS_multisample -#define _ALLEGRO_GLX_SGIS_multisample +#define _A5O_GLX_SGIS_multisample #define GLX_SGIS_multisample #define GLX_SAMPLE_BUFFERS_SGIS 100000 #define GLX_SAMPLES_SGIS 100001 @@ -132,7 +132,7 @@ typedef void (*__GLXextFuncPtr)(void); #endif #ifndef GLX_EXT_visual_info -#define _ALLEGRO_GLX_EXT_visual_info +#define _A5O_GLX_EXT_visual_info #define GLX_EXT_visual_info #define GLX_X_VISUAL_TYPE_EXT 0x22 #define GLX_TRANSPARENT_TYPE_EXT 0x23 @@ -153,7 +153,7 @@ typedef void (*__GLXextFuncPtr)(void); #endif #ifndef GLX_EXT_visual_rating -#define _ALLEGRO_GLX_EXT_visual_rating +#define _A5O_GLX_EXT_visual_rating #define GLX_EXT_visual_rating #define GLX_VISUAL_CAVEAT_EXT 0x20 #define GLX_SLOW_VISUAL_EXT 0x8001 @@ -162,7 +162,7 @@ typedef void (*__GLXextFuncPtr)(void); #endif #ifndef GLX_EXT_import_context -#define _ALLEGRO_GLX_EXT_import_context +#define _A5O_GLX_EXT_import_context #define GLX_EXT_import_context #define GLX_SHARE_CONTEXT_EXT 0x800A #define GLX_VISUAL_ID_EXT 0x800B @@ -170,7 +170,7 @@ typedef void (*__GLXextFuncPtr)(void); #endif #ifndef GLX_SGIX_fbconfig -#define _ALLEGRO_GLX_SGIX_fbconfig +#define _A5O_GLX_SGIX_fbconfig #define GLX_SGIX_fbconfig typedef XID GLXFBConfigIDSGIX; typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; @@ -188,7 +188,7 @@ typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; #endif #ifndef GLX_SGIX_pbuffer -#define _ALLEGRO_GLX_SGIX_pbuffer +#define _A5O_GLX_SGIX_pbuffer #define GLX_SGIX_pbuffer typedef XID GLXPbufferSGIX; typedef struct { @@ -232,53 +232,53 @@ typedef struct { #endif #ifndef GLX_SGIX_video_resize -#define _ALLEGRO_GLX_SGIX_video_resize +#define _A5O_GLX_SGIX_video_resize #define GLX_SGIX_video_resize #define GLX_SYNC_FRAME_SGIX 0x00000000 #define GLX_SYNC_SWAP_SGIX 0x00000001 #endif #ifndef GLX_SGIX_dmbuffer -#define _ALLEGRO_GLX_SGIX_dmbuffer +#define _A5O_GLX_SGIX_dmbuffer #define GLX_SGIX_dmbuffer #define GLX_DIGITAL_MEDIA_PBUFFER_SGIX 0x8024 #endif #ifndef GLX_SGIS_blended_overlay -#define _ALLEGRO_GLX_SGIS_blended_overlay +#define _A5O_GLX_SGIS_blended_overlay #define GLX_SGIS_blended_overlay #define GLX_BLENDED_RGBA_SGIS 0x8025 #endif #ifndef GLX_SGIS_shared_multisample -#define _ALLEGRO_GLX_SGIS_shared_multisample +#define _A5O_GLX_SGIS_shared_multisample #define GLX_SGIS_shared_multisample #define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026 #define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027 #endif #ifndef GLX_3DFX_multisample -#define _ALLEGRO_GLX_3DFX_multisample +#define _A5O_GLX_3DFX_multisample #define GLX_3DFX_multisample #define GLX_SAMPLE_BUFFERS_3DFX 0x8050 #define GLX_SAMPLES_3DFX 0x8051 #endif #ifndef GLX_MESA_set_3dfx_mode -#define _ALLEGRO_GLX_MESA_set_3dfx_mode +#define _A5O_GLX_MESA_set_3dfx_mode #define GLX_MESA_set_3dfx_mode #define GLX_3DFX_WINDOW_MODE_MESA 0x1 #define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 #endif #ifndef GLX_SGIX_visual_select_group -#define _ALLEGRO_GLX_SGIX_visual_select_group +#define _A5O_GLX_SGIX_visual_select_group #define GLX_SGIX_visual_select_group #define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028 #endif #ifndef GLX_OML_swap_method -#define _ALLEGRO_GLX_OML_swap_method +#define _A5O_GLX_OML_swap_method #define GLX_OML_swap_method #define GLX_SWAP_METHOD_OML 0x8060 #define GLX_SWAP_EXCHANGE_OML 0x8061 @@ -287,69 +287,69 @@ typedef struct { #endif #ifndef GLX_SGIX_video_source -#define _ALLEGRO_GLX_SGIX_video_source +#define _A5O_GLX_SGIX_video_source #define GLX_SGIX_video_source typedef XID GLXVideoSourceSGIX; #endif #ifndef GLX_SGI_video_sync #define GLX_SGI_video_sync -#define _ALLEGRO_GLX_SGI_video_sync +#define _A5O_GLX_SGI_video_sync #endif #ifndef GLX_SGI_swap_control #define GLX_SGI_swap_control -#define _ALLEGRO_GLX_SGI_swap_control +#define _A5O_GLX_SGI_swap_control #endif #ifndef GLX_SGI_make_current_read #define GLX_SGI_make_current_read -#define _ALLEGRO_GLX_SGI_make_current_read +#define _A5O_GLX_SGI_make_current_read #endif #ifndef GLX_SGI_cushion #define GLX_SGI_cushion -#define _ALLEGRO_GLX_SGI_cushion +#define _A5O_GLX_SGI_cushion #endif #ifndef GLX_SGIX_swap_group #define GLX_SGIX_swap_group -#define _ALLEGRO_GLX_SGIX_swap_group +#define _A5O_GLX_SGIX_swap_group #endif #ifndef GLX_SGIX_swap_barrier #define GLX_SGIX_swap_barrier -#define _ALLEGRO_GLX_SGIX_swap_barrier +#define _A5O_GLX_SGIX_swap_barrier #endif #ifndef GLX_SUN_get_transparent_index #define GLX_SUN_get_transparent_index -#define _ALLEGRO_GLX_SUN_get_transparent_index +#define _A5O_GLX_SUN_get_transparent_index #endif #ifndef GLX_MESA_copy_sub_buffer #define GLX_MESA_copy_sub_buffer -#define _ALLEGRO_GLX_MESA_copy_sub_buffer +#define _A5O_GLX_MESA_copy_sub_buffer #endif #ifndef GLX_MESA_pixmap_colormap #define GLX_MESA_pixmap_colormap -#define _ALLEGRO_GLX_MESA_pixmap_colormap +#define _A5O_GLX_MESA_pixmap_colormap #endif #ifndef GLX_MESA_release_buffers #define GLX_MESA_release_buffers -#define _ALLEGRO_GLX_MESA_release_buffers +#define _A5O_GLX_MESA_release_buffers #endif #ifndef GLX_OML_sync_control #define GLX_OML_sync_control -#define _ALLEGRO_GLX_OML_sync_control +#define _A5O_GLX_OML_sync_control #endif #ifndef GLX_SGIX_hyperpipe #define GLX_SGIX_hyperpipe -#define _ALLEGRO_GLX_SGIX_hyperpipe +#define _A5O_GLX_SGIX_hyperpipe #define GLX_HYPERPIPE_ID_SGIX 0x8030 #define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80 #define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001 @@ -397,25 +397,25 @@ typedef struct { #ifndef GLX_MESA_agp_offset #define GLX_MESA_agp_offset -#define _ALLEGRO_GLX_MESA_agp_offset +#define _A5O_GLX_MESA_agp_offset #endif #ifndef GLX_EXT_framebuffer_sRGB #define GLX_EXT_framebuffer_sRGB -#define _ALLEGRO_GLX_EXT_framebuffer_sRGB +#define _A5O_GLX_EXT_framebuffer_sRGB #define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2 #endif #ifndef GLX_EXT_fbconfig_packed_float #define GLX_EXT_fbconfig_packed_float -#define _ALLEGRO_GLX_EXT_fbconfig_packed_float +#define _A5O_GLX_EXT_fbconfig_packed_float #define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1 #define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008 #endif #ifndef GLX_EXT_texture_from_pixmap #define GLX_EXT_texture_from_pixmap -#define _ALLEGRO_GLX_EXT_texture_from_pixmap +#define _A5O_GLX_EXT_texture_from_pixmap #define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 #define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 #define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 @@ -453,13 +453,13 @@ typedef struct { #ifndef GLX_NV_present_video #define GLX_NV_present_video -#define _ALLEGRO_GLX_NV_present_video +#define _A5O_GLX_NV_present_video #define GLX_GLX_NUM_VIDEO_SLOTS_NV 0x20F0 #endif #ifndef GLX_NV_video_output #define GLX_NV_video_output -#define _ALLEGRO_GLX_NV_video_output +#define _A5O_GLX_NV_video_output #define GLX_VIDEO_OUT_COLOR_NV 0x20C3 #define GLX_VIDEO_OUT_ALPHA_NV 0x20C4 #define GLX_VIDEO_OUT_DEPTH_NV 0x20C5 @@ -473,12 +473,12 @@ typedef unsigned int GLXVideoDeviceNV; #ifndef GLX_NV_swap_group #define GLX_NV_swap_group -#define _ALLEGRO_GLX_NV_swap_group +#define _A5O_GLX_NV_swap_group #endif #ifndef GLX_NV_video_capture #define GLX_NV_video_capture -#define _ALLEGRO_GLX_NV_video_capture +#define _A5O_GLX_NV_video_capture #define GLX_DEVICE_ID_NV 0x20CD #define GLX_UNIQUE_ID_NV 0x20CE #define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF @@ -487,19 +487,19 @@ typedef XID GLXVideoCaptureDeviceNV; #ifndef GLX_EXT_swap_control #define GLX_EXT_swap_control -#define _ALLEGRO_GLX_EXT_swap_control +#define _A5O_GLX_EXT_swap_control #define GLX_SWAP_INTERVAL_EXT 0x20F1 #define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2 #endif #ifndef GLX_NV_copy_image #define GLX_NV_copy_image -#define _ALLEGRO_GLX_NV_copy_image +#define _A5O_GLX_NV_copy_image #endif #ifndef GLX_INTEL_swap_event #define GLX_INTEL_swap_event -#define _ALLEGRO_GLX_INTEL_swap_event +#define _A5O_GLX_INTEL_swap_event #define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x04000000 #define GLX_EXCHANGE_COMPLETE_INTEL 0x8180 #define GLX_COPY_COMPLETE_INTEL 0x8181 @@ -509,7 +509,7 @@ typedef XID GLXVideoCaptureDeviceNV; #ifndef GLX_EXT_create_context_es_profile #define GLX_EXT_create_context_es_profile #define GLX_EXT_create_context_es2_profile -#define _ALLEGRO_GLX_EXT_create_context_es_profile +#define _A5O_GLX_EXT_create_context_es_profile #define GLX_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004 #define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004 #endif diff --git a/include/allegro5/opengl/gl_ext.h b/include/allegro5/opengl/gl_ext.h index 5c137486d8..347ce78c02 100644 --- a/include/allegro5/opengl/gl_ext.h +++ b/include/allegro5/opengl/gl_ext.h @@ -2,14 +2,14 @@ #ifndef __al_included_allegro5_gl_ext_h #define __al_included_allegro5_gl_ext_h -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_SRC) /* * MSVC declares the following extensions and MinGW doesn't. In order to * export the same symbols on both platforms we removed the extensions from * MSVC. */ -#ifdef ALLEGRO_MSVC +#ifdef A5O_MSVC #undef GL_EXT_vertex_array #undef GL_EXT_paletted_texture #undef GL_WIN_swap_hint @@ -24,12 +24,12 @@ * */ -#if !defined ALLEGRO_CFG_OPENGLES +#if !defined A5O_CFG_OPENGLES #include "allegro5/opengl/GLext/gl_ext_defs.h" #endif -#if defined ALLEGRO_WINDOWS && !defined ALLEGRO_EXCLUDE_WGL +#if defined A5O_WINDOWS && !defined A5O_EXCLUDE_WGL #include "allegro5/opengl/GLext/wgl_ext_defs.h" -#elif defined ALLEGRO_UNIX && !defined ALLEGRO_EXCLUDE_GLX +#elif defined A5O_UNIX && !defined A5O_EXCLUDE_GLX #include "allegro5/opengl/GLext/glx_ext_defs.h" #endif @@ -37,7 +37,7 @@ /* For example: * - * typedef void (APIENTRY * _ALLEGRO_glBlendEquation_t (GLenum); + * typedef void (APIENTRY * _A5O_glBlendEquation_t (GLenum); * */ @@ -46,15 +46,15 @@ #define APIENTRY_defined #endif -#define AGL_API(type, name, args) typedef type (APIENTRY * _ALLEGRO_gl##name##_t) args; +#define AGL_API(type, name, args) typedef type (APIENTRY * _A5O_gl##name##_t) args; # include "allegro5/opengl/GLext/gl_ext_api.h" #undef AGL_API -#ifdef ALLEGRO_WINDOWS -#define AGL_API(type, name, args) typedef type (APIENTRY * _ALLEGRO_wgl##name##_t) args; +#ifdef A5O_WINDOWS +#define AGL_API(type, name, args) typedef type (APIENTRY * _A5O_wgl##name##_t) args; # include "allegro5/opengl/GLext/wgl_ext_api.h" #undef AGL_API -#elif defined ALLEGRO_UNIX -#define AGL_API(type, name, args) typedef type (APIENTRY * _ALLEGRO_glX##name##_t) args; +#elif defined A5O_UNIX +#define AGL_API(type, name, args) typedef type (APIENTRY * _A5O_glX##name##_t) args; # include "allegro5/opengl/GLext/glx_ext_api.h" #undef AGL_API #endif @@ -69,21 +69,21 @@ /* For example: * * #define glBlendEquation _al_glBlendEquation - * extern _ALLEGRO_glBlendEquation_t _al_glBlendEquation; + * extern _A5O_glBlendEquation_t _al_glBlendEquation; * */ -#define AGL_API(type, name, args) AL_VAR(_ALLEGRO_gl##name##_t, _al_gl##name); +#define AGL_API(type, name, args) AL_VAR(_A5O_gl##name##_t, _al_gl##name); # include "allegro5/opengl/GLext/gl_ext_alias.h" # include "allegro5/opengl/GLext/gl_ext_api.h" #undef AGL_API -#ifdef ALLEGRO_WINDOWS -#define AGL_API(type, name, args) AL_VAR(_ALLEGRO_wgl##name##_t, _al_wgl##name); +#ifdef A5O_WINDOWS +#define AGL_API(type, name, args) AL_VAR(_A5O_wgl##name##_t, _al_wgl##name); # include "allegro5/opengl/GLext/wgl_ext_alias.h" # include "allegro5/opengl/GLext/wgl_ext_api.h" #undef AGL_API -#elif defined ALLEGRO_UNIX -#define AGL_API(type, name, args) extern _ALLEGRO_glX##name##_t _al_glX##name; +#elif defined A5O_UNIX +#define AGL_API(type, name, args) extern _A5O_glX##name##_t _al_glX##name; # include "allegro5/opengl/GLext/glx_ext_alias.h" # include "allegro5/opengl/GLext/glx_ext_api.h" #undef AGL_API @@ -92,52 +92,52 @@ /* A list of all supported extensions. * * For example: - * int ALLEGRO_GL_ARB_imaging; + * int A5O_GL_ARB_imaging; * */ -typedef struct ALLEGRO_OGL_EXT_LIST { -# define AGL_EXT(name, ver) int ALLEGRO_GL_##name; +typedef struct A5O_OGL_EXT_LIST { +# define AGL_EXT(name, ver) int A5O_GL_##name; # include "allegro5/opengl/GLext/gl_ext_list.h" # undef AGL_EXT -#ifdef ALLEGRO_UNIX -# define AGL_EXT(name, ver) int ALLEGRO_GLX_##name; +#ifdef A5O_UNIX +# define AGL_EXT(name, ver) int A5O_GLX_##name; # include "allegro5/opengl/GLext/glx_ext_list.h" # undef AGL_EXT -#elif defined ALLEGRO_WINDOWS -# define AGL_EXT(name, ver) int ALLEGRO_WGL_##name; +#elif defined A5O_WINDOWS +# define AGL_EXT(name, ver) int A5O_WGL_##name; # include "allegro5/opengl/GLext/wgl_ext_list.h" # undef AGL_EXT #endif -} ALLEGRO_OGL_EXT_LIST; +} A5O_OGL_EXT_LIST; /* GL extension Structure. Holds the pointers to all the functions * of all extensions, for a single context. * * Example: - * ALLEGRO_BlendEquation_t BlendEquation; + * A5O_BlendEquation_t BlendEquation; */ -typedef struct ALLEGRO_OGL_EXT_API { -#define AGL_API(type, name, args) _ALLEGRO_gl##name##_t name; +typedef struct A5O_OGL_EXT_API { +#define AGL_API(type, name, args) _A5O_gl##name##_t name; # include "allegro5/opengl/GLext/gl_ext_api.h" #undef AGL_API -#ifdef ALLEGRO_WINDOWS -#define AGL_API(type, name, args) _ALLEGRO_wgl##name##_t name; +#ifdef A5O_WINDOWS +#define AGL_API(type, name, args) _A5O_wgl##name##_t name; # include "allegro5/opengl/GLext/wgl_ext_api.h" #undef AGL_API -#elif defined ALLEGRO_UNIX -#define AGL_API(type, name, args) _ALLEGRO_glX##name##_t name; +#elif defined A5O_UNIX +#define AGL_API(type, name, args) _A5O_glX##name##_t name; # include "allegro5/opengl/GLext/glx_ext_api.h" #undef AGL_API #endif -} ALLEGRO_OGL_EXT_API; +} A5O_OGL_EXT_API; #else -typedef struct ALLEGRO_OGL_EXT_LIST ALLEGRO_OGL_EXT_LIST; +typedef struct A5O_OGL_EXT_LIST A5O_OGL_EXT_LIST; #endif diff --git a/include/allegro5/path.h b/include/allegro5/path.h index 0eb78c62d7..114490d482 100644 --- a/include/allegro5/path.h +++ b/include/allegro5/path.h @@ -9,45 +9,45 @@ #endif -#ifdef ALLEGRO_WINDOWS -# define ALLEGRO_NATIVE_PATH_SEP '\\' -# define ALLEGRO_NATIVE_DRIVE_SEP ':' +#ifdef A5O_WINDOWS +# define A5O_NATIVE_PATH_SEP '\\' +# define A5O_NATIVE_DRIVE_SEP ':' #else -# define ALLEGRO_NATIVE_PATH_SEP '/' -# define ALLEGRO_NATIVE_DRIVE_SEP '\0' +# define A5O_NATIVE_PATH_SEP '/' +# define A5O_NATIVE_DRIVE_SEP '\0' #endif -typedef struct ALLEGRO_PATH ALLEGRO_PATH; - -AL_FUNC(ALLEGRO_PATH*, al_create_path, (const char *str)); -AL_FUNC(ALLEGRO_PATH*, al_create_path_for_directory, (const char *str)); -AL_FUNC(ALLEGRO_PATH*, al_clone_path, (const ALLEGRO_PATH *path)); - -AL_FUNC(int, al_get_path_num_components, (const ALLEGRO_PATH *path)); -AL_FUNC(const char*, al_get_path_component, (const ALLEGRO_PATH *path, int i)); -AL_FUNC(void, al_replace_path_component, (ALLEGRO_PATH *path, int i, const char *s)); -AL_FUNC(void, al_remove_path_component, (ALLEGRO_PATH *path, int i)); -AL_FUNC(void, al_insert_path_component, (ALLEGRO_PATH *path, int i, const char *s)); -AL_FUNC(const char*, al_get_path_tail, (const ALLEGRO_PATH *path)); -AL_FUNC(void, al_drop_path_tail, (ALLEGRO_PATH *path)); -AL_FUNC(void, al_append_path_component, (ALLEGRO_PATH *path, const char *s)); -AL_FUNC(bool, al_join_paths, (ALLEGRO_PATH *path, const ALLEGRO_PATH *tail)); -AL_FUNC(bool, al_rebase_path, (const ALLEGRO_PATH *head, ALLEGRO_PATH *tail)); -AL_FUNC(const char*, al_path_cstr, (const ALLEGRO_PATH *path, char delim)); -AL_FUNC(const ALLEGRO_USTR*, al_path_ustr, (const ALLEGRO_PATH *path, char delim)); -AL_FUNC(void, al_destroy_path, (ALLEGRO_PATH *path)); - -AL_FUNC(void, al_set_path_drive, (ALLEGRO_PATH *path, const char *drive)); -AL_FUNC(const char*, al_get_path_drive, (const ALLEGRO_PATH *path)); - -AL_FUNC(void, al_set_path_filename, (ALLEGRO_PATH *path, const char *filename)); -AL_FUNC(const char*, al_get_path_filename, (const ALLEGRO_PATH *path)); - -AL_FUNC(const char*, al_get_path_extension, (const ALLEGRO_PATH *path)); -AL_FUNC(bool, al_set_path_extension, (ALLEGRO_PATH *path, char const *extension)); -AL_FUNC(const char*, al_get_path_basename, (const ALLEGRO_PATH *path)); - -AL_FUNC(bool, al_make_path_canonical, (ALLEGRO_PATH *path)); +typedef struct A5O_PATH A5O_PATH; + +AL_FUNC(A5O_PATH*, al_create_path, (const char *str)); +AL_FUNC(A5O_PATH*, al_create_path_for_directory, (const char *str)); +AL_FUNC(A5O_PATH*, al_clone_path, (const A5O_PATH *path)); + +AL_FUNC(int, al_get_path_num_components, (const A5O_PATH *path)); +AL_FUNC(const char*, al_get_path_component, (const A5O_PATH *path, int i)); +AL_FUNC(void, al_replace_path_component, (A5O_PATH *path, int i, const char *s)); +AL_FUNC(void, al_remove_path_component, (A5O_PATH *path, int i)); +AL_FUNC(void, al_insert_path_component, (A5O_PATH *path, int i, const char *s)); +AL_FUNC(const char*, al_get_path_tail, (const A5O_PATH *path)); +AL_FUNC(void, al_drop_path_tail, (A5O_PATH *path)); +AL_FUNC(void, al_append_path_component, (A5O_PATH *path, const char *s)); +AL_FUNC(bool, al_join_paths, (A5O_PATH *path, const A5O_PATH *tail)); +AL_FUNC(bool, al_rebase_path, (const A5O_PATH *head, A5O_PATH *tail)); +AL_FUNC(const char*, al_path_cstr, (const A5O_PATH *path, char delim)); +AL_FUNC(const A5O_USTR*, al_path_ustr, (const A5O_PATH *path, char delim)); +AL_FUNC(void, al_destroy_path, (A5O_PATH *path)); + +AL_FUNC(void, al_set_path_drive, (A5O_PATH *path, const char *drive)); +AL_FUNC(const char*, al_get_path_drive, (const A5O_PATH *path)); + +AL_FUNC(void, al_set_path_filename, (A5O_PATH *path, const char *filename)); +AL_FUNC(const char*, al_get_path_filename, (const A5O_PATH *path)); + +AL_FUNC(const char*, al_get_path_extension, (const A5O_PATH *path)); +AL_FUNC(bool, al_set_path_extension, (A5O_PATH *path, char const *extension)); +AL_FUNC(const char*, al_get_path_basename, (const A5O_PATH *path)); + +AL_FUNC(bool, al_make_path_canonical, (A5O_PATH *path)); #ifdef __cplusplus diff --git a/include/allegro5/platform/aintandroid.h b/include/allegro5/platform/aintandroid.h index 1767200b72..d87eb1831d 100644 --- a/include/allegro5/platform/aintandroid.h +++ b/include/allegro5/platform/aintandroid.h @@ -27,7 +27,7 @@ extern "C" { #include "allegro5/internal/aintern_system.h" #include "allegro5/internal/aintern_display.h" -ALLEGRO_PATH *_al_android_get_path(int id); +A5O_PATH *_al_android_get_path(int id); #ifdef __cplusplus } diff --git a/include/allegro5/platform/aintiphone.h b/include/allegro5/platform/aintiphone.h index f51f9a5199..75ead53d82 100644 --- a/include/allegro5/platform/aintiphone.h +++ b/include/allegro5/platform/aintiphone.h @@ -7,9 +7,9 @@ #include "allegro5/system.h" #include "allegro5/platform/aintunix.h" -ALLEGRO_DISPLAY_INTERFACE *_al_display_iphone(void); -ALLEGRO_SYSTEM_INTERFACE *_al_system_iphone(void); -ALLEGRO_PATH *_al_iphone_get_path(int id); +A5O_DISPLAY_INTERFACE *_al_display_iphone(void); +A5O_SYSTEM_INTERFACE *_al_system_iphone(void); +A5O_PATH *_al_iphone_get_path(int id); #endif diff --git a/include/allegro5/platform/aintlnx.h b/include/allegro5/platform/aintlnx.h index f0866e3448..a776e144bc 100644 --- a/include/allegro5/platform/aintlnx.h +++ b/include/allegro5/platform/aintlnx.h @@ -30,7 +30,7 @@ extern "C" { extern _AL_DRIVER_INFO _al_linux_keyboard_driver_list[]; extern _AL_DRIVER_INFO _al_linux_mouse_driver_list[]; -#ifdef ALLEGRO_RASPBERRYPI +#ifdef A5O_RASPBERRYPI #define AL_MOUSEDRV_LINUX_EVDEV AL_ID('E', 'V', 'D', 'V') #endif diff --git a/include/allegro5/platform/aintosx.h b/include/allegro5/platform/aintosx.h index b4fb301d32..53aa26b3ad 100644 --- a/include/allegro5/platform/aintosx.h +++ b/include/allegro5/platform/aintosx.h @@ -119,14 +119,14 @@ typedef struct HID_DEVICE_COLLECTION HID_DEVICE_COLLECTION; int _al_osx_bootstrap_ok(void); void _al_osx_tell_dock(void); -void _al_osx_keyboard_handler(int pressed, NSEvent *event, ALLEGRO_DISPLAY*); -void _al_osx_keyboard_modifiers(unsigned int new_mods, ALLEGRO_DISPLAY*); +void _al_osx_keyboard_handler(int pressed, NSEvent *event, A5O_DISPLAY*); +void _al_osx_keyboard_modifiers(unsigned int new_mods, A5O_DISPLAY*); void _al_osx_keyboard_focused(int focused, int state); -void _al_osx_mouse_generate_event(NSEvent*, ALLEGRO_DISPLAY*); +void _al_osx_mouse_generate_event(NSEvent*, A5O_DISPLAY*); void _al_osx_mouse_handler(NSEvent*); -int _al_osx_mouse_set_sprite(ALLEGRO_BITMAP *sprite, int x, int y); -int _al_osx_mouse_show(ALLEGRO_BITMAP *bmp, int x, int y); +int _al_osx_mouse_set_sprite(A5O_BITMAP *sprite, int x, int y); +int _al_osx_mouse_show(A5O_BITMAP *bmp, int x, int y); void _al_osx_mouse_hide(void); void _al_osx_mouse_move(int x, int y); @@ -134,33 +134,33 @@ HID_DEVICE_COLLECTION *_al_osx_hid_scan(int type, HID_DEVICE_COLLECTION*); void _al_osx_hid_free(HID_DEVICE_COLLECTION *); // Record in the keyboard state that the main window has changed -void _al_osx_switch_keyboard_focus(ALLEGRO_DISPLAY *, bool switch_in); +void _al_osx_switch_keyboard_focus(A5O_DISPLAY *, bool switch_in); // Record in the mouse state that the main window has changed -void _al_osx_switch_mouse_focus(ALLEGRO_DISPLAY *, bool switch_in); +void _al_osx_switch_mouse_focus(A5O_DISPLAY *, bool switch_in); // Clear the mouse state when a dialog closes in the dialog addon void _al_osx_clear_mouse_state(void); // Notify the display that the mouse driver was installed/uninstalled. void _al_osx_mouse_was_installed(BOOL); // Create and destroy mouse cursors -ALLEGRO_MOUSE_CURSOR *_al_osx_create_mouse_cursor(ALLEGRO_BITMAP *bmp, int x_focus, int y_focus); -void _al_osx_destroy_mouse_cursor(ALLEGRO_MOUSE_CURSOR *curs); +A5O_MOUSE_CURSOR *_al_osx_create_mouse_cursor(A5O_BITMAP *bmp, int x_focus, int y_focus); +void _al_osx_destroy_mouse_cursor(A5O_MOUSE_CURSOR *curs); // Notify the display that the keyboard driver was installed/uninstalled. void _al_osx_keyboard_was_installed(BOOL); // Notify that the quit menu was clicked void _al_osx_post_quit(void); // Get the underlying view -NSView* _al_osx_view_from_display(ALLEGRO_DISPLAY*); +NSView* _al_osx_view_from_display(A5O_DISPLAY*); // Create an image from an allegro bitmap -NSImage* NSImageFromAllegroBitmap(ALLEGRO_BITMAP* bmp); +NSImage* NSImageFromAllegroBitmap(A5O_BITMAP* bmp); // Get the y coordinate of the upper-left corner of the primary display. int _al_osx_get_primary_screen_y(void); // Get the global scale factor. float _al_osx_get_global_scale_factor(void); // Drivers -AL_FUNC(ALLEGRO_KEYBOARD_DRIVER*, _al_osx_get_keyboard_driver, (void)); -AL_FUNC(ALLEGRO_DISPLAY_INTERFACE*, _al_osx_get_display_driver, (void)); -AL_FUNC(ALLEGRO_MOUSE_DRIVER*, _al_osx_get_mouse_driver, (void)); -AL_FUNC(ALLEGRO_JOYSTICK_DRIVER*, _al_osx_get_joystick_driver, (void)); +AL_FUNC(A5O_KEYBOARD_DRIVER*, _al_osx_get_keyboard_driver, (void)); +AL_FUNC(A5O_DISPLAY_INTERFACE*, _al_osx_get_display_driver, (void)); +AL_FUNC(A5O_MOUSE_DRIVER*, _al_osx_get_mouse_driver, (void)); +AL_FUNC(A5O_JOYSTICK_DRIVER*, _al_osx_get_joystick_driver, (void)); #endif AL_FUNC(int, _al_osx_run_main, (int argc, char **argv, diff --git a/include/allegro5/platform/aintraspberrypi.h b/include/allegro5/platform/aintraspberrypi.h index ec46db2137..f138df9aab 100644 --- a/include/allegro5/platform/aintraspberrypi.h +++ b/include/allegro5/platform/aintraspberrypi.h @@ -26,7 +26,7 @@ extern "C" { #include "allegro5/internal/aintern_keyboard.h" -ALLEGRO_KEYBOARD_DRIVER *_al_xwin_keyboard_driver(void); +A5O_KEYBOARD_DRIVER *_al_xwin_keyboard_driver(void); #ifdef __cplusplus } diff --git a/include/allegro5/platform/aintunix.h b/include/allegro5/platform/aintunix.h index 6126c4e79e..b99ec50ef2 100644 --- a/include/allegro5/platform/aintunix.h +++ b/include/allegro5/platform/aintunix.h @@ -23,7 +23,7 @@ #include "allegro5/internal/aintern_driver.h" /* Need right now for XKeyEvent --pw */ -#ifdef ALLEGRO_WITH_XWINDOWS +#ifdef A5O_WITH_XWINDOWS #include #endif @@ -31,10 +31,10 @@ extern "C" { #endif -ALLEGRO_PATH *_al_unix_get_path(int id); +A5O_PATH *_al_unix_get_path(int id); double _al_unix_get_time(void); void _al_unix_rest(double seconds); -void _al_unix_init_timeout(ALLEGRO_TIMEOUT *timeout, double seconds); +void _al_unix_init_timeout(A5O_TIMEOUT *timeout, double seconds); #ifdef __cplusplus @@ -42,7 +42,7 @@ void _al_unix_init_timeout(ALLEGRO_TIMEOUT *timeout, double seconds); #endif -#ifdef ALLEGRO_LINUX +#ifdef A5O_LINUX #include "allegro5/platform/aintlnx.h" #endif @@ -72,18 +72,18 @@ void _al_unix_stop_watching_fd(int fd); /* ljoynu.c */ /* This isn't in aintlnx.h because it's needed for the X11 port as well. */ -#define _ALLEGRO_JOYDRV_LINUX AL_ID('L','N','X','A') +#define _A5O_JOYDRV_LINUX AL_ID('L','N','X','A') -#ifdef ALLEGRO_HAVE_LINUX_INPUT_H -AL_VAR(struct ALLEGRO_JOYSTICK_DRIVER, _al_joydrv_linux); +#ifdef A5O_HAVE_LINUX_INPUT_H +AL_VAR(struct A5O_JOYSTICK_DRIVER, _al_joydrv_linux); #endif /* lhaptic.c */ /* This isn't in aintlnx.h because it's needed for the X11 port as well. */ -#define _ALLEGRO_HAPDRV_LINUX AL_ID('L','N','X','H') +#define _A5O_HAPDRV_LINUX AL_ID('L','N','X','H') -#ifdef ALLEGRO_HAVE_LINUX_INPUT_H -AL_VAR(struct ALLEGRO_HAPTIC_DRIVER, _al_hapdrv_linux); +#ifdef A5O_HAVE_LINUX_INPUT_H +AL_VAR(struct A5O_HAPTIC_DRIVER, _al_hapdrv_linux); #endif diff --git a/include/allegro5/platform/aintuthr.h b/include/allegro5/platform/aintuthr.h index 809753ae67..1627d7d01f 100644 --- a/include/allegro5/platform/aintuthr.h +++ b/include/allegro5/platform/aintuthr.h @@ -38,8 +38,8 @@ struct _AL_COND pthread_cond_t cond; }; -typedef struct ALLEGRO_TIMEOUT_UNIX ALLEGRO_TIMEOUT_UNIX; -struct ALLEGRO_TIMEOUT_UNIX +typedef struct A5O_TIMEOUT_UNIX A5O_TIMEOUT_UNIX; +struct A5O_TIMEOUT_UNIX { struct timespec abstime; }; diff --git a/include/allegro5/platform/aintwin.h b/include/allegro5/platform/aintwin.h index a2b6a93fe0..f347c215f0 100644 --- a/include/allegro5/platform/aintwin.h +++ b/include/allegro5/platform/aintwin.h @@ -22,7 +22,7 @@ #error must include allegro.h first #endif -#ifndef ALLEGRO_WINDOWS +#ifndef A5O_WINDOWS #error bad include #endif @@ -43,24 +43,24 @@ /* user defined hooks into the main win32 event loop */ -typedef bool (*ALLEGRO_DISPLAY_WIN_CALLBACK_PROC) - (ALLEGRO_DISPLAY *, UINT, WPARAM, LPARAM, LRESULT*, void *); +typedef bool (*A5O_DISPLAY_WIN_CALLBACK_PROC) + (A5O_DISPLAY *, UINT, WPARAM, LPARAM, LRESULT*, void *); -typedef struct ALLEGRO_DISPLAY_WIN_CALLBACK ALLEGRO_DISPLAY_WIN_CALLBACK; +typedef struct A5O_DISPLAY_WIN_CALLBACK A5O_DISPLAY_WIN_CALLBACK; -struct ALLEGRO_DISPLAY_WIN_CALLBACK +struct A5O_DISPLAY_WIN_CALLBACK { - ALLEGRO_DISPLAY_WIN_CALLBACK_PROC proc; + A5O_DISPLAY_WIN_CALLBACK_PROC proc; void *userdata; }; /* the extended display struct for Windows */ -typedef struct ALLEGRO_DISPLAY_WIN ALLEGRO_DISPLAY_WIN; +typedef struct A5O_DISPLAY_WIN A5O_DISPLAY_WIN; -struct ALLEGRO_DISPLAY_WIN +struct A5O_DISPLAY_WIN { - ALLEGRO_DISPLAY display; + A5O_DISPLAY display; HWND window; HCURSOR mouse_selected_hcursor; @@ -112,33 +112,33 @@ struct ALLEGRO_DISPLAY_WIN /* standard path */ -ALLEGRO_PATH *_al_win_get_path(int id); +A5O_PATH *_al_win_get_path(int id); /* thread routines */ void _al_win_thread_init(void); void _al_win_thread_exit(void); /* input routines */ -void _al_win_grab_input(ALLEGRO_DISPLAY_WIN *win_disp); +void _al_win_grab_input(A5O_DISPLAY_WIN *win_disp); /* keyboard routines */ void _al_win_kbd_handle_key_press(int scode, int vcode, bool extended, - bool repeated, ALLEGRO_DISPLAY_WIN *win_disp); + bool repeated, A5O_DISPLAY_WIN *win_disp); void _al_win_kbd_handle_key_release(int scode, int vcode, bool extended, - ALLEGRO_DISPLAY_WIN *win_disp); + A5O_DISPLAY_WIN *win_disp); void _al_win_fix_modifiers(void); /* mouse routines */ -void _al_win_mouse_handle_move(int x, int y, bool abs, ALLEGRO_DISPLAY_WIN *win_disp); -void _al_win_mouse_handle_wheel(int raw_dz, bool abs, ALLEGRO_DISPLAY_WIN *win_disp); -void _al_win_mouse_handle_hwheel(int raw_dw, bool abs, ALLEGRO_DISPLAY_WIN *win_disp); -void _al_win_mouse_handle_button(int button, bool down, int x, int y, bool abs, ALLEGRO_DISPLAY_WIN *win_disp); -void _al_win_mouse_handle_leave(ALLEGRO_DISPLAY_WIN *win_display); -void _al_win_mouse_handle_enter(ALLEGRO_DISPLAY_WIN *win_display); +void _al_win_mouse_handle_move(int x, int y, bool abs, A5O_DISPLAY_WIN *win_disp); +void _al_win_mouse_handle_wheel(int raw_dz, bool abs, A5O_DISPLAY_WIN *win_disp); +void _al_win_mouse_handle_hwheel(int raw_dw, bool abs, A5O_DISPLAY_WIN *win_disp); +void _al_win_mouse_handle_button(int button, bool down, int x, int y, bool abs, A5O_DISPLAY_WIN *win_disp); +void _al_win_mouse_handle_leave(A5O_DISPLAY_WIN *win_display); +void _al_win_mouse_handle_enter(A5O_DISPLAY_WIN *win_display); /* joystick routines */ void _al_win_joystick_dinput_unacquire(void *unused); -void _al_win_joystick_dinput_grab(void *ALLEGRO_DISPLAY_WIN); +void _al_win_joystick_dinput_grab(void *A5O_DISPLAY_WIN); /* custom Allegro messages */ extern UINT _al_win_msg_call_proc; @@ -167,75 +167,75 @@ void _al_win_shutdown_time(void); } u; \ u.p = (ptr); -typedef struct ALLEGRO_SYSTEM_WIN ALLEGRO_SYSTEM_WIN; -/* This is our version of ALLEGRO_SYSTEM with driver specific extra data. */ -struct ALLEGRO_SYSTEM_WIN +typedef struct A5O_SYSTEM_WIN A5O_SYSTEM_WIN; +/* This is our version of A5O_SYSTEM with driver specific extra data. */ +struct A5O_SYSTEM_WIN { - ALLEGRO_SYSTEM system; /* This must be the first member, we "derive" from it. */ - ALLEGRO_DISPLAY *mouse_grab_display; /* May be inaccurate. */ + A5O_SYSTEM system; /* This must be the first member, we "derive" from it. */ + A5O_DISPLAY *mouse_grab_display; /* May be inaccurate. */ int toggle_mouse_grab_keycode; /* Disabled if zero. */ unsigned int toggle_mouse_grab_modifiers; }; /* helpers to create windows */ -HWND _al_win_create_window(ALLEGRO_DISPLAY *display, int width, int height, int flags); -HWND _al_win_create_faux_fullscreen_window(LPCTSTR devname, ALLEGRO_DISPLAY *display, +HWND _al_win_create_window(A5O_DISPLAY *display, int width, int height, int flags); +HWND _al_win_create_faux_fullscreen_window(LPCTSTR devname, A5O_DISPLAY *display, int x1, int y1, int width, int height, int refresh_rate, int flags); int _al_win_init_window(void); void _al_win_shutdown_window(void); HWND _al_win_create_hidden_window(void); -void _al_win_post_create_window(ALLEGRO_DISPLAY *display); +void _al_win_post_create_window(A5O_DISPLAY *display); /* icon helpers */ -void _al_win_set_display_icons(ALLEGRO_DISPLAY *display, int num_icons, ALLEGRO_BITMAP *bitmap[]); -HICON _al_win_create_icon(HWND wnd, ALLEGRO_BITMAP *sprite, int xfocus, int yfocus, bool is_cursor, bool resize); -void _al_win_destroy_display_icons(ALLEGRO_DISPLAY *display); +void _al_win_set_display_icons(A5O_DISPLAY *display, int num_icons, A5O_BITMAP *bitmap[]); +HICON _al_win_create_icon(HWND wnd, A5O_BITMAP *sprite, int xfocus, int yfocus, bool is_cursor, bool resize); +void _al_win_destroy_display_icons(A5O_DISPLAY *display); /* window decorations */ void _al_win_set_window_position(HWND window, int x, int y); void _al_win_get_window_position(HWND window, int *x, int *y); -bool _al_win_get_window_borders(ALLEGRO_DISPLAY *display, int *left, int *top, int *right, int *bottom); -bool _al_win_set_window_constraints(ALLEGRO_DISPLAY *display, int min_w, int min_h, int max_w, int max_h); -bool _al_win_get_window_constraints(ALLEGRO_DISPLAY *display, int *min_w, int *min_h, int *max_w, int *max_h); -void _al_win_apply_window_constraints(ALLEGRO_DISPLAY *display, bool onoff); -void _al_win_set_window_frameless(ALLEGRO_DISPLAY *display, HWND window, bool frameless); -bool _al_win_set_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff); -void _al_win_set_window_title(ALLEGRO_DISPLAY *display, const char *title); +bool _al_win_get_window_borders(A5O_DISPLAY *display, int *left, int *top, int *right, int *bottom); +bool _al_win_set_window_constraints(A5O_DISPLAY *display, int min_w, int min_h, int max_w, int max_h); +bool _al_win_get_window_constraints(A5O_DISPLAY *display, int *min_w, int *min_h, int *max_w, int *max_h); +void _al_win_apply_window_constraints(A5O_DISPLAY *display, bool onoff); +void _al_win_set_window_frameless(A5O_DISPLAY *display, HWND window, bool frameless); +bool _al_win_set_display_flag(A5O_DISPLAY *display, int flag, bool onoff); +void _al_win_set_window_title(A5O_DISPLAY *display, const char *title); /* cursor routines */ -typedef struct ALLEGRO_MOUSE_CURSOR_WIN ALLEGRO_MOUSE_CURSOR_WIN; -struct ALLEGRO_MOUSE_CURSOR_WIN +typedef struct A5O_MOUSE_CURSOR_WIN A5O_MOUSE_CURSOR_WIN; +struct A5O_MOUSE_CURSOR_WIN { HCURSOR hcursor; }; -ALLEGRO_MOUSE_CURSOR* _al_win_create_mouse_cursor(ALLEGRO_BITMAP *sprite, int xfocus, int yfocus); -void _al_win_destroy_mouse_cursor(ALLEGRO_MOUSE_CURSOR *cursor); -bool _al_win_set_mouse_cursor(ALLEGRO_DISPLAY *display, ALLEGRO_MOUSE_CURSOR *cursor); -bool _al_win_set_system_mouse_cursor(ALLEGRO_DISPLAY *display, ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id); -bool _al_win_show_mouse_cursor(ALLEGRO_DISPLAY *display); -bool _al_win_hide_mouse_cursor(ALLEGRO_DISPLAY *display); +A5O_MOUSE_CURSOR* _al_win_create_mouse_cursor(A5O_BITMAP *sprite, int xfocus, int yfocus); +void _al_win_destroy_mouse_cursor(A5O_MOUSE_CURSOR *cursor); +bool _al_win_set_mouse_cursor(A5O_DISPLAY *display, A5O_MOUSE_CURSOR *cursor); +bool _al_win_set_system_mouse_cursor(A5O_DISPLAY *display, A5O_SYSTEM_MOUSE_CURSOR cursor_id); +bool _al_win_show_mouse_cursor(A5O_DISPLAY *display); +bool _al_win_hide_mouse_cursor(A5O_DISPLAY *display); /* driver specific functions */ -#if defined ALLEGRO_CFG_D3D - ALLEGRO_DISPLAY_INTERFACE* _al_display_d3d_driver(void); +#if defined A5O_CFG_D3D + A5O_DISPLAY_INTERFACE* _al_display_d3d_driver(void); int _al_d3d_get_num_display_modes(int format, int refresh_rate, int flags); - ALLEGRO_DISPLAY_MODE* _al_d3d_get_display_mode(int index, int format, + A5O_DISPLAY_MODE* _al_d3d_get_display_mode(int index, int format, int refresh_rate, int flags, - ALLEGRO_DISPLAY_MODE *mode); + A5O_DISPLAY_MODE *mode); void _al_d3d_shutdown_display(void); -#endif /* defined ALLEGRO_CFG_D3D */ +#endif /* defined A5O_CFG_D3D */ -#if defined ALLEGRO_CFG_OPENGL - ALLEGRO_DISPLAY_INTERFACE *_al_display_wgl_driver(void); +#if defined A5O_CFG_OPENGL + A5O_DISPLAY_INTERFACE *_al_display_wgl_driver(void); int _al_wgl_get_num_display_modes(int format, int refresh_rate, int flags); - ALLEGRO_DISPLAY_MODE* _al_wgl_get_display_mode(int index, int format, + A5O_DISPLAY_MODE* _al_wgl_get_display_mode(int index, int format, int refresh_rate, int flags, - ALLEGRO_DISPLAY_MODE *mode); -#endif /* defined ALLEGRO_CFG_OPENGL */ + A5O_DISPLAY_MODE *mode); +#endif /* defined A5O_CFG_OPENGL */ /* touch input specific API */ @@ -294,10 +294,10 @@ extern UNREGISTERTOUCHWINDOWPROC _al_win_unregister_touch_window; /* touch input routines */ void _al_win_touch_input_set_time_stamp(size_t timestamp); -void _al_win_touch_input_handle_begin(int id, size_t timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY_WIN *win_disp); -void _al_win_touch_input_handle_end(int id, size_t timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY_WIN *win_disp); -void _al_win_touch_input_handle_move(int id, size_t timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY_WIN *win_disp); -void _al_win_touch_input_handle_cancel(int id, size_t timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY_WIN *win_disp); +void _al_win_touch_input_handle_begin(int id, size_t timestamp, float x, float y, bool primary, A5O_DISPLAY_WIN *win_disp); +void _al_win_touch_input_handle_end(int id, size_t timestamp, float x, float y, bool primary, A5O_DISPLAY_WIN *win_disp); +void _al_win_touch_input_handle_move(int id, size_t timestamp, float x, float y, bool primary, A5O_DISPLAY_WIN *win_disp); +void _al_win_touch_input_handle_cancel(int id, size_t timestamp, float x, float y, bool primary, A5O_DISPLAY_WIN *win_disp); /* Helpers for getting Windows system errors * May be called from addons @@ -308,7 +308,7 @@ AL_FUNC(const char*, _al_win_last_error, (void)); /* Time handling */ double _al_win_get_time(void); void _al_win_rest(double seconds); -void _al_win_init_timeout(ALLEGRO_TIMEOUT *timeout, double seconds); +void _al_win_init_timeout(A5O_TIMEOUT *timeout, double seconds); #ifdef __cplusplus } diff --git a/include/allegro5/platform/aintwiz.h b/include/allegro5/platform/aintwiz.h index b48a1a9427..962b9b7970 100644 --- a/include/allegro5/platform/aintwiz.h +++ b/include/allegro5/platform/aintwiz.h @@ -7,10 +7,10 @@ #include "allegro5/system.h" #include "allegro5/platform/aintunix.h" -ALLEGRO_DISPLAY_INTERFACE *_al_display_gp2xwiz_opengl_driver(void); -ALLEGRO_DISPLAY_INTERFACE *_al_display_gp2xwiz_framebuffer_driver(void); -ALLEGRO_SYSTEM_INTERFACE *_al_system_gp2xwiz_driver(void); -ALLEGRO_BITMAP_INTERFACE *_al_bitmap_gp2xwiz_driver(void); +A5O_DISPLAY_INTERFACE *_al_display_gp2xwiz_opengl_driver(void); +A5O_DISPLAY_INTERFACE *_al_display_gp2xwiz_framebuffer_driver(void); +A5O_SYSTEM_INTERFACE *_al_system_gp2xwiz_driver(void); +A5O_BITMAP_INTERFACE *_al_bitmap_gp2xwiz_driver(void); #endif diff --git a/include/allegro5/platform/aintwthr.h b/include/allegro5/platform/aintwthr.h index cbe88c0f94..e68bed48c8 100644 --- a/include/allegro5/platform/aintwthr.h +++ b/include/allegro5/platform/aintwthr.h @@ -40,8 +40,8 @@ struct _AL_COND CRITICAL_SECTION mtxUnblockLock; }; -typedef struct ALLEGRO_TIMEOUT_WIN ALLEGRO_TIMEOUT_WIN; -struct ALLEGRO_TIMEOUT_WIN +typedef struct A5O_TIMEOUT_WIN A5O_TIMEOUT_WIN; +struct A5O_TIMEOUT_WIN { DWORD abstime; }; diff --git a/include/allegro5/platform/aintxglx.h b/include/allegro5/platform/aintxglx.h index 6a5284505c..4aee2b4fa8 100644 --- a/include/allegro5/platform/aintxglx.h +++ b/include/allegro5/platform/aintxglx.h @@ -1,7 +1,7 @@ #ifndef __al_included_allegro5_aintxglx_h #define __al_included_allegro5_aintxglx_h -ALLEGRO_DISPLAY_INTERFACE *_al_display_xglx_driver(void); -ALLEGRO_SYSTEM_INTERFACE *_al_system_xglx_driver(void); +A5O_DISPLAY_INTERFACE *_al_display_xglx_driver(void); +A5O_SYSTEM_INTERFACE *_al_system_xglx_driver(void); #endif diff --git a/include/allegro5/platform/alandroid.h b/include/allegro5/platform/alandroid.h index 261cd7df9c..60d2f1d362 100644 --- a/include/allegro5/platform/alandroid.h +++ b/include/allegro5/platform/alandroid.h @@ -14,7 +14,7 @@ */ -#ifndef ALLEGRO_ANDROID +#ifndef A5O_ANDROID #error bad include #endif diff --git a/include/allegro5/platform/alandroidcfg.h b/include/allegro5/platform/alandroidcfg.h index 9399c43e00..8eea33eea4 100644 --- a/include/allegro5/platform/alandroidcfg.h +++ b/include/allegro5/platform/alandroidcfg.h @@ -16,10 +16,10 @@ */ /* Describe this platform. */ -#define ALLEGRO_PLATFORM_STR "Android" +#define A5O_PLATFORM_STR "Android" -#define ALLEGRO_EXTRA_HEADER "allegro5/platform/alandroid.h" -#define ALLEGRO_INTERNAL_HEADER "allegro5/platform/aintandroid.h" -#define ALLEGRO_INTERNAL_THREAD_HEADER "allegro5/platform/aintuthr.h" +#define A5O_EXTRA_HEADER "allegro5/platform/alandroid.h" +#define A5O_INTERNAL_HEADER "allegro5/platform/aintandroid.h" +#define A5O_INTERNAL_THREAD_HEADER "allegro5/platform/aintuthr.h" -#define ALLEGRO_EXCLUDE_GLX +#define A5O_EXCLUDE_GLX diff --git a/include/allegro5/platform/albcc32.h b/include/allegro5/platform/albcc32.h index ca6bbc260b..91ef535b41 100644 --- a/include/allegro5/platform/albcc32.h +++ b/include/allegro5/platform/albcc32.h @@ -17,7 +17,7 @@ /* -#ifdef ALLEGRO_SRC +#ifdef A5O_SRC #error Currently BCC32 cannot build the library #endif */ @@ -36,22 +36,22 @@ /* describe this platform */ -#define ALLEGRO_PLATFORM_STR "BCC32" -#define ALLEGRO_WINDOWS -#define ALLEGRO_I386 -#define ALLEGRO_LITTLE_ENDIAN -#define ALLEGRO_GUESS_INTTYPES_OK +#define A5O_PLATFORM_STR "BCC32" +#define A5O_WINDOWS +#define A5O_I386 +#define A5O_LITTLE_ENDIAN +#define A5O_GUESS_INTTYPES_OK /* TODO: check if BCC has inttypes.h and/or stdint.h */ -#ifdef ALLEGRO_USE_CONSOLE - #define ALLEGRO_NO_MAGIC_MAIN +#ifdef A5O_USE_CONSOLE + #define A5O_NO_MAGIC_MAIN #endif /* describe how function prototypes look to BCC32 */ -#if (defined ALLEGRO_STATICLINK) +#if (defined A5O_STATICLINK) #define _AL_DLL -#elif (defined ALLEGRO_SRC) +#elif (defined A5O_SRC) #define _AL_DLL __declspec(dllexport) #else #define _AL_DLL __declspec(dllimport) @@ -92,6 +92,6 @@ /* This fixes 99.999999% of Borland C++Builder's problems with structs. */ /* arrange for other headers to be included later on */ -#define ALLEGRO_EXTRA_HEADER "allegro5/platform/alwin.h" -#define ALLEGRO_INTERNAL_HEADER "allegro5/platform/aintwin.h" -#define ALLEGRO_INTERNAL_THREAD_HEADER "allegro5/platform/aintwthr.h" +#define A5O_EXTRA_HEADER "allegro5/platform/alwin.h" +#define A5O_INTERNAL_HEADER "allegro5/platform/aintwin.h" +#define A5O_INTERNAL_THREAD_HEADER "allegro5/platform/aintwthr.h" diff --git a/include/allegro5/platform/aldmc.h b/include/allegro5/platform/aldmc.h index 2063ad78bd..2217dde8cd 100644 --- a/include/allegro5/platform/aldmc.h +++ b/include/allegro5/platform/aldmc.h @@ -23,29 +23,29 @@ /* a static auto config */ -#define ALLEGRO_HAVE_INTTYPES_H -#define ALLEGRO_HAVE_STDINT_H +#define A5O_HAVE_INTTYPES_H +#define A5O_HAVE_STDINT_H #define LONG_LONG long long /* describe this platform */ -#ifdef ALLEGRO_STATICLINK - #define ALLEGRO_PLATFORM_STR "DMC.s" +#ifdef A5O_STATICLINK + #define A5O_PLATFORM_STR "DMC.s" #else - #define ALLEGRO_PLATFORM_STR "DMC" + #define A5O_PLATFORM_STR "DMC" #endif -#define ALLEGRO_WINDOWS -#define ALLEGRO_I386 -#define ALLEGRO_LITTLE_ENDIAN +#define A5O_WINDOWS +#define A5O_I386 +#define A5O_LITTLE_ENDIAN -#ifdef ALLEGRO_USE_CONSOLE - #define ALLEGRO_NO_MAGIC_MAIN +#ifdef A5O_USE_CONSOLE + #define A5O_NO_MAGIC_MAIN #endif /* describe how function prototypes look to DMC */ -#if (defined ALLEGRO_STATICLINK) || (defined ALLEGRO_SRC) +#if (defined A5O_STATICLINK) || (defined A5O_SRC) #define _AL_DLL #else #define _AL_DLL __declspec(dllimport) @@ -60,7 +60,7 @@ /* Windows specific defines */ -#if (defined ALLEGRO_SRC) +#if (defined A5O_SRC) #if (!defined S_IRUSR) #define S_IRUSR S_IREAD @@ -78,8 +78,8 @@ struct _wfinddata_t { wchar_t name[260]; /* may include spaces. */ }; -#endif /* ALLEGRO_SRC */ +#endif /* A5O_SRC */ /* arrange for other headers to be included later on */ -#define ALLEGRO_EXTRA_HEADER "allegro5/platform/alwin.h" -#define ALLEGRO_INTERNAL_HEADER "allegro5/platform/aintwin.h" +#define A5O_EXTRA_HEADER "allegro5/platform/alwin.h" +#define A5O_INTERNAL_HEADER "allegro5/platform/aintwin.h" diff --git a/include/allegro5/platform/aliphone.h b/include/allegro5/platform/aliphone.h index 228c07ee66..7e408dc38d 100644 --- a/include/allegro5/platform/aliphone.h +++ b/include/allegro5/platform/aliphone.h @@ -1,9 +1,9 @@ -#ifndef ALLEGRO_IPHONE +#ifndef A5O_IPHONE #error bad include #endif -#ifndef ALLEGRO_LIB_BUILD -#define ALLEGRO_MAGIC_MAIN +#ifndef A5O_LIB_BUILD +#define A5O_MAGIC_MAIN #define main _al_mangled_main #ifdef __cplusplus extern "C" int _al_mangled_main(int, char **); diff --git a/include/allegro5/platform/aliphonecfg.h b/include/allegro5/platform/aliphonecfg.h index a4739acc10..fb10bb4b9f 100644 --- a/include/allegro5/platform/aliphonecfg.h +++ b/include/allegro5/platform/aliphonecfg.h @@ -18,13 +18,13 @@ #include /* Describe this platform. */ -#define ALLEGRO_PLATFORM_STR "IPHONE" +#define A5O_PLATFORM_STR "IPHONE" -#define ALLEGRO_EXTRA_HEADER "allegro5/platform/aliphone.h" -#define ALLEGRO_INTERNAL_HEADER "allegro5/platform/aintiphone.h" -#define ALLEGRO_INTERNAL_THREAD_HEADER "allegro5/platform/aintuthr.h" +#define A5O_EXTRA_HEADER "allegro5/platform/aliphone.h" +#define A5O_INTERNAL_HEADER "allegro5/platform/aintiphone.h" +#define A5O_INTERNAL_THREAD_HEADER "allegro5/platform/aintuthr.h" -#define ALLEGRO_EXCLUDE_GLX +#define A5O_EXCLUDE_GLX #ifndef AL_INLINE #define AL_INLINE(type, name, args, code) \ diff --git a/include/allegro5/platform/allegro_internal_sdl.h b/include/allegro5/platform/allegro_internal_sdl.h index 3eb68e4dd7..ad8ba05a04 100644 --- a/include/allegro5/platform/allegro_internal_sdl.h +++ b/include/allegro5/platform/allegro_internal_sdl.h @@ -9,29 +9,29 @@ typedef struct { - ALLEGRO_SYSTEM system; - ALLEGRO_MUTEX *mutex; + A5O_SYSTEM system; + A5O_MUTEX *mutex; #ifdef __EMSCRIPTEN__ double timer_time; #endif -} ALLEGRO_SYSTEM_SDL; +} A5O_SYSTEM_SDL; -typedef struct ALLEGRO_DISPLAY_SDL +typedef struct A5O_DISPLAY_SDL { - ALLEGRO_DISPLAY display; /* This must be the first member. */ + A5O_DISPLAY display; /* This must be the first member. */ int x, y; SDL_Window *window; SDL_GLContext context; -} ALLEGRO_DISPLAY_SDL; +} A5O_DISPLAY_SDL; -ALLEGRO_SYSTEM_INTERFACE *_al_sdl_system_driver(void); -ALLEGRO_DISPLAY_INTERFACE *_al_sdl_display_driver(void); -ALLEGRO_KEYBOARD_DRIVER *_al_sdl_keyboard_driver(void); -ALLEGRO_MOUSE_DRIVER *_al_sdl_mouse_driver(void); -ALLEGRO_TOUCH_INPUT_DRIVER *_al_sdl_touch_input_driver(void); -ALLEGRO_JOYSTICK_DRIVER *_al_sdl_joystick_driver(void); -ALLEGRO_BITMAP_INTERFACE *_al_sdl_bitmap_driver(void); +A5O_SYSTEM_INTERFACE *_al_sdl_system_driver(void); +A5O_DISPLAY_INTERFACE *_al_sdl_display_driver(void); +A5O_KEYBOARD_DRIVER *_al_sdl_keyboard_driver(void); +A5O_MOUSE_DRIVER *_al_sdl_mouse_driver(void); +A5O_TOUCH_INPUT_DRIVER *_al_sdl_touch_input_driver(void); +A5O_JOYSTICK_DRIVER *_al_sdl_joystick_driver(void); +A5O_BITMAP_INTERFACE *_al_sdl_bitmap_driver(void); void _al_sdl_keyboard_event(SDL_Event *e); void _al_sdl_mouse_event(SDL_Event *e); @@ -42,17 +42,17 @@ void _al_sdl_joystick_event(SDL_Event *e); int _al_sdl_get_allegro_pixel_format(int sdl_format); int _al_sdl_get_sdl_pixel_format(int allegro_format); -ALLEGRO_DISPLAY *_al_sdl_find_display(uint32_t window_id); -float _al_sdl_get_display_pixel_ratio(ALLEGRO_DISPLAY *display); +A5O_DISPLAY *_al_sdl_find_display(uint32_t window_id); +float _al_sdl_get_display_pixel_ratio(A5O_DISPLAY *display); void _al_sdl_event_hack(void); double _al_sdl_get_time(void); void _al_sdl_rest(double seconds); -void _al_sdl_init_timeout(ALLEGRO_TIMEOUT *timeout, double seconds); +void _al_sdl_init_timeout(A5O_TIMEOUT *timeout, double seconds); -typedef struct ALLEGRO_MOUSE_CURSOR_SDL ALLEGRO_MOUSE_CURSOR_SDL; -struct ALLEGRO_MOUSE_CURSOR_SDL +typedef struct A5O_MOUSE_CURSOR_SDL A5O_MOUSE_CURSOR_SDL; +struct A5O_MOUSE_CURSOR_SDL { SDL_Cursor *cursor; }; diff --git a/include/allegro5/platform/allegro_sdl_config.h b/include/allegro5/platform/allegro_sdl_config.h index 79e98d1bed..b529a3ecf9 100644 --- a/include/allegro5/platform/allegro_sdl_config.h +++ b/include/allegro5/platform/allegro_sdl_config.h @@ -1,7 +1,7 @@ -#define ALLEGRO_PLATFORM_STR "SDL" +#define A5O_PLATFORM_STR "SDL" -#define ALLEGRO_INTERNAL_HEADER "allegro5/platform/allegro_internal_sdl.h" -#define ALLEGRO_INTERNAL_THREAD_HEADER "allegro5/platform/allegro_sdl_thread.h" +#define A5O_INTERNAL_HEADER "allegro5/platform/allegro_internal_sdl.h" +#define A5O_INTERNAL_THREAD_HEADER "allegro5/platform/allegro_sdl_thread.h" // FIXME: remove once we don't use Unix specifics anymore #include diff --git a/include/allegro5/platform/allegro_sdl_thread.h b/include/allegro5/platform/allegro_sdl_thread.h index ed00cab3a9..51ad7f2a58 100644 --- a/include/allegro5/platform/allegro_sdl_thread.h +++ b/include/allegro5/platform/allegro_sdl_thread.h @@ -30,8 +30,8 @@ struct _AL_COND SDL_cond *cond; }; -typedef struct ALLEGRO_TIMEOUT_SDL ALLEGRO_TIMEOUT_SDL; -struct ALLEGRO_TIMEOUT_SDL +typedef struct A5O_TIMEOUT_SDL A5O_TIMEOUT_SDL; +struct A5O_TIMEOUT_SDL { int ms; }; diff --git a/include/allegro5/platform/almngw32.h b/include/allegro5/platform/almngw32.h index cfda24fd81..9e32fbb0f0 100644 --- a/include/allegro5/platform/almngw32.h +++ b/include/allegro5/platform/almngw32.h @@ -27,23 +27,23 @@ /* describe this platform */ -#ifdef ALLEGRO_STATICLINK - #define ALLEGRO_PLATFORM_STR "MinGW32.s" +#ifdef A5O_STATICLINK + #define A5O_PLATFORM_STR "MinGW32.s" #else - #define ALLEGRO_PLATFORM_STR "MinGW32" + #define A5O_PLATFORM_STR "MinGW32" #endif -#define ALLEGRO_WINDOWS -#define ALLEGRO_I386 -#define ALLEGRO_LITTLE_ENDIAN +#define A5O_WINDOWS +#define A5O_I386 +#define A5O_LITTLE_ENDIAN -#ifdef ALLEGRO_USE_CONSOLE - #define ALLEGRO_NO_MAGIC_MAIN +#ifdef A5O_USE_CONSOLE + #define A5O_NO_MAGIC_MAIN #endif /* describe how function prototypes look to MINGW32 */ -#if (defined ALLEGRO_STATICLINK) || (defined ALLEGRO_SRC) +#if (defined A5O_STATICLINK) || (defined A5O_SRC) #define _AL_DLL #else #define _AL_DLL __declspec(dllimport) @@ -58,7 +58,7 @@ /* windows specific defines */ -#if (defined ALLEGRO_SRC) +#if (defined A5O_SRC) /* pathches to handle DX7 headers on a win9x system */ /* should WINNT be defined on win9x systems? */ @@ -71,7 +71,7 @@ #define HMONITOR_DECLARED 1 #endif -#endif /* ALLEGRO_SRC */ +#endif /* A5O_SRC */ /* another instance of missing constants in the mingw32 headers */ #ifndef ENUM_CURRENT_SETTINGS @@ -79,6 +79,6 @@ #endif /* arrange for other headers to be included later on */ -#define ALLEGRO_EXTRA_HEADER "allegro5/platform/alwin.h" -#define ALLEGRO_INTERNAL_HEADER "allegro5/platform/aintwin.h" -#define ALLEGRO_INTERNAL_THREAD_HEADER "allegro5/platform/aintwthr.h" +#define A5O_EXTRA_HEADER "allegro5/platform/alwin.h" +#define A5O_INTERNAL_HEADER "allegro5/platform/aintwin.h" +#define A5O_INTERNAL_THREAD_HEADER "allegro5/platform/aintwthr.h" diff --git a/include/allegro5/platform/almsvc.h b/include/allegro5/platform/almsvc.h index 9a3cdf5656..ff33d8d2fb 100644 --- a/include/allegro5/platform/almsvc.h +++ b/include/allegro5/platform/almsvc.h @@ -27,25 +27,25 @@ /* describe this platform */ -#ifdef ALLEGRO_STATICLINK - #define ALLEGRO_PLATFORM_STR "MSVC.s" +#ifdef A5O_STATICLINK + #define A5O_PLATFORM_STR "MSVC.s" #else - #define ALLEGRO_PLATFORM_STR "MSVC" + #define A5O_PLATFORM_STR "MSVC" #endif -#define ALLEGRO_WINDOWS -#define ALLEGRO_I386 -#define ALLEGRO_LITTLE_ENDIAN -#define ALLEGRO_GUESS_INTTYPES_OK +#define A5O_WINDOWS +#define A5O_I386 +#define A5O_LITTLE_ENDIAN +#define A5O_GUESS_INTTYPES_OK -#ifdef ALLEGRO_USE_CONSOLE - #define ALLEGRO_NO_MAGIC_MAIN +#ifdef A5O_USE_CONSOLE + #define A5O_NO_MAGIC_MAIN #endif /* describe how function prototypes look to MSVC */ -#ifndef ALLEGRO_STATICLINK - #ifdef ALLEGRO_SRC +#ifndef A5O_STATICLINK + #ifdef A5O_SRC #define _AL_DLL __declspec(dllexport) #else #define _AL_DLL __declspec(dllimport) @@ -100,6 +100,6 @@ /* arrange for other headers to be included later on */ -#define ALLEGRO_EXTRA_HEADER "allegro5/platform/alwin.h" -#define ALLEGRO_INTERNAL_HEADER "allegro5/platform/aintwin.h" -#define ALLEGRO_INTERNAL_THREAD_HEADER "allegro5/platform/aintwthr.h" +#define A5O_EXTRA_HEADER "allegro5/platform/alwin.h" +#define A5O_INTERNAL_HEADER "allegro5/platform/aintwin.h" +#define A5O_INTERNAL_THREAD_HEADER "allegro5/platform/aintwthr.h" diff --git a/include/allegro5/platform/alosx.h b/include/allegro5/platform/alosx.h index d9845b92cb..261fb6da5c 100644 --- a/include/allegro5/platform/alosx.h +++ b/include/allegro5/platform/alosx.h @@ -19,7 +19,7 @@ #ifndef __al_included_allegro5_alosx_h #define __al_included_allegro5_alosx_h -#ifndef ALLEGRO_MACOSX +#ifndef A5O_MACOSX #error bad include #endif @@ -31,7 +31,7 @@ #include #include #include -#if defined __OBJC__ && defined ALLEGRO_SRC +#if defined __OBJC__ && defined A5O_SRC #import #import #import @@ -47,11 +47,11 @@ #import #endif -ALLEGRO_PATH *_al_osx_get_path(int id); +A5O_PATH *_al_osx_get_path(int id); -#ifndef ALLEGRO_LIB_BUILD - #ifndef ALLEGRO_NO_MAGIC_MAIN - #define ALLEGRO_MAGIC_MAIN +#ifndef A5O_LIB_BUILD + #ifndef A5O_NO_MAGIC_MAIN + #define A5O_MAGIC_MAIN #if __GNUC__ >= 4 #define main __attribute__ ((visibility("default"),used)) _al_mangled_main #else diff --git a/include/allegro5/platform/alosxcfg.h b/include/allegro5/platform/alosxcfg.h index 830cf116f6..03c5b28668 100644 --- a/include/allegro5/platform/alosxcfg.h +++ b/include/allegro5/platform/alosxcfg.h @@ -22,15 +22,15 @@ /* Include configuration information. */ #include "allegro5/platform/alplatf.h" -#define ALLEGRO_INTERNAL_THREAD_HEADER "allegro5/platform/aintuthr.h" +#define A5O_INTERNAL_THREAD_HEADER "allegro5/platform/aintuthr.h" /* Describe this platform */ -#define ALLEGRO_PLATFORM_STR "MacOS X" +#define A5O_PLATFORM_STR "MacOS X" /* Arrange for other headers to be included later on */ -#define ALLEGRO_EXTRA_HEADER "allegro5/platform/alosx.h" -#define ALLEGRO_INTERNAL_HEADER "allegro5/platform/aintosx.h" +#define A5O_EXTRA_HEADER "allegro5/platform/alosx.h" +#define A5O_INTERNAL_HEADER "allegro5/platform/aintosx.h" #endif diff --git a/include/allegro5/platform/alplatf.h.cmake b/include/allegro5/platform/alplatf.h.cmake index 62cca38744..d4de2b1840 100644 --- a/include/allegro5/platform/alplatf.h.cmake +++ b/include/allegro5/platform/alplatf.h.cmake @@ -1,127 +1,127 @@ /* alplatf.h is generated from alplatf.h.cmake */ -#cmakedefine ALLEGRO_MINGW32 -#cmakedefine ALLEGRO_UNIX -#cmakedefine ALLEGRO_MSVC -#cmakedefine ALLEGRO_MACOSX -#cmakedefine ALLEGRO_BCC32 -#cmakedefine ALLEGRO_IPHONE -#cmakedefine ALLEGRO_ANDROID -#cmakedefine ALLEGRO_RASPBERRYPI -#cmakedefine ALLEGRO_CFG_NO_FPU -#cmakedefine ALLEGRO_CFG_DLL_TLS -#cmakedefine ALLEGRO_CFG_PTHREADS_TLS -#cmakedefine ALLEGRO_CFG_RELEASE_LOGGING - -#cmakedefine ALLEGRO_CFG_D3D -#cmakedefine ALLEGRO_CFG_D3D9EX -#cmakedefine ALLEGRO_CFG_D3DX9 -#cmakedefine ALLEGRO_CFG_XINPUT -#cmakedefine ALLEGRO_CFG_OPENGL -#cmakedefine ALLEGRO_CFG_OPENGLES -#cmakedefine ALLEGRO_CFG_OPENGLES1 -#cmakedefine ALLEGRO_CFG_OPENGLES2 -#cmakedefine ALLEGRO_CFG_OPENGLES3 -#cmakedefine ALLEGRO_CFG_OPENGL_FIXED_FUNCTION -#cmakedefine ALLEGRO_CFG_OPENGL_PROGRAMMABLE_PIPELINE -#cmakedefine ALLEGRO_CFG_SHADER_GLSL -#cmakedefine ALLEGRO_CFG_SHADER_HLSL - -#cmakedefine ALLEGRO_CFG_ANDROID_LEGACY - -#cmakedefine ALLEGRO_CFG_HAVE_XINPUT_CAPABILITIES_EX +#cmakedefine A5O_MINGW32 +#cmakedefine A5O_UNIX +#cmakedefine A5O_MSVC +#cmakedefine A5O_MACOSX +#cmakedefine A5O_BCC32 +#cmakedefine A5O_IPHONE +#cmakedefine A5O_ANDROID +#cmakedefine A5O_RASPBERRYPI +#cmakedefine A5O_CFG_NO_FPU +#cmakedefine A5O_CFG_DLL_TLS +#cmakedefine A5O_CFG_PTHREADS_TLS +#cmakedefine A5O_CFG_RELEASE_LOGGING + +#cmakedefine A5O_CFG_D3D +#cmakedefine A5O_CFG_D3D9EX +#cmakedefine A5O_CFG_D3DX9 +#cmakedefine A5O_CFG_XINPUT +#cmakedefine A5O_CFG_OPENGL +#cmakedefine A5O_CFG_OPENGLES +#cmakedefine A5O_CFG_OPENGLES1 +#cmakedefine A5O_CFG_OPENGLES2 +#cmakedefine A5O_CFG_OPENGLES3 +#cmakedefine A5O_CFG_OPENGL_FIXED_FUNCTION +#cmakedefine A5O_CFG_OPENGL_PROGRAMMABLE_PIPELINE +#cmakedefine A5O_CFG_SHADER_GLSL +#cmakedefine A5O_CFG_SHADER_HLSL + +#cmakedefine A5O_CFG_ANDROID_LEGACY + +#cmakedefine A5O_CFG_HAVE_XINPUT_CAPABILITIES_EX /*---------------------------------------------------------------------------*/ /* 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_SOUNDCARD_H -#cmakedefine ALLEGRO_HAVE_MACHINE_SOUNDCARD_H -#cmakedefine ALLEGRO_HAVE_SOUNDCARD_H -#cmakedefine ALLEGRO_HAVE_STDBOOL_H -#cmakedefine ALLEGRO_HAVE_STDINT_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_TIME_H -#cmakedefine ALLEGRO_HAVE_SYS_UTSNAME_H -#cmakedefine ALLEGRO_HAVE_SYS_TYPES_H -#cmakedefine ALLEGRO_HAVE_OSATOMIC_H -#cmakedefine ALLEGRO_HAVE_SYS_INOTIFY_H -#cmakedefine ALLEGRO_HAVE_SAL_H +#cmakedefine A5O_HAVE_DIRENT_H +#cmakedefine A5O_HAVE_INTTYPES_H +#cmakedefine A5O_HAVE_LINUX_AWE_VOICE_H +#cmakedefine A5O_HAVE_LINUX_INPUT_H +#cmakedefine A5O_HAVE_LINUX_SOUNDCARD_H +#cmakedefine A5O_HAVE_MACHINE_SOUNDCARD_H +#cmakedefine A5O_HAVE_SOUNDCARD_H +#cmakedefine A5O_HAVE_STDBOOL_H +#cmakedefine A5O_HAVE_STDINT_H +#cmakedefine A5O_HAVE_SV_PROCFS_H +#cmakedefine A5O_HAVE_SYS_IO_H +#cmakedefine A5O_HAVE_SYS_SOUNDCARD_H +#cmakedefine A5O_HAVE_SYS_STAT_H +#cmakedefine A5O_HAVE_SYS_TIME_H +#cmakedefine A5O_HAVE_TIME_H +#cmakedefine A5O_HAVE_SYS_UTSNAME_H +#cmakedefine A5O_HAVE_SYS_TYPES_H +#cmakedefine A5O_HAVE_OSATOMIC_H +#cmakedefine A5O_HAVE_SYS_INOTIFY_H +#cmakedefine A5O_HAVE_SAL_H /* Define to 1 if the corresponding functions are available. */ -#cmakedefine ALLEGRO_HAVE_GETEXECNAME -#cmakedefine ALLEGRO_HAVE_MKSTEMP -#cmakedefine ALLEGRO_HAVE_MMAP -#cmakedefine ALLEGRO_HAVE_MPROTECT -#cmakedefine ALLEGRO_HAVE_SCHED_YIELD -#cmakedefine ALLEGRO_HAVE_SYSCONF -#cmakedefine ALLEGRO_HAVE_SYSCTL - -#cmakedefine ALLEGRO_HAVE_FSEEKO -#cmakedefine ALLEGRO_HAVE_FTELLO -#cmakedefine ALLEGRO_HAVE_STRERROR_R -#cmakedefine ALLEGRO_HAVE_STRERROR_S -#cmakedefine ALLEGRO_HAVE_VA_COPY -#cmakedefine ALLEGRO_HAVE_FTELLI64 -#cmakedefine ALLEGRO_HAVE_FSEEKI64 +#cmakedefine A5O_HAVE_GETEXECNAME +#cmakedefine A5O_HAVE_MKSTEMP +#cmakedefine A5O_HAVE_MMAP +#cmakedefine A5O_HAVE_MPROTECT +#cmakedefine A5O_HAVE_SCHED_YIELD +#cmakedefine A5O_HAVE_SYSCONF +#cmakedefine A5O_HAVE_SYSCTL + +#cmakedefine A5O_HAVE_FSEEKO +#cmakedefine A5O_HAVE_FTELLO +#cmakedefine A5O_HAVE_STRERROR_R +#cmakedefine A5O_HAVE_STRERROR_S +#cmakedefine A5O_HAVE_VA_COPY +#cmakedefine A5O_HAVE_FTELLI64 +#cmakedefine A5O_HAVE_FSEEKI64 /* Define to 1 if procfs reveals argc and argv */ -#cmakedefine ALLEGRO_HAVE_PROCFS_ARGCV +#cmakedefine A5O_HAVE_PROCFS_ARGCV /*---------------------------------------------------------------------------*/ /* Define if target machine is little endian. */ -#cmakedefine ALLEGRO_LITTLE_ENDIAN +#cmakedefine A5O_LITTLE_ENDIAN /* Define if target machine is big endian. */ -#cmakedefine ALLEGRO_BIG_ENDIAN +#cmakedefine A5O_BIG_ENDIAN /* Define if target platform is Darwin. */ -#cmakedefine ALLEGRO_DARWIN +#cmakedefine A5O_DARWIN /*---------------------------------------------------------------------------*/ /* Define if you need support for X-Windows. */ -#cmakedefine ALLEGRO_WITH_XWINDOWS +#cmakedefine A5O_WITH_XWINDOWS /* Define if XCursor ARGB extension is available. */ -#cmakedefine ALLEGRO_XWINDOWS_WITH_XCURSOR +#cmakedefine A5O_XWINDOWS_WITH_XCURSOR /* Define if XF86VidMode extension is supported. */ -#cmakedefine ALLEGRO_XWINDOWS_WITH_XF86VIDMODE +#cmakedefine A5O_XWINDOWS_WITH_XF86VIDMODE /* Define if Xinerama extension is supported. */ -#cmakedefine ALLEGRO_XWINDOWS_WITH_XINERAMA +#cmakedefine A5O_XWINDOWS_WITH_XINERAMA /* Define if XRandR extension is supported. */ -#cmakedefine ALLEGRO_XWINDOWS_WITH_XRANDR +#cmakedefine A5O_XWINDOWS_WITH_XRANDR /* Define if XScreenSaver extension is supported. */ -#cmakedefine ALLEGRO_XWINDOWS_WITH_XSCREENSAVER +#cmakedefine A5O_XWINDOWS_WITH_XSCREENSAVER /* Define if XIM extension is supported. */ -#cmakedefine ALLEGRO_XWINDOWS_WITH_XIM +#cmakedefine A5O_XWINDOWS_WITH_XIM /* Define if XInput 2.2 X11 extension is supported. */ -#cmakedefine ALLEGRO_XWINDOWS_WITH_XINPUT2 +#cmakedefine A5O_XWINDOWS_WITH_XINPUT2 /*---------------------------------------------------------------------------*/ /* Define if target platform is linux. */ -#cmakedefine ALLEGRO_LINUX +#cmakedefine A5O_LINUX /* Define if we are building with SDL backend. */ -#cmakedefine ALLEGRO_SDL +#cmakedefine A5O_SDL /* Define if sleep should be used instead of threads (only useful for emscripten without web workers) */ -#cmakedefine ALLEGRO_WAIT_EVENT_SLEEP +#cmakedefine A5O_WAIT_EVENT_SLEEP /*---------------------------------------------------------------------------*/ /* vi: set ft=c ts=3 sts=3 sw=3 et: */ diff --git a/include/allegro5/platform/alraspberrypi.h b/include/allegro5/platform/alraspberrypi.h index 629a02ff01..670950e2b1 100644 --- a/include/allegro5/platform/alraspberrypi.h +++ b/include/allegro5/platform/alraspberrypi.h @@ -14,11 +14,11 @@ */ -#ifndef ALLEGRO_RASPBERRYPI +#ifndef A5O_RASPBERRYPI #error bad include #endif -#ifdef ALLEGRO_LIB_BUILD +#ifdef A5O_LIB_BUILD #include "allegro5/platform/aintuthr.h" #endif diff --git a/include/allegro5/platform/alraspberrypicfg.h b/include/allegro5/platform/alraspberrypicfg.h index 17941ca7e1..e280575cbf 100644 --- a/include/allegro5/platform/alraspberrypicfg.h +++ b/include/allegro5/platform/alraspberrypicfg.h @@ -20,10 +20,10 @@ #include /* Describe this platform. */ -#define ALLEGRO_PLATFORM_STR "RaspberryPi" +#define A5O_PLATFORM_STR "RaspberryPi" -#define ALLEGRO_EXTRA_HEADER "allegro5/platform/alraspberrypi.h" -#define ALLEGRO_INTERNAL_HEADER "allegro5/platform/aintraspberrypi.h" -#define ALLEGRO_INTERNAL_THREAD_HEADER "allegro5/platform/aintuthr.h" +#define A5O_EXTRA_HEADER "allegro5/platform/alraspberrypi.h" +#define A5O_INTERNAL_HEADER "allegro5/platform/aintraspberrypi.h" +#define A5O_INTERNAL_THREAD_HEADER "allegro5/platform/aintuthr.h" -#define ALLEGRO_EXCLUDE_GLX +#define A5O_EXCLUDE_GLX diff --git a/include/allegro5/platform/alucfg.h b/include/allegro5/platform/alucfg.h index b9947c88ac..35f4ec05d7 100644 --- a/include/allegro5/platform/alucfg.h +++ b/include/allegro5/platform/alucfg.h @@ -20,21 +20,21 @@ #include /* Describe this platform. */ -#define ALLEGRO_PLATFORM_STR "Unix" +#define A5O_PLATFORM_STR "Unix" -#define ALLEGRO_EXTRA_HEADER "allegro5/platform/alunix.h" +#define A5O_EXTRA_HEADER "allegro5/platform/alunix.h" #ifdef _this_is_a_hack_to_fool_scons #include "alunix.h" #endif -#define ALLEGRO_INTERNAL_HEADER "allegro5/platform/aintunix.h" -#define ALLEGRO_INTERNAL_THREAD_HEADER "allegro5/platform/aintuthr.h" +#define A5O_INTERNAL_HEADER "allegro5/platform/aintunix.h" +#define A5O_INTERNAL_THREAD_HEADER "allegro5/platform/aintuthr.h" /* Include configuration information. */ #include "allegro5/platform/alplatf.h" /* Enable OpenGL if GLX is available. */ -#ifdef ALLEGRO_GLX -#define ALLEGRO_CFG_OPENGL +#ifdef A5O_GLX +#define A5O_CFG_OPENGL #endif diff --git a/include/allegro5/platform/alunix.h b/include/allegro5/platform/alunix.h index ae1b858a28..a363768747 100644 --- a/include/allegro5/platform/alunix.h +++ b/include/allegro5/platform/alunix.h @@ -14,7 +14,7 @@ */ -#ifndef ALLEGRO_UNIX +#ifndef A5O_UNIX #error bad include #endif diff --git a/include/allegro5/platform/alwatcom.h b/include/allegro5/platform/alwatcom.h index f2d0771411..fee0d666f1 100644 --- a/include/allegro5/platform/alwatcom.h +++ b/include/allegro5/platform/alwatcom.h @@ -37,20 +37,20 @@ /* these are available in OpenWatcom 1.3 (12.3) */ #if __WATCOMC__ >= 1230 - #define ALLEGRO_HAVE_INTTYPES_H 1 - #define ALLEGRO_HAVE_STDINT_H 1 + #define A5O_HAVE_INTTYPES_H 1 + #define A5O_HAVE_STDINT_H 1 #else - #define ALLEGRO_GUESS_INTTYPES_OK + #define A5O_GUESS_INTTYPES_OK #endif /* describe this platform */ -#define ALLEGRO_PLATFORM_STR "Watcom" -#define ALLEGRO_DOS -#define ALLEGRO_I386 -#define ALLEGRO_LITTLE_ENDIAN +#define A5O_PLATFORM_STR "Watcom" +#define A5O_DOS +#define A5O_I386 +#define A5O_LITTLE_ENDIAN -#ifdef ALLEGRO_GUESS_INTTYPES_OK +#ifdef A5O_GUESS_INTTYPES_OK #define int64_t signed long long #define uint64_t unsigned long long #endif @@ -177,5 +177,5 @@ void _unlock_dpmi_data(void *addr, int size); /* arrange for other headers to be included later on */ -#define ALLEGRO_EXTRA_HEADER "allegro5/platform/aldos.h" -#define ALLEGRO_INTERNAL_HEADER "allegro5/platform/aintdos.h" +#define A5O_EXTRA_HEADER "allegro5/platform/aldos.h" +#define A5O_INTERNAL_HEADER "allegro5/platform/aintdos.h" diff --git a/include/allegro5/platform/alwin.h b/include/allegro5/platform/alwin.h index eab4b10f35..d32162cb81 100644 --- a/include/allegro5/platform/alwin.h +++ b/include/allegro5/platform/alwin.h @@ -16,7 +16,7 @@ */ -#ifndef ALLEGRO_WINDOWS +#ifndef A5O_WINDOWS #error bad include #endif @@ -37,8 +37,8 @@ AL_FUNC(int, _WinMain, (void *_main, void *hInst, void *hPrev, char *Cmd, int nS /* The following is due to torhu from A.cc (see * http://www.allegro.cc/forums/thread/596872/756993#target) */ -#ifndef ALLEGRO_NO_MAGIC_MAIN - #if defined _MSC_VER && !defined ALLEGRO_LIB_BUILD +#ifndef A5O_NO_MAGIC_MAIN + #if defined _MSC_VER && !defined A5O_LIB_BUILD #pragma comment(linker,"/ENTRY:mainCRTStartup") #endif #endif @@ -53,7 +53,7 @@ AL_FUNC(int, _WinMain, (void *_main, void *hInst, void *hPrev, char *Cmd, int nS extern "C" { #endif -AL_VAR(struct ALLEGRO_JOYSTICK_DRIVER, _al_joydrv_directx); +AL_VAR(struct A5O_JOYSTICK_DRIVER, _al_joydrv_directx); #ifdef __cplusplus } @@ -68,7 +68,7 @@ AL_VAR(struct ALLEGRO_JOYSTICK_DRIVER, _al_joydrv_directx); extern "C" { #endif -AL_VAR(struct ALLEGRO_JOYSTICK_DRIVER, _al_joydrv_xinput); +AL_VAR(struct A5O_JOYSTICK_DRIVER, _al_joydrv_xinput); #ifdef __cplusplus } @@ -83,7 +83,7 @@ AL_VAR(struct ALLEGRO_JOYSTICK_DRIVER, _al_joydrv_xinput); extern "C" { #endif -AL_VAR(struct ALLEGRO_JOYSTICK_DRIVER, _al_joydrv_windows_all); +AL_VAR(struct A5O_JOYSTICK_DRIVER, _al_joydrv_windows_all); #ifdef __cplusplus } @@ -104,7 +104,7 @@ AL_VAR(struct ALLEGRO_JOYSTICK_DRIVER, _al_joydrv_windows_all); extern "C" { #endif -AL_VAR(struct ALLEGRO_HAPTIC_DRIVER, _al_hapdrv_directx); +AL_VAR(struct A5O_HAPTIC_DRIVER, _al_hapdrv_directx); #ifdef __cplusplus } @@ -120,7 +120,7 @@ AL_VAR(struct ALLEGRO_HAPTIC_DRIVER, _al_hapdrv_directx); extern "C" { #endif -AL_VAR(struct ALLEGRO_HAPTIC_DRIVER, _al_hapdrv_xinput); +AL_VAR(struct A5O_HAPTIC_DRIVER, _al_hapdrv_xinput); #ifdef __cplusplus } @@ -136,7 +136,7 @@ AL_VAR(struct ALLEGRO_HAPTIC_DRIVER, _al_hapdrv_xinput); extern "C" { #endif -AL_VAR(struct ALLEGRO_HAPTIC_DRIVER, _al_hapdrv_windows_all); +AL_VAR(struct A5O_HAPTIC_DRIVER, _al_hapdrv_windows_all); #ifdef __cplusplus } diff --git a/include/allegro5/platform/alwiz.h b/include/allegro5/platform/alwiz.h index 9595b3f5b7..a4358893d2 100644 --- a/include/allegro5/platform/alwiz.h +++ b/include/allegro5/platform/alwiz.h @@ -16,13 +16,13 @@ */ -#ifndef ALLEGRO_GP2XWIZ +#ifndef A5O_GP2XWIZ #error bad include #endif #define AL_JOY_TYPE_GP2XWIZ AL_ID('W','I','Z',' ') -AL_VAR(struct ALLEGRO_JOYSTICK_DRIVER, _al_joydrv_gp2xwiz); +AL_VAR(struct A5O_JOYSTICK_DRIVER, _al_joydrv_gp2xwiz); #define _AL_JOYSTICK_DRIVER_GP2XWIZ \ { AL_JOY_TYPE_GP2XWIZ, &_al_joydrv_gp2xwiz, true }, diff --git a/include/allegro5/platform/alwizcfg.h b/include/allegro5/platform/alwizcfg.h index a8afe365cf..6d359995ee 100644 --- a/include/allegro5/platform/alwizcfg.h +++ b/include/allegro5/platform/alwizcfg.h @@ -20,14 +20,14 @@ #include /* Describe this platform. */ -#define ALLEGRO_PLATFORM_STR "GP2XWIZ" +#define A5O_PLATFORM_STR "GP2XWIZ" -#define ALLEGRO_EXTRA_HEADER "allegro5/platform/alwiz.h" -#define ALLEGRO_INTERNAL_HEADER "allegro5/platform/aintwiz.h" -#define ALLEGRO_INTERNAL_THREAD_HEADER "allegro5/platform/aintuthr.h" +#define A5O_EXTRA_HEADER "allegro5/platform/alwiz.h" +#define A5O_INTERNAL_HEADER "allegro5/platform/aintwiz.h" +#define A5O_INTERNAL_THREAD_HEADER "allegro5/platform/aintuthr.h" /* Include configuration information. */ #include "allegro5/platform/alplatf.h" /* No GLX on the Wiz */ -#define ALLEGRO_EXCLUDE_GLX +#define A5O_EXCLUDE_GLX diff --git a/include/allegro5/platform/astdbool.h b/include/allegro5/platform/astdbool.h index 591f476936..d3788b28cc 100644 --- a/include/allegro5/platform/astdbool.h +++ b/include/allegro5/platform/astdbool.h @@ -19,10 +19,10 @@ #define __al_included_allegro5_astdbool_h #ifndef __cplusplus -# ifdef ALLEGRO_HAVE_STDBOOL_H +# ifdef A5O_HAVE_STDBOOL_H # include # else -# ifndef ALLEGRO_HAVE__BOOL +# ifndef A5O_HAVE__BOOL typedef unsigned char _Bool; # endif # define bool _Bool diff --git a/include/allegro5/platform/astdint.h b/include/allegro5/platform/astdint.h index 63b00305ca..b4f05bda97 100644 --- a/include/allegro5/platform/astdint.h +++ b/include/allegro5/platform/astdint.h @@ -24,12 +24,12 @@ -#if defined ALLEGRO_HAVE_INTTYPES_H +#if defined A5O_HAVE_INTTYPES_H #include -#elif defined ALLEGRO_HAVE_STDINT_H +#elif defined A5O_HAVE_STDINT_H #include -#elif defined ALLEGRO_I386 && defined ALLEGRO_LITTLE_ENDIAN - #ifndef ALLEGRO_GUESS_INTTYPES_OK +#elif defined A5O_I386 && defined A5O_LITTLE_ENDIAN + #ifndef A5O_GUESS_INTTYPES_OK #warning Guessing the definitions of fixed-width integer types. #endif #include @@ -51,7 +51,7 @@ #define INT32_MAX INT_MAX #define UINT32_MAX UINT_MAX - #ifdef ALLEGRO_WINDOWS + #ifdef A5O_WINDOWS #ifndef _INTPTR_T_DEFINED #ifdef _WIN64 diff --git a/include/allegro5/render_state.h b/include/allegro5/render_state.h index 99c076489b..648e904941 100644 --- a/include/allegro5/render_state.h +++ b/include/allegro5/render_state.h @@ -7,46 +7,46 @@ extern "C" { #endif -/* Enum: ALLEGRO_RENDER_STATE +/* Enum: A5O_RENDER_STATE */ -typedef enum ALLEGRO_RENDER_STATE { - /* ALLEGRO_ALPHA_TEST was the name of a rare bitmap flag only used on the +typedef enum A5O_RENDER_STATE { + /* A5O_ALPHA_TEST was the name of a rare bitmap flag only used on the * Wiz port. Reuse the name but retain the same value. */ - ALLEGRO_ALPHA_TEST = 0x0010, - ALLEGRO_WRITE_MASK, - ALLEGRO_DEPTH_TEST, - ALLEGRO_DEPTH_FUNCTION, - ALLEGRO_ALPHA_FUNCTION, - ALLEGRO_ALPHA_TEST_VALUE -} ALLEGRO_RENDER_STATE; - -/* Enum: ALLEGRO_RENDER_FUNCTION + A5O_ALPHA_TEST = 0x0010, + A5O_WRITE_MASK, + A5O_DEPTH_TEST, + A5O_DEPTH_FUNCTION, + A5O_ALPHA_FUNCTION, + A5O_ALPHA_TEST_VALUE +} A5O_RENDER_STATE; + +/* Enum: A5O_RENDER_FUNCTION */ -typedef enum ALLEGRO_RENDER_FUNCTION { - ALLEGRO_RENDER_NEVER, - ALLEGRO_RENDER_ALWAYS, - ALLEGRO_RENDER_LESS, - ALLEGRO_RENDER_EQUAL, - ALLEGRO_RENDER_LESS_EQUAL, - ALLEGRO_RENDER_GREATER, - ALLEGRO_RENDER_NOT_EQUAL, - ALLEGRO_RENDER_GREATER_EQUAL -} ALLEGRO_RENDER_FUNCTION; - -/* Enum: ALLEGRO_WRITE_MASK_FLAGS +typedef enum A5O_RENDER_FUNCTION { + A5O_RENDER_NEVER, + A5O_RENDER_ALWAYS, + A5O_RENDER_LESS, + A5O_RENDER_EQUAL, + A5O_RENDER_LESS_EQUAL, + A5O_RENDER_GREATER, + A5O_RENDER_NOT_EQUAL, + A5O_RENDER_GREATER_EQUAL +} A5O_RENDER_FUNCTION; + +/* Enum: A5O_WRITE_MASK_FLAGS */ -typedef enum ALLEGRO_WRITE_MASK_FLAGS { - ALLEGRO_MASK_RED = 1 << 0, - ALLEGRO_MASK_GREEN = 1 << 1, - ALLEGRO_MASK_BLUE = 1 << 2, - ALLEGRO_MASK_ALPHA = 1 << 3, - ALLEGRO_MASK_DEPTH = 1 << 4, - ALLEGRO_MASK_RGB = (ALLEGRO_MASK_RED | ALLEGRO_MASK_GREEN | ALLEGRO_MASK_BLUE), - ALLEGRO_MASK_RGBA = (ALLEGRO_MASK_RGB | ALLEGRO_MASK_ALPHA) -} ALLEGRO_WRITE_MASK_FLAGS; - -AL_FUNC(void, al_set_render_state, (ALLEGRO_RENDER_STATE state, int value)); +typedef enum A5O_WRITE_MASK_FLAGS { + A5O_MASK_RED = 1 << 0, + A5O_MASK_GREEN = 1 << 1, + A5O_MASK_BLUE = 1 << 2, + A5O_MASK_ALPHA = 1 << 3, + A5O_MASK_DEPTH = 1 << 4, + A5O_MASK_RGB = (A5O_MASK_RED | A5O_MASK_GREEN | A5O_MASK_BLUE), + A5O_MASK_RGBA = (A5O_MASK_RGB | A5O_MASK_ALPHA) +} A5O_WRITE_MASK_FLAGS; + +AL_FUNC(void, al_set_render_state, (A5O_RENDER_STATE state, int value)); #ifdef __cplusplus } diff --git a/include/allegro5/shader.h b/include/allegro5/shader.h index 61cb9bf494..abdf3b41ac 100644 --- a/include/allegro5/shader.h +++ b/include/allegro5/shader.h @@ -9,63 +9,63 @@ #endif -/* Type: ALLEGRO_SHADER +/* Type: A5O_SHADER */ -typedef struct ALLEGRO_SHADER ALLEGRO_SHADER; +typedef struct A5O_SHADER A5O_SHADER; -enum ALLEGRO_SHADER_TYPE { - ALLEGRO_VERTEX_SHADER = 1, - ALLEGRO_PIXEL_SHADER = 2 +enum A5O_SHADER_TYPE { + A5O_VERTEX_SHADER = 1, + A5O_PIXEL_SHADER = 2 }; -/* Enum: ALLEGRO_SHADER_TYPE +/* Enum: A5O_SHADER_TYPE */ -typedef enum ALLEGRO_SHADER_TYPE ALLEGRO_SHADER_TYPE; +typedef enum A5O_SHADER_TYPE A5O_SHADER_TYPE; -enum ALLEGRO_SHADER_PLATFORM { - ALLEGRO_SHADER_AUTO = 0, - ALLEGRO_SHADER_GLSL = 1, - ALLEGRO_SHADER_HLSL = 2, - ALLEGRO_SHADER_AUTO_MINIMAL = 3, - ALLEGRO_SHADER_GLSL_MINIMAL = 4, - ALLEGRO_SHADER_HLSL_MINIMAL = 5, - ALLEGRO_SHADER_HLSL_SM_3_0 = 6, +enum A5O_SHADER_PLATFORM { + A5O_SHADER_AUTO = 0, + A5O_SHADER_GLSL = 1, + A5O_SHADER_HLSL = 2, + A5O_SHADER_AUTO_MINIMAL = 3, + A5O_SHADER_GLSL_MINIMAL = 4, + A5O_SHADER_HLSL_MINIMAL = 5, + A5O_SHADER_HLSL_SM_3_0 = 6, }; -/* Enum: ALLEGRO_SHADER_PLATFORM +/* Enum: A5O_SHADER_PLATFORM */ -typedef enum ALLEGRO_SHADER_PLATFORM ALLEGRO_SHADER_PLATFORM; +typedef enum A5O_SHADER_PLATFORM A5O_SHADER_PLATFORM; /* Shader variable names */ -#define ALLEGRO_SHADER_VAR_COLOR "al_color" -#define ALLEGRO_SHADER_VAR_POS "al_pos" -#define ALLEGRO_SHADER_VAR_PROJVIEW_MATRIX "al_projview_matrix" -#define ALLEGRO_SHADER_VAR_TEX "al_tex" -#define ALLEGRO_SHADER_VAR_TEXCOORD "al_texcoord" -#define ALLEGRO_SHADER_VAR_TEX_MATRIX "al_tex_matrix" -#define ALLEGRO_SHADER_VAR_USER_ATTR "al_user_attr_" -#define ALLEGRO_SHADER_VAR_USE_TEX "al_use_tex" -#define ALLEGRO_SHADER_VAR_USE_TEX_MATRIX "al_use_tex_matrix" -#define ALLEGRO_SHADER_VAR_ALPHA_TEST "al_alpha_test" -#define ALLEGRO_SHADER_VAR_ALPHA_FUNCTION "al_alpha_func" -#define ALLEGRO_SHADER_VAR_ALPHA_TEST_VALUE "al_alpha_test_val" +#define A5O_SHADER_VAR_COLOR "al_color" +#define A5O_SHADER_VAR_POS "al_pos" +#define A5O_SHADER_VAR_PROJVIEW_MATRIX "al_projview_matrix" +#define A5O_SHADER_VAR_TEX "al_tex" +#define A5O_SHADER_VAR_TEXCOORD "al_texcoord" +#define A5O_SHADER_VAR_TEX_MATRIX "al_tex_matrix" +#define A5O_SHADER_VAR_USER_ATTR "al_user_attr_" +#define A5O_SHADER_VAR_USE_TEX "al_use_tex" +#define A5O_SHADER_VAR_USE_TEX_MATRIX "al_use_tex_matrix" +#define A5O_SHADER_VAR_ALPHA_TEST "al_alpha_test" +#define A5O_SHADER_VAR_ALPHA_FUNCTION "al_alpha_func" +#define A5O_SHADER_VAR_ALPHA_TEST_VALUE "al_alpha_test_val" -AL_FUNC(ALLEGRO_SHADER *, al_create_shader, (ALLEGRO_SHADER_PLATFORM platform)); -AL_FUNC(bool, al_attach_shader_source, (ALLEGRO_SHADER *shader, - ALLEGRO_SHADER_TYPE type, const char *source)); -AL_FUNC(bool, al_attach_shader_source_file, (ALLEGRO_SHADER *shader, - ALLEGRO_SHADER_TYPE type, const char *filename)); -AL_FUNC(bool, al_build_shader, (ALLEGRO_SHADER *shader)); -AL_FUNC(const char *, al_get_shader_log, (ALLEGRO_SHADER *shader)); -AL_FUNC(ALLEGRO_SHADER_PLATFORM, al_get_shader_platform, (ALLEGRO_SHADER *shader)); -AL_FUNC(bool, al_use_shader, (ALLEGRO_SHADER *shader)); -AL_FUNC(ALLEGRO_SHADER *, al_get_current_shader, (void)); -AL_FUNC(void, al_destroy_shader, (ALLEGRO_SHADER *shader)); +AL_FUNC(A5O_SHADER *, al_create_shader, (A5O_SHADER_PLATFORM platform)); +AL_FUNC(bool, al_attach_shader_source, (A5O_SHADER *shader, + A5O_SHADER_TYPE type, const char *source)); +AL_FUNC(bool, al_attach_shader_source_file, (A5O_SHADER *shader, + A5O_SHADER_TYPE type, const char *filename)); +AL_FUNC(bool, al_build_shader, (A5O_SHADER *shader)); +AL_FUNC(const char *, al_get_shader_log, (A5O_SHADER *shader)); +AL_FUNC(A5O_SHADER_PLATFORM, al_get_shader_platform, (A5O_SHADER *shader)); +AL_FUNC(bool, al_use_shader, (A5O_SHADER *shader)); +AL_FUNC(A5O_SHADER *, al_get_current_shader, (void)); +AL_FUNC(void, al_destroy_shader, (A5O_SHADER *shader)); -AL_FUNC(bool, al_set_shader_sampler, (const char *name, ALLEGRO_BITMAP *bitmap, +AL_FUNC(bool, al_set_shader_sampler, (const char *name, A5O_BITMAP *bitmap, int unit)); AL_FUNC(bool, al_set_shader_matrix, (const char *name, - const ALLEGRO_TRANSFORM *matrix)); + const A5O_TRANSFORM *matrix)); AL_FUNC(bool, al_set_shader_int, (const char *name, int i)); AL_FUNC(bool, al_set_shader_float, (const char *name, float f)); AL_FUNC(bool, al_set_shader_int_vector, (const char *name, int num_components, @@ -74,8 +74,8 @@ AL_FUNC(bool, al_set_shader_float_vector, (const char *name, int num_components, const float *f, int num_elems)); AL_FUNC(bool, al_set_shader_bool, (const char *name, bool b)); -AL_FUNC(char const *, al_get_default_shader_source, (ALLEGRO_SHADER_PLATFORM platform, - ALLEGRO_SHADER_TYPE type)); +AL_FUNC(char const *, al_get_default_shader_source, (A5O_SHADER_PLATFORM platform, + A5O_SHADER_TYPE type)); #ifdef __cplusplus } diff --git a/include/allegro5/system.h b/include/allegro5/system.h index 5e25cf686f..64e0c5b5aa 100644 --- a/include/allegro5/system.h +++ b/include/allegro5/system.h @@ -8,46 +8,46 @@ extern "C" { #endif -typedef struct ALLEGRO_SYSTEM ALLEGRO_SYSTEM; +typedef struct A5O_SYSTEM A5O_SYSTEM; -/* Enum: ALLEGRO_SYSTEM_ID +/* Enum: A5O_SYSTEM_ID */ -enum ALLEGRO_SYSTEM_ID { - ALLEGRO_SYSTEM_ID_UNKNOWN = 0, - ALLEGRO_SYSTEM_ID_XGLX = AL_ID('X', 'G', 'L', 'X'), - ALLEGRO_SYSTEM_ID_WINDOWS = AL_ID('W', 'I', 'N', 'D'), - ALLEGRO_SYSTEM_ID_MACOSX = AL_ID('O', 'S', 'X', ' '), - ALLEGRO_SYSTEM_ID_ANDROID = AL_ID('A', 'N', 'D', 'R'), - ALLEGRO_SYSTEM_ID_IPHONE = AL_ID('I', 'P', 'H', 'O'), - ALLEGRO_SYSTEM_ID_GP2XWIZ = AL_ID('W', 'I', 'Z', ' '), - ALLEGRO_SYSTEM_ID_RASPBERRYPI = AL_ID('R', 'A', 'S', 'P'), - ALLEGRO_SYSTEM_ID_SDL = AL_ID('S', 'D', 'L', '2') +enum A5O_SYSTEM_ID { + A5O_SYSTEM_ID_UNKNOWN = 0, + A5O_SYSTEM_ID_XGLX = AL_ID('X', 'G', 'L', 'X'), + A5O_SYSTEM_ID_WINDOWS = AL_ID('W', 'I', 'N', 'D'), + A5O_SYSTEM_ID_MACOSX = AL_ID('O', 'S', 'X', ' '), + A5O_SYSTEM_ID_ANDROID = AL_ID('A', 'N', 'D', 'R'), + A5O_SYSTEM_ID_IPHONE = AL_ID('I', 'P', 'H', 'O'), + A5O_SYSTEM_ID_GP2XWIZ = AL_ID('W', 'I', 'Z', ' '), + A5O_SYSTEM_ID_RASPBERRYPI = AL_ID('R', 'A', 'S', 'P'), + A5O_SYSTEM_ID_SDL = AL_ID('S', 'D', 'L', '2') }; -typedef enum ALLEGRO_SYSTEM_ID ALLEGRO_SYSTEM_ID; +typedef enum A5O_SYSTEM_ID A5O_SYSTEM_ID; /* Function: al_init */ -#define al_init() (al_install_system(ALLEGRO_VERSION_INT, atexit)) +#define al_init() (al_install_system(A5O_VERSION_INT, atexit)) AL_FUNC(bool, al_install_system, (int version, int (*atexit_ptr)(void (*)(void)))); AL_FUNC(void, al_uninstall_system, (void)); AL_FUNC(bool, al_is_system_installed, (void)); -AL_FUNC(ALLEGRO_SYSTEM *, al_get_system_driver, (void)); -AL_FUNC(ALLEGRO_CONFIG *, al_get_system_config, (void)); -AL_FUNC(ALLEGRO_SYSTEM_ID, al_get_system_id, (void)); +AL_FUNC(A5O_SYSTEM *, al_get_system_driver, (void)); +AL_FUNC(A5O_CONFIG *, al_get_system_config, (void)); +AL_FUNC(A5O_SYSTEM_ID, al_get_system_id, (void)); enum { - ALLEGRO_RESOURCES_PATH = 0, - ALLEGRO_TEMP_PATH, - ALLEGRO_USER_DATA_PATH, - ALLEGRO_USER_HOME_PATH, - ALLEGRO_USER_SETTINGS_PATH, - ALLEGRO_USER_DOCUMENTS_PATH, - ALLEGRO_EXENAME_PATH, - ALLEGRO_LAST_PATH /* must be last */ + A5O_RESOURCES_PATH = 0, + A5O_TEMP_PATH, + A5O_USER_DATA_PATH, + A5O_USER_HOME_PATH, + A5O_USER_SETTINGS_PATH, + A5O_USER_DOCUMENTS_PATH, + A5O_EXENAME_PATH, + A5O_LAST_PATH /* must be last */ }; -AL_FUNC(ALLEGRO_PATH *, al_get_standard_path, (int id)); +AL_FUNC(A5O_PATH *, al_get_standard_path, (int id)); AL_FUNC(void, al_set_exe_name, (char const *path)); AL_FUNC(void, al_set_org_name, (const char *org_name)); diff --git a/include/allegro5/threads.h b/include/allegro5/threads.h index 5a94a1639f..0a66bb5a1b 100644 --- a/include/allegro5/threads.h +++ b/include/allegro5/threads.h @@ -22,45 +22,45 @@ extern "C" { #endif -/* Type: ALLEGRO_THREAD +/* Type: A5O_THREAD */ -typedef struct ALLEGRO_THREAD ALLEGRO_THREAD; +typedef struct A5O_THREAD A5O_THREAD; -/* Type: ALLEGRO_MUTEX +/* Type: A5O_MUTEX */ -typedef struct ALLEGRO_MUTEX ALLEGRO_MUTEX; +typedef struct A5O_MUTEX A5O_MUTEX; -/* Type: ALLEGRO_COND +/* Type: A5O_COND */ -typedef struct ALLEGRO_COND ALLEGRO_COND; +typedef struct A5O_COND A5O_COND; -AL_FUNC(ALLEGRO_THREAD *, al_create_thread, - (void *(*proc)(ALLEGRO_THREAD *thread, void *arg), void *arg)); -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) -AL_FUNC(ALLEGRO_THREAD *, al_create_thread_with_stacksize, - (void *(*proc)(ALLEGRO_THREAD *thread, void *arg), void *arg, size_t stacksize)); +AL_FUNC(A5O_THREAD *, al_create_thread, + (void *(*proc)(A5O_THREAD *thread, void *arg), void *arg)); +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_SRC) +AL_FUNC(A5O_THREAD *, al_create_thread_with_stacksize, + (void *(*proc)(A5O_THREAD *thread, void *arg), void *arg, size_t stacksize)); #endif -AL_FUNC(void, al_start_thread, (ALLEGRO_THREAD *outer)); -AL_FUNC(void, al_join_thread, (ALLEGRO_THREAD *outer, void **ret_value)); -AL_FUNC(void, al_set_thread_should_stop, (ALLEGRO_THREAD *outer)); -AL_FUNC(bool, al_get_thread_should_stop, (ALLEGRO_THREAD *outer)); -AL_FUNC(void, al_destroy_thread, (ALLEGRO_THREAD *thread)); +AL_FUNC(void, al_start_thread, (A5O_THREAD *outer)); +AL_FUNC(void, al_join_thread, (A5O_THREAD *outer, void **ret_value)); +AL_FUNC(void, al_set_thread_should_stop, (A5O_THREAD *outer)); +AL_FUNC(bool, al_get_thread_should_stop, (A5O_THREAD *outer)); +AL_FUNC(void, al_destroy_thread, (A5O_THREAD *thread)); AL_FUNC(void, al_run_detached_thread, (void *(*proc)(void *arg), void *arg)); -AL_FUNC(ALLEGRO_MUTEX *, al_create_mutex, (void)); -AL_FUNC(ALLEGRO_MUTEX *, al_create_mutex_recursive, (void)); -AL_FUNC(void, al_lock_mutex, (ALLEGRO_MUTEX *mutex)); -AL_FUNC(void, al_unlock_mutex, (ALLEGRO_MUTEX *mutex)); -AL_FUNC(void, al_destroy_mutex, (ALLEGRO_MUTEX *mutex)); +AL_FUNC(A5O_MUTEX *, al_create_mutex, (void)); +AL_FUNC(A5O_MUTEX *, al_create_mutex_recursive, (void)); +AL_FUNC(void, al_lock_mutex, (A5O_MUTEX *mutex)); +AL_FUNC(void, al_unlock_mutex, (A5O_MUTEX *mutex)); +AL_FUNC(void, al_destroy_mutex, (A5O_MUTEX *mutex)); -AL_FUNC(ALLEGRO_COND *, al_create_cond, (void)); -AL_FUNC(void, al_destroy_cond, (ALLEGRO_COND *cond)); -AL_FUNC(void, al_wait_cond, (ALLEGRO_COND *cond, ALLEGRO_MUTEX *mutex)); -AL_FUNC(int, al_wait_cond_until, (ALLEGRO_COND *cond, ALLEGRO_MUTEX *mutex, - const ALLEGRO_TIMEOUT *timeout)); -AL_FUNC(void, al_broadcast_cond, (ALLEGRO_COND *cond)); -AL_FUNC(void, al_signal_cond, (ALLEGRO_COND *cond)); +AL_FUNC(A5O_COND *, al_create_cond, (void)); +AL_FUNC(void, al_destroy_cond, (A5O_COND *cond)); +AL_FUNC(void, al_wait_cond, (A5O_COND *cond, A5O_MUTEX *mutex)); +AL_FUNC(int, al_wait_cond_until, (A5O_COND *cond, A5O_MUTEX *mutex, + const A5O_TIMEOUT *timeout)); +AL_FUNC(void, al_broadcast_cond, (A5O_COND *cond)); +AL_FUNC(void, al_signal_cond, (A5O_COND *cond)); #ifdef __cplusplus } diff --git a/include/allegro5/timer.h b/include/allegro5/timer.h index 1d6bffddd9..3fb2b6e5fe 100644 --- a/include/allegro5/timer.h +++ b/include/allegro5/timer.h @@ -24,40 +24,40 @@ #endif -/* Function: ALLEGRO_USECS_TO_SECS +/* Function: A5O_USECS_TO_SECS */ -#define ALLEGRO_USECS_TO_SECS(x) ((x) / 1000000.0) +#define A5O_USECS_TO_SECS(x) ((x) / 1000000.0) -/* Function: ALLEGRO_MSECS_TO_SECS +/* Function: A5O_MSECS_TO_SECS */ -#define ALLEGRO_MSECS_TO_SECS(x) ((x) / 1000.0) +#define A5O_MSECS_TO_SECS(x) ((x) / 1000.0) -/* Function: ALLEGRO_BPS_TO_SECS +/* Function: A5O_BPS_TO_SECS */ -#define ALLEGRO_BPS_TO_SECS(x) (1.0 / (x)) +#define A5O_BPS_TO_SECS(x) (1.0 / (x)) -/* Function: ALLEGRO_BPM_TO_SECS +/* Function: A5O_BPM_TO_SECS */ -#define ALLEGRO_BPM_TO_SECS(x) (60.0 / (x)) +#define A5O_BPM_TO_SECS(x) (60.0 / (x)) -/* Type: ALLEGRO_TIMER +/* Type: A5O_TIMER */ -typedef struct ALLEGRO_TIMER ALLEGRO_TIMER; +typedef struct A5O_TIMER A5O_TIMER; -AL_FUNC(ALLEGRO_TIMER*, al_create_timer, (double speed_secs)); -AL_FUNC(void, al_destroy_timer, (ALLEGRO_TIMER *timer)); -AL_FUNC(void, al_start_timer, (ALLEGRO_TIMER *timer)); -AL_FUNC(void, al_stop_timer, (ALLEGRO_TIMER *timer)); -AL_FUNC(void, al_resume_timer, (ALLEGRO_TIMER *timer)); -AL_FUNC(bool, al_get_timer_started, (const ALLEGRO_TIMER *timer)); -AL_FUNC(double, al_get_timer_speed, (const ALLEGRO_TIMER *timer)); -AL_FUNC(void, al_set_timer_speed, (ALLEGRO_TIMER *timer, double speed_secs)); -AL_FUNC(int64_t, al_get_timer_count, (const ALLEGRO_TIMER *timer)); -AL_FUNC(void, al_set_timer_count, (ALLEGRO_TIMER *timer, int64_t count)); -AL_FUNC(void, al_add_timer_count, (ALLEGRO_TIMER *timer, int64_t diff)); -AL_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_timer_event_source, (ALLEGRO_TIMER *timer)); +AL_FUNC(A5O_TIMER*, al_create_timer, (double speed_secs)); +AL_FUNC(void, al_destroy_timer, (A5O_TIMER *timer)); +AL_FUNC(void, al_start_timer, (A5O_TIMER *timer)); +AL_FUNC(void, al_stop_timer, (A5O_TIMER *timer)); +AL_FUNC(void, al_resume_timer, (A5O_TIMER *timer)); +AL_FUNC(bool, al_get_timer_started, (const A5O_TIMER *timer)); +AL_FUNC(double, al_get_timer_speed, (const A5O_TIMER *timer)); +AL_FUNC(void, al_set_timer_speed, (A5O_TIMER *timer, double speed_secs)); +AL_FUNC(int64_t, al_get_timer_count, (const A5O_TIMER *timer)); +AL_FUNC(void, al_set_timer_count, (A5O_TIMER *timer, int64_t count)); +AL_FUNC(void, al_add_timer_count, (A5O_TIMER *timer, int64_t diff)); +AL_FUNC(A5O_EVENT_SOURCE *, al_get_timer_event_source, (A5O_TIMER *timer)); #ifdef __cplusplus diff --git a/include/allegro5/tls.h b/include/allegro5/tls.h index 949b18a734..a519dcc971 100644 --- a/include/allegro5/tls.h +++ b/include/allegro5/tls.h @@ -23,40 +23,40 @@ #endif -/* Enum: ALLEGRO_STATE_FLAGS +/* Enum: A5O_STATE_FLAGS */ -typedef enum ALLEGRO_STATE_FLAGS +typedef enum A5O_STATE_FLAGS { - ALLEGRO_STATE_NEW_DISPLAY_PARAMETERS = 0x0001, - ALLEGRO_STATE_NEW_BITMAP_PARAMETERS = 0x0002, - ALLEGRO_STATE_DISPLAY = 0x0004, - ALLEGRO_STATE_TARGET_BITMAP = 0x0008, - ALLEGRO_STATE_BLENDER = 0x0010, - ALLEGRO_STATE_NEW_FILE_INTERFACE = 0x0020, - ALLEGRO_STATE_TRANSFORM = 0x0040, - ALLEGRO_STATE_PROJECTION_TRANSFORM = 0x0100, + A5O_STATE_NEW_DISPLAY_PARAMETERS = 0x0001, + A5O_STATE_NEW_BITMAP_PARAMETERS = 0x0002, + A5O_STATE_DISPLAY = 0x0004, + A5O_STATE_TARGET_BITMAP = 0x0008, + A5O_STATE_BLENDER = 0x0010, + A5O_STATE_NEW_FILE_INTERFACE = 0x0020, + A5O_STATE_TRANSFORM = 0x0040, + A5O_STATE_PROJECTION_TRANSFORM = 0x0100, - ALLEGRO_STATE_BITMAP = ALLEGRO_STATE_TARGET_BITMAP +\ - ALLEGRO_STATE_NEW_BITMAP_PARAMETERS, + A5O_STATE_BITMAP = A5O_STATE_TARGET_BITMAP +\ + A5O_STATE_NEW_BITMAP_PARAMETERS, - ALLEGRO_STATE_ALL = 0xffff + A5O_STATE_ALL = 0xffff -} ALLEGRO_STATE_FLAGS; +} A5O_STATE_FLAGS; -/* Type: ALLEGRO_STATE +/* Type: A5O_STATE */ -typedef struct ALLEGRO_STATE ALLEGRO_STATE; +typedef struct A5O_STATE A5O_STATE; -struct ALLEGRO_STATE +struct A5O_STATE { /* Internally, a thread_local_state structure is placed here. */ char _tls[1024]; }; -AL_FUNC(void, al_store_state, (ALLEGRO_STATE *state, int flags)); -AL_FUNC(void, al_restore_state, (ALLEGRO_STATE const *state)); +AL_FUNC(void, al_store_state, (A5O_STATE *state, int flags)); +AL_FUNC(void, al_restore_state, (A5O_STATE const *state)); #ifdef __cplusplus diff --git a/include/allegro5/touch_input.h b/include/allegro5/touch_input.h index cd2f3bce09..851fbd8668 100644 --- a/include/allegro5/touch_input.h +++ b/include/allegro5/touch_input.h @@ -24,27 +24,27 @@ #endif -/* Enum: ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT +/* Enum: A5O_TOUCH_INPUT_MAX_TOUCH_COUNT */ -#define ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT 16 +#define A5O_TOUCH_INPUT_MAX_TOUCH_COUNT 16 -/* Type: ALLEGRO_TOUCH_INPUT +/* Type: A5O_TOUCH_INPUT */ -typedef struct ALLEGRO_TOUCH_INPUT ALLEGRO_TOUCH_INPUT; +typedef struct A5O_TOUCH_INPUT A5O_TOUCH_INPUT; -/* Type: ALLEGRO_TOUCH_INPUT_STATE +/* Type: A5O_TOUCH_INPUT_STATE */ -typedef struct ALLEGRO_TOUCH_INPUT_STATE ALLEGRO_TOUCH_INPUT_STATE; +typedef struct A5O_TOUCH_INPUT_STATE A5O_TOUCH_INPUT_STATE; -/* Type: ALLEGRO_TOUCH_STATE +/* Type: A5O_TOUCH_STATE */ -typedef struct ALLEGRO_TOUCH_STATE ALLEGRO_TOUCH_STATE; +typedef struct A5O_TOUCH_STATE A5O_TOUCH_STATE; -struct ALLEGRO_TOUCH_STATE +struct A5O_TOUCH_STATE { /* (id) An identifier of touch. If touch is valid this number is positive. * (x, y) Touch position on the screen in 1:1 resolution. @@ -56,39 +56,39 @@ struct ALLEGRO_TOUCH_STATE float x, y; float dx, dy; bool primary; - struct ALLEGRO_DISPLAY *display; + struct A5O_DISPLAY *display; }; -struct ALLEGRO_TOUCH_INPUT_STATE +struct A5O_TOUCH_INPUT_STATE { - ALLEGRO_TOUCH_STATE touches[ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT]; + A5O_TOUCH_STATE touches[A5O_TOUCH_INPUT_MAX_TOUCH_COUNT]; }; -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) -/* Enum: ALLEGRO_MOUSE_EMULATION_MODE +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_SRC) +/* Enum: A5O_MOUSE_EMULATION_MODE */ -typedef enum ALLEGRO_MOUSE_EMULATION_MODE +typedef enum A5O_MOUSE_EMULATION_MODE { - ALLEGRO_MOUSE_EMULATION_NONE, - ALLEGRO_MOUSE_EMULATION_TRANSPARENT, - ALLEGRO_MOUSE_EMULATION_INCLUSIVE, - ALLEGRO_MOUSE_EMULATION_EXCLUSIVE, - ALLEGRO_MOUSE_EMULATION_5_0_x -} ALLEGRO_MOUSE_EMULATION_MODE; + A5O_MOUSE_EMULATION_NONE, + A5O_MOUSE_EMULATION_TRANSPARENT, + A5O_MOUSE_EMULATION_INCLUSIVE, + A5O_MOUSE_EMULATION_EXCLUSIVE, + A5O_MOUSE_EMULATION_5_0_x +} A5O_MOUSE_EMULATION_MODE; #endif AL_FUNC(bool, al_is_touch_input_installed, (void)); AL_FUNC(bool, al_install_touch_input, (void)); AL_FUNC(void, al_uninstall_touch_input, (void)); -AL_FUNC(void, al_get_touch_input_state, (ALLEGRO_TOUCH_INPUT_STATE *ret_state)); -AL_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_touch_input_event_source, (void)); +AL_FUNC(void, al_get_touch_input_state, (A5O_TOUCH_INPUT_STATE *ret_state)); +AL_FUNC(A5O_EVENT_SOURCE *, al_get_touch_input_event_source, (void)); -#if defined(ALLEGRO_UNSTABLE) || defined(ALLEGRO_INTERNAL_UNSTABLE) || defined(ALLEGRO_SRC) +#if defined(A5O_UNSTABLE) || defined(A5O_INTERNAL_UNSTABLE) || defined(A5O_SRC) AL_FUNC(void, al_set_mouse_emulation_mode, (int mode)); AL_FUNC(int, al_get_mouse_emulation_mode, (void)); -AL_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_touch_input_mouse_emulation_event_source, (void)); +AL_FUNC(A5O_EVENT_SOURCE *, al_get_touch_input_mouse_emulation_event_source, (void)); #endif #ifdef __cplusplus diff --git a/include/allegro5/transformations.h b/include/allegro5/transformations.h index fe146f1007..4e22ab0b87 100644 --- a/include/allegro5/transformations.h +++ b/include/allegro5/transformations.h @@ -7,48 +7,48 @@ extern "C" { #endif -/* Type: ALLEGRO_TRANSFORM +/* Type: A5O_TRANSFORM */ -typedef struct ALLEGRO_TRANSFORM ALLEGRO_TRANSFORM; +typedef struct A5O_TRANSFORM A5O_TRANSFORM; -struct ALLEGRO_TRANSFORM { +struct A5O_TRANSFORM { float m[4][4]; }; /* Transformations*/ -AL_FUNC(void, al_use_transform, (const ALLEGRO_TRANSFORM* trans)); -AL_FUNC(void, al_use_projection_transform, (const ALLEGRO_TRANSFORM* trans)); -AL_FUNC(void, al_copy_transform, (ALLEGRO_TRANSFORM* dest, const ALLEGRO_TRANSFORM* src)); -AL_FUNC(void, al_identity_transform, (ALLEGRO_TRANSFORM* trans)); -AL_FUNC(void, al_build_transform, (ALLEGRO_TRANSFORM* trans, float x, float y, float sx, float sy, float theta)); -AL_FUNC(void, al_build_camera_transform, (ALLEGRO_TRANSFORM *trans, +AL_FUNC(void, al_use_transform, (const A5O_TRANSFORM* trans)); +AL_FUNC(void, al_use_projection_transform, (const A5O_TRANSFORM* trans)); +AL_FUNC(void, al_copy_transform, (A5O_TRANSFORM* dest, const A5O_TRANSFORM* src)); +AL_FUNC(void, al_identity_transform, (A5O_TRANSFORM* trans)); +AL_FUNC(void, al_build_transform, (A5O_TRANSFORM* trans, float x, float y, float sx, float sy, float theta)); +AL_FUNC(void, al_build_camera_transform, (A5O_TRANSFORM *trans, float position_x, float position_y, float position_z, float look_x, float look_y, float look_z, float up_x, float up_y, float up_z)); -AL_FUNC(void, al_translate_transform, (ALLEGRO_TRANSFORM* trans, float x, float y)); -AL_FUNC(void, al_translate_transform_3d, (ALLEGRO_TRANSFORM *trans, float x, float y, float z)); -AL_FUNC(void, al_rotate_transform, (ALLEGRO_TRANSFORM* trans, float theta)); -AL_FUNC(void, al_rotate_transform_3d, (ALLEGRO_TRANSFORM *trans, float x, float y, float z, float angle)); -AL_FUNC(void, al_scale_transform, (ALLEGRO_TRANSFORM* trans, float sx, float sy)); -AL_FUNC(void, al_scale_transform_3d, (ALLEGRO_TRANSFORM *trans, float sx, float sy, float sz)); -AL_FUNC(void, al_transform_coordinates, (const ALLEGRO_TRANSFORM* trans, float* x, float* y)); -AL_FUNC(void, al_transform_coordinates_3d, (const ALLEGRO_TRANSFORM *trans, +AL_FUNC(void, al_translate_transform, (A5O_TRANSFORM* trans, float x, float y)); +AL_FUNC(void, al_translate_transform_3d, (A5O_TRANSFORM *trans, float x, float y, float z)); +AL_FUNC(void, al_rotate_transform, (A5O_TRANSFORM* trans, float theta)); +AL_FUNC(void, al_rotate_transform_3d, (A5O_TRANSFORM *trans, float x, float y, float z, float angle)); +AL_FUNC(void, al_scale_transform, (A5O_TRANSFORM* trans, float sx, float sy)); +AL_FUNC(void, al_scale_transform_3d, (A5O_TRANSFORM *trans, float sx, float sy, float sz)); +AL_FUNC(void, al_transform_coordinates, (const A5O_TRANSFORM* trans, float* x, float* y)); +AL_FUNC(void, al_transform_coordinates_3d, (const A5O_TRANSFORM *trans, float *x, float *y, float *z)); -AL_FUNC(void, al_transform_coordinates_4d, (const ALLEGRO_TRANSFORM *trans, +AL_FUNC(void, al_transform_coordinates_4d, (const A5O_TRANSFORM *trans, float *x, float *y, float *z, float *w)); -AL_FUNC(void, al_transform_coordinates_3d_projective, (const ALLEGRO_TRANSFORM *trans, +AL_FUNC(void, al_transform_coordinates_3d_projective, (const A5O_TRANSFORM *trans, float *x, float *y, float *z)); -AL_FUNC(void, al_compose_transform, (ALLEGRO_TRANSFORM* trans, const ALLEGRO_TRANSFORM* other)); -AL_FUNC(const ALLEGRO_TRANSFORM*, al_get_current_transform, (void)); -AL_FUNC(const ALLEGRO_TRANSFORM*, al_get_current_inverse_transform, (void)); -AL_FUNC(const ALLEGRO_TRANSFORM *, al_get_current_projection_transform, (void)); -AL_FUNC(void, al_invert_transform, (ALLEGRO_TRANSFORM *trans)); -AL_FUNC(void, al_transpose_transform, (ALLEGRO_TRANSFORM *trans)); -AL_FUNC(int, al_check_inverse, (const ALLEGRO_TRANSFORM *trans, float tol)); -AL_FUNC(void, al_orthographic_transform, (ALLEGRO_TRANSFORM *trans, float left, float top, float n, float right, float bottom, float f)); -AL_FUNC(void, al_perspective_transform, (ALLEGRO_TRANSFORM *trans, float left, float top, float n, float right, float bottom, float f)); -AL_FUNC(void, al_horizontal_shear_transform, (ALLEGRO_TRANSFORM *trans, float theta)); -AL_FUNC(void, al_vertical_shear_transform, (ALLEGRO_TRANSFORM *trans, float theta)); +AL_FUNC(void, al_compose_transform, (A5O_TRANSFORM* trans, const A5O_TRANSFORM* other)); +AL_FUNC(const A5O_TRANSFORM*, al_get_current_transform, (void)); +AL_FUNC(const A5O_TRANSFORM*, al_get_current_inverse_transform, (void)); +AL_FUNC(const A5O_TRANSFORM *, al_get_current_projection_transform, (void)); +AL_FUNC(void, al_invert_transform, (A5O_TRANSFORM *trans)); +AL_FUNC(void, al_transpose_transform, (A5O_TRANSFORM *trans)); +AL_FUNC(int, al_check_inverse, (const A5O_TRANSFORM *trans, float tol)); +AL_FUNC(void, al_orthographic_transform, (A5O_TRANSFORM *trans, float left, float top, float n, float right, float bottom, float f)); +AL_FUNC(void, al_perspective_transform, (A5O_TRANSFORM *trans, float left, float top, float n, float right, float bottom, float f)); +AL_FUNC(void, al_horizontal_shear_transform, (A5O_TRANSFORM *trans, float theta)); +AL_FUNC(void, al_vertical_shear_transform, (A5O_TRANSFORM *trans, float theta)); #ifdef __cplusplus } diff --git a/include/allegro5/utf8.h b/include/allegro5/utf8.h index cb94a77bb7..b17846d61d 100644 --- a/include/allegro5/utf8.h +++ b/include/allegro5/utf8.h @@ -7,13 +7,13 @@ extern "C" { #endif -/* Type: ALLEGRO_USTR +/* Type: A5O_USTR */ -typedef struct _al_tagbstring ALLEGRO_USTR; +typedef struct _al_tagbstring A5O_USTR; -/* Type: ALLEGRO_USTR_INFO +/* Type: A5O_USTR_INFO */ -typedef struct _al_tagbstring ALLEGRO_USTR_INFO; +typedef struct _al_tagbstring A5O_USTR_INFO; #ifndef __al_tagbstring_defined #define __al_tagbstring_defined @@ -25,120 +25,120 @@ struct _al_tagbstring { #endif /* Creating strings */ -AL_FUNC(ALLEGRO_USTR *, al_ustr_new, (const char *s)); -AL_FUNC(ALLEGRO_USTR *, al_ustr_new_from_buffer, (const char *s, size_t size)); -AL_PRINTFUNC(ALLEGRO_USTR *, al_ustr_newf, (const char *fmt, ...), 1, 2); -AL_FUNC(void, al_ustr_free, (ALLEGRO_USTR *us)); -AL_FUNC(const char *, al_cstr, (const ALLEGRO_USTR *us)); -AL_FUNC(void, al_ustr_to_buffer, (const ALLEGRO_USTR *us, char *buffer, int size)); -AL_FUNC(char *, al_cstr_dup, (const ALLEGRO_USTR *us)); -AL_FUNC(ALLEGRO_USTR *, al_ustr_dup, (const ALLEGRO_USTR *us)); -AL_FUNC(ALLEGRO_USTR *, al_ustr_dup_substr, (const ALLEGRO_USTR *us, +AL_FUNC(A5O_USTR *, al_ustr_new, (const char *s)); +AL_FUNC(A5O_USTR *, al_ustr_new_from_buffer, (const char *s, size_t size)); +AL_PRINTFUNC(A5O_USTR *, al_ustr_newf, (const char *fmt, ...), 1, 2); +AL_FUNC(void, al_ustr_free, (A5O_USTR *us)); +AL_FUNC(const char *, al_cstr, (const A5O_USTR *us)); +AL_FUNC(void, al_ustr_to_buffer, (const A5O_USTR *us, char *buffer, int size)); +AL_FUNC(char *, al_cstr_dup, (const A5O_USTR *us)); +AL_FUNC(A5O_USTR *, al_ustr_dup, (const A5O_USTR *us)); +AL_FUNC(A5O_USTR *, al_ustr_dup_substr, (const A5O_USTR *us, int start_pos, int end_pos)); /* Predefined string */ -AL_FUNC(const ALLEGRO_USTR *, al_ustr_empty_string, (void)); +AL_FUNC(const A5O_USTR *, al_ustr_empty_string, (void)); /* Reference strings */ -AL_FUNC(const ALLEGRO_USTR *, al_ref_cstr, (ALLEGRO_USTR_INFO *info, const char *s)); -AL_FUNC(const ALLEGRO_USTR *, al_ref_buffer, (ALLEGRO_USTR_INFO *info, const char *s, +AL_FUNC(const A5O_USTR *, al_ref_cstr, (A5O_USTR_INFO *info, const char *s)); +AL_FUNC(const A5O_USTR *, al_ref_buffer, (A5O_USTR_INFO *info, const char *s, size_t size)); -AL_FUNC(const ALLEGRO_USTR *, al_ref_ustr, (ALLEGRO_USTR_INFO *info, - const ALLEGRO_USTR *us, int start_pos, int end_pos)); -AL_FUNC(const ALLEGRO_USTR *, al_ref_info, (const ALLEGRO_USTR_INFO *info)); +AL_FUNC(const A5O_USTR *, al_ref_ustr, (A5O_USTR_INFO *info, + const A5O_USTR *us, int start_pos, int end_pos)); +AL_FUNC(const A5O_USTR *, al_ref_info, (const A5O_USTR_INFO *info)); /* Sizes and offsets */ -AL_FUNC(size_t, al_ustr_size, (const ALLEGRO_USTR *us)); -AL_FUNC(size_t, al_ustr_length, (const ALLEGRO_USTR *us)); -AL_FUNC(int, al_ustr_offset, (const ALLEGRO_USTR *us, int index)); -AL_FUNC(bool, al_ustr_next, (const ALLEGRO_USTR *us, int *pos)); -AL_FUNC(bool, al_ustr_prev, (const ALLEGRO_USTR *us, int *pos)); +AL_FUNC(size_t, al_ustr_size, (const A5O_USTR *us)); +AL_FUNC(size_t, al_ustr_length, (const A5O_USTR *us)); +AL_FUNC(int, al_ustr_offset, (const A5O_USTR *us, int index)); +AL_FUNC(bool, al_ustr_next, (const A5O_USTR *us, int *pos)); +AL_FUNC(bool, al_ustr_prev, (const A5O_USTR *us, int *pos)); /* Get codepoints */ -AL_FUNC(int32_t, al_ustr_get, (const ALLEGRO_USTR *us, int pos)); -AL_FUNC(int32_t, al_ustr_get_next, (const ALLEGRO_USTR *us, int *pos)); -AL_FUNC(int32_t, al_ustr_prev_get, (const ALLEGRO_USTR *us, int *pos)); +AL_FUNC(int32_t, al_ustr_get, (const A5O_USTR *us, int pos)); +AL_FUNC(int32_t, al_ustr_get_next, (const A5O_USTR *us, int *pos)); +AL_FUNC(int32_t, al_ustr_prev_get, (const A5O_USTR *us, int *pos)); /* Insert */ -AL_FUNC(bool, al_ustr_insert, (ALLEGRO_USTR *us1, int pos, - const ALLEGRO_USTR *us2)); -AL_FUNC(bool, al_ustr_insert_cstr, (ALLEGRO_USTR *us, int pos, +AL_FUNC(bool, al_ustr_insert, (A5O_USTR *us1, int pos, + const A5O_USTR *us2)); +AL_FUNC(bool, al_ustr_insert_cstr, (A5O_USTR *us, int pos, const char *us2)); -AL_FUNC(size_t, al_ustr_insert_chr, (ALLEGRO_USTR *us, int pos, int32_t c)); +AL_FUNC(size_t, al_ustr_insert_chr, (A5O_USTR *us, int pos, int32_t c)); /* Append */ -AL_FUNC(bool, al_ustr_append, (ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2)); -AL_FUNC(bool, al_ustr_append_cstr, (ALLEGRO_USTR *us, const char *s)); -AL_FUNC(size_t, al_ustr_append_chr, (ALLEGRO_USTR *us, int32_t c)); -AL_PRINTFUNC(bool, al_ustr_appendf, (ALLEGRO_USTR *us, const char *fmt, ...), +AL_FUNC(bool, al_ustr_append, (A5O_USTR *us1, const A5O_USTR *us2)); +AL_FUNC(bool, al_ustr_append_cstr, (A5O_USTR *us, const char *s)); +AL_FUNC(size_t, al_ustr_append_chr, (A5O_USTR *us, int32_t c)); +AL_PRINTFUNC(bool, al_ustr_appendf, (A5O_USTR *us, const char *fmt, ...), 2, 3); -AL_FUNC(bool, al_ustr_vappendf, (ALLEGRO_USTR *us, const char *fmt, +AL_FUNC(bool, al_ustr_vappendf, (A5O_USTR *us, const char *fmt, va_list ap)); /* Remove */ -AL_FUNC(bool, al_ustr_remove_chr, (ALLEGRO_USTR *us, int pos)); -AL_FUNC(bool, al_ustr_remove_range, (ALLEGRO_USTR *us, int start_pos, +AL_FUNC(bool, al_ustr_remove_chr, (A5O_USTR *us, int pos)); +AL_FUNC(bool, al_ustr_remove_range, (A5O_USTR *us, int start_pos, int end_pos)); -AL_FUNC(bool, al_ustr_truncate, (ALLEGRO_USTR *us, int start_pos)); -AL_FUNC(bool, al_ustr_ltrim_ws, (ALLEGRO_USTR *us)); -AL_FUNC(bool, al_ustr_rtrim_ws, (ALLEGRO_USTR *us)); -AL_FUNC(bool, al_ustr_trim_ws, (ALLEGRO_USTR *us)); +AL_FUNC(bool, al_ustr_truncate, (A5O_USTR *us, int start_pos)); +AL_FUNC(bool, al_ustr_ltrim_ws, (A5O_USTR *us)); +AL_FUNC(bool, al_ustr_rtrim_ws, (A5O_USTR *us)); +AL_FUNC(bool, al_ustr_trim_ws, (A5O_USTR *us)); /* Assign */ -AL_FUNC(bool, al_ustr_assign, (ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2)); -AL_FUNC(bool, al_ustr_assign_substr, (ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2, +AL_FUNC(bool, al_ustr_assign, (A5O_USTR *us1, const A5O_USTR *us2)); +AL_FUNC(bool, al_ustr_assign_substr, (A5O_USTR *us1, const A5O_USTR *us2, int start_pos, int end_pos)); -AL_FUNC(bool, al_ustr_assign_cstr, (ALLEGRO_USTR *us1, const char *s)); +AL_FUNC(bool, al_ustr_assign_cstr, (A5O_USTR *us1, const char *s)); /* Replace */ -AL_FUNC(size_t, al_ustr_set_chr, (ALLEGRO_USTR *us, int pos, int32_t c)); -AL_FUNC(bool, al_ustr_replace_range, (ALLEGRO_USTR *us1, int start_pos1, - int end_pos1, const ALLEGRO_USTR *us2)); +AL_FUNC(size_t, al_ustr_set_chr, (A5O_USTR *us, int pos, int32_t c)); +AL_FUNC(bool, al_ustr_replace_range, (A5O_USTR *us1, int start_pos1, + int end_pos1, const A5O_USTR *us2)); /* Searching */ -AL_FUNC(int, al_ustr_find_chr, (const ALLEGRO_USTR *us, int start_pos, +AL_FUNC(int, al_ustr_find_chr, (const A5O_USTR *us, int start_pos, int32_t c)); -AL_FUNC(int, al_ustr_rfind_chr, (const ALLEGRO_USTR *us, int start_pos, +AL_FUNC(int, al_ustr_rfind_chr, (const A5O_USTR *us, int start_pos, int32_t c)); -AL_FUNC(int, al_ustr_find_set, (const ALLEGRO_USTR *us, int start_pos, - const ALLEGRO_USTR *accept)); -AL_FUNC(int, al_ustr_find_set_cstr, (const ALLEGRO_USTR *us, int start_pos, +AL_FUNC(int, al_ustr_find_set, (const A5O_USTR *us, int start_pos, + const A5O_USTR *accept)); +AL_FUNC(int, al_ustr_find_set_cstr, (const A5O_USTR *us, int start_pos, const char *accept)); -AL_FUNC(int, al_ustr_find_cset, (const ALLEGRO_USTR *us, int start_pos, - const ALLEGRO_USTR *reject)); -AL_FUNC(int, al_ustr_find_cset_cstr, (const ALLEGRO_USTR *us, int start_pos, +AL_FUNC(int, al_ustr_find_cset, (const A5O_USTR *us, int start_pos, + const A5O_USTR *reject)); +AL_FUNC(int, al_ustr_find_cset_cstr, (const A5O_USTR *us, int start_pos, const char *reject)); -AL_FUNC(int, al_ustr_find_str, (const ALLEGRO_USTR *haystack, int start_pos, - const ALLEGRO_USTR *needle)); -AL_FUNC(int, al_ustr_find_cstr, (const ALLEGRO_USTR *haystack, int start_pos, +AL_FUNC(int, al_ustr_find_str, (const A5O_USTR *haystack, int start_pos, + const A5O_USTR *needle)); +AL_FUNC(int, al_ustr_find_cstr, (const A5O_USTR *haystack, int start_pos, const char *needle)); -AL_FUNC(int, al_ustr_rfind_str, (const ALLEGRO_USTR *haystack, int start_pos, - const ALLEGRO_USTR *needle)); -AL_FUNC(int, al_ustr_rfind_cstr, (const ALLEGRO_USTR *haystack, int start_pos, +AL_FUNC(int, al_ustr_rfind_str, (const A5O_USTR *haystack, int start_pos, + const A5O_USTR *needle)); +AL_FUNC(int, al_ustr_rfind_cstr, (const A5O_USTR *haystack, int start_pos, const char *needle)); -AL_FUNC(bool, al_ustr_find_replace, (ALLEGRO_USTR *us, int start_pos, - const ALLEGRO_USTR *find, const ALLEGRO_USTR *replace)); -AL_FUNC(bool, al_ustr_find_replace_cstr, (ALLEGRO_USTR *us, int start_pos, +AL_FUNC(bool, al_ustr_find_replace, (A5O_USTR *us, int start_pos, + const A5O_USTR *find, const A5O_USTR *replace)); +AL_FUNC(bool, al_ustr_find_replace_cstr, (A5O_USTR *us, int start_pos, const char *find, const char *replace)); /* Compare */ -AL_FUNC(bool, al_ustr_equal, (const ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2)); -AL_FUNC(int, al_ustr_compare, (const ALLEGRO_USTR *u, const ALLEGRO_USTR *v)); -AL_FUNC(int, al_ustr_ncompare, (const ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2, +AL_FUNC(bool, al_ustr_equal, (const A5O_USTR *us1, const A5O_USTR *us2)); +AL_FUNC(int, al_ustr_compare, (const A5O_USTR *u, const A5O_USTR *v)); +AL_FUNC(int, al_ustr_ncompare, (const A5O_USTR *us1, const A5O_USTR *us2, int n)); -AL_FUNC(bool, al_ustr_has_prefix,(const ALLEGRO_USTR *u, const ALLEGRO_USTR *v)); -AL_FUNC(bool, al_ustr_has_prefix_cstr, (const ALLEGRO_USTR *u, const char *s)); -AL_FUNC(bool, al_ustr_has_suffix,(const ALLEGRO_USTR *u, const ALLEGRO_USTR *v)); -AL_FUNC(bool, al_ustr_has_suffix_cstr,(const ALLEGRO_USTR *us1, const char *s)); +AL_FUNC(bool, al_ustr_has_prefix,(const A5O_USTR *u, const A5O_USTR *v)); +AL_FUNC(bool, al_ustr_has_prefix_cstr, (const A5O_USTR *u, const char *s)); +AL_FUNC(bool, al_ustr_has_suffix,(const A5O_USTR *u, const A5O_USTR *v)); +AL_FUNC(bool, al_ustr_has_suffix_cstr,(const A5O_USTR *us1, const char *s)); /* Low level UTF-8 functions */ AL_FUNC(size_t, al_utf8_width, (int32_t c)); AL_FUNC(size_t, al_utf8_encode, (char s[], int32_t c)); /* UTF-16 */ -AL_FUNC(ALLEGRO_USTR *, al_ustr_new_from_utf16, (uint16_t const *s)); -AL_FUNC(size_t, al_ustr_size_utf16, (const ALLEGRO_USTR *us)); -AL_FUNC(size_t, al_ustr_encode_utf16, (const ALLEGRO_USTR *us, uint16_t *s, size_t n)); +AL_FUNC(A5O_USTR *, al_ustr_new_from_utf16, (uint16_t const *s)); +AL_FUNC(size_t, al_ustr_size_utf16, (const A5O_USTR *us)); +AL_FUNC(size_t, al_ustr_encode_utf16, (const A5O_USTR *us, uint16_t *s, size_t n)); AL_FUNC(size_t, al_utf16_width, (int c)); AL_FUNC(size_t, al_utf16_encode, (uint16_t s[], int32_t c)); diff --git a/indent.pro b/indent.pro index 8e0847c002..96e0b14964 100644 --- a/indent.pro +++ b/indent.pro @@ -1,5 +1,5 @@ -kr -nce -ss -ncs -i3 -cli3 -nut -bls -l80 --T ALLEGRO_BITMAP +-T A5O_BITMAP -T PACKFILE -T BMPINFOHEADER -T PalEntry diff --git a/misc/.!61120!icon.png b/misc/.!61120!icon.png new file mode 100644 index 0000000000..e69de29bb2 diff --git a/misc/Allegro5_iOS/Allegro5_iOS.xcodeproj/project.pbxproj b/misc/Allegro5_iOS/Allegro5_iOS.xcodeproj/project.pbxproj index 216985cbc7..4cd6ee58e4 100644 --- a/misc/Allegro5_iOS/Allegro5_iOS.xcodeproj/project.pbxproj +++ b/misc/Allegro5_iOS/Allegro5_iOS.xcodeproj/project.pbxproj @@ -625,9 +625,9 @@ CLANG_CXX_LIBRARY = "libstdc++"; CLANG_ENABLE_OBJC_ARC = NO; GCC_PREPROCESSOR_DEFINITIONS = ( - ALLEGRO_LIB_BUILD, - ALLEGRO_UNSTABLE, - ALLEGRO_INTERNAL_UNSTABLE, + A5O_LIB_BUILD, + A5O_UNSTABLE, + A5O_INTERNAL_UNSTABLE, ); HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -663,9 +663,9 @@ CLANG_ENABLE_OBJC_ARC = NO; GCC_OPTIMIZATION_LEVEL = s; GCC_PREPROCESSOR_DEFINITIONS = ( - ALLEGRO_LIB_BUILD, - ALLEGRO_UNSTABLE, - ALLEGRO_INTERNAL_UNSTABLE, + A5O_LIB_BUILD, + A5O_UNSTABLE, + A5O_INTERNAL_UNSTABLE, ); HEADER_SEARCH_PATHS = ( "$(inherited)", diff --git a/misc/Allegro5_iOS/allegro5/internal/aintern_image_cfg.h b/misc/Allegro5_iOS/allegro5/internal/aintern_image_cfg.h index 70f7cd8e76..152e22a8da 100644 --- a/misc/Allegro5_iOS/allegro5/internal/aintern_image_cfg.h +++ b/misc/Allegro5_iOS/allegro5/internal/aintern_image_cfg.h @@ -1,14 +1,14 @@ -/* #define ALLEGRO_CFG_WANT_NATIVE_IMAGE_LOADER */ +/* #define A5O_CFG_WANT_NATIVE_IMAGE_LOADER */ /* which libraries are present and needed? */ -/* #undef ALLEGRO_CFG_IIO_HAVE_GDIPLUS */ -/* #undef ALLEGRO_CFG_IIO_HAVE_GDIPLUS_LOWERCASE_H */ -/* #undef ALLEGRO_CFG_IIO_HAVE_ANDROID */ -/* #undef ALLEGRO_CFG_IIO_HAVE_PNG */ -/* #undef ALLEGRO_CFG_IIO_HAVE_JPG */ +/* #undef A5O_CFG_IIO_HAVE_GDIPLUS */ +/* #undef A5O_CFG_IIO_HAVE_GDIPLUS_LOWERCASE_H */ +/* #undef A5O_CFG_IIO_HAVE_ANDROID */ +/* #undef A5O_CFG_IIO_HAVE_PNG */ +/* #undef A5O_CFG_IIO_HAVE_JPG */ -#define ALLEGRO_CFG_IIO_HAVE_PNG +#define A5O_CFG_IIO_HAVE_PNG /* which formats are supported and wanted? */ -#define ALLEGRO_CFG_IIO_SUPPORT_PNG -//#define ALLEGRO_CFG_IIO_SUPPORT_JPG +#define A5O_CFG_IIO_SUPPORT_PNG +//#define A5O_CFG_IIO_SUPPORT_JPG diff --git a/misc/Allegro5_iOS/allegro5/internal/aintern_ttf_cfg.h b/misc/Allegro5_iOS/allegro5/internal/aintern_ttf_cfg.h index ad50e076c6..cae0e0f113 100644 --- a/misc/Allegro5_iOS/allegro5/internal/aintern_ttf_cfg.h +++ b/misc/Allegro5_iOS/allegro5/internal/aintern_ttf_cfg.h @@ -1 +1 @@ -/* #undef ALLEGRO_CFG_TTF_FREETYPE */ +/* #undef A5O_CFG_TTF_FREETYPE */ diff --git a/misc/Allegro5_iOS/allegro5/platform/alplatf.h b/misc/Allegro5_iOS/allegro5/platform/alplatf.h index b3257979f9..88a2066e44 100644 --- a/misc/Allegro5_iOS/allegro5/platform/alplatf.h +++ b/misc/Allegro5_iOS/allegro5/platform/alplatf.h @@ -1,109 +1,109 @@ /* alplatf.h is generated from alplatf.h.cmake */ -/* #undef ALLEGRO_MINGW32 */ -/* #undef ALLEGRO_UNIX */ -/* #undef ALLEGRO_MSVC */ -/* #undef ALLEGRO_MACOSX */ -/* #undef ALLEGRO_BCC32 */ -#define ALLEGRO_IPHONE -/* #undef ALLEGRO_ANDROID */ -/* #undef ALLEGRO_RASPBERRYPI */ -/* #undef ALLEGRO_CFG_NO_FPU */ -/* #undef ALLEGRO_CFG_DLL_TLS */ -#define ALLEGRO_CFG_PTHREADS_TLS -/* #undef ALLEGRO_CFG_RELEASE_LOGGING */ - -/* #undef ALLEGRO_CFG_D3D */ -/* #undef ALLEGRO_CFG_D3D9EX */ -/* #undef ALLEGRO_CFG_D3DX9 */ -/* #undef ALLEGRO_CFG_XINPUT */ -#define ALLEGRO_CFG_OPENGL -#define ALLEGRO_CFG_OPENGLES -#define ALLEGRO_CFG_OPENGLES2 -#define ALLEGRO_CFG_OPENGL_PROGRAMMABLE_PIPELINE -#define ALLEGRO_CFG_SHADER_GLSL -/* #undef ALLEGRO_CFG_SHADER_HLSL */ -/* #undef ALLEGRO_CFG_OPENGL_S3TC_LOCKING */ - -/* #undef ALLEGRO_CFG_ANDROID_LEGACY */ +/* #undef A5O_MINGW32 */ +/* #undef A5O_UNIX */ +/* #undef A5O_MSVC */ +/* #undef A5O_MACOSX */ +/* #undef A5O_BCC32 */ +#define A5O_IPHONE +/* #undef A5O_ANDROID */ +/* #undef A5O_RASPBERRYPI */ +/* #undef A5O_CFG_NO_FPU */ +/* #undef A5O_CFG_DLL_TLS */ +#define A5O_CFG_PTHREADS_TLS +/* #undef A5O_CFG_RELEASE_LOGGING */ + +/* #undef A5O_CFG_D3D */ +/* #undef A5O_CFG_D3D9EX */ +/* #undef A5O_CFG_D3DX9 */ +/* #undef A5O_CFG_XINPUT */ +#define A5O_CFG_OPENGL +#define A5O_CFG_OPENGLES +#define A5O_CFG_OPENGLES2 +#define A5O_CFG_OPENGL_PROGRAMMABLE_PIPELINE +#define A5O_CFG_SHADER_GLSL +/* #undef A5O_CFG_SHADER_HLSL */ +/* #undef A5O_CFG_OPENGL_S3TC_LOCKING */ + +/* #undef A5O_CFG_ANDROID_LEGACY */ /*---------------------------------------------------------------------------*/ /* Define to 1 if you have the corresponding header file. */ -#define ALLEGRO_HAVE_DIRENT_H -#define ALLEGRO_HAVE_INTTYPES_H -/* #undef ALLEGRO_HAVE_LINUX_AWE_VOICE_H */ -/* #undef ALLEGRO_HAVE_LINUX_INPUT_H */ -/* #undef ALLEGRO_HAVE_LINUX_SOUNDCARD_H */ -/* #undef ALLEGRO_HAVE_MACHINE_SOUNDCARD_H */ -/* #undef ALLEGRO_HAVE_SOUNDCARD_H */ -#define ALLEGRO_HAVE_STDBOOL_H -#define ALLEGRO_HAVE_STDINT_H -/* #undef ALLEGRO_HAVE_SV_PROCFS_H */ -/* #undef ALLEGRO_HAVE_SYS_IO_H */ -/* #undef ALLEGRO_HAVE_SYS_SOUNDCARD_H */ -#define ALLEGRO_HAVE_SYS_STAT_H -#define ALLEGRO_HAVE_SYS_TIME_H -#define ALLEGRO_HAVE_TIME_H -#define ALLEGRO_HAVE_SYS_UTSNAME_H -#define ALLEGRO_HAVE_SYS_TYPES_H -#define ALLEGRO_HAVE_OSATOMIC_H -/* #undef ALLEGRO_HAVE_SYS_INOTIFY_H */ -/* #undef ALLEGRO_HAVE_SAL_H */ +#define A5O_HAVE_DIRENT_H +#define A5O_HAVE_INTTYPES_H +/* #undef A5O_HAVE_LINUX_AWE_VOICE_H */ +/* #undef A5O_HAVE_LINUX_INPUT_H */ +/* #undef A5O_HAVE_LINUX_SOUNDCARD_H */ +/* #undef A5O_HAVE_MACHINE_SOUNDCARD_H */ +/* #undef A5O_HAVE_SOUNDCARD_H */ +#define A5O_HAVE_STDBOOL_H +#define A5O_HAVE_STDINT_H +/* #undef A5O_HAVE_SV_PROCFS_H */ +/* #undef A5O_HAVE_SYS_IO_H */ +/* #undef A5O_HAVE_SYS_SOUNDCARD_H */ +#define A5O_HAVE_SYS_STAT_H +#define A5O_HAVE_SYS_TIME_H +#define A5O_HAVE_TIME_H +#define A5O_HAVE_SYS_UTSNAME_H +#define A5O_HAVE_SYS_TYPES_H +#define A5O_HAVE_OSATOMIC_H +/* #undef A5O_HAVE_SYS_INOTIFY_H */ +/* #undef A5O_HAVE_SAL_H */ /* Define to 1 if the corresponding functions are available. */ -/* #undef ALLEGRO_HAVE_GETEXECNAME */ -#define ALLEGRO_HAVE_MKSTEMP -#define ALLEGRO_HAVE_MMAP -#define ALLEGRO_HAVE_MPROTECT -#define ALLEGRO_HAVE_SCHED_YIELD -#define ALLEGRO_HAVE_SYSCONF -#define ALLEGRO_HAVE_FSEEKO -#define ALLEGRO_HAVE_FTELLO -#define ALLEGRO_HAVE_STRERROR_R -/* #undef ALLEGRO_HAVE_STRERROR_S */ -#define ALLEGRO_HAVE_VA_COPY +/* #undef A5O_HAVE_GETEXECNAME */ +#define A5O_HAVE_MKSTEMP +#define A5O_HAVE_MMAP +#define A5O_HAVE_MPROTECT +#define A5O_HAVE_SCHED_YIELD +#define A5O_HAVE_SYSCONF +#define A5O_HAVE_FSEEKO +#define A5O_HAVE_FTELLO +#define A5O_HAVE_STRERROR_R +/* #undef A5O_HAVE_STRERROR_S */ +#define A5O_HAVE_VA_COPY /* Define to 1 if procfs reveals argc and argv */ -/* #undef ALLEGRO_HAVE_PROCFS_ARGCV */ +/* #undef A5O_HAVE_PROCFS_ARGCV */ /*---------------------------------------------------------------------------*/ /* Define if target machine is little endian. */ -#define ALLEGRO_LITTLE_ENDIAN +#define A5O_LITTLE_ENDIAN /* Define if target machine is big endian. */ -/* #undef ALLEGRO_BIG_ENDIAN */ +/* #undef A5O_BIG_ENDIAN */ /* Define if target platform is Darwin. */ -/* #undef ALLEGRO_DARWIN */ +/* #undef A5O_DARWIN */ /*---------------------------------------------------------------------------*/ /* Define if you need support for X-Windows. */ -/* #undef ALLEGRO_WITH_XWINDOWS */ +/* #undef A5O_WITH_XWINDOWS */ /* Define if XCursor ARGB extension is available. */ -/* #undef ALLEGRO_XWINDOWS_WITH_XCURSOR */ +/* #undef A5O_XWINDOWS_WITH_XCURSOR */ /* Define if XF86VidMode extension is supported. */ -/* #undef ALLEGRO_XWINDOWS_WITH_XF86VIDMODE */ +/* #undef A5O_XWINDOWS_WITH_XF86VIDMODE */ /* Define if Xinerama extension is supported. */ -/* #undef ALLEGRO_XWINDOWS_WITH_XINERAMA */ +/* #undef A5O_XWINDOWS_WITH_XINERAMA */ /* Define if XRandR extension is supported. */ -/* #undef ALLEGRO_XWINDOWS_WITH_XRANDR */ +/* #undef A5O_XWINDOWS_WITH_XRANDR */ /* Define if XIM extension is supported. */ -/* #undef ALLEGRO_XWINDOWS_WITH_XIM */ +/* #undef A5O_XWINDOWS_WITH_XIM */ /*---------------------------------------------------------------------------*/ /* Define if target platform is linux. */ -/* #undef ALLEGRO_LINUX */ +/* #undef A5O_LINUX */ /* Define if we are building with SDL backend. */ -/* #undef ALLEGRO_SDL */ +/* #undef A5O_SDL */ /*---------------------------------------------------------------------------*/ /* vi: set ft=c ts=3 sts=3 sw=3 et: */ diff --git a/misc/allegro.pc.in b/misc/allegro.pc.in index c7185cfe78..4d76941662 100644 --- a/misc/allegro.pc.in +++ b/misc/allegro.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=${prefix} libdir=@libdir@ includedir=@includedir@ -version=@ALLEGRO_VERSION@ +version=@A5O_VERSION@ suffix=@lib_type@@lib_linkage@ versuffix=@versuffix@ diff --git a/misc/allegro_acodec.pc.in b/misc/allegro_acodec.pc.in index 2187dea927..db44695c4a 100644 --- a/misc/allegro_acodec.pc.in +++ b/misc/allegro_acodec.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=${prefix} libdir=@libdir@ includedir=@includedir@ -version=@ALLEGRO_VERSION@ +version=@A5O_VERSION@ suffix=@lib_type@@lib_linkage@ versuffix=@versuffix@ diff --git a/misc/allegro_audio.pc.in b/misc/allegro_audio.pc.in index 3ce87fdd9c..0cff701e5a 100644 --- a/misc/allegro_audio.pc.in +++ b/misc/allegro_audio.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=${prefix} libdir=@libdir@ includedir=@includedir@ -version=@ALLEGRO_VERSION@ +version=@A5O_VERSION@ suffix=@lib_type@@lib_linkage@ versuffix=@versuffix@ diff --git a/misc/allegro_color.pc.in b/misc/allegro_color.pc.in index fc985b0d1a..8254a462cb 100644 --- a/misc/allegro_color.pc.in +++ b/misc/allegro_color.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=${prefix} libdir=@libdir@ includedir=@includedir@ -version=@ALLEGRO_VERSION@ +version=@A5O_VERSION@ suffix=@lib_type@@lib_linkage@ versuffix=@versuffix@ diff --git a/misc/allegro_dialog.pc.in b/misc/allegro_dialog.pc.in index 67b8cb7200..103f27449e 100644 --- a/misc/allegro_dialog.pc.in +++ b/misc/allegro_dialog.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=${prefix} libdir=@libdir@ includedir=@includedir@ -version=@ALLEGRO_VERSION@ +version=@A5O_VERSION@ suffix=@lib_type@@lib_linkage@ versuffix=@versuffix@ diff --git a/misc/allegro_font.pc.in b/misc/allegro_font.pc.in index 46ea1d5681..e5f4417d2d 100644 --- a/misc/allegro_font.pc.in +++ b/misc/allegro_font.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=${prefix} libdir=@libdir@ includedir=@includedir@ -version=@ALLEGRO_VERSION@ +version=@A5O_VERSION@ suffix=@lib_type@@lib_linkage@ versuffix=@versuffix@ diff --git a/misc/allegro_image.pc.in b/misc/allegro_image.pc.in index 4bdc9f00fa..b0cb48775f 100644 --- a/misc/allegro_image.pc.in +++ b/misc/allegro_image.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=${prefix} libdir=@libdir@ includedir=@includedir@ -version=@ALLEGRO_VERSION@ +version=@A5O_VERSION@ suffix=@lib_type@@lib_linkage@ versuffix=@versuffix@ diff --git a/misc/allegro_main.pc.in b/misc/allegro_main.pc.in index 0f620d5740..6c91ae9871 100644 --- a/misc/allegro_main.pc.in +++ b/misc/allegro_main.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=${prefix} libdir=@libdir@ includedir=@includedir@ -version=@ALLEGRO_VERSION@ +version=@A5O_VERSION@ suffix=@lib_type@@lib_linkage@ versuffix=@versuffix@ diff --git a/misc/allegro_memfile.pc.in b/misc/allegro_memfile.pc.in index f6887de619..b6acae4cac 100644 --- a/misc/allegro_memfile.pc.in +++ b/misc/allegro_memfile.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=${prefix} libdir=@libdir@ includedir=@includedir@ -version=@ALLEGRO_VERSION@ +version=@A5O_VERSION@ suffix=@lib_type@@lib_linkage@ versuffix=@versuffix@ diff --git a/misc/allegro_monolith.pc.in b/misc/allegro_monolith.pc.in index f8bcc488c2..eab99449b1 100644 --- a/misc/allegro_monolith.pc.in +++ b/misc/allegro_monolith.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=${prefix} libdir=@libdir@ includedir=@includedir@ -version=@ALLEGRO_VERSION@ +version=@A5O_VERSION@ suffix=@lib_type@@lib_linkage@ versuffix=@versuffix@ diff --git a/misc/allegro_physfs.pc.in b/misc/allegro_physfs.pc.in index 2a0d7d8f25..00a56c9782 100644 --- a/misc/allegro_physfs.pc.in +++ b/misc/allegro_physfs.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=${prefix} libdir=@libdir@ includedir=@includedir@ -version=@ALLEGRO_VERSION@ +version=@A5O_VERSION@ suffix=@lib_type@@lib_linkage@ versuffix=@versuffix@ diff --git a/misc/allegro_primitives.pc.in b/misc/allegro_primitives.pc.in index 1932353be9..210f830c84 100644 --- a/misc/allegro_primitives.pc.in +++ b/misc/allegro_primitives.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=${prefix} libdir=@libdir@ includedir=@includedir@ -version=@ALLEGRO_VERSION@ +version=@A5O_VERSION@ suffix=@lib_type@@lib_linkage@ versuffix=@versuffix@ diff --git a/misc/allegro_ttf.pc.in b/misc/allegro_ttf.pc.in index be44bc491a..75a777f8be 100644 --- a/misc/allegro_ttf.pc.in +++ b/misc/allegro_ttf.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=${prefix} libdir=@libdir@ includedir=@includedir@ -version=@ALLEGRO_VERSION@ +version=@A5O_VERSION@ suffix=@lib_type@@lib_linkage@ versuffix=@versuffix@ diff --git a/misc/allegro_video.pc.in b/misc/allegro_video.pc.in index 566a4bbffb..1ad799559c 100644 --- a/misc/allegro_video.pc.in +++ b/misc/allegro_video.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=${prefix} libdir=@libdir@ includedir=@includedir@ -version=@ALLEGRO_VERSION@ +version=@A5O_VERSION@ suffix=@lib_type@@lib_linkage@ versuffix=@versuffix@ diff --git a/misc/dtou.sh b/misc/dtou.sh index 2788f000f9..838c868727 100755 --- a/misc/dtou.sh +++ b/misc/dtou.sh @@ -37,7 +37,7 @@ then exit fi -if test "$ALLEGRO_USE_CYGWIN" = "1" +if test "$A5O_USE_CYGWIN" = "1" then with_cygwin "$@" else diff --git a/misc/fixver.sh b/misc/fixver.sh index 1d8d30b201..07426b9979 100755 --- a/misc/fixver.sh +++ b/misc/fixver.sh @@ -9,9 +9,9 @@ BASE_H_FILE="include/allegro5/base.h" if [ $# -eq 1 ] && [ "$1" = "datestamp" ]; then - major_num=$( awk '/^#define\s+ALLEGRO_VERSION\s+[0-9]+$/ { print $NF }' $BASE_H_FILE ) - sub_num=$( awk '/^#define\s+ALLEGRO_SUB_VERSION\s+[0-9]+$/ { print $NF }' $BASE_H_FILE ) - wip_num=$( awk '/^#define\s+ALLEGRO_WIP_VERSION\s+[0-9]+$/ { print $NF }' $BASE_H_FILE ) + major_num=$( awk '/^#define\s+A5O_VERSION\s+[0-9]+$/ { print $NF }' $BASE_H_FILE ) + sub_num=$( awk '/^#define\s+A5O_SUB_VERSION\s+[0-9]+$/ { print $NF }' $BASE_H_FILE ) + wip_num=$( awk '/^#define\s+A5O_WIP_VERSION\s+[0-9]+$/ { print $NF }' $BASE_H_FILE ) datestamp=`date '+%Y%m%d'` echo "Re-invoking script with args: [$major_num $sub_num $wip_num $datestamp]" $0 $major_num $sub_num $wip_num $datestamp @@ -74,13 +74,13 @@ day=$(date +%d) datestr="$(date +%b) $day, $year" # patch allegro/base.h -echo "s/\#define ALLEGRO_VERSION .*/\#define ALLEGRO_VERSION $1/" > fixver.sed -echo "s/\#define ALLEGRO_SUB_VERSION .*/\#define ALLEGRO_SUB_VERSION $2/" >> fixver.sed -echo "s/\#define ALLEGRO_WIP_VERSION .*/\#define ALLEGRO_WIP_VERSION $3/" >> fixver.sed -echo "s/\#define ALLEGRO_RELEASE_NUMBER .*/\#define ALLEGRO_RELEASE_NUMBER $fourth/" >> fixver.sed -echo "s/\#define ALLEGRO_VERSION_STR .*/\#define ALLEGRO_VERSION_STR \"$verstr\"/" >> fixver.sed -echo "s/\#define ALLEGRO_DATE_STR .*/\#define ALLEGRO_DATE_STR \"$year\"/" >> fixver.sed -echo "s/\#define ALLEGRO_DATE .*/\#define ALLEGRO_DATE $year$month$day \/\* yyyymmdd \*\//" >> fixver.sed +echo "s/\#define A5O_VERSION .*/\#define A5O_VERSION $1/" > fixver.sed +echo "s/\#define A5O_SUB_VERSION .*/\#define A5O_SUB_VERSION $2/" >> fixver.sed +echo "s/\#define A5O_WIP_VERSION .*/\#define A5O_WIP_VERSION $3/" >> fixver.sed +echo "s/\#define A5O_RELEASE_NUMBER .*/\#define A5O_RELEASE_NUMBER $fourth/" >> fixver.sed +echo "s/\#define A5O_VERSION_STR .*/\#define A5O_VERSION_STR \"$verstr\"/" >> fixver.sed +echo "s/\#define A5O_DATE_STR .*/\#define A5O_DATE_STR \"$year\"/" >> fixver.sed +echo "s/\#define A5O_DATE .*/\#define A5O_DATE $year$month$day \/\* yyyymmdd \*\//" >> fixver.sed echo "Patching ${BASE_H_FILE}..." cp $BASE_H_FILE fixver.tmp diff --git a/misc/install_test.c b/misc/install_test.c index 8334dc18d3..388613ac7a 100644 --- a/misc/install_test.c +++ b/misc/install_test.c @@ -26,8 +26,8 @@ int main() { int release = version & 255; fprintf(stderr, "Library version: %d.%d.%d.%d\n", major, minor, revision, release); - fprintf(stderr, "Header version: %d.%d.%d.%d\n", ALLEGRO_VERSION, ALLEGRO_SUB_VERSION, ALLEGRO_WIP_VERSION, ALLEGRO_RELEASE_NUMBER); - fprintf(stderr, "Header version string: %s\n", ALLEGRO_VERSION_STR); + fprintf(stderr, "Header version: %d.%d.%d.%d\n", A5O_VERSION, A5O_SUB_VERSION, A5O_WIP_VERSION, A5O_RELEASE_NUMBER); + fprintf(stderr, "Header version string: %s\n", A5O_VERSION_STR); if (!al_init()) { fprintf(stderr, "Failed to initialize Allegro, probably a header/shared library version mismatch.\n"); diff --git a/misc/make_converters.py b/misc/make_converters.py index b14ddad500..a523d8e615 100755 --- a/misc/make_converters.py +++ b/misc/make_converters.py @@ -13,9 +13,9 @@ def read_color_h(filename): for line in open(filename): line = line.strip() if line == "{": continue - if line == "typedef enum ALLEGRO_PIXEL_FORMAT": inside_enum = True + if line == "typedef enum A5O_PIXEL_FORMAT": inside_enum = True elif inside_enum: - match = re.match(r"\s*ALLEGRO_PIXEL_FORMAT_(\w+)", line) + match = re.match(r"\s*A5O_PIXEL_FORMAT_(\w+)", line) if match: formats.append(match.group(1)) else: @@ -255,12 +255,12 @@ def converter_macro(info_a, info_b): """ if not info_a or not info_b: return None - name = "ALLEGRO_CONVERT_" + info_a.name + "_TO_" + info_b.name + name = "A5O_CONVERT_" + info_a.name + "_TO_" + info_b.name r = "" if info_a.little_endian or info_b.little_endian: - r += "#ifdef ALLEGRO_BIG_ENDIAN\n" + r += "#ifdef A5O_BIG_ENDIAN\n" r += "#define " + name + "(x) \\\n" if info_a.name == "ABGR_8888_LE": r += macro_lines(formats_by_name["RGBA_8888"], info_b) @@ -315,7 +315,7 @@ def converter_function(info_a, info_b): params += " int sx, int sy, int dx, int dy, int width, int height" declaration = "static void " + name + "(" + params + ")" - macro_name = "ALLEGRO_CONVERT_" + info_a.name + "_TO_" + info_b.name + macro_name = "A5O_CONVERT_" + info_a.name + "_TO_" + info_b.name types_and_sizes = { 8 : ("uint8_t", "", 1), @@ -323,7 +323,7 @@ def converter_function(info_a, info_b): 16 : ("uint16_t", "", 2), 24: ("uint8_t", " * 3", 1), 32 : ("uint32_t", "", 4), - 128 : ("ALLEGRO_COLOR", "", 16)} + 128 : ("A5O_COLOR", "", 16)} a_type, a_count, a_size = types_and_sizes[info_a.size] b_type, b_count, b_size = types_and_sizes[info_b.size] @@ -336,7 +336,7 @@ def converter_function(info_a, info_b): if a_count != "": s_conversion = """\ - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); @@ -345,7 +345,7 @@ def converter_function(info_a, info_b): if b_count != "": d_conversion = """\ - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -419,8 +419,8 @@ def write_convert_c(filename): f.write(function) f.write("""\ -void (*_al_convert_funcs[ALLEGRO_NUM_PIXEL_FORMATS] - [ALLEGRO_NUM_PIXEL_FORMATS])(const void *, int, void *, int, +void (*_al_convert_funcs[A5O_NUM_PIXEL_FORMATS] + [A5O_NUM_PIXEL_FORMATS])(const void *, int, void *, int, int, int, int, int, int, int) = { """) for a in formats_list: diff --git a/misc/make_mixer_helpers.py b/misc/make_mixer_helpers.py index ba3afcf6ac..4e5abdf765 100755 --- a/misc/make_mixer_helpers.py +++ b/misc/make_mixer_helpers.py @@ -23,7 +23,7 @@ def index(self, fmt): class Depth_f32(Depth): def constant(self): - return "ALLEGRO_AUDIO_DEPTH_FLOAT32" + return "A5O_AUDIO_DEPTH_FLOAT32" def index_f32(self, buf, index): return interp("#{buf}.f32[ #{index} ]") def index_s16(self, buf, index): @@ -31,7 +31,7 @@ def index_s16(self, buf, index): class Depth_int24(Depth): def constant(self): - return "ALLEGRO_AUDIO_DEPTH_INT24" + return "A5O_AUDIO_DEPTH_INT24" def index_f32(self, buf, index): return interp("(float) #{buf}.s24[ #{index} ] / ((float)0x7FFFFF + 0.5f)") def index_s16(self, buf, index): @@ -39,7 +39,7 @@ def index_s16(self, buf, index): class Depth_uint24(Depth): def constant(self): - return "ALLEGRO_AUDIO_DEPTH_UINT24" + return "A5O_AUDIO_DEPTH_UINT24" def index_f32(self, buf, index): return interp("(float) #{buf}.u24[ #{index} ] / ((float)0x7FFFFF + 0.5f) - 1.0f") def index_s16(self, buf, index): @@ -47,7 +47,7 @@ def index_s16(self, buf, index): class Depth_int16(Depth): def constant(self): - return "ALLEGRO_AUDIO_DEPTH_INT16" + return "A5O_AUDIO_DEPTH_INT16" def index_f32(self, buf, index): return interp("(float) #{buf}.s16[ #{index} ] / ((float)0x7FFF + 0.5f)") def index_s16(self, buf, index): @@ -55,7 +55,7 @@ def index_s16(self, buf, index): class Depth_uint16(Depth): def constant(self): - return "ALLEGRO_AUDIO_DEPTH_UINT16" + return "A5O_AUDIO_DEPTH_UINT16" def index_f32(self, buf, index): return interp("(float) #{buf}.u16[ #{index} ] / ((float)0x7FFF + 0.5f) - 1.0f") def index_s16(self, buf, index): @@ -63,7 +63,7 @@ def index_s16(self, buf, index): class Depth_int8(Depth): def constant(self): - return "ALLEGRO_AUDIO_DEPTH_INT8" + return "A5O_AUDIO_DEPTH_INT8" def index_f32(self, buf, index): return interp("(float) #{buf}.s8[ #{index} ] / ((float)0x7F + 0.5f)") def index_s16(self, buf, index): @@ -71,7 +71,7 @@ def index_s16(self, buf, index): class Depth_uint8(Depth): def constant(self): - return "ALLEGRO_AUDIO_DEPTH_UINT8" + return "A5O_AUDIO_DEPTH_UINT8" def index_f32(self, buf, index): return interp("(float) #{buf}.u8[ #{index} ] / ((float)0x7F + 0.5f) - 1.0f") def index_s16(self, buf, index): @@ -92,7 +92,7 @@ def make_point_interpolator(name, fmt): static INLINE const void * #{name} (SAMP_BUF *samp_buf, - const ALLEGRO_SAMPLE_INSTANCE *spl, + const A5O_SAMPLE_INSTANCE *spl, unsigned int maxc) { unsigned int i0 = spl->pos*maxc; @@ -123,32 +123,32 @@ def make_linear_interpolator(name, fmt): static INLINE const void * #{name} (SAMP_BUF *samp_buf, - const ALLEGRO_SAMPLE_INSTANCE *spl, + const A5O_SAMPLE_INSTANCE *spl, unsigned int maxc) { int p0 = spl->pos; int p1 = spl->pos+1; switch (spl->loop) { - case ALLEGRO_PLAYMODE_ONCE: + case A5O_PLAYMODE_ONCE: if (p1 >= spl->spl_data.len) p1 = p0; break; - case ALLEGRO_PLAYMODE_LOOP_ONCE: - case ALLEGRO_PLAYMODE_LOOP: + case A5O_PLAYMODE_LOOP_ONCE: + case A5O_PLAYMODE_LOOP: if (p1 >= spl->loop_end) p1 = spl->loop_start; break; - case ALLEGRO_PLAYMODE_BIDIR: + case A5O_PLAYMODE_BIDIR: if (p1 >= spl->loop_end) { p1 = spl->loop_end - 1; if (p1 < spl->loop_start) p1 = spl->loop_start; } break; - case _ALLEGRO_PLAYMODE_STREAM_ONCE: - case _ALLEGRO_PLAYMODE_STREAM_LOOP_ONCE: - case _ALLEGRO_PLAYMODE_STREAM_ONEDIR:""" + + case _A5O_PLAYMODE_STREAM_ONCE: + case _A5O_PLAYMODE_STREAM_LOOP_ONCE: + case _A5O_PLAYMODE_STREAM_ONEDIR:""" + # For audio streams, sample i+1 may be in the next buffer fragment, # which may not even be generated yet. So we lag by one sample and # interpolate between sample i-1 and sample i. @@ -213,7 +213,7 @@ def make_cubic_interpolator(name, fmt): static INLINE const void * #{name} (SAMP_BUF *samp_buf, - const ALLEGRO_SAMPLE_INSTANCE *spl, + const A5O_SAMPLE_INSTANCE *spl, unsigned int maxc) { int p0 = spl->pos-1; @@ -222,7 +222,7 @@ def make_cubic_interpolator(name, fmt): int p3 = spl->pos+2; switch (spl->loop) { - case ALLEGRO_PLAYMODE_ONCE: + case A5O_PLAYMODE_ONCE: if (p0 < 0) p0 = 0; if (p2 >= spl->spl_data.len) @@ -230,9 +230,9 @@ def make_cubic_interpolator(name, fmt): if (p3 >= spl->spl_data.len) p3 = spl->spl_data.len - 1; break; - case ALLEGRO_PLAYMODE_LOOP_ONCE: - case ALLEGRO_PLAYMODE_LOOP: - case ALLEGRO_PLAYMODE_BIDIR: + case A5O_PLAYMODE_LOOP_ONCE: + case A5O_PLAYMODE_LOOP: + case A5O_PLAYMODE_BIDIR: /* These positions should really wrap/bounce instead of clamping * but it's probably unnoticeable. */ @@ -243,9 +243,9 @@ def make_cubic_interpolator(name, fmt): if (p3 >= spl->loop_end) p3 = spl->loop_start; break; - case _ALLEGRO_PLAYMODE_STREAM_ONCE: - case _ALLEGRO_PLAYMODE_STREAM_LOOP_ONCE: - case _ALLEGRO_PLAYMODE_STREAM_ONEDIR: + case _A5O_PLAYMODE_STREAM_ONCE: + case _A5O_PLAYMODE_STREAM_LOOP_ONCE: + case _A5O_PLAYMODE_STREAM_ONEDIR: /* Lag by three samples in total. */ p0 -= 2; p1 -= 2; diff --git a/misc/make_scanline_drawers.py b/misc/make_scanline_drawers.py index 2cafcc14b8..1f8c67ae52 100755 --- a/misc/make_scanline_drawers.py +++ b/misc/make_scanline_drawers.py @@ -38,19 +38,19 @@ def make_drawer(name): print("""\ state_grad_any_2d *gs = (state_grad_any_2d *)state; state_solid_any_2d *s = &gs->solid; - ALLEGRO_COLOR cur_color = s->cur_color; + A5O_COLOR cur_color = s->cur_color; """) else: print("""\ state_solid_any_2d *s = (state_solid_any_2d *)state; - ALLEGRO_COLOR cur_color = s->cur_color; + A5O_COLOR cur_color = s->cur_color; """) else: if grad: print("""\ state_texture_grad_any_2d *gs = (state_texture_grad_any_2d *)state; state_texture_solid_any_2d *s = &gs->solid; - ALLEGRO_COLOR cur_color = s->cur_color; + A5O_COLOR cur_color = s->cur_color; """) else: print("""\ @@ -63,7 +63,7 @@ def make_drawer(name): # XXX still don't understand why y-1 is required print("""\ - ALLEGRO_BITMAP *target = s->target; + A5O_BITMAP *target = s->target; if (target->parent) { x1 += target->xofs; @@ -111,7 +111,7 @@ def make_drawer(name): print("""\ int op, src_mode, dst_mode; int op_alpha, src_alpha, dst_alpha; - ALLEGRO_COLOR const_color; + A5O_COLOR const_color; al_get_separate_bitmap_blender(&op, &src_mode, &dst_mode, &op_alpha, &src_alpha, &dst_alpha); const_color = al_get_blend_color(); @@ -122,10 +122,10 @@ def make_drawer(name): print("""\ const int offset_x = s->texture->parent ? s->texture->xofs : 0; const int offset_y = s->texture->parent ? s->texture->yofs : 0; - ALLEGRO_BITMAP* texture = s->texture->parent ? s->texture->parent : s->texture; + A5O_BITMAP* texture = s->texture->parent ? s->texture->parent : s->texture; const int src_format = texture->locked_region.format; const int src_size = texture->locked_region.pixel_size; - ALLEGRO_BITMAP_WRAP wrap_u, wrap_v; + A5O_BITMAP_WRAP wrap_u, wrap_v; _al_get_bitmap_wrap(texture, &wrap_u, &wrap_v); int tile_u = (int)(floorf(u / s->w)); int tile_v = (int)(floorf(v / s->h)); @@ -149,40 +149,40 @@ def make_drawer(name): if shade: make_if_blender_loop( - op='ALLEGRO_ADD', - src_mode='ALLEGRO_ONE', - src_alpha='ALLEGRO_ONE', - op_alpha='ALLEGRO_ADD', - dst_mode='ALLEGRO_INVERSE_ALPHA', - dst_alpha='ALLEGRO_INVERSE_ALPHA', + op='A5O_ADD', + src_mode='A5O_ONE', + src_alpha='A5O_ONE', + op_alpha='A5O_ADD', + dst_mode='A5O_INVERSE_ALPHA', + dst_alpha='A5O_INVERSE_ALPHA', const_color='NULL', - if_format='ALLEGRO_PIXEL_FORMAT_ARGB_8888', + if_format='A5O_PIXEL_FORMAT_ARGB_8888', alpha_only=True, repeat=repeat, ) print("else") make_if_blender_loop( - op='ALLEGRO_ADD', - src_mode='ALLEGRO_ALPHA', - src_alpha='ALLEGRO_ALPHA', - op_alpha='ALLEGRO_ADD', - dst_mode='ALLEGRO_INVERSE_ALPHA', - dst_alpha='ALLEGRO_INVERSE_ALPHA', + op='A5O_ADD', + src_mode='A5O_ALPHA', + src_alpha='A5O_ALPHA', + op_alpha='A5O_ADD', + dst_mode='A5O_INVERSE_ALPHA', + dst_alpha='A5O_INVERSE_ALPHA', const_color='NULL', - if_format='ALLEGRO_PIXEL_FORMAT_ARGB_8888', + if_format='A5O_PIXEL_FORMAT_ARGB_8888', alpha_only=True, repeat=repeat, ) print("else") make_if_blender_loop( - op='ALLEGRO_ADD', - src_mode='ALLEGRO_ONE', - src_alpha='ALLEGRO_ONE', - op_alpha='ALLEGRO_ADD', - dst_mode='ALLEGRO_ONE', - dst_alpha='ALLEGRO_ONE', + op='A5O_ADD', + src_mode='A5O_ONE', + src_alpha='A5O_ONE', + op_alpha='A5O_ADD', + dst_mode='A5O_ONE', + dst_alpha='A5O_ONE', const_color='NULL', - if_format='ALLEGRO_PIXEL_FORMAT_ARGB_8888', + if_format='A5O_PIXEL_FORMAT_ARGB_8888', alpha_only=True, repeat=repeat, ) @@ -197,7 +197,7 @@ def make_drawer(name): print("else") else: make_loop( - if_format='ALLEGRO_PIXEL_FORMAT_ARGB_8888' + if_format='A5O_PIXEL_FORMAT_ARGB_8888' ) print("else") @@ -389,7 +389,7 @@ def make_innermost_loop( if not texture: print("""\ - ALLEGRO_COLOR src_color = cur_color; + A5O_COLOR src_color = cur_color; """) else: print(interp("""\ @@ -400,13 +400,13 @@ def make_innermost_loop( if not repeat: print("""\ switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -415,13 +415,13 @@ def make_innermost_loop( } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -440,7 +440,7 @@ def make_innermost_loop( pass else: print(interp("""\ - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(#{src_format}, src_data, src_color, false); """)) if grad: @@ -478,8 +478,8 @@ def make_innermost_loop( blend = "_al_blend_alpha_inline" print(interp("""\ { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(#{dst_format}, dst_data, dst_color, false); #{blend}(&src_color, &dst_color, #{op}, #{src_mode}, #{dst_mode}, diff --git a/misc/utod.sh b/misc/utod.sh index 3a1e7e9224..39784208cb 100755 --- a/misc/utod.sh +++ b/misc/utod.sh @@ -37,7 +37,7 @@ then exit fi -if test "$ALLEGRO_USE_CYGWIN" = "1" +if test "$A5O_USE_CYGWIN" = "1" then with_cygwin "$@" else diff --git a/misc/zipup.sh b/misc/zipup.sh index 25ef971931..5389a300e2 100755 --- a/misc/zipup.sh +++ b/misc/zipup.sh @@ -52,8 +52,8 @@ fi # delete all generated files # echo "Cleaning the Allegro tree..." # -# sed -n -e "/CLEAN_FILES/,/^$/p; /^ALLEGRO_.*_EXES/,/^$/p" makefile.lst | \ -# sed -e "/CLEAN_FILES/d; /ALLEGRO_.*_EXES/d; s/\\\\//g" | \ +# sed -n -e "/CLEAN_FILES/,/^$/p; /^A5O_.*_EXES/,/^$/p" makefile.lst | \ +# sed -e "/CLEAN_FILES/d; /A5O_.*_EXES/d; s/\\\\//g" | \ # xargs -n 1 echo | \ # sed -e "s/\(.*\)/-c \"rm -f \1\"/" | \ # xargs -l sh diff --git a/misc/zipwin.sh b/misc/zipwin.sh index 76e93bd5eb..ac4d737204 100755 --- a/misc/zipwin.sh +++ b/misc/zipwin.sh @@ -6,7 +6,7 @@ # and finally zip up the results. # # Note! If you use Cygwin to generate the DLLs make sure you have set up -# your MINGDIR and ALLEGRO_USE_CYGWIN environment variables correctly. +# your MINGDIR and A5O_USE_CYGWIN environment variables correctly. # # It should be run from the root of the Allegro directory, eg. # bash misc/zipwin.sh, so that it can find misc/vcvars.c and misc/askq.c. @@ -22,7 +22,7 @@ name=$(echo "$1" | sed -e 's/.*[\\\/]//; s/\.zip//') # check that MSVC or Cygwin is available -if [ "$ALLEGRO_USE_CYGWIN" = "1" ]; then +if [ "$A5O_USE_CYGWIN" = "1" ]; then if [ "$MINGDIR" = "" ]; then echo "You need to set up Cygwin before running this script" 1>&2 exit 1 @@ -43,7 +43,7 @@ fi # convert Allegro to MSVC or Cygwin format -if [ "$ALLEGRO_USE_CYGWIN" = "1" ]; then +if [ "$A5O_USE_CYGWIN" = "1" ]; then ./fix.sh mingw --dtou else ./fix.sh msvc --utod @@ -76,7 +76,7 @@ ver=`sed -n -e "s/LIBRARY_VERSION = \(.*\)/\1/p" makefile.ver` # compile vcvars echo "Compiling vcvars.exe..." -if [ "$ALLEGRO_USE_CYGWIN" = "1" ]; then +if [ "$A5O_USE_CYGWIN" = "1" ]; then gcc -Wl,--subsystem,console -o vcvars.exe misc/vcvars.c -ladvapi32 else cl -nologo misc/vcvars.c advapi32.lib @@ -86,7 +86,7 @@ fi # compile askq echo "Compiling askq.exe..." -if [ "$ALLEGRO_USE_CYGWIN" = "1" ]; then +if [ "$A5O_USE_CYGWIN" = "1" ]; then gcc -Wl,--subsystem,console -o askq.exe misc/askq.c else cl -nologo misc/askq.c @@ -143,7 +143,7 @@ END_OF_BATCH # If running Cygwin, we need to do some trickery -if [ "$ALLEGRO_USE_CYGWIN" = "1" ]; then +if [ "$A5O_USE_CYGWIN" = "1" ]; then ./fix.sh msvc --utod export MSVCDIR="MSVCDIR" make.exe depend UNIX_TOOLS=1 @@ -208,7 +208,7 @@ make.exe -n | \ rm _fix1.sed _fix2.sed -if [ "$ALLEGRO_USE_CYGWIN" = "1" ]; then +if [ "$A5O_USE_CYGWIN" = "1" ]; then unset MSVCDIR fi @@ -346,7 +346,7 @@ echo "Creating $name.zip..." cd .. if [ -f $name.zip ]; then rm $name.zip; fi -if [ "$ALLEGRO_USE_CYGWIN" = "1" ]; then +if [ "$A5O_USE_CYGWIN" = "1" ]; then unix2dos allegro/$name.txt unix2dos allegro/msvcmake.bat fi diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index f802d5a249..3eef2ca69d 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -2,7 +2,7 @@ include(FindPythonInterp) # Construct list of files whose modification should trigger a rebuild of # the Python API. -foreach(x ${MONOLITH_SOURCES} ${MONOLITH_HEADERS} ${ALLEGRO_PUBLIC_HEADERS}) +foreach(x ${MONOLITH_SOURCES} ${MONOLITH_HEADERS} ${A5O_PUBLIC_HEADERS}) if(NOT ${x} MATCHES "^/.*") file(RELATIVE_PATH xrel ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/${x}) list(APPEND SOURCES ${xrel}) @@ -34,7 +34,7 @@ endif(WIN32) SET(release "") append_lib_type_suffix(release) append_lib_linkage_suffix(release) -SET(version "${ALLEGRO_SOVERSION}") +SET(version "${A5O_SOVERSION}") add_custom_command( OUTPUT allegro.py diff --git a/python/checkdocs.py b/python/checkdocs.py index 7d9cf88a8e..6ba1da0bc2 100755 --- a/python/checkdocs.py +++ b/python/checkdocs.py @@ -58,7 +58,7 @@ def add_struct(line): anonymous_enums[line] = 1 else: sname = mob.group(1) - if sname.startswith("_ALLEGRO_gl"): + if sname.startswith("_A5O_gl"): return if kind == "typedef": types[sname] = line @@ -238,9 +238,9 @@ def check_undocumented_functions(): if link and not link.startswith("GL") and \ not link.startswith("gl") and \ not link.startswith("_al_gl") and \ - not link.startswith("_ALLEGRO_gl") and \ - not link.startswith("_ALLEGRO_GL") and \ - not link.startswith("ALLEGRO_"): + not link.startswith("_A5O_gl") and \ + not link.startswith("_A5O_GL") and \ + not link.startswith("A5O_"): others.append(link) print("Also leaking:") diff --git a/python/ex_draw_bitmap.py b/python/ex_draw_bitmap.py index b7582d9d37..5cbb8e7b71 100755 --- a/python/ex_draw_bitmap.py +++ b/python/ex_draw_bitmap.py @@ -112,11 +112,11 @@ def change_size(size): if example.bitmap: al_destroy_bitmap(example.bitmap) al_set_new_bitmap_flags( - ALLEGRO_MEMORY_BITMAP if example.use_memory_bitmaps else 0) + A5O_MEMORY_BITMAP if example.use_memory_bitmaps else 0) example.bitmap = al_create_bitmap(size, size) example.bitmap_size = size al_set_target_bitmap(example.bitmap) - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO, example.white) + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO, example.white) al_clear_to_color(al_map_rgba_f(0, 0, 0, 0)) bw = al_get_bitmap_width(example.mysha) bh = al_get_bitmap_height(example.mysha) @@ -163,22 +163,22 @@ def redraw(): tint = example.white if example.blending == 0: - al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) + al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) tint = example.half_white elif example.blending == 1: - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE) + al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE) tint = example.dark elif example.blending == 2: - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO) + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO) tint = example.red elif example.blending == 3: - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO, example.white) + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO, example.white) for i in range(example.sprite_count): s = example.sprites[i] al_draw_tinted_bitmap(example.bitmap, tint, s.x, s.y, 0) - al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) + al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) if example.show_help: for i in range(5): al_draw_text(example.font, example.white, 0, h - 5 * fh + i * fh, 0, text[i]) @@ -193,9 +193,9 @@ def redraw(): binfo[example.blending].encode("utf8")) f1, f2 = get_fps() - al_draw_textf(example.font, example.white, w, 0, ALLEGRO_ALIGN_RIGHT, "%s", + al_draw_textf(example.font, example.white, w, 0, A5O_ALIGN_RIGHT, "%s", ("FPS: %4d +- %-4d" % (f1, f2)).encode("utf8")) - al_draw_textf(example.font, example.white, w, fh, ALLEGRO_ALIGN_RIGHT, "%s", + al_draw_textf(example.font, example.white, w, fh, A5O_ALIGN_RIGHT, "%s", ("%4d / sec" % int(1.0 / example.direct_speed_measure)).encode("utf8")) def main(): @@ -204,7 +204,7 @@ def main(): need_redraw = True example.show_help = True - if not al_install_system(ALLEGRO_VERSION_INT, None): + if not al_install_system(A5O_VERSION_INT, None): abort_example("Failed to init Allegro.\n") sys.exit(1) @@ -216,7 +216,7 @@ def main(): al_get_num_video_adapters() - info = ALLEGRO_MONITOR_INFO() + info = A5O_MONITOR_INFO() al_get_monitor_info(0, byref(info)) if info.x2 - info.x1 < w: w = info.x2 - info.x1 @@ -260,7 +260,7 @@ def main(): al_start_timer(timer) while not done: - event = ALLEGRO_EVENT() + event = A5O_EVENT() if need_redraw and al_is_event_queue_empty(queue): t = -al_get_time() @@ -274,39 +274,39 @@ def main(): al_wait_for_event(queue, byref(event)) - if event.type == ALLEGRO_EVENT_KEY_CHAR: - if event.keyboard.keycode == ALLEGRO_KEY_ESCAPE: + if event.type == A5O_EVENT_KEY_CHAR: + if event.keyboard.keycode == A5O_KEY_ESCAPE: done = True - elif event.keyboard.keycode == ALLEGRO_KEY_UP: + elif event.keyboard.keycode == A5O_KEY_UP: add_sprites(1) - elif event.keyboard.keycode == ALLEGRO_KEY_DOWN: + elif event.keyboard.keycode == A5O_KEY_DOWN: remove_sprites(1) - elif event.keyboard.keycode == ALLEGRO_KEY_LEFT: + elif event.keyboard.keycode == A5O_KEY_LEFT: change_size(example.bitmap_size - 1) - elif event.keyboard.keycode == ALLEGRO_KEY_RIGHT: + elif event.keyboard.keycode == A5O_KEY_RIGHT: change_size(example.bitmap_size + 1) - elif event.keyboard.keycode == ALLEGRO_KEY_F1: + elif event.keyboard.keycode == A5O_KEY_F1: example.show_help ^= 1 - elif event.keyboard.keycode == ALLEGRO_KEY_SPACE: + elif event.keyboard.keycode == A5O_KEY_SPACE: example.use_memory_bitmaps ^= 1 change_size(example.bitmap_size) - elif event.keyboard.keycode == ALLEGRO_KEY_B: + elif event.keyboard.keycode == A5O_KEY_B: example.blending += 1 if example.blending == 4: example.blending = 0 - elif event.type == ALLEGRO_EVENT_DISPLAY_CLOSE: + elif event.type == A5O_EVENT_DISPLAY_CLOSE: done = True - elif event.type == ALLEGRO_EVENT_TIMER: + elif event.type == A5O_EVENT_TIMER: update() need_redraw = True - elif event.type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN: + elif event.type == A5O_EVENT_MOUSE_BUTTON_DOWN: example.mouse_down = True example.last_x = event.mouse.x example.last_y = event.mouse.y - elif event.type == ALLEGRO_EVENT_MOUSE_BUTTON_UP: + elif event.type == A5O_EVENT_MOUSE_BUTTON_UP: fh = al_get_font_line_height(example.font) example.mouse_down = False if event.mouse.x < 40 and event.mouse.y >= h - fh * 5: @@ -321,7 +321,7 @@ def main(): if button == 4: example.show_help ^= 1 - elif event.type == ALLEGRO_EVENT_MOUSE_AXES: + elif event.type == A5O_EVENT_MOUSE_AXES: if example.mouse_down: dx = event.mouse.x - example.last_x dy = event.mouse.y - example.last_y diff --git a/python/generate_python_ctypes.py b/python/generate_python_ctypes.py index 6af193bfc7..fba1b12476 100755 --- a/python/generate_python_ctypes.py +++ b/python/generate_python_ctypes.py @@ -187,9 +187,9 @@ def parse_protos(self, filename): funcs.append(line) continue # anonymous structs have no name at all - if name and not name.startswith("ALLEGRO_"): + if name and not name.startswith("A5O_"): continue - if name == "ALLEGRO_OGL_EXT_API": + if name == "A5O_OGL_EXT_API": continue if proto.startswith("union") or\ proto.startswith("typedef union"): @@ -521,20 +521,20 @@ def from_param(x): # some stuff the automated parser doesn't pick up f.write(r""" -ALLEGRO_VERSION_INT = \ - ((ALLEGRO_VERSION << 24) | (ALLEGRO_SUB_VERSION << 16) | \ - (ALLEGRO_WIP_VERSION << 8) | ALLEGRO_RELEASE_NUMBER) +A5O_VERSION_INT = \ + ((A5O_VERSION << 24) | (A5O_SUB_VERSION << 16) | \ + (A5O_WIP_VERSION << 8) | A5O_RELEASE_NUMBER) """) f.write(r""" # work around bug http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36834 if os.name == "nt": - def al_map_rgba_f(r, g, b, a): return ALLEGRO_COLOR(r, g, b, a) - def al_map_rgb_f(r, g, b): return ALLEGRO_COLOR(r, g, b, 1) + def al_map_rgba_f(r, g, b, a): return A5O_COLOR(r, g, b, a) + def al_map_rgb_f(r, g, b): return A5O_COLOR(r, g, b, 1) def al_map_rgba(r, g, b, a): - return ALLEGRO_COLOR(r / 255.0, g / 255.0, b / 255.0, a / 255.0) + return A5O_COLOR(r / 255.0, g / 255.0, b / 255.0, a / 255.0) def al_map_rgb(r, g, b): - return ALLEGRO_COLOR(r / 255.0, g / 255.0, b / 255.0, 1) + return A5O_COLOR(r / 255.0, g / 255.0, b / 255.0, 1) """) f.write(""" diff --git a/python/pong.py b/python/pong.py index c17a30ed3e..76e245c348 100755 --- a/python/pong.py +++ b/python/pong.py @@ -45,12 +45,12 @@ def __init__(self, x, y, h, w, speed, keyup, keydown, color): self.keyup, self.keydown = keyup, keydown def handle_event(self, ev): - if ev.type == ALLEGRO_EVENT_KEY_DOWN: + if ev.type == A5O_EVENT_KEY_DOWN: if ev.keyboard.keycode == self.keyup: self.moving = -1 elif ev.keyboard.keycode == self.keydown: self.moving = 1 - elif ev.type == ALLEGRO_EVENT_KEY_UP: + elif ev.type == A5O_EVENT_KEY_UP: if (ev.keyboard.keycode == self.keyup and self.moving == -1) or\ (ev.keyboard.keycode == self.keydown and self.moving == 1): self.moving = 0 @@ -64,7 +64,7 @@ def __init__(self, x, y, w, h, speed, color, difficulty, ball): def handle_event(self, ev): #Only fire on a timer event - if ev.type == ALLEGRO_EVENT_TIMER: + if ev.type == A5O_EVENT_TIMER: #Calculate the target y location according to the difficulty level if self.difficulty == 1: target_y = self.ball.y + self.ball.size / 2 @@ -165,12 +165,12 @@ def main(): #Initialisation difficulty = int(input("What difficulty do you want to play on? " + "Input: 0 for two-player mode, 1-4 for AI difficulty setting.\n")) - al_install_system(ALLEGRO_VERSION_INT, None) + al_install_system(A5O_VERSION_INT, None) w, h = 800, 600 #Make lines draw smoother - al_set_new_display_option(ALLEGRO_SAMPLE_BUFFERS, 1, ALLEGRO_SUGGEST) - al_set_new_display_option(ALLEGRO_SAMPLES, 4, ALLEGRO_SUGGEST) + al_set_new_display_option(A5O_SAMPLE_BUFFERS, 1, A5O_SUGGEST) + al_set_new_display_option(A5O_SAMPLES, 4, A5O_SUGGEST) display = al_create_display(w, h) al_init_primitives_addon() @@ -188,13 +188,13 @@ def main(): players = [] players.append(Player(0, h / 2 - pallet_h / 2, pallet_w, pallet_h, pallet_speed, - ALLEGRO_KEY_W, ALLEGRO_KEY_S, al_map_rgb_f(1.0, 0.0, 0.0))) + A5O_KEY_W, A5O_KEY_S, al_map_rgb_f(1.0, 0.0, 0.0))) ball = Ball(w / 2, h / 2, ball_speed, ball_size, players, al_map_rgb_f(0, 1.0, 0)) if not difficulty: players.append(Player(w - pallet_w, h / 2 - pallet_h / 2, pallet_w, pallet_h, - pallet_speed, ALLEGRO_KEY_UP, ALLEGRO_KEY_DOWN, + pallet_speed, A5O_KEY_UP, A5O_KEY_DOWN, al_map_rgb_f(0.0, 0.0, 1.0))) else: players.append(AI(w - pallet_w, h / 2 - pallet_h / 2, pallet_w, @@ -243,20 +243,20 @@ def upgrade_decrease_speed(pallet): upgrade.draw() if not finished: al_draw_text(font, al_map_rgb_f(1, 1, 1), w / 2, 10, - ALLEGRO_ALIGN_CENTRE, "Player 1: use W and S to move, " + + A5O_ALIGN_CENTRE, "Player 1: use W and S to move, " + "Player 2: use the up and down arrow keys.") else: al_draw_text(font, al_map_rgb_f(1, 1, 1), w / 2, 10, - ALLEGRO_ALIGN_CENTRE, "Press R to reset, ESC to exit.") + A5O_ALIGN_CENTRE, "Press R to reset, ESC to exit.") al_draw_text(font, al_map_rgb_f(1, 1, 1), w / 2, h - 20, - ALLEGRO_ALIGN_CENTRE, "{0} - {1}".format(*score)) + A5O_ALIGN_CENTRE, "{0} - {1}".format(*score)) al_flip_display() need_redraw = False - ev = ALLEGRO_EVENT() + ev = A5O_EVENT() al_wait_for_event(queue, byref(ev)) - if ev.type == ALLEGRO_EVENT_TIMER: + if ev.type == A5O_EVENT_TIMER: for player in players: player.update() ball.update() @@ -273,12 +273,12 @@ def upgrade_decrease_speed(pallet): upgrades.append(Upgrade(w / 2, h / 2, ball_speed, players, upgrade_types[i][0], upgrade_types[i][1])) need_redraw = True - elif (ev.type == ALLEGRO_EVENT_KEY_DOWN and - ev.keyboard.keycode == ALLEGRO_KEY_ESCAPE) or\ - ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE: + elif (ev.type == A5O_EVENT_KEY_DOWN and + ev.keyboard.keycode == A5O_KEY_ESCAPE) or\ + ev.type == A5O_EVENT_DISPLAY_CLOSE: break - elif ev.type == ALLEGRO_EVENT_KEY_DOWN and\ - ev.keyboard.keycode == ALLEGRO_KEY_R: + elif ev.type == A5O_EVENT_KEY_DOWN and\ + ev.keyboard.keycode == A5O_KEY_R: ball.x = w / 2 ball.y = h / 2 ball.speed = ball_speed diff --git a/src/allegro.c b/src/allegro.c index b63c50f75c..85402b1fed 100644 --- a/src/allegro.c +++ b/src/allegro.c @@ -19,14 +19,14 @@ #include "allegro5/allegro.h" #include "allegro5/platform/alplatf.h" #include "allegro5/internal/aintern.h" -#include ALLEGRO_INTERNAL_HEADER +#include A5O_INTERNAL_HEADER /* Function: al_get_allegro_version */ uint32_t al_get_allegro_version(void) { - return ALLEGRO_VERSION_INT; + return A5O_VERSION_INT; } @@ -35,7 +35,7 @@ uint32_t al_get_allegro_version(void) */ int al_run_main(int argc, char **argv, int (*user_main)(int, char **)) { -#ifdef ALLEGRO_MACOSX +#ifdef A5O_MACOSX return _al_osx_run_main(argc, argv, user_main); #else return user_main(argc, argv); diff --git a/src/android/android_apk_file.c b/src/android/android_apk_file.c index 84aaf19929..593da5f35e 100644 --- a/src/android/android_apk_file.c +++ b/src/android/android_apk_file.c @@ -4,25 +4,25 @@ #define streq(a, b) (0 == strcmp(a, b)) -ALLEGRO_DEBUG_CHANNEL("android") +A5O_DEBUG_CHANNEL("android") -typedef struct ALLEGRO_FILE_APK ALLEGRO_FILE_APK; +typedef struct A5O_FILE_APK A5O_FILE_APK; -struct ALLEGRO_FILE_APK +struct A5O_FILE_APK { jobject apk; bool error_indicator; }; -static ALLEGRO_FILE_APK *cast_stream(ALLEGRO_FILE *f) +static A5O_FILE_APK *cast_stream(A5O_FILE *f) { - return (ALLEGRO_FILE_APK *)al_get_file_userdata(f); + return (A5O_FILE_APK *)al_get_file_userdata(f); } -static void apk_set_errno(ALLEGRO_FILE_APK *fp) +static void apk_set_errno(A5O_FILE_APK *fp) { al_set_errno(-1); @@ -43,7 +43,7 @@ static jobject APK_openRead(const char *filename) jnienv = _al_android_get_jnienv(); ctor = _jni_call(jnienv, jclass, GetMethodID, _al_android_apk_stream_class(), "", - "(L" ALLEGRO_ANDROID_PACKAGE_NAME_SLASH "/AllegroActivity;Ljava/lang/String;)V"); + "(L" A5O_ANDROID_PACKAGE_NAME_SLASH "/AllegroActivity;Ljava/lang/String;)V"); str = (*jnienv)->NewStringUTF(jnienv, filename); ref = _jni_call(jnienv, jobject, NewObject, _al_android_apk_stream_class(), @@ -115,7 +115,7 @@ static long APK_size(jobject apk_stream) static void *file_apk_fopen(const char *filename, const char *mode) { - ALLEGRO_FILE_APK *fp; + A5O_FILE_APK *fp; jobject apk; if (streq(mode, "r") || streq(mode, "rb")) @@ -142,9 +142,9 @@ static void *file_apk_fopen(const char *filename, const char *mode) } -static bool file_apk_fclose(ALLEGRO_FILE *f) +static bool file_apk_fclose(A5O_FILE *f) { - ALLEGRO_FILE_APK *fp = cast_stream(f); + A5O_FILE_APK *fp = cast_stream(f); bool ret; ret = APK_close(fp->apk); @@ -155,9 +155,9 @@ static bool file_apk_fclose(ALLEGRO_FILE *f) } -static size_t file_apk_fread(ALLEGRO_FILE *f, void *buf, size_t buf_size) +static size_t file_apk_fread(A5O_FILE *f, void *buf, size_t buf_size) { - ALLEGRO_FILE_APK *fp = cast_stream(f); + A5O_FILE_APK *fp = cast_stream(f); int n; if (buf_size == 0) @@ -172,7 +172,7 @@ static size_t file_apk_fread(ALLEGRO_FILE *f, void *buf, size_t buf_size) } -static size_t file_apk_fwrite(ALLEGRO_FILE *f, const void *buf, +static size_t file_apk_fwrite(A5O_FILE *f, const void *buf, size_t buf_size) { // Not supported @@ -183,7 +183,7 @@ static size_t file_apk_fwrite(ALLEGRO_FILE *f, const void *buf, } -static bool file_apk_fflush(ALLEGRO_FILE *f) +static bool file_apk_fflush(A5O_FILE *f) { // Not supported (void)f; @@ -191,24 +191,24 @@ static bool file_apk_fflush(ALLEGRO_FILE *f) } -static int64_t file_apk_ftell(ALLEGRO_FILE *f) +static int64_t file_apk_ftell(A5O_FILE *f) { - ALLEGRO_FILE_APK *fp = cast_stream(f); + A5O_FILE_APK *fp = cast_stream(f); return APK_tell(fp->apk); } -static bool file_apk_seek(ALLEGRO_FILE *f, int64_t offset, int whence) +static bool file_apk_seek(A5O_FILE *f, int64_t offset, int whence) { - ALLEGRO_FILE_APK *fp = cast_stream(f); + A5O_FILE_APK *fp = cast_stream(f); long base; switch (whence) { - case ALLEGRO_SEEK_SET: + case A5O_SEEK_SET: base = 0; break; - case ALLEGRO_SEEK_CUR: + case A5O_SEEK_CUR: base = APK_tell(fp->apk); if (base < 0) { apk_set_errno(fp); @@ -216,7 +216,7 @@ static bool file_apk_seek(ALLEGRO_FILE *f, int64_t offset, int whence) } break; - case ALLEGRO_SEEK_END: + case A5O_SEEK_END: base = APK_size(fp->apk); if (base < 0) { apk_set_errno(fp); @@ -238,46 +238,46 @@ static bool file_apk_seek(ALLEGRO_FILE *f, int64_t offset, int whence) } -static bool file_apk_feof(ALLEGRO_FILE *f) +static bool file_apk_feof(A5O_FILE *f) { - ALLEGRO_FILE_APK *fp = cast_stream(f); + A5O_FILE_APK *fp = cast_stream(f); jboolean res = _jni_callBooleanMethodV(_al_android_get_jnienv(), fp->apk, "eof", "()Z"); return res; } -static int file_apk_ferror(ALLEGRO_FILE *f) +static int file_apk_ferror(A5O_FILE *f) { - ALLEGRO_FILE_APK *fp = cast_stream(f); + A5O_FILE_APK *fp = cast_stream(f); return (fp->error_indicator) ? 1 : 0; } -static const char *file_apk_ferrmsg(ALLEGRO_FILE *f) +static const char *file_apk_ferrmsg(A5O_FILE *f) { (void)f; return ""; } -static void file_apk_fclearerr(ALLEGRO_FILE *f) +static void file_apk_fclearerr(A5O_FILE *f) { - ALLEGRO_FILE_APK *fp = cast_stream(f); + A5O_FILE_APK *fp = cast_stream(f); fp->error_indicator = false; } -static off_t file_apk_fsize(ALLEGRO_FILE *f) +static off_t file_apk_fsize(A5O_FILE *f) { - ALLEGRO_FILE_APK *fp = cast_stream(f); + A5O_FILE_APK *fp = cast_stream(f); return APK_size(fp->apk); } -static const ALLEGRO_FILE_INTERFACE file_apk_vtable = +static const A5O_FILE_INTERFACE file_apk_vtable = { file_apk_fopen, file_apk_fclose, @@ -295,7 +295,7 @@ static const ALLEGRO_FILE_INTERFACE file_apk_vtable = }; -const ALLEGRO_FILE_INTERFACE *_al_get_apk_file_vtable(void) +const A5O_FILE_INTERFACE *_al_get_apk_file_vtable(void) { return &file_apk_vtable; } diff --git a/src/android/android_apk_fs.c b/src/android/android_apk_fs.c index 21d86f055a..5510171ba2 100644 --- a/src/android/android_apk_fs.c +++ b/src/android/android_apk_fs.c @@ -11,14 +11,14 @@ #include -ALLEGRO_DEBUG_CHANNEL("android") +A5O_DEBUG_CHANNEL("android") -typedef struct ALLEGRO_FS_ENTRY_APK ALLEGRO_FS_ENTRY_APK; +typedef struct A5O_FS_ENTRY_APK A5O_FS_ENTRY_APK; -struct ALLEGRO_FS_ENTRY_APK +struct A5O_FS_ENTRY_APK { - ALLEGRO_FS_ENTRY fs_entry; /* must be first */ - ALLEGRO_PATH *path; + A5O_FS_ENTRY fs_entry; /* must be first */ + A5O_PATH *path; const char *path_cstr; /* For directory listing. */ @@ -28,15 +28,15 @@ struct ALLEGRO_FS_ENTRY_APK }; /* forward declaration */ -static const ALLEGRO_FS_INTERFACE fs_apk_vtable; +static const A5O_FS_INTERFACE fs_apk_vtable; /* current working directory */ /* TODO: free this somewhere */ -static ALLEGRO_USTR *fs_apk_cwd_ustr; +static A5O_USTR *fs_apk_cwd_ustr; -static ALLEGRO_FILE *fs_apk_open_file(ALLEGRO_FS_ENTRY *fse, const char *mode); +static A5O_FILE *fs_apk_open_file(A5O_FS_ENTRY *fse, const char *mode); -static ALLEGRO_USTR *get_fake_cwd(void) { +static A5O_USTR *get_fake_cwd(void) { if (!fs_apk_cwd_ustr) { fs_apk_cwd_ustr = al_ustr_new("/"); } @@ -48,7 +48,7 @@ static bool path_is_absolute(const char *path) return (path && path[0] == '/'); } -static void ensure_trailing_slash(ALLEGRO_USTR *us) +static void ensure_trailing_slash(A5O_USTR *us) { int pos = al_ustr_size(us); if (al_ustr_prev_get(us, &pos) != '/') { @@ -56,9 +56,9 @@ static void ensure_trailing_slash(ALLEGRO_USTR *us) } } -static ALLEGRO_USTR *apply_cwd(const char *path) +static A5O_USTR *apply_cwd(const char *path) { - ALLEGRO_USTR *us; + A5O_USTR *us; if (path_is_absolute(path)) { return al_ustr_new(path); @@ -69,10 +69,10 @@ static ALLEGRO_USTR *apply_cwd(const char *path) return us; } -static ALLEGRO_FS_ENTRY *fs_apk_create_entry(const char *path) +static A5O_FS_ENTRY *fs_apk_create_entry(const char *path) { - ALLEGRO_FS_ENTRY_APK *e; - ALLEGRO_USTR *us; + A5O_FS_ENTRY_APK *e; + A5O_USTR *us; e = al_calloc(1, sizeof *e); if (!e) @@ -98,8 +98,8 @@ static char *fs_apk_get_current_directory(void) static bool fs_apk_change_directory(const char *path) { - ALLEGRO_USTR *us; - ALLEGRO_USTR *cwd = get_fake_cwd(); + A5O_USTR *us; + A5O_USTR *cwd = get_fake_cwd(); /* Figure out which directory we are trying to change to. */ if (path_is_absolute(path)) @@ -128,19 +128,19 @@ static bool fs_apk_make_directory(const char *path) return false; } -static const char *fs_apk_entry_name(ALLEGRO_FS_ENTRY *fse) +static const char *fs_apk_entry_name(A5O_FS_ENTRY *fse) { - ALLEGRO_FS_ENTRY_APK *e = (ALLEGRO_FS_ENTRY_APK *)fse; + A5O_FS_ENTRY_APK *e = (A5O_FS_ENTRY_APK *)fse; return al_path_cstr(e->path, '/'); } -static bool fs_apk_update_entry(ALLEGRO_FS_ENTRY *fse) +static bool fs_apk_update_entry(A5O_FS_ENTRY *fse) { (void)fse; return true; } -static off_t fs_apk_entry_size(ALLEGRO_FS_ENTRY *fse) +static off_t fs_apk_entry_size(A5O_FS_ENTRY *fse) { // Only way to determine the size would be to read the file... // we won't do that. @@ -148,27 +148,27 @@ static off_t fs_apk_entry_size(ALLEGRO_FS_ENTRY *fse) return 0; } -static uint32_t fs_apk_entry_mode(ALLEGRO_FS_ENTRY *fse) +static uint32_t fs_apk_entry_mode(A5O_FS_ENTRY *fse) { - ALLEGRO_FS_ENTRY_APK *e = (ALLEGRO_FS_ENTRY_APK *)fse; - uint32_t mode = ALLEGRO_FILEMODE_READ; + A5O_FS_ENTRY_APK *e = (A5O_FS_ENTRY_APK *)fse; + uint32_t mode = A5O_FILEMODE_READ; int n = strlen(e->path_cstr); if (e->path_cstr[n - 1] == '/') - mode |= ALLEGRO_FILEMODE_ISDIR | ALLEGRO_FILEMODE_EXECUTE; + mode |= A5O_FILEMODE_ISDIR | A5O_FILEMODE_EXECUTE; else - mode |= ALLEGRO_FILEMODE_ISFILE; + mode |= A5O_FILEMODE_ISFILE; return mode; } -static time_t fs_apk_entry_mtime(ALLEGRO_FS_ENTRY *fse) +static time_t fs_apk_entry_mtime(A5O_FS_ENTRY *fse) { (void)fse; return 0; } -static bool fs_apk_entry_exists(ALLEGRO_FS_ENTRY *fse) +static bool fs_apk_entry_exists(A5O_FS_ENTRY *fse) { - ALLEGRO_FILE *f = fs_apk_open_file(fse, "r"); + A5O_FILE *f = fs_apk_open_file(fse, "r"); if (f) { al_fclose(f); return true; @@ -176,22 +176,22 @@ static bool fs_apk_entry_exists(ALLEGRO_FS_ENTRY *fse) return false; } -static bool fs_apk_remove_entry(ALLEGRO_FS_ENTRY *fse) +static bool fs_apk_remove_entry(A5O_FS_ENTRY *fse) { (void)fse; return false; } -static bool fs_apk_open_directory(ALLEGRO_FS_ENTRY *fse) +static bool fs_apk_open_directory(A5O_FS_ENTRY *fse) { - ALLEGRO_FS_ENTRY_APK *e = (ALLEGRO_FS_ENTRY_APK *)fse; + A5O_FS_ENTRY_APK *e = (A5O_FS_ENTRY_APK *)fse; JNIEnv *jnienv; jnienv = _al_android_get_jnienv(); jstring jpath = (*jnienv)->NewStringUTF(jnienv, e->path_cstr); jstring js = _jni_callStaticObjectMethodV(jnienv, _al_android_apk_fs_class(), "list", - "(L" ALLEGRO_ANDROID_PACKAGE_NAME_SLASH "/AllegroActivity;Ljava/lang/String;)Ljava/lang/String;", + "(L" A5O_ANDROID_PACKAGE_NAME_SLASH "/AllegroActivity;Ljava/lang/String;)Ljava/lang/String;", _al_android_activity_object(), jpath); const char *cs = _jni_call(jnienv, const char *, GetStringUTFChars, js, NULL); @@ -207,11 +207,11 @@ static bool fs_apk_open_directory(ALLEGRO_FS_ENTRY *fse) return true; } -static ALLEGRO_FS_ENTRY *fs_apk_read_directory(ALLEGRO_FS_ENTRY *fse) +static A5O_FS_ENTRY *fs_apk_read_directory(A5O_FS_ENTRY *fse) { - ALLEGRO_FS_ENTRY_APK *e = (ALLEGRO_FS_ENTRY_APK *)fse; - ALLEGRO_FS_ENTRY *next; - ALLEGRO_USTR *tmp; + A5O_FS_ENTRY_APK *e = (A5O_FS_ENTRY_APK *)fse; + A5O_FS_ENTRY *next; + A5O_USTR *tmp; if (!e->file_list_pos) return NULL; @@ -236,25 +236,25 @@ static ALLEGRO_FS_ENTRY *fs_apk_read_directory(ALLEGRO_FS_ENTRY *fse) return next; } -static bool fs_apk_close_directory(ALLEGRO_FS_ENTRY *fse) +static bool fs_apk_close_directory(A5O_FS_ENTRY *fse) { - ALLEGRO_FS_ENTRY_APK *e = (ALLEGRO_FS_ENTRY_APK *)fse; + A5O_FS_ENTRY_APK *e = (A5O_FS_ENTRY_APK *)fse; al_free(e->file_list); e->file_list = NULL; e->is_dir_open = false; return true; } -static void fs_apk_destroy_entry(ALLEGRO_FS_ENTRY *fse) +static void fs_apk_destroy_entry(A5O_FS_ENTRY *fse) { - ALLEGRO_FS_ENTRY_APK *e = (ALLEGRO_FS_ENTRY_APK *)fse; + A5O_FS_ENTRY_APK *e = (A5O_FS_ENTRY_APK *)fse; if (e->is_dir_open) fs_apk_close_directory(fse); al_destroy_path(e->path); al_free(e); } -static ALLEGRO_FILE *fs_apk_open_file(ALLEGRO_FS_ENTRY *fse, const char *mode) +static A5O_FILE *fs_apk_open_file(A5O_FS_ENTRY *fse, const char *mode) { return al_fopen_interface(_al_get_apk_file_vtable(), fs_apk_entry_name(fse), mode); @@ -264,13 +264,13 @@ static bool fs_apk_filename_exists(const char *path) { bool ret; - ALLEGRO_FS_ENTRY *e = fs_apk_create_entry(path); + A5O_FS_ENTRY *e = fs_apk_create_entry(path); ret = fs_apk_entry_exists(e); fs_apk_destroy_entry(e); return ret; } -static const ALLEGRO_FS_INTERFACE fs_apk_vtable = +static const A5O_FS_INTERFACE fs_apk_vtable = { fs_apk_create_entry, fs_apk_destroy_entry, diff --git a/src/android/android_clipboard.c b/src/android/android_clipboard.c index d5255f0d92..631f1355b1 100644 --- a/src/android/android_clipboard.c +++ b/src/android/android_clipboard.c @@ -25,9 +25,9 @@ #include -ALLEGRO_DEBUG_CHANNEL("clipboard") +A5O_DEBUG_CHANNEL("clipboard") -static bool android_set_clipboard_text(ALLEGRO_DISPLAY *display, const char *text) +static bool android_set_clipboard_text(A5O_DISPLAY *display, const char *text) { JNIEnv * env = (JNIEnv *)_al_android_get_jnienv(); jstring jtext= _jni_call(env, jstring, NewStringUTF, text); @@ -36,7 +36,7 @@ static bool android_set_clipboard_text(ALLEGRO_DISPLAY *display, const char *tex "setClipboardText", "(Ljava/lang/String;)Z", jtext); } -static char *android_get_clipboard_text(ALLEGRO_DISPLAY *display) +static char *android_get_clipboard_text(A5O_DISPLAY *display) { JNIEnv * env = (JNIEnv *)_al_android_get_jnienv(); jobject jtext = _jni_callObjectMethod(env, _al_android_activity_object(), "getClipboardText", "()Ljava/lang/String;"); @@ -52,7 +52,7 @@ static char *android_get_clipboard_text(ALLEGRO_DISPLAY *display) return text; } -static bool android_has_clipboard_text(ALLEGRO_DISPLAY *display) +static bool android_has_clipboard_text(A5O_DISPLAY *display) { JNIEnv * env = (JNIEnv *)_al_android_get_jnienv(); (void) display; @@ -61,7 +61,7 @@ static bool android_has_clipboard_text(ALLEGRO_DISPLAY *display) } -void _al_android_add_clipboard_functions(ALLEGRO_DISPLAY_INTERFACE *vt) +void _al_android_add_clipboard_functions(A5O_DISPLAY_INTERFACE *vt) { vt->set_clipboard_text = android_set_clipboard_text; vt->get_clipboard_text = android_get_clipboard_text; diff --git a/src/android/android_display.c b/src/android/android_display.c index 7d30d34ddc..431451867d 100644 --- a/src/android/android_display.c +++ b/src/android/android_display.c @@ -25,31 +25,31 @@ #include "EGL/egl.h" -ALLEGRO_DEBUG_CHANNEL("display") +A5O_DEBUG_CHANNEL("display") -static ALLEGRO_DISPLAY_INTERFACE *vt; -static ALLEGRO_EXTRA_DISPLAY_SETTINGS main_thread_display_settings; +static A5O_DISPLAY_INTERFACE *vt; +static A5O_EXTRA_DISPLAY_SETTINGS main_thread_display_settings; -static int select_best_visual_and_update(JNIEnv *env, ALLEGRO_DISPLAY_ANDROID *d); -static void android_set_display_option(ALLEGRO_DISPLAY *d, int o, int v); -static void _al_android_resize_display(ALLEGRO_DISPLAY_ANDROID *d, int width, int height); -static bool _al_android_init_display(JNIEnv *env, ALLEGRO_DISPLAY_ANDROID *display); -void _al_android_clear_current(JNIEnv *env, ALLEGRO_DISPLAY_ANDROID *d); -void _al_android_make_current(JNIEnv *env, ALLEGRO_DISPLAY_ANDROID *d); +static int select_best_visual_and_update(JNIEnv *env, A5O_DISPLAY_ANDROID *d); +static void android_set_display_option(A5O_DISPLAY *d, int o, int v); +static void _al_android_resize_display(A5O_DISPLAY_ANDROID *d, int width, int height); +static bool _al_android_init_display(JNIEnv *env, A5O_DISPLAY_ANDROID *display); +void _al_android_clear_current(JNIEnv *env, A5O_DISPLAY_ANDROID *d); +void _al_android_make_current(JNIEnv *env, A5O_DISPLAY_ANDROID *d); JNI_FUNC(void, AllegroSurface, nativeOnCreate, (JNIEnv *env, jobject obj)) { - ALLEGRO_DEBUG("nativeOnCreate"); + A5O_DEBUG("nativeOnCreate"); (void)env; (void)obj; - ALLEGRO_SYSTEM *system = (void *)al_get_system_driver(); + A5O_SYSTEM *system = (void *)al_get_system_driver(); ASSERT(system != NULL); - ALLEGRO_DEBUG("AllegroSurface_nativeOnCreate"); + A5O_DEBUG("AllegroSurface_nativeOnCreate"); - ALLEGRO_DISPLAY_ANDROID **dptr = _al_vector_ref(&system->displays, 0); - ALLEGRO_DISPLAY_ANDROID *d = *dptr; + A5O_DISPLAY_ANDROID **dptr = _al_vector_ref(&system->displays, 0); + A5O_DISPLAY_ANDROID *d = *dptr; ASSERT(d != NULL); d->recreate = true; @@ -57,21 +57,21 @@ JNI_FUNC(void, AllegroSurface, nativeOnCreate, (JNIEnv *env, jobject obj)) JNI_FUNC(bool, AllegroSurface, nativeOnDestroy, (JNIEnv *env, jobject obj)) { - ALLEGRO_SYSTEM *sys = (void *)al_get_system_driver(); + A5O_SYSTEM *sys = (void *)al_get_system_driver(); ASSERT(sys != NULL); - ALLEGRO_DISPLAY_ANDROID **dptr = _al_vector_ref(&sys->displays, 0); - ALLEGRO_DISPLAY_ANDROID *display = *dptr; + A5O_DISPLAY_ANDROID **dptr = _al_vector_ref(&sys->displays, 0); + A5O_DISPLAY_ANDROID *display = *dptr; ASSERT(display != NULL); - ALLEGRO_DISPLAY *d = (ALLEGRO_DISPLAY *)display; + A5O_DISPLAY *d = (A5O_DISPLAY *)display; - ALLEGRO_DEBUG("AllegroSurface_nativeOnDestroy"); + A5O_DEBUG("AllegroSurface_nativeOnDestroy"); (void)obj; (void)env; if (!display->created) { - ALLEGRO_DEBUG("Display creation failed, not sending HALT"); + A5O_DEBUG("Display creation failed, not sending HALT"); return false; } @@ -84,29 +84,29 @@ JNI_FUNC(bool, AllegroSurface, nativeOnDestroy, (JNIEnv *env, jobject obj)) // we'll wait for acknowledge_drawing_halt display->halt_acknowledge = false; - // emit ALLEGRO_EVENT_DISPLAY_HALT_DRAWING - ALLEGRO_DEBUG("locking display event source: %p %p", d, &d->es); + // emit A5O_EVENT_DISPLAY_HALT_DRAWING + A5O_DEBUG("locking display event source: %p %p", d, &d->es); _al_event_source_lock(&d->es); if (_al_event_source_needs_to_generate_event(&d->es)) { - ALLEGRO_EVENT event; - event.display.type = ALLEGRO_EVENT_DISPLAY_HALT_DRAWING; + A5O_EVENT event; + event.display.type = A5O_EVENT_DISPLAY_HALT_DRAWING; event.display.timestamp = al_current_time(); _al_event_source_emit_event(&d->es, &event); } - ALLEGRO_DEBUG("unlocking display event source"); + A5O_DEBUG("unlocking display event source"); _al_event_source_unlock(&d->es); // wait for acknowledge_drawing_halt - ALLEGRO_DEBUG("waiting for acknowledge_drawing_halt"); + A5O_DEBUG("waiting for acknowledge_drawing_halt"); al_lock_mutex(display->mutex); while (!display->halt_acknowledge) al_wait_cond(display->cond, display->mutex); al_unlock_mutex(display->mutex); - ALLEGRO_DEBUG("done waiting for acknowledge_drawing_halt"); + A5O_DEBUG("done waiting for acknowledge_drawing_halt"); - ALLEGRO_DEBUG("AllegroSurface_nativeOnDestroy end"); + A5O_DEBUG("AllegroSurface_nativeOnDestroy end"); return true; } @@ -116,15 +116,15 @@ JNI_FUNC(bool, AllegroSurface, nativeOnDestroy, (JNIEnv *env, jobject obj)) JNI_FUNC(void, AllegroSurface, nativeOnChange, (JNIEnv *env, jobject obj, jint format, jint width, jint height)) { - ALLEGRO_SYSTEM *system = (void *)al_get_system_driver(); + A5O_SYSTEM *system = (void *)al_get_system_driver(); ASSERT(system != NULL); - ALLEGRO_DISPLAY_ANDROID **dptr = _al_vector_ref(&system->displays, 0); - ALLEGRO_DISPLAY_ANDROID *d = *dptr; - ALLEGRO_DISPLAY *display = (ALLEGRO_DISPLAY*)d; + A5O_DISPLAY_ANDROID **dptr = _al_vector_ref(&system->displays, 0); + A5O_DISPLAY_ANDROID *d = *dptr; + A5O_DISPLAY *display = (A5O_DISPLAY*)d; ASSERT(display != NULL); - ALLEGRO_DEBUG("on change %dx%d!", width, height); + A5O_DEBUG("on change %dx%d!", width, height); (void)format; if (!d->first_run && !d->recreate) { @@ -136,7 +136,7 @@ JNI_FUNC(void, AllegroSurface, nativeOnChange, (JNIEnv *env, jobject obj, if (d->first_run || d->recreate) { d->surface_object = (*env)->NewGlobalRef(env, obj); - if (display->flags & ALLEGRO_FULLSCREEN_WINDOW) { + if (display->flags & A5O_FULLSCREEN_WINDOW) { display->w = width; display->h = height; } @@ -156,18 +156,18 @@ JNI_FUNC(void, AllegroSurface, nativeOnChange, (JNIEnv *env, jobject obj, d->resumed = false; if (!d->first_run) { - ALLEGRO_DEBUG("locking display event source: %p", d); + A5O_DEBUG("locking display event source: %p", d); _al_event_source_lock(&display->es); - ALLEGRO_DEBUG("check generate event"); + A5O_DEBUG("check generate event"); if (_al_event_source_needs_to_generate_event(&display->es)) { - ALLEGRO_EVENT event; - event.display.type = ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING; + A5O_EVENT event; + event.display.type = A5O_EVENT_DISPLAY_RESUME_DRAWING; event.display.timestamp = al_current_time(); _al_event_source_emit_event(&display->es, &event); } - ALLEGRO_DEBUG("unlocking display event source"); + A5O_DEBUG("unlocking display event source"); _al_event_source_unlock(&display->es); } @@ -176,11 +176,11 @@ JNI_FUNC(void, AllegroSurface, nativeOnChange, (JNIEnv *env, jobject obj, d->first_run = false; } else { - ALLEGRO_DEBUG("Waiting for al_acknowledge_drawing_resume"); + A5O_DEBUG("Waiting for al_acknowledge_drawing_resume"); while (!d->resumed) { al_wait_cond(d->cond, d->mutex); } - ALLEGRO_DEBUG("Got al_acknowledge_drawing_resume"); + A5O_DEBUG("Got al_acknowledge_drawing_resume"); } al_unlock_mutex(d->mutex); @@ -232,22 +232,22 @@ void _al_android_destroy_surface(JNIEnv *env, jobject surface, bool post) } } -void _al_android_make_current(JNIEnv *env, ALLEGRO_DISPLAY_ANDROID *d) +void _al_android_make_current(JNIEnv *env, A5O_DISPLAY_ANDROID *d) { _jni_callVoidMethodV(env, d->surface_object, "egl_makeCurrent", "()V"); } -void _al_android_clear_current(JNIEnv *env, ALLEGRO_DISPLAY_ANDROID *d) +void _al_android_clear_current(JNIEnv *env, A5O_DISPLAY_ANDROID *d) { _jni_callVoidMethodV(env, d->surface_object, "egl_clearCurrent", "()V"); } static bool _al_android_init_display(JNIEnv *env, - ALLEGRO_DISPLAY_ANDROID *display) + A5O_DISPLAY_ANDROID *display) { - ALLEGRO_SYSTEM_ANDROID *system = (void *)al_get_system_driver(); - ALLEGRO_DISPLAY *d = (ALLEGRO_DISPLAY *)display; - const ALLEGRO_EXTRA_DISPLAY_SETTINGS *extras = &main_thread_display_settings; + A5O_SYSTEM_ANDROID *system = (void *)al_get_system_driver(); + A5O_DISPLAY *d = (A5O_DISPLAY *)display; + const A5O_EXTRA_DISPLAY_SETTINGS *extras = &main_thread_display_settings; int config_index; bool programmable_pipeline; int major_version, minor_version; @@ -258,13 +258,13 @@ static bool _al_android_init_display(JNIEnv *env, ASSERT(system != NULL); ASSERT(display != NULL); - ALLEGRO_DEBUG("calling egl_Init"); + A5O_DEBUG("calling egl_Init"); if (!_jni_callBooleanMethodV(env, display->surface_object, "egl_Init", "()Z")) { // XXX should probably destroy the AllegroSurface here - ALLEGRO_ERROR("failed to initialize EGL"); + A5O_ERROR("failed to initialize EGL"); display->failed = true; return false; } @@ -272,46 +272,46 @@ static bool _al_android_init_display(JNIEnv *env, config_index = select_best_visual_and_update(env, display); if (config_index < 0) { // XXX should probably destroy the AllegroSurface here - ALLEGRO_ERROR("Failed to choose config.\n"); + A5O_ERROR("Failed to choose config.\n"); display->failed = true; return false; } - programmable_pipeline = (d->flags & ALLEGRO_PROGRAMMABLE_PIPELINE); - major_version = extras->settings[ALLEGRO_OPENGL_MAJOR_VERSION]; - minor_version = extras->settings[ALLEGRO_OPENGL_MINOR_VERSION]; - is_required_major = (extras->required & ((int64_t)1 << ALLEGRO_OPENGL_MAJOR_VERSION)); - is_required_minor = (extras->required & ((int64_t)1 << ALLEGRO_OPENGL_MINOR_VERSION)); - is_suggested_major = (extras->suggested & ((int64_t)1 << ALLEGRO_OPENGL_MAJOR_VERSION)); - is_suggested_minor = (extras->suggested & ((int64_t)1 << ALLEGRO_OPENGL_MINOR_VERSION)); + programmable_pipeline = (d->flags & A5O_PROGRAMMABLE_PIPELINE); + major_version = extras->settings[A5O_OPENGL_MAJOR_VERSION]; + minor_version = extras->settings[A5O_OPENGL_MINOR_VERSION]; + is_required_major = (extras->required & ((int64_t)1 << A5O_OPENGL_MAJOR_VERSION)); + is_required_minor = (extras->required & ((int64_t)1 << A5O_OPENGL_MINOR_VERSION)); + is_suggested_major = (extras->suggested & ((int64_t)1 << A5O_OPENGL_MAJOR_VERSION)); + is_suggested_minor = (extras->suggested & ((int64_t)1 << A5O_OPENGL_MINOR_VERSION)); if (!is_required_major && !is_suggested_major) // "don't care" major_version = 0; if (!is_required_minor && !is_suggested_minor) minor_version = 0; - ALLEGRO_DEBUG("calling egl_createContext"); + A5O_DEBUG("calling egl_createContext"); ret = _jni_callIntMethodV(env, display->surface_object, "egl_createContext", "(IZIIZZ)I", config_index, programmable_pipeline, major_version, minor_version, is_required_major, is_required_minor); if (!ret) { // XXX should probably destroy the AllegroSurface here - ALLEGRO_ERROR("failed to create egl context!"); + A5O_ERROR("failed to create egl context!"); display->failed = true; return false; } - ALLEGRO_DEBUG("calling egl_createSurface"); + A5O_DEBUG("calling egl_createSurface"); if (!_jni_callBooleanMethodV(env, display->surface_object, "egl_createSurface", "()Z")) { // XXX should probably destroy the AllegroSurface here - ALLEGRO_ERROR("failed to create egl surface!"); + A5O_ERROR("failed to create egl surface!"); display->failed = true; return false; } - ALLEGRO_DEBUG("initialize ogl extensions"); + A5O_DEBUG("initialize ogl extensions"); _al_ogl_manage_extensions(d); _al_ogl_set_extensions(d->ogl_extras->extension_api); @@ -323,28 +323,28 @@ static bool _al_android_init_display(JNIEnv *env, /* implementation helpers */ -static void _al_android_resize_display(ALLEGRO_DISPLAY_ANDROID *d, +static void _al_android_resize_display(A5O_DISPLAY_ANDROID *d, int width, int height) { - ALLEGRO_DISPLAY *display = (ALLEGRO_DISPLAY *)d; + A5O_DISPLAY *display = (A5O_DISPLAY *)d; bool emitted_event = true; - ALLEGRO_DEBUG("display resize"); + A5O_DEBUG("display resize"); d->resize_acknowledge = false; d->resize_acknowledge2 = false; - ALLEGRO_DEBUG("locking mutex"); + A5O_DEBUG("locking mutex"); al_lock_mutex(d->mutex); - ALLEGRO_DEBUG("done locking mutex"); + A5O_DEBUG("done locking mutex"); - ALLEGRO_DEBUG("locking display event source: %p", d); + A5O_DEBUG("locking display event source: %p", d); _al_event_source_lock(&display->es); - ALLEGRO_DEBUG("check generate event"); + A5O_DEBUG("check generate event"); if(_al_event_source_needs_to_generate_event(&display->es)) { - ALLEGRO_EVENT event; - event.display.type = ALLEGRO_EVENT_DISPLAY_RESIZE; + A5O_EVENT event; + event.display.type = A5O_EVENT_DISPLAY_RESIZE; event.display.timestamp = al_current_time(); event.display.x = 0; // FIXME: probably not correct event.display.y = 0; @@ -357,23 +357,23 @@ static void _al_android_resize_display(ALLEGRO_DISPLAY_ANDROID *d, emitted_event = false; } - ALLEGRO_DEBUG("unlocking display event source"); + A5O_DEBUG("unlocking display event source"); _al_event_source_unlock(&display->es); if (emitted_event) { - ALLEGRO_DEBUG("waiting for display resize acknowledge"); + A5O_DEBUG("waiting for display resize acknowledge"); while (!d->resize_acknowledge) { - ALLEGRO_DEBUG("calling al_wait_cond"); + A5O_DEBUG("calling al_wait_cond"); al_wait_cond(d->cond, d->mutex); } al_unlock_mutex(d->mutex); - ALLEGRO_DEBUG("done waiting for display resize acknowledge"); + A5O_DEBUG("done waiting for display resize acknowledge"); } display->w = width; display->h = height; - ALLEGRO_DEBUG("resize backbuffer"); + A5O_DEBUG("resize backbuffer"); _al_ogl_setup_gl(display); if (emitted_event) { @@ -383,39 +383,39 @@ static void _al_android_resize_display(ALLEGRO_DISPLAY_ANDROID *d, al_unlock_mutex(d->mutex); - ALLEGRO_DEBUG("done"); + A5O_DEBUG("done"); } -static void call_initRequiredAttribs(JNIEnv *env, ALLEGRO_DISPLAY_ANDROID *d) +static void call_initRequiredAttribs(JNIEnv *env, A5O_DISPLAY_ANDROID *d) { _jni_callVoidMethodV(env, d->surface_object, "egl_initRequiredAttribs", "()V"); } -static void call_setRequiredAttrib(JNIEnv *env, ALLEGRO_DISPLAY_ANDROID *d, +static void call_setRequiredAttrib(JNIEnv *env, A5O_DISPLAY_ANDROID *d, int attr, int value) { _jni_callVoidMethodV(env, d->surface_object, "egl_setRequiredAttrib", "(II)V", attr, value); } -static int call_chooseConfig(JNIEnv *env, ALLEGRO_DISPLAY_ANDROID *d) +static int call_chooseConfig(JNIEnv *env, A5O_DISPLAY_ANDROID *d) { - bool pp = (d->display.flags & ALLEGRO_PROGRAMMABLE_PIPELINE); + bool pp = (d->display.flags & A5O_PROGRAMMABLE_PIPELINE); return _jni_callIntMethodV(env, d->surface_object, "egl_chooseConfig", "(Z)I", pp); } -static void call_getConfigAttribs(JNIEnv *env, ALLEGRO_DISPLAY_ANDROID *d, - int configIndex, ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds) +static void call_getConfigAttribs(JNIEnv *env, A5O_DISPLAY_ANDROID *d, + int configIndex, A5O_EXTRA_DISPLAY_SETTINGS *eds) { jintArray jArray; jint *ptr; int i; - jArray = (*env)->NewIntArray(env, ALLEGRO_DISPLAY_OPTIONS_COUNT); + jArray = (*env)->NewIntArray(env, A5O_DISPLAY_OPTIONS_COUNT); if (jArray == NULL) { - ALLEGRO_ERROR("NewIntArray failed\n"); + A5O_ERROR("NewIntArray failed\n"); return; } @@ -423,15 +423,15 @@ static void call_getConfigAttribs(JNIEnv *env, ALLEGRO_DISPLAY_ANDROID *d, "egl_getConfigAttribs", "(I[I)V", configIndex, jArray); ptr = (*env)->GetIntArrayElements(env, jArray, 0); - for (i = 0; i < ALLEGRO_DISPLAY_OPTIONS_COUNT; i++) { + for (i = 0; i < A5O_DISPLAY_OPTIONS_COUNT; i++) { eds->settings[i] = ptr[i]; } (*env)->ReleaseIntArrayElements(env, jArray, ptr, 0); } -static void set_required_attribs(JNIEnv *env, ALLEGRO_DISPLAY_ANDROID *d, - ALLEGRO_EXTRA_DISPLAY_SETTINGS *ref) +static void set_required_attribs(JNIEnv *env, A5O_DISPLAY_ANDROID *d, + A5O_EXTRA_DISPLAY_SETTINGS *ref) { #define MAYBE_SET(v) \ do { \ @@ -441,33 +441,33 @@ static void set_required_attribs(JNIEnv *env, ALLEGRO_DISPLAY_ANDROID *d, } \ } while (0) - MAYBE_SET(ALLEGRO_RED_SIZE); - MAYBE_SET(ALLEGRO_GREEN_SIZE); - MAYBE_SET(ALLEGRO_BLUE_SIZE); - MAYBE_SET(ALLEGRO_ALPHA_SIZE); - MAYBE_SET(ALLEGRO_COLOR_SIZE); - MAYBE_SET(ALLEGRO_DEPTH_SIZE); - MAYBE_SET(ALLEGRO_STENCIL_SIZE); - MAYBE_SET(ALLEGRO_SAMPLE_BUFFERS); - MAYBE_SET(ALLEGRO_SAMPLES); + MAYBE_SET(A5O_RED_SIZE); + MAYBE_SET(A5O_GREEN_SIZE); + MAYBE_SET(A5O_BLUE_SIZE); + MAYBE_SET(A5O_ALPHA_SIZE); + MAYBE_SET(A5O_COLOR_SIZE); + MAYBE_SET(A5O_DEPTH_SIZE); + MAYBE_SET(A5O_STENCIL_SIZE); + MAYBE_SET(A5O_SAMPLE_BUFFERS); + MAYBE_SET(A5O_SAMPLES); #undef MAYBE_SET } static int select_best_visual_and_update(JNIEnv *env, - ALLEGRO_DISPLAY_ANDROID *d) + A5O_DISPLAY_ANDROID *d) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS *ref = &main_thread_display_settings; - ALLEGRO_EXTRA_DISPLAY_SETTINGS **eds = NULL; + A5O_EXTRA_DISPLAY_SETTINGS *ref = &main_thread_display_settings; + A5O_EXTRA_DISPLAY_SETTINGS **eds = NULL; int num_configs; int chosen_index; int i; - ALLEGRO_DEBUG("Setting required display settings.\n"); + A5O_DEBUG("Setting required display settings.\n"); call_initRequiredAttribs(env, d); set_required_attribs(env, d, ref); - ALLEGRO_DEBUG("Calling eglChooseConfig.\n"); + A5O_DEBUG("Calling eglChooseConfig.\n"); num_configs = call_chooseConfig(env, d); if (num_configs < 1) { return -1; @@ -480,20 +480,20 @@ static int select_best_visual_and_update(JNIEnv *env, call_getConfigAttribs(env, d, i, eds[i]); - eds[i]->settings[ALLEGRO_RENDER_METHOD] = 1; - eds[i]->settings[ALLEGRO_COMPATIBLE_DISPLAY] = 1; - eds[i]->settings[ALLEGRO_SWAP_METHOD] = 2; - eds[i]->settings[ALLEGRO_VSYNC] = 1; + eds[i]->settings[A5O_RENDER_METHOD] = 1; + eds[i]->settings[A5O_COMPATIBLE_DISPLAY] = 1; + eds[i]->settings[A5O_SWAP_METHOD] = 2; + eds[i]->settings[A5O_VSYNC] = 1; eds[i]->index = i; eds[i]->score = _al_score_display_settings(eds[i], ref); } - ALLEGRO_DEBUG("Sorting configs.\n"); + A5O_DEBUG("Sorting configs.\n"); qsort(eds, num_configs, sizeof(*eds), _al_display_settings_sorter); chosen_index = eds[0]->index; - ALLEGRO_INFO("Chose config %i\n", chosen_index); + A5O_INFO("Chose config %i\n", chosen_index); d->display.extra_settings = *eds[0]; @@ -508,11 +508,11 @@ static int select_best_visual_and_update(JNIEnv *env, /* driver implementation hooks */ -static bool android_set_display_flag(ALLEGRO_DISPLAY *dpy, int flag, bool onoff) +static bool android_set_display_flag(A5O_DISPLAY *dpy, int flag, bool onoff) { (void)dpy; (void)flag; (void)onoff; - if (flag == ALLEGRO_FRAMELESS) { + if (flag == A5O_FRAMELESS) { _jni_callVoidMethodV(_al_android_get_jnienv(), _al_android_activity_object(), "setAllegroFrameless", "(Z)V", onoff); } @@ -520,22 +520,22 @@ static bool android_set_display_flag(ALLEGRO_DISPLAY *dpy, int flag, bool onoff) return false; } -static ALLEGRO_DISPLAY *android_create_display(int w, int h) +static A5O_DISPLAY *android_create_display(int w, int h) { - ALLEGRO_DEBUG("begin"); + A5O_DEBUG("begin"); int flags = al_get_new_display_flags(); -#ifndef ALLEGRO_CFG_OPENGL_PROGRAMMABLE_PIPELINE - if (flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { - ALLEGRO_WARN("Programmable pipeline support not built.\n"); +#ifndef A5O_CFG_OPENGL_PROGRAMMABLE_PIPELINE + if (flags & A5O_PROGRAMMABLE_PIPELINE) { + A5O_WARN("Programmable pipeline support not built.\n"); return NULL; } #endif - ALLEGRO_DISPLAY_ANDROID *d = al_malloc(sizeof *d); - ALLEGRO_DISPLAY *display = (void *)d; + A5O_DISPLAY_ANDROID *d = al_malloc(sizeof *d); + A5O_DISPLAY *display = (void *)d; - ALLEGRO_OGL_EXTRAS *ogl = al_malloc(sizeof *ogl); + A5O_OGL_EXTRAS *ogl = al_malloc(sizeof *ogl); memset(d, 0, sizeof *d); memset(ogl, 0, sizeof *ogl); display->ogl_extras = ogl; @@ -544,12 +544,12 @@ static ALLEGRO_DISPLAY *android_create_display(int w, int h) display->h = h; display->flags = flags; - display->flags |= ALLEGRO_OPENGL; -#ifdef ALLEGRO_CFG_OPENGLES2 - display->flags |= ALLEGRO_PROGRAMMABLE_PIPELINE; + display->flags |= A5O_OPENGL; +#ifdef A5O_CFG_OPENGLES2 + display->flags |= A5O_PROGRAMMABLE_PIPELINE; #endif -#ifdef ALLEGRO_CFG_OPENGLES - display->flags |= ALLEGRO_OPENGL_ES_PROFILE; +#ifdef A5O_CFG_OPENGLES + display->flags |= A5O_OPENGL_ES_PROFILE; #endif _al_event_source_init(&display->es); @@ -565,10 +565,10 @@ static ALLEGRO_DISPLAY *android_create_display(int w, int h) d->first_run = true; d->failed = false; - ALLEGRO_SYSTEM *system = (void *)al_get_system_driver(); + A5O_SYSTEM *system = (void *)al_get_system_driver(); ASSERT(system != NULL); - ALLEGRO_DISPLAY_ANDROID **add; + A5O_DISPLAY_ANDROID **add; add = _al_vector_alloc_back(&system->displays); *add = d; @@ -578,48 +578,48 @@ static ALLEGRO_DISPLAY *android_create_display(int w, int h) _al_android_create_surface(_al_android_get_jnienv(), true); // wait for sizing to happen - ALLEGRO_DEBUG("waiting for surface onChange"); + A5O_DEBUG("waiting for surface onChange"); while (!d->created && !d->failed) { al_wait_cond(d->cond, d->mutex); } al_unlock_mutex(d->mutex); - ALLEGRO_DEBUG("done waiting for surface onChange"); + A5O_DEBUG("done waiting for surface onChange"); if (d->failed) { - ALLEGRO_DEBUG("Display creation failed"); + A5O_DEBUG("Display creation failed"); _al_vector_find_and_delete(&system->displays, &d); al_free(ogl); al_free(d); return NULL; } - ALLEGRO_DEBUG("display: %p %ix%i", display, display->w, display->h); + A5O_DEBUG("display: %p %ix%i", display, display->w, display->h); _al_android_clear_current(_al_android_get_jnienv(), d); _al_android_make_current(_al_android_get_jnienv(), d); /* Don't need to repeat what this does */ - android_set_display_option(display, ALLEGRO_SUPPORTED_ORIENTATIONS, - al_get_new_display_option(ALLEGRO_SUPPORTED_ORIENTATIONS, NULL)); + android_set_display_option(display, A5O_SUPPORTED_ORIENTATIONS, + al_get_new_display_option(A5O_SUPPORTED_ORIENTATIONS, NULL)); /* Fill in opengl version */ const int v = d->display.ogl_extras->ogl_info.version; - d->display.extra_settings.settings[ALLEGRO_OPENGL_MAJOR_VERSION] = (v >> 24) & 0xFF; - d->display.extra_settings.settings[ALLEGRO_OPENGL_MINOR_VERSION] = (v >> 16) & 0xFF; + d->display.extra_settings.settings[A5O_OPENGL_MAJOR_VERSION] = (v >> 24) & 0xFF; + d->display.extra_settings.settings[A5O_OPENGL_MINOR_VERSION] = (v >> 16) & 0xFF; - if (flags & ALLEGRO_FRAMELESS) { - android_set_display_flag(display, ALLEGRO_FRAMELESS, true); + if (flags & A5O_FRAMELESS) { + android_set_display_flag(display, A5O_FRAMELESS, true); } - ALLEGRO_DEBUG("end"); + A5O_DEBUG("end"); return display; } -static void android_destroy_display(ALLEGRO_DISPLAY *dpy) +static void android_destroy_display(A5O_DISPLAY *dpy) { - ALLEGRO_DISPLAY_ANDROID *d = (ALLEGRO_DISPLAY_ANDROID*)dpy; + A5O_DISPLAY_ANDROID *d = (A5O_DISPLAY_ANDROID*)dpy; - ALLEGRO_DEBUG("clear current"); + A5O_DEBUG("clear current"); if (!d->created) { // if nativeOnDestroy was called (the app switched out) and @@ -649,43 +649,43 @@ static void android_destroy_display(ALLEGRO_DISPLAY *dpy) already_deleted: // XXX: this causes a crash, no idea why as of yet - //ALLEGRO_DEBUG("destroy backbuffer"); + //A5O_DEBUG("destroy backbuffer"); //_al_ogl_destroy_backbuffer(al_get_backbuffer(dpy)); - ALLEGRO_DEBUG("destroy mutex"); + A5O_DEBUG("destroy mutex"); al_destroy_mutex(d->mutex); - ALLEGRO_DEBUG("destroy cond"); + A5O_DEBUG("destroy cond"); al_destroy_cond(d->cond); - ALLEGRO_DEBUG("free ogl_extras"); + A5O_DEBUG("free ogl_extras"); al_free(dpy->ogl_extras); - ALLEGRO_DEBUG("remove display from system list"); - ALLEGRO_SYSTEM *s = al_get_system_driver(); + A5O_DEBUG("remove display from system list"); + A5O_SYSTEM *s = al_get_system_driver(); _al_vector_find_and_delete(&s->displays, &d); _al_vector_free(&dpy->bitmaps); al_free(dpy->vertex_cache); - ALLEGRO_DEBUG("free display"); + A5O_DEBUG("free display"); al_free(d); - ALLEGRO_DEBUG("done"); + A5O_DEBUG("done"); } -static bool android_set_current_display(ALLEGRO_DISPLAY *dpy) +static bool android_set_current_display(A5O_DISPLAY *dpy) { - ALLEGRO_DEBUG("make current %p", dpy); + A5O_DEBUG("make current %p", dpy); if (al_get_current_display() != NULL){ _al_android_clear_current(_al_android_get_jnienv(), - (ALLEGRO_DISPLAY_ANDROID *)al_get_current_display()); + (A5O_DISPLAY_ANDROID *)al_get_current_display()); } if (dpy) { _al_android_make_current(_al_android_get_jnienv(), - (ALLEGRO_DISPLAY_ANDROID *)dpy); + (A5O_DISPLAY_ANDROID *)dpy); } _al_ogl_update_render_state(dpy); @@ -693,32 +693,32 @@ static bool android_set_current_display(ALLEGRO_DISPLAY *dpy) return true; } -static void android_unset_current_display(ALLEGRO_DISPLAY *dpy) +static void android_unset_current_display(A5O_DISPLAY *dpy) { - ALLEGRO_DEBUG("unset current %p", dpy); + A5O_DEBUG("unset current %p", dpy); _al_android_clear_current(_al_android_get_jnienv(), - (ALLEGRO_DISPLAY_ANDROID *)dpy); + (A5O_DISPLAY_ANDROID *)dpy); } -static void android_flip_display(ALLEGRO_DISPLAY *dpy) +static void android_flip_display(A5O_DISPLAY *dpy) { // Some Androids crash if you swap buffers with an fbo bound // so temporarily change target to the backbuffer. - ALLEGRO_BITMAP *old_target = al_get_target_bitmap(); + A5O_BITMAP *old_target = al_get_target_bitmap(); al_set_target_backbuffer(dpy); _jni_callVoidMethod(_al_android_get_jnienv(), - ((ALLEGRO_DISPLAY_ANDROID *)dpy)->surface_object, "egl_SwapBuffers"); + ((A5O_DISPLAY_ANDROID *)dpy)->surface_object, "egl_SwapBuffers"); al_set_target_bitmap(old_target); - /* Backup bitmaps created without ALLEGRO_NO_PRESERVE_TEXTURE that are + /* Backup bitmaps created without A5O_NO_PRESERVE_TEXTURE that are * dirty, to system memory. */ al_backup_dirty_bitmaps(dpy); } -static void android_update_display_region(ALLEGRO_DISPLAY *dpy, int x, int y, +static void android_update_display_region(A5O_DISPLAY *dpy, int x, int y, int width, int height) { (void)x; @@ -728,49 +728,49 @@ static void android_update_display_region(ALLEGRO_DISPLAY *dpy, int x, int y, android_flip_display(dpy); } -static bool android_acknowledge_resize(ALLEGRO_DISPLAY *dpy) +static bool android_acknowledge_resize(A5O_DISPLAY *dpy) { - ALLEGRO_DISPLAY_ANDROID *d = (ALLEGRO_DISPLAY_ANDROID *)dpy; + A5O_DISPLAY_ANDROID *d = (A5O_DISPLAY_ANDROID *)dpy; - ALLEGRO_DEBUG("clear current context"); + A5O_DEBUG("clear current context"); _al_android_clear_current(_al_android_get_jnienv(), d); - ALLEGRO_DEBUG("locking mutex"); + A5O_DEBUG("locking mutex"); al_lock_mutex(d->mutex); d->resize_acknowledge = true; al_broadcast_cond(d->cond); - ALLEGRO_DEBUG("broadcasted condvar"); + A5O_DEBUG("broadcasted condvar"); - ALLEGRO_DEBUG("waiting for display resize acknowledge 2"); + A5O_DEBUG("waiting for display resize acknowledge 2"); while (!d->resize_acknowledge2) { - ALLEGRO_DEBUG("calling al_wait_cond"); + A5O_DEBUG("calling al_wait_cond"); al_wait_cond(d->cond, d->mutex); } al_unlock_mutex(d->mutex); - ALLEGRO_DEBUG("done waiting for display resize acknowledge 2"); + A5O_DEBUG("done waiting for display resize acknowledge 2"); - ALLEGRO_DEBUG("acquire context"); + A5O_DEBUG("acquire context"); _al_android_make_current(_al_android_get_jnienv(), d); - ALLEGRO_DEBUG("done"); + A5O_DEBUG("done"); return true; } -static int android_get_orientation(ALLEGRO_DISPLAY *dpy) +static int android_get_orientation(A5O_DISPLAY *dpy) { (void)dpy; return _al_android_get_display_orientation(); } -static bool android_is_compatible_bitmap(ALLEGRO_DISPLAY *dpy, - ALLEGRO_BITMAP *bmp) +static bool android_is_compatible_bitmap(A5O_DISPLAY *dpy, + A5O_BITMAP *bmp) { (void)dpy; (void)bmp; return true; } -static bool android_resize_display(ALLEGRO_DISPLAY *dpy, int w, int h) +static bool android_resize_display(A5O_DISPLAY *dpy, int w, int h) { (void)dpy; (void)w; @@ -778,85 +778,85 @@ static bool android_resize_display(ALLEGRO_DISPLAY *dpy, int w, int h) return false; } -static void android_set_icons(ALLEGRO_DISPLAY *dpy, int num_icons, - ALLEGRO_BITMAP *bmps[]) +static void android_set_icons(A5O_DISPLAY *dpy, int num_icons, + A5O_BITMAP *bmps[]) { (void)dpy; (void)num_icons; (void)bmps; } -static void android_set_window_title(ALLEGRO_DISPLAY *dpy, const char *title) +static void android_set_window_title(A5O_DISPLAY *dpy, const char *title) { (void)dpy; (void)title; } -static void android_set_window_position(ALLEGRO_DISPLAY *dpy, int x, int y) +static void android_set_window_position(A5O_DISPLAY *dpy, int x, int y) { (void)dpy; (void)x; (void)y; } -static void android_get_window_position(ALLEGRO_DISPLAY *dpy, int *x, int *y) +static void android_get_window_position(A5O_DISPLAY *dpy, int *x, int *y) { (void)dpy; *x = *y = 0; } -static bool android_wait_for_vsync(ALLEGRO_DISPLAY *dpy) +static bool android_wait_for_vsync(A5O_DISPLAY *dpy) { (void)dpy; return false; } -static bool android_set_mouse_cursor(ALLEGRO_DISPLAY *dpy, - ALLEGRO_MOUSE_CURSOR *cursor) +static bool android_set_mouse_cursor(A5O_DISPLAY *dpy, + A5O_MOUSE_CURSOR *cursor) { (void)dpy; (void)cursor; return false; } -static bool android_set_system_mouse_cursor(ALLEGRO_DISPLAY *dpy, - ALLEGRO_SYSTEM_MOUSE_CURSOR id) +static bool android_set_system_mouse_cursor(A5O_DISPLAY *dpy, + A5O_SYSTEM_MOUSE_CURSOR id) { (void)dpy; (void)id; return false; } -static bool android_show_mouse_cursor(ALLEGRO_DISPLAY *dpy) +static bool android_show_mouse_cursor(A5O_DISPLAY *dpy) { (void)dpy; return false; } -static bool android_hide_mouse_cursor(ALLEGRO_DISPLAY *dpy) +static bool android_hide_mouse_cursor(A5O_DISPLAY *dpy) { (void)dpy; return false; } -static void android_acknowledge_drawing_halt(ALLEGRO_DISPLAY *dpy) +static void android_acknowledge_drawing_halt(A5O_DISPLAY *dpy) { int i; - ALLEGRO_DEBUG("android_acknowledge_drawing_halt"); + A5O_DEBUG("android_acknowledge_drawing_halt"); for (i = 0; i < (int)dpy->bitmaps._size; i++) { - ALLEGRO_BITMAP **bptr = _al_vector_ref(&dpy->bitmaps, i); - ALLEGRO_BITMAP *bmp = *bptr; + A5O_BITMAP **bptr = _al_vector_ref(&dpy->bitmaps, i); + A5O_BITMAP *bmp = *bptr; int bitmap_flags = al_get_bitmap_flags(bmp); if (!bmp->parent && - !(bitmap_flags & ALLEGRO_MEMORY_BITMAP)) + !(bitmap_flags & A5O_MEMORY_BITMAP)) { - ALLEGRO_BITMAP_EXTRA_OPENGL *extra = bmp->extra; + A5O_BITMAP_EXTRA_OPENGL *extra = bmp->extra; al_remove_opengl_fbo(bmp); glDeleteTextures(1, &extra->texture); extra->texture = 0; } } - ALLEGRO_DISPLAY_ANDROID *d = (ALLEGRO_DISPLAY_ANDROID *)dpy; + A5O_DISPLAY_ANDROID *d = (A5O_DISPLAY_ANDROID *)dpy; _al_android_clear_current(_al_android_get_jnienv(), d); @@ -866,31 +866,31 @@ static void android_acknowledge_drawing_halt(ALLEGRO_DISPLAY *dpy) al_broadcast_cond(d->cond); al_unlock_mutex(d->mutex); - ALLEGRO_DEBUG("acknowledged drawing halt"); + A5O_DEBUG("acknowledged drawing halt"); } -static void android_broadcast_resume(ALLEGRO_DISPLAY_ANDROID *d) +static void android_broadcast_resume(A5O_DISPLAY_ANDROID *d) { - ALLEGRO_DEBUG("Broadcasting resume"); + A5O_DEBUG("Broadcasting resume"); d->resumed = true; al_broadcast_cond(d->cond); - ALLEGRO_DEBUG("done broadcasting resume"); + A5O_DEBUG("done broadcasting resume"); } -static void android_acknowledge_drawing_resume(ALLEGRO_DISPLAY *dpy) +static void android_acknowledge_drawing_resume(A5O_DISPLAY *dpy) { unsigned i; - ALLEGRO_DEBUG("begin"); + A5O_DEBUG("begin"); - ALLEGRO_DISPLAY_ANDROID *d = (ALLEGRO_DISPLAY_ANDROID *)dpy; + A5O_DISPLAY_ANDROID *d = (A5O_DISPLAY_ANDROID *)dpy; _al_android_clear_current(_al_android_get_jnienv(), d); _al_android_make_current(_al_android_get_jnienv(), d); - ALLEGRO_DEBUG("made current"); + A5O_DEBUG("made current"); - if (dpy->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { + if (dpy->flags & A5O_PROGRAMMABLE_PIPELINE) { dpy->default_shader = _al_create_default_shader(dpy); } @@ -903,17 +903,17 @@ static void android_acknowledge_drawing_resume(ALLEGRO_DISPLAY *dpy) // Restore bitmaps // have to get this because new bitmaps could be created below for (i = 0; i < _al_vector_size(&dpy->bitmaps); i++) { - ALLEGRO_BITMAP **bptr = _al_vector_ref(&dpy->bitmaps, i); - ALLEGRO_BITMAP *bmp = *bptr; + A5O_BITMAP **bptr = _al_vector_ref(&dpy->bitmaps, i); + A5O_BITMAP *bmp = *bptr; int bitmap_flags = al_get_bitmap_flags(bmp); if (!bmp->parent && - !(bitmap_flags & ALLEGRO_MEMORY_BITMAP)) + !(bitmap_flags & A5O_MEMORY_BITMAP)) { int format = al_get_bitmap_format(bmp); - format = _al_pixel_format_is_compressed(format) ? ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE : format; + format = _al_pixel_format_is_compressed(format) ? A5O_PIXEL_FORMAT_ABGR_8888_LE : format; - if (!(bitmap_flags & ALLEGRO_NO_PRESERVE_TEXTURE)) + if (!(bitmap_flags & A5O_NO_PRESERVE_TEXTURE)) _al_ogl_upload_bitmap_memory(bmp, format, bmp->memory); else _al_ogl_upload_bitmap_memory(bmp, format, NULL); @@ -924,21 +924,21 @@ static void android_acknowledge_drawing_resume(ALLEGRO_DISPLAY *dpy) android_broadcast_resume(d); - ALLEGRO_DEBUG("acknowledge_drawing_resume end"); + A5O_DEBUG("acknowledge_drawing_resume end"); } -static void android_set_display_option(ALLEGRO_DISPLAY *d, int o, int v) +static void android_set_display_option(A5O_DISPLAY *d, int o, int v) { (void)d; - if (o == ALLEGRO_SUPPORTED_ORIENTATIONS) { + if (o == A5O_SUPPORTED_ORIENTATIONS) { _jni_callVoidMethodV(_al_android_get_jnienv(), _al_android_activity_object(), "setAllegroOrientation", "(I)V", v); } } /* obtain a reference to the android driver */ -ALLEGRO_DISPLAY_INTERFACE *_al_get_android_display_driver(void) +A5O_DISPLAY_INTERFACE *_al_get_android_display_driver(void) { if (vt) return vt; diff --git a/src/android/android_image.c b/src/android/android_image.c index a3daf546d9..0206b060a4 100644 --- a/src/android/android_image.c +++ b/src/android/android_image.c @@ -20,17 +20,17 @@ #include -ALLEGRO_DEBUG_CHANNEL("android") +A5O_DEBUG_CHANNEL("android") static void -copy_bitmap_data(ALLEGRO_BITMAP *bitmap, - const uint32_t *src, ALLEGRO_PIXEL_FORMAT src_format, int src_pitch, +copy_bitmap_data(A5O_BITMAP *bitmap, + const uint32_t *src, A5O_PIXEL_FORMAT src_format, int src_pitch, int bitmap_w, int bitmap_h) { - ALLEGRO_LOCKED_REGION *lr; + A5O_LOCKED_REGION *lr; - lr = al_lock_bitmap(bitmap, ALLEGRO_PIXEL_FORMAT_ANY, - ALLEGRO_LOCK_WRITEONLY); + lr = al_lock_bitmap(bitmap, A5O_PIXEL_FORMAT_ANY, + A5O_LOCK_WRITEONLY); ASSERT(lr); if (!lr) return; @@ -43,14 +43,14 @@ copy_bitmap_data(ALLEGRO_BITMAP *bitmap, } static void -copy_bitmap_data_multiply_alpha(ALLEGRO_BITMAP *bitmap, const uint32_t *src, +copy_bitmap_data_multiply_alpha(A5O_BITMAP *bitmap, const uint32_t *src, int bitmap_w, int bitmap_h) { - ALLEGRO_LOCKED_REGION *lr; + A5O_LOCKED_REGION *lr; int x, y; - lr = al_lock_bitmap(bitmap, ALLEGRO_PIXEL_FORMAT_ABGR_8888, - ALLEGRO_LOCK_WRITEONLY); + lr = al_lock_bitmap(bitmap, A5O_PIXEL_FORMAT_ABGR_8888, + A5O_LOCK_WRITEONLY); ASSERT(lr); if (!lr) return; @@ -72,14 +72,14 @@ copy_bitmap_data_multiply_alpha(ALLEGRO_BITMAP *bitmap, const uint32_t *src, } static void -copy_bitmap_data_demultiply_alpha(ALLEGRO_BITMAP *bitmap, const uint32_t *src, +copy_bitmap_data_demultiply_alpha(A5O_BITMAP *bitmap, const uint32_t *src, int src_format, int src_pitch, int bitmap_w, int bitmap_h) { - ALLEGRO_LOCKED_REGION *lr; + A5O_LOCKED_REGION *lr; int x, y; - lr = al_lock_bitmap(bitmap, ALLEGRO_PIXEL_FORMAT_ABGR_8888, - ALLEGRO_LOCK_WRITEONLY); + lr = al_lock_bitmap(bitmap, A5O_PIXEL_FORMAT_ABGR_8888, + A5O_LOCK_WRITEONLY); ASSERT(lr); if (!lr) return; @@ -119,7 +119,7 @@ copy_bitmap_data_demultiply_alpha(ALLEGRO_BITMAP *bitmap, const uint32_t *src, * AllegroInputStream which in turn calls back into C to use Allegro's * file functions. */ -ALLEGRO_BITMAP *_al_android_load_image_f(ALLEGRO_FILE *fh, int flags) +A5O_BITMAP *_al_android_load_image_f(A5O_FILE *fh, int flags) { JNIEnv *jnienv; jclass image_loader_class; @@ -130,13 +130,13 @@ ALLEGRO_BITMAP *_al_android_load_image_f(ALLEGRO_FILE *fh, int flags) uint8_t *buffer; jobject byte_buffer; jobject jbitmap; - ALLEGRO_BITMAP *bitmap; + A5O_BITMAP *bitmap; int bitmap_w; int bitmap_h; int pitch; - if (flags & ALLEGRO_KEEP_INDEX) { - ALLEGRO_ERROR("ALLEGRO_KEEP_INDEX not yet supported\n"); + if (flags & A5O_KEEP_INDEX) { + A5O_ERROR("A5O_KEEP_INDEX not yet supported\n"); return NULL; } @@ -150,7 +150,7 @@ ALLEGRO_BITMAP *_al_android_load_image_f(ALLEGRO_FILE *fh, int flags) input_stream = _jni_call(jnienv, jobject, NewObject, input_stream_class, input_stream_ctor, (jlong)(intptr_t)fh); if (!input_stream) { - ALLEGRO_ERROR("failed to create new AllegroInputStream object"); + A5O_ERROR("failed to create new AllegroInputStream object"); return NULL; } @@ -201,7 +201,7 @@ ALLEGRO_BITMAP *_al_android_load_image_f(ALLEGRO_FILE *fh, int flags) } /* buffer already has alpha multiplied in. */ - if (flags & ALLEGRO_NO_PREMULTIPLIED_ALPHA) { + if (flags & A5O_NO_PREMULTIPLIED_ALPHA) { copy_bitmap_data_demultiply_alpha(bitmap, (const uint32_t *)buffer, src_format, pitch, bitmap_w, bitmap_h); } @@ -215,7 +215,7 @@ ALLEGRO_BITMAP *_al_android_load_image_f(ALLEGRO_FILE *fh, int flags) return bitmap; } -static ALLEGRO_BITMAP *android_load_image_asset(const char *filename, int flags) +static A5O_BITMAP *android_load_image_asset(const char *filename, int flags) { JNIEnv *jnienv; jclass image_loader_class; @@ -224,12 +224,12 @@ static ALLEGRO_BITMAP *android_load_image_asset(const char *filename, int flags) jobject jbitmap; int bitmap_w; int bitmap_h; - ALLEGRO_BITMAP *bitmap; + A5O_BITMAP *bitmap; jintArray ia; jint *arr; - if (flags & ALLEGRO_KEEP_INDEX) { - ALLEGRO_ERROR("ALLEGRO_KEEP_INDEX not yet supported\n"); + if (flags & A5O_KEEP_INDEX) { + A5O_ERROR("A5O_KEEP_INDEX not yet supported\n"); return NULL; } @@ -255,7 +255,7 @@ static ALLEGRO_BITMAP *android_load_image_asset(const char *filename, int flags) bitmap_w = _jni_callIntMethod(jnienv, jbitmap, "getWidth"); bitmap_h = _jni_callIntMethod(jnienv, jbitmap, "getHeight"); - ALLEGRO_DEBUG("bitmap dimensions: %d, %d", bitmap_w, bitmap_h); + A5O_DEBUG("bitmap dimensions: %d, %d", bitmap_w, bitmap_h); bitmap = al_create_bitmap(bitmap_w, bitmap_h); if (!bitmap) { @@ -268,8 +268,8 @@ static ALLEGRO_BITMAP *android_load_image_asset(const char *filename, int flags) arr = (*jnienv)->GetIntArrayElements(jnienv, ia, 0); /* arr is an array of packed colours, NON-premultiplied alpha. */ - if (flags & ALLEGRO_NO_PREMULTIPLIED_ALPHA) { - int src_format = ALLEGRO_PIXEL_FORMAT_ARGB_8888; + if (flags & A5O_NO_PREMULTIPLIED_ALPHA) { + int src_format = A5O_PIXEL_FORMAT_ARGB_8888; int src_pitch = bitmap_w * sizeof(uint32_t); copy_bitmap_data(bitmap, (const uint32_t *)arr, src_format, src_pitch, bitmap_w, bitmap_h); @@ -286,12 +286,12 @@ static ALLEGRO_BITMAP *android_load_image_asset(const char *filename, int flags) return bitmap; } -ALLEGRO_BITMAP *_al_android_load_image(const char *filename, int flags) +A5O_BITMAP *_al_android_load_image(const char *filename, int flags) { - ALLEGRO_FILE *fp; - ALLEGRO_BITMAP *bmp; + A5O_FILE *fp; + A5O_BITMAP *bmp; - /* Bypass the ALLEGRO_FILE interface when we know the underlying stream + /* Bypass the A5O_FILE interface when we know the underlying stream * implementation, to avoid a lot of shunting between C and Java. * We could probably do this for normal filesystem as well. */ diff --git a/src/android/android_input_stream.c b/src/android/android_input_stream.c index fcc1bb38cb..82de67d573 100644 --- a/src/android/android_input_stream.c +++ b/src/android/android_input_stream.c @@ -18,30 +18,30 @@ #include -ALLEGRO_DEBUG_CHANNEL("android") +A5O_DEBUG_CHANNEL("android") -/* XXX ALLEGRO_FILE pointers currently passed as ints */ -ALLEGRO_STATIC_ASSERT(android, sizeof(jlong) >= sizeof(ALLEGRO_FILE *)); +/* XXX A5O_FILE pointers currently passed as ints */ +A5O_STATIC_ASSERT(android, sizeof(jlong) >= sizeof(A5O_FILE *)); JNI_FUNC(int, AllegroInputStream, nativeRead, (JNIEnv *env, jobject obj, jlong handle, jbyteArray array, int offset, int length)) { - ALLEGRO_FILE *fp = (ALLEGRO_FILE *)(intptr_t)handle; + A5O_FILE *fp = (A5O_FILE *)(intptr_t)handle; int ret = -1; jbyte *array_ptr = NULL; ASSERT(fp != NULL); (void)obj; - ALLEGRO_DEBUG("nativeRead begin: handle:%lli fp:%p offset:%i length:%i", + A5O_DEBUG("nativeRead begin: handle:%lli fp:%p offset:%i length:%i", handle, fp, offset, length); int array_len = _jni_call(env, int, GetArrayLength, array); - ALLEGRO_DEBUG("array length: %i", array_len); + A5O_DEBUG("array length: %i", array_len); array_ptr = _jni_call(env, jbyte *, GetByteArrayElements, array, NULL); ASSERT(array_ptr != NULL); - ALLEGRO_DEBUG("al_fread: p:%p, o:%i, l:%i", array_ptr, offset, length); + A5O_DEBUG("al_fread: p:%p, o:%i, l:%i", array_ptr, offset, length); ret = al_fread(fp, array_ptr + offset, length); if (ret == 0 && al_feof(fp)) { @@ -51,14 +51,14 @@ JNI_FUNC(int, AllegroInputStream, nativeRead, (JNIEnv *env, jobject obj, _jni_callv(env, ReleaseByteArrayElements, array, array_ptr, 0); - ALLEGRO_DEBUG("nativeRead end"); + A5O_DEBUG("nativeRead end"); return ret; } JNI_FUNC(void, AllegroInputStream, nativeClose, (JNIEnv *env, jobject obj, jlong handle)) { - ALLEGRO_FILE *fp = (ALLEGRO_FILE *)(intptr_t)handle; + A5O_FILE *fp = (A5O_FILE *)(intptr_t)handle; (void)env; (void)obj; al_fclose(fp); diff --git a/src/android/android_joystick.c b/src/android/android_joystick.c index dd8e222688..8f61b8cb5e 100644 --- a/src/android/android_joystick.c +++ b/src/android/android_joystick.c @@ -4,22 +4,22 @@ #include "allegro5/internal/aintern_joystick.h" #include "allegro5/internal/aintern_android.h" -ALLEGRO_DEBUG_CHANNEL("android") +A5O_DEBUG_CHANNEL("android") /* the number of gamepad & dpad buttons defined in the Android documentation https://developer.android.com/reference/android/view/KeyEvent */ #define MAX_BUTTONS 36 -ALLEGRO_STATIC_ASSERT(android_joystick, _AL_MAX_JOYSTICK_BUTTONS >= MAX_BUTTONS); +A5O_STATIC_ASSERT(android_joystick, _AL_MAX_JOYSTICK_BUTTONS >= MAX_BUTTONS); /* sticks: left & right thumbsticks; left & right triggers */ #define MAX_STICKS 4 -ALLEGRO_STATIC_ASSERT(android_joystick, _AL_MAX_JOYSTICK_STICKS >= MAX_STICKS); +A5O_STATIC_ASSERT(android_joystick, _AL_MAX_JOYSTICK_STICKS >= MAX_STICKS); -typedef struct ALLEGRO_JOYSTICK_ANDROID { - ALLEGRO_JOYSTICK parent; - ALLEGRO_JOYSTICK_STATE joystate; +typedef struct A5O_JOYSTICK_ANDROID { + A5O_JOYSTICK parent; + A5O_JOYSTICK_STATE joystate; char name[64]; -} ALLEGRO_JOYSTICK_ANDROID; +} A5O_JOYSTICK_ANDROID; static const char *button_name[MAX_BUTTONS] = { /* buttons are named according to the Android documentation @@ -66,13 +66,13 @@ static const char *button_name[MAX_BUTTONS] = { "16" }; -static _AL_VECTOR joysticks = _AL_VECTOR_INITIALIZER(ALLEGRO_JOYSTICK_ANDROID *); +static _AL_VECTOR joysticks = _AL_VECTOR_INITIALIZER(A5O_JOYSTICK_ANDROID *); static bool initialized; static char *android_get_joystick_name(JNIEnv *env, jobject activity, int index, char *buffer, size_t buffer_size) { jstring str_obj = (jstring)_jni_callObjectMethodV(env, activity, "getJoystickName", "(I)Ljava/lang/String;", (jint)index); - ALLEGRO_USTR *s = _jni_getString(env, str_obj); + A5O_USTR *s = _jni_getString(env, str_obj); _al_sane_strncpy(buffer, al_cstr(s), buffer_size); al_ustr_free(s); _jni_callv(env, DeleteLocalRef, str_obj); @@ -87,9 +87,9 @@ static void android_init_joysticks(int num) jobject activity = _al_android_activity_object(); for (i = 0; i < num; i++) { - ALLEGRO_JOYSTICK_ANDROID *stick = al_calloc(1, sizeof(ALLEGRO_JOYSTICK_ANDROID)); - ALLEGRO_JOYSTICK_ANDROID **ptr; - ALLEGRO_JOYSTICK *joy; + A5O_JOYSTICK_ANDROID *stick = al_calloc(1, sizeof(A5O_JOYSTICK_ANDROID)); + A5O_JOYSTICK_ANDROID **ptr; + A5O_JOYSTICK *joy; joy = (void *)stick; @@ -101,20 +101,20 @@ static void android_init_joysticks(int num) joy->info.stick[0].num_axes = 2; joy->info.stick[0].axis[0].name = "X"; joy->info.stick[0].axis[1].name = "Y"; - joy->info.stick[0].flags = ALLEGRO_JOYFLAG_ANALOGUE; + joy->info.stick[0].flags = A5O_JOYFLAG_ANALOGUE; joy->info.stick[1].name = "Right Thumbstick"; joy->info.stick[1].num_axes = 2; joy->info.stick[1].axis[0].name = "X"; joy->info.stick[1].axis[1].name = "Y"; - joy->info.stick[1].flags = ALLEGRO_JOYFLAG_ANALOGUE; + joy->info.stick[1].flags = A5O_JOYFLAG_ANALOGUE; joy->info.stick[2].name = "Left Trigger"; joy->info.stick[2].num_axes = 1; joy->info.stick[2].axis[0].name = "Ramp"; - joy->info.stick[2].flags = ALLEGRO_JOYFLAG_ANALOGUE; + joy->info.stick[2].flags = A5O_JOYFLAG_ANALOGUE; joy->info.stick[3].name = "Right Trigger"; joy->info.stick[3].num_axes = 1; joy->info.stick[3].axis[0].name = "Ramp"; - joy->info.stick[3].flags = ALLEGRO_JOYFLAG_ANALOGUE; + joy->info.stick[3].flags = A5O_JOYFLAG_ANALOGUE; for (j = 0; j < joy->info.num_buttons; j++) { joy->info.button[j].name = button_name[j]; @@ -127,9 +127,9 @@ static void android_init_joysticks(int num) static bool andjoy_init_joystick(void) { - ALLEGRO_JOYSTICK_ANDROID *accel = al_calloc(1, sizeof(ALLEGRO_JOYSTICK_ANDROID)); - ALLEGRO_JOYSTICK_ANDROID **ptr; - ALLEGRO_JOYSTICK *joy; + A5O_JOYSTICK_ANDROID *accel = al_calloc(1, sizeof(A5O_JOYSTICK_ANDROID)); + A5O_JOYSTICK_ANDROID **ptr; + A5O_JOYSTICK *joy; int num; joy = (void *)accel; @@ -143,7 +143,7 @@ static bool andjoy_init_joystick(void) joy->info.stick[0].axis[0].name = "X"; joy->info.stick[0].axis[1].name = "Y"; joy->info.stick[0].axis[2].name = "Z"; - joy->info.stick[0].flags = ALLEGRO_JOYFLAG_ANALOGUE; + joy->info.stick[0].flags = A5O_JOYFLAG_ANALOGUE; ptr = _al_vector_alloc_back(&joysticks); *ptr = accel; @@ -173,7 +173,7 @@ static bool andjoy_reconfigure_joysticks(void) sz = _al_vector_size(&joysticks); for (i = 1; i < sz; i++) { - al_free(*((ALLEGRO_JOYSTICK_ANDROID **)_al_vector_ref(&joysticks, 1))); + al_free(*((A5O_JOYSTICK_ANDROID **)_al_vector_ref(&joysticks, 1))); _al_vector_delete_at(&joysticks, 1); } @@ -191,21 +191,21 @@ static int andjoy_num_joysticks(void) return _al_vector_size(&joysticks); } -static ALLEGRO_JOYSTICK *andjoy_get_joystick(int num) +static A5O_JOYSTICK *andjoy_get_joystick(int num) { - ALLEGRO_JOYSTICK_ANDROID *andjoy; - ALLEGRO_JOYSTICK *joy; + A5O_JOYSTICK_ANDROID *andjoy; + A5O_JOYSTICK *joy; if (num >= andjoy_num_joysticks()) return NULL; - andjoy = *((ALLEGRO_JOYSTICK_ANDROID **)_al_vector_ref(&joysticks, num)); + andjoy = *((A5O_JOYSTICK_ANDROID **)_al_vector_ref(&joysticks, num)); joy = &andjoy->parent; return joy; } -static void andjoy_release_joystick(ALLEGRO_JOYSTICK *joy) +static void andjoy_release_joystick(A5O_JOYSTICK *joy) { int i; int sz; @@ -214,26 +214,26 @@ static void andjoy_release_joystick(ALLEGRO_JOYSTICK *joy) sz = _al_vector_size(&joysticks); for (i = 0; i < sz; i++) { - al_free(*((ALLEGRO_JOYSTICK_ANDROID **)_al_vector_ref(&joysticks, 0))); + al_free(*((A5O_JOYSTICK_ANDROID **)_al_vector_ref(&joysticks, 0))); _al_vector_delete_at(&joysticks, 0); } _jni_callVoidMethod(_al_android_get_jnienv(), _al_android_activity_object(), "setJoystickInactive"); - ALLEGRO_DEBUG("Joystick released.\n"); + A5O_DEBUG("Joystick released.\n"); initialized = false; } -static void andjoy_get_joystick_state(ALLEGRO_JOYSTICK *joy, ALLEGRO_JOYSTICK_STATE *ret_state) +static void andjoy_get_joystick_state(A5O_JOYSTICK *joy, A5O_JOYSTICK_STATE *ret_state) { - ALLEGRO_JOYSTICK_ANDROID *andjoy = (void *)joy; - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_JOYSTICK_ANDROID *andjoy = (void *)joy; + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); int i; bool found = false; for (i = 0; i < (int)_al_vector_size(&joysticks); i++) { - ALLEGRO_JOYSTICK_ANDROID **ptr = _al_vector_ref(&joysticks, i); - ALLEGRO_JOYSTICK_ANDROID *thisjoy = *ptr; + A5O_JOYSTICK_ANDROID **ptr = _al_vector_ref(&joysticks, i); + A5O_JOYSTICK_ANDROID *thisjoy = *ptr; if (andjoy == thisjoy) { found = true; break; @@ -270,12 +270,12 @@ void _al_android_generate_accelerometer_event(float x, float y, float z) if (z < -1) z = -1; if (z > 1) z = 1; - ALLEGRO_JOYSTICK_ANDROID *accel = *((ALLEGRO_JOYSTICK_ANDROID **)_al_vector_ref(&joysticks, 0)); - ALLEGRO_JOYSTICK *joy = &accel->parent; + A5O_JOYSTICK_ANDROID *accel = *((A5O_JOYSTICK_ANDROID **)_al_vector_ref(&joysticks, 0)); + A5O_JOYSTICK *joy = &accel->parent; - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); - ALLEGRO_EVENT event; + A5O_EVENT event; _al_event_source_lock(es); @@ -284,7 +284,7 @@ void _al_android_generate_accelerometer_event(float x, float y, float z) int i; for (i = 0; i < 3; i++) { event.joystick.id = joy; - event.joystick.type = ALLEGRO_EVENT_JOYSTICK_AXIS; + event.joystick.type = A5O_EVENT_JOYSTICK_AXIS; event.joystick.timestamp = al_get_time(); event.joystick.stick = 0; event.joystick.axis = i; @@ -305,18 +305,18 @@ void _al_android_generate_joystick_axis_event(int index, int stick, int axis, fl if (!initialized || index >= andjoy_num_joysticks()) return; - ALLEGRO_JOYSTICK_ANDROID *joystick = *((ALLEGRO_JOYSTICK_ANDROID **)_al_vector_ref(&joysticks, index)); - ALLEGRO_JOYSTICK *joy = &joystick->parent; + A5O_JOYSTICK_ANDROID *joystick = *((A5O_JOYSTICK_ANDROID **)_al_vector_ref(&joysticks, index)); + A5O_JOYSTICK *joy = &joystick->parent; - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); - ALLEGRO_EVENT event; + A5O_EVENT event; _al_event_source_lock(es); if (_al_event_source_needs_to_generate_event(es)) { event.joystick.id = joy; - event.joystick.type = ALLEGRO_EVENT_JOYSTICK_AXIS; + event.joystick.type = A5O_EVENT_JOYSTICK_AXIS; event.joystick.timestamp = al_get_time(); event.joystick.stick = stick; event.joystick.axis = axis; @@ -337,19 +337,19 @@ void _al_android_generate_joystick_button_event(int index, int button, bool down if (!initialized || index >= andjoy_num_joysticks()) return; - ALLEGRO_JOYSTICK_ANDROID *joystick = *((ALLEGRO_JOYSTICK_ANDROID **)_al_vector_ref(&joysticks, index)); - ALLEGRO_JOYSTICK *joy = &joystick->parent; + A5O_JOYSTICK_ANDROID *joystick = *((A5O_JOYSTICK_ANDROID **)_al_vector_ref(&joysticks, index)); + A5O_JOYSTICK *joy = &joystick->parent; - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); - ALLEGRO_EVENT event; + A5O_EVENT event; _al_event_source_lock(es); if (down) - type = ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN; + type = A5O_EVENT_JOYSTICK_BUTTON_DOWN; else - type = ALLEGRO_EVENT_JOYSTICK_BUTTON_UP; + type = A5O_EVENT_JOYSTICK_BUTTON_UP; if (_al_event_source_needs_to_generate_event(es)) { event.joystick.id = joy; @@ -360,34 +360,34 @@ void _al_android_generate_joystick_button_event(int index, int button, bool down event.joystick.pos = 0; event.joystick.button = button; - joystick->joystate.button[button] = type == ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN ? 1 : 0; + joystick->joystate.button[button] = type == A5O_EVENT_JOYSTICK_BUTTON_DOWN ? 1 : 0; _al_event_source_emit_event(es, &event); } _al_event_source_unlock(es); } -static char const *andjoy_get_name(ALLEGRO_JOYSTICK *joy) +static char const *andjoy_get_name(A5O_JOYSTICK *joy) { int i; (void)joy; for (i = 0; i < (int)_al_vector_size(&joysticks); i++) { - ALLEGRO_JOYSTICK_ANDROID *andjoy = *((ALLEGRO_JOYSTICK_ANDROID **)_al_vector_ref(&joysticks, i)); - if ((ALLEGRO_JOYSTICK *)andjoy == joy) + A5O_JOYSTICK_ANDROID *andjoy = *((A5O_JOYSTICK_ANDROID **)_al_vector_ref(&joysticks, i)); + if ((A5O_JOYSTICK *)andjoy == joy) return andjoy->name; } return ""; } -static bool andjoy_get_active(ALLEGRO_JOYSTICK *joy) +static bool andjoy_get_active(A5O_JOYSTICK *joy) { (void)joy; return true; } -ALLEGRO_JOYSTICK_DRIVER _al_android_joystick_driver = { +A5O_JOYSTICK_DRIVER _al_android_joystick_driver = { AL_ID('A', 'N', 'D', 'R'), "", "", diff --git a/src/android/android_keyboard.c b/src/android/android_keyboard.c index 1cc1bff59f..1fbe1461b0 100644 --- a/src/android/android_keyboard.c +++ b/src/android/android_keyboard.c @@ -5,10 +5,10 @@ #include -ALLEGRO_DEBUG_CHANNEL("keyboard") +A5O_DEBUG_CHANNEL("keyboard") -static ALLEGRO_KEYBOARD the_keyboard; -static ALLEGRO_KEYBOARD_STATE the_state; +static A5O_KEYBOARD the_keyboard; +static A5O_KEYBOARD_STATE the_state; static bool android_init_keyboard(void) { @@ -23,7 +23,7 @@ static void android_exit_keyboard(void) } -static ALLEGRO_KEYBOARD *android_get_keyboard(void) +static A5O_KEYBOARD *android_get_keyboard(void) { return &the_keyboard; } @@ -37,14 +37,14 @@ static bool android_set_keyboard_leds(int leds) static char const *android_keycode_to_name(int keycode) { static bool created = false; - static char names[ALLEGRO_KEY_MAX][5]; + static char names[A5O_KEY_MAX][5]; - ASSERT(keycode >= 0 && keycode < ALLEGRO_KEY_MAX); + ASSERT(keycode >= 0 && keycode < A5O_KEY_MAX); if (!created) { int i; created = true; - for (i = 0; i < ALLEGRO_KEY_MAX; i++) { + for (i = 0; i < A5O_KEY_MAX; i++) { snprintf(names[i], 5, "%d", i); } } @@ -52,7 +52,7 @@ static char const *android_keycode_to_name(int keycode) return names[keycode]; } -static void android_get_keyboard_state(ALLEGRO_KEYBOARD_STATE *ret_state) +static void android_get_keyboard_state(A5O_KEYBOARD_STATE *ret_state) { _al_event_source_lock(&the_keyboard.es); { @@ -70,7 +70,7 @@ static void android_clear_keyboard_state(void) _al_event_source_unlock(&the_keyboard.es); } -static ALLEGRO_KEYBOARD_DRIVER android_keyboard_driver = { +static A5O_KEYBOARD_DRIVER android_keyboard_driver = { AL_ID('A','N','D','R'), "", "", @@ -84,20 +84,20 @@ static ALLEGRO_KEYBOARD_DRIVER android_keyboard_driver = { android_clear_keyboard_state }; -ALLEGRO_KEYBOARD_DRIVER *_al_get_android_keyboard_driver(void) +A5O_KEYBOARD_DRIVER *_al_get_android_keyboard_driver(void) { return &android_keyboard_driver; } -static void android_keyboard_handle_event(ALLEGRO_DISPLAY *display, - int scancode, int unichar, ALLEGRO_EVENT_TYPE event_type) +static void android_keyboard_handle_event(A5O_DISPLAY *display, + int scancode, int unichar, A5O_EVENT_TYPE event_type) { - ALLEGRO_EVENT event; + A5O_EVENT event; ASSERT(display != NULL); ASSERT(scancode > 0); - if (event_type == ALLEGRO_EVENT_KEY_UP) { + if (event_type == A5O_EVENT_KEY_UP) { _AL_KEYBOARD_STATE_CLEAR_KEY_DOWN(the_state, scancode); } else { @@ -114,7 +114,7 @@ static void android_keyboard_handle_event(ALLEGRO_DISPLAY *display, event.keyboard.keycode = scancode; event.keyboard.unichar = unichar; event.keyboard.modifiers = 0; - event.keyboard.repeat = event_type == ALLEGRO_EVENT_KEY_CHAR; + event.keyboard.repeat = event_type == A5O_EVENT_KEY_CHAR; _al_event_source_emit_event(&the_keyboard.es, &event); } @@ -128,15 +128,15 @@ JNI_FUNC(void, KeyListener, nativeOnKeyDown, (JNIEnv *env, jobject obj, (void)env; (void)obj; - ALLEGRO_SYSTEM *system = al_get_system_driver(); + A5O_SYSTEM *system = al_get_system_driver(); ASSERT(system != NULL); - ALLEGRO_DISPLAY **dptr = _al_vector_ref(&system->displays, 0); - ALLEGRO_DISPLAY *display = *dptr; + A5O_DISPLAY **dptr = _al_vector_ref(&system->displays, 0); + A5O_DISPLAY *display = *dptr; ASSERT(display != NULL); android_keyboard_handle_event(display, scancode, unichar, - ALLEGRO_EVENT_KEY_DOWN); + A5O_EVENT_KEY_DOWN); } JNI_FUNC(void, KeyListener, nativeOnKeyUp, (JNIEnv *env, jobject obj, @@ -145,14 +145,14 @@ JNI_FUNC(void, KeyListener, nativeOnKeyUp, (JNIEnv *env, jobject obj, (void)env; (void)obj; - ALLEGRO_SYSTEM *system = al_get_system_driver(); + A5O_SYSTEM *system = al_get_system_driver(); ASSERT(system != NULL); - ALLEGRO_DISPLAY **dptr = _al_vector_ref(&system->displays, 0); - ALLEGRO_DISPLAY *display = *dptr; + A5O_DISPLAY **dptr = _al_vector_ref(&system->displays, 0); + A5O_DISPLAY *display = *dptr; ASSERT(display != NULL); - android_keyboard_handle_event(display, scancode, 0, ALLEGRO_EVENT_KEY_UP); + android_keyboard_handle_event(display, scancode, 0, A5O_EVENT_KEY_UP); } JNI_FUNC(void, KeyListener, nativeOnKeyChar, (JNIEnv *env, jobject obj, @@ -161,15 +161,15 @@ JNI_FUNC(void, KeyListener, nativeOnKeyChar, (JNIEnv *env, jobject obj, (void)env; (void)obj; - ALLEGRO_SYSTEM *system = al_get_system_driver(); + A5O_SYSTEM *system = al_get_system_driver(); ASSERT(system != NULL); - ALLEGRO_DISPLAY **dptr = _al_vector_ref(&system->displays, 0); - ALLEGRO_DISPLAY *display = *dptr; + A5O_DISPLAY **dptr = _al_vector_ref(&system->displays, 0); + A5O_DISPLAY *display = *dptr; ASSERT(display != NULL); android_keyboard_handle_event(display, scancode, unichar, - ALLEGRO_EVENT_KEY_CHAR); + A5O_EVENT_KEY_CHAR); } JNI_FUNC(void, KeyListener, nativeOnJoystickButton, (JNIEnv *env, jobject obj, diff --git a/src/android/android_mouse.c b/src/android/android_mouse.c index 985482169a..ef39c2f9c1 100644 --- a/src/android/android_mouse.c +++ b/src/android/android_mouse.c @@ -3,12 +3,12 @@ #include "allegro5/internal/aintern_display.h" #include "allegro5/internal/aintern_android.h" -typedef struct ALLEGRO_MOUSE_ANDROID { - ALLEGRO_MOUSE parent; - ALLEGRO_MOUSE_STATE state; -} ALLEGRO_MOUSE_ANDROID; +typedef struct A5O_MOUSE_ANDROID { + A5O_MOUSE parent; + A5O_MOUSE_STATE state; +} A5O_MOUSE_ANDROID; -static ALLEGRO_MOUSE_ANDROID the_mouse; +static A5O_MOUSE_ANDROID the_mouse; static bool amouse_installed; @@ -16,9 +16,9 @@ static bool amouse_installed; * Helper to generate a mouse event. */ void _al_android_generate_mouse_event(unsigned int type, int x, int y, - unsigned int button, ALLEGRO_DISPLAY *d) + unsigned int button, A5O_DISPLAY *d) { - ALLEGRO_EVENT event; + A5O_EVENT event; _al_event_source_lock(&the_mouse.parent.es); @@ -27,10 +27,10 @@ void _al_android_generate_mouse_event(unsigned int type, int x, int y, the_mouse.state.x = x; the_mouse.state.y = y; - if (type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN) { + if (type == A5O_EVENT_MOUSE_BUTTON_DOWN) { the_mouse.state.buttons |= (1 << button); } - else if (type == ALLEGRO_EVENT_MOUSE_BUTTON_UP) { + else if (type == A5O_EVENT_MOUSE_BUTTON_UP) { the_mouse.state.buttons &= ~(1 << button); } @@ -75,10 +75,10 @@ static void amouse_exit(void) _al_event_source_free(&the_mouse.parent.es); } -static ALLEGRO_MOUSE *amouse_get_mouse(void) +static A5O_MOUSE *amouse_get_mouse(void) { ASSERT(amouse_installed); - return (ALLEGRO_MOUSE *)&the_mouse; + return (A5O_MOUSE *)&the_mouse; } /* We report multi-touch as different buttons. */ @@ -93,7 +93,7 @@ static unsigned int amouse_get_mouse_num_axes(void) } /* Hard to accomplish on a touch screen. */ -static bool amouse_set_mouse_xy(ALLEGRO_DISPLAY *display, int x, int y) +static bool amouse_set_mouse_xy(A5O_DISPLAY *display, int x, int y) { (void)display; (void)x; @@ -108,7 +108,7 @@ static bool amouse_set_mouse_axis(int which, int z) return false; } -static ALLEGRO_MOUSE_DRIVER android_mouse_driver = { +static A5O_MOUSE_DRIVER android_mouse_driver = { AL_ID('A', 'N', 'D', 'R'), "", "", @@ -123,7 +123,7 @@ static ALLEGRO_MOUSE_DRIVER android_mouse_driver = { _al_android_mouse_get_state }; -ALLEGRO_MOUSE_DRIVER *_al_get_android_mouse_driver(void) +A5O_MOUSE_DRIVER *_al_get_android_mouse_driver(void) { return &android_mouse_driver; } diff --git a/src/android/android_system.c b/src/android/android_system.c index 2fc0cfab31..1a9b9de8a3 100644 --- a/src/android/android_system.c +++ b/src/android/android_system.c @@ -29,7 +29,7 @@ #include "allegro5/allegro_opengl.h" #include "allegro5/internal/aintern_opengl.h" -ALLEGRO_DEBUG_CHANNEL("android") +A5O_DEBUG_CHANNEL("android") struct system_data_t { JNIEnv *env; @@ -41,19 +41,19 @@ struct system_data_t { jclass clipboard_class; jclass apk_fs_class; - ALLEGRO_SYSTEM_ANDROID *system; - ALLEGRO_MUTEX *mutex; - ALLEGRO_COND *cond; - ALLEGRO_THREAD *trampoline; + A5O_SYSTEM_ANDROID *system; + A5O_MUTEX *mutex; + A5O_COND *cond; + A5O_THREAD *trampoline; bool trampoline_running; - ALLEGRO_USTR *user_lib_name; - ALLEGRO_USTR *resources_dir; - ALLEGRO_USTR *data_dir; - ALLEGRO_USTR *temp_dir; - ALLEGRO_USTR *apk_path; - ALLEGRO_USTR *model; - ALLEGRO_USTR *manufacturer; + A5O_USTR *user_lib_name; + A5O_USTR *resources_dir; + A5O_USTR *data_dir; + A5O_USTR *temp_dir; + A5O_USTR *apk_path; + A5O_USTR *model; + A5O_USTR *manufacturer; void *user_lib; int (*user_main)(int argc, char **argv); @@ -113,7 +113,7 @@ static void finish_activity(JNIEnv *env); static bool already_cleaned_up = false; -/* NOTE: don't put any ALLEGRO_DEBUG in here! */ +/* NOTE: don't put any A5O_DEBUG in here! */ static void android_cleanup(bool uninstall_system) { if (already_cleaned_up) { @@ -133,7 +133,7 @@ static void android_cleanup(bool uninstall_system) (*javavm)->DetachCurrentThread(javavm); } -static void *android_app_trampoline(ALLEGRO_THREAD *thr, void *arg) +static void *android_app_trampoline(A5O_THREAD *thr, void *arg) { const int argc = 1; const char *argv[2] = {system_data.user_lib, NULL}; @@ -142,21 +142,21 @@ static void *android_app_trampoline(ALLEGRO_THREAD *thr, void *arg) (void)thr; (void)arg; - ALLEGRO_DEBUG("signaling running"); + A5O_DEBUG("signaling running"); al_lock_mutex(system_data.mutex); system_data.trampoline_running = true; al_broadcast_cond(system_data.cond); al_unlock_mutex(system_data.mutex); - ALLEGRO_DEBUG("entering main function %p", system_data.user_main); + A5O_DEBUG("entering main function %p", system_data.user_main); ret = (system_data.user_main)(argc, (char **)argv); /* Can we do anything with this exit code? */ - ALLEGRO_DEBUG("returned from main function, exit code = %d", ret); + A5O_DEBUG("returned from main function, exit code = %d", ret); - /* NOTE: don't put any ALLEGRO_DEBUG in here after running main! */ + /* NOTE: don't put any A5O_DEBUG in here after running main! */ android_cleanup(true); @@ -173,12 +173,12 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) JNI_FUNC(bool, AllegroActivity, nativeOnCreate, (JNIEnv *env, jobject obj)) { - ALLEGRO_SYSTEM_ANDROID *na_sys = NULL; + A5O_SYSTEM_ANDROID *na_sys = NULL; jclass iae; jclass aisc; jclass asc; - ALLEGRO_DEBUG("entered nativeOnCreate"); + A5O_DEBUG("entered nativeOnCreate"); // we're already initialized, we REALLY don't want to run all the stuff below again. if(system_data.system) { @@ -186,38 +186,38 @@ JNI_FUNC(bool, AllegroActivity, nativeOnCreate, (JNIEnv *env, jobject obj)) } pthread_t self = pthread_self(); - ALLEGRO_DEBUG("pthread_self:%p", (void*)self); - ALLEGRO_DEBUG("nativeOnCreate begin"); + A5O_DEBUG("pthread_self:%p", (void*)self); + A5O_DEBUG("nativeOnCreate begin"); memset(&system_data, 0, sizeof(system_data)); - ALLEGRO_DEBUG("grab activity global refs"); + A5O_DEBUG("grab activity global refs"); system_data.env = env; system_data.activity_object = (*env)->NewGlobalRef(env, obj); iae = (*env)->FindClass(env, "java/lang/IllegalArgumentException"); system_data.illegal_argument_exception_class = (*env)->NewGlobalRef(env, iae); - aisc = (*env)->FindClass(env, ALLEGRO_ANDROID_PACKAGE_NAME_SLASH "/AllegroInputStream"); + aisc = (*env)->FindClass(env, A5O_ANDROID_PACKAGE_NAME_SLASH "/AllegroInputStream"); system_data.input_stream_class = (*env)->NewGlobalRef(env, aisc); - asc = (*env)->FindClass(env, ALLEGRO_ANDROID_PACKAGE_NAME_SLASH "/AllegroAPKStream"); + asc = (*env)->FindClass(env, A5O_ANDROID_PACKAGE_NAME_SLASH "/AllegroAPKStream"); system_data.apk_stream_class = (*env)->NewGlobalRef(env, asc); - asc = (*env)->FindClass(env, ALLEGRO_ANDROID_PACKAGE_NAME_SLASH "/ImageLoader"); + asc = (*env)->FindClass(env, A5O_ANDROID_PACKAGE_NAME_SLASH "/ImageLoader"); system_data.image_loader_class = (*env)->NewGlobalRef(env, asc); - asc = (*env)->FindClass(env, ALLEGRO_ANDROID_PACKAGE_NAME_SLASH "/Clipboard"); + asc = (*env)->FindClass(env, A5O_ANDROID_PACKAGE_NAME_SLASH "/Clipboard"); system_data.clipboard_class = (*env)->NewGlobalRef(env, asc); - asc = (*env)->FindClass(env, ALLEGRO_ANDROID_PACKAGE_NAME_SLASH "/AllegroAPKList"); + asc = (*env)->FindClass(env, A5O_ANDROID_PACKAGE_NAME_SLASH "/AllegroAPKList"); system_data.apk_fs_class = (*env)->NewGlobalRef(env, asc); - ALLEGRO_DEBUG("create mutex and cond objects"); + A5O_DEBUG("create mutex and cond objects"); system_data.mutex = al_create_mutex(); system_data.cond = al_create_cond(); - ALLEGRO_DEBUG("get directories"); + A5O_DEBUG("get directories"); system_data.user_lib_name = _jni_callStringMethod(env, system_data.activity_object, "getUserLibName", "()Ljava/lang/String;"); system_data.resources_dir = _jni_callStringMethod(env, system_data.activity_object, "getResourcesDir", "()Ljava/lang/String;"); system_data.data_dir = _jni_callStringMethod(env, system_data.activity_object, "getPubDataDir", "()Ljava/lang/String;"); @@ -225,57 +225,57 @@ JNI_FUNC(bool, AllegroActivity, nativeOnCreate, (JNIEnv *env, jobject obj)) system_data.apk_path = _jni_callStringMethod(env, system_data.activity_object, "getApkPath", "()Ljava/lang/String;"); system_data.model = _jni_callStringMethod(env, system_data.activity_object, "getModel", "()Ljava/lang/String;"); system_data.manufacturer = _jni_callStringMethod(env, system_data.activity_object, "getManufacturer", "()Ljava/lang/String;"); - ALLEGRO_DEBUG("resources_dir: %s", al_cstr(system_data.resources_dir)); - ALLEGRO_DEBUG("data_dir: %s", al_cstr(system_data.data_dir)); - ALLEGRO_DEBUG("temp_dir: %s", al_cstr(system_data.temp_dir)); - ALLEGRO_DEBUG("apk_path: %s", al_cstr(system_data.apk_path)); - ALLEGRO_DEBUG("model: %s", al_cstr(system_data.model)); - ALLEGRO_DEBUG("manufacturer: %s", al_cstr(system_data.manufacturer)); - - ALLEGRO_DEBUG("creating ALLEGRO_SYSTEM_ANDROID struct"); - na_sys = system_data.system = (ALLEGRO_SYSTEM_ANDROID*)al_malloc(sizeof *na_sys); + A5O_DEBUG("resources_dir: %s", al_cstr(system_data.resources_dir)); + A5O_DEBUG("data_dir: %s", al_cstr(system_data.data_dir)); + A5O_DEBUG("temp_dir: %s", al_cstr(system_data.temp_dir)); + A5O_DEBUG("apk_path: %s", al_cstr(system_data.apk_path)); + A5O_DEBUG("model: %s", al_cstr(system_data.model)); + A5O_DEBUG("manufacturer: %s", al_cstr(system_data.manufacturer)); + + A5O_DEBUG("creating A5O_SYSTEM_ANDROID struct"); + na_sys = system_data.system = (A5O_SYSTEM_ANDROID*)al_malloc(sizeof *na_sys); memset(na_sys, 0, sizeof *na_sys); - ALLEGRO_DEBUG("get system pointer"); - ALLEGRO_SYSTEM *sys = &na_sys->system; - ALLEGRO_DEBUG("get system interface"); + A5O_DEBUG("get system pointer"); + A5O_SYSTEM *sys = &na_sys->system; + A5O_DEBUG("get system interface"); sys->vt = _al_system_android_interface(); - ALLEGRO_DEBUG("init display vector"); - _al_vector_init(&sys->displays, sizeof(ALLEGRO_DISPLAY_ANDROID *)); + A5O_DEBUG("init display vector"); + _al_vector_init(&sys->displays, sizeof(A5O_DISPLAY_ANDROID *)); - ALLEGRO_DEBUG("init time"); + A5O_DEBUG("init time"); _al_unix_init_time(); const char *user_lib_name = al_cstr(system_data.user_lib_name); - ALLEGRO_DEBUG("load user lib: %s", user_lib_name); + A5O_DEBUG("load user lib: %s", user_lib_name); system_data.user_lib = dlopen(user_lib_name, RTLD_LAZY|RTLD_GLOBAL); if (!system_data.user_lib) { - ALLEGRO_ERROR("failed to load user lib: %s", user_lib_name); - ALLEGRO_ERROR("%s", dlerror()); + A5O_ERROR("failed to load user lib: %s", user_lib_name); + A5O_ERROR("%s", dlerror()); return false; } system_data.user_main = dlsym(system_data.user_lib, "main"); if (!system_data.user_main) { - ALLEGRO_ERROR("failed to locate symbol main: %s", dlerror()); + A5O_ERROR("failed to locate symbol main: %s", dlerror()); dlclose(system_data.user_lib); return false; } - ALLEGRO_DEBUG("main function address: %p\n", system_data.user_main); + A5O_DEBUG("main function address: %p\n", system_data.user_main); - ALLEGRO_DEBUG("creating trampoline for app thread"); + A5O_DEBUG("creating trampoline for app thread"); system_data.trampoline = al_create_thread(android_app_trampoline, NULL); al_start_thread(system_data.trampoline); - ALLEGRO_DEBUG("waiting for app trampoline to signal running"); + A5O_DEBUG("waiting for app trampoline to signal running"); al_lock_mutex(system_data.mutex); while(!system_data.trampoline_running) { al_wait_cond(system_data.cond, system_data.mutex); } al_unlock_mutex(system_data.mutex); - ALLEGRO_DEBUG("setup done. returning to dalvik."); + A5O_DEBUG("setup done. returning to dalvik."); return true; } @@ -286,30 +286,30 @@ JNI_FUNC(void, AllegroActivity, nativeOnPause, (JNIEnv *env, jobject obj)) (void)env; (void)obj; - ALLEGRO_DEBUG("pause activity\n"); + A5O_DEBUG("pause activity\n"); system_data.paused = true; - ALLEGRO_SYSTEM *sys = (void *)al_get_system_driver(); + A5O_SYSTEM *sys = (void *)al_get_system_driver(); if (!system_data.system || !sys) { - ALLEGRO_DEBUG("no system driver"); + A5O_DEBUG("no system driver"); return; } if (!_al_vector_size(&sys->displays)) { - ALLEGRO_DEBUG("no display, not sending SWITCH_OUT event"); + A5O_DEBUG("no display, not sending SWITCH_OUT event"); return; } - ALLEGRO_DISPLAY *display = *(ALLEGRO_DISPLAY**)_al_vector_ref(&sys->displays, 0); + A5O_DISPLAY *display = *(A5O_DISPLAY**)_al_vector_ref(&sys->displays, 0); if (display) { - ALLEGRO_EVENT event; + A5O_EVENT event; _al_event_source_lock(&display->es); if(_al_event_source_needs_to_generate_event(&display->es)) { - event.display.type = ALLEGRO_EVENT_DISPLAY_SWITCH_OUT; + event.display.type = A5O_EVENT_DISPLAY_SWITCH_OUT; event.display.timestamp = al_current_time(); _al_event_source_emit_event(&display->es, &event); } @@ -319,40 +319,40 @@ JNI_FUNC(void, AllegroActivity, nativeOnPause, (JNIEnv *env, jobject obj)) JNI_FUNC(void, AllegroActivity, nativeOnResume, (JNIEnv *env, jobject obj)) { - ALLEGRO_SYSTEM *sys = &system_data.system->system; - ALLEGRO_DISPLAY *d = NULL; + A5O_SYSTEM *sys = &system_data.system->system; + A5O_DISPLAY *d = NULL; (void)obj; system_data.paused = false; - ALLEGRO_DEBUG("resume activity"); + A5O_DEBUG("resume activity"); if(!system_data.system || !sys) { - ALLEGRO_DEBUG("no system driver"); + A5O_DEBUG("no system driver"); return; } if(!_al_vector_size(&sys->displays)) { - ALLEGRO_DEBUG("no display, not sending SWITCH_IN event"); + A5O_DEBUG("no display, not sending SWITCH_IN event"); return; } - d = *(ALLEGRO_DISPLAY**)_al_vector_ref(&sys->displays, 0); - ALLEGRO_DEBUG("got display: %p", d); + d = *(A5O_DISPLAY**)_al_vector_ref(&sys->displays, 0); + A5O_DEBUG("got display: %p", d); - if(!((ALLEGRO_DISPLAY_ANDROID*)d)->created) { + if(!((A5O_DISPLAY_ANDROID*)d)->created) { _al_android_create_surface(env, true); // request android create our surface } - ALLEGRO_DISPLAY *display = *(ALLEGRO_DISPLAY**)_al_vector_ref(&sys->displays, 0); + A5O_DISPLAY *display = *(A5O_DISPLAY**)_al_vector_ref(&sys->displays, 0); if (display) { - ALLEGRO_EVENT event; + A5O_EVENT event; _al_event_source_lock(&display->es); if(_al_event_source_needs_to_generate_event(&display->es)) { - event.display.type = ALLEGRO_EVENT_DISPLAY_SWITCH_IN; + event.display.type = A5O_EVENT_DISPLAY_SWITCH_IN; event.display.timestamp = al_current_time(); _al_event_source_emit_event(&display->es, &event); } @@ -360,7 +360,7 @@ JNI_FUNC(void, AllegroActivity, nativeOnResume, (JNIEnv *env, jobject obj)) } } -/* NOTE: don't put any ALLEGRO_DEBUG in here! */ +/* NOTE: don't put any A5O_DEBUG in here! */ JNI_FUNC(void, AllegroActivity, nativeOnDestroy, (JNIEnv *env, jobject obj)) { (void)obj; @@ -405,13 +405,13 @@ JNI_FUNC(void, AllegroActivity, nativeOnDestroy, (JNIEnv *env, jobject obj)) JNI_FUNC(void, AllegroActivity, nativeOnOrientationChange, (JNIEnv *env, jobject obj, int orientation, bool init)) { - ALLEGRO_SYSTEM *sys = &system_data.system->system; - ALLEGRO_DISPLAY *d = NULL; - ALLEGRO_EVENT event; + A5O_SYSTEM *sys = &system_data.system->system; + A5O_DISPLAY *d = NULL; + A5O_EVENT event; (void)env; (void)obj; - ALLEGRO_DEBUG("got orientation change!"); + A5O_DEBUG("got orientation change!"); system_data.orientation = orientation; @@ -419,26 +419,26 @@ JNI_FUNC(void, AllegroActivity, nativeOnOrientationChange, (JNIEnv *env, jobject /* no display, just skip */ if (!_al_vector_size(&sys->displays)) { - ALLEGRO_DEBUG("no display, not sending orientation change event"); + A5O_DEBUG("no display, not sending orientation change event"); return; } - d = *(ALLEGRO_DISPLAY**)_al_vector_ref(&sys->displays, 0); + d = *(A5O_DISPLAY**)_al_vector_ref(&sys->displays, 0); ASSERT(d != NULL); - ALLEGRO_DEBUG("locking display event source: %p %p", d, &d->es); + A5O_DEBUG("locking display event source: %p %p", d, &d->es); _al_event_source_lock(&d->es); if(_al_event_source_needs_to_generate_event(&d->es)) { - ALLEGRO_DEBUG("emit event"); - event.display.type = ALLEGRO_EVENT_DISPLAY_ORIENTATION; + A5O_DEBUG("emit event"); + event.display.type = A5O_EVENT_DISPLAY_ORIENTATION; event.display.timestamp = al_current_time(); event.display.orientation = orientation; _al_event_source_emit_event(&d->es, &event); } - ALLEGRO_DEBUG("unlocking display event source"); + A5O_DEBUG("unlocking display event source"); _al_event_source_unlock(&d->es); } @@ -453,25 +453,25 @@ JNI_FUNC(void, AllegroActivity, nativeSendJoystickConfigurationEvent, (JNIEnv *e return; } - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); _al_event_source_lock(es); - ALLEGRO_EVENT event; - event.type = ALLEGRO_EVENT_JOYSTICK_CONFIGURATION; + A5O_EVENT event; + event.type = A5O_EVENT_JOYSTICK_CONFIGURATION; _al_event_source_emit_event(es, &event); _al_event_source_unlock(es); } -/* NOTE: don't put any ALLEGRO_DEBUG in here! */ +/* NOTE: don't put any A5O_DEBUG in here! */ static void finish_activity(JNIEnv *env) { _jni_callVoidMethod(env, system_data.activity_object, "postFinish"); } -static ALLEGRO_SYSTEM *android_initialize(int flags) +static A5O_SYSTEM *android_initialize(int flags) { (void)flags; - ALLEGRO_DEBUG("android_initialize"); + A5O_DEBUG("android_initialize"); /* This was stored before user main ran, to make it easy and accessible * the same way for all threads, we set it in tls @@ -481,7 +481,7 @@ static ALLEGRO_SYSTEM *android_initialize(int flags) return &system_data.system->system; } -static ALLEGRO_JOYSTICK_DRIVER *android_get_joystick_driver(void) +static A5O_JOYSTICK_DRIVER *android_get_joystick_driver(void) { return &_al_android_joystick_driver; } @@ -491,7 +491,7 @@ static int android_get_num_video_adapters(void) return 1; } -static bool android_get_monitor_info(int adapter, ALLEGRO_MONITOR_INFO *info) +static bool android_get_monitor_info(int adapter, A5O_MONITOR_INFO *info) { if (adapter >= android_get_num_video_adapters()) return false; @@ -504,7 +504,7 @@ static bool android_get_monitor_info(int adapter, ALLEGRO_MONITOR_INFO *info) info->x2 = _jni_callIntMethod(env, rect, "width"); info->y2 = _jni_callIntMethod(env, rect, "height"); - ALLEGRO_DEBUG("Monitor Info: %d:%d", info->x2, info->y2); + A5O_DEBUG("Monitor Info: %d:%d", info->x2, info->y2); _jni_callv(env, DeleteLocalRef, rect); @@ -513,11 +513,11 @@ static bool android_get_monitor_info(int adapter, ALLEGRO_MONITOR_INFO *info) static void android_shutdown_system(void) { - ALLEGRO_SYSTEM *s = al_get_system_driver(); + A5O_SYSTEM *s = al_get_system_driver(); /* Close all open displays. */ while (_al_vector_size(&s->displays) > 0) { - ALLEGRO_DISPLAY **dptr = _al_vector_ref(&s->displays, 0); - ALLEGRO_DISPLAY *d = *dptr; + A5O_DISPLAY **dptr = _al_vector_ref(&s->displays, 0); + A5O_DISPLAY *d = *dptr; al_destroy_display(d); } _al_vector_free(&s->displays); @@ -528,9 +528,9 @@ static bool android_inhibit_screensaver(bool inhibit) return _jni_callBooleanMethodV(_al_android_get_jnienv(), system_data.activity_object, "inhibitScreenLock", "(Z)Z", inhibit); } -static ALLEGRO_SYSTEM_INTERFACE *android_vt; +static A5O_SYSTEM_INTERFACE *android_vt; -ALLEGRO_SYSTEM_INTERFACE *_al_system_android_interface() +A5O_SYSTEM_INTERFACE *_al_system_android_interface() { if(android_vt) return android_vt; @@ -538,7 +538,7 @@ ALLEGRO_SYSTEM_INTERFACE *_al_system_android_interface() android_vt = al_malloc(sizeof *android_vt); memset(android_vt, 0, sizeof *android_vt); - android_vt->id = ALLEGRO_SYSTEM_ID_ANDROID; + android_vt->id = A5O_SYSTEM_ID_ANDROID; android_vt->initialize = android_initialize; android_vt->get_display_driver = _al_get_android_display_driver; android_vt->get_keyboard_driver = _al_get_android_keyboard_driver; @@ -557,30 +557,30 @@ ALLEGRO_SYSTEM_INTERFACE *_al_system_android_interface() return android_vt; } -ALLEGRO_PATH *_al_android_get_path(int id) +A5O_PATH *_al_android_get_path(int id) { - ALLEGRO_PATH *path = NULL; + A5O_PATH *path = NULL; switch(id) { - case ALLEGRO_RESOURCES_PATH: + case A5O_RESOURCES_PATH: /* path to bundle's files */ path = al_create_path_for_directory(al_cstr(system_data.resources_dir)); break; - case ALLEGRO_TEMP_PATH: + case A5O_TEMP_PATH: /* path to the application cache */ path = al_create_path_for_directory(al_cstr(system_data.temp_dir)); break; - case ALLEGRO_USER_DATA_PATH: - case ALLEGRO_USER_HOME_PATH: - case ALLEGRO_USER_SETTINGS_PATH: - case ALLEGRO_USER_DOCUMENTS_PATH: + case A5O_USER_DATA_PATH: + case A5O_USER_HOME_PATH: + case A5O_USER_SETTINGS_PATH: + case A5O_USER_DOCUMENTS_PATH: /* path to sdcard */ path = al_create_path_for_directory(al_cstr(system_data.data_dir)); break; - case ALLEGRO_EXENAME_PATH: + case A5O_EXENAME_PATH: /* bundle path + bundle name */ // FIXME! path = al_create_path(al_cstr(system_data.apk_path)); @@ -597,7 +597,7 @@ ALLEGRO_PATH *_al_android_get_path(int id) static const char *_real_al_android_get_os_version(JNIEnv *env) { static char buffer[25]; - ALLEGRO_USTR *s = _jni_callStringMethod(env, system_data.activity_object, "getOsVersion", "()Ljava/lang/String;"); + A5O_USTR *s = _jni_callStringMethod(env, system_data.activity_object, "getOsVersion", "()Ljava/lang/String;"); strncpy(buffer, al_cstr(s), 25); al_ustr_free(s); return buffer; @@ -618,7 +618,7 @@ void _al_android_thread_created(void) /* This function runs once before al_init, so before TLS is initialized * so we save the environment and set it later in that case. */ - ALLEGRO_SYSTEM *s = al_get_system_driver(); + A5O_SYSTEM *s = al_get_system_driver(); if (s && s->installed) { _al_android_set_jnienv(env); } @@ -632,9 +632,9 @@ void _al_android_thread_ended(void) (*javavm)->DetachCurrentThread(javavm); } -void _al_android_set_capture_volume_keys(ALLEGRO_DISPLAY *display, bool onoff) +void _al_android_set_capture_volume_keys(A5O_DISPLAY *display, bool onoff) { - ALLEGRO_DISPLAY_ANDROID *d = (ALLEGRO_DISPLAY_ANDROID *)display; + A5O_DISPLAY_ANDROID *d = (A5O_DISPLAY_ANDROID *)display; _jni_callVoidMethodV(_al_android_get_jnienv(), d->surface_object, "setCaptureVolumeKeys", "(Z)V", onoff); } @@ -642,7 +642,7 @@ void _al_android_set_capture_volume_keys(ALLEGRO_DISPLAY *display, bool onoff) void _al_register_system_interfaces(void) { - ALLEGRO_SYSTEM_INTERFACE **add; + A5O_SYSTEM_INTERFACE **add; /* add the native activity driver */ add = _al_vector_alloc_back(&_al_system_interfaces); diff --git a/src/android/android_touch.c b/src/android/android_touch.c index 5c17345c15..4d9fbc7e70 100644 --- a/src/android/android_touch.c +++ b/src/android/android_touch.c @@ -22,17 +22,17 @@ #include "allegro5/internal/aintern_display.h" #include "allegro5/internal/aintern_touch_input.h" -ALLEGRO_DEBUG_CHANNEL("android") +A5O_DEBUG_CHANNEL("android") /* forward declaration */ static void android_touch_input_handle_cancel(int id, double timestamp, - float x, float y, bool primary, ALLEGRO_DISPLAY *disp); + float x, float y, bool primary, A5O_DISPLAY *disp); -static ALLEGRO_TOUCH_INPUT_STATE touch_input_state; -static ALLEGRO_MOUSE_STATE mouse_state; -static ALLEGRO_TOUCH_INPUT touch_input; +static A5O_TOUCH_INPUT_STATE touch_input_state; +static A5O_MOUSE_STATE mouse_state; +static A5O_TOUCH_INPUT touch_input; static bool installed = false; @@ -40,7 +40,7 @@ static void reset_touch_input_state(void) { int i; - for (i = 0; i < ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT; i++) { + for (i = 0; i < A5O_TOUCH_INPUT_MAX_TOUCH_COUNT; i++) { touch_input_state.touches[i].id = -1; } } @@ -48,25 +48,25 @@ static void reset_touch_input_state(void) static void generate_touch_input_event(unsigned int type, double timestamp, int id, float x, float y, float dx, float dy, bool primary, - ALLEGRO_DISPLAY *disp) + A5O_DISPLAY *disp) { - ALLEGRO_EVENT event; + A5O_EVENT event; bool want_touch_event = _al_event_source_needs_to_generate_event(&touch_input.es); bool want_mouse_emulation_event; - if (touch_input.mouse_emulation_mode == ALLEGRO_MOUSE_EMULATION_5_0_x) { + if (touch_input.mouse_emulation_mode == A5O_MOUSE_EMULATION_5_0_x) { want_mouse_emulation_event = _al_event_source_needs_to_generate_event(&touch_input.mouse_emulation_es) && al_is_mouse_installed(); } else { want_mouse_emulation_event = _al_event_source_needs_to_generate_event(&touch_input.mouse_emulation_es) && primary && al_is_mouse_installed(); } - if (touch_input.mouse_emulation_mode == ALLEGRO_MOUSE_EMULATION_NONE) + if (touch_input.mouse_emulation_mode == A5O_MOUSE_EMULATION_NONE) want_mouse_emulation_event = false; - else if (touch_input.mouse_emulation_mode == ALLEGRO_MOUSE_EMULATION_INCLUSIVE) + else if (touch_input.mouse_emulation_mode == A5O_MOUSE_EMULATION_INCLUSIVE) want_touch_event = al_is_mouse_installed() ? (want_touch_event && !primary) : want_touch_event; - else if (touch_input.mouse_emulation_mode == ALLEGRO_MOUSE_EMULATION_EXCLUSIVE) + else if (touch_input.mouse_emulation_mode == A5O_MOUSE_EMULATION_EXCLUSIVE) want_touch_event = al_is_mouse_installed() ? false : want_touch_event; @@ -76,7 +76,7 @@ static void generate_touch_input_event(unsigned int type, double timestamp, if (want_touch_event) { event.touch.type = type; - event.touch.display = (ALLEGRO_DISPLAY*)disp; + event.touch.display = (A5O_DISPLAY*)disp; event.touch.timestamp = timestamp; event.touch.id = id; event.touch.x = x; @@ -90,12 +90,12 @@ static void generate_touch_input_event(unsigned int type, double timestamp, _al_event_source_unlock(&touch_input.es); } - if (touch_input.mouse_emulation_mode != ALLEGRO_MOUSE_EMULATION_NONE) { + if (touch_input.mouse_emulation_mode != A5O_MOUSE_EMULATION_NONE) { mouse_state.x = (int)x; mouse_state.y = (int)y; - if (type == ALLEGRO_EVENT_TOUCH_BEGIN) + if (type == A5O_EVENT_TOUCH_BEGIN) mouse_state.buttons++; - else if (type == ALLEGRO_EVENT_TOUCH_END) + else if (type == A5O_EVENT_TOUCH_END) mouse_state.buttons--; mouse_state.pressure = mouse_state.buttons ? 1.0 : 0.0; /* TODO */ @@ -104,22 +104,22 @@ static void generate_touch_input_event(unsigned int type, double timestamp, if (want_mouse_emulation_event) { switch (type) { - case ALLEGRO_EVENT_TOUCH_BEGIN: type = ALLEGRO_EVENT_MOUSE_BUTTON_DOWN; break; - case ALLEGRO_EVENT_TOUCH_CANCEL: - case ALLEGRO_EVENT_TOUCH_END: type = ALLEGRO_EVENT_MOUSE_BUTTON_UP; break; - case ALLEGRO_EVENT_TOUCH_MOVE: type = ALLEGRO_EVENT_MOUSE_AXES; break; + case A5O_EVENT_TOUCH_BEGIN: type = A5O_EVENT_MOUSE_BUTTON_DOWN; break; + case A5O_EVENT_TOUCH_CANCEL: + case A5O_EVENT_TOUCH_END: type = A5O_EVENT_MOUSE_BUTTON_UP; break; + case A5O_EVENT_TOUCH_MOVE: type = A5O_EVENT_MOUSE_AXES; break; } event.mouse.type = type; event.mouse.timestamp = timestamp; - event.mouse.display = (ALLEGRO_DISPLAY*)disp; + event.mouse.display = (A5O_DISPLAY*)disp; event.mouse.x = (int)x; event.mouse.y = (int)y; event.mouse.dx = (int)dx; event.mouse.dy = (int)dy; event.mouse.dz = 0; event.mouse.dw = 0; - if (touch_input.mouse_emulation_mode != ALLEGRO_MOUSE_EMULATION_5_0_x) { + if (touch_input.mouse_emulation_mode != A5O_MOUSE_EMULATION_5_0_x) { event.mouse.button = 1; } else { @@ -127,7 +127,7 @@ static void generate_touch_input_event(unsigned int type, double timestamp, } event.mouse.pressure = mouse_state.pressure; - if (touch_input.mouse_emulation_mode != ALLEGRO_MOUSE_EMULATION_5_0_x) { + if (touch_input.mouse_emulation_mode != A5O_MOUSE_EMULATION_5_0_x) { al_set_mouse_xy(event.mouse.display, event.mouse.x, event.mouse.y); } @@ -148,7 +148,7 @@ static bool init_touch_input(void) _al_event_source_init(&touch_input.es); _al_event_source_init(&touch_input.mouse_emulation_es); - touch_input.mouse_emulation_mode = ALLEGRO_MOUSE_EMULATION_TRANSPARENT; + touch_input.mouse_emulation_mode = A5O_MOUSE_EMULATION_TRANSPARENT; installed = true; @@ -171,13 +171,13 @@ static void exit_touch_input(void) } -static ALLEGRO_TOUCH_INPUT* get_touch_input(void) +static A5O_TOUCH_INPUT* get_touch_input(void) { return &touch_input; } -static void get_touch_input_state(ALLEGRO_TOUCH_INPUT_STATE *ret_state) +static void get_touch_input_state(A5O_TOUCH_INPUT_STATE *ret_state) { _al_event_source_lock(&touch_input.es); *ret_state = touch_input_state; @@ -191,9 +191,9 @@ static void set_mouse_emulation_mode(int mode) int i; - for (i = 0; i < ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) { + for (i = 0; i < A5O_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) { - ALLEGRO_TOUCH_STATE* touch = touch_input_state.touches + i; + A5O_TOUCH_STATE* touch = touch_input_state.touches + i; if (touch->id > 0) { android_touch_input_handle_cancel(touch->id, al_get_time(), @@ -206,11 +206,11 @@ static void set_mouse_emulation_mode(int mode) } -static ALLEGRO_TOUCH_STATE* find_free_touch_state(void) +static A5O_TOUCH_STATE* find_free_touch_state(void) { int i; - for (i = 0; i < ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) + for (i = 0; i < A5O_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) if (touch_input_state.touches[i].id < 0) return touch_input_state.touches + i; @@ -218,11 +218,11 @@ static ALLEGRO_TOUCH_STATE* find_free_touch_state(void) } -static ALLEGRO_TOUCH_STATE* find_touch_state_with_id(int id) +static A5O_TOUCH_STATE* find_touch_state_with_id(int id) { int i; - for (i = 0; i < ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) + for (i = 0; i < A5O_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) if (touch_input_state.touches[i].id == id) return touch_input_state.touches + i; @@ -231,9 +231,9 @@ static ALLEGRO_TOUCH_STATE* find_touch_state_with_id(int id) static void android_touch_input_handle_begin(int id, double timestamp, - float x, float y, bool primary, ALLEGRO_DISPLAY *disp) + float x, float y, bool primary, A5O_DISPLAY *disp) { - ALLEGRO_TOUCH_STATE* state = find_free_touch_state(); + A5O_TOUCH_STATE* state = find_free_touch_state(); (void)primary; if (NULL == state) @@ -249,16 +249,16 @@ static void android_touch_input_handle_begin(int id, double timestamp, state->display = disp; _al_event_source_unlock(&touch_input.es); - generate_touch_input_event(ALLEGRO_EVENT_TOUCH_BEGIN, timestamp, + generate_touch_input_event(A5O_EVENT_TOUCH_BEGIN, timestamp, state->id, state->x, state->y, state->dx, state->dy, state->primary, disp); } static void android_touch_input_handle_end(int id, double timestamp, - float x, float y, bool primary, ALLEGRO_DISPLAY *disp) + float x, float y, bool primary, A5O_DISPLAY *disp) { - ALLEGRO_TOUCH_STATE* state = find_touch_state_with_id(id); + A5O_TOUCH_STATE* state = find_touch_state_with_id(id); (void)primary; if (NULL == state) @@ -271,7 +271,7 @@ static void android_touch_input_handle_end(int id, double timestamp, state->y = y; _al_event_source_unlock(&touch_input.es); - generate_touch_input_event(ALLEGRO_EVENT_TOUCH_END, timestamp, + generate_touch_input_event(A5O_EVENT_TOUCH_END, timestamp, state->id, state->x, state->y, state->dx, state->dy, state->primary, disp); @@ -282,9 +282,9 @@ static void android_touch_input_handle_end(int id, double timestamp, static void android_touch_input_handle_move(int id, double timestamp, - float x, float y, bool primary, ALLEGRO_DISPLAY *disp) + float x, float y, bool primary, A5O_DISPLAY *disp) { - ALLEGRO_TOUCH_STATE* state = find_touch_state_with_id(id); + A5O_TOUCH_STATE* state = find_touch_state_with_id(id); (void)primary; if (NULL == state) @@ -297,16 +297,16 @@ static void android_touch_input_handle_move(int id, double timestamp, state->y = y; _al_event_source_unlock(&touch_input.es); - generate_touch_input_event(ALLEGRO_EVENT_TOUCH_MOVE, timestamp, + generate_touch_input_event(A5O_EVENT_TOUCH_MOVE, timestamp, state->id, state->x, state->y, state->dx, state->dy, state->primary, disp); } static void android_touch_input_handle_cancel(int id, double timestamp, - float x, float y, bool primary, ALLEGRO_DISPLAY *disp) + float x, float y, bool primary, A5O_DISPLAY *disp) { - ALLEGRO_TOUCH_STATE* state = find_touch_state_with_id(id); + A5O_TOUCH_STATE* state = find_touch_state_with_id(id); (void)primary; if (NULL == state) @@ -319,7 +319,7 @@ static void android_touch_input_handle_cancel(int id, double timestamp, state->y = y; _al_event_source_unlock(&touch_input.es); - generate_touch_input_event(ALLEGRO_EVENT_TOUCH_CANCEL, timestamp, + generate_touch_input_event(A5O_EVENT_TOUCH_CANCEL, timestamp, state->id, state->x, state->y, state->dx, state->dy, state->primary, disp); _al_event_source_lock(&touch_input.es); @@ -334,36 +334,36 @@ JNI_FUNC(void, TouchListener, nativeOnTouch, (JNIEnv *env, jobject obj, (void)env; (void)obj; - ALLEGRO_SYSTEM *system = al_get_system_driver(); + A5O_SYSTEM *system = al_get_system_driver(); ASSERT(system != NULL); - ALLEGRO_DISPLAY **dptr = _al_vector_ref(&system->displays, 0); - ALLEGRO_DISPLAY *display = *dptr; + A5O_DISPLAY **dptr = _al_vector_ref(&system->displays, 0); + A5O_DISPLAY *display = *dptr; ASSERT(display != NULL); switch (action) { - case ALLEGRO_EVENT_TOUCH_BEGIN: + case A5O_EVENT_TOUCH_BEGIN: android_touch_input_handle_begin(id, al_get_time(), x, y, primary, display); break; - case ALLEGRO_EVENT_TOUCH_END: + case A5O_EVENT_TOUCH_END: android_touch_input_handle_end(id, al_get_time(), x, y, primary, display); break; - case ALLEGRO_EVENT_TOUCH_MOVE: + case A5O_EVENT_TOUCH_MOVE: android_touch_input_handle_move(id, al_get_time(), x, y, primary, display); break; - case ALLEGRO_EVENT_TOUCH_CANCEL: + case A5O_EVENT_TOUCH_CANCEL: android_touch_input_handle_cancel(id, al_get_time(), x, y, primary, display); break; default: - ALLEGRO_ERROR("unknown touch action: %i", action); + A5O_ERROR("unknown touch action: %i", action); break; } } @@ -372,7 +372,7 @@ JNI_FUNC(void, TouchListener, nativeOnTouch, (JNIEnv *env, jobject obj, /* the driver vtable */ #define TOUCH_INPUT_ANDROID AL_ID('A','T','I','D') -static ALLEGRO_TOUCH_INPUT_DRIVER touch_input_driver = +static A5O_TOUCH_INPUT_DRIVER touch_input_driver = { TOUCH_INPUT_ANDROID, init_touch_input, @@ -384,13 +384,13 @@ static ALLEGRO_TOUCH_INPUT_DRIVER touch_input_driver = }; -ALLEGRO_TOUCH_INPUT_DRIVER *_al_get_android_touch_input_driver(void) +A5O_TOUCH_INPUT_DRIVER *_al_get_android_touch_input_driver(void) { return &touch_input_driver; } -void _al_android_mouse_get_state(ALLEGRO_MOUSE_STATE *ret_state) +void _al_android_mouse_get_state(A5O_MOUSE_STATE *ret_state) { _al_event_source_lock(&touch_input.es); *ret_state = mouse_state; diff --git a/src/android/jni_helpers.c b/src/android/jni_helpers.c index 453dac57e5..636c44ba07 100644 --- a/src/android/jni_helpers.c +++ b/src/android/jni_helpers.c @@ -19,7 +19,7 @@ #include #include -ALLEGRO_DEBUG_CHANNEL("jni") +A5O_DEBUG_CHANNEL("jni") #define VERBOSE_DEBUG(a, ...) (void)0 @@ -31,7 +31,7 @@ void __jni_checkException(JNIEnv *env, const char *file, const char *func, int l exc = (*env)->ExceptionOccurred(env); if (exc) { - ALLEGRO_DEBUG("GOT AN EXCEPTION @ %s:%i %s", file, line, func); + A5O_DEBUG("GOT AN EXCEPTION @ %s:%i %s", file, line, func); /* We don't do much with the exception, except that we print a debug message for it, clear it, and throw a new exception. */ @@ -76,7 +76,7 @@ jobject _jni_callObjectMethodV(JNIEnv *env, jobject object, return ret; } -ALLEGRO_USTR *_jni_getString(JNIEnv *env, jstring str_obj) +A5O_USTR *_jni_getString(JNIEnv *env, jstring str_obj) { VERBOSE_DEBUG("GetStringUTFLength"); jsize len = _jni_call(env, jsize, GetStringUTFLength, str_obj); @@ -84,18 +84,18 @@ ALLEGRO_USTR *_jni_getString(JNIEnv *env, jstring str_obj) const char *str = _jni_call(env, const char *, GetStringUTFChars, str_obj, NULL); VERBOSE_DEBUG("al_ustr_new_from_buffer"); - ALLEGRO_USTR *ustr = al_ustr_new_from_buffer(str, len); + A5O_USTR *ustr = al_ustr_new_from_buffer(str, len); _jni_callv(env, ReleaseStringUTFChars, str_obj, str); return ustr; } -ALLEGRO_USTR *_jni_callStringMethod(JNIEnv *env, jobject obj, +A5O_USTR *_jni_callStringMethod(JNIEnv *env, jobject obj, const char *name, const char *sig) { jstring str_obj = (jstring)_jni_callObjectMethod(env, obj, name, sig); - ALLEGRO_USTR *ustr = _jni_getString(env, str_obj); + A5O_USTR *ustr = _jni_getString(env, str_obj); _jni_callv(env, DeleteLocalRef, str_obj); diff --git a/src/bitmap.c b/src/bitmap.c index d13af1d994..0b71c98b42 100644 --- a/src/bitmap.c +++ b/src/bitmap.c @@ -28,15 +28,15 @@ #include "allegro5/internal/aintern_shader.h" #include "allegro5/internal/aintern_system.h" -ALLEGRO_DEBUG_CHANNEL("bitmap") +A5O_DEBUG_CHANNEL("bitmap") /* Creates a memory bitmap. */ -static ALLEGRO_BITMAP *create_memory_bitmap(ALLEGRO_DISPLAY *current_display, +static A5O_BITMAP *create_memory_bitmap(A5O_DISPLAY *current_display, int w, int h, int format, int flags) { - ALLEGRO_BITMAP *bitmap; + A5O_BITMAP *bitmap; int pitch; if (_al_pixel_format_is_video_only(format)) { @@ -56,8 +56,8 @@ static ALLEGRO_BITMAP *create_memory_bitmap(ALLEGRO_DISPLAY *current_display, /* If this is really a video bitmap, we add it to the list of to * be converted bitmaps. */ - bitmap->_flags = flags | ALLEGRO_MEMORY_BITMAP; - bitmap->_flags &= ~ALLEGRO_VIDEO_BITMAP; + bitmap->_flags = flags | A5O_MEMORY_BITMAP; + bitmap->_flags &= ~A5O_VIDEO_BITMAP; bitmap->w = w; bitmap->h = h; bitmap->pitch = pitch; @@ -84,7 +84,7 @@ static ALLEGRO_BITMAP *create_memory_bitmap(ALLEGRO_DISPLAY *current_display, -static void destroy_memory_bitmap(ALLEGRO_BITMAP *bmp) +static void destroy_memory_bitmap(A5O_BITMAP *bmp) { _al_unregister_convert_bitmap(bmp); @@ -95,12 +95,12 @@ static void destroy_memory_bitmap(ALLEGRO_BITMAP *bmp) -ALLEGRO_BITMAP *_al_create_bitmap_params(ALLEGRO_DISPLAY *current_display, +A5O_BITMAP *_al_create_bitmap_params(A5O_DISPLAY *current_display, int w, int h, int format, int flags, int depth, int samples) { - ALLEGRO_SYSTEM *system = al_get_system_driver(); - ALLEGRO_BITMAP *bitmap; - ALLEGRO_BITMAP **back; + A5O_SYSTEM *system = al_get_system_driver(); + A5O_BITMAP *bitmap; + A5O_BITMAP **back; bool result; /* Reject bitmaps with negative dimensions. * Also reject bitmaps where a calculation pixel_size*w*h would overflow @@ -108,17 +108,17 @@ ALLEGRO_BITMAP *_al_create_bitmap_params(ALLEGRO_DISPLAY *current_display, * Overflow calc based on https://stackoverflow.com/a/1514309/231929 */ if (w < 0 || h < 0 || (h > 0 && (int64_t) w > (INT_MAX/4) / (int64_t) h)) { - ALLEGRO_WARN("Rejecting %dx%d bitmap\n", w, h); + A5O_WARN("Rejecting %dx%d bitmap\n", w, h); return NULL; } - if ((flags & ALLEGRO_MEMORY_BITMAP) || + if ((flags & A5O_MEMORY_BITMAP) || !current_display || !current_display->vt || current_display->vt->create_bitmap == NULL || _al_vector_size(&system->displays) < 1) { - if (flags & ALLEGRO_VIDEO_BITMAP) + if (flags & A5O_VIDEO_BITMAP) return NULL; return create_memory_bitmap(current_display, w, h, format, flags); @@ -129,7 +129,7 @@ ALLEGRO_BITMAP *_al_create_bitmap_params(ALLEGRO_DISPLAY *current_display, bitmap = current_display->vt->create_bitmap(current_display, w, h, format, flags); if (!bitmap) { - ALLEGRO_ERROR("failed to create display bitmap\n"); + A5O_ERROR("failed to create display bitmap\n"); return NULL; } @@ -149,8 +149,8 @@ ALLEGRO_BITMAP *_al_create_bitmap_params(ALLEGRO_DISPLAY *current_display, bitmap->parent = NULL; bitmap->xofs = 0; bitmap->yofs = 0; - bitmap->_flags |= ALLEGRO_VIDEO_BITMAP; - bitmap->dirty = !(bitmap->_flags & ALLEGRO_NO_PRESERVE_TEXTURE); + bitmap->_flags |= A5O_VIDEO_BITMAP; + bitmap->dirty = !(bitmap->_flags & A5O_NO_PRESERVE_TEXTURE); bitmap->_depth = depth; bitmap->_samples = samples; bitmap->use_bitmap_blender = false; @@ -166,9 +166,9 @@ ALLEGRO_BITMAP *_al_create_bitmap_params(ALLEGRO_DISPLAY *current_display, if (!result) { al_destroy_bitmap(bitmap); - if (flags & ALLEGRO_VIDEO_BITMAP) + if (flags & A5O_VIDEO_BITMAP) return NULL; - /* With ALLEGRO_CONVERT_BITMAP, just use a memory bitmap instead if + /* With A5O_CONVERT_BITMAP, just use a memory bitmap instead if * video failed. */ return create_memory_bitmap(current_display, w, h, format, flags); @@ -185,9 +185,9 @@ ALLEGRO_BITMAP *_al_create_bitmap_params(ALLEGRO_DISPLAY *current_display, /* Function: al_create_bitmap */ -ALLEGRO_BITMAP *al_create_bitmap(int w, int h) +A5O_BITMAP *al_create_bitmap(int w, int h) { - ALLEGRO_BITMAP *bitmap; + A5O_BITMAP *bitmap; bitmap = _al_create_bitmap_params(al_get_current_display(), w, h, al_get_new_bitmap_format(), al_get_new_bitmap_flags(), @@ -203,7 +203,7 @@ ALLEGRO_BITMAP *al_create_bitmap(int w, int h) /* Function: al_destroy_bitmap */ -void al_destroy_bitmap(ALLEGRO_BITMAP *bitmap) +void al_destroy_bitmap(A5O_BITMAP *bitmap) { if (!bitmap) { return; @@ -213,7 +213,7 @@ void al_destroy_bitmap(ALLEGRO_BITMAP *bitmap) * before it is destroyed, but maintain the current display. */ if (bitmap == al_get_target_bitmap()) { - ALLEGRO_DISPLAY *display = al_get_current_display(); + A5O_DISPLAY *display = al_get_current_display(); if (display) al_set_target_bitmap(al_get_backbuffer(display)); else @@ -225,8 +225,8 @@ void al_destroy_bitmap(ALLEGRO_BITMAP *bitmap) _al_unregister_destructor(_al_dtor_list, bitmap->dtor_item); if (!al_is_sub_bitmap(bitmap)) { - ALLEGRO_DISPLAY* disp = _al_get_bitmap_display(bitmap); - if (al_get_bitmap_flags(bitmap) & ALLEGRO_MEMORY_BITMAP) { + A5O_DISPLAY* disp = _al_get_bitmap_display(bitmap); + if (al_get_bitmap_flags(bitmap) & A5O_MEMORY_BITMAP) { destroy_memory_bitmap(bitmap); return; } @@ -252,20 +252,20 @@ void al_destroy_bitmap(ALLEGRO_BITMAP *bitmap) /* Function: al_convert_mask_to_alpha */ -void al_convert_mask_to_alpha(ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR mask_color) +void al_convert_mask_to_alpha(A5O_BITMAP *bitmap, A5O_COLOR mask_color) { - ALLEGRO_LOCKED_REGION *lr; + A5O_LOCKED_REGION *lr; int x, y; - ALLEGRO_COLOR pixel; - ALLEGRO_COLOR alpha_pixel; - ALLEGRO_STATE state; + A5O_COLOR pixel; + A5O_COLOR alpha_pixel; + A5O_STATE state; - if (!(lr = al_lock_bitmap(bitmap, ALLEGRO_PIXEL_FORMAT_ANY, 0))) { - ALLEGRO_ERROR("Couldn't lock bitmap."); + if (!(lr = al_lock_bitmap(bitmap, A5O_PIXEL_FORMAT_ANY, 0))) { + A5O_ERROR("Couldn't lock bitmap."); return; } - al_store_state(&state, ALLEGRO_STATE_TARGET_BITMAP); + al_store_state(&state, A5O_STATE_TARGET_BITMAP); al_set_target_bitmap(bitmap); alpha_pixel = al_map_rgba(0, 0, 0, 0); @@ -273,7 +273,7 @@ void al_convert_mask_to_alpha(ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR mask_color) for (y = 0; y < bitmap->h; y++) { for (x = 0; x < bitmap->w; x++) { pixel = al_get_pixel(bitmap, x, y); - if (memcmp(&pixel, &mask_color, sizeof(ALLEGRO_COLOR)) == 0) { + if (memcmp(&pixel, &mask_color, sizeof(A5O_COLOR)) == 0) { al_put_pixel(x, y, alpha_pixel); } } @@ -288,7 +288,7 @@ void al_convert_mask_to_alpha(ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR mask_color) /* Function: al_get_bitmap_width */ -int al_get_bitmap_width(ALLEGRO_BITMAP *bitmap) +int al_get_bitmap_width(A5O_BITMAP *bitmap) { return bitmap->w; } @@ -297,7 +297,7 @@ int al_get_bitmap_width(ALLEGRO_BITMAP *bitmap) /* Function: al_get_bitmap_height */ -int al_get_bitmap_height(ALLEGRO_BITMAP *bitmap) +int al_get_bitmap_height(A5O_BITMAP *bitmap) { return bitmap->h; } @@ -306,7 +306,7 @@ int al_get_bitmap_height(ALLEGRO_BITMAP *bitmap) /* Function: al_get_bitmap_format */ -int al_get_bitmap_format(ALLEGRO_BITMAP *bitmap) +int al_get_bitmap_format(A5O_BITMAP *bitmap) { if (bitmap->parent) return bitmap->parent->_format; @@ -315,7 +315,7 @@ int al_get_bitmap_format(ALLEGRO_BITMAP *bitmap) } -int _al_get_bitmap_memory_format(ALLEGRO_BITMAP *bitmap) +int _al_get_bitmap_memory_format(A5O_BITMAP *bitmap) { if (bitmap->parent) return bitmap->parent->_memory_format; @@ -327,7 +327,7 @@ int _al_get_bitmap_memory_format(ALLEGRO_BITMAP *bitmap) /* Function: al_get_bitmap_flags */ -int al_get_bitmap_flags(ALLEGRO_BITMAP *bitmap) +int al_get_bitmap_flags(A5O_BITMAP *bitmap) { if (bitmap->parent) return bitmap->parent->_flags; @@ -336,7 +336,7 @@ int al_get_bitmap_flags(ALLEGRO_BITMAP *bitmap) } -ALLEGRO_DISPLAY *_al_get_bitmap_display(ALLEGRO_BITMAP *bitmap) +A5O_DISPLAY *_al_get_bitmap_display(A5O_BITMAP *bitmap) { if (bitmap->parent) return bitmap->parent->_display; @@ -347,7 +347,7 @@ ALLEGRO_DISPLAY *_al_get_bitmap_display(ALLEGRO_BITMAP *bitmap) /* Function: al_get_bitmap_depth */ -int al_get_bitmap_depth(ALLEGRO_BITMAP *bitmap) +int al_get_bitmap_depth(A5O_BITMAP *bitmap) { if (bitmap->parent) return bitmap->parent->_depth; @@ -358,7 +358,7 @@ int al_get_bitmap_depth(ALLEGRO_BITMAP *bitmap) /* Function: al_get_bitmap_samples */ -int al_get_bitmap_samples(ALLEGRO_BITMAP *bitmap) +int al_get_bitmap_samples(A5O_BITMAP *bitmap) { if (bitmap->parent) return bitmap->parent->_samples; @@ -368,10 +368,10 @@ int al_get_bitmap_samples(ALLEGRO_BITMAP *bitmap) /* Function: al_get_bitmap_blend_color */ -ALLEGRO_COLOR al_get_bitmap_blend_color(void) +A5O_COLOR al_get_bitmap_blend_color(void) { - ALLEGRO_BITMAP *bitmap = al_get_target_bitmap(); - ALLEGRO_BLENDER *b; + A5O_BITMAP *bitmap = al_get_target_bitmap(); + A5O_BLENDER *b; ASSERT(bitmap); @@ -395,8 +395,8 @@ void al_get_bitmap_blender(int *op, int *src, int *dst) */ void al_get_separate_bitmap_blender(int *op, int *src, int *dst, int *alpha_op, int *alpha_src, int *alpha_dst) { - ALLEGRO_BITMAP *bitmap = al_get_target_bitmap(); - ALLEGRO_BLENDER *b; + A5O_BITMAP *bitmap = al_get_target_bitmap(); + A5O_BLENDER *b; ASSERT(bitmap); @@ -429,10 +429,10 @@ void al_get_separate_bitmap_blender(int *op, int *src, int *dst, int *alpha_op, /* Function: al_set_bitmap_blend_color */ -void al_set_bitmap_blend_color(ALLEGRO_COLOR col) +void al_set_bitmap_blend_color(A5O_COLOR col) { - ALLEGRO_BITMAP *bitmap = al_get_target_bitmap(); - ALLEGRO_BLENDER *b; + A5O_BITMAP *bitmap = al_get_target_bitmap(); + A5O_BLENDER *b; ASSERT(bitmap); @@ -444,7 +444,7 @@ void al_set_bitmap_blend_color(ALLEGRO_COLOR col) */ void al_set_bitmap_blender(int op, int src, int dest) { - ALLEGRO_BITMAP *bitmap = al_get_target_bitmap(); + A5O_BITMAP *bitmap = al_get_target_bitmap(); ASSERT(bitmap); @@ -455,8 +455,8 @@ void al_set_bitmap_blender(int op, int src, int dest) */ void al_set_separate_bitmap_blender(int op, int src, int dst, int alpha_op, int alpha_src, int alpha_dst) { - ALLEGRO_BITMAP *bitmap = al_get_target_bitmap(); - ALLEGRO_BLENDER *b; + A5O_BITMAP *bitmap = al_get_target_bitmap(); + A5O_BLENDER *b; ASSERT(bitmap); @@ -474,7 +474,7 @@ void al_set_separate_bitmap_blender(int op, int src, int dst, int alpha_op, int */ void al_reset_bitmap_blender(void) { - ALLEGRO_BITMAP *bitmap = al_get_target_bitmap(); + A5O_BITMAP *bitmap = al_get_target_bitmap(); ASSERT(bitmap); @@ -486,7 +486,7 @@ void al_reset_bitmap_blender(void) */ void al_set_clipping_rectangle(int x, int y, int width, int height) { - ALLEGRO_BITMAP *bitmap = al_get_target_bitmap(); + A5O_BITMAP *bitmap = al_get_target_bitmap(); ASSERT(bitmap); @@ -527,7 +527,7 @@ void al_set_clipping_rectangle(int x, int y, int width, int height) */ void al_reset_clipping_rectangle(void) { - ALLEGRO_BITMAP *bitmap = al_get_target_bitmap(); + A5O_BITMAP *bitmap = al_get_target_bitmap(); if (bitmap) { int w = al_get_bitmap_width(bitmap); @@ -542,7 +542,7 @@ void al_reset_clipping_rectangle(void) */ void al_get_clipping_rectangle(int *x, int *y, int *w, int *h) { - ALLEGRO_BITMAP *bitmap = al_get_target_bitmap(); + A5O_BITMAP *bitmap = al_get_target_bitmap(); ASSERT(bitmap); @@ -556,10 +556,10 @@ void al_get_clipping_rectangle(int *x, int *y, int *w, int *h) /* Function: al_create_sub_bitmap */ -ALLEGRO_BITMAP *al_create_sub_bitmap(ALLEGRO_BITMAP *parent, +A5O_BITMAP *al_create_sub_bitmap(A5O_BITMAP *parent, int x, int y, int w, int h) { - ALLEGRO_BITMAP *bitmap; + A5O_BITMAP *bitmap; if (parent->parent) { x += parent->xofs; @@ -575,7 +575,7 @@ ALLEGRO_BITMAP *al_create_sub_bitmap(ALLEGRO_BITMAP *parent, * directly. */ bitmap->_format = 0; bitmap->_flags = 0; - bitmap->_display = (ALLEGRO_DISPLAY*)0x1; + bitmap->_display = (A5O_DISPLAY*)0x1; bitmap->_wrap_u = 0; bitmap->_wrap_v = 0; @@ -605,7 +605,7 @@ ALLEGRO_BITMAP *al_create_sub_bitmap(ALLEGRO_BITMAP *parent, /* Function: al_reparent_bitmap */ -void al_reparent_bitmap(ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP *parent, +void al_reparent_bitmap(A5O_BITMAP *bitmap, A5O_BITMAP *parent, int x, int y, int w, int h) { ASSERT(bitmap->parent); @@ -630,7 +630,7 @@ void al_reparent_bitmap(ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP *parent, /* Function: al_is_sub_bitmap */ -bool al_is_sub_bitmap(ALLEGRO_BITMAP *bitmap) +bool al_is_sub_bitmap(A5O_BITMAP *bitmap) { return (bitmap->parent != NULL); } @@ -638,7 +638,7 @@ bool al_is_sub_bitmap(ALLEGRO_BITMAP *bitmap) /* Function: al_get_parent_bitmap */ -ALLEGRO_BITMAP *al_get_parent_bitmap(ALLEGRO_BITMAP *bitmap) +A5O_BITMAP *al_get_parent_bitmap(A5O_BITMAP *bitmap) { ASSERT(bitmap); return bitmap->parent; @@ -647,7 +647,7 @@ ALLEGRO_BITMAP *al_get_parent_bitmap(ALLEGRO_BITMAP *bitmap) /* Function: al_get_bitmap_x */ -int al_get_bitmap_x(ALLEGRO_BITMAP *bitmap) +int al_get_bitmap_x(A5O_BITMAP *bitmap) { ASSERT(bitmap); return bitmap->xofs; @@ -656,17 +656,17 @@ int al_get_bitmap_x(ALLEGRO_BITMAP *bitmap) /* Function: al_get_bitmap_y */ -int al_get_bitmap_y(ALLEGRO_BITMAP *bitmap) +int al_get_bitmap_y(A5O_BITMAP *bitmap) { ASSERT(bitmap); return bitmap->yofs; } -static bool transfer_bitmap_data(ALLEGRO_BITMAP *src, ALLEGRO_BITMAP *dst) +static bool transfer_bitmap_data(A5O_BITMAP *src, A5O_BITMAP *dst) { - ALLEGRO_LOCKED_REGION *dst_region; - ALLEGRO_LOCKED_REGION *src_region; + A5O_LOCKED_REGION *dst_region; + A5O_LOCKED_REGION *src_region; int src_format = al_get_bitmap_format(src); int dst_format = al_get_bitmap_format(dst); bool src_compressed = _al_pixel_format_is_compressed(src_format); @@ -677,19 +677,19 @@ static bool transfer_bitmap_data(ALLEGRO_BITMAP *src, ALLEGRO_BITMAP *dst) if (src_compressed && dst_compressed && src_format == dst_format) { int block_width = al_get_pixel_block_width(src_format); int block_height = al_get_pixel_block_height(src_format); - if (!(src_region = al_lock_bitmap_blocked(src, ALLEGRO_LOCK_READONLY))) + if (!(src_region = al_lock_bitmap_blocked(src, A5O_LOCK_READONLY))) return false; - if (!(dst_region = al_lock_bitmap_blocked(dst, ALLEGRO_LOCK_WRITEONLY))) { + if (!(dst_region = al_lock_bitmap_blocked(dst, A5O_LOCK_WRITEONLY))) { al_unlock_bitmap(src); return false; } copy_w = _al_get_least_multiple(copy_w, block_width); copy_h = _al_get_least_multiple(copy_h, block_height); - ALLEGRO_DEBUG("Taking fast clone path.\n"); + A5O_DEBUG("Taking fast clone path.\n"); } else { - int lock_format = ALLEGRO_PIXEL_FORMAT_ANY; + int lock_format = A5O_PIXEL_FORMAT_ANY; /* Go through a non-compressed intermediate */ if (src_compressed && !dst_compressed) { lock_format = dst_format; @@ -698,10 +698,10 @@ static bool transfer_bitmap_data(ALLEGRO_BITMAP *src, ALLEGRO_BITMAP *dst) lock_format = src_format; } - if (!(src_region = al_lock_bitmap(src, lock_format, ALLEGRO_LOCK_READONLY))) + if (!(src_region = al_lock_bitmap(src, lock_format, A5O_LOCK_READONLY))) return false; - if (!(dst_region = al_lock_bitmap(dst, lock_format, ALLEGRO_LOCK_WRITEONLY))) { + if (!(dst_region = al_lock_bitmap(dst, lock_format, A5O_LOCK_WRITEONLY))) { al_unlock_bitmap(src); return false; } @@ -790,9 +790,9 @@ void _al_convert_bitmap_data( /* Function: al_clone_bitmap */ -ALLEGRO_BITMAP *al_clone_bitmap(ALLEGRO_BITMAP *bitmap) +A5O_BITMAP *al_clone_bitmap(A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP *clone; + A5O_BITMAP *clone; ASSERT(bitmap); clone = al_create_bitmap(bitmap->w, bitmap->h); @@ -808,14 +808,14 @@ ALLEGRO_BITMAP *al_clone_bitmap(ALLEGRO_BITMAP *bitmap) /* Function: al_backup_dirty_bitmap */ -void al_backup_dirty_bitmap(ALLEGRO_BITMAP *bitmap) +void al_backup_dirty_bitmap(A5O_BITMAP *bitmap) { if (bitmap->vt && bitmap->vt->backup_dirty_bitmap) bitmap->vt->backup_dirty_bitmap(bitmap); } -void _al_get_bitmap_wrap(ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP_WRAP *wrap_u, ALLEGRO_BITMAP_WRAP *wrap_v) +void _al_get_bitmap_wrap(A5O_BITMAP *bitmap, A5O_BITMAP_WRAP *wrap_u, A5O_BITMAP_WRAP *wrap_v) { ASSERT(bitmap); ASSERT(wrap_u); diff --git a/src/bitmap_draw.c b/src/bitmap_draw.c index cd01dfd12d..d73f2127c3 100644 --- a/src/bitmap_draw.c +++ b/src/bitmap_draw.c @@ -21,26 +21,26 @@ #include "allegro5/internal/aintern_pixels.h" -static ALLEGRO_COLOR solid_white = {1, 1, 1, 1}; +static A5O_COLOR solid_white = {1, 1, 1, 1}; -static void _bitmap_drawer(ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR tint, +static void _bitmap_drawer(A5O_BITMAP *bitmap, A5O_COLOR tint, float sx, float sy, float sw, float sh, int flags) { - ALLEGRO_BITMAP *dest = al_get_target_bitmap(); - ALLEGRO_DISPLAY *display = _al_get_bitmap_display(dest); + A5O_BITMAP *dest = al_get_target_bitmap(); + A5O_DISPLAY *display = _al_get_bitmap_display(dest); ASSERT(bitmap->parent == NULL); - ASSERT(!(flags & (ALLEGRO_FLIP_HORIZONTAL | ALLEGRO_FLIP_VERTICAL))); + ASSERT(!(flags & (A5O_FLIP_HORIZONTAL | A5O_FLIP_VERTICAL))); ASSERT(bitmap != dest && bitmap != dest->parent); /* If destination is memory, do a memory blit */ - if (al_get_bitmap_flags(dest) & ALLEGRO_MEMORY_BITMAP || + if (al_get_bitmap_flags(dest) & A5O_MEMORY_BITMAP || _al_pixel_format_is_compressed(al_get_bitmap_format(dest))) { _al_draw_bitmap_region_memory(bitmap, tint, sx, sy, sw, sh, 0, 0, flags); } else { /* if source is memory or incompatible */ - if ((al_get_bitmap_flags(bitmap) & ALLEGRO_MEMORY_BITMAP) || + if ((al_get_bitmap_flags(bitmap) & A5O_MEMORY_BITMAP) || (!al_is_compatible_bitmap(bitmap))) { if (display && display->vt->draw_memory_bitmap_region) { @@ -59,15 +59,15 @@ static void _bitmap_drawer(ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR tint, } -static void _draw_tinted_rotated_scaled_bitmap_region(ALLEGRO_BITMAP *bitmap, - ALLEGRO_COLOR tint, float cx, float cy, float angle, +static void _draw_tinted_rotated_scaled_bitmap_region(A5O_BITMAP *bitmap, + A5O_COLOR tint, float cx, float cy, float angle, float xscale, float yscale, float sx, float sy, float sw, float sh, float dx, float dy, int flags) { - ALLEGRO_TRANSFORM backup; - ALLEGRO_TRANSFORM t; - ALLEGRO_BITMAP *parent = bitmap; + A5O_TRANSFORM backup; + A5O_TRANSFORM t; + A5O_BITMAP *parent = bitmap; float const orig_sw = sw; float const orig_sh = sh; ASSERT(bitmap); @@ -96,16 +96,16 @@ static void _draw_tinted_rotated_scaled_bitmap_region(ALLEGRO_BITMAP *bitmap, if (sy + sh > parent->h) sh = parent->h - sy; - if (flags & ALLEGRO_FLIP_HORIZONTAL) { + if (flags & A5O_FLIP_HORIZONTAL) { al_scale_transform(&t, -1, 1); al_translate_transform(&t, orig_sw, 0); - flags &= ~ALLEGRO_FLIP_HORIZONTAL; + flags &= ~A5O_FLIP_HORIZONTAL; } - if (flags & ALLEGRO_FLIP_VERTICAL) { + if (flags & A5O_FLIP_VERTICAL) { al_scale_transform(&t, 1, -1); al_translate_transform(&t, 0, orig_sh); - flags &= ~ALLEGRO_FLIP_VERTICAL; + flags &= ~A5O_FLIP_VERTICAL; } al_translate_transform(&t, -cx, -cy); @@ -122,8 +122,8 @@ static void _draw_tinted_rotated_scaled_bitmap_region(ALLEGRO_BITMAP *bitmap, /* Function: al_draw_tinted_bitmap_region */ -void al_draw_tinted_bitmap_region(ALLEGRO_BITMAP *bitmap, - ALLEGRO_COLOR tint, +void al_draw_tinted_bitmap_region(A5O_BITMAP *bitmap, + A5O_COLOR tint, float sx, float sy, float sw, float sh, float dx, float dy, int flags) { @@ -134,7 +134,7 @@ void al_draw_tinted_bitmap_region(ALLEGRO_BITMAP *bitmap, /* Function: al_draw_tinted_bitmap */ -void al_draw_tinted_bitmap(ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR tint, +void al_draw_tinted_bitmap(A5O_BITMAP *bitmap, A5O_COLOR tint, float dx, float dy, int flags) { ASSERT(bitmap); @@ -145,7 +145,7 @@ void al_draw_tinted_bitmap(ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR tint, /* Function: al_draw_bitmap */ -void al_draw_bitmap(ALLEGRO_BITMAP *bitmap, float dx, float dy, int flags) +void al_draw_bitmap(A5O_BITMAP *bitmap, float dx, float dy, int flags) { al_draw_tinted_bitmap(bitmap, solid_white, dx, dy, flags); } @@ -153,7 +153,7 @@ void al_draw_bitmap(ALLEGRO_BITMAP *bitmap, float dx, float dy, int flags) /* Function: al_draw_bitmap_region */ -void al_draw_bitmap_region(ALLEGRO_BITMAP *bitmap, +void al_draw_bitmap_region(A5O_BITMAP *bitmap, float sx, float sy, float sw, float sh, float dx, float dy, int flags) { al_draw_tinted_bitmap_region(bitmap, solid_white, sx, sy, sw, sh, @@ -163,8 +163,8 @@ void al_draw_bitmap_region(ALLEGRO_BITMAP *bitmap, /* Function: al_draw_tinted_scaled_bitmap */ -void al_draw_tinted_scaled_bitmap(ALLEGRO_BITMAP *bitmap, - ALLEGRO_COLOR tint, +void al_draw_tinted_scaled_bitmap(A5O_BITMAP *bitmap, + A5O_COLOR tint, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, int flags) { @@ -177,7 +177,7 @@ void al_draw_tinted_scaled_bitmap(ALLEGRO_BITMAP *bitmap, /* Function: al_draw_scaled_bitmap */ -void al_draw_scaled_bitmap(ALLEGRO_BITMAP *bitmap, +void al_draw_scaled_bitmap(A5O_BITMAP *bitmap, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, int flags) { @@ -191,8 +191,8 @@ void al_draw_scaled_bitmap(ALLEGRO_BITMAP *bitmap, * angle is specified in radians and moves clockwise * on the screen. */ -void al_draw_tinted_rotated_bitmap(ALLEGRO_BITMAP *bitmap, - ALLEGRO_COLOR tint, +void al_draw_tinted_rotated_bitmap(A5O_BITMAP *bitmap, + A5O_COLOR tint, float cx, float cy, float dx, float dy, float angle, int flags) { al_draw_tinted_scaled_rotated_bitmap(bitmap, tint, cx, cy, dx, dy, @@ -202,7 +202,7 @@ void al_draw_tinted_rotated_bitmap(ALLEGRO_BITMAP *bitmap, /* Function: al_draw_rotated_bitmap */ -void al_draw_rotated_bitmap(ALLEGRO_BITMAP *bitmap, +void al_draw_rotated_bitmap(A5O_BITMAP *bitmap, float cx, float cy, float dx, float dy, float angle, int flags) { al_draw_tinted_rotated_bitmap(bitmap, solid_white, cx, cy, dx, dy, @@ -212,8 +212,8 @@ void al_draw_rotated_bitmap(ALLEGRO_BITMAP *bitmap, /* Function: al_draw_tinted_scaled_rotated_bitmap */ -void al_draw_tinted_scaled_rotated_bitmap(ALLEGRO_BITMAP *bitmap, - ALLEGRO_COLOR tint, +void al_draw_tinted_scaled_rotated_bitmap(A5O_BITMAP *bitmap, + A5O_COLOR tint, float cx, float cy, float dx, float dy, float xscale, float yscale, float angle, int flags) { @@ -226,9 +226,9 @@ void al_draw_tinted_scaled_rotated_bitmap(ALLEGRO_BITMAP *bitmap, /* Function: al_draw_tinted_scaled_rotated_bitmap_region */ -void al_draw_tinted_scaled_rotated_bitmap_region(ALLEGRO_BITMAP *bitmap, +void al_draw_tinted_scaled_rotated_bitmap_region(A5O_BITMAP *bitmap, float sx, float sy, float sw, float sh, - ALLEGRO_COLOR tint, + A5O_COLOR tint, float cx, float cy, float dx, float dy, float xscale, float yscale, float angle, int flags) { @@ -241,7 +241,7 @@ void al_draw_tinted_scaled_rotated_bitmap_region(ALLEGRO_BITMAP *bitmap, /* Function: al_draw_scaled_rotated_bitmap */ -void al_draw_scaled_rotated_bitmap(ALLEGRO_BITMAP *bitmap, +void al_draw_scaled_rotated_bitmap(A5O_BITMAP *bitmap, float cx, float cy, float dx, float dy, float xscale, float yscale, float angle, int flags) { diff --git a/src/bitmap_io.c b/src/bitmap_io.c index aeefd00a1c..078f609c89 100644 --- a/src/bitmap_io.c +++ b/src/bitmap_io.c @@ -21,7 +21,7 @@ #include -ALLEGRO_DEBUG_CHANNEL("bitmap") +A5O_DEBUG_CHANNEL("bitmap") #define MAX_EXTENSION (32) @@ -29,11 +29,11 @@ ALLEGRO_DEBUG_CHANNEL("bitmap") typedef struct Handler { char extension[MAX_EXTENSION]; - ALLEGRO_IIO_LOADER_FUNCTION loader; - ALLEGRO_IIO_SAVER_FUNCTION saver; - ALLEGRO_IIO_FS_LOADER_FUNCTION fs_loader; - ALLEGRO_IIO_FS_SAVER_FUNCTION fs_saver; - ALLEGRO_IIO_IDENTIFIER_FUNCTION identifier; + A5O_IIO_LOADER_FUNCTION loader; + A5O_IIO_SAVER_FUNCTION saver; + A5O_IIO_FS_LOADER_FUNCTION fs_loader; + A5O_IIO_FS_SAVER_FUNCTION fs_saver; + A5O_IIO_IDENTIFIER_FUNCTION identifier; } Handler; @@ -81,7 +81,7 @@ static Handler *find_handler(const char *extension, bool create_if_not) } -static Handler *find_handler_for_file(ALLEGRO_FILE *f) +static Handler *find_handler_for_file(A5O_FILE *f) { unsigned i; @@ -92,7 +92,7 @@ static Handler *find_handler_for_file(ALLEGRO_FILE *f) if (l->identifier) { int64_t pos = al_ftell(f); bool identified = l->identifier(f); - al_fseek(f, pos, ALLEGRO_SEEK_SET); + al_fseek(f, pos, A5O_SEEK_SET); if (identified) return l; } @@ -126,7 +126,7 @@ void _al_init_iio_table(void) /* Function: al_register_bitmap_loader */ bool al_register_bitmap_loader(const char *extension, - ALLEGRO_BITMAP *(*loader)(const char *filename, int flags)) + A5O_BITMAP *(*loader)(const char *filename, int flags)) { REGISTER(loader) } @@ -135,7 +135,7 @@ bool al_register_bitmap_loader(const char *extension, /* Function: al_register_bitmap_saver */ bool al_register_bitmap_saver(const char *extension, - bool (*saver)(const char *filename, ALLEGRO_BITMAP *bmp)) + bool (*saver)(const char *filename, A5O_BITMAP *bmp)) { REGISTER(saver) } @@ -144,7 +144,7 @@ bool al_register_bitmap_saver(const char *extension, /* Function: al_register_bitmap_loader_f */ bool al_register_bitmap_loader_f(const char *extension, - ALLEGRO_BITMAP *(*fs_loader)(ALLEGRO_FILE *fp, int flags)) + A5O_BITMAP *(*fs_loader)(A5O_FILE *fp, int flags)) { REGISTER(fs_loader) } @@ -153,7 +153,7 @@ bool al_register_bitmap_loader_f(const char *extension, /* Function: al_register_bitmap_saver_f */ bool al_register_bitmap_saver_f(const char *extension, - bool (*fs_saver)(ALLEGRO_FILE *fp, ALLEGRO_BITMAP *bmp)) + bool (*fs_saver)(A5O_FILE *fp, A5O_BITMAP *bmp)) { REGISTER(fs_saver) } @@ -162,7 +162,7 @@ bool al_register_bitmap_saver_f(const char *extension, /* Function: al_register_bitmap_identifier */ bool al_register_bitmap_identifier(const char *extension, - bool (*identifier)(ALLEGRO_FILE *f)) + bool (*identifier)(A5O_FILE *f)) { REGISTER(identifier) } @@ -170,14 +170,14 @@ bool al_register_bitmap_identifier(const char *extension, /* Function: al_load_bitmap */ -ALLEGRO_BITMAP *al_load_bitmap(const char *filename) +A5O_BITMAP *al_load_bitmap(const char *filename) { int flags = 0; /* For backwards compatibility with the 5.0 branch. */ - if (al_get_new_bitmap_flags() & ALLEGRO_NO_PREMULTIPLIED_ALPHA) { - flags |= ALLEGRO_NO_PREMULTIPLIED_ALPHA; - ALLEGRO_WARN("ALLEGRO_NO_PREMULTIPLIED_ALPHA in new_bitmap_flags " + if (al_get_new_bitmap_flags() & A5O_NO_PREMULTIPLIED_ALPHA) { + flags |= A5O_NO_PREMULTIPLIED_ALPHA; + A5O_WARN("A5O_NO_PREMULTIPLIED_ALPHA in new_bitmap_flags " "is deprecated\n"); } @@ -187,17 +187,17 @@ ALLEGRO_BITMAP *al_load_bitmap(const char *filename) /* Function: al_load_bitmap_flags */ -ALLEGRO_BITMAP *al_load_bitmap_flags(const char *filename, int flags) +A5O_BITMAP *al_load_bitmap_flags(const char *filename, int flags) { const char *ext; Handler *h; - ALLEGRO_BITMAP *ret; + A5O_BITMAP *ret; ext = al_identify_bitmap(filename); if (!ext) { ext = strrchr(filename, '.'); if (!ext) { - ALLEGRO_ERROR("Could not identify bitmap %s!\n", filename); + A5O_ERROR("Could not identify bitmap %s!\n", filename); return NULL; } } @@ -206,11 +206,11 @@ ALLEGRO_BITMAP *al_load_bitmap_flags(const char *filename, int flags) if (h && h->loader) { ret = h->loader(filename, flags); if (!ret) - ALLEGRO_ERROR("Failed loading bitmap %s with %s handler.\n", + A5O_ERROR("Failed loading bitmap %s with %s handler.\n", filename, ext); } else { - ALLEGRO_ERROR("No handler for bitmap %s!\n", filename); + A5O_ERROR("No handler for bitmap %s!\n", filename); ret = NULL; } @@ -220,14 +220,14 @@ ALLEGRO_BITMAP *al_load_bitmap_flags(const char *filename, int flags) /* Function: al_save_bitmap */ -bool al_save_bitmap(const char *filename, ALLEGRO_BITMAP *bitmap) +bool al_save_bitmap(const char *filename, A5O_BITMAP *bitmap) { const char *ext; Handler *h; ext = strrchr(filename, '.'); if (!ext) { - ALLEGRO_ERROR("Unable to determine file format from %s\n", filename); + A5O_ERROR("Unable to determine file format from %s\n", filename); return false; } @@ -235,7 +235,7 @@ bool al_save_bitmap(const char *filename, ALLEGRO_BITMAP *bitmap) if (h && h->saver) return h->saver(filename, bitmap); else { - ALLEGRO_ERROR("No handler for image %s found\n", filename); + A5O_ERROR("No handler for image %s found\n", filename); return false; } } @@ -243,14 +243,14 @@ bool al_save_bitmap(const char *filename, ALLEGRO_BITMAP *bitmap) /* Function: al_load_bitmap_f */ -ALLEGRO_BITMAP *al_load_bitmap_f(ALLEGRO_FILE *fp, const char *ident) +A5O_BITMAP *al_load_bitmap_f(A5O_FILE *fp, const char *ident) { int flags = 0; /* For backwards compatibility with the 5.0 branch. */ - if (al_get_new_bitmap_flags() & ALLEGRO_NO_PREMULTIPLIED_ALPHA) { - flags |= ALLEGRO_NO_PREMULTIPLIED_ALPHA; - ALLEGRO_WARN("ALLEGRO_NO_PREMULTIPLIED_ALPHA in new_bitmap_flags " + if (al_get_new_bitmap_flags() & A5O_NO_PREMULTIPLIED_ALPHA) { + flags |= A5O_NO_PREMULTIPLIED_ALPHA; + A5O_WARN("A5O_NO_PREMULTIPLIED_ALPHA in new_bitmap_flags " "is deprecated\n"); } @@ -260,7 +260,7 @@ ALLEGRO_BITMAP *al_load_bitmap_f(ALLEGRO_FILE *fp, const char *ident) /* Function: al_load_bitmap_flags_f */ -ALLEGRO_BITMAP *al_load_bitmap_flags_f(ALLEGRO_FILE *fp, +A5O_BITMAP *al_load_bitmap_flags_f(A5O_FILE *fp, const char *ident, int flags) { Handler *h; @@ -277,14 +277,14 @@ ALLEGRO_BITMAP *al_load_bitmap_flags_f(ALLEGRO_FILE *fp, /* Function: al_save_bitmap_f */ -bool al_save_bitmap_f(ALLEGRO_FILE *fp, const char *ident, - ALLEGRO_BITMAP *bitmap) +bool al_save_bitmap_f(A5O_FILE *fp, const char *ident, + A5O_BITMAP *bitmap) { Handler *h = find_handler(ident, false); if (h && h->fs_saver) return h->fs_saver(fp, bitmap); else { - ALLEGRO_ERROR("No handler for image %s found\n", ident); + A5O_ERROR("No handler for image %s found\n", ident); return false; } } @@ -292,7 +292,7 @@ bool al_save_bitmap_f(ALLEGRO_FILE *fp, const char *ident, /* Function: al_identify_bitmap_f */ -char const *al_identify_bitmap_f(ALLEGRO_FILE *fp) +char const *al_identify_bitmap_f(A5O_FILE *fp) { Handler *h = find_handler_for_file(fp); if (!h) @@ -306,7 +306,7 @@ char const *al_identify_bitmap_f(ALLEGRO_FILE *fp) char const *al_identify_bitmap(char const *filename) { char const *ext; - ALLEGRO_FILE *fp = al_fopen(filename, "rb"); + A5O_FILE *fp = al_fopen(filename, "rb"); if (!fp) return NULL; ext = al_identify_bitmap_f(fp); diff --git a/src/bitmap_lock.c b/src/bitmap_lock.c index ba0d1492ba..1f8164dfbf 100644 --- a/src/bitmap_lock.c +++ b/src/bitmap_lock.c @@ -22,10 +22,10 @@ /* Function: al_lock_bitmap_region */ -ALLEGRO_LOCKED_REGION *al_lock_bitmap_region(ALLEGRO_BITMAP *bitmap, +A5O_LOCKED_REGION *al_lock_bitmap_region(A5O_BITMAP *bitmap, int x, int y, int width, int height, int format, int flags) { - ALLEGRO_LOCKED_REGION *lr; + A5O_LOCKED_REGION *lr; int bitmap_format = al_get_bitmap_format(bitmap); int bitmap_flags = al_get_bitmap_flags(bitmap); int block_width = al_get_pixel_block_width(bitmap_format); @@ -51,8 +51,8 @@ ALLEGRO_LOCKED_REGION *al_lock_bitmap_region(ALLEGRO_BITMAP *bitmap, if (bitmap->locked) return NULL; - if (!(bitmap_flags & ALLEGRO_MEMORY_BITMAP) && - !(flags & ALLEGRO_LOCK_READONLY)) + if (!(bitmap_flags & A5O_MEMORY_BITMAP) && + !(flags & A5O_LOCK_READONLY)) bitmap->dirty = true; ASSERT(x+width <= bitmap->w); @@ -69,21 +69,21 @@ ALLEGRO_LOCKED_REGION *al_lock_bitmap_region(ALLEGRO_BITMAP *bitmap, bitmap->lock_h = hc; bitmap->lock_flags = flags; - if (flags == ALLEGRO_LOCK_WRITEONLY && + if (flags == A5O_LOCK_WRITEONLY && (xc != x || yc != y || wc != width || hc != height)) { /* Unaligned write-only access requires that we fill in the padding * from the texture. * XXX: In principle, this could be done more efficiently. */ - flags = ALLEGRO_LOCK_READWRITE; + flags = A5O_LOCK_READWRITE; } - if (bitmap_flags & ALLEGRO_MEMORY_BITMAP) { + if (bitmap_flags & A5O_MEMORY_BITMAP) { int f = _al_get_real_pixel_format(al_get_current_display(), format); if (f < 0) { return NULL; } ASSERT(bitmap->memory); - if (format == ALLEGRO_PIXEL_FORMAT_ANY || bitmap_format == format || bitmap_format == f) { + if (format == A5O_PIXEL_FORMAT_ANY || bitmap_format == format || bitmap_format == f) { bitmap->locked_region.data = bitmap->memory + bitmap->pitch * yc + xc * al_get_pixel_size(bitmap_format); bitmap->locked_region.format = bitmap_format; @@ -95,7 +95,7 @@ ALLEGRO_LOCKED_REGION *al_lock_bitmap_region(ALLEGRO_BITMAP *bitmap, bitmap->locked_region.data = al_malloc(bitmap->locked_region.pitch*hc); bitmap->locked_region.format = f; bitmap->locked_region.pixel_size = al_get_pixel_size(f); - if (!(bitmap->lock_flags & ALLEGRO_LOCK_WRITEONLY)) { + if (!(bitmap->lock_flags & A5O_LOCK_WRITEONLY)) { _al_convert_bitmap_data( bitmap->memory, bitmap_format, bitmap->pitch, bitmap->locked_region.data, f, bitmap->locked_region.pitch, @@ -123,7 +123,7 @@ ALLEGRO_LOCKED_REGION *al_lock_bitmap_region(ALLEGRO_BITMAP *bitmap, /* Function: al_lock_bitmap */ -ALLEGRO_LOCKED_REGION *al_lock_bitmap(ALLEGRO_BITMAP *bitmap, +A5O_LOCKED_REGION *al_lock_bitmap(A5O_BITMAP *bitmap, int format, int flags) { return al_lock_bitmap_region(bitmap, 0, 0, bitmap->w, bitmap->h, format, flags); @@ -132,7 +132,7 @@ ALLEGRO_LOCKED_REGION *al_lock_bitmap(ALLEGRO_BITMAP *bitmap, /* Function: al_unlock_bitmap */ -void al_unlock_bitmap(ALLEGRO_BITMAP *bitmap) +void al_unlock_bitmap(A5O_BITMAP *bitmap) { int bitmap_format = al_get_bitmap_format(bitmap); /* For sub-bitmaps */ @@ -140,7 +140,7 @@ void al_unlock_bitmap(ALLEGRO_BITMAP *bitmap) bitmap = bitmap->parent; } - if (!(al_get_bitmap_flags(bitmap) & ALLEGRO_MEMORY_BITMAP)) { + if (!(al_get_bitmap_flags(bitmap) & A5O_MEMORY_BITMAP)) { if (_al_pixel_format_is_compressed(bitmap->locked_region.format)) bitmap->vt->unlock_compressed_region(bitmap); else @@ -148,7 +148,7 @@ void al_unlock_bitmap(ALLEGRO_BITMAP *bitmap) } else { if (bitmap->locked_region.format != 0 && bitmap->locked_region.format != bitmap_format) { - if (!(bitmap->lock_flags & ALLEGRO_LOCK_READONLY)) { + if (!(bitmap->lock_flags & A5O_LOCK_READONLY)) { _al_convert_bitmap_data( bitmap->locked_region.data, bitmap->locked_region.format, bitmap->locked_region.pitch, bitmap->memory, bitmap_format, bitmap->pitch, @@ -164,14 +164,14 @@ void al_unlock_bitmap(ALLEGRO_BITMAP *bitmap) /* Function: al_is_bitmap_locked */ -bool al_is_bitmap_locked(ALLEGRO_BITMAP *bitmap) +bool al_is_bitmap_locked(A5O_BITMAP *bitmap) { return bitmap->locked; } /* Function: al_lock_bitmap_blocked */ -ALLEGRO_LOCKED_REGION *al_lock_bitmap_blocked(ALLEGRO_BITMAP *bitmap, +A5O_LOCKED_REGION *al_lock_bitmap_blocked(A5O_BITMAP *bitmap, int flags) { int bitmap_format = al_get_bitmap_format(bitmap); @@ -186,10 +186,10 @@ ALLEGRO_LOCKED_REGION *al_lock_bitmap_blocked(ALLEGRO_BITMAP *bitmap, /* Function: al_lock_bitmap_region_blocked */ -ALLEGRO_LOCKED_REGION *al_lock_bitmap_region_blocked(ALLEGRO_BITMAP *bitmap, +A5O_LOCKED_REGION *al_lock_bitmap_region_blocked(A5O_BITMAP *bitmap, int x_block, int y_block, int width_block, int height_block, int flags) { - ALLEGRO_LOCKED_REGION *lr; + A5O_LOCKED_REGION *lr; int bitmap_format = al_get_bitmap_format(bitmap); int bitmap_flags = al_get_bitmap_flags(bitmap); int block_width = al_get_pixel_block_width(bitmap_format); @@ -206,7 +206,7 @@ ALLEGRO_LOCKED_REGION *al_lock_bitmap_region_blocked(ALLEGRO_BITMAP *bitmap, /* Currently, this is the only format that gets to this point */ ASSERT(_al_pixel_format_is_compressed(bitmap_format)); - ASSERT(!(bitmap_flags & ALLEGRO_MEMORY_BITMAP)); + ASSERT(!(bitmap_flags & A5O_MEMORY_BITMAP)); /* For sub-bitmaps */ if (bitmap->parent) { @@ -222,7 +222,7 @@ ALLEGRO_LOCKED_REGION *al_lock_bitmap_region_blocked(ALLEGRO_BITMAP *bitmap, if (bitmap->locked) return NULL; - if (!(flags & ALLEGRO_LOCK_READONLY)) + if (!(flags & A5O_LOCK_READONLY)) bitmap->dirty = true; ASSERT(x_block + width_block diff --git a/src/bitmap_pixel.c b/src/bitmap_pixel.c index 3d1bd32535..0e48477099 100644 --- a/src/bitmap_pixel.c +++ b/src/bitmap_pixel.c @@ -19,16 +19,16 @@ #include "allegro5/internal/aintern_blend.h" #include "allegro5/internal/aintern_pixels.h" -ALLEGRO_DEBUG_CHANNEL("bitmap") +A5O_DEBUG_CHANNEL("bitmap") /* Function: al_get_pixel */ -ALLEGRO_COLOR al_get_pixel(ALLEGRO_BITMAP *bitmap, int x, int y) +A5O_COLOR al_get_pixel(A5O_BITMAP *bitmap, int x, int y) { - ALLEGRO_LOCKED_REGION *lr; + A5O_LOCKED_REGION *lr; char *data; - ALLEGRO_COLOR color = al_map_rgba_f(0, 0, 0, 0); + A5O_COLOR color = al_map_rgba_f(0, 0, 0, 0); if (bitmap->parent) { x += bitmap->xofs; @@ -38,13 +38,13 @@ ALLEGRO_COLOR al_get_pixel(ALLEGRO_BITMAP *bitmap, int x, int y) if (bitmap->locked) { if (_al_pixel_format_is_video_only(bitmap->locked_region.format)) { - ALLEGRO_ERROR("Invalid lock format."); + A5O_ERROR("Invalid lock format."); return color; } x -= bitmap->lock_x; y -= bitmap->lock_y; if (x < 0 || y < 0 || x >= bitmap->lock_w || y >= bitmap->lock_h) { - ALLEGRO_ERROR("Out of bounds."); + A5O_ERROR("Out of bounds."); return color; } @@ -61,7 +61,7 @@ ALLEGRO_COLOR al_get_pixel(ALLEGRO_BITMAP *bitmap, int x, int y) } if (!(lr = al_lock_bitmap_region(bitmap, x, y, 1, 1, - ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_READONLY))) { + A5O_PIXEL_FORMAT_ANY, A5O_LOCK_READONLY))) { return color; } @@ -77,9 +77,9 @@ ALLEGRO_COLOR al_get_pixel(ALLEGRO_BITMAP *bitmap, int x, int y) } -void _al_put_pixel(ALLEGRO_BITMAP *bitmap, int x, int y, ALLEGRO_COLOR color) +void _al_put_pixel(A5O_BITMAP *bitmap, int x, int y, A5O_COLOR color) { - ALLEGRO_LOCKED_REGION *lr; + A5O_LOCKED_REGION *lr; char *data; if (bitmap->parent) { @@ -95,7 +95,7 @@ void _al_put_pixel(ALLEGRO_BITMAP *bitmap, int x, int y, ALLEGRO_COLOR color) if (bitmap->locked) { if (_al_pixel_format_is_video_only(bitmap->locked_region.format)) { - ALLEGRO_ERROR("Invalid lock format."); + A5O_ERROR("Invalid lock format."); return; } x -= bitmap->lock_x; @@ -112,7 +112,7 @@ void _al_put_pixel(ALLEGRO_BITMAP *bitmap, int x, int y, ALLEGRO_COLOR color) } else { lr = al_lock_bitmap_region(bitmap, x, y, 1, 1, - ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_WRITEONLY); + A5O_PIXEL_FORMAT_ANY, A5O_LOCK_WRITEONLY); if (!lr) return; @@ -128,7 +128,7 @@ void _al_put_pixel(ALLEGRO_BITMAP *bitmap, int x, int y, ALLEGRO_COLOR color) /* Function: al_put_pixel */ -void al_put_pixel(int x, int y, ALLEGRO_COLOR color) +void al_put_pixel(int x, int y, A5O_COLOR color) { _al_put_pixel(al_get_target_bitmap(), x, y, color); } @@ -136,10 +136,10 @@ void al_put_pixel(int x, int y, ALLEGRO_COLOR color) /* Function: al_put_blended_pixel */ -void al_put_blended_pixel(int x, int y, ALLEGRO_COLOR color) +void al_put_blended_pixel(int x, int y, A5O_COLOR color) { - ALLEGRO_COLOR result; - ALLEGRO_BITMAP* bitmap = al_get_target_bitmap(); + A5O_COLOR result; + A5O_BITMAP* bitmap = al_get_target_bitmap(); _al_blend_memory(&color, bitmap, x, y, &result); _al_put_pixel(bitmap, x, y, result); } diff --git a/src/bitmap_type.c b/src/bitmap_type.c index c23c984cf9..5020cc77e2 100644 --- a/src/bitmap_type.c +++ b/src/bitmap_type.c @@ -22,12 +22,12 @@ #include "allegro5/internal/aintern_system.h" #include "allegro5/internal/aintern_vector.h" -ALLEGRO_DEBUG_CHANNEL("bitmap") +A5O_DEBUG_CHANNEL("bitmap") -/* Global list of MEMORY bitmaps with ALLEGRO_CONVERT_BITMAP flag. */ +/* Global list of MEMORY bitmaps with A5O_CONVERT_BITMAP flag. */ struct BITMAP_CONVERSION_LIST { - ALLEGRO_MUTEX *mutex; + A5O_MUTEX *mutex; _AL_VECTOR bitmaps; }; @@ -48,19 +48,19 @@ static void cleanup_convert_bitmap_list(void) void _al_init_convert_bitmap_list(void) { convert_bitmap_list.mutex = al_create_mutex_recursive(); - _al_vector_init(&convert_bitmap_list.bitmaps, sizeof(ALLEGRO_BITMAP *)); + _al_vector_init(&convert_bitmap_list.bitmaps, sizeof(A5O_BITMAP *)); _al_add_exit_func(cleanup_convert_bitmap_list, "cleanup_convert_bitmap_list"); } -void _al_register_convert_bitmap(ALLEGRO_BITMAP *bitmap) +void _al_register_convert_bitmap(A5O_BITMAP *bitmap) { int bitmap_flags = al_get_bitmap_flags(bitmap); - if (!(bitmap_flags & ALLEGRO_MEMORY_BITMAP)) + if (!(bitmap_flags & A5O_MEMORY_BITMAP)) return; - if (bitmap_flags & ALLEGRO_CONVERT_BITMAP) { - ALLEGRO_BITMAP **back; + if (bitmap_flags & A5O_CONVERT_BITMAP) { + A5O_BITMAP **back; al_lock_mutex(convert_bitmap_list.mutex); back = _al_vector_alloc_back(&convert_bitmap_list.bitmaps); *back = bitmap; @@ -69,12 +69,12 @@ void _al_register_convert_bitmap(ALLEGRO_BITMAP *bitmap) } -void _al_unregister_convert_bitmap(ALLEGRO_BITMAP *bitmap) +void _al_unregister_convert_bitmap(A5O_BITMAP *bitmap) { int bitmap_flags = al_get_bitmap_flags(bitmap); - if (!(bitmap_flags & ALLEGRO_MEMORY_BITMAP)) + if (!(bitmap_flags & A5O_MEMORY_BITMAP)) return; - if (bitmap_flags & ALLEGRO_CONVERT_BITMAP) { + if (bitmap_flags & A5O_CONVERT_BITMAP) { al_lock_mutex(convert_bitmap_list.mutex); _al_vector_find_and_delete(&convert_bitmap_list.bitmaps, &bitmap); al_unlock_mutex(convert_bitmap_list.mutex); @@ -82,12 +82,12 @@ void _al_unregister_convert_bitmap(ALLEGRO_BITMAP *bitmap) } -static void swap_bitmaps(ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP *other) +static void swap_bitmaps(A5O_BITMAP *bitmap, A5O_BITMAP *other) { - ALLEGRO_BITMAP temp; + A5O_BITMAP temp; _AL_LIST_ITEM *bitmap_dtor_item = bitmap->dtor_item; _AL_LIST_ITEM *other_dtor_item = other->dtor_item; - ALLEGRO_DISPLAY *bitmap_display, *other_display; + A5O_DISPLAY *bitmap_display, *other_display; _al_unregister_convert_bitmap(bitmap); _al_unregister_convert_bitmap(other); @@ -118,7 +118,7 @@ static void swap_bitmaps(ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP *other) /* This means before the swap, other was the display bitmap, and we * now should replace it with the swapped pointer. */ - ALLEGRO_BITMAP **back; + A5O_BITMAP **back; int pos = _al_vector_find(&bitmap_display->bitmaps, &other); ASSERT(pos >= 0); back = _al_vector_ref(&bitmap_display->bitmaps, pos); @@ -126,7 +126,7 @@ static void swap_bitmaps(ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP *other) } if (other_display && !bitmap_display) { - ALLEGRO_BITMAP **back; + A5O_BITMAP **back; int pos = _al_vector_find(&other_display->bitmaps, &bitmap); ASSERT(pos >= 0); back = _al_vector_ref(&other_display->bitmaps, pos); @@ -151,16 +151,16 @@ static void swap_bitmaps(ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP *other) /* Function: al_convert_bitmap */ -void al_convert_bitmap(ALLEGRO_BITMAP *bitmap) +void al_convert_bitmap(A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP *clone; + A5O_BITMAP *clone; int bitmap_flags = al_get_bitmap_flags(bitmap); int new_bitmap_flags = al_get_new_bitmap_flags(); - bool want_memory = (new_bitmap_flags & ALLEGRO_MEMORY_BITMAP) != 0; + bool want_memory = (new_bitmap_flags & A5O_MEMORY_BITMAP) != 0; bool clone_memory; - ALLEGRO_BITMAP *target_bitmap; + A5O_BITMAP *target_bitmap; - bitmap_flags &= ~_ALLEGRO_INTERNAL_OPENGL; + bitmap_flags &= ~_A5O_INTERNAL_OPENGL; /* If a cloned bitmap would be identical, we can just do nothing. */ if (al_get_bitmap_format(bitmap) == al_get_new_bitmap_format() && @@ -181,7 +181,7 @@ void al_convert_bitmap(ALLEGRO_BITMAP *bitmap) return; } - clone_memory = (al_get_bitmap_flags(clone) & ALLEGRO_MEMORY_BITMAP) != 0; + clone_memory = (al_get_bitmap_flags(clone) & A5O_MEMORY_BITMAP) != 0; if (clone_memory != want_memory) { /* We couldn't convert. */ @@ -202,7 +202,7 @@ void al_convert_bitmap(ALLEGRO_BITMAP *bitmap) /* Memory bitmaps do not support custom projection transforms, * so reset it to the orthographic transform. */ - if (new_bitmap_flags & ALLEGRO_MEMORY_BITMAP) { + if (new_bitmap_flags & A5O_MEMORY_BITMAP) { al_identity_transform(&bitmap->proj_transform); al_orthographic_transform(&bitmap->proj_transform, 0, 0, -1.0, bitmap->w, bitmap->h, 1.0); } else { @@ -215,7 +215,7 @@ void al_convert_bitmap(ALLEGRO_BITMAP *bitmap) * on the current target. */ target_bitmap = al_get_target_bitmap(); if (target_bitmap) { - ALLEGRO_BITMAP *target_parent = + A5O_BITMAP *target_parent = target_bitmap->parent ? target_bitmap->parent : target_bitmap; if (bitmap == target_parent || bitmap->parent == target_parent) { al_set_target_bitmap(target_bitmap); @@ -230,35 +230,35 @@ void al_convert_bitmap(ALLEGRO_BITMAP *bitmap) */ void al_convert_memory_bitmaps(void) { - ALLEGRO_STATE backup; - ALLEGRO_DISPLAY *display = al_get_current_display(); + A5O_STATE backup; + A5O_DISPLAY *display = al_get_current_display(); _AL_VECTOR copy; size_t i; if (!display) return; - al_store_state(&backup, ALLEGRO_STATE_NEW_BITMAP_PARAMETERS); + al_store_state(&backup, A5O_STATE_NEW_BITMAP_PARAMETERS); al_lock_mutex(convert_bitmap_list.mutex); - _al_vector_init(©, sizeof(ALLEGRO_BITMAP *)); + _al_vector_init(©, sizeof(A5O_BITMAP *)); for (i = 0; i < _al_vector_size(&convert_bitmap_list.bitmaps); i++) { - ALLEGRO_BITMAP **bptr, **bptr2; + A5O_BITMAP **bptr, **bptr2; bptr = _al_vector_ref(&convert_bitmap_list.bitmaps, i); bptr2 = _al_vector_alloc_back(©); *bptr2 = *bptr; } _al_vector_free(&convert_bitmap_list.bitmaps); - _al_vector_init(&convert_bitmap_list.bitmaps, sizeof(ALLEGRO_BITMAP *)); + _al_vector_init(&convert_bitmap_list.bitmaps, sizeof(A5O_BITMAP *)); for (i = 0; i < _al_vector_size(©); i++) { - ALLEGRO_BITMAP **bptr; + A5O_BITMAP **bptr; int flags; bptr = _al_vector_ref(©, i); flags = al_get_bitmap_flags(*bptr); - flags &= ~ALLEGRO_MEMORY_BITMAP; + flags &= ~A5O_MEMORY_BITMAP; al_set_new_bitmap_flags(flags); al_set_new_bitmap_format(al_get_bitmap_format(*bptr)); - ALLEGRO_DEBUG("converting memory bitmap %p to display bitmap\n", *bptr); + A5O_DEBUG("converting memory bitmap %p to display bitmap\n", *bptr); al_convert_bitmap(*bptr); } @@ -276,18 +276,18 @@ void al_convert_memory_bitmaps(void) * * If this is called for a sub-bitmap, the parent also is converted. */ -void _al_convert_to_display_bitmap(ALLEGRO_BITMAP *bitmap) +void _al_convert_to_display_bitmap(A5O_BITMAP *bitmap) { - ALLEGRO_STATE backup; + A5O_STATE backup; int bitmap_flags = al_get_bitmap_flags(bitmap); /* Do nothing if it is a display bitmap already. */ - if (!(bitmap_flags & ALLEGRO_MEMORY_BITMAP)) + if (!(bitmap_flags & A5O_MEMORY_BITMAP)) return; - ALLEGRO_DEBUG("converting memory bitmap %p to display bitmap\n", bitmap); + A5O_DEBUG("converting memory bitmap %p to display bitmap\n", bitmap); - al_store_state(&backup, ALLEGRO_STATE_NEW_BITMAP_PARAMETERS); - al_set_new_bitmap_flags(bitmap_flags & ~ALLEGRO_MEMORY_BITMAP); + al_store_state(&backup, A5O_STATE_NEW_BITMAP_PARAMETERS); + al_set_new_bitmap_flags(bitmap_flags & ~A5O_MEMORY_BITMAP); al_set_new_bitmap_format(al_get_bitmap_format(bitmap)); al_convert_bitmap(bitmap); al_restore_state(&backup); @@ -297,18 +297,18 @@ void _al_convert_to_display_bitmap(ALLEGRO_BITMAP *bitmap) /* Converts a display bitmap to a memory bitmap preserving its contents. * If this is called for a sub-bitmap, the parent also is converted. */ -void _al_convert_to_memory_bitmap(ALLEGRO_BITMAP *bitmap) +void _al_convert_to_memory_bitmap(A5O_BITMAP *bitmap) { - ALLEGRO_STATE backup; + A5O_STATE backup; int bitmap_flags = al_get_bitmap_flags(bitmap); /* Do nothing if it is a memory bitmap already. */ - if (bitmap_flags & ALLEGRO_MEMORY_BITMAP) + if (bitmap_flags & A5O_MEMORY_BITMAP) return; - ALLEGRO_DEBUG("converting display bitmap %p to memory bitmap\n", bitmap); + A5O_DEBUG("converting display bitmap %p to memory bitmap\n", bitmap); - al_store_state(&backup, ALLEGRO_STATE_NEW_BITMAP_PARAMETERS); - al_set_new_bitmap_flags((bitmap_flags & ~ALLEGRO_VIDEO_BITMAP) | ALLEGRO_MEMORY_BITMAP); + al_store_state(&backup, A5O_STATE_NEW_BITMAP_PARAMETERS); + al_set_new_bitmap_flags((bitmap_flags & ~A5O_VIDEO_BITMAP) | A5O_MEMORY_BITMAP); al_set_new_bitmap_format(al_get_bitmap_format(bitmap)); al_convert_bitmap(bitmap); al_restore_state(&backup); diff --git a/src/blenders.c b/src/blenders.c index bd6a24183b..b52dfb6eab 100644 --- a/src/blenders.c +++ b/src/blenders.c @@ -22,12 +22,12 @@ #include "allegro5/internal/aintern_display.h" #include -void _al_blend_memory(ALLEGRO_COLOR *scol, - ALLEGRO_BITMAP *dest, - int dx, int dy, ALLEGRO_COLOR *result) +void _al_blend_memory(A5O_COLOR *scol, + A5O_BITMAP *dest, + int dx, int dy, A5O_COLOR *result) { - ALLEGRO_COLOR dcol; - ALLEGRO_COLOR constcol; + A5O_COLOR dcol; + A5O_COLOR constcol; int op, src_blend, dest_blend, alpha_op, alpha_src_blend, alpha_dest_blend; dcol = al_get_pixel(dest, dx, dy); al_get_separate_bitmap_blender(&op, &src_blend, &dest_blend, diff --git a/src/clipboard.c b/src/clipboard.c index 7425a4e3b2..e6d65718af 100644 --- a/src/clipboard.c +++ b/src/clipboard.c @@ -26,7 +26,7 @@ /* Function: al_get_clipboard_text */ -char *al_get_clipboard_text(ALLEGRO_DISPLAY *display) +char *al_get_clipboard_text(A5O_DISPLAY *display) { if (!display) display = al_get_current_display(); @@ -43,7 +43,7 @@ char *al_get_clipboard_text(ALLEGRO_DISPLAY *display) /* Function: al_set_clipboard_text */ -bool al_set_clipboard_text(ALLEGRO_DISPLAY *display, const char *text) +bool al_set_clipboard_text(A5O_DISPLAY *display, const char *text) { if (!display) display = al_get_current_display(); @@ -61,7 +61,7 @@ bool al_set_clipboard_text(ALLEGRO_DISPLAY *display, const char *text) /* Function: al_clipboard_has_text */ -bool al_clipboard_has_text(ALLEGRO_DISPLAY *display) +bool al_clipboard_has_text(A5O_DISPLAY *display) { if (!display) display = al_get_current_display(); diff --git a/src/config.c b/src/config.c index 1848d5e753..54745eb2e2 100644 --- a/src/config.c +++ b/src/config.c @@ -34,31 +34,31 @@ static int cmp_ustr(void const *a, void const *b) /* Function: al_create_config */ -ALLEGRO_CONFIG *al_create_config(void) +A5O_CONFIG *al_create_config(void) { - ALLEGRO_CONFIG *config = al_calloc(1, sizeof(ALLEGRO_CONFIG)); + A5O_CONFIG *config = al_calloc(1, sizeof(A5O_CONFIG)); ASSERT(config); return config; } -static ALLEGRO_CONFIG_SECTION *find_section(const ALLEGRO_CONFIG *config, - const ALLEGRO_USTR *section) +static A5O_CONFIG_SECTION *find_section(const A5O_CONFIG *config, + const A5O_USTR *section) { return _al_aa_search(config->tree, section, cmp_ustr); } -static ALLEGRO_CONFIG_ENTRY *find_entry(const ALLEGRO_CONFIG_SECTION *section, - const ALLEGRO_USTR *key) +static A5O_CONFIG_ENTRY *find_entry(const A5O_CONFIG_SECTION *section, + const A5O_USTR *key) { return _al_aa_search(section->tree, key, cmp_ustr); } -static void get_key_and_value(const ALLEGRO_USTR *buf, - ALLEGRO_USTR *key, ALLEGRO_USTR *value) +static void get_key_and_value(const A5O_USTR *buf, + A5O_USTR *key, A5O_USTR *value) { int eq = al_ustr_find_chr(buf, 0, '='); @@ -76,16 +76,16 @@ static void get_key_and_value(const ALLEGRO_USTR *buf, } -static ALLEGRO_CONFIG_SECTION *config_add_section(ALLEGRO_CONFIG *config, - const ALLEGRO_USTR *name) +static A5O_CONFIG_SECTION *config_add_section(A5O_CONFIG *config, + const A5O_USTR *name) { - ALLEGRO_CONFIG_SECTION *sec = config->head; - ALLEGRO_CONFIG_SECTION *section; + A5O_CONFIG_SECTION *sec = config->head; + A5O_CONFIG_SECTION *section; if ((section = find_section(config, name))) return section; - section = al_calloc(1, sizeof(ALLEGRO_CONFIG_SECTION)); + section = al_calloc(1, sizeof(A5O_CONFIG_SECTION)); section->name = al_ustr_dup(name); if (sec == NULL) { @@ -107,22 +107,22 @@ static ALLEGRO_CONFIG_SECTION *config_add_section(ALLEGRO_CONFIG *config, /* Function: al_add_config_section */ -void al_add_config_section(ALLEGRO_CONFIG *config, const char *name) +void al_add_config_section(A5O_CONFIG *config, const char *name) { - ALLEGRO_USTR_INFO name_info; - const ALLEGRO_USTR *uname; + A5O_USTR_INFO name_info; + const A5O_USTR *uname; uname = al_ref_cstr(&name_info, name); config_add_section(config, uname); } -static void config_set_value(ALLEGRO_CONFIG *config, - const ALLEGRO_USTR *section, const ALLEGRO_USTR *key, - const ALLEGRO_USTR *value) +static void config_set_value(A5O_CONFIG *config, + const A5O_USTR *section, const A5O_USTR *key, + const A5O_USTR *value) { - ALLEGRO_CONFIG_SECTION *s; - ALLEGRO_CONFIG_ENTRY *entry; + A5O_CONFIG_SECTION *s; + A5O_CONFIG_ENTRY *entry; s = find_section(config, section); if (s) { @@ -134,7 +134,7 @@ static void config_set_value(ALLEGRO_CONFIG *config, } } - entry = al_calloc(1, sizeof(ALLEGRO_CONFIG_ENTRY)); + entry = al_calloc(1, sizeof(A5O_CONFIG_ENTRY)); entry->is_comment = false; entry->key = al_ustr_dup(key); entry->value = al_ustr_dup(value); @@ -161,15 +161,15 @@ static void config_set_value(ALLEGRO_CONFIG *config, /* Function: al_set_config_value */ -void al_set_config_value(ALLEGRO_CONFIG *config, +void al_set_config_value(A5O_CONFIG *config, const char *section, const char *key, const char *value) { - ALLEGRO_USTR_INFO section_info; - ALLEGRO_USTR_INFO key_info; - ALLEGRO_USTR_INFO value_info; - const ALLEGRO_USTR *usection; - const ALLEGRO_USTR *ukey; - const ALLEGRO_USTR *uvalue; + A5O_USTR_INFO section_info; + A5O_USTR_INFO key_info; + A5O_USTR_INFO value_info; + const A5O_USTR *usection; + const A5O_USTR *ukey; + const A5O_USTR *uvalue; if (section == NULL) { section = ""; @@ -186,15 +186,15 @@ void al_set_config_value(ALLEGRO_CONFIG *config, } -static void config_add_comment(ALLEGRO_CONFIG *config, - const ALLEGRO_USTR *section, const ALLEGRO_USTR *comment) +static void config_add_comment(A5O_CONFIG *config, + const A5O_USTR *section, const A5O_USTR *comment) { - ALLEGRO_CONFIG_SECTION *s; - ALLEGRO_CONFIG_ENTRY *entry; + A5O_CONFIG_SECTION *s; + A5O_CONFIG_ENTRY *entry; s = find_section(config, section); - entry = al_calloc(1, sizeof(ALLEGRO_CONFIG_ENTRY)); + entry = al_calloc(1, sizeof(A5O_CONFIG_ENTRY)); entry->is_comment = true; entry->key = al_ustr_dup(comment); @@ -222,13 +222,13 @@ static void config_add_comment(ALLEGRO_CONFIG *config, /* Function: al_add_config_comment */ -void al_add_config_comment(ALLEGRO_CONFIG *config, +void al_add_config_comment(A5O_CONFIG *config, const char *section, const char *comment) { - ALLEGRO_USTR_INFO section_info; - ALLEGRO_USTR_INFO comment_info; - const ALLEGRO_USTR *usection; - const ALLEGRO_USTR *ucomment; + A5O_USTR_INFO section_info; + A5O_USTR_INFO comment_info; + const A5O_USTR *usection; + const A5O_USTR *ucomment; if (section == NULL) { section = ""; @@ -243,12 +243,12 @@ void al_add_config_comment(ALLEGRO_CONFIG *config, } -static bool config_get_value(const ALLEGRO_CONFIG *config, - const ALLEGRO_USTR *section, const ALLEGRO_USTR *key, - const ALLEGRO_USTR **ret_value) +static bool config_get_value(const A5O_CONFIG *config, + const A5O_USTR *section, const A5O_USTR *key, + const A5O_USTR **ret_value) { - ALLEGRO_CONFIG_SECTION *s; - ALLEGRO_CONFIG_ENTRY *e; + A5O_CONFIG_SECTION *s; + A5O_CONFIG_ENTRY *e; s = find_section(config, section); if (!s) @@ -265,14 +265,14 @@ static bool config_get_value(const ALLEGRO_CONFIG *config, /* Function: al_get_config_value */ -const char *al_get_config_value(const ALLEGRO_CONFIG *config, +const char *al_get_config_value(const A5O_CONFIG *config, const char *section, const char *key) { - ALLEGRO_USTR_INFO section_info; - ALLEGRO_USTR_INFO key_info; - const ALLEGRO_USTR *usection; - const ALLEGRO_USTR *ukey; - const ALLEGRO_USTR *value; + A5O_USTR_INFO section_info; + A5O_USTR_INFO key_info; + const A5O_USTR *usection; + const A5O_USTR *ukey; + const A5O_USTR *value; if (section == NULL) { section = ""; @@ -288,7 +288,7 @@ const char *al_get_config_value(const ALLEGRO_CONFIG *config, } -static bool readline(ALLEGRO_FILE *file, ALLEGRO_USTR *line) +static bool readline(A5O_FILE *file, A5O_USTR *line) { char buf[128]; @@ -308,10 +308,10 @@ static bool readline(ALLEGRO_FILE *file, ALLEGRO_USTR *line) /* Function: al_load_config_file */ -ALLEGRO_CONFIG *al_load_config_file(const char *filename) +A5O_CONFIG *al_load_config_file(const char *filename) { - ALLEGRO_FILE *file; - ALLEGRO_CONFIG *cfg = NULL; + A5O_FILE *file; + A5O_CONFIG *cfg = NULL; file = al_fopen(filename, "r"); if (file) { @@ -325,14 +325,14 @@ ALLEGRO_CONFIG *al_load_config_file(const char *filename) /* Function: al_load_config_file_f */ -ALLEGRO_CONFIG *al_load_config_file_f(ALLEGRO_FILE *file) +A5O_CONFIG *al_load_config_file_f(A5O_FILE *file) { - ALLEGRO_CONFIG *config; - ALLEGRO_CONFIG_SECTION *current_section = NULL; - ALLEGRO_USTR *line; - ALLEGRO_USTR *section; - ALLEGRO_USTR *key; - ALLEGRO_USTR *value; + A5O_CONFIG *config; + A5O_CONFIG_SECTION *current_section = NULL; + A5O_USTR *line; + A5O_USTR *section; + A5O_USTR *key; + A5O_USTR *value; ASSERT(file); config = al_create_config(); @@ -353,7 +353,7 @@ ALLEGRO_CONFIG *al_load_config_file_f(ALLEGRO_FILE *file) if (al_ustr_has_prefix_cstr(line, "#") || al_ustr_size(line) == 0) { /* Preserve comments and blank lines */ - const ALLEGRO_USTR *name; + const A5O_USTR *name; if (current_section) name = current_section->name; else @@ -385,10 +385,10 @@ ALLEGRO_CONFIG *al_load_config_file_f(ALLEGRO_FILE *file) } -static bool config_write_section(ALLEGRO_FILE *file, - const ALLEGRO_CONFIG_SECTION *s) +static bool config_write_section(A5O_FILE *file, + const A5O_CONFIG_SECTION *s) { - ALLEGRO_CONFIG_ENTRY *e; + A5O_CONFIG_ENTRY *e; if (al_ustr_size(s->name) > 0) { al_fputc(file, '['); @@ -429,9 +429,9 @@ static bool config_write_section(ALLEGRO_FILE *file, /* Function: al_save_config_file */ -bool al_save_config_file(const char *filename, const ALLEGRO_CONFIG *config) +bool al_save_config_file(const char *filename, const A5O_CONFIG *config) { - ALLEGRO_FILE *file; + A5O_FILE *file; file = al_fopen(filename, "w"); if (file) { @@ -446,9 +446,9 @@ bool al_save_config_file(const char *filename, const ALLEGRO_CONFIG *config) /* Function: al_save_config_file_f */ -bool al_save_config_file_f(ALLEGRO_FILE *file, const ALLEGRO_CONFIG *config) +bool al_save_config_file_f(A5O_FILE *file, const A5O_CONFIG *config) { - ALLEGRO_CONFIG_SECTION *s; + A5O_CONFIG_SECTION *s; /* Save global section */ s = config->head; @@ -480,11 +480,11 @@ bool al_save_config_file_f(ALLEGRO_FILE *file, const ALLEGRO_CONFIG *config) /* do_config_merge_into: * Helper function for merging. */ -static void do_config_merge_into(ALLEGRO_CONFIG *master, - const ALLEGRO_CONFIG *add, bool merge_comments) +static void do_config_merge_into(A5O_CONFIG *master, + const A5O_CONFIG *add, bool merge_comments) { - ALLEGRO_CONFIG_SECTION *s; - ALLEGRO_CONFIG_ENTRY *e; + A5O_CONFIG_SECTION *s; + A5O_CONFIG_ENTRY *e; ASSERT(master); if (!add) { @@ -512,7 +512,7 @@ static void do_config_merge_into(ALLEGRO_CONFIG *master, /* Function: al_merge_config_into */ -void al_merge_config_into(ALLEGRO_CONFIG *master, const ALLEGRO_CONFIG *add) +void al_merge_config_into(A5O_CONFIG *master, const A5O_CONFIG *add) { do_config_merge_into(master, add, false); } @@ -520,10 +520,10 @@ void al_merge_config_into(ALLEGRO_CONFIG *master, const ALLEGRO_CONFIG *add) /* Function: al_merge_config */ -ALLEGRO_CONFIG *al_merge_config(const ALLEGRO_CONFIG *cfg1, - const ALLEGRO_CONFIG *cfg2) +A5O_CONFIG *al_merge_config(const A5O_CONFIG *cfg1, + const A5O_CONFIG *cfg2) { - ALLEGRO_CONFIG *config = al_create_config(); + A5O_CONFIG *config = al_create_config(); do_config_merge_into(config, cfg1, true); do_config_merge_into(config, cfg2, false); @@ -532,7 +532,7 @@ ALLEGRO_CONFIG *al_merge_config(const ALLEGRO_CONFIG *cfg1, } -static void destroy_entry(ALLEGRO_CONFIG_ENTRY *e) +static void destroy_entry(A5O_CONFIG_ENTRY *e) { al_ustr_free(e->key); al_ustr_free(e->value); @@ -540,11 +540,11 @@ static void destroy_entry(ALLEGRO_CONFIG_ENTRY *e) } -static void destroy_section(ALLEGRO_CONFIG_SECTION *s) +static void destroy_section(A5O_CONFIG_SECTION *s) { - ALLEGRO_CONFIG_ENTRY *e = s->head; + A5O_CONFIG_ENTRY *e = s->head; while (e) { - ALLEGRO_CONFIG_ENTRY *tmp = e->next; + A5O_CONFIG_ENTRY *tmp = e->next; destroy_entry(e); e = tmp; } @@ -556,9 +556,9 @@ static void destroy_section(ALLEGRO_CONFIG_SECTION *s) /* Function: al_destroy_config */ -void al_destroy_config(ALLEGRO_CONFIG *config) +void al_destroy_config(A5O_CONFIG *config) { - ALLEGRO_CONFIG_SECTION *s; + A5O_CONFIG_SECTION *s; if (!config) { return; @@ -566,7 +566,7 @@ void al_destroy_config(ALLEGRO_CONFIG *config) s = config->head; while (s) { - ALLEGRO_CONFIG_SECTION *tmp = s->next; + A5O_CONFIG_SECTION *tmp = s->next; destroy_section(s); s = tmp; } @@ -578,10 +578,10 @@ void al_destroy_config(ALLEGRO_CONFIG *config) /* Function: al_get_first_config_section */ -char const *al_get_first_config_section(ALLEGRO_CONFIG const *config, - ALLEGRO_CONFIG_SECTION **iterator) +char const *al_get_first_config_section(A5O_CONFIG const *config, + A5O_CONFIG_SECTION **iterator) { - ALLEGRO_CONFIG_SECTION *s; + A5O_CONFIG_SECTION *s; if (!config) return NULL; @@ -593,9 +593,9 @@ char const *al_get_first_config_section(ALLEGRO_CONFIG const *config, /* Function: al_get_next_config_section */ -char const *al_get_next_config_section(ALLEGRO_CONFIG_SECTION **iterator) +char const *al_get_next_config_section(A5O_CONFIG_SECTION **iterator) { - ALLEGRO_CONFIG_SECTION *s; + A5O_CONFIG_SECTION *s; if (!iterator) return NULL; @@ -609,13 +609,13 @@ char const *al_get_next_config_section(ALLEGRO_CONFIG_SECTION **iterator) /* Function: al_get_first_config_entry */ -char const *al_get_first_config_entry(ALLEGRO_CONFIG const *config, - char const *section, ALLEGRO_CONFIG_ENTRY **iterator) +char const *al_get_first_config_entry(A5O_CONFIG const *config, + char const *section, A5O_CONFIG_ENTRY **iterator) { - ALLEGRO_USTR_INFO section_info; - const ALLEGRO_USTR *usection; - ALLEGRO_CONFIG_SECTION *s; - ALLEGRO_CONFIG_ENTRY *e; + A5O_USTR_INFO section_info; + const A5O_USTR *usection; + A5O_CONFIG_SECTION *s; + A5O_CONFIG_ENTRY *e; if (!config) return NULL; @@ -637,9 +637,9 @@ char const *al_get_first_config_entry(ALLEGRO_CONFIG const *config, /* Function: al_get_next_config_entry */ -char const *al_get_next_config_entry(ALLEGRO_CONFIG_ENTRY **iterator) +char const *al_get_next_config_entry(A5O_CONFIG_ENTRY **iterator) { - ALLEGRO_CONFIG_ENTRY *e; + A5O_CONFIG_ENTRY *e; if (!iterator) return NULL; @@ -655,12 +655,12 @@ char const *al_get_next_config_entry(ALLEGRO_CONFIG_ENTRY **iterator) /* Function: al_remove_config_section */ -bool al_remove_config_section(ALLEGRO_CONFIG *config, char const *section) +bool al_remove_config_section(A5O_CONFIG *config, char const *section) { - ALLEGRO_USTR_INFO section_info; - ALLEGRO_USTR const *usection; + A5O_USTR_INFO section_info; + A5O_USTR const *usection; void *value; - ALLEGRO_CONFIG_SECTION *s; + A5O_CONFIG_SECTION *s; if (section == NULL) section = ""; @@ -697,22 +697,22 @@ bool al_remove_config_section(ALLEGRO_CONFIG *config, char const *section) /* Function: al_remove_config_key */ -bool al_remove_config_key(ALLEGRO_CONFIG *config, char const *section, +bool al_remove_config_key(A5O_CONFIG *config, char const *section, char const *key) { - ALLEGRO_USTR_INFO section_info; - ALLEGRO_USTR_INFO key_info; - ALLEGRO_USTR const *usection; - ALLEGRO_USTR const *ukey = al_ref_cstr(&key_info, key); + A5O_USTR_INFO section_info; + A5O_USTR_INFO key_info; + A5O_USTR const *usection; + A5O_USTR const *ukey = al_ref_cstr(&key_info, key); void *value; - ALLEGRO_CONFIG_ENTRY * e; + A5O_CONFIG_ENTRY * e; if (section == NULL) section = ""; usection = al_ref_cstr(§ion_info, section); - ALLEGRO_CONFIG_SECTION *s = find_section(config, usection); + A5O_CONFIG_SECTION *s = find_section(config, usection); if (!s) return false; diff --git a/src/convert.c b/src/convert.c index 73eda47a76..435c7c1022 100644 --- a/src/convert.c +++ b/src/convert.c @@ -16,7 +16,7 @@ static void argb_8888_to_rgba_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_8888_TO_RGBA_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_8888_TO_RGBA_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -38,7 +38,7 @@ static void argb_8888_to_argb_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_8888_TO_ARGB_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_8888_TO_ARGB_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -60,8 +60,8 @@ static void argb_8888_to_rgb_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_ARGB_8888_TO_RGB_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_ARGB_8888_TO_RGB_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -91,7 +91,7 @@ static void argb_8888_to_rgb_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_8888_TO_RGB_565(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_8888_TO_RGB_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -113,7 +113,7 @@ static void argb_8888_to_rgb_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_8888_TO_RGB_555(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_8888_TO_RGB_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -135,7 +135,7 @@ static void argb_8888_to_rgba_5551(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_8888_TO_RGBA_5551(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_8888_TO_RGBA_5551(*src_ptr); dst_ptr++; src_ptr++; } @@ -157,7 +157,7 @@ static void argb_8888_to_argb_1555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_8888_TO_ARGB_1555(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_8888_TO_ARGB_1555(*src_ptr); dst_ptr++; src_ptr++; } @@ -179,7 +179,7 @@ static void argb_8888_to_abgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_8888_TO_ABGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_8888_TO_ABGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -201,7 +201,7 @@ static void argb_8888_to_xbgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_8888_TO_XBGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_8888_TO_XBGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -223,8 +223,8 @@ static void argb_8888_to_bgr_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_ARGB_8888_TO_BGR_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_ARGB_8888_TO_BGR_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -254,7 +254,7 @@ static void argb_8888_to_bgr_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_8888_TO_BGR_565(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_8888_TO_BGR_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -276,7 +276,7 @@ static void argb_8888_to_bgr_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_8888_TO_BGR_555(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_8888_TO_BGR_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -298,7 +298,7 @@ static void argb_8888_to_rgbx_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_8888_TO_RGBX_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_8888_TO_RGBX_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -320,7 +320,7 @@ static void argb_8888_to_xrgb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_8888_TO_XRGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_8888_TO_XRGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -334,15 +334,15 @@ static void argb_8888_to_abgr_f32(const void *src, int src_pitch, { int y; const uint32_t *src_ptr = (const uint32_t *)((const char *)src + sy * src_pitch); - ALLEGRO_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); + A5O_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 4 - width; int dst_gap = dst_pitch / 16 - width; src_ptr += sx; dst_ptr += dx; for (y = 0; y < height; y++) { - ALLEGRO_COLOR *dst_end = dst_ptr + width; + A5O_COLOR *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_8888_TO_ABGR_F32(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_8888_TO_ABGR_F32(*src_ptr); dst_ptr++; src_ptr++; } @@ -364,7 +364,7 @@ static void argb_8888_to_abgr_8888_le(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_8888_TO_ABGR_8888_LE(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_8888_TO_ABGR_8888_LE(*src_ptr); dst_ptr++; src_ptr++; } @@ -386,7 +386,7 @@ static void argb_8888_to_rgba_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_8888_TO_RGBA_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_8888_TO_RGBA_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -408,7 +408,7 @@ static void argb_8888_to_single_channel_8(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_8888_TO_SINGLE_CHANNEL_8(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_8888_TO_SINGLE_CHANNEL_8(*src_ptr); dst_ptr++; src_ptr++; } @@ -430,7 +430,7 @@ static void rgba_8888_to_argb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_8888_TO_ARGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_8888_TO_ARGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -452,7 +452,7 @@ static void rgba_8888_to_argb_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_8888_TO_ARGB_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_8888_TO_ARGB_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -474,8 +474,8 @@ static void rgba_8888_to_rgb_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_RGBA_8888_TO_RGB_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_RGBA_8888_TO_RGB_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -505,7 +505,7 @@ static void rgba_8888_to_rgb_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_8888_TO_RGB_565(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_8888_TO_RGB_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -527,7 +527,7 @@ static void rgba_8888_to_rgb_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_8888_TO_RGB_555(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_8888_TO_RGB_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -549,7 +549,7 @@ static void rgba_8888_to_rgba_5551(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_8888_TO_RGBA_5551(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_8888_TO_RGBA_5551(*src_ptr); dst_ptr++; src_ptr++; } @@ -571,7 +571,7 @@ static void rgba_8888_to_argb_1555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_8888_TO_ARGB_1555(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_8888_TO_ARGB_1555(*src_ptr); dst_ptr++; src_ptr++; } @@ -593,7 +593,7 @@ static void rgba_8888_to_abgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_8888_TO_ABGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_8888_TO_ABGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -615,7 +615,7 @@ static void rgba_8888_to_xbgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_8888_TO_XBGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_8888_TO_XBGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -637,8 +637,8 @@ static void rgba_8888_to_bgr_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_RGBA_8888_TO_BGR_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_RGBA_8888_TO_BGR_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -668,7 +668,7 @@ static void rgba_8888_to_bgr_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_8888_TO_BGR_565(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_8888_TO_BGR_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -690,7 +690,7 @@ static void rgba_8888_to_bgr_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_8888_TO_BGR_555(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_8888_TO_BGR_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -712,7 +712,7 @@ static void rgba_8888_to_rgbx_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_8888_TO_RGBX_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_8888_TO_RGBX_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -734,7 +734,7 @@ static void rgba_8888_to_xrgb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_8888_TO_XRGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_8888_TO_XRGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -748,15 +748,15 @@ static void rgba_8888_to_abgr_f32(const void *src, int src_pitch, { int y; const uint32_t *src_ptr = (const uint32_t *)((const char *)src + sy * src_pitch); - ALLEGRO_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); + A5O_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 4 - width; int dst_gap = dst_pitch / 16 - width; src_ptr += sx; dst_ptr += dx; for (y = 0; y < height; y++) { - ALLEGRO_COLOR *dst_end = dst_ptr + width; + A5O_COLOR *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_8888_TO_ABGR_F32(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_8888_TO_ABGR_F32(*src_ptr); dst_ptr++; src_ptr++; } @@ -778,7 +778,7 @@ static void rgba_8888_to_abgr_8888_le(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_8888_TO_ABGR_8888_LE(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_8888_TO_ABGR_8888_LE(*src_ptr); dst_ptr++; src_ptr++; } @@ -800,7 +800,7 @@ static void rgba_8888_to_rgba_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_8888_TO_RGBA_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_8888_TO_RGBA_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -822,7 +822,7 @@ static void rgba_8888_to_single_channel_8(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_8888_TO_SINGLE_CHANNEL_8(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_8888_TO_SINGLE_CHANNEL_8(*src_ptr); dst_ptr++; src_ptr++; } @@ -844,7 +844,7 @@ static void argb_4444_to_argb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_4444_TO_ARGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_4444_TO_ARGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -866,7 +866,7 @@ static void argb_4444_to_rgba_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_4444_TO_RGBA_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_4444_TO_RGBA_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -888,8 +888,8 @@ static void argb_4444_to_rgb_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_ARGB_4444_TO_RGB_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_ARGB_4444_TO_RGB_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -919,7 +919,7 @@ static void argb_4444_to_rgb_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_4444_TO_RGB_565(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_4444_TO_RGB_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -941,7 +941,7 @@ static void argb_4444_to_rgb_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_4444_TO_RGB_555(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_4444_TO_RGB_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -963,7 +963,7 @@ static void argb_4444_to_rgba_5551(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_4444_TO_RGBA_5551(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_4444_TO_RGBA_5551(*src_ptr); dst_ptr++; src_ptr++; } @@ -985,7 +985,7 @@ static void argb_4444_to_argb_1555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_4444_TO_ARGB_1555(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_4444_TO_ARGB_1555(*src_ptr); dst_ptr++; src_ptr++; } @@ -1007,7 +1007,7 @@ static void argb_4444_to_abgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_4444_TO_ABGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_4444_TO_ABGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -1029,7 +1029,7 @@ static void argb_4444_to_xbgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_4444_TO_XBGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_4444_TO_XBGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -1051,8 +1051,8 @@ static void argb_4444_to_bgr_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_ARGB_4444_TO_BGR_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_ARGB_4444_TO_BGR_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -1082,7 +1082,7 @@ static void argb_4444_to_bgr_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_4444_TO_BGR_565(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_4444_TO_BGR_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -1104,7 +1104,7 @@ static void argb_4444_to_bgr_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_4444_TO_BGR_555(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_4444_TO_BGR_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -1126,7 +1126,7 @@ static void argb_4444_to_rgbx_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_4444_TO_RGBX_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_4444_TO_RGBX_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -1148,7 +1148,7 @@ static void argb_4444_to_xrgb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_4444_TO_XRGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_4444_TO_XRGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -1162,15 +1162,15 @@ static void argb_4444_to_abgr_f32(const void *src, int src_pitch, { int y; const uint16_t *src_ptr = (const uint16_t *)((const char *)src + sy * src_pitch); - ALLEGRO_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); + A5O_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 2 - width; int dst_gap = dst_pitch / 16 - width; src_ptr += sx; dst_ptr += dx; for (y = 0; y < height; y++) { - ALLEGRO_COLOR *dst_end = dst_ptr + width; + A5O_COLOR *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_4444_TO_ABGR_F32(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_4444_TO_ABGR_F32(*src_ptr); dst_ptr++; src_ptr++; } @@ -1192,7 +1192,7 @@ static void argb_4444_to_abgr_8888_le(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_4444_TO_ABGR_8888_LE(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_4444_TO_ABGR_8888_LE(*src_ptr); dst_ptr++; src_ptr++; } @@ -1214,7 +1214,7 @@ static void argb_4444_to_rgba_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_4444_TO_RGBA_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_4444_TO_RGBA_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -1236,7 +1236,7 @@ static void argb_4444_to_single_channel_8(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_4444_TO_SINGLE_CHANNEL_8(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_4444_TO_SINGLE_CHANNEL_8(*src_ptr); dst_ptr++; src_ptr++; } @@ -1258,12 +1258,12 @@ static void rgb_888_to_argb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_RGB_888_TO_ARGB_8888(src_pixel); + *dst_ptr = A5O_CONVERT_RGB_888_TO_ARGB_8888(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -1285,12 +1285,12 @@ static void rgb_888_to_rgba_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_RGB_888_TO_RGBA_8888(src_pixel); + *dst_ptr = A5O_CONVERT_RGB_888_TO_RGBA_8888(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -1312,12 +1312,12 @@ static void rgb_888_to_argb_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_RGB_888_TO_ARGB_4444(src_pixel); + *dst_ptr = A5O_CONVERT_RGB_888_TO_ARGB_4444(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -1339,12 +1339,12 @@ static void rgb_888_to_rgb_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_RGB_888_TO_RGB_565(src_pixel); + *dst_ptr = A5O_CONVERT_RGB_888_TO_RGB_565(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -1366,12 +1366,12 @@ static void rgb_888_to_rgb_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_RGB_888_TO_RGB_555(src_pixel); + *dst_ptr = A5O_CONVERT_RGB_888_TO_RGB_555(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -1393,12 +1393,12 @@ static void rgb_888_to_rgba_5551(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_RGB_888_TO_RGBA_5551(src_pixel); + *dst_ptr = A5O_CONVERT_RGB_888_TO_RGBA_5551(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -1420,12 +1420,12 @@ static void rgb_888_to_argb_1555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_RGB_888_TO_ARGB_1555(src_pixel); + *dst_ptr = A5O_CONVERT_RGB_888_TO_ARGB_1555(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -1447,12 +1447,12 @@ static void rgb_888_to_abgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_RGB_888_TO_ABGR_8888(src_pixel); + *dst_ptr = A5O_CONVERT_RGB_888_TO_ABGR_8888(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -1474,12 +1474,12 @@ static void rgb_888_to_xbgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_RGB_888_TO_XBGR_8888(src_pixel); + *dst_ptr = A5O_CONVERT_RGB_888_TO_XBGR_8888(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -1501,13 +1501,13 @@ static void rgb_888_to_bgr_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - int dst_pixel = ALLEGRO_CONVERT_RGB_888_TO_BGR_888(src_pixel); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_RGB_888_TO_BGR_888(src_pixel); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -1537,12 +1537,12 @@ static void rgb_888_to_bgr_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_RGB_888_TO_BGR_565(src_pixel); + *dst_ptr = A5O_CONVERT_RGB_888_TO_BGR_565(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -1564,12 +1564,12 @@ static void rgb_888_to_bgr_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_RGB_888_TO_BGR_555(src_pixel); + *dst_ptr = A5O_CONVERT_RGB_888_TO_BGR_555(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -1591,12 +1591,12 @@ static void rgb_888_to_rgbx_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_RGB_888_TO_RGBX_8888(src_pixel); + *dst_ptr = A5O_CONVERT_RGB_888_TO_RGBX_8888(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -1618,12 +1618,12 @@ static void rgb_888_to_xrgb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_RGB_888_TO_XRGB_8888(src_pixel); + *dst_ptr = A5O_CONVERT_RGB_888_TO_XRGB_8888(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -1637,20 +1637,20 @@ static void rgb_888_to_abgr_f32(const void *src, int src_pitch, { int y; const uint8_t *src_ptr = (const uint8_t *)((const char *)src + sy * src_pitch); - ALLEGRO_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); + A5O_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 1 - width * 3; int dst_gap = dst_pitch / 16 - width; src_ptr += sx * 3; dst_ptr += dx; for (y = 0; y < height; y++) { - ALLEGRO_COLOR *dst_end = dst_ptr + width; + A5O_COLOR *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_RGB_888_TO_ABGR_F32(src_pixel); + *dst_ptr = A5O_CONVERT_RGB_888_TO_ABGR_F32(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -1672,12 +1672,12 @@ static void rgb_888_to_abgr_8888_le(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_RGB_888_TO_ABGR_8888_LE(src_pixel); + *dst_ptr = A5O_CONVERT_RGB_888_TO_ABGR_8888_LE(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -1699,12 +1699,12 @@ static void rgb_888_to_rgba_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_RGB_888_TO_RGBA_4444(src_pixel); + *dst_ptr = A5O_CONVERT_RGB_888_TO_RGBA_4444(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -1726,12 +1726,12 @@ static void rgb_888_to_single_channel_8(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_RGB_888_TO_SINGLE_CHANNEL_8(src_pixel); + *dst_ptr = A5O_CONVERT_RGB_888_TO_SINGLE_CHANNEL_8(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -1753,7 +1753,7 @@ static void rgb_565_to_argb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_565_TO_ARGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_565_TO_ARGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -1775,7 +1775,7 @@ static void rgb_565_to_rgba_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_565_TO_RGBA_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_565_TO_RGBA_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -1797,7 +1797,7 @@ static void rgb_565_to_argb_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_565_TO_ARGB_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_565_TO_ARGB_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -1819,8 +1819,8 @@ static void rgb_565_to_rgb_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_RGB_565_TO_RGB_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_RGB_565_TO_RGB_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -1850,7 +1850,7 @@ static void rgb_565_to_rgb_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_565_TO_RGB_555(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_565_TO_RGB_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -1872,7 +1872,7 @@ static void rgb_565_to_rgba_5551(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_565_TO_RGBA_5551(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_565_TO_RGBA_5551(*src_ptr); dst_ptr++; src_ptr++; } @@ -1894,7 +1894,7 @@ static void rgb_565_to_argb_1555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_565_TO_ARGB_1555(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_565_TO_ARGB_1555(*src_ptr); dst_ptr++; src_ptr++; } @@ -1916,7 +1916,7 @@ static void rgb_565_to_abgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_565_TO_ABGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_565_TO_ABGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -1938,7 +1938,7 @@ static void rgb_565_to_xbgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_565_TO_XBGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_565_TO_XBGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -1960,8 +1960,8 @@ static void rgb_565_to_bgr_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_RGB_565_TO_BGR_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_RGB_565_TO_BGR_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -1991,7 +1991,7 @@ static void rgb_565_to_bgr_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_565_TO_BGR_565(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_565_TO_BGR_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -2013,7 +2013,7 @@ static void rgb_565_to_bgr_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_565_TO_BGR_555(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_565_TO_BGR_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -2035,7 +2035,7 @@ static void rgb_565_to_rgbx_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_565_TO_RGBX_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_565_TO_RGBX_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -2057,7 +2057,7 @@ static void rgb_565_to_xrgb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_565_TO_XRGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_565_TO_XRGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -2071,15 +2071,15 @@ static void rgb_565_to_abgr_f32(const void *src, int src_pitch, { int y; const uint16_t *src_ptr = (const uint16_t *)((const char *)src + sy * src_pitch); - ALLEGRO_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); + A5O_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 2 - width; int dst_gap = dst_pitch / 16 - width; src_ptr += sx; dst_ptr += dx; for (y = 0; y < height; y++) { - ALLEGRO_COLOR *dst_end = dst_ptr + width; + A5O_COLOR *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_565_TO_ABGR_F32(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_565_TO_ABGR_F32(*src_ptr); dst_ptr++; src_ptr++; } @@ -2101,7 +2101,7 @@ static void rgb_565_to_abgr_8888_le(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_565_TO_ABGR_8888_LE(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_565_TO_ABGR_8888_LE(*src_ptr); dst_ptr++; src_ptr++; } @@ -2123,7 +2123,7 @@ static void rgb_565_to_rgba_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_565_TO_RGBA_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_565_TO_RGBA_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -2145,7 +2145,7 @@ static void rgb_565_to_single_channel_8(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_565_TO_SINGLE_CHANNEL_8(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_565_TO_SINGLE_CHANNEL_8(*src_ptr); dst_ptr++; src_ptr++; } @@ -2167,7 +2167,7 @@ static void rgb_555_to_argb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_555_TO_ARGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_555_TO_ARGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -2189,7 +2189,7 @@ static void rgb_555_to_rgba_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_555_TO_RGBA_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_555_TO_RGBA_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -2211,7 +2211,7 @@ static void rgb_555_to_argb_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_555_TO_ARGB_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_555_TO_ARGB_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -2233,8 +2233,8 @@ static void rgb_555_to_rgb_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_RGB_555_TO_RGB_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_RGB_555_TO_RGB_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -2264,7 +2264,7 @@ static void rgb_555_to_rgb_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_555_TO_RGB_565(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_555_TO_RGB_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -2286,7 +2286,7 @@ static void rgb_555_to_rgba_5551(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_555_TO_RGBA_5551(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_555_TO_RGBA_5551(*src_ptr); dst_ptr++; src_ptr++; } @@ -2308,7 +2308,7 @@ static void rgb_555_to_argb_1555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_555_TO_ARGB_1555(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_555_TO_ARGB_1555(*src_ptr); dst_ptr++; src_ptr++; } @@ -2330,7 +2330,7 @@ static void rgb_555_to_abgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_555_TO_ABGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_555_TO_ABGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -2352,7 +2352,7 @@ static void rgb_555_to_xbgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_555_TO_XBGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_555_TO_XBGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -2374,8 +2374,8 @@ static void rgb_555_to_bgr_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_RGB_555_TO_BGR_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_RGB_555_TO_BGR_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -2405,7 +2405,7 @@ static void rgb_555_to_bgr_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_555_TO_BGR_565(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_555_TO_BGR_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -2427,7 +2427,7 @@ static void rgb_555_to_bgr_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_555_TO_BGR_555(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_555_TO_BGR_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -2449,7 +2449,7 @@ static void rgb_555_to_rgbx_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_555_TO_RGBX_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_555_TO_RGBX_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -2471,7 +2471,7 @@ static void rgb_555_to_xrgb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_555_TO_XRGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_555_TO_XRGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -2485,15 +2485,15 @@ static void rgb_555_to_abgr_f32(const void *src, int src_pitch, { int y; const uint16_t *src_ptr = (const uint16_t *)((const char *)src + sy * src_pitch); - ALLEGRO_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); + A5O_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 2 - width; int dst_gap = dst_pitch / 16 - width; src_ptr += sx; dst_ptr += dx; for (y = 0; y < height; y++) { - ALLEGRO_COLOR *dst_end = dst_ptr + width; + A5O_COLOR *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_555_TO_ABGR_F32(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_555_TO_ABGR_F32(*src_ptr); dst_ptr++; src_ptr++; } @@ -2515,7 +2515,7 @@ static void rgb_555_to_abgr_8888_le(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_555_TO_ABGR_8888_LE(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_555_TO_ABGR_8888_LE(*src_ptr); dst_ptr++; src_ptr++; } @@ -2537,7 +2537,7 @@ static void rgb_555_to_rgba_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_555_TO_RGBA_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_555_TO_RGBA_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -2559,7 +2559,7 @@ static void rgb_555_to_single_channel_8(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGB_555_TO_SINGLE_CHANNEL_8(*src_ptr); + *dst_ptr = A5O_CONVERT_RGB_555_TO_SINGLE_CHANNEL_8(*src_ptr); dst_ptr++; src_ptr++; } @@ -2581,7 +2581,7 @@ static void rgba_5551_to_argb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_5551_TO_ARGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_5551_TO_ARGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -2603,7 +2603,7 @@ static void rgba_5551_to_rgba_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_5551_TO_RGBA_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_5551_TO_RGBA_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -2625,7 +2625,7 @@ static void rgba_5551_to_argb_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_5551_TO_ARGB_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_5551_TO_ARGB_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -2647,8 +2647,8 @@ static void rgba_5551_to_rgb_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_RGBA_5551_TO_RGB_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_RGBA_5551_TO_RGB_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -2678,7 +2678,7 @@ static void rgba_5551_to_rgb_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_5551_TO_RGB_565(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_5551_TO_RGB_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -2700,7 +2700,7 @@ static void rgba_5551_to_rgb_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_5551_TO_RGB_555(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_5551_TO_RGB_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -2722,7 +2722,7 @@ static void rgba_5551_to_argb_1555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_5551_TO_ARGB_1555(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_5551_TO_ARGB_1555(*src_ptr); dst_ptr++; src_ptr++; } @@ -2744,7 +2744,7 @@ static void rgba_5551_to_abgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_5551_TO_ABGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_5551_TO_ABGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -2766,7 +2766,7 @@ static void rgba_5551_to_xbgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_5551_TO_XBGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_5551_TO_XBGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -2788,8 +2788,8 @@ static void rgba_5551_to_bgr_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_RGBA_5551_TO_BGR_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_RGBA_5551_TO_BGR_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -2819,7 +2819,7 @@ static void rgba_5551_to_bgr_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_5551_TO_BGR_565(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_5551_TO_BGR_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -2841,7 +2841,7 @@ static void rgba_5551_to_bgr_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_5551_TO_BGR_555(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_5551_TO_BGR_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -2863,7 +2863,7 @@ static void rgba_5551_to_rgbx_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_5551_TO_RGBX_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_5551_TO_RGBX_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -2885,7 +2885,7 @@ static void rgba_5551_to_xrgb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_5551_TO_XRGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_5551_TO_XRGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -2899,15 +2899,15 @@ static void rgba_5551_to_abgr_f32(const void *src, int src_pitch, { int y; const uint16_t *src_ptr = (const uint16_t *)((const char *)src + sy * src_pitch); - ALLEGRO_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); + A5O_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 2 - width; int dst_gap = dst_pitch / 16 - width; src_ptr += sx; dst_ptr += dx; for (y = 0; y < height; y++) { - ALLEGRO_COLOR *dst_end = dst_ptr + width; + A5O_COLOR *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_5551_TO_ABGR_F32(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_5551_TO_ABGR_F32(*src_ptr); dst_ptr++; src_ptr++; } @@ -2929,7 +2929,7 @@ static void rgba_5551_to_abgr_8888_le(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_5551_TO_ABGR_8888_LE(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_5551_TO_ABGR_8888_LE(*src_ptr); dst_ptr++; src_ptr++; } @@ -2951,7 +2951,7 @@ static void rgba_5551_to_rgba_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_5551_TO_RGBA_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_5551_TO_RGBA_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -2973,7 +2973,7 @@ static void rgba_5551_to_single_channel_8(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_5551_TO_SINGLE_CHANNEL_8(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_5551_TO_SINGLE_CHANNEL_8(*src_ptr); dst_ptr++; src_ptr++; } @@ -2995,7 +2995,7 @@ static void argb_1555_to_argb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_1555_TO_ARGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_1555_TO_ARGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -3017,7 +3017,7 @@ static void argb_1555_to_rgba_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_1555_TO_RGBA_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_1555_TO_RGBA_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -3039,7 +3039,7 @@ static void argb_1555_to_argb_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_1555_TO_ARGB_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_1555_TO_ARGB_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -3061,8 +3061,8 @@ static void argb_1555_to_rgb_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_ARGB_1555_TO_RGB_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_ARGB_1555_TO_RGB_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -3092,7 +3092,7 @@ static void argb_1555_to_rgb_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_1555_TO_RGB_565(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_1555_TO_RGB_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -3114,7 +3114,7 @@ static void argb_1555_to_rgb_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_1555_TO_RGB_555(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_1555_TO_RGB_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -3136,7 +3136,7 @@ static void argb_1555_to_rgba_5551(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_1555_TO_RGBA_5551(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_1555_TO_RGBA_5551(*src_ptr); dst_ptr++; src_ptr++; } @@ -3158,7 +3158,7 @@ static void argb_1555_to_abgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_1555_TO_ABGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_1555_TO_ABGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -3180,7 +3180,7 @@ static void argb_1555_to_xbgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_1555_TO_XBGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_1555_TO_XBGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -3202,8 +3202,8 @@ static void argb_1555_to_bgr_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_ARGB_1555_TO_BGR_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_ARGB_1555_TO_BGR_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -3233,7 +3233,7 @@ static void argb_1555_to_bgr_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_1555_TO_BGR_565(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_1555_TO_BGR_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -3255,7 +3255,7 @@ static void argb_1555_to_bgr_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_1555_TO_BGR_555(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_1555_TO_BGR_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -3277,7 +3277,7 @@ static void argb_1555_to_rgbx_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_1555_TO_RGBX_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_1555_TO_RGBX_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -3299,7 +3299,7 @@ static void argb_1555_to_xrgb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_1555_TO_XRGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_1555_TO_XRGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -3313,15 +3313,15 @@ static void argb_1555_to_abgr_f32(const void *src, int src_pitch, { int y; const uint16_t *src_ptr = (const uint16_t *)((const char *)src + sy * src_pitch); - ALLEGRO_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); + A5O_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 2 - width; int dst_gap = dst_pitch / 16 - width; src_ptr += sx; dst_ptr += dx; for (y = 0; y < height; y++) { - ALLEGRO_COLOR *dst_end = dst_ptr + width; + A5O_COLOR *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_1555_TO_ABGR_F32(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_1555_TO_ABGR_F32(*src_ptr); dst_ptr++; src_ptr++; } @@ -3343,7 +3343,7 @@ static void argb_1555_to_abgr_8888_le(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_1555_TO_ABGR_8888_LE(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_1555_TO_ABGR_8888_LE(*src_ptr); dst_ptr++; src_ptr++; } @@ -3365,7 +3365,7 @@ static void argb_1555_to_rgba_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_1555_TO_RGBA_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_1555_TO_RGBA_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -3387,7 +3387,7 @@ static void argb_1555_to_single_channel_8(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ARGB_1555_TO_SINGLE_CHANNEL_8(*src_ptr); + *dst_ptr = A5O_CONVERT_ARGB_1555_TO_SINGLE_CHANNEL_8(*src_ptr); dst_ptr++; src_ptr++; } @@ -3409,7 +3409,7 @@ static void abgr_8888_to_argb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_TO_ARGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_TO_ARGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -3431,7 +3431,7 @@ static void abgr_8888_to_rgba_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_TO_RGBA_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_TO_RGBA_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -3453,7 +3453,7 @@ static void abgr_8888_to_argb_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_TO_ARGB_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_TO_ARGB_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -3475,8 +3475,8 @@ static void abgr_8888_to_rgb_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_ABGR_8888_TO_RGB_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_ABGR_8888_TO_RGB_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -3506,7 +3506,7 @@ static void abgr_8888_to_rgb_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_TO_RGB_565(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_TO_RGB_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -3528,7 +3528,7 @@ static void abgr_8888_to_rgb_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_TO_RGB_555(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_TO_RGB_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -3550,7 +3550,7 @@ static void abgr_8888_to_rgba_5551(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_TO_RGBA_5551(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_TO_RGBA_5551(*src_ptr); dst_ptr++; src_ptr++; } @@ -3572,7 +3572,7 @@ static void abgr_8888_to_argb_1555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_TO_ARGB_1555(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_TO_ARGB_1555(*src_ptr); dst_ptr++; src_ptr++; } @@ -3594,7 +3594,7 @@ static void abgr_8888_to_xbgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_TO_XBGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_TO_XBGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -3616,8 +3616,8 @@ static void abgr_8888_to_bgr_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_ABGR_8888_TO_BGR_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_ABGR_8888_TO_BGR_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -3647,7 +3647,7 @@ static void abgr_8888_to_bgr_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_TO_BGR_565(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_TO_BGR_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -3669,7 +3669,7 @@ static void abgr_8888_to_bgr_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_TO_BGR_555(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_TO_BGR_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -3691,7 +3691,7 @@ static void abgr_8888_to_rgbx_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_TO_RGBX_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_TO_RGBX_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -3713,7 +3713,7 @@ static void abgr_8888_to_xrgb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_TO_XRGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_TO_XRGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -3727,15 +3727,15 @@ static void abgr_8888_to_abgr_f32(const void *src, int src_pitch, { int y; const uint32_t *src_ptr = (const uint32_t *)((const char *)src + sy * src_pitch); - ALLEGRO_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); + A5O_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 4 - width; int dst_gap = dst_pitch / 16 - width; src_ptr += sx; dst_ptr += dx; for (y = 0; y < height; y++) { - ALLEGRO_COLOR *dst_end = dst_ptr + width; + A5O_COLOR *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_TO_ABGR_F32(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_TO_ABGR_F32(*src_ptr); dst_ptr++; src_ptr++; } @@ -3757,7 +3757,7 @@ static void abgr_8888_to_abgr_8888_le(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_TO_ABGR_8888_LE(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_TO_ABGR_8888_LE(*src_ptr); dst_ptr++; src_ptr++; } @@ -3779,7 +3779,7 @@ static void abgr_8888_to_rgba_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_TO_RGBA_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_TO_RGBA_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -3801,7 +3801,7 @@ static void abgr_8888_to_single_channel_8(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_TO_SINGLE_CHANNEL_8(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_TO_SINGLE_CHANNEL_8(*src_ptr); dst_ptr++; src_ptr++; } @@ -3823,7 +3823,7 @@ static void xbgr_8888_to_argb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XBGR_8888_TO_ARGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_XBGR_8888_TO_ARGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -3845,7 +3845,7 @@ static void xbgr_8888_to_rgba_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XBGR_8888_TO_RGBA_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_XBGR_8888_TO_RGBA_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -3867,7 +3867,7 @@ static void xbgr_8888_to_argb_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XBGR_8888_TO_ARGB_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_XBGR_8888_TO_ARGB_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -3889,8 +3889,8 @@ static void xbgr_8888_to_rgb_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_XBGR_8888_TO_RGB_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_XBGR_8888_TO_RGB_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -3920,7 +3920,7 @@ static void xbgr_8888_to_rgb_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XBGR_8888_TO_RGB_565(*src_ptr); + *dst_ptr = A5O_CONVERT_XBGR_8888_TO_RGB_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -3942,7 +3942,7 @@ static void xbgr_8888_to_rgb_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XBGR_8888_TO_RGB_555(*src_ptr); + *dst_ptr = A5O_CONVERT_XBGR_8888_TO_RGB_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -3964,7 +3964,7 @@ static void xbgr_8888_to_rgba_5551(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XBGR_8888_TO_RGBA_5551(*src_ptr); + *dst_ptr = A5O_CONVERT_XBGR_8888_TO_RGBA_5551(*src_ptr); dst_ptr++; src_ptr++; } @@ -3986,7 +3986,7 @@ static void xbgr_8888_to_argb_1555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XBGR_8888_TO_ARGB_1555(*src_ptr); + *dst_ptr = A5O_CONVERT_XBGR_8888_TO_ARGB_1555(*src_ptr); dst_ptr++; src_ptr++; } @@ -4008,7 +4008,7 @@ static void xbgr_8888_to_abgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XBGR_8888_TO_ABGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_XBGR_8888_TO_ABGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -4030,8 +4030,8 @@ static void xbgr_8888_to_bgr_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_XBGR_8888_TO_BGR_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_XBGR_8888_TO_BGR_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -4061,7 +4061,7 @@ static void xbgr_8888_to_bgr_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XBGR_8888_TO_BGR_565(*src_ptr); + *dst_ptr = A5O_CONVERT_XBGR_8888_TO_BGR_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -4083,7 +4083,7 @@ static void xbgr_8888_to_bgr_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XBGR_8888_TO_BGR_555(*src_ptr); + *dst_ptr = A5O_CONVERT_XBGR_8888_TO_BGR_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -4105,7 +4105,7 @@ static void xbgr_8888_to_rgbx_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XBGR_8888_TO_RGBX_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_XBGR_8888_TO_RGBX_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -4127,7 +4127,7 @@ static void xbgr_8888_to_xrgb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XBGR_8888_TO_XRGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_XBGR_8888_TO_XRGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -4141,15 +4141,15 @@ static void xbgr_8888_to_abgr_f32(const void *src, int src_pitch, { int y; const uint32_t *src_ptr = (const uint32_t *)((const char *)src + sy * src_pitch); - ALLEGRO_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); + A5O_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 4 - width; int dst_gap = dst_pitch / 16 - width; src_ptr += sx; dst_ptr += dx; for (y = 0; y < height; y++) { - ALLEGRO_COLOR *dst_end = dst_ptr + width; + A5O_COLOR *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XBGR_8888_TO_ABGR_F32(*src_ptr); + *dst_ptr = A5O_CONVERT_XBGR_8888_TO_ABGR_F32(*src_ptr); dst_ptr++; src_ptr++; } @@ -4171,7 +4171,7 @@ static void xbgr_8888_to_abgr_8888_le(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XBGR_8888_TO_ABGR_8888_LE(*src_ptr); + *dst_ptr = A5O_CONVERT_XBGR_8888_TO_ABGR_8888_LE(*src_ptr); dst_ptr++; src_ptr++; } @@ -4193,7 +4193,7 @@ static void xbgr_8888_to_rgba_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XBGR_8888_TO_RGBA_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_XBGR_8888_TO_RGBA_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -4215,7 +4215,7 @@ static void xbgr_8888_to_single_channel_8(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XBGR_8888_TO_SINGLE_CHANNEL_8(*src_ptr); + *dst_ptr = A5O_CONVERT_XBGR_8888_TO_SINGLE_CHANNEL_8(*src_ptr); dst_ptr++; src_ptr++; } @@ -4237,12 +4237,12 @@ static void bgr_888_to_argb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_BGR_888_TO_ARGB_8888(src_pixel); + *dst_ptr = A5O_CONVERT_BGR_888_TO_ARGB_8888(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -4264,12 +4264,12 @@ static void bgr_888_to_rgba_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_BGR_888_TO_RGBA_8888(src_pixel); + *dst_ptr = A5O_CONVERT_BGR_888_TO_RGBA_8888(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -4291,12 +4291,12 @@ static void bgr_888_to_argb_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_BGR_888_TO_ARGB_4444(src_pixel); + *dst_ptr = A5O_CONVERT_BGR_888_TO_ARGB_4444(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -4318,13 +4318,13 @@ static void bgr_888_to_rgb_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - int dst_pixel = ALLEGRO_CONVERT_BGR_888_TO_RGB_888(src_pixel); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_BGR_888_TO_RGB_888(src_pixel); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -4354,12 +4354,12 @@ static void bgr_888_to_rgb_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_BGR_888_TO_RGB_565(src_pixel); + *dst_ptr = A5O_CONVERT_BGR_888_TO_RGB_565(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -4381,12 +4381,12 @@ static void bgr_888_to_rgb_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_BGR_888_TO_RGB_555(src_pixel); + *dst_ptr = A5O_CONVERT_BGR_888_TO_RGB_555(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -4408,12 +4408,12 @@ static void bgr_888_to_rgba_5551(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_BGR_888_TO_RGBA_5551(src_pixel); + *dst_ptr = A5O_CONVERT_BGR_888_TO_RGBA_5551(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -4435,12 +4435,12 @@ static void bgr_888_to_argb_1555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_BGR_888_TO_ARGB_1555(src_pixel); + *dst_ptr = A5O_CONVERT_BGR_888_TO_ARGB_1555(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -4462,12 +4462,12 @@ static void bgr_888_to_abgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_BGR_888_TO_ABGR_8888(src_pixel); + *dst_ptr = A5O_CONVERT_BGR_888_TO_ABGR_8888(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -4489,12 +4489,12 @@ static void bgr_888_to_xbgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_BGR_888_TO_XBGR_8888(src_pixel); + *dst_ptr = A5O_CONVERT_BGR_888_TO_XBGR_8888(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -4516,12 +4516,12 @@ static void bgr_888_to_bgr_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_BGR_888_TO_BGR_565(src_pixel); + *dst_ptr = A5O_CONVERT_BGR_888_TO_BGR_565(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -4543,12 +4543,12 @@ static void bgr_888_to_bgr_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_BGR_888_TO_BGR_555(src_pixel); + *dst_ptr = A5O_CONVERT_BGR_888_TO_BGR_555(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -4570,12 +4570,12 @@ static void bgr_888_to_rgbx_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_BGR_888_TO_RGBX_8888(src_pixel); + *dst_ptr = A5O_CONVERT_BGR_888_TO_RGBX_8888(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -4597,12 +4597,12 @@ static void bgr_888_to_xrgb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_BGR_888_TO_XRGB_8888(src_pixel); + *dst_ptr = A5O_CONVERT_BGR_888_TO_XRGB_8888(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -4616,20 +4616,20 @@ static void bgr_888_to_abgr_f32(const void *src, int src_pitch, { int y; const uint8_t *src_ptr = (const uint8_t *)((const char *)src + sy * src_pitch); - ALLEGRO_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); + A5O_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 1 - width * 3; int dst_gap = dst_pitch / 16 - width; src_ptr += sx * 3; dst_ptr += dx; for (y = 0; y < height; y++) { - ALLEGRO_COLOR *dst_end = dst_ptr + width; + A5O_COLOR *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_BGR_888_TO_ABGR_F32(src_pixel); + *dst_ptr = A5O_CONVERT_BGR_888_TO_ABGR_F32(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -4651,12 +4651,12 @@ static void bgr_888_to_abgr_8888_le(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_BGR_888_TO_ABGR_8888_LE(src_pixel); + *dst_ptr = A5O_CONVERT_BGR_888_TO_ABGR_8888_LE(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -4678,12 +4678,12 @@ static void bgr_888_to_rgba_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_BGR_888_TO_RGBA_4444(src_pixel); + *dst_ptr = A5O_CONVERT_BGR_888_TO_RGBA_4444(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -4705,12 +4705,12 @@ static void bgr_888_to_single_channel_8(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - #ifdef ALLEGRO_BIG_ENDIAN + #ifdef A5O_BIG_ENDIAN int src_pixel = src_ptr[2] | (src_ptr[1] << 8) | (src_ptr[0] << 16); #else int src_pixel = src_ptr[0] | (src_ptr[1] << 8) | (src_ptr[2] << 16); #endif - *dst_ptr = ALLEGRO_CONVERT_BGR_888_TO_SINGLE_CHANNEL_8(src_pixel); + *dst_ptr = A5O_CONVERT_BGR_888_TO_SINGLE_CHANNEL_8(src_pixel); src_ptr += 1 * 3; dst_ptr += 1; } @@ -4732,7 +4732,7 @@ static void bgr_565_to_argb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_565_TO_ARGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_565_TO_ARGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -4754,7 +4754,7 @@ static void bgr_565_to_rgba_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_565_TO_RGBA_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_565_TO_RGBA_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -4776,7 +4776,7 @@ static void bgr_565_to_argb_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_565_TO_ARGB_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_565_TO_ARGB_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -4798,8 +4798,8 @@ static void bgr_565_to_rgb_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_BGR_565_TO_RGB_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_BGR_565_TO_RGB_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -4829,7 +4829,7 @@ static void bgr_565_to_rgb_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_565_TO_RGB_565(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_565_TO_RGB_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -4851,7 +4851,7 @@ static void bgr_565_to_rgb_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_565_TO_RGB_555(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_565_TO_RGB_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -4873,7 +4873,7 @@ static void bgr_565_to_rgba_5551(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_565_TO_RGBA_5551(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_565_TO_RGBA_5551(*src_ptr); dst_ptr++; src_ptr++; } @@ -4895,7 +4895,7 @@ static void bgr_565_to_argb_1555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_565_TO_ARGB_1555(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_565_TO_ARGB_1555(*src_ptr); dst_ptr++; src_ptr++; } @@ -4917,7 +4917,7 @@ static void bgr_565_to_abgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_565_TO_ABGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_565_TO_ABGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -4939,7 +4939,7 @@ static void bgr_565_to_xbgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_565_TO_XBGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_565_TO_XBGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -4961,8 +4961,8 @@ static void bgr_565_to_bgr_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_BGR_565_TO_BGR_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_BGR_565_TO_BGR_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -4992,7 +4992,7 @@ static void bgr_565_to_bgr_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_565_TO_BGR_555(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_565_TO_BGR_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -5014,7 +5014,7 @@ static void bgr_565_to_rgbx_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_565_TO_RGBX_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_565_TO_RGBX_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -5036,7 +5036,7 @@ static void bgr_565_to_xrgb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_565_TO_XRGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_565_TO_XRGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -5050,15 +5050,15 @@ static void bgr_565_to_abgr_f32(const void *src, int src_pitch, { int y; const uint16_t *src_ptr = (const uint16_t *)((const char *)src + sy * src_pitch); - ALLEGRO_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); + A5O_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 2 - width; int dst_gap = dst_pitch / 16 - width; src_ptr += sx; dst_ptr += dx; for (y = 0; y < height; y++) { - ALLEGRO_COLOR *dst_end = dst_ptr + width; + A5O_COLOR *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_565_TO_ABGR_F32(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_565_TO_ABGR_F32(*src_ptr); dst_ptr++; src_ptr++; } @@ -5080,7 +5080,7 @@ static void bgr_565_to_abgr_8888_le(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_565_TO_ABGR_8888_LE(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_565_TO_ABGR_8888_LE(*src_ptr); dst_ptr++; src_ptr++; } @@ -5102,7 +5102,7 @@ static void bgr_565_to_rgba_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_565_TO_RGBA_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_565_TO_RGBA_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -5124,7 +5124,7 @@ static void bgr_565_to_single_channel_8(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_565_TO_SINGLE_CHANNEL_8(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_565_TO_SINGLE_CHANNEL_8(*src_ptr); dst_ptr++; src_ptr++; } @@ -5146,7 +5146,7 @@ static void bgr_555_to_argb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_555_TO_ARGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_555_TO_ARGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -5168,7 +5168,7 @@ static void bgr_555_to_rgba_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_555_TO_RGBA_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_555_TO_RGBA_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -5190,7 +5190,7 @@ static void bgr_555_to_argb_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_555_TO_ARGB_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_555_TO_ARGB_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -5212,8 +5212,8 @@ static void bgr_555_to_rgb_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_BGR_555_TO_RGB_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_BGR_555_TO_RGB_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -5243,7 +5243,7 @@ static void bgr_555_to_rgb_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_555_TO_RGB_565(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_555_TO_RGB_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -5265,7 +5265,7 @@ static void bgr_555_to_rgb_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_555_TO_RGB_555(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_555_TO_RGB_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -5287,7 +5287,7 @@ static void bgr_555_to_rgba_5551(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_555_TO_RGBA_5551(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_555_TO_RGBA_5551(*src_ptr); dst_ptr++; src_ptr++; } @@ -5309,7 +5309,7 @@ static void bgr_555_to_argb_1555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_555_TO_ARGB_1555(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_555_TO_ARGB_1555(*src_ptr); dst_ptr++; src_ptr++; } @@ -5331,7 +5331,7 @@ static void bgr_555_to_abgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_555_TO_ABGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_555_TO_ABGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -5353,7 +5353,7 @@ static void bgr_555_to_xbgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_555_TO_XBGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_555_TO_XBGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -5375,8 +5375,8 @@ static void bgr_555_to_bgr_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_BGR_555_TO_BGR_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_BGR_555_TO_BGR_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -5406,7 +5406,7 @@ static void bgr_555_to_bgr_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_555_TO_BGR_565(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_555_TO_BGR_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -5428,7 +5428,7 @@ static void bgr_555_to_rgbx_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_555_TO_RGBX_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_555_TO_RGBX_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -5450,7 +5450,7 @@ static void bgr_555_to_xrgb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_555_TO_XRGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_555_TO_XRGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -5464,15 +5464,15 @@ static void bgr_555_to_abgr_f32(const void *src, int src_pitch, { int y; const uint16_t *src_ptr = (const uint16_t *)((const char *)src + sy * src_pitch); - ALLEGRO_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); + A5O_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 2 - width; int dst_gap = dst_pitch / 16 - width; src_ptr += sx; dst_ptr += dx; for (y = 0; y < height; y++) { - ALLEGRO_COLOR *dst_end = dst_ptr + width; + A5O_COLOR *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_555_TO_ABGR_F32(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_555_TO_ABGR_F32(*src_ptr); dst_ptr++; src_ptr++; } @@ -5494,7 +5494,7 @@ static void bgr_555_to_abgr_8888_le(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_555_TO_ABGR_8888_LE(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_555_TO_ABGR_8888_LE(*src_ptr); dst_ptr++; src_ptr++; } @@ -5516,7 +5516,7 @@ static void bgr_555_to_rgba_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_555_TO_RGBA_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_555_TO_RGBA_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -5538,7 +5538,7 @@ static void bgr_555_to_single_channel_8(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_BGR_555_TO_SINGLE_CHANNEL_8(*src_ptr); + *dst_ptr = A5O_CONVERT_BGR_555_TO_SINGLE_CHANNEL_8(*src_ptr); dst_ptr++; src_ptr++; } @@ -5560,7 +5560,7 @@ static void rgbx_8888_to_argb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBX_8888_TO_ARGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBX_8888_TO_ARGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -5582,7 +5582,7 @@ static void rgbx_8888_to_rgba_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBX_8888_TO_RGBA_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBX_8888_TO_RGBA_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -5604,7 +5604,7 @@ static void rgbx_8888_to_argb_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBX_8888_TO_ARGB_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBX_8888_TO_ARGB_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -5626,8 +5626,8 @@ static void rgbx_8888_to_rgb_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_RGBX_8888_TO_RGB_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_RGBX_8888_TO_RGB_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -5657,7 +5657,7 @@ static void rgbx_8888_to_rgb_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBX_8888_TO_RGB_565(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBX_8888_TO_RGB_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -5679,7 +5679,7 @@ static void rgbx_8888_to_rgb_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBX_8888_TO_RGB_555(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBX_8888_TO_RGB_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -5701,7 +5701,7 @@ static void rgbx_8888_to_rgba_5551(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBX_8888_TO_RGBA_5551(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBX_8888_TO_RGBA_5551(*src_ptr); dst_ptr++; src_ptr++; } @@ -5723,7 +5723,7 @@ static void rgbx_8888_to_argb_1555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBX_8888_TO_ARGB_1555(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBX_8888_TO_ARGB_1555(*src_ptr); dst_ptr++; src_ptr++; } @@ -5745,7 +5745,7 @@ static void rgbx_8888_to_abgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBX_8888_TO_ABGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBX_8888_TO_ABGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -5767,7 +5767,7 @@ static void rgbx_8888_to_xbgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBX_8888_TO_XBGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBX_8888_TO_XBGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -5789,8 +5789,8 @@ static void rgbx_8888_to_bgr_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_RGBX_8888_TO_BGR_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_RGBX_8888_TO_BGR_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -5820,7 +5820,7 @@ static void rgbx_8888_to_bgr_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBX_8888_TO_BGR_565(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBX_8888_TO_BGR_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -5842,7 +5842,7 @@ static void rgbx_8888_to_bgr_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBX_8888_TO_BGR_555(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBX_8888_TO_BGR_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -5864,7 +5864,7 @@ static void rgbx_8888_to_xrgb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBX_8888_TO_XRGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBX_8888_TO_XRGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -5878,15 +5878,15 @@ static void rgbx_8888_to_abgr_f32(const void *src, int src_pitch, { int y; const uint32_t *src_ptr = (const uint32_t *)((const char *)src + sy * src_pitch); - ALLEGRO_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); + A5O_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 4 - width; int dst_gap = dst_pitch / 16 - width; src_ptr += sx; dst_ptr += dx; for (y = 0; y < height; y++) { - ALLEGRO_COLOR *dst_end = dst_ptr + width; + A5O_COLOR *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBX_8888_TO_ABGR_F32(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBX_8888_TO_ABGR_F32(*src_ptr); dst_ptr++; src_ptr++; } @@ -5908,7 +5908,7 @@ static void rgbx_8888_to_abgr_8888_le(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBX_8888_TO_ABGR_8888_LE(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBX_8888_TO_ABGR_8888_LE(*src_ptr); dst_ptr++; src_ptr++; } @@ -5930,7 +5930,7 @@ static void rgbx_8888_to_rgba_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBX_8888_TO_RGBA_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBX_8888_TO_RGBA_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -5952,7 +5952,7 @@ static void rgbx_8888_to_single_channel_8(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBX_8888_TO_SINGLE_CHANNEL_8(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBX_8888_TO_SINGLE_CHANNEL_8(*src_ptr); dst_ptr++; src_ptr++; } @@ -5974,7 +5974,7 @@ static void xrgb_8888_to_argb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XRGB_8888_TO_ARGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_XRGB_8888_TO_ARGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -5996,7 +5996,7 @@ static void xrgb_8888_to_rgba_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XRGB_8888_TO_RGBA_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_XRGB_8888_TO_RGBA_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -6018,7 +6018,7 @@ static void xrgb_8888_to_argb_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XRGB_8888_TO_ARGB_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_XRGB_8888_TO_ARGB_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -6040,8 +6040,8 @@ static void xrgb_8888_to_rgb_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_XRGB_8888_TO_RGB_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_XRGB_8888_TO_RGB_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -6071,7 +6071,7 @@ static void xrgb_8888_to_rgb_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XRGB_8888_TO_RGB_565(*src_ptr); + *dst_ptr = A5O_CONVERT_XRGB_8888_TO_RGB_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -6093,7 +6093,7 @@ static void xrgb_8888_to_rgb_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XRGB_8888_TO_RGB_555(*src_ptr); + *dst_ptr = A5O_CONVERT_XRGB_8888_TO_RGB_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -6115,7 +6115,7 @@ static void xrgb_8888_to_rgba_5551(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XRGB_8888_TO_RGBA_5551(*src_ptr); + *dst_ptr = A5O_CONVERT_XRGB_8888_TO_RGBA_5551(*src_ptr); dst_ptr++; src_ptr++; } @@ -6137,7 +6137,7 @@ static void xrgb_8888_to_argb_1555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XRGB_8888_TO_ARGB_1555(*src_ptr); + *dst_ptr = A5O_CONVERT_XRGB_8888_TO_ARGB_1555(*src_ptr); dst_ptr++; src_ptr++; } @@ -6159,7 +6159,7 @@ static void xrgb_8888_to_abgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XRGB_8888_TO_ABGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_XRGB_8888_TO_ABGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -6181,7 +6181,7 @@ static void xrgb_8888_to_xbgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XRGB_8888_TO_XBGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_XRGB_8888_TO_XBGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -6203,8 +6203,8 @@ static void xrgb_8888_to_bgr_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_XRGB_8888_TO_BGR_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_XRGB_8888_TO_BGR_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -6234,7 +6234,7 @@ static void xrgb_8888_to_bgr_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XRGB_8888_TO_BGR_565(*src_ptr); + *dst_ptr = A5O_CONVERT_XRGB_8888_TO_BGR_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -6256,7 +6256,7 @@ static void xrgb_8888_to_bgr_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XRGB_8888_TO_BGR_555(*src_ptr); + *dst_ptr = A5O_CONVERT_XRGB_8888_TO_BGR_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -6278,7 +6278,7 @@ static void xrgb_8888_to_rgbx_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XRGB_8888_TO_RGBX_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_XRGB_8888_TO_RGBX_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -6292,15 +6292,15 @@ static void xrgb_8888_to_abgr_f32(const void *src, int src_pitch, { int y; const uint32_t *src_ptr = (const uint32_t *)((const char *)src + sy * src_pitch); - ALLEGRO_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); + A5O_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 4 - width; int dst_gap = dst_pitch / 16 - width; src_ptr += sx; dst_ptr += dx; for (y = 0; y < height; y++) { - ALLEGRO_COLOR *dst_end = dst_ptr + width; + A5O_COLOR *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XRGB_8888_TO_ABGR_F32(*src_ptr); + *dst_ptr = A5O_CONVERT_XRGB_8888_TO_ABGR_F32(*src_ptr); dst_ptr++; src_ptr++; } @@ -6322,7 +6322,7 @@ static void xrgb_8888_to_abgr_8888_le(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XRGB_8888_TO_ABGR_8888_LE(*src_ptr); + *dst_ptr = A5O_CONVERT_XRGB_8888_TO_ABGR_8888_LE(*src_ptr); dst_ptr++; src_ptr++; } @@ -6344,7 +6344,7 @@ static void xrgb_8888_to_rgba_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XRGB_8888_TO_RGBA_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_XRGB_8888_TO_RGBA_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -6366,7 +6366,7 @@ static void xrgb_8888_to_single_channel_8(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_XRGB_8888_TO_SINGLE_CHANNEL_8(*src_ptr); + *dst_ptr = A5O_CONVERT_XRGB_8888_TO_SINGLE_CHANNEL_8(*src_ptr); dst_ptr++; src_ptr++; } @@ -6379,7 +6379,7 @@ static void abgr_f32_to_argb_8888(const void *src, int src_pitch, int sx, int sy, int dx, int dy, int width, int height) { int y; - const ALLEGRO_COLOR *src_ptr = (const ALLEGRO_COLOR *)((const char *)src + sy * src_pitch); + const A5O_COLOR *src_ptr = (const A5O_COLOR *)((const char *)src + sy * src_pitch); uint32_t *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 16 - width; int dst_gap = dst_pitch / 4 - width; @@ -6388,7 +6388,7 @@ static void abgr_f32_to_argb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_F32_TO_ARGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_F32_TO_ARGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -6401,7 +6401,7 @@ static void abgr_f32_to_rgba_8888(const void *src, int src_pitch, int sx, int sy, int dx, int dy, int width, int height) { int y; - const ALLEGRO_COLOR *src_ptr = (const ALLEGRO_COLOR *)((const char *)src + sy * src_pitch); + const A5O_COLOR *src_ptr = (const A5O_COLOR *)((const char *)src + sy * src_pitch); uint32_t *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 16 - width; int dst_gap = dst_pitch / 4 - width; @@ -6410,7 +6410,7 @@ static void abgr_f32_to_rgba_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_F32_TO_RGBA_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_F32_TO_RGBA_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -6423,7 +6423,7 @@ static void abgr_f32_to_argb_4444(const void *src, int src_pitch, int sx, int sy, int dx, int dy, int width, int height) { int y; - const ALLEGRO_COLOR *src_ptr = (const ALLEGRO_COLOR *)((const char *)src + sy * src_pitch); + const A5O_COLOR *src_ptr = (const A5O_COLOR *)((const char *)src + sy * src_pitch); uint16_t *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 16 - width; int dst_gap = dst_pitch / 2 - width; @@ -6432,7 +6432,7 @@ static void abgr_f32_to_argb_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_F32_TO_ARGB_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_F32_TO_ARGB_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -6445,7 +6445,7 @@ static void abgr_f32_to_rgb_888(const void *src, int src_pitch, int sx, int sy, int dx, int dy, int width, int height) { int y; - const ALLEGRO_COLOR *src_ptr = (const ALLEGRO_COLOR *)((const char *)src + sy * src_pitch); + const A5O_COLOR *src_ptr = (const A5O_COLOR *)((const char *)src + sy * src_pitch); uint8_t *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 16 - width; int dst_gap = dst_pitch / 1 - width * 3; @@ -6454,8 +6454,8 @@ static void abgr_f32_to_rgb_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_ABGR_F32_TO_RGB_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_ABGR_F32_TO_RGB_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -6476,7 +6476,7 @@ static void abgr_f32_to_rgb_565(const void *src, int src_pitch, int sx, int sy, int dx, int dy, int width, int height) { int y; - const ALLEGRO_COLOR *src_ptr = (const ALLEGRO_COLOR *)((const char *)src + sy * src_pitch); + const A5O_COLOR *src_ptr = (const A5O_COLOR *)((const char *)src + sy * src_pitch); uint16_t *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 16 - width; int dst_gap = dst_pitch / 2 - width; @@ -6485,7 +6485,7 @@ static void abgr_f32_to_rgb_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_F32_TO_RGB_565(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_F32_TO_RGB_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -6498,7 +6498,7 @@ static void abgr_f32_to_rgb_555(const void *src, int src_pitch, int sx, int sy, int dx, int dy, int width, int height) { int y; - const ALLEGRO_COLOR *src_ptr = (const ALLEGRO_COLOR *)((const char *)src + sy * src_pitch); + const A5O_COLOR *src_ptr = (const A5O_COLOR *)((const char *)src + sy * src_pitch); uint16_t *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 16 - width; int dst_gap = dst_pitch / 2 - width; @@ -6507,7 +6507,7 @@ static void abgr_f32_to_rgb_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_F32_TO_RGB_555(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_F32_TO_RGB_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -6520,7 +6520,7 @@ static void abgr_f32_to_rgba_5551(const void *src, int src_pitch, int sx, int sy, int dx, int dy, int width, int height) { int y; - const ALLEGRO_COLOR *src_ptr = (const ALLEGRO_COLOR *)((const char *)src + sy * src_pitch); + const A5O_COLOR *src_ptr = (const A5O_COLOR *)((const char *)src + sy * src_pitch); uint16_t *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 16 - width; int dst_gap = dst_pitch / 2 - width; @@ -6529,7 +6529,7 @@ static void abgr_f32_to_rgba_5551(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_F32_TO_RGBA_5551(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_F32_TO_RGBA_5551(*src_ptr); dst_ptr++; src_ptr++; } @@ -6542,7 +6542,7 @@ static void abgr_f32_to_argb_1555(const void *src, int src_pitch, int sx, int sy, int dx, int dy, int width, int height) { int y; - const ALLEGRO_COLOR *src_ptr = (const ALLEGRO_COLOR *)((const char *)src + sy * src_pitch); + const A5O_COLOR *src_ptr = (const A5O_COLOR *)((const char *)src + sy * src_pitch); uint16_t *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 16 - width; int dst_gap = dst_pitch / 2 - width; @@ -6551,7 +6551,7 @@ static void abgr_f32_to_argb_1555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_F32_TO_ARGB_1555(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_F32_TO_ARGB_1555(*src_ptr); dst_ptr++; src_ptr++; } @@ -6564,7 +6564,7 @@ static void abgr_f32_to_abgr_8888(const void *src, int src_pitch, int sx, int sy, int dx, int dy, int width, int height) { int y; - const ALLEGRO_COLOR *src_ptr = (const ALLEGRO_COLOR *)((const char *)src + sy * src_pitch); + const A5O_COLOR *src_ptr = (const A5O_COLOR *)((const char *)src + sy * src_pitch); uint32_t *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 16 - width; int dst_gap = dst_pitch / 4 - width; @@ -6573,7 +6573,7 @@ static void abgr_f32_to_abgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_F32_TO_ABGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_F32_TO_ABGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -6586,7 +6586,7 @@ static void abgr_f32_to_xbgr_8888(const void *src, int src_pitch, int sx, int sy, int dx, int dy, int width, int height) { int y; - const ALLEGRO_COLOR *src_ptr = (const ALLEGRO_COLOR *)((const char *)src + sy * src_pitch); + const A5O_COLOR *src_ptr = (const A5O_COLOR *)((const char *)src + sy * src_pitch); uint32_t *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 16 - width; int dst_gap = dst_pitch / 4 - width; @@ -6595,7 +6595,7 @@ static void abgr_f32_to_xbgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_F32_TO_XBGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_F32_TO_XBGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -6608,7 +6608,7 @@ static void abgr_f32_to_bgr_888(const void *src, int src_pitch, int sx, int sy, int dx, int dy, int width, int height) { int y; - const ALLEGRO_COLOR *src_ptr = (const ALLEGRO_COLOR *)((const char *)src + sy * src_pitch); + const A5O_COLOR *src_ptr = (const A5O_COLOR *)((const char *)src + sy * src_pitch); uint8_t *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 16 - width; int dst_gap = dst_pitch / 1 - width * 3; @@ -6617,8 +6617,8 @@ static void abgr_f32_to_bgr_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_ABGR_F32_TO_BGR_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_ABGR_F32_TO_BGR_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -6639,7 +6639,7 @@ static void abgr_f32_to_bgr_565(const void *src, int src_pitch, int sx, int sy, int dx, int dy, int width, int height) { int y; - const ALLEGRO_COLOR *src_ptr = (const ALLEGRO_COLOR *)((const char *)src + sy * src_pitch); + const A5O_COLOR *src_ptr = (const A5O_COLOR *)((const char *)src + sy * src_pitch); uint16_t *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 16 - width; int dst_gap = dst_pitch / 2 - width; @@ -6648,7 +6648,7 @@ static void abgr_f32_to_bgr_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_F32_TO_BGR_565(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_F32_TO_BGR_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -6661,7 +6661,7 @@ static void abgr_f32_to_bgr_555(const void *src, int src_pitch, int sx, int sy, int dx, int dy, int width, int height) { int y; - const ALLEGRO_COLOR *src_ptr = (const ALLEGRO_COLOR *)((const char *)src + sy * src_pitch); + const A5O_COLOR *src_ptr = (const A5O_COLOR *)((const char *)src + sy * src_pitch); uint16_t *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 16 - width; int dst_gap = dst_pitch / 2 - width; @@ -6670,7 +6670,7 @@ static void abgr_f32_to_bgr_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_F32_TO_BGR_555(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_F32_TO_BGR_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -6683,7 +6683,7 @@ static void abgr_f32_to_rgbx_8888(const void *src, int src_pitch, int sx, int sy, int dx, int dy, int width, int height) { int y; - const ALLEGRO_COLOR *src_ptr = (const ALLEGRO_COLOR *)((const char *)src + sy * src_pitch); + const A5O_COLOR *src_ptr = (const A5O_COLOR *)((const char *)src + sy * src_pitch); uint32_t *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 16 - width; int dst_gap = dst_pitch / 4 - width; @@ -6692,7 +6692,7 @@ static void abgr_f32_to_rgbx_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_F32_TO_RGBX_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_F32_TO_RGBX_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -6705,7 +6705,7 @@ static void abgr_f32_to_xrgb_8888(const void *src, int src_pitch, int sx, int sy, int dx, int dy, int width, int height) { int y; - const ALLEGRO_COLOR *src_ptr = (const ALLEGRO_COLOR *)((const char *)src + sy * src_pitch); + const A5O_COLOR *src_ptr = (const A5O_COLOR *)((const char *)src + sy * src_pitch); uint32_t *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 16 - width; int dst_gap = dst_pitch / 4 - width; @@ -6714,7 +6714,7 @@ static void abgr_f32_to_xrgb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_F32_TO_XRGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_F32_TO_XRGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -6727,7 +6727,7 @@ static void abgr_f32_to_abgr_8888_le(const void *src, int src_pitch, int sx, int sy, int dx, int dy, int width, int height) { int y; - const ALLEGRO_COLOR *src_ptr = (const ALLEGRO_COLOR *)((const char *)src + sy * src_pitch); + const A5O_COLOR *src_ptr = (const A5O_COLOR *)((const char *)src + sy * src_pitch); uint32_t *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 16 - width; int dst_gap = dst_pitch / 4 - width; @@ -6736,7 +6736,7 @@ static void abgr_f32_to_abgr_8888_le(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_F32_TO_ABGR_8888_LE(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_F32_TO_ABGR_8888_LE(*src_ptr); dst_ptr++; src_ptr++; } @@ -6749,7 +6749,7 @@ static void abgr_f32_to_rgba_4444(const void *src, int src_pitch, int sx, int sy, int dx, int dy, int width, int height) { int y; - const ALLEGRO_COLOR *src_ptr = (const ALLEGRO_COLOR *)((const char *)src + sy * src_pitch); + const A5O_COLOR *src_ptr = (const A5O_COLOR *)((const char *)src + sy * src_pitch); uint16_t *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 16 - width; int dst_gap = dst_pitch / 2 - width; @@ -6758,7 +6758,7 @@ static void abgr_f32_to_rgba_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_F32_TO_RGBA_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_F32_TO_RGBA_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -6771,7 +6771,7 @@ static void abgr_f32_to_single_channel_8(const void *src, int src_pitch, int sx, int sy, int dx, int dy, int width, int height) { int y; - const ALLEGRO_COLOR *src_ptr = (const ALLEGRO_COLOR *)((const char *)src + sy * src_pitch); + const A5O_COLOR *src_ptr = (const A5O_COLOR *)((const char *)src + sy * src_pitch); uint8_t *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 16 - width; int dst_gap = dst_pitch / 1 - width; @@ -6780,7 +6780,7 @@ static void abgr_f32_to_single_channel_8(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_F32_TO_SINGLE_CHANNEL_8(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_F32_TO_SINGLE_CHANNEL_8(*src_ptr); dst_ptr++; src_ptr++; } @@ -6802,7 +6802,7 @@ static void abgr_8888_le_to_argb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_LE_TO_ARGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_LE_TO_ARGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -6824,7 +6824,7 @@ static void abgr_8888_le_to_rgba_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGBA_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_LE_TO_RGBA_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -6846,7 +6846,7 @@ static void abgr_8888_le_to_argb_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_LE_TO_ARGB_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_LE_TO_ARGB_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -6868,8 +6868,8 @@ static void abgr_8888_le_to_rgb_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGB_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_ABGR_8888_LE_TO_RGB_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -6899,7 +6899,7 @@ static void abgr_8888_le_to_rgb_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGB_565(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_LE_TO_RGB_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -6921,7 +6921,7 @@ static void abgr_8888_le_to_rgb_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGB_555(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_LE_TO_RGB_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -6943,7 +6943,7 @@ static void abgr_8888_le_to_rgba_5551(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGBA_5551(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_LE_TO_RGBA_5551(*src_ptr); dst_ptr++; src_ptr++; } @@ -6965,7 +6965,7 @@ static void abgr_8888_le_to_argb_1555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_LE_TO_ARGB_1555(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_LE_TO_ARGB_1555(*src_ptr); dst_ptr++; src_ptr++; } @@ -6987,7 +6987,7 @@ static void abgr_8888_le_to_abgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_LE_TO_ABGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_LE_TO_ABGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -7009,7 +7009,7 @@ static void abgr_8888_le_to_xbgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_LE_TO_XBGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_LE_TO_XBGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -7031,8 +7031,8 @@ static void abgr_8888_le_to_bgr_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_ABGR_8888_LE_TO_BGR_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_ABGR_8888_LE_TO_BGR_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -7062,7 +7062,7 @@ static void abgr_8888_le_to_bgr_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_LE_TO_BGR_565(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_LE_TO_BGR_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -7084,7 +7084,7 @@ static void abgr_8888_le_to_bgr_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_LE_TO_BGR_555(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_LE_TO_BGR_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -7106,7 +7106,7 @@ static void abgr_8888_le_to_rgbx_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGBX_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_LE_TO_RGBX_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -7128,7 +7128,7 @@ static void abgr_8888_le_to_xrgb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_LE_TO_XRGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_LE_TO_XRGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -7142,15 +7142,15 @@ static void abgr_8888_le_to_abgr_f32(const void *src, int src_pitch, { int y; const uint32_t *src_ptr = (const uint32_t *)((const char *)src + sy * src_pitch); - ALLEGRO_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); + A5O_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 4 - width; int dst_gap = dst_pitch / 16 - width; src_ptr += sx; dst_ptr += dx; for (y = 0; y < height; y++) { - ALLEGRO_COLOR *dst_end = dst_ptr + width; + A5O_COLOR *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_LE_TO_ABGR_F32(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_LE_TO_ABGR_F32(*src_ptr); dst_ptr++; src_ptr++; } @@ -7172,7 +7172,7 @@ static void abgr_8888_le_to_rgba_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_LE_TO_RGBA_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_LE_TO_RGBA_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -7194,7 +7194,7 @@ static void abgr_8888_le_to_single_channel_8(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_ABGR_8888_LE_TO_SINGLE_CHANNEL_8(*src_ptr); + *dst_ptr = A5O_CONVERT_ABGR_8888_LE_TO_SINGLE_CHANNEL_8(*src_ptr); dst_ptr++; src_ptr++; } @@ -7216,7 +7216,7 @@ static void rgba_4444_to_argb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_4444_TO_ARGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_4444_TO_ARGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -7238,7 +7238,7 @@ static void rgba_4444_to_rgba_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_4444_TO_RGBA_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_4444_TO_RGBA_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -7260,7 +7260,7 @@ static void rgba_4444_to_argb_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_4444_TO_ARGB_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_4444_TO_ARGB_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -7282,8 +7282,8 @@ static void rgba_4444_to_rgb_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_RGBA_4444_TO_RGB_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_RGBA_4444_TO_RGB_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -7313,7 +7313,7 @@ static void rgba_4444_to_rgb_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_4444_TO_RGB_565(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_4444_TO_RGB_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -7335,7 +7335,7 @@ static void rgba_4444_to_rgb_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_4444_TO_RGB_555(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_4444_TO_RGB_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -7357,7 +7357,7 @@ static void rgba_4444_to_rgba_5551(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_4444_TO_RGBA_5551(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_4444_TO_RGBA_5551(*src_ptr); dst_ptr++; src_ptr++; } @@ -7379,7 +7379,7 @@ static void rgba_4444_to_argb_1555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_4444_TO_ARGB_1555(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_4444_TO_ARGB_1555(*src_ptr); dst_ptr++; src_ptr++; } @@ -7401,7 +7401,7 @@ static void rgba_4444_to_abgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_4444_TO_ABGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_4444_TO_ABGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -7423,7 +7423,7 @@ static void rgba_4444_to_xbgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_4444_TO_XBGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_4444_TO_XBGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -7445,8 +7445,8 @@ static void rgba_4444_to_bgr_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_RGBA_4444_TO_BGR_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_RGBA_4444_TO_BGR_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -7476,7 +7476,7 @@ static void rgba_4444_to_bgr_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_4444_TO_BGR_565(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_4444_TO_BGR_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -7498,7 +7498,7 @@ static void rgba_4444_to_bgr_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_4444_TO_BGR_555(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_4444_TO_BGR_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -7520,7 +7520,7 @@ static void rgba_4444_to_rgbx_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_4444_TO_RGBX_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_4444_TO_RGBX_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -7542,7 +7542,7 @@ static void rgba_4444_to_xrgb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_4444_TO_XRGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_4444_TO_XRGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -7556,15 +7556,15 @@ static void rgba_4444_to_abgr_f32(const void *src, int src_pitch, { int y; const uint16_t *src_ptr = (const uint16_t *)((const char *)src + sy * src_pitch); - ALLEGRO_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); + A5O_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 2 - width; int dst_gap = dst_pitch / 16 - width; src_ptr += sx; dst_ptr += dx; for (y = 0; y < height; y++) { - ALLEGRO_COLOR *dst_end = dst_ptr + width; + A5O_COLOR *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_4444_TO_ABGR_F32(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_4444_TO_ABGR_F32(*src_ptr); dst_ptr++; src_ptr++; } @@ -7586,7 +7586,7 @@ static void rgba_4444_to_abgr_8888_le(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_4444_TO_ABGR_8888_LE(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_4444_TO_ABGR_8888_LE(*src_ptr); dst_ptr++; src_ptr++; } @@ -7608,7 +7608,7 @@ static void rgba_4444_to_single_channel_8(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_RGBA_4444_TO_SINGLE_CHANNEL_8(*src_ptr); + *dst_ptr = A5O_CONVERT_RGBA_4444_TO_SINGLE_CHANNEL_8(*src_ptr); dst_ptr++; src_ptr++; } @@ -7630,7 +7630,7 @@ static void single_channel_8_to_argb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_ARGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_SINGLE_CHANNEL_8_TO_ARGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -7652,7 +7652,7 @@ static void single_channel_8_to_rgba_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_RGBA_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_SINGLE_CHANNEL_8_TO_RGBA_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -7674,7 +7674,7 @@ static void single_channel_8_to_argb_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_ARGB_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_SINGLE_CHANNEL_8_TO_ARGB_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -7696,8 +7696,8 @@ static void single_channel_8_to_rgb_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_RGB_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_SINGLE_CHANNEL_8_TO_RGB_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -7727,7 +7727,7 @@ static void single_channel_8_to_rgb_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_RGB_565(*src_ptr); + *dst_ptr = A5O_CONVERT_SINGLE_CHANNEL_8_TO_RGB_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -7749,7 +7749,7 @@ static void single_channel_8_to_rgb_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_RGB_555(*src_ptr); + *dst_ptr = A5O_CONVERT_SINGLE_CHANNEL_8_TO_RGB_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -7771,7 +7771,7 @@ static void single_channel_8_to_rgba_5551(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_RGBA_5551(*src_ptr); + *dst_ptr = A5O_CONVERT_SINGLE_CHANNEL_8_TO_RGBA_5551(*src_ptr); dst_ptr++; src_ptr++; } @@ -7793,7 +7793,7 @@ static void single_channel_8_to_argb_1555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_ARGB_1555(*src_ptr); + *dst_ptr = A5O_CONVERT_SINGLE_CHANNEL_8_TO_ARGB_1555(*src_ptr); dst_ptr++; src_ptr++; } @@ -7815,7 +7815,7 @@ static void single_channel_8_to_abgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_ABGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_SINGLE_CHANNEL_8_TO_ABGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -7837,7 +7837,7 @@ static void single_channel_8_to_xbgr_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_XBGR_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_SINGLE_CHANNEL_8_TO_XBGR_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -7859,8 +7859,8 @@ static void single_channel_8_to_bgr_888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint8_t *dst_end = dst_ptr + width * 3; while (dst_ptr < dst_end) { - int dst_pixel = ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_BGR_888(*src_ptr); - #ifdef ALLEGRO_BIG_ENDIAN + int dst_pixel = A5O_CONVERT_SINGLE_CHANNEL_8_TO_BGR_888(*src_ptr); + #ifdef A5O_BIG_ENDIAN dst_ptr[0] = dst_pixel >> 16; dst_ptr[1] = dst_pixel >> 8; dst_ptr[2] = dst_pixel; @@ -7890,7 +7890,7 @@ static void single_channel_8_to_bgr_565(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_BGR_565(*src_ptr); + *dst_ptr = A5O_CONVERT_SINGLE_CHANNEL_8_TO_BGR_565(*src_ptr); dst_ptr++; src_ptr++; } @@ -7912,7 +7912,7 @@ static void single_channel_8_to_bgr_555(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_BGR_555(*src_ptr); + *dst_ptr = A5O_CONVERT_SINGLE_CHANNEL_8_TO_BGR_555(*src_ptr); dst_ptr++; src_ptr++; } @@ -7934,7 +7934,7 @@ static void single_channel_8_to_rgbx_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_RGBX_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_SINGLE_CHANNEL_8_TO_RGBX_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -7956,7 +7956,7 @@ static void single_channel_8_to_xrgb_8888(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_XRGB_8888(*src_ptr); + *dst_ptr = A5O_CONVERT_SINGLE_CHANNEL_8_TO_XRGB_8888(*src_ptr); dst_ptr++; src_ptr++; } @@ -7970,15 +7970,15 @@ static void single_channel_8_to_abgr_f32(const void *src, int src_pitch, { int y; const uint8_t *src_ptr = (const uint8_t *)((const char *)src + sy * src_pitch); - ALLEGRO_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); + A5O_COLOR *dst_ptr = (void *)((char *)dst + dy * dst_pitch); int src_gap = src_pitch / 1 - width; int dst_gap = dst_pitch / 16 - width; src_ptr += sx; dst_ptr += dx; for (y = 0; y < height; y++) { - ALLEGRO_COLOR *dst_end = dst_ptr + width; + A5O_COLOR *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_ABGR_F32(*src_ptr); + *dst_ptr = A5O_CONVERT_SINGLE_CHANNEL_8_TO_ABGR_F32(*src_ptr); dst_ptr++; src_ptr++; } @@ -8000,7 +8000,7 @@ static void single_channel_8_to_abgr_8888_le(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint32_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_ABGR_8888_LE(*src_ptr); + *dst_ptr = A5O_CONVERT_SINGLE_CHANNEL_8_TO_ABGR_8888_LE(*src_ptr); dst_ptr++; src_ptr++; } @@ -8022,7 +8022,7 @@ static void single_channel_8_to_rgba_4444(const void *src, int src_pitch, for (y = 0; y < height; y++) { uint16_t *dst_end = dst_ptr + width; while (dst_ptr < dst_end) { - *dst_ptr = ALLEGRO_CONVERT_SINGLE_CHANNEL_8_TO_RGBA_4444(*src_ptr); + *dst_ptr = A5O_CONVERT_SINGLE_CHANNEL_8_TO_RGBA_4444(*src_ptr); dst_ptr++; src_ptr++; } @@ -8030,8 +8030,8 @@ static void single_channel_8_to_rgba_4444(const void *src, int src_pitch, dst_ptr += dst_gap; } } -void (*_al_convert_funcs[ALLEGRO_NUM_PIXEL_FORMATS] - [ALLEGRO_NUM_PIXEL_FORMATS])(const void *, int, void *, int, +void (*_al_convert_funcs[A5O_NUM_PIXEL_FORMATS] + [A5O_NUM_PIXEL_FORMATS])(const void *, int, void *, int, int, int, int, int, int, int) = { {NULL}, {NULL}, diff --git a/src/cpu.c b/src/cpu.c index f17ad06562..3d046d38ce 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -28,16 +28,16 @@ * On Windows, of course, the Windows API is always used. */ -#ifdef ALLEGRO_HAVE_SYSCONF +#ifdef A5O_HAVE_SYSCONF #include #endif -#ifdef ALLEGRO_HAVE_SYSCTL +#ifdef A5O_HAVE_SYSCTL #include #include #endif -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS #ifndef WINVER #define WINVER 0x0500 #endif @@ -49,9 +49,9 @@ */ int al_get_cpu_count(void) { -#if defined(ALLEGRO_HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN) +#if defined(A5O_HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN) return (int)sysconf(_SC_NPROCESSORS_ONLN); -#elif defined(ALLEGRO_HAVE_SYSCTL) +#elif defined(A5O_HAVE_SYSCTL) #if defined(HW_AVAILCPU) int mib[2] = {CTL_HW, HW_AVAILCPU}; #elif defined(HW_NCPU) @@ -64,7 +64,7 @@ int al_get_cpu_count(void) if (sysctl(mib, 2, &ncpu, &len, NULL, 0) == 0) { return ncpu; } -#elif defined(ALLEGRO_WINDOWS) +#elif defined(A5O_WINDOWS) SYSTEM_INFO info; GetSystemInfo(&info); return info.dwNumberOfProcessors; @@ -76,12 +76,12 @@ int al_get_cpu_count(void) */ int al_get_ram_size(void) { -#if defined(ALLEGRO_HAVE_SYSCONF) && defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE) +#if defined(A5O_HAVE_SYSCONF) && defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE) uint64_t aid = (uint64_t) sysconf(_SC_PHYS_PAGES); aid *= (uint64_t) sysconf(_SC_PAGESIZE); aid /= (uint64_t) (1024 * 1024); return (int)(aid); -#elif defined(ALLEGRO_HAVE_SYSCTL) +#elif defined(A5O_HAVE_SYSCTL) #ifdef HW_REALMEM int mib[2] = {CTL_HW, HW_REALMEM}; #elif defined(HW_PHYSMEM) @@ -96,7 +96,7 @@ int al_get_ram_size(void) if (sysctl(mib, 2, &memsize, &len, NULL, 0) == 0) { return (int)(memsize / (1024*1024)); } -#elif defined(ALLEGRO_WINDOWS) +#elif defined(A5O_WINDOWS) MEMORYSTATUSEX status; status.dwLength = sizeof(status); if (GlobalMemoryStatusEx(&status)) { diff --git a/src/debug.c b/src/debug.c index e0c894d4ef..bc42062bb7 100644 --- a/src/debug.c +++ b/src/debug.c @@ -21,11 +21,11 @@ #include "allegro5/internal/aintern_thread.h" #include "allegro5/internal/aintern_vector.h" -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS #include "allegro5/internal/aintern_wunicode.h" #endif -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID #include #include #endif @@ -59,8 +59,8 @@ static TRACE_INFO trace_info = _AL_MUTEX_UNINITED, 0, 7, - _AL_VECTOR_INITIALIZER(ALLEGRO_USTR *), - _AL_VECTOR_INITIALIZER(ALLEGRO_USTR *), + _AL_VECTOR_INITIALIZER(A5O_USTR *), + _AL_VECTOR_INITIALIZER(A5O_USTR *), false }; @@ -77,7 +77,7 @@ static void delete_string_list(_AL_VECTOR *v) { while (_al_vector_is_nonempty(v)) { int i = _al_vector_size(v) - 1; - ALLEGRO_USTR **iter = _al_vector_ref(v, i); + A5O_USTR **iter = _al_vector_ref(v, i); al_ustr_free(*iter); _al_vector_delete_at(v, i); } @@ -87,21 +87,21 @@ static void delete_string_list(_AL_VECTOR *v) void _al_configure_logging(void) { - ALLEGRO_CONFIG *config; + A5O_CONFIG *config; char const *v; bool got_all = false; config = al_get_system_config(); v = al_get_config_value(config, "trace", "channels"); if (v) { - ALLEGRO_USTR_INFO uinfo; - const ALLEGRO_USTR *u = al_ref_cstr(&uinfo, v); + A5O_USTR_INFO uinfo; + const A5O_USTR *u = al_ref_cstr(&uinfo, v); int pos = 0; while (pos >= 0) { int comma = al_ustr_find_chr(u, pos, ','); int first; - ALLEGRO_USTR *u2, **iter; + A5O_USTR *u2, **iter; if (comma == -1) u2 = al_ustr_dup_substr(u, pos, al_ustr_length(u)); else @@ -136,7 +136,7 @@ void _al_configure_logging(void) trace_info.level = 9999; #endif - v = getenv("ALLEGRO_TRACE_LEVEL"); + v = getenv("A5O_TRACE_LEVEL"); if (!v) v = al_get_config_value(config, "trace", "level"); if (v) { @@ -175,7 +175,7 @@ void _al_configure_logging(void) static void open_trace_file(void) { if (trace_info.trace_virgin) { - const char *s = getenv("ALLEGRO_TRACE"); + const char *s = getenv("A5O_TRACE"); if (s) { if (!strcmp(s, "-")) { @@ -187,7 +187,7 @@ static void open_trace_file(void) } } else -#if defined(ALLEGRO_IPHONE) || defined(ALLEGRO_ANDROID) || defined(__EMSCRIPTEN__) +#if defined(A5O_IPHONE) || defined(A5O_ANDROID) || defined(__EMSCRIPTEN__) /* iPhone and Android don't like us writing files, so we'll be doing * something else there by default. */ trace_info.trace_file = NULL; @@ -234,7 +234,7 @@ bool _al_trace_prefix(char const *channel, int level, goto channel_included; for (i = 0; i < _al_vector_size(v); i++) { - ALLEGRO_USTR **iter = _al_vector_ref(v, i); + A5O_USTR **iter = _al_vector_ref(v, i); if (!strcmp(al_cstr(*iter), channel)) goto channel_included; } @@ -246,7 +246,7 @@ bool _al_trace_prefix(char const *channel, int level, v = &trace_info.excluded; if (_al_vector_is_nonempty(v)) { for (i = 0; i < _al_vector_size(v); i++) { - ALLEGRO_USTR **iter = _al_vector_ref(v, i); + A5O_USTR **iter = _al_vector_ref(v, i); if (!strcmp(al_cstr(*iter), channel)) return false; } @@ -264,7 +264,7 @@ bool _al_trace_prefix(char const *channel, int level, if (level == 2) do_trace("W "); if (level == 3) do_trace("E "); -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID { char pid_buf[16]; snprintf(pid_buf, sizeof(pid_buf), "%i: ", gettid()); @@ -272,7 +272,7 @@ bool _al_trace_prefix(char const *channel, int level, } #endif -#ifdef ALLEGRO_MSVC +#ifdef A5O_MSVC name = strrchr(file, '\\'); #else name = strrchr(file, '/'); @@ -312,15 +312,15 @@ void _al_trace_suffix(const char *msg, ...) _al_user_trace_handler(static_trace_buffer); } else { -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID (void)__android_log_print(ANDROID_LOG_INFO, "allegro", "%s", static_trace_buffer); #endif -#if defined(ALLEGRO_IPHONE) || defined(__EMSCRIPTEN__) +#if defined(A5O_IPHONE) || defined(__EMSCRIPTEN__) fprintf(stderr, "%s", static_trace_buffer); fflush(stderr); #endif -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS { TCHAR *windows_output = _twin_utf8_to_tchar(static_trace_buffer); OutputDebugString(windows_output); diff --git a/src/display.c b/src/display.c index 7947425a97..b4c87a6647 100644 --- a/src/display.c +++ b/src/display.c @@ -30,29 +30,29 @@ #include "allegro5/internal/aintern_system.h" -ALLEGRO_DEBUG_CHANNEL("display") +A5O_DEBUG_CHANNEL("display") /* Function: al_create_display */ -ALLEGRO_DISPLAY *al_create_display(int w, int h) +A5O_DISPLAY *al_create_display(int w, int h) { - ALLEGRO_SYSTEM *system; - ALLEGRO_DISPLAY_INTERFACE *driver; - ALLEGRO_DISPLAY *display; - ALLEGRO_EXTRA_DISPLAY_SETTINGS *settings; + A5O_SYSTEM *system; + A5O_DISPLAY_INTERFACE *driver; + A5O_DISPLAY *display; + A5O_EXTRA_DISPLAY_SETTINGS *settings; int64_t flags; system = al_get_system_driver(); driver = system->vt->get_display_driver(); if (!driver) { - ALLEGRO_ERROR("Failed to create display (no display driver)\n"); + A5O_ERROR("Failed to create display (no display driver)\n"); return NULL; } display = driver->create_display(w, h); if (!display) { - ALLEGRO_ERROR("Failed to create display (NULL)\n"); + A5O_ERROR("Failed to create display (NULL)\n"); return NULL; } @@ -60,11 +60,11 @@ ALLEGRO_DISPLAY *al_create_display(int w, int h) settings = &display->extra_settings; flags = settings->required | settings->suggested; - if (!(flags & (1 << ALLEGRO_AUTO_CONVERT_BITMAPS))) { - settings->settings[ALLEGRO_AUTO_CONVERT_BITMAPS] = 1; + if (!(flags & (1 << A5O_AUTO_CONVERT_BITMAPS))) { + settings->settings[A5O_AUTO_CONVERT_BITMAPS] = 1; } - settings->settings[ALLEGRO_DEFAULT_SHADER_PLATFORM] = - _al_get_new_display_settings()->settings[ALLEGRO_DEFAULT_SHADER_PLATFORM]; + settings->settings[A5O_DEFAULT_SHADER_PLATFORM] = + _al_get_new_display_settings()->settings[A5O_DEFAULT_SHADER_PLATFORM]; display->min_w = 0; display->min_h = 0; @@ -84,24 +84,24 @@ ALLEGRO_DISPLAY *al_create_display(int w, int h) _al_vector_init(&display->display_invalidated_callbacks, sizeof(void *)); _al_vector_init(&display->display_validated_callbacks, sizeof(void *)); - display->render_state.write_mask = ALLEGRO_MASK_RGBA | ALLEGRO_MASK_DEPTH; + display->render_state.write_mask = A5O_MASK_RGBA | A5O_MASK_DEPTH; display->render_state.depth_test = false; - display->render_state.depth_function = ALLEGRO_RENDER_LESS; + display->render_state.depth_function = A5O_RENDER_LESS; display->render_state.alpha_test = false; - display->render_state.alpha_function = ALLEGRO_RENDER_ALWAYS; + display->render_state.alpha_function = A5O_RENDER_ALWAYS; display->render_state.alpha_test_value = 0; - _al_vector_init(&display->bitmaps, sizeof(ALLEGRO_BITMAP*)); + _al_vector_init(&display->bitmaps, sizeof(A5O_BITMAP*)); - if (settings->settings[ALLEGRO_COMPATIBLE_DISPLAY]) { + if (settings->settings[A5O_COMPATIBLE_DISPLAY]) { al_set_target_bitmap(al_get_backbuffer(display)); } else { - ALLEGRO_DEBUG("ALLEGRO_COMPATIBLE_DISPLAY not set\n"); + A5O_DEBUG("A5O_COMPATIBLE_DISPLAY not set\n"); _al_set_current_display_only(display); } - if (display->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { + if (display->flags & A5O_PROGRAMMABLE_PIPELINE) { display->default_shader = _al_create_default_shader(display); if (!display->default_shader) { al_destroy_display(display); @@ -111,7 +111,7 @@ ALLEGRO_DISPLAY *al_create_display(int w, int h) } /* Clear the screen */ - if (settings->settings[ALLEGRO_COMPATIBLE_DISPLAY]) { + if (settings->settings[A5O_COMPATIBLE_DISPLAY]) { al_clear_to_color(al_map_rgb(0, 0, 0)); /* TODO: @@ -124,7 +124,7 @@ ALLEGRO_DISPLAY *al_create_display(int w, int h) #endif } - if (settings->settings[ALLEGRO_AUTO_CONVERT_BITMAPS]) { + if (settings->settings[A5O_AUTO_CONVERT_BITMAPS]) { /* We convert video bitmaps to memory bitmaps when the display is * destroyed, so seems only fair to re-convertt hem when the * display is re-created again. @@ -139,7 +139,7 @@ ALLEGRO_DISPLAY *al_create_display(int w, int h) /* Function: al_destroy_display */ -void al_destroy_display(ALLEGRO_DISPLAY *display) +void al_destroy_display(A5O_DISPLAY *display) { if (display) { /* This causes warnings and potential errors on Android because @@ -147,8 +147,8 @@ void al_destroy_display(ALLEGRO_DISPLAY *display) * the context bound in its destroy function and to destroy the * shader. Just skip this part on Android. */ -#ifndef ALLEGRO_ANDROID - ALLEGRO_BITMAP *bmp; +#ifndef A5O_ANDROID + A5O_BITMAP *bmp; bmp = al_get_target_bitmap(); if (bmp && _al_get_bitmap_display(bmp) == display) @@ -173,7 +173,7 @@ void al_destroy_display(ALLEGRO_DISPLAY *display) /* Function: al_get_backbuffer */ -ALLEGRO_BITMAP *al_get_backbuffer(ALLEGRO_DISPLAY *display) +A5O_BITMAP *al_get_backbuffer(A5O_DISPLAY *display) { if (display) { ASSERT(display->vt); @@ -188,7 +188,7 @@ ALLEGRO_BITMAP *al_get_backbuffer(ALLEGRO_DISPLAY *display) */ void al_flip_display(void) { - ALLEGRO_DISPLAY *display = al_get_current_display(); + A5O_DISPLAY *display = al_get_current_display(); if (display) { ASSERT(display->vt); @@ -202,7 +202,7 @@ void al_flip_display(void) */ void al_update_display_region(int x, int y, int width, int height) { - ALLEGRO_DISPLAY *display = al_get_current_display(); + A5O_DISPLAY *display = al_get_current_display(); if (display) { ASSERT(display->vt); @@ -214,12 +214,12 @@ void al_update_display_region(int x, int y, int width, int height) /* Function: al_acknowledge_resize */ -bool al_acknowledge_resize(ALLEGRO_DISPLAY *display) +bool al_acknowledge_resize(A5O_DISPLAY *display) { ASSERT(display); ASSERT(display->vt); - if (!(display->flags & ALLEGRO_FULLSCREEN)) { + if (!(display->flags & A5O_FULLSCREEN)) { if (display->vt->acknowledge_resize) { return display->vt->acknowledge_resize(display); } @@ -231,12 +231,12 @@ bool al_acknowledge_resize(ALLEGRO_DISPLAY *display) /* Function: al_resize_display */ -bool al_resize_display(ALLEGRO_DISPLAY *display, int width, int height) +bool al_resize_display(A5O_DISPLAY *display, int width, int height) { ASSERT(display); ASSERT(display->vt); - ALLEGRO_INFO("Requested display resize %dx%d\n", width, height); + A5O_INFO("Requested display resize %dx%d\n", width, height); if (display->vt->resize_display) { return display->vt->resize_display(display, width, height); @@ -248,9 +248,9 @@ bool al_resize_display(ALLEGRO_DISPLAY *display, int width, int height) /* Function: al_is_compatible_bitmap */ -bool al_is_compatible_bitmap(ALLEGRO_BITMAP *bitmap) +bool al_is_compatible_bitmap(A5O_BITMAP *bitmap) { - ALLEGRO_DISPLAY *display = al_get_current_display(); + A5O_DISPLAY *display = al_get_current_display(); ASSERT(bitmap); if (display) { @@ -265,7 +265,7 @@ bool al_is_compatible_bitmap(ALLEGRO_BITMAP *bitmap) /* Function: al_get_display_width */ -int al_get_display_width(ALLEGRO_DISPLAY *display) +int al_get_display_width(A5O_DISPLAY *display) { ASSERT(display); @@ -276,7 +276,7 @@ int al_get_display_width(ALLEGRO_DISPLAY *display) /* Function: al_get_display_height */ -int al_get_display_height(ALLEGRO_DISPLAY *display) +int al_get_display_height(A5O_DISPLAY *display) { ASSERT(display); @@ -286,7 +286,7 @@ int al_get_display_height(ALLEGRO_DISPLAY *display) /* Function: al_get_display_format */ -int al_get_display_format(ALLEGRO_DISPLAY *display) +int al_get_display_format(A5O_DISPLAY *display) { ASSERT(display); @@ -296,7 +296,7 @@ int al_get_display_format(ALLEGRO_DISPLAY *display) /* Function: al_get_display_refresh_rate */ -int al_get_display_refresh_rate(ALLEGRO_DISPLAY *display) +int al_get_display_refresh_rate(A5O_DISPLAY *display) { ASSERT(display); @@ -307,7 +307,7 @@ int al_get_display_refresh_rate(ALLEGRO_DISPLAY *display) /* Function: al_get_display_flags */ -int al_get_display_flags(ALLEGRO_DISPLAY *display) +int al_get_display_flags(A5O_DISPLAY *display) { ASSERT(display); @@ -317,12 +317,12 @@ int al_get_display_flags(ALLEGRO_DISPLAY *display) /* Function: al_get_display_orientation */ -int al_get_display_orientation(ALLEGRO_DISPLAY* display) +int al_get_display_orientation(A5O_DISPLAY* display) { if (display && display->vt->get_orientation) return display->vt->get_orientation(display); else - return ALLEGRO_DISPLAY_ORIENTATION_UNKNOWN; + return A5O_DISPLAY_ORIENTATION_UNKNOWN; } @@ -330,7 +330,7 @@ int al_get_display_orientation(ALLEGRO_DISPLAY* display) */ bool al_wait_for_vsync(void) { - ALLEGRO_DISPLAY *display = al_get_current_display(); + A5O_DISPLAY *display = al_get_current_display(); ASSERT(display); if (display->vt->wait_for_vsync) @@ -343,9 +343,9 @@ bool al_wait_for_vsync(void) /* Function: al_set_display_icon */ -void al_set_display_icon(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *icon) +void al_set_display_icon(A5O_DISPLAY *display, A5O_BITMAP *icon) { - ALLEGRO_BITMAP *icons[1] = { icon }; + A5O_BITMAP *icons[1] = { icon }; al_set_display_icons(display, 1, icons); } @@ -354,8 +354,8 @@ void al_set_display_icon(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *icon) /* Function: al_set_display_icons */ -void al_set_display_icons(ALLEGRO_DISPLAY *display, - int num_icons, ALLEGRO_BITMAP *icons[]) +void al_set_display_icons(A5O_DISPLAY *display, + int num_icons, A5O_BITMAP *icons[]) { int i; @@ -373,11 +373,11 @@ void al_set_display_icons(ALLEGRO_DISPLAY *display, /* Function: al_set_window_position */ -void al_set_window_position(ALLEGRO_DISPLAY *display, int x, int y) +void al_set_window_position(A5O_DISPLAY *display, int x, int y) { ASSERT(display); - if (display && display->flags & ALLEGRO_FULLSCREEN) { + if (display && display->flags & A5O_FULLSCREEN) { return; } @@ -389,7 +389,7 @@ void al_set_window_position(ALLEGRO_DISPLAY *display, int x, int y) /* Function: al_get_window_position */ -void al_get_window_position(ALLEGRO_DISPLAY *display, int *x, int *y) +void al_get_window_position(A5O_DISPLAY *display, int *x, int *y) { ASSERT(x); ASSERT(y); @@ -405,7 +405,7 @@ void al_get_window_position(ALLEGRO_DISPLAY *display, int *x, int *y) /* Function: al_get_window_borders */ -bool al_get_window_borders(ALLEGRO_DISPLAY *display, int *left, int *top, int *right, int *bottom) +bool al_get_window_borders(A5O_DISPLAY *display, int *left, int *top, int *right, int *bottom) { if (display && display->vt && display->vt->get_window_borders) { return display->vt->get_window_borders(display, left, top, right, bottom); @@ -418,7 +418,7 @@ bool al_get_window_borders(ALLEGRO_DISPLAY *display, int *left, int *top, int *r /* Function: al_set_window_constraints */ -bool al_set_window_constraints(ALLEGRO_DISPLAY *display, +bool al_set_window_constraints(A5O_DISPLAY *display, int min_w, int min_h, int max_w, int max_h) { ASSERT(display); @@ -435,12 +435,12 @@ bool al_set_window_constraints(ALLEGRO_DISPLAY *display, } /* Cannot constrain when fullscreen. */ - if (display->flags & ALLEGRO_FULLSCREEN) { + if (display->flags & A5O_FULLSCREEN) { return false; } /* Cannot constrain if not resizable. */ - if (!(display->flags & ALLEGRO_RESIZABLE)) { + if (!(display->flags & A5O_RESIZABLE)) { return false; } @@ -456,7 +456,7 @@ bool al_set_window_constraints(ALLEGRO_DISPLAY *display, /* Function: al_get_window_constraints */ -bool al_get_window_constraints(ALLEGRO_DISPLAY *display, +bool al_get_window_constraints(A5O_DISPLAY *display, int *min_w, int *min_h, int *max_w, int *max_h) { ASSERT(display); @@ -477,7 +477,7 @@ bool al_get_window_constraints(ALLEGRO_DISPLAY *display, /* Function: al_set_display_flag */ -bool al_set_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff) +bool al_set_display_flag(A5O_DISPLAY *display, int flag, bool onoff) { ASSERT(display); @@ -490,7 +490,7 @@ bool al_set_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff) /* Function: al_set_window_title */ -void al_set_window_title(ALLEGRO_DISPLAY *display, const char *title) +void al_set_window_title(A5O_DISPLAY *display, const char *title) { if (display && display->vt && display->vt->set_window_title) display->vt->set_window_title(display, title); @@ -499,7 +499,7 @@ void al_set_window_title(ALLEGRO_DISPLAY *display, const char *title) /* Function: al_get_display_event_source */ -ALLEGRO_EVENT_SOURCE *al_get_display_event_source(ALLEGRO_DISPLAY *display) +A5O_EVENT_SOURCE *al_get_display_event_source(A5O_DISPLAY *display) { return &display->es; } @@ -508,7 +508,7 @@ ALLEGRO_EVENT_SOURCE *al_get_display_event_source(ALLEGRO_DISPLAY *display) */ void al_hold_bitmap_drawing(bool hold) { - ALLEGRO_DISPLAY *current_display = al_get_current_display(); + A5O_DISPLAY *current_display = al_get_current_display(); if (current_display) { if (hold && !current_display->cache_enabled) { @@ -518,7 +518,7 @@ void al_hold_bitmap_drawing(bool hold) * holding is turned on, al_use_transform does not update the hardware * transformation. */ - ALLEGRO_TRANSFORM old, ident; + A5O_TRANSFORM old, ident; al_copy_transform(&old, al_get_current_transform()); al_identity_transform(&ident); @@ -544,7 +544,7 @@ void al_hold_bitmap_drawing(bool hold) */ bool al_is_bitmap_drawing_held(void) { - ALLEGRO_DISPLAY *current_display = al_get_current_display(); + A5O_DISPLAY *current_display = al_get_current_display(); if (current_display) return current_display->cache_enabled; @@ -552,41 +552,41 @@ bool al_is_bitmap_drawing_held(void) return false; } -void _al_add_display_invalidated_callback(ALLEGRO_DISPLAY* display, void (*display_invalidated)(ALLEGRO_DISPLAY*)) +void _al_add_display_invalidated_callback(A5O_DISPLAY* display, void (*display_invalidated)(A5O_DISPLAY*)) { if (_al_vector_find(&display->display_invalidated_callbacks, display_invalidated) >= 0) { return; } else { - void (**callback)(ALLEGRO_DISPLAY *) = _al_vector_alloc_back(&display->display_invalidated_callbacks); + void (**callback)(A5O_DISPLAY *) = _al_vector_alloc_back(&display->display_invalidated_callbacks); *callback = display_invalidated; } } -void _al_add_display_validated_callback(ALLEGRO_DISPLAY* display, void (*display_validated)(ALLEGRO_DISPLAY*)) +void _al_add_display_validated_callback(A5O_DISPLAY* display, void (*display_validated)(A5O_DISPLAY*)) { if (_al_vector_find(&display->display_validated_callbacks, display_validated) >= 0) { return; } else { - void (**callback)(ALLEGRO_DISPLAY *) = _al_vector_alloc_back(&display->display_validated_callbacks); + void (**callback)(A5O_DISPLAY *) = _al_vector_alloc_back(&display->display_validated_callbacks); *callback = display_validated; } } -void _al_remove_display_invalidated_callback(ALLEGRO_DISPLAY *display, void (*callback)(ALLEGRO_DISPLAY *)) +void _al_remove_display_invalidated_callback(A5O_DISPLAY *display, void (*callback)(A5O_DISPLAY *)) { _al_vector_find_and_delete(&display->display_invalidated_callbacks, &callback); } -void _al_remove_display_validated_callback(ALLEGRO_DISPLAY *display, void (*callback)(ALLEGRO_DISPLAY *)) +void _al_remove_display_validated_callback(A5O_DISPLAY *display, void (*callback)(A5O_DISPLAY *)) { _al_vector_find_and_delete(&display->display_validated_callbacks, &callback); } /* Function: al_acknowledge_drawing_halt */ -void al_acknowledge_drawing_halt(ALLEGRO_DISPLAY *display) +void al_acknowledge_drawing_halt(A5O_DISPLAY *display) { if (display->vt->acknowledge_drawing_halt) { display->vt->acknowledge_drawing_halt(display); @@ -595,7 +595,7 @@ void al_acknowledge_drawing_halt(ALLEGRO_DISPLAY *display) /* Function: al_acknowledge_drawing_resume */ -void al_acknowledge_drawing_resume(ALLEGRO_DISPLAY *display) +void al_acknowledge_drawing_resume(A5O_DISPLAY *display) { if (display->vt->acknowledge_drawing_resume) { display->vt->acknowledge_drawing_resume(display); @@ -604,34 +604,34 @@ void al_acknowledge_drawing_resume(ALLEGRO_DISPLAY *display) /* Function: al_set_render_state */ -void al_set_render_state(ALLEGRO_RENDER_STATE state, int value) +void al_set_render_state(A5O_RENDER_STATE state, int value) { - ALLEGRO_DISPLAY *display = al_get_current_display(); + A5O_DISPLAY *display = al_get_current_display(); if (!display) return; switch (state) { - case ALLEGRO_ALPHA_TEST: + case A5O_ALPHA_TEST: display->render_state.alpha_test = value; break; - case ALLEGRO_WRITE_MASK: + case A5O_WRITE_MASK: display->render_state.write_mask = value; break; - case ALLEGRO_DEPTH_TEST: + case A5O_DEPTH_TEST: display->render_state.depth_test = value; break; - case ALLEGRO_DEPTH_FUNCTION: + case A5O_DEPTH_FUNCTION: display->render_state.depth_function = value; break; - case ALLEGRO_ALPHA_FUNCTION: + case A5O_ALPHA_FUNCTION: display->render_state.alpha_function = value; break; - case ALLEGRO_ALPHA_TEST_VALUE: + case A5O_ALPHA_TEST_VALUE: display->render_state.alpha_test_value = value; break; default: - ALLEGRO_WARN("unknown state to change: %d\n", state); + A5O_WARN("unknown state to change: %d\n", state); break; } @@ -642,13 +642,13 @@ void al_set_render_state(ALLEGRO_RENDER_STATE state, int value) /* Function: al_backup_dirty_bitmaps */ -void al_backup_dirty_bitmaps(ALLEGRO_DISPLAY *display) +void al_backup_dirty_bitmaps(A5O_DISPLAY *display) { unsigned int i; for (i = 0; i < display->bitmaps._size; i++) { - ALLEGRO_BITMAP **bptr = (ALLEGRO_BITMAP **)_al_vector_ref(&display->bitmaps, i); - ALLEGRO_BITMAP *bmp = *bptr; + A5O_BITMAP **bptr = (A5O_BITMAP **)_al_vector_ref(&display->bitmaps, i); + A5O_BITMAP *bmp = *bptr; if (_al_get_bitmap_display(bmp) == display) { if (bmp->vt && bmp->vt->backup_dirty_bitmap) { bmp->vt->backup_dirty_bitmap(bmp); @@ -659,7 +659,7 @@ void al_backup_dirty_bitmaps(ALLEGRO_DISPLAY *display) /* Function: al_apply_window_constraints */ -void al_apply_window_constraints(ALLEGRO_DISPLAY *display, bool onoff) +void al_apply_window_constraints(A5O_DISPLAY *display, bool onoff) { display->use_constraints = onoff; diff --git a/src/display_settings.c b/src/display_settings.c index 6572655b08..8755d65c5a 100644 --- a/src/display_settings.c +++ b/src/display_settings.c @@ -21,25 +21,25 @@ #include "allegro5/internal/aintern_display.h" #include -ALLEGRO_DEBUG_CHANNEL("display") +A5O_DEBUG_CHANNEL("display") /* Function: al_set_new_display_option */ void al_set_new_display_option(int option, int value, int importance) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS *extras; + A5O_EXTRA_DISPLAY_SETTINGS *extras; extras = _al_get_new_display_settings(); switch (importance) { - case ALLEGRO_REQUIRE: + case A5O_REQUIRE: extras->required |= (int64_t)1 << option; extras->suggested &= ~((int64_t)1 << option); break; - case ALLEGRO_SUGGEST: + case A5O_SUGGEST: extras->suggested |= (int64_t)1 << option; extras->required &= ~((int64_t)1 << option); break; - case ALLEGRO_DONTCARE: + case A5O_DONTCARE: extras->required &= ~((int64_t)1 << option); extras->suggested &= ~((int64_t)1 << option); break; @@ -48,10 +48,10 @@ void al_set_new_display_option(int option, int value, int importance) } -int _al_get_suggested_display_option(ALLEGRO_DISPLAY *d, +int _al_get_suggested_display_option(A5O_DISPLAY *d, int option, int default_value) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS *s = &d->extra_settings; + A5O_EXTRA_DISPLAY_SETTINGS *s = &d->extra_settings; uint64_t flags = s->required | s->suggested; if (flags & ((uint64_t)1 << option)) return s->settings[option]; @@ -63,25 +63,25 @@ int _al_get_suggested_display_option(ALLEGRO_DISPLAY *d, */ int al_get_new_display_option(int option, int *importance) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS *extras; + A5O_EXTRA_DISPLAY_SETTINGS *extras; extras = _al_get_new_display_settings(); if (extras->required & ((int64_t)1 << option)) { - if (importance) *importance = ALLEGRO_REQUIRE; + if (importance) *importance = A5O_REQUIRE; return extras->settings[option]; } if (extras->suggested & ((int64_t)1 << option)) { - if (importance) *importance = ALLEGRO_SUGGEST; + if (importance) *importance = A5O_SUGGEST; return extras->settings[option]; } - if (importance) *importance = ALLEGRO_DONTCARE; + if (importance) *importance = A5O_DONTCARE; return 0; } /* Function: al_set_display_option */ -void al_set_display_option(ALLEGRO_DISPLAY *display, int option, int value) +void al_set_display_option(A5O_DISPLAY *display, int option, int value) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS *extras; + A5O_EXTRA_DISPLAY_SETTINGS *extras; extras = &display->extra_settings; extras->settings[option] = value; if (display->vt->set_display_option) { @@ -91,9 +91,9 @@ void al_set_display_option(ALLEGRO_DISPLAY *display, int option, int value) /* Function: al_get_display_option */ -int al_get_display_option(ALLEGRO_DISPLAY *display, int option) +int al_get_display_option(A5O_DISPLAY *display, int option) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS *extras; + A5O_EXTRA_DISPLAY_SETTINGS *extras; extras = &display->extra_settings; return extras->settings[option]; } @@ -103,7 +103,7 @@ int al_get_display_option(ALLEGRO_DISPLAY *display, int option) */ void al_reset_new_display_options(void) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS *extras; + A5O_EXTRA_DISPLAY_SETTINGS *extras; extras = _al_get_new_display_settings(); _al_fill_display_settings(extras); } @@ -116,128 +116,128 @@ void al_reset_new_display_options(void) /* _al_fill_display_settings() * Will fill in missing settings by 'guessing' what the user intended. */ -void _al_fill_display_settings(ALLEGRO_EXTRA_DISPLAY_SETTINGS *ref) +void _al_fill_display_settings(A5O_EXTRA_DISPLAY_SETTINGS *ref) { - int all_components = (1<settings[ALLEGRO_COLOR_SIZE] = ref->settings[ALLEGRO_RED_SIZE] - + ref->settings[ALLEGRO_GREEN_SIZE] - + ref->settings[ALLEGRO_BLUE_SIZE] - + ref->settings[ALLEGRO_ALPHA_SIZE]; + ref->settings[A5O_COLOR_SIZE] = ref->settings[A5O_RED_SIZE] + + ref->settings[A5O_GREEN_SIZE] + + ref->settings[A5O_BLUE_SIZE] + + ref->settings[A5O_ALPHA_SIZE]; /* Round depth to 8 bits */ - ref->settings[ALLEGRO_COLOR_SIZE] = (ref->settings[ALLEGRO_COLOR_SIZE] + 7) / 8; + ref->settings[A5O_COLOR_SIZE] = (ref->settings[A5O_COLOR_SIZE] + 7) / 8; } /* If only some components were set, guess the others */ else if ((req | sug) & all_components) { - int avg = ((req | sug) & (1<settings[ALLEGRO_RED_SIZE]: 0) - + ((req | sug) & (1<settings[ALLEGRO_GREEN_SIZE]: 0) - + ((req | sug) & (1<settings[ALLEGRO_BLUE_SIZE]: 0) - + ((req | sug) & (1<settings[ALLEGRO_ALPHA_SIZE]: 0); + int avg = ((req | sug) & (1<settings[A5O_RED_SIZE]: 0) + + ((req | sug) & (1<settings[A5O_GREEN_SIZE]: 0) + + ((req | sug) & (1<settings[A5O_BLUE_SIZE]: 0) + + ((req | sug) & (1<settings[A5O_ALPHA_SIZE]: 0); - int num = ((req | sug) & (1<settings[ALLEGRO_RED_SIZE] = avg; + if (((req | sug) & (1<settings[A5O_RED_SIZE] = avg; } - if (((req | sug) & (1<settings[ALLEGRO_GREEN_SIZE] = avg; + if (((req | sug) & (1<settings[A5O_GREEN_SIZE] = avg; } - if (((req | sug) & (1<settings[ALLEGRO_BLUE_SIZE] = avg; + if (((req | sug) & (1<settings[A5O_BLUE_SIZE] = avg; } - if (((req | sug) & (1<settings[ALLEGRO_ALPHA_SIZE] = avg; + if (((req | sug) & (1<settings[A5O_ALPHA_SIZE] = avg; } /* If color depth wasn't defined, figure it out */ - if (((req | sug) & (1<settings[ALLEGRO_COLOR_SIZE], - eds->settings[ALLEGRO_RED_SIZE], - eds->settings[ALLEGRO_GREEN_SIZE], - eds->settings[ALLEGRO_BLUE_SIZE], - eds->settings[ALLEGRO_ALPHA_SIZE], - eds->settings[ALLEGRO_DEPTH_SIZE], - eds->settings[ALLEGRO_STENCIL_SIZE], - eds->settings[ALLEGRO_ACC_RED_SIZE], - eds->settings[ALLEGRO_ACC_RED_SIZE], - eds->settings[ALLEGRO_ACC_RED_SIZE], - eds->settings[ALLEGRO_ACC_RED_SIZE], - eds->settings[ALLEGRO_SAMPLES], - eds->settings[ALLEGRO_SAMPLE_BUFFERS]); + eds->settings[A5O_COLOR_SIZE], + eds->settings[A5O_RED_SIZE], + eds->settings[A5O_GREEN_SIZE], + eds->settings[A5O_BLUE_SIZE], + eds->settings[A5O_ALPHA_SIZE], + eds->settings[A5O_DEPTH_SIZE], + eds->settings[A5O_STENCIL_SIZE], + eds->settings[A5O_ACC_RED_SIZE], + eds->settings[A5O_ACC_RED_SIZE], + eds->settings[A5O_ACC_RED_SIZE], + eds->settings[A5O_ACC_RED_SIZE], + eds->settings[A5O_SAMPLES], + eds->settings[A5O_SAMPLE_BUFFERS]); } -int _al_score_display_settings(ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds, - ALLEGRO_EXTRA_DISPLAY_SETTINGS *ref) +int _al_score_display_settings(A5O_EXTRA_DISPLAY_SETTINGS *eds, + A5O_EXTRA_DISPLAY_SETTINGS *ref) { int score = 0; debug_display_settings(eds); - if (eds->settings[ALLEGRO_COMPATIBLE_DISPLAY] != ref->settings[ALLEGRO_COMPATIBLE_DISPLAY]) { - if (req & (1<settings[A5O_COMPATIBLE_DISPLAY] != ref->settings[A5O_COMPATIBLE_DISPLAY]) { + if (req & (1<settings[ALLEGRO_VSYNC] != ref->settings[ALLEGRO_VSYNC]) { - if (req & (1<settings[A5O_VSYNC] != ref->settings[A5O_VSYNC]) { + if (req & (1<settings[ALLEGRO_COLOR_SIZE] != ref->settings[ALLEGRO_COLOR_SIZE]) { - if (req & (1<settings[A5O_COLOR_SIZE] != ref->settings[A5O_COLOR_SIZE]) { + if (req & (1<settings[ALLEGRO_COLOR_SIZE] < ref->settings[ALLEGRO_COLOR_SIZE]) - score += (96 * eds->settings[ALLEGRO_COLOR_SIZE]) / ref->settings[ALLEGRO_COLOR_SIZE]; + if (sug & (1<settings[A5O_COLOR_SIZE] < ref->settings[A5O_COLOR_SIZE]) + score += (96 * eds->settings[A5O_COLOR_SIZE]) / ref->settings[A5O_COLOR_SIZE]; else - score += 96 + 96 / (1 + eds->settings[ALLEGRO_COLOR_SIZE] - ref->settings[ALLEGRO_COLOR_SIZE]); + score += 96 + 96 / (1 + eds->settings[A5O_COLOR_SIZE] - ref->settings[A5O_COLOR_SIZE]); } /* check colour component widths here and Allegro formatness */ - if ((req & (1<settings[ALLEGRO_RED_SIZE] != ref->settings[ALLEGRO_RED_SIZE])) { - ALLEGRO_DEBUG("Red depth requirement not met.\n"); + if ((req & (1<settings[A5O_RED_SIZE] != ref->settings[A5O_RED_SIZE])) { + A5O_DEBUG("Red depth requirement not met.\n"); return -1; } - if (sug & (1<settings[ALLEGRO_RED_SIZE] < ref->settings[ALLEGRO_RED_SIZE]) { - score += (16 * eds->settings[ALLEGRO_RED_SIZE]) / ref->settings[ALLEGRO_RED_SIZE]; + if (sug & (1<settings[A5O_RED_SIZE] < ref->settings[A5O_RED_SIZE]) { + score += (16 * eds->settings[A5O_RED_SIZE]) / ref->settings[A5O_RED_SIZE]; } else { - score += 16 + 16 / (1 + eds->settings[ALLEGRO_RED_SIZE] - ref->settings[ALLEGRO_RED_SIZE]); + score += 16 + 16 / (1 + eds->settings[A5O_RED_SIZE] - ref->settings[A5O_RED_SIZE]); } } - if ((req & (1<settings[ALLEGRO_GREEN_SIZE] != ref->settings[ALLEGRO_GREEN_SIZE])) { - ALLEGRO_DEBUG("Green depth requirement not met.\n"); + if ((req & (1<settings[A5O_GREEN_SIZE] != ref->settings[A5O_GREEN_SIZE])) { + A5O_DEBUG("Green depth requirement not met.\n"); return -1; } - if (sug & (1<settings[ALLEGRO_GREEN_SIZE] < ref->settings[ALLEGRO_GREEN_SIZE]) { - score += (16 * eds->settings[ALLEGRO_GREEN_SIZE]) / ref->settings[ALLEGRO_GREEN_SIZE]; + if (sug & (1<settings[A5O_GREEN_SIZE] < ref->settings[A5O_GREEN_SIZE]) { + score += (16 * eds->settings[A5O_GREEN_SIZE]) / ref->settings[A5O_GREEN_SIZE]; } else { - score += 16 + 16 / (1 + eds->settings[ALLEGRO_GREEN_SIZE] - ref->settings[ALLEGRO_GREEN_SIZE]); + score += 16 + 16 / (1 + eds->settings[A5O_GREEN_SIZE] - ref->settings[A5O_GREEN_SIZE]); } } - if ((req & (1<settings[ALLEGRO_BLUE_SIZE] != ref->settings[ALLEGRO_BLUE_SIZE])) { - ALLEGRO_DEBUG("Blue depth requirement not met.\n"); + if ((req & (1<settings[A5O_BLUE_SIZE] != ref->settings[A5O_BLUE_SIZE])) { + A5O_DEBUG("Blue depth requirement not met.\n"); return -1; } - if (sug & (1<settings[ALLEGRO_BLUE_SIZE] < ref->settings[ALLEGRO_BLUE_SIZE]) { - score += (16 * eds->settings[ALLEGRO_BLUE_SIZE]) / ref->settings[ALLEGRO_BLUE_SIZE]; + if (sug & (1<settings[A5O_BLUE_SIZE] < ref->settings[A5O_BLUE_SIZE]) { + score += (16 * eds->settings[A5O_BLUE_SIZE]) / ref->settings[A5O_BLUE_SIZE]; } else { - score += 16 + 16 / (1 + eds->settings[ALLEGRO_BLUE_SIZE] - ref->settings[ALLEGRO_BLUE_SIZE]); + score += 16 + 16 / (1 + eds->settings[A5O_BLUE_SIZE] - ref->settings[A5O_BLUE_SIZE]); } } - if ((req & (1<settings[ALLEGRO_ALPHA_SIZE] != ref->settings[ALLEGRO_ALPHA_SIZE])) { - ALLEGRO_DEBUG("Alpha depth requirement not met (%d instead of %d).\n", - eds->settings[ALLEGRO_ALPHA_SIZE], ref->settings[ALLEGRO_ALPHA_SIZE]); + if ((req & (1<settings[A5O_ALPHA_SIZE] != ref->settings[A5O_ALPHA_SIZE])) { + A5O_DEBUG("Alpha depth requirement not met (%d instead of %d).\n", + eds->settings[A5O_ALPHA_SIZE], ref->settings[A5O_ALPHA_SIZE]); return -1; } - if (sug & (1<settings[ALLEGRO_ALPHA_SIZE] < ref->settings[ALLEGRO_ALPHA_SIZE]) { - score += (16 * eds->settings[ALLEGRO_ALPHA_SIZE]) / ref->settings[ALLEGRO_ALPHA_SIZE]; + if (sug & (1<settings[A5O_ALPHA_SIZE] < ref->settings[A5O_ALPHA_SIZE]) { + score += (16 * eds->settings[A5O_ALPHA_SIZE]) / ref->settings[A5O_ALPHA_SIZE]; } else { - score += 16 + 16 / (1 + eds->settings[ALLEGRO_ALPHA_SIZE] - ref->settings[ALLEGRO_ALPHA_SIZE]); + score += 16 + 16 / (1 + eds->settings[A5O_ALPHA_SIZE] - ref->settings[A5O_ALPHA_SIZE]); } } - if ((req & (1<settings[ALLEGRO_ACC_RED_SIZE] != ref->settings[ALLEGRO_ACC_RED_SIZE])) { - ALLEGRO_DEBUG("Accumulator Red depth requirement not met.\n"); + if ((req & (1<settings[A5O_ACC_RED_SIZE] != ref->settings[A5O_ACC_RED_SIZE])) { + A5O_DEBUG("Accumulator Red depth requirement not met.\n"); return -1; } - if (sug & (1<settings[ALLEGRO_ACC_RED_SIZE] < ref->settings[ALLEGRO_ACC_RED_SIZE]) { - score += (16 * eds->settings[ALLEGRO_ACC_RED_SIZE]) / ref->settings[ALLEGRO_ACC_RED_SIZE]; + if (sug & (1<settings[A5O_ACC_RED_SIZE] < ref->settings[A5O_ACC_RED_SIZE]) { + score += (16 * eds->settings[A5O_ACC_RED_SIZE]) / ref->settings[A5O_ACC_RED_SIZE]; } else { - score += 16 + 16 / (1 + eds->settings[ALLEGRO_ACC_RED_SIZE] - ref->settings[ALLEGRO_ACC_RED_SIZE]); + score += 16 + 16 / (1 + eds->settings[A5O_ACC_RED_SIZE] - ref->settings[A5O_ACC_RED_SIZE]); } } - if ((req & (1<settings[ALLEGRO_ACC_GREEN_SIZE] != ref->settings[ALLEGRO_ACC_GREEN_SIZE])) { - ALLEGRO_DEBUG("Accumulator Green depth requirement not met.\n"); + if ((req & (1<settings[A5O_ACC_GREEN_SIZE] != ref->settings[A5O_ACC_GREEN_SIZE])) { + A5O_DEBUG("Accumulator Green depth requirement not met.\n"); return -1; } - if (sug & (1<settings[ALLEGRO_ACC_GREEN_SIZE] < ref->settings[ALLEGRO_ACC_GREEN_SIZE]) { - score += (16 * eds->settings[ALLEGRO_ACC_GREEN_SIZE]) / ref->settings[ALLEGRO_ACC_GREEN_SIZE]; + if (sug & (1<settings[A5O_ACC_GREEN_SIZE] < ref->settings[A5O_ACC_GREEN_SIZE]) { + score += (16 * eds->settings[A5O_ACC_GREEN_SIZE]) / ref->settings[A5O_ACC_GREEN_SIZE]; } else { - score += 16 + 16 / (1 + eds->settings[ALLEGRO_ACC_GREEN_SIZE] - ref->settings[ALLEGRO_ACC_GREEN_SIZE]); + score += 16 + 16 / (1 + eds->settings[A5O_ACC_GREEN_SIZE] - ref->settings[A5O_ACC_GREEN_SIZE]); } } - if ((req & (1<settings[ALLEGRO_ACC_BLUE_SIZE] != ref->settings[ALLEGRO_ACC_BLUE_SIZE])) { - ALLEGRO_DEBUG("Accumulator Blue depth requirement not met.\n"); + if ((req & (1<settings[A5O_ACC_BLUE_SIZE] != ref->settings[A5O_ACC_BLUE_SIZE])) { + A5O_DEBUG("Accumulator Blue depth requirement not met.\n"); return -1; } - if (sug & (1<settings[ALLEGRO_ACC_BLUE_SIZE] < ref->settings[ALLEGRO_ACC_BLUE_SIZE]) { - score += (16 * eds->settings[ALLEGRO_ACC_BLUE_SIZE]) / ref->settings[ALLEGRO_ACC_BLUE_SIZE]; + if (sug & (1<settings[A5O_ACC_BLUE_SIZE] < ref->settings[A5O_ACC_BLUE_SIZE]) { + score += (16 * eds->settings[A5O_ACC_BLUE_SIZE]) / ref->settings[A5O_ACC_BLUE_SIZE]; } else { - score += 16 + 16 / (1 + eds->settings[ALLEGRO_ACC_BLUE_SIZE] - ref->settings[ALLEGRO_ACC_BLUE_SIZE]); + score += 16 + 16 / (1 + eds->settings[A5O_ACC_BLUE_SIZE] - ref->settings[A5O_ACC_BLUE_SIZE]); } } - if ((req & (1<settings[ALLEGRO_ACC_ALPHA_SIZE] != ref->settings[ALLEGRO_ACC_ALPHA_SIZE])) { - ALLEGRO_DEBUG("Accumulator Alpha depth requirement not met.\n"); + if ((req & (1<settings[A5O_ACC_ALPHA_SIZE] != ref->settings[A5O_ACC_ALPHA_SIZE])) { + A5O_DEBUG("Accumulator Alpha depth requirement not met.\n"); return -1; } - if (sug & (1<settings[ALLEGRO_ACC_ALPHA_SIZE] < ref->settings[ALLEGRO_ACC_ALPHA_SIZE]) { - score += (16 * eds->settings[ALLEGRO_ACC_ALPHA_SIZE]) / ref->settings[ALLEGRO_ACC_ALPHA_SIZE]; + if (sug & (1<settings[A5O_ACC_ALPHA_SIZE] < ref->settings[A5O_ACC_ALPHA_SIZE]) { + score += (16 * eds->settings[A5O_ACC_ALPHA_SIZE]) / ref->settings[A5O_ACC_ALPHA_SIZE]; } else { - score += 16 + 16 / (1 + eds->settings[ALLEGRO_ACC_ALPHA_SIZE] - ref->settings[ALLEGRO_ACC_ALPHA_SIZE]); + score += 16 + 16 / (1 + eds->settings[A5O_ACC_ALPHA_SIZE] - ref->settings[A5O_ACC_ALPHA_SIZE]); } } - if (!eds->settings[ALLEGRO_SINGLE_BUFFER] != !ref->settings[ALLEGRO_SINGLE_BUFFER]) { - if (req & (1<settings[A5O_SINGLE_BUFFER] != !ref->settings[A5O_SINGLE_BUFFER]) { + if (req & (1<settings[ALLEGRO_STEREO] != !ref->settings[ALLEGRO_STEREO]) { - if (req & (1<settings[A5O_STEREO] != !ref->settings[A5O_STEREO]) { + if (req & (1<settings[ALLEGRO_AUX_BUFFERS] < ref->settings[ALLEGRO_AUX_BUFFERS])) { - ALLEGRO_DEBUG("Aux Buffer requirement not met.\n"); + if ((req & (1<settings[A5O_AUX_BUFFERS] < ref->settings[A5O_AUX_BUFFERS])) { + A5O_DEBUG("Aux Buffer requirement not met.\n"); return -1; } - if (sug & (1<settings[ALLEGRO_AUX_BUFFERS] < ref->settings[ALLEGRO_AUX_BUFFERS]) { - score += (64 * eds->settings[ALLEGRO_AUX_BUFFERS]) / ref->settings[ALLEGRO_AUX_BUFFERS]; + if (sug & (1<settings[A5O_AUX_BUFFERS] < ref->settings[A5O_AUX_BUFFERS]) { + score += (64 * eds->settings[A5O_AUX_BUFFERS]) / ref->settings[A5O_AUX_BUFFERS]; } else { - score += 64 + 64 / (1 + eds->settings[ALLEGRO_AUX_BUFFERS] - ref->settings[ALLEGRO_AUX_BUFFERS]); + score += 64 + 64 / (1 + eds->settings[A5O_AUX_BUFFERS] - ref->settings[A5O_AUX_BUFFERS]); } } - if ((req & (1<settings[ALLEGRO_DEPTH_SIZE] != ref->settings[ALLEGRO_DEPTH_SIZE])) { - ALLEGRO_DEBUG("Z-Buffer requirement not met.\n"); + if ((req & (1<settings[A5O_DEPTH_SIZE] != ref->settings[A5O_DEPTH_SIZE])) { + A5O_DEBUG("Z-Buffer requirement not met.\n"); return -1; } - if (sug & (1<settings[ALLEGRO_DEPTH_SIZE] < ref->settings[ALLEGRO_DEPTH_SIZE]) { - score += (64 * eds->settings[ALLEGRO_DEPTH_SIZE]) / ref->settings[ALLEGRO_DEPTH_SIZE]; + if (sug & (1<settings[A5O_DEPTH_SIZE] < ref->settings[A5O_DEPTH_SIZE]) { + score += (64 * eds->settings[A5O_DEPTH_SIZE]) / ref->settings[A5O_DEPTH_SIZE]; } else { - score += 64 + 64 / (1 + eds->settings[ALLEGRO_DEPTH_SIZE] - ref->settings[ALLEGRO_DEPTH_SIZE]); + score += 64 + 64 / (1 + eds->settings[A5O_DEPTH_SIZE] - ref->settings[A5O_DEPTH_SIZE]); } } - if ((req & (1<settings[ALLEGRO_STENCIL_SIZE] != ref->settings[ALLEGRO_STENCIL_SIZE])) { - ALLEGRO_DEBUG("Stencil depth requirement not met.\n"); + if ((req & (1<settings[A5O_STENCIL_SIZE] != ref->settings[A5O_STENCIL_SIZE])) { + A5O_DEBUG("Stencil depth requirement not met.\n"); return -1; } - if (sug & (1<settings[ALLEGRO_STENCIL_SIZE] < ref->settings[ALLEGRO_STENCIL_SIZE]) { - score += (64 * eds->settings[ALLEGRO_STENCIL_SIZE]) / ref->settings[ALLEGRO_STENCIL_SIZE]; + if (sug & (1<settings[A5O_STENCIL_SIZE] < ref->settings[A5O_STENCIL_SIZE]) { + score += (64 * eds->settings[A5O_STENCIL_SIZE]) / ref->settings[A5O_STENCIL_SIZE]; } else { - score += 64 + 64 / (1 + eds->settings[ALLEGRO_STENCIL_SIZE] - ref->settings[ALLEGRO_STENCIL_SIZE]); + score += 64 + 64 / (1 + eds->settings[A5O_STENCIL_SIZE] - ref->settings[A5O_STENCIL_SIZE]); } } - if ((req & (1<settings[ALLEGRO_RENDER_METHOD] != ref->settings[ALLEGRO_RENDER_METHOD]) - || (ref->settings[ALLEGRO_RENDER_METHOD] == 2))) { - ALLEGRO_DEBUG("Render Method requirement not met.\n"); + if ((req & (1<settings[A5O_RENDER_METHOD] != ref->settings[A5O_RENDER_METHOD]) + || (ref->settings[A5O_RENDER_METHOD] == 2))) { + A5O_DEBUG("Render Method requirement not met.\n"); return -1; } - if ((sug & (1<settings[ALLEGRO_RENDER_METHOD] == ref->settings[ALLEGRO_RENDER_METHOD])) { + if ((sug & (1<settings[A5O_RENDER_METHOD] == ref->settings[A5O_RENDER_METHOD])) { score += 1024; } - else if (eds->settings[ALLEGRO_RENDER_METHOD] == 1) { + else if (eds->settings[A5O_RENDER_METHOD] == 1) { score++; /* Add 1 for hw accel */ } - if ((req & (1<settings[ALLEGRO_SAMPLE_BUFFERS] != ref->settings[ALLEGRO_SAMPLE_BUFFERS])) { - ALLEGRO_DEBUG("Multisample Buffers requirement not met\n"); + if ((req & (1<settings[A5O_SAMPLE_BUFFERS] != ref->settings[A5O_SAMPLE_BUFFERS])) { + A5O_DEBUG("Multisample Buffers requirement not met\n"); return -1; } - else if (sug & (1<settings[ALLEGRO_SAMPLE_BUFFERS] == ref->settings[ALLEGRO_SAMPLE_BUFFERS]) { + else if (sug & (1<settings[A5O_SAMPLE_BUFFERS] == ref->settings[A5O_SAMPLE_BUFFERS]) { score += 128; } } - if ((req & (1<settings[ALLEGRO_SAMPLES] != ref->settings[ALLEGRO_SAMPLES])) { - ALLEGRO_DEBUG("Multisample Samples requirement not met\n"); + if ((req & (1<settings[A5O_SAMPLES] != ref->settings[A5O_SAMPLES])) { + A5O_DEBUG("Multisample Samples requirement not met\n"); return -1; } - if (sug & (1<settings[ALLEGRO_SAMPLES] < ref->settings[ALLEGRO_SAMPLES]) { - score += (64 * eds->settings[ALLEGRO_SAMPLES]) / ref->settings[ALLEGRO_SAMPLES]; + if (sug & (1<settings[A5O_SAMPLES] < ref->settings[A5O_SAMPLES]) { + score += (64 * eds->settings[A5O_SAMPLES]) / ref->settings[A5O_SAMPLES]; } else { - score += 64 + 64 / (1 + eds->settings[ALLEGRO_SAMPLES] - ref->settings[ALLEGRO_SAMPLES]); + score += 64 + 64 / (1 + eds->settings[A5O_SAMPLES] - ref->settings[A5O_SAMPLES]); } } - if (!eds->settings[ALLEGRO_FLOAT_COLOR] != !ref->settings[ALLEGRO_FLOAT_COLOR]) { - if (req & (1<settings[A5O_FLOAT_COLOR] != !ref->settings[A5O_FLOAT_COLOR]) { + if (req & (1<settings[ALLEGRO_FLOAT_DEPTH] != !ref->settings[ALLEGRO_FLOAT_DEPTH]) { - if (req & (1<settings[A5O_FLOAT_DEPTH] != !ref->settings[A5O_FLOAT_DEPTH]) { + if (req & (1<settings[ALLEGRO_RED_SIZE] == 8 && - eds->settings[ALLEGRO_GREEN_SIZE] == 8 && - eds->settings[ALLEGRO_BLUE_SIZE] == 8) { - if (eds->settings[ALLEGRO_ALPHA_SIZE] == 8 && - eds->settings[ALLEGRO_COLOR_SIZE] == 32) { - if (eds->settings[ALLEGRO_ALPHA_SHIFT] == 0 && - eds->settings[ALLEGRO_BLUE_SHIFT] == 8 && - eds->settings[ALLEGRO_GREEN_SHIFT] == 16 && - eds->settings[ALLEGRO_RED_SHIFT] == 24) { - format = ALLEGRO_PIXEL_FORMAT_RGBA_8888; + int format = A5O_PIXEL_FORMAT_ANY; + + if (eds->settings[A5O_RED_SIZE] == 8 && + eds->settings[A5O_GREEN_SIZE] == 8 && + eds->settings[A5O_BLUE_SIZE] == 8) { + if (eds->settings[A5O_ALPHA_SIZE] == 8 && + eds->settings[A5O_COLOR_SIZE] == 32) { + if (eds->settings[A5O_ALPHA_SHIFT] == 0 && + eds->settings[A5O_BLUE_SHIFT] == 8 && + eds->settings[A5O_GREEN_SHIFT] == 16 && + eds->settings[A5O_RED_SHIFT] == 24) { + format = A5O_PIXEL_FORMAT_RGBA_8888; } - else if (eds->settings[ALLEGRO_ALPHA_SHIFT] == 24 && - eds->settings[ALLEGRO_RED_SHIFT] == 0 && - eds->settings[ALLEGRO_GREEN_SHIFT] == 8 && - eds->settings[ALLEGRO_BLUE_SHIFT] == 16) { - format = ALLEGRO_PIXEL_FORMAT_ABGR_8888; + else if (eds->settings[A5O_ALPHA_SHIFT] == 24 && + eds->settings[A5O_RED_SHIFT] == 0 && + eds->settings[A5O_GREEN_SHIFT] == 8 && + eds->settings[A5O_BLUE_SHIFT] == 16) { + format = A5O_PIXEL_FORMAT_ABGR_8888; } - else if (eds->settings[ALLEGRO_ALPHA_SHIFT] == 24 && - eds->settings[ALLEGRO_RED_SHIFT] == 16 && - eds->settings[ALLEGRO_GREEN_SHIFT] == 8 && - eds->settings[ALLEGRO_BLUE_SHIFT] == 0) { - format = ALLEGRO_PIXEL_FORMAT_ARGB_8888; + else if (eds->settings[A5O_ALPHA_SHIFT] == 24 && + eds->settings[A5O_RED_SHIFT] == 16 && + eds->settings[A5O_GREEN_SHIFT] == 8 && + eds->settings[A5O_BLUE_SHIFT] == 0) { + format = A5O_PIXEL_FORMAT_ARGB_8888; } } - else if (eds->settings[ALLEGRO_ALPHA_SIZE] == 0 && - eds->settings[ALLEGRO_COLOR_SIZE] == 24) { - if (eds->settings[ALLEGRO_BLUE_SHIFT] == 0 && - eds->settings[ALLEGRO_GREEN_SHIFT] == 8 && - eds->settings[ALLEGRO_RED_SHIFT] == 16) { - format = ALLEGRO_PIXEL_FORMAT_RGB_888; + else if (eds->settings[A5O_ALPHA_SIZE] == 0 && + eds->settings[A5O_COLOR_SIZE] == 24) { + if (eds->settings[A5O_BLUE_SHIFT] == 0 && + eds->settings[A5O_GREEN_SHIFT] == 8 && + eds->settings[A5O_RED_SHIFT] == 16) { + format = A5O_PIXEL_FORMAT_RGB_888; } - else if (eds->settings[ALLEGRO_RED_SHIFT] == 0 && - eds->settings[ALLEGRO_GREEN_SHIFT] == 8 && - eds->settings[ALLEGRO_BLUE_SHIFT] == 16) { - format = ALLEGRO_PIXEL_FORMAT_BGR_888; + else if (eds->settings[A5O_RED_SHIFT] == 0 && + eds->settings[A5O_GREEN_SHIFT] == 8 && + eds->settings[A5O_BLUE_SHIFT] == 16) { + format = A5O_PIXEL_FORMAT_BGR_888; } } - else if (eds->settings[ALLEGRO_ALPHA_SIZE] == 0 && - eds->settings[ALLEGRO_COLOR_SIZE] == 32) { - if (eds->settings[ALLEGRO_BLUE_SHIFT] == 0 && - eds->settings[ALLEGRO_GREEN_SHIFT] == 8 && - eds->settings[ALLEGRO_RED_SHIFT] == 16) { - format = ALLEGRO_PIXEL_FORMAT_XRGB_8888; + else if (eds->settings[A5O_ALPHA_SIZE] == 0 && + eds->settings[A5O_COLOR_SIZE] == 32) { + if (eds->settings[A5O_BLUE_SHIFT] == 0 && + eds->settings[A5O_GREEN_SHIFT] == 8 && + eds->settings[A5O_RED_SHIFT] == 16) { + format = A5O_PIXEL_FORMAT_XRGB_8888; } - else if (eds->settings[ALLEGRO_RED_SHIFT] == 0 && - eds->settings[ALLEGRO_GREEN_SHIFT] == 8 && - eds->settings[ALLEGRO_BLUE_SHIFT] == 16) { - format = ALLEGRO_PIXEL_FORMAT_XBGR_8888; + else if (eds->settings[A5O_RED_SHIFT] == 0 && + eds->settings[A5O_GREEN_SHIFT] == 8 && + eds->settings[A5O_BLUE_SHIFT] == 16) { + format = A5O_PIXEL_FORMAT_XBGR_8888; } - else if (eds->settings[ALLEGRO_RED_SHIFT] == 24 && - eds->settings[ALLEGRO_GREEN_SHIFT] == 16 && - eds->settings[ALLEGRO_BLUE_SHIFT] == 8) { - format = ALLEGRO_PIXEL_FORMAT_RGBX_8888; + else if (eds->settings[A5O_RED_SHIFT] == 24 && + eds->settings[A5O_GREEN_SHIFT] == 16 && + eds->settings[A5O_BLUE_SHIFT] == 8) { + format = A5O_PIXEL_FORMAT_RGBX_8888; } } } - else if (eds->settings[ALLEGRO_RED_SIZE] == 5 && - eds->settings[ALLEGRO_GREEN_SIZE] == 6 && - eds->settings[ALLEGRO_BLUE_SIZE] == 5) { - if (eds->settings[ALLEGRO_RED_SHIFT] == 0 && - eds->settings[ALLEGRO_GREEN_SHIFT] == 5 && - eds->settings[ALLEGRO_BLUE_SHIFT] == 11) { - format = ALLEGRO_PIXEL_FORMAT_BGR_565; - } - else if (eds->settings[ALLEGRO_BLUE_SHIFT] == 0 && - eds->settings[ALLEGRO_GREEN_SHIFT] == 5 && - eds->settings[ALLEGRO_RED_SHIFT] == 11) { - format = ALLEGRO_PIXEL_FORMAT_RGB_565; - } - } - else if (eds->settings[ALLEGRO_RED_SIZE] == 5 && - eds->settings[ALLEGRO_GREEN_SIZE] == 5 && - eds->settings[ALLEGRO_BLUE_SIZE] == 5) { - if (eds->settings[ALLEGRO_ALPHA_SIZE] == 1 && - eds->settings[ALLEGRO_COLOR_SIZE] == 16) { - if (eds->settings[ALLEGRO_ALPHA_SHIFT] == 0 && - eds->settings[ALLEGRO_BLUE_SHIFT] == 1 && - eds->settings[ALLEGRO_GREEN_SHIFT] == 6 && - eds->settings[ALLEGRO_RED_SHIFT] == 11) { - format = ALLEGRO_PIXEL_FORMAT_RGBA_5551; + else if (eds->settings[A5O_RED_SIZE] == 5 && + eds->settings[A5O_GREEN_SIZE] == 6 && + eds->settings[A5O_BLUE_SIZE] == 5) { + if (eds->settings[A5O_RED_SHIFT] == 0 && + eds->settings[A5O_GREEN_SHIFT] == 5 && + eds->settings[A5O_BLUE_SHIFT] == 11) { + format = A5O_PIXEL_FORMAT_BGR_565; + } + else if (eds->settings[A5O_BLUE_SHIFT] == 0 && + eds->settings[A5O_GREEN_SHIFT] == 5 && + eds->settings[A5O_RED_SHIFT] == 11) { + format = A5O_PIXEL_FORMAT_RGB_565; + } + } + else if (eds->settings[A5O_RED_SIZE] == 5 && + eds->settings[A5O_GREEN_SIZE] == 5 && + eds->settings[A5O_BLUE_SIZE] == 5) { + if (eds->settings[A5O_ALPHA_SIZE] == 1 && + eds->settings[A5O_COLOR_SIZE] == 16) { + if (eds->settings[A5O_ALPHA_SHIFT] == 0 && + eds->settings[A5O_BLUE_SHIFT] == 1 && + eds->settings[A5O_GREEN_SHIFT] == 6 && + eds->settings[A5O_RED_SHIFT] == 11) { + format = A5O_PIXEL_FORMAT_RGBA_5551; } - if (eds->settings[ALLEGRO_ALPHA_SHIFT] == 15 && - eds->settings[ALLEGRO_BLUE_SHIFT] == 0 && - eds->settings[ALLEGRO_GREEN_SHIFT] == 5 && - eds->settings[ALLEGRO_RED_SHIFT] == 10) { - format = ALLEGRO_PIXEL_FORMAT_ARGB_1555; + if (eds->settings[A5O_ALPHA_SHIFT] == 15 && + eds->settings[A5O_BLUE_SHIFT] == 0 && + eds->settings[A5O_GREEN_SHIFT] == 5 && + eds->settings[A5O_RED_SHIFT] == 10) { + format = A5O_PIXEL_FORMAT_ARGB_1555; } } } - else if (eds->settings[ALLEGRO_RED_SIZE] == 4 && - eds->settings[ALLEGRO_GREEN_SIZE] == 4 && - eds->settings[ALLEGRO_BLUE_SIZE] == 4) { - if (eds->settings[ALLEGRO_ALPHA_SIZE] == 4 && - eds->settings[ALLEGRO_COLOR_SIZE] == 16) { - if (eds->settings[ALLEGRO_ALPHA_SHIFT] == 12 && - eds->settings[ALLEGRO_BLUE_SHIFT] == 0 && - eds->settings[ALLEGRO_GREEN_SHIFT] == 4 && - eds->settings[ALLEGRO_RED_SHIFT] == 8) { - format = ALLEGRO_PIXEL_FORMAT_ARGB_4444; + else if (eds->settings[A5O_RED_SIZE] == 4 && + eds->settings[A5O_GREEN_SIZE] == 4 && + eds->settings[A5O_BLUE_SIZE] == 4) { + if (eds->settings[A5O_ALPHA_SIZE] == 4 && + eds->settings[A5O_COLOR_SIZE] == 16) { + if (eds->settings[A5O_ALPHA_SHIFT] == 12 && + eds->settings[A5O_BLUE_SHIFT] == 0 && + eds->settings[A5O_GREEN_SHIFT] == 4 && + eds->settings[A5O_RED_SHIFT] == 8) { + format = A5O_PIXEL_FORMAT_ARGB_4444; } - else if (eds->settings[ALLEGRO_ALPHA_SHIFT] == 12 && - eds->settings[ALLEGRO_BLUE_SHIFT] == 8 && - eds->settings[ALLEGRO_GREEN_SHIFT] == 4 && - eds->settings[ALLEGRO_RED_SHIFT] == 0) { - format = ALLEGRO_PIXEL_FORMAT_RGBA_4444; + else if (eds->settings[A5O_ALPHA_SHIFT] == 12 && + eds->settings[A5O_BLUE_SHIFT] == 8 && + eds->settings[A5O_GREEN_SHIFT] == 4 && + eds->settings[A5O_RED_SHIFT] == 0) { + format = A5O_PIXEL_FORMAT_RGBA_4444; } } } - if (format == ALLEGRO_PIXEL_FORMAT_ANY) { - ALLEGRO_WARN( + if (format == A5O_PIXEL_FORMAT_ANY) { + A5O_WARN( "Could not deduce color format, sizes = (%d,%d,%d,%d,%d), shifts = (%d,%d,%d,%d)\n", - eds->settings[ALLEGRO_RED_SIZE], - eds->settings[ALLEGRO_GREEN_SIZE], - eds->settings[ALLEGRO_BLUE_SIZE], - eds->settings[ALLEGRO_ALPHA_SIZE], - eds->settings[ALLEGRO_COLOR_SIZE], - eds->settings[ALLEGRO_RED_SHIFT], - eds->settings[ALLEGRO_GREEN_SHIFT], - eds->settings[ALLEGRO_BLUE_SHIFT], - eds->settings[ALLEGRO_ALPHA_SHIFT]); + eds->settings[A5O_RED_SIZE], + eds->settings[A5O_GREEN_SIZE], + eds->settings[A5O_BLUE_SIZE], + eds->settings[A5O_ALPHA_SIZE], + eds->settings[A5O_COLOR_SIZE], + eds->settings[A5O_RED_SHIFT], + eds->settings[A5O_GREEN_SHIFT], + eds->settings[A5O_BLUE_SHIFT], + eds->settings[A5O_ALPHA_SHIFT]); } return format; } -void _al_set_color_components(int format, ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds, +void _al_set_color_components(int format, A5O_EXTRA_DISPLAY_SETTINGS *eds, int importance) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS old_eds; + A5O_EXTRA_DISPLAY_SETTINGS old_eds; memcpy(&old_eds, _al_get_new_display_settings(), sizeof(old_eds)); _al_set_new_display_settings(eds); - al_set_new_display_option(ALLEGRO_RED_SIZE, 0, ALLEGRO_DONTCARE); - al_set_new_display_option(ALLEGRO_RED_SHIFT, 0, ALLEGRO_DONTCARE); - al_set_new_display_option(ALLEGRO_GREEN_SIZE, 0, ALLEGRO_DONTCARE); - al_set_new_display_option(ALLEGRO_GREEN_SHIFT, 0, ALLEGRO_DONTCARE); - al_set_new_display_option(ALLEGRO_BLUE_SIZE, 0, ALLEGRO_DONTCARE); - al_set_new_display_option(ALLEGRO_BLUE_SHIFT, 0, ALLEGRO_DONTCARE); - al_set_new_display_option(ALLEGRO_ALPHA_SIZE, 0, ALLEGRO_DONTCARE); - al_set_new_display_option(ALLEGRO_ALPHA_SHIFT, 0, ALLEGRO_DONTCARE); - al_set_new_display_option(ALLEGRO_COLOR_SIZE, 0, ALLEGRO_DONTCARE); + al_set_new_display_option(A5O_RED_SIZE, 0, A5O_DONTCARE); + al_set_new_display_option(A5O_RED_SHIFT, 0, A5O_DONTCARE); + al_set_new_display_option(A5O_GREEN_SIZE, 0, A5O_DONTCARE); + al_set_new_display_option(A5O_GREEN_SHIFT, 0, A5O_DONTCARE); + al_set_new_display_option(A5O_BLUE_SIZE, 0, A5O_DONTCARE); + al_set_new_display_option(A5O_BLUE_SHIFT, 0, A5O_DONTCARE); + al_set_new_display_option(A5O_ALPHA_SIZE, 0, A5O_DONTCARE); + al_set_new_display_option(A5O_ALPHA_SHIFT, 0, A5O_DONTCARE); + al_set_new_display_option(A5O_COLOR_SIZE, 0, A5O_DONTCARE); switch (format) { - case ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA: - al_set_new_display_option(ALLEGRO_ALPHA_SIZE, 0, importance); + case A5O_PIXEL_FORMAT_ANY_NO_ALPHA: + al_set_new_display_option(A5O_ALPHA_SIZE, 0, importance); break; - case ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA: - al_set_new_display_option(ALLEGRO_ALPHA_SIZE, 8, importance); + case A5O_PIXEL_FORMAT_ANY_WITH_ALPHA: + al_set_new_display_option(A5O_ALPHA_SIZE, 8, importance); break; - case ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA: - al_set_new_display_option(ALLEGRO_ALPHA_SIZE, 0, importance); - al_set_new_display_option(ALLEGRO_COLOR_SIZE, 16, importance); + case A5O_PIXEL_FORMAT_ANY_16_NO_ALPHA: + al_set_new_display_option(A5O_ALPHA_SIZE, 0, importance); + al_set_new_display_option(A5O_COLOR_SIZE, 16, importance); break; - case ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA: - al_set_new_display_option(ALLEGRO_ALPHA_SIZE, 1, importance); - al_set_new_display_option(ALLEGRO_COLOR_SIZE, 16, importance); + case A5O_PIXEL_FORMAT_ANY_16_WITH_ALPHA: + al_set_new_display_option(A5O_ALPHA_SIZE, 1, importance); + al_set_new_display_option(A5O_COLOR_SIZE, 16, importance); break; - case ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA: - al_set_new_display_option(ALLEGRO_ALPHA_SIZE, 0, importance); - al_set_new_display_option(ALLEGRO_COLOR_SIZE, 24, importance); + case A5O_PIXEL_FORMAT_ANY_24_NO_ALPHA: + al_set_new_display_option(A5O_ALPHA_SIZE, 0, importance); + al_set_new_display_option(A5O_COLOR_SIZE, 24, importance); break; - case ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA: + case A5O_PIXEL_FORMAT_ANY_32_NO_ALPHA: /* With OpenGL drivers, we never "know" the actual pixel * format. We use glReadPixels when we lock the screen, so * we can always lock the screen in any format we want. There @@ -733,167 +733,167 @@ void _al_set_color_components(int format, ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds, * the number of bits used for red/green/blue/alpha to us only. * They never report any "X bits".). */ - al_set_new_display_option(ALLEGRO_ALPHA_SIZE, 0, importance); - al_set_new_display_option(ALLEGRO_COLOR_SIZE, 32, ALLEGRO_SUGGEST); + al_set_new_display_option(A5O_ALPHA_SIZE, 0, importance); + al_set_new_display_option(A5O_COLOR_SIZE, 32, A5O_SUGGEST); break; - case ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA: - al_set_new_display_option(ALLEGRO_ALPHA_SIZE, 8, importance); - al_set_new_display_option(ALLEGRO_COLOR_SIZE, 32, importance); + case A5O_PIXEL_FORMAT_ANY_32_WITH_ALPHA: + al_set_new_display_option(A5O_ALPHA_SIZE, 8, importance); + al_set_new_display_option(A5O_COLOR_SIZE, 32, importance); break; } switch (format) { - case ALLEGRO_PIXEL_FORMAT_RGBA_8888: - case ALLEGRO_PIXEL_FORMAT_ABGR_8888: - case ALLEGRO_PIXEL_FORMAT_ARGB_8888: - case ALLEGRO_PIXEL_FORMAT_RGB_888: - case ALLEGRO_PIXEL_FORMAT_BGR_888: - case ALLEGRO_PIXEL_FORMAT_RGBX_8888: - case ALLEGRO_PIXEL_FORMAT_XRGB_8888: - case ALLEGRO_PIXEL_FORMAT_XBGR_8888: - al_set_new_display_option(ALLEGRO_RED_SIZE, 8, importance); - al_set_new_display_option(ALLEGRO_GREEN_SIZE, 8, importance); - al_set_new_display_option(ALLEGRO_BLUE_SIZE, 8, importance); + case A5O_PIXEL_FORMAT_RGBA_8888: + case A5O_PIXEL_FORMAT_ABGR_8888: + case A5O_PIXEL_FORMAT_ARGB_8888: + case A5O_PIXEL_FORMAT_RGB_888: + case A5O_PIXEL_FORMAT_BGR_888: + case A5O_PIXEL_FORMAT_RGBX_8888: + case A5O_PIXEL_FORMAT_XRGB_8888: + case A5O_PIXEL_FORMAT_XBGR_8888: + al_set_new_display_option(A5O_RED_SIZE, 8, importance); + al_set_new_display_option(A5O_GREEN_SIZE, 8, importance); + al_set_new_display_option(A5O_BLUE_SIZE, 8, importance); break; - case ALLEGRO_PIXEL_FORMAT_BGR_565: - case ALLEGRO_PIXEL_FORMAT_RGB_565: - al_set_new_display_option(ALLEGRO_RED_SIZE, 5, importance); - al_set_new_display_option(ALLEGRO_GREEN_SIZE, 6, importance); - al_set_new_display_option(ALLEGRO_BLUE_SIZE, 5, importance); + case A5O_PIXEL_FORMAT_BGR_565: + case A5O_PIXEL_FORMAT_RGB_565: + al_set_new_display_option(A5O_RED_SIZE, 5, importance); + al_set_new_display_option(A5O_GREEN_SIZE, 6, importance); + al_set_new_display_option(A5O_BLUE_SIZE, 5, importance); break; - case ALLEGRO_PIXEL_FORMAT_RGBA_5551: - case ALLEGRO_PIXEL_FORMAT_ARGB_1555: - al_set_new_display_option(ALLEGRO_RED_SIZE, 5, importance); - al_set_new_display_option(ALLEGRO_GREEN_SIZE, 5, importance); - al_set_new_display_option(ALLEGRO_BLUE_SIZE, 5, importance); + case A5O_PIXEL_FORMAT_RGBA_5551: + case A5O_PIXEL_FORMAT_ARGB_1555: + al_set_new_display_option(A5O_RED_SIZE, 5, importance); + al_set_new_display_option(A5O_GREEN_SIZE, 5, importance); + al_set_new_display_option(A5O_BLUE_SIZE, 5, importance); break; - case ALLEGRO_PIXEL_FORMAT_ARGB_4444: - case ALLEGRO_PIXEL_FORMAT_RGBA_4444: - al_set_new_display_option(ALLEGRO_RED_SIZE, 4, importance); - al_set_new_display_option(ALLEGRO_GREEN_SIZE, 4, importance); - al_set_new_display_option(ALLEGRO_BLUE_SIZE, 4, importance); + case A5O_PIXEL_FORMAT_ARGB_4444: + case A5O_PIXEL_FORMAT_RGBA_4444: + al_set_new_display_option(A5O_RED_SIZE, 4, importance); + al_set_new_display_option(A5O_GREEN_SIZE, 4, importance); + al_set_new_display_option(A5O_BLUE_SIZE, 4, importance); break; } switch (format) { - case ALLEGRO_PIXEL_FORMAT_RGBA_8888: - case ALLEGRO_PIXEL_FORMAT_ABGR_8888: - case ALLEGRO_PIXEL_FORMAT_ARGB_8888: - al_set_new_display_option(ALLEGRO_ALPHA_SIZE, 8, importance); - al_set_new_display_option(ALLEGRO_COLOR_SIZE, 32, importance); + case A5O_PIXEL_FORMAT_RGBA_8888: + case A5O_PIXEL_FORMAT_ABGR_8888: + case A5O_PIXEL_FORMAT_ARGB_8888: + al_set_new_display_option(A5O_ALPHA_SIZE, 8, importance); + al_set_new_display_option(A5O_COLOR_SIZE, 32, importance); break; - case ALLEGRO_PIXEL_FORMAT_RGB_888: - case ALLEGRO_PIXEL_FORMAT_BGR_888: - al_set_new_display_option(ALLEGRO_ALPHA_SIZE, 0, importance); - al_set_new_display_option(ALLEGRO_COLOR_SIZE, 24, importance); + case A5O_PIXEL_FORMAT_RGB_888: + case A5O_PIXEL_FORMAT_BGR_888: + al_set_new_display_option(A5O_ALPHA_SIZE, 0, importance); + al_set_new_display_option(A5O_COLOR_SIZE, 24, importance); break; - case ALLEGRO_PIXEL_FORMAT_RGBX_8888: - case ALLEGRO_PIXEL_FORMAT_XRGB_8888: - case ALLEGRO_PIXEL_FORMAT_XBGR_8888: - al_set_new_display_option(ALLEGRO_ALPHA_SIZE, 0, importance); - al_set_new_display_option(ALLEGRO_COLOR_SIZE, 32, importance); + case A5O_PIXEL_FORMAT_RGBX_8888: + case A5O_PIXEL_FORMAT_XRGB_8888: + case A5O_PIXEL_FORMAT_XBGR_8888: + al_set_new_display_option(A5O_ALPHA_SIZE, 0, importance); + al_set_new_display_option(A5O_COLOR_SIZE, 32, importance); break; - case ALLEGRO_PIXEL_FORMAT_BGR_565: - case ALLEGRO_PIXEL_FORMAT_RGB_565: - al_set_new_display_option(ALLEGRO_ALPHA_SIZE, 0, importance); - al_set_new_display_option(ALLEGRO_COLOR_SIZE, 16, importance); + case A5O_PIXEL_FORMAT_BGR_565: + case A5O_PIXEL_FORMAT_RGB_565: + al_set_new_display_option(A5O_ALPHA_SIZE, 0, importance); + al_set_new_display_option(A5O_COLOR_SIZE, 16, importance); break; - case ALLEGRO_PIXEL_FORMAT_RGBA_5551: - case ALLEGRO_PIXEL_FORMAT_ARGB_1555: - al_set_new_display_option(ALLEGRO_ALPHA_SIZE, 1, importance); - al_set_new_display_option(ALLEGRO_COLOR_SIZE, 16, importance); + case A5O_PIXEL_FORMAT_RGBA_5551: + case A5O_PIXEL_FORMAT_ARGB_1555: + al_set_new_display_option(A5O_ALPHA_SIZE, 1, importance); + al_set_new_display_option(A5O_COLOR_SIZE, 16, importance); break; - case ALLEGRO_PIXEL_FORMAT_ARGB_4444: - case ALLEGRO_PIXEL_FORMAT_RGBA_4444: - al_set_new_display_option(ALLEGRO_ALPHA_SIZE, 4, importance); - al_set_new_display_option(ALLEGRO_COLOR_SIZE, 16, importance); + case A5O_PIXEL_FORMAT_ARGB_4444: + case A5O_PIXEL_FORMAT_RGBA_4444: + al_set_new_display_option(A5O_ALPHA_SIZE, 4, importance); + al_set_new_display_option(A5O_COLOR_SIZE, 16, importance); break; } switch (format) { - case ALLEGRO_PIXEL_FORMAT_RGBA_8888: - al_set_new_display_option(ALLEGRO_ALPHA_SHIFT, 0, importance); - al_set_new_display_option(ALLEGRO_BLUE_SHIFT, 8, importance); - al_set_new_display_option(ALLEGRO_GREEN_SHIFT, 16, importance); - al_set_new_display_option(ALLEGRO_RED_SHIFT, 24, importance); + case A5O_PIXEL_FORMAT_RGBA_8888: + al_set_new_display_option(A5O_ALPHA_SHIFT, 0, importance); + al_set_new_display_option(A5O_BLUE_SHIFT, 8, importance); + al_set_new_display_option(A5O_GREEN_SHIFT, 16, importance); + al_set_new_display_option(A5O_RED_SHIFT, 24, importance); break; - case ALLEGRO_PIXEL_FORMAT_ABGR_8888: - al_set_new_display_option(ALLEGRO_ALPHA_SHIFT, 24, importance); - al_set_new_display_option(ALLEGRO_BLUE_SHIFT, 16, importance); - al_set_new_display_option(ALLEGRO_GREEN_SHIFT, 8, importance); - al_set_new_display_option(ALLEGRO_RED_SHIFT, 0, importance); + case A5O_PIXEL_FORMAT_ABGR_8888: + al_set_new_display_option(A5O_ALPHA_SHIFT, 24, importance); + al_set_new_display_option(A5O_BLUE_SHIFT, 16, importance); + al_set_new_display_option(A5O_GREEN_SHIFT, 8, importance); + al_set_new_display_option(A5O_RED_SHIFT, 0, importance); break; - case ALLEGRO_PIXEL_FORMAT_ARGB_8888: - al_set_new_display_option(ALLEGRO_ALPHA_SHIFT, 24, importance); - al_set_new_display_option(ALLEGRO_BLUE_SHIFT, 0, importance); - al_set_new_display_option(ALLEGRO_GREEN_SHIFT, 8, importance); - al_set_new_display_option(ALLEGRO_RED_SHIFT, 16, importance); + case A5O_PIXEL_FORMAT_ARGB_8888: + al_set_new_display_option(A5O_ALPHA_SHIFT, 24, importance); + al_set_new_display_option(A5O_BLUE_SHIFT, 0, importance); + al_set_new_display_option(A5O_GREEN_SHIFT, 8, importance); + al_set_new_display_option(A5O_RED_SHIFT, 16, importance); break; - case ALLEGRO_PIXEL_FORMAT_RGB_888: - al_set_new_display_option(ALLEGRO_ALPHA_SHIFT, 0, importance); - al_set_new_display_option(ALLEGRO_BLUE_SHIFT, 0, importance); - al_set_new_display_option(ALLEGRO_GREEN_SHIFT, 8, importance); - al_set_new_display_option(ALLEGRO_RED_SHIFT, 16, importance); + case A5O_PIXEL_FORMAT_RGB_888: + al_set_new_display_option(A5O_ALPHA_SHIFT, 0, importance); + al_set_new_display_option(A5O_BLUE_SHIFT, 0, importance); + al_set_new_display_option(A5O_GREEN_SHIFT, 8, importance); + al_set_new_display_option(A5O_RED_SHIFT, 16, importance); break; - case ALLEGRO_PIXEL_FORMAT_BGR_888: - al_set_new_display_option(ALLEGRO_ALPHA_SHIFT, 0, importance); - al_set_new_display_option(ALLEGRO_BLUE_SHIFT, 16, importance); - al_set_new_display_option(ALLEGRO_GREEN_SHIFT, 8, importance); - al_set_new_display_option(ALLEGRO_RED_SHIFT, 0, importance); + case A5O_PIXEL_FORMAT_BGR_888: + al_set_new_display_option(A5O_ALPHA_SHIFT, 0, importance); + al_set_new_display_option(A5O_BLUE_SHIFT, 16, importance); + al_set_new_display_option(A5O_GREEN_SHIFT, 8, importance); + al_set_new_display_option(A5O_RED_SHIFT, 0, importance); break; - case ALLEGRO_PIXEL_FORMAT_XRGB_8888: - al_set_new_display_option(ALLEGRO_ALPHA_SHIFT, 0, importance); - al_set_new_display_option(ALLEGRO_BLUE_SHIFT, 0, importance); - al_set_new_display_option(ALLEGRO_GREEN_SHIFT, 8, importance); - al_set_new_display_option(ALLEGRO_RED_SHIFT, 16, importance); + case A5O_PIXEL_FORMAT_XRGB_8888: + al_set_new_display_option(A5O_ALPHA_SHIFT, 0, importance); + al_set_new_display_option(A5O_BLUE_SHIFT, 0, importance); + al_set_new_display_option(A5O_GREEN_SHIFT, 8, importance); + al_set_new_display_option(A5O_RED_SHIFT, 16, importance); break; - case ALLEGRO_PIXEL_FORMAT_RGBX_8888: - al_set_new_display_option(ALLEGRO_ALPHA_SHIFT, 0, importance); - al_set_new_display_option(ALLEGRO_BLUE_SHIFT, 8, importance); - al_set_new_display_option(ALLEGRO_GREEN_SHIFT, 16, importance); - al_set_new_display_option(ALLEGRO_RED_SHIFT, 24, importance); + case A5O_PIXEL_FORMAT_RGBX_8888: + al_set_new_display_option(A5O_ALPHA_SHIFT, 0, importance); + al_set_new_display_option(A5O_BLUE_SHIFT, 8, importance); + al_set_new_display_option(A5O_GREEN_SHIFT, 16, importance); + al_set_new_display_option(A5O_RED_SHIFT, 24, importance); break; - case ALLEGRO_PIXEL_FORMAT_XBGR_8888: - al_set_new_display_option(ALLEGRO_ALPHA_SHIFT, 0, importance); - al_set_new_display_option(ALLEGRO_BLUE_SHIFT, 16, importance); - al_set_new_display_option(ALLEGRO_GREEN_SHIFT, 8, importance); - al_set_new_display_option(ALLEGRO_RED_SHIFT, 0, importance); + case A5O_PIXEL_FORMAT_XBGR_8888: + al_set_new_display_option(A5O_ALPHA_SHIFT, 0, importance); + al_set_new_display_option(A5O_BLUE_SHIFT, 16, importance); + al_set_new_display_option(A5O_GREEN_SHIFT, 8, importance); + al_set_new_display_option(A5O_RED_SHIFT, 0, importance); break; - case ALLEGRO_PIXEL_FORMAT_BGR_565: - al_set_new_display_option(ALLEGRO_ALPHA_SHIFT, 0, importance); - al_set_new_display_option(ALLEGRO_BLUE_SHIFT, 11, importance); - al_set_new_display_option(ALLEGRO_GREEN_SHIFT, 5, importance); - al_set_new_display_option(ALLEGRO_RED_SHIFT, 0, importance); + case A5O_PIXEL_FORMAT_BGR_565: + al_set_new_display_option(A5O_ALPHA_SHIFT, 0, importance); + al_set_new_display_option(A5O_BLUE_SHIFT, 11, importance); + al_set_new_display_option(A5O_GREEN_SHIFT, 5, importance); + al_set_new_display_option(A5O_RED_SHIFT, 0, importance); break; - case ALLEGRO_PIXEL_FORMAT_RGB_565: - al_set_new_display_option(ALLEGRO_ALPHA_SHIFT, 0, importance); - al_set_new_display_option(ALLEGRO_BLUE_SHIFT, 0, importance); - al_set_new_display_option(ALLEGRO_GREEN_SHIFT, 5, importance); - al_set_new_display_option(ALLEGRO_RED_SHIFT, 11, importance); + case A5O_PIXEL_FORMAT_RGB_565: + al_set_new_display_option(A5O_ALPHA_SHIFT, 0, importance); + al_set_new_display_option(A5O_BLUE_SHIFT, 0, importance); + al_set_new_display_option(A5O_GREEN_SHIFT, 5, importance); + al_set_new_display_option(A5O_RED_SHIFT, 11, importance); break; - case ALLEGRO_PIXEL_FORMAT_RGBA_5551: - al_set_new_display_option(ALLEGRO_ALPHA_SHIFT, 0, importance); - al_set_new_display_option(ALLEGRO_BLUE_SHIFT, 1, importance); - al_set_new_display_option(ALLEGRO_GREEN_SHIFT, 6, importance); - al_set_new_display_option(ALLEGRO_RED_SHIFT, 11, importance); + case A5O_PIXEL_FORMAT_RGBA_5551: + al_set_new_display_option(A5O_ALPHA_SHIFT, 0, importance); + al_set_new_display_option(A5O_BLUE_SHIFT, 1, importance); + al_set_new_display_option(A5O_GREEN_SHIFT, 6, importance); + al_set_new_display_option(A5O_RED_SHIFT, 11, importance); break; - case ALLEGRO_PIXEL_FORMAT_ARGB_1555: - al_set_new_display_option(ALLEGRO_ALPHA_SHIFT, 15, importance); - al_set_new_display_option(ALLEGRO_BLUE_SHIFT, 0, importance); - al_set_new_display_option(ALLEGRO_GREEN_SHIFT, 5, importance); - al_set_new_display_option(ALLEGRO_RED_SHIFT, 10, importance); + case A5O_PIXEL_FORMAT_ARGB_1555: + al_set_new_display_option(A5O_ALPHA_SHIFT, 15, importance); + al_set_new_display_option(A5O_BLUE_SHIFT, 0, importance); + al_set_new_display_option(A5O_GREEN_SHIFT, 5, importance); + al_set_new_display_option(A5O_RED_SHIFT, 10, importance); break; - case ALLEGRO_PIXEL_FORMAT_ARGB_4444: - al_set_new_display_option(ALLEGRO_ALPHA_SHIFT, 12, importance); - al_set_new_display_option(ALLEGRO_BLUE_SHIFT, 0, importance); - al_set_new_display_option(ALLEGRO_GREEN_SHIFT, 4, importance); - al_set_new_display_option(ALLEGRO_RED_SHIFT, 8, importance); + case A5O_PIXEL_FORMAT_ARGB_4444: + al_set_new_display_option(A5O_ALPHA_SHIFT, 12, importance); + al_set_new_display_option(A5O_BLUE_SHIFT, 0, importance); + al_set_new_display_option(A5O_GREEN_SHIFT, 4, importance); + al_set_new_display_option(A5O_RED_SHIFT, 8, importance); break; - case ALLEGRO_PIXEL_FORMAT_RGBA_4444: - al_set_new_display_option(ALLEGRO_ALPHA_SHIFT, 0, importance); - al_set_new_display_option(ALLEGRO_BLUE_SHIFT, 4, importance); - al_set_new_display_option(ALLEGRO_GREEN_SHIFT, 8, importance); - al_set_new_display_option(ALLEGRO_RED_SHIFT, 12, importance); + case A5O_PIXEL_FORMAT_RGBA_4444: + al_set_new_display_option(A5O_ALPHA_SHIFT, 0, importance); + al_set_new_display_option(A5O_BLUE_SHIFT, 4, importance); + al_set_new_display_option(A5O_GREEN_SHIFT, 8, importance); + al_set_new_display_option(A5O_RED_SHIFT, 12, importance); break; } diff --git a/src/drawing.c b/src/drawing.c index 8b8744d9a4..96d02faed7 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -23,17 +23,17 @@ /* Function: al_clear_to_color */ -void al_clear_to_color(ALLEGRO_COLOR color) +void al_clear_to_color(A5O_COLOR color) { - ALLEGRO_BITMAP *target = al_get_target_bitmap(); + A5O_BITMAP *target = al_get_target_bitmap(); ASSERT(target); - if (al_get_bitmap_flags(target) & ALLEGRO_MEMORY_BITMAP || + if (al_get_bitmap_flags(target) & A5O_MEMORY_BITMAP || _al_pixel_format_is_compressed(al_get_bitmap_format(target))) { _al_clear_bitmap_by_locking(target, &color); } else { - ALLEGRO_DISPLAY *display = _al_get_bitmap_display(target); + A5O_DISPLAY *display = _al_get_bitmap_display(target); ASSERT(display); ASSERT(display->vt); display->vt->clear(display, &color); @@ -45,14 +45,14 @@ void al_clear_to_color(ALLEGRO_COLOR color) */ void al_clear_depth_buffer(float z) { - ALLEGRO_BITMAP *target = al_get_target_bitmap(); + A5O_BITMAP *target = al_get_target_bitmap(); ASSERT(target); - if (al_get_bitmap_flags(target) & ALLEGRO_MEMORY_BITMAP) { + if (al_get_bitmap_flags(target) & A5O_MEMORY_BITMAP) { /* has no depth buffer */ } else { - ALLEGRO_DISPLAY *display = _al_get_bitmap_display(target); + A5O_DISPLAY *display = _al_get_bitmap_display(target); ASSERT(display); display->vt->clear_depth_buffer(display, z); } @@ -61,18 +61,18 @@ void al_clear_depth_buffer(float z) /* Function: al_draw_pixel */ -void al_draw_pixel(float x, float y, ALLEGRO_COLOR color) +void al_draw_pixel(float x, float y, A5O_COLOR color) { - ALLEGRO_BITMAP *target = al_get_target_bitmap(); + A5O_BITMAP *target = al_get_target_bitmap(); ASSERT(target); - if (al_get_bitmap_flags(target) & ALLEGRO_MEMORY_BITMAP || + if (al_get_bitmap_flags(target) & A5O_MEMORY_BITMAP || _al_pixel_format_is_compressed(al_get_bitmap_format(target))) { _al_draw_pixel_memory(target, x, y, &color); } else { - ALLEGRO_DISPLAY *display = _al_get_bitmap_display(target); + A5O_DISPLAY *display = _al_get_bitmap_display(target); ASSERT(display); ASSERT(display->vt); display->vt->draw_pixel(display, x, y, &color); diff --git a/src/dtor.c b/src/dtor.c index b966a1256e..b90239787f 100644 --- a/src/dtor.c +++ b/src/dtor.c @@ -35,7 +35,7 @@ * does not it easy to make abstract away TLS API differences. */ -ALLEGRO_DEBUG_CHANNEL("dtor") +A5O_DEBUG_CHANNEL("dtor") struct _AL_DTOR_LIST { @@ -113,7 +113,7 @@ void _al_run_destructors(_AL_DTOR_LIST *dtors) void *object = dtor->object; void (*func)(void *) = dtor->func; - ALLEGRO_DEBUG("calling dtor for %s %p, func %p\n", + A5O_DEBUG("calling dtor for %s %p, func %p\n", dtor->name, object, func); _al_mutex_unlock(&dtors->mutex); { @@ -193,12 +193,12 @@ _AL_LIST_ITEM *_al_register_destructor(_AL_DTOR_LIST *dtors, char const *name, new_dtor->object = object; new_dtor->func = func; new_dtor->name = name; - ALLEGRO_DEBUG("added dtor for %s %p, func %p\n", name, + A5O_DEBUG("added dtor for %s %p, func %p\n", name, object, func); ret = _al_list_push_back(dtors->dtors, new_dtor); } else { - ALLEGRO_WARN("failed to add dtor for %s %p\n", name, + A5O_WARN("failed to add dtor for %s %p\n", name, object); } } @@ -224,7 +224,7 @@ void _al_unregister_destructor(_AL_DTOR_LIST *dtors, _AL_LIST_ITEM *dtor_item) _al_mutex_lock(&dtors->mutex); { DTOR *dtor = _al_list_item_data(dtor_item); - ALLEGRO_DEBUG("removed dtor for %s %p\n", dtor->name, dtor->object); + A5O_DEBUG("removed dtor for %s %p\n", dtor->name, dtor->object); al_free(dtor); _al_list_erase(dtors->dtors, dtor_item); } diff --git a/src/events.c b/src/events.c index 24292c8dd1..3f1fcab852 100644 --- a/src/events.c +++ b/src/events.c @@ -33,10 +33,10 @@ -struct ALLEGRO_EVENT_QUEUE +struct A5O_EVENT_QUEUE { - _AL_VECTOR sources; /* vector of (ALLEGRO_EVENT_SOURCE *) */ - _AL_VECTOR events; /* vector of ALLEGRO_EVENT, used as circular array */ + _AL_VECTOR sources; /* vector of (A5O_EVENT_SOURCE *) */ + _AL_VECTOR events; /* vector of A5O_EVENT, used as circular array */ unsigned int events_head; /* write end of circular array */ unsigned int events_tail; /* read end of circular array */ bool paused; @@ -54,13 +54,13 @@ static _AL_MUTEX user_event_refcount_mutex = _AL_MUTEX_UNINITED; /* forward declarations */ static void shutdown_events(void); -static bool do_wait_for_event(ALLEGRO_EVENT_QUEUE *queue, - ALLEGRO_EVENT *ret_event, ALLEGRO_TIMEOUT *timeout); -static void copy_event(ALLEGRO_EVENT *dest, const ALLEGRO_EVENT *src); -static void ref_if_user_event(ALLEGRO_EVENT *event); -static void unref_if_user_event(ALLEGRO_EVENT *event); -static void discard_events_of_source(ALLEGRO_EVENT_QUEUE *queue, - const ALLEGRO_EVENT_SOURCE *source); +static bool do_wait_for_event(A5O_EVENT_QUEUE *queue, + A5O_EVENT *ret_event, A5O_TIMEOUT *timeout); +static void copy_event(A5O_EVENT *dest, const A5O_EVENT *src); +static void ref_if_user_event(A5O_EVENT *event); +static void unref_if_user_event(A5O_EVENT *event); +static void discard_events_of_source(A5O_EVENT_QUEUE *queue, + const A5O_EVENT_SOURCE *source); @@ -87,16 +87,16 @@ static void shutdown_events(void) /* Function: al_create_event_queue */ -ALLEGRO_EVENT_QUEUE *al_create_event_queue(void) +A5O_EVENT_QUEUE *al_create_event_queue(void) { - ALLEGRO_EVENT_QUEUE *queue = al_malloc(sizeof *queue); + A5O_EVENT_QUEUE *queue = al_malloc(sizeof *queue); ASSERT(queue); if (queue) { - _al_vector_init(&queue->sources, sizeof(ALLEGRO_EVENT_SOURCE *)); + _al_vector_init(&queue->sources, sizeof(A5O_EVENT_SOURCE *)); - _al_vector_init(&queue->events, sizeof(ALLEGRO_EVENT)); + _al_vector_init(&queue->events, sizeof(A5O_EVENT)); _al_vector_alloc_back(&queue->events); queue->events_head = 0; queue->events_tail = 0; @@ -117,14 +117,14 @@ ALLEGRO_EVENT_QUEUE *al_create_event_queue(void) /* Function: al_destroy_event_queue */ -void al_destroy_event_queue(ALLEGRO_EVENT_QUEUE *queue) +void al_destroy_event_queue(A5O_EVENT_QUEUE *queue) { if (queue) { _al_unregister_destructor(_al_dtor_list, queue->dtor_item); /* Unregister any event sources registered with this queue. */ while (_al_vector_is_nonempty(&queue->sources)) { - ALLEGRO_EVENT_SOURCE** slot = _al_vector_ref_back(&queue->sources); + A5O_EVENT_SOURCE** slot = _al_vector_ref_back(&queue->sources); al_unregister_event_source(queue, *slot); } @@ -144,8 +144,8 @@ void al_destroy_event_queue(ALLEGRO_EVENT_QUEUE *queue) /* Function: al_is_event_source_registered */ -bool al_is_event_source_registered(ALLEGRO_EVENT_QUEUE *queue, - ALLEGRO_EVENT_SOURCE *source) +bool al_is_event_source_registered(A5O_EVENT_QUEUE *queue, + A5O_EVENT_SOURCE *source) { ASSERT(queue); ASSERT(source); @@ -158,10 +158,10 @@ bool al_is_event_source_registered(ALLEGRO_EVENT_QUEUE *queue, /* Function: al_register_event_source */ -void al_register_event_source(ALLEGRO_EVENT_QUEUE *queue, - ALLEGRO_EVENT_SOURCE *source) +void al_register_event_source(A5O_EVENT_QUEUE *queue, + A5O_EVENT_SOURCE *source) { - ALLEGRO_EVENT_SOURCE **slot; + A5O_EVENT_SOURCE **slot; ASSERT(queue); ASSERT(source); @@ -178,8 +178,8 @@ void al_register_event_source(ALLEGRO_EVENT_QUEUE *queue, /* Function: al_unregister_event_source */ -void al_unregister_event_source(ALLEGRO_EVENT_QUEUE *queue, - ALLEGRO_EVENT_SOURCE *source) +void al_unregister_event_source(A5O_EVENT_QUEUE *queue, + A5O_EVENT_SOURCE *source) { bool found; ASSERT(queue); @@ -205,7 +205,7 @@ void al_unregister_event_source(ALLEGRO_EVENT_QUEUE *queue, /* Function: al_pause_event_queue */ -void al_pause_event_queue(ALLEGRO_EVENT_QUEUE *queue, bool pause) +void al_pause_event_queue(A5O_EVENT_QUEUE *queue, bool pause) { ASSERT(queue); @@ -218,7 +218,7 @@ void al_pause_event_queue(ALLEGRO_EVENT_QUEUE *queue, bool pause) /* Function: al_is_event_queue_paused */ -bool al_is_event_queue_paused(const ALLEGRO_EVENT_QUEUE *queue) +bool al_is_event_queue_paused(const A5O_EVENT_QUEUE *queue) { ASSERT(queue); @@ -229,14 +229,14 @@ bool al_is_event_queue_paused(const ALLEGRO_EVENT_QUEUE *queue) static void heartbeat(void) { - ALLEGRO_SYSTEM *system = al_get_system_driver(); + A5O_SYSTEM *system = al_get_system_driver(); if (system->vt->heartbeat) system->vt->heartbeat(); } -static bool is_event_queue_empty(ALLEGRO_EVENT_QUEUE *queue) +static bool is_event_queue_empty(A5O_EVENT_QUEUE *queue) { return (queue->events_head == queue->events_tail); } @@ -245,7 +245,7 @@ static bool is_event_queue_empty(ALLEGRO_EVENT_QUEUE *queue) /* Function: al_is_event_queue_empty */ -bool al_is_event_queue_empty(ALLEGRO_EVENT_QUEUE *queue) +bool al_is_event_queue_empty(A5O_EVENT_QUEUE *queue) { ASSERT(queue); @@ -276,10 +276,10 @@ static unsigned int circ_array_next(const _AL_VECTOR *vector, unsigned int i) * responsibility). The event queue must be locked before entering * this function. */ -static ALLEGRO_EVENT *get_next_event_if_any(ALLEGRO_EVENT_QUEUE *queue, +static A5O_EVENT *get_next_event_if_any(A5O_EVENT_QUEUE *queue, bool delete) { - ALLEGRO_EVENT *event; + A5O_EVENT *event; if (is_event_queue_empty(queue)) { return NULL; @@ -296,9 +296,9 @@ static ALLEGRO_EVENT *get_next_event_if_any(ALLEGRO_EVENT_QUEUE *queue, /* Function: al_get_next_event */ -bool al_get_next_event(ALLEGRO_EVENT_QUEUE *queue, ALLEGRO_EVENT *ret_event) +bool al_get_next_event(A5O_EVENT_QUEUE *queue, A5O_EVENT *ret_event) { - ALLEGRO_EVENT *next_event; + A5O_EVENT *next_event; ASSERT(queue); ASSERT(ret_event); @@ -321,9 +321,9 @@ bool al_get_next_event(ALLEGRO_EVENT_QUEUE *queue, ALLEGRO_EVENT *ret_event) /* Function: al_peek_next_event */ -bool al_peek_next_event(ALLEGRO_EVENT_QUEUE *queue, ALLEGRO_EVENT *ret_event) +bool al_peek_next_event(A5O_EVENT_QUEUE *queue, A5O_EVENT *ret_event) { - ALLEGRO_EVENT *next_event; + A5O_EVENT *next_event; ASSERT(queue); ASSERT(ret_event); @@ -346,9 +346,9 @@ bool al_peek_next_event(ALLEGRO_EVENT_QUEUE *queue, ALLEGRO_EVENT *ret_event) /* Function: al_drop_next_event */ -bool al_drop_next_event(ALLEGRO_EVENT_QUEUE *queue) +bool al_drop_next_event(A5O_EVENT_QUEUE *queue) { - ALLEGRO_EVENT *next_event; + A5O_EVENT *next_event; ASSERT(queue); heartbeat(); @@ -369,7 +369,7 @@ bool al_drop_next_event(ALLEGRO_EVENT_QUEUE *queue) /* Function: al_flush_event_queue */ -void al_flush_event_queue(ALLEGRO_EVENT_QUEUE *queue) +void al_flush_event_queue(A5O_EVENT_QUEUE *queue) { unsigned int i; ASSERT(queue); @@ -381,7 +381,7 @@ void al_flush_event_queue(ALLEGRO_EVENT_QUEUE *queue) /* Decrement reference counts on all user events. */ i = queue->events_tail; while (i != queue->events_head) { - ALLEGRO_EVENT *old_ev = _al_vector_ref(&queue->events, i); + A5O_EVENT *old_ev = _al_vector_ref(&queue->events, i); unref_if_user_event(old_ev); i = circ_array_next(&queue->events, i); } @@ -395,9 +395,9 @@ void al_flush_event_queue(ALLEGRO_EVENT_QUEUE *queue) /* [primary thread] */ /* Function: al_wait_for_event */ -void al_wait_for_event(ALLEGRO_EVENT_QUEUE *queue, ALLEGRO_EVENT *ret_event) +void al_wait_for_event(A5O_EVENT_QUEUE *queue, A5O_EVENT *ret_event) { - ALLEGRO_EVENT *next_event = NULL; + A5O_EVENT *next_event = NULL; ASSERT(queue); @@ -406,7 +406,7 @@ void al_wait_for_event(ALLEGRO_EVENT_QUEUE *queue, ALLEGRO_EVENT *ret_event) _al_mutex_lock(&queue->mutex); { while (is_event_queue_empty(queue)) { - #ifdef ALLEGRO_WAIT_EVENT_SLEEP + #ifdef A5O_WAIT_EVENT_SLEEP al_rest(0.001); heartbeat(); #else @@ -427,10 +427,10 @@ void al_wait_for_event(ALLEGRO_EVENT_QUEUE *queue, ALLEGRO_EVENT *ret_event) /* [primary thread] */ /* Function: al_wait_for_event_timed */ -bool al_wait_for_event_timed(ALLEGRO_EVENT_QUEUE *queue, - ALLEGRO_EVENT *ret_event, float secs) +bool al_wait_for_event_timed(A5O_EVENT_QUEUE *queue, + A5O_EVENT *ret_event, float secs) { - ALLEGRO_TIMEOUT timeout; + A5O_TIMEOUT timeout; ASSERT(queue); ASSERT(secs >= 0); @@ -449,8 +449,8 @@ bool al_wait_for_event_timed(ALLEGRO_EVENT_QUEUE *queue, /* Function: al_wait_for_event_until */ -bool al_wait_for_event_until(ALLEGRO_EVENT_QUEUE *queue, - ALLEGRO_EVENT *ret_event, ALLEGRO_TIMEOUT *timeout) +bool al_wait_for_event_until(A5O_EVENT_QUEUE *queue, + A5O_EVENT *ret_event, A5O_TIMEOUT *timeout) { ASSERT(queue); @@ -461,11 +461,11 @@ bool al_wait_for_event_until(ALLEGRO_EVENT_QUEUE *queue, -static bool do_wait_for_event(ALLEGRO_EVENT_QUEUE *queue, - ALLEGRO_EVENT *ret_event, ALLEGRO_TIMEOUT *timeout) +static bool do_wait_for_event(A5O_EVENT_QUEUE *queue, + A5O_EVENT *ret_event, A5O_TIMEOUT *timeout) { bool timed_out = false; - ALLEGRO_EVENT *next_event = NULL; + A5O_EVENT *next_event = NULL; _al_mutex_lock(&queue->mutex); { @@ -499,7 +499,7 @@ static bool do_wait_for_event(ALLEGRO_EVENT_QUEUE *queue, /* expand_events_array: * Expand the circular array holding events. */ -static void expand_events_array(ALLEGRO_EVENT_QUEUE *queue) +static void expand_events_array(A5O_EVENT_QUEUE *queue) { /* The underlying vector grows by powers of two. */ const size_t old_size = _al_vector_size(&queue->events); @@ -513,8 +513,8 @@ static void expand_events_array(ALLEGRO_EVENT_QUEUE *queue) /* Move wrapped-around elements at the start of the array to the back. */ if (queue->events_head < queue->events_tail) { for (i = 0; i < queue->events_head; i++) { - ALLEGRO_EVENT *old_ev = _al_vector_ref(&queue->events, i); - ALLEGRO_EVENT *new_ev = _al_vector_ref(&queue->events, old_size + i); + A5O_EVENT *old_ev = _al_vector_ref(&queue->events, i); + A5O_EVENT *new_ev = _al_vector_ref(&queue->events, old_size + i); copy_event(new_ev, old_ev); } queue->events_head += old_size; @@ -528,9 +528,9 @@ static void expand_events_array(ALLEGRO_EVENT_QUEUE *queue) * * [runs in background threads] */ -static ALLEGRO_EVENT *alloc_event(ALLEGRO_EVENT_QUEUE *queue) +static A5O_EVENT *alloc_event(A5O_EVENT_QUEUE *queue) { - ALLEGRO_EVENT *event; + A5O_EVENT *event; unsigned int adv_head; adv_head = circ_array_next(&queue->events, queue->events_head); @@ -549,7 +549,7 @@ static ALLEGRO_EVENT *alloc_event(ALLEGRO_EVENT_QUEUE *queue) /* copy_event: * Copies the contents of the event SRC to DEST. */ -static void copy_event(ALLEGRO_EVENT *dest, const ALLEGRO_EVENT *src) +static void copy_event(A5O_EVENT *dest, const A5O_EVENT *src) { ASSERT(dest); ASSERT(src); @@ -562,10 +562,10 @@ static void copy_event(ALLEGRO_EVENT *dest, const ALLEGRO_EVENT *src) /* Increment a user event's reference count, if the event passed is a user * event and requires it. */ -static void ref_if_user_event(ALLEGRO_EVENT *event) +static void ref_if_user_event(A5O_EVENT *event) { - if (ALLEGRO_EVENT_TYPE_IS_USER(event->type)) { - ALLEGRO_USER_EVENT_DESCRIPTOR *descr = event->user.__internal__descr; + if (A5O_EVENT_TYPE_IS_USER(event->type)) { + A5O_USER_EVENT_DESCRIPTOR *descr = event->user.__internal__descr; if (descr) { _al_mutex_lock(&user_event_refcount_mutex); descr->refcount++; @@ -579,9 +579,9 @@ static void ref_if_user_event(ALLEGRO_EVENT *event) /* Decrement a user event's reference count, if the event passed is a user * event and requires it. */ -static void unref_if_user_event(ALLEGRO_EVENT *event) +static void unref_if_user_event(A5O_EVENT *event) { - if (ALLEGRO_EVENT_TYPE_IS_USER(event->type)) { + if (A5O_EVENT_TYPE_IS_USER(event->type)) { al_unref_user_event(&event->user); } } @@ -596,10 +596,10 @@ static void unref_if_user_event(ALLEGRO_EVENT *event) * If no event queues can accept the event, the event should be * returned to the event source's list of recyclable events. */ -void _al_event_queue_push_event(ALLEGRO_EVENT_QUEUE *queue, - const ALLEGRO_EVENT *orig_event) +void _al_event_queue_push_event(A5O_EVENT_QUEUE *queue, + const A5O_EVENT *orig_event) { - ALLEGRO_EVENT *new_event; + A5O_EVENT *new_event; ASSERT(queue); ASSERT(orig_event); @@ -626,10 +626,10 @@ void _al_event_queue_push_event(ALLEGRO_EVENT_QUEUE *queue, * Return true iff the event queue contains an event from the given source. * The queue must be locked. */ -static bool contains_event_of_source(const ALLEGRO_EVENT_QUEUE *queue, - const ALLEGRO_EVENT_SOURCE *source) +static bool contains_event_of_source(const A5O_EVENT_QUEUE *queue, + const A5O_EVENT_SOURCE *source) { - ALLEGRO_EVENT *event; + A5O_EVENT *event; unsigned int i; i = queue->events_tail; @@ -660,12 +660,12 @@ static int pot(int x) * Discard all the events in the queue that belong to the source. * The queue must be locked. */ -static void discard_events_of_source(ALLEGRO_EVENT_QUEUE *queue, - const ALLEGRO_EVENT_SOURCE *source) +static void discard_events_of_source(A5O_EVENT_QUEUE *queue, + const A5O_EVENT_SOURCE *source) { _AL_VECTOR old_events; - ALLEGRO_EVENT *old_event; - ALLEGRO_EVENT *new_event; + A5O_EVENT *old_event; + A5O_EVENT *new_event; size_t old_size; size_t new_size; unsigned int i; @@ -676,7 +676,7 @@ static void discard_events_of_source(ALLEGRO_EVENT_QUEUE *queue, /* Copy elements we want to keep from the old vector to a new one. */ old_events = queue->events; - _al_vector_init(&queue->events, sizeof(ALLEGRO_EVENT)); + _al_vector_init(&queue->events, sizeof(A5O_EVENT)); i = queue->events_tail; while (i != queue->events_head) { @@ -708,9 +708,9 @@ static void discard_events_of_source(ALLEGRO_EVENT_QUEUE *queue, /* Function: al_unref_user_event */ -void al_unref_user_event(ALLEGRO_USER_EVENT *event) +void al_unref_user_event(A5O_USER_EVENT *event) { - ALLEGRO_USER_EVENT_DESCRIPTOR *descr; + A5O_USER_EVENT_DESCRIPTOR *descr; int refcount; ASSERT(event); diff --git a/src/evtsrc.c b/src/evtsrc.c index 2275fad920..e6035b9ffd 100644 --- a/src/evtsrc.c +++ b/src/evtsrc.c @@ -26,22 +26,22 @@ #include "allegro5/internal/aintern_system.h" -ALLEGRO_STATIC_ASSERT(evtsrc, - sizeof(ALLEGRO_EVENT_SOURCE_REAL) <= sizeof(ALLEGRO_EVENT_SOURCE)); +A5O_STATIC_ASSERT(evtsrc, + sizeof(A5O_EVENT_SOURCE_REAL) <= sizeof(A5O_EVENT_SOURCE)); /* Internal function: _al_event_source_init * Initialise an event source structure. */ -void _al_event_source_init(ALLEGRO_EVENT_SOURCE *es) +void _al_event_source_init(A5O_EVENT_SOURCE *es) { - ALLEGRO_EVENT_SOURCE_REAL *this = (ALLEGRO_EVENT_SOURCE_REAL *)es; + A5O_EVENT_SOURCE_REAL *this = (A5O_EVENT_SOURCE_REAL *)es; memset(es, 0, sizeof(*es)); _AL_MARK_MUTEX_UNINITED(this->mutex); _al_mutex_init(&this->mutex); - _al_vector_init(&this->queues, sizeof(ALLEGRO_EVENT_QUEUE *)); + _al_vector_init(&this->queues, sizeof(A5O_EVENT_QUEUE *)); this->data = 0; } @@ -52,13 +52,13 @@ void _al_event_source_init(ALLEGRO_EVENT_SOURCE *es) * automatically unregisters the event source from all the event * queues it is currently registered with. */ -void _al_event_source_free(ALLEGRO_EVENT_SOURCE *es) +void _al_event_source_free(A5O_EVENT_SOURCE *es) { - ALLEGRO_EVENT_SOURCE_REAL *this = (ALLEGRO_EVENT_SOURCE_REAL *)es; + A5O_EVENT_SOURCE_REAL *this = (A5O_EVENT_SOURCE_REAL *)es; /* Unregister from all queues. */ while (!_al_vector_is_empty(&this->queues)) { - ALLEGRO_EVENT_QUEUE **slot = _al_vector_ref_back(&this->queues); + A5O_EVENT_QUEUE **slot = _al_vector_ref_back(&this->queues); al_unregister_event_source(*slot, es); } @@ -72,9 +72,9 @@ void _al_event_source_free(ALLEGRO_EVENT_SOURCE *es) /* Internal function: _al_event_source_lock * Lock the event source. See below for when you should call this function. */ -void _al_event_source_lock(ALLEGRO_EVENT_SOURCE *es) +void _al_event_source_lock(A5O_EVENT_SOURCE *es) { - ALLEGRO_EVENT_SOURCE_REAL *this = (ALLEGRO_EVENT_SOURCE_REAL *)es; + A5O_EVENT_SOURCE_REAL *this = (A5O_EVENT_SOURCE_REAL *)es; _al_mutex_lock(&this->mutex); } @@ -84,9 +84,9 @@ void _al_event_source_lock(ALLEGRO_EVENT_SOURCE *es) /* Internal function: _al_event_source_unlock * Unlock the event source. */ -void _al_event_source_unlock(ALLEGRO_EVENT_SOURCE *es) +void _al_event_source_unlock(A5O_EVENT_SOURCE *es) { - ALLEGRO_EVENT_SOURCE_REAL *this = (ALLEGRO_EVENT_SOURCE_REAL *)es; + A5O_EVENT_SOURCE_REAL *this = (A5O_EVENT_SOURCE_REAL *)es; _al_mutex_unlock(&this->mutex); } @@ -99,15 +99,15 @@ void _al_event_source_unlock(ALLEGRO_EVENT_SOURCE *es) * event source a chance to remember which queues it is registered * to. */ -void _al_event_source_on_registration_to_queue(ALLEGRO_EVENT_SOURCE *es, - ALLEGRO_EVENT_QUEUE *queue) +void _al_event_source_on_registration_to_queue(A5O_EVENT_SOURCE *es, + A5O_EVENT_QUEUE *queue) { _al_event_source_lock(es); { - ALLEGRO_EVENT_SOURCE_REAL *this = (ALLEGRO_EVENT_SOURCE_REAL *)es; + A5O_EVENT_SOURCE_REAL *this = (A5O_EVENT_SOURCE_REAL *)es; /* Add the queue to the source's list. */ - ALLEGRO_EVENT_QUEUE **slot = _al_vector_alloc_back(&this->queues); + A5O_EVENT_QUEUE **slot = _al_vector_alloc_back(&this->queues); *slot = queue; } _al_event_source_unlock(es); @@ -119,12 +119,12 @@ void _al_event_source_on_registration_to_queue(ALLEGRO_EVENT_SOURCE *es, * This function is called by al_unregister_event_source() when an * event source is unregistered from a queue. */ -void _al_event_source_on_unregistration_from_queue(ALLEGRO_EVENT_SOURCE *es, - ALLEGRO_EVENT_QUEUE *queue) +void _al_event_source_on_unregistration_from_queue(A5O_EVENT_SOURCE *es, + A5O_EVENT_QUEUE *queue) { _al_event_source_lock(es); { - ALLEGRO_EVENT_SOURCE_REAL *this = (ALLEGRO_EVENT_SOURCE_REAL *)es; + A5O_EVENT_SOURCE_REAL *this = (A5O_EVENT_SOURCE_REAL *)es; _al_vector_find_and_delete(&this->queues, &queue); } @@ -145,9 +145,9 @@ void _al_event_source_on_unregistration_from_queue(ALLEGRO_EVENT_SOURCE *es, * * [runs in background threads] */ -bool _al_event_source_needs_to_generate_event(ALLEGRO_EVENT_SOURCE *es) +bool _al_event_source_needs_to_generate_event(A5O_EVENT_SOURCE *es) { - ALLEGRO_EVENT_SOURCE_REAL *this = (ALLEGRO_EVENT_SOURCE_REAL *)es; + A5O_EVENT_SOURCE_REAL *this = (A5O_EVENT_SOURCE_REAL *)es; /* We don't consider pausing of event queues, but it does not seem worth * optimising for. @@ -167,9 +167,9 @@ bool _al_event_source_needs_to_generate_event(ALLEGRO_EVENT_SOURCE *es) * * [runs in background threads] */ -void _al_event_source_emit_event(ALLEGRO_EVENT_SOURCE *es, ALLEGRO_EVENT *event) +void _al_event_source_emit_event(A5O_EVENT_SOURCE *es, A5O_EVENT *event) { - ALLEGRO_EVENT_SOURCE_REAL *this = (ALLEGRO_EVENT_SOURCE_REAL *)es; + A5O_EVENT_SOURCE_REAL *this = (A5O_EVENT_SOURCE_REAL *)es; event->any.source = es; @@ -179,7 +179,7 @@ void _al_event_source_emit_event(ALLEGRO_EVENT_SOURCE *es, ALLEGRO_EVENT *event) { size_t num_queues = _al_vector_size(&this->queues); unsigned int i; - ALLEGRO_EVENT_QUEUE **slot; + A5O_EVENT_QUEUE **slot; for (i = 0; i < num_queues; i++) { slot = _al_vector_ref(&this->queues, i); @@ -192,7 +192,7 @@ void _al_event_source_emit_event(ALLEGRO_EVENT_SOURCE *es, ALLEGRO_EVENT *event) /* Function: al_init_user_event_source */ -void al_init_user_event_source(ALLEGRO_EVENT_SOURCE *src) +void al_init_user_event_source(A5O_EVENT_SOURCE *src) { ASSERT(src); @@ -203,7 +203,7 @@ void al_init_user_event_source(ALLEGRO_EVENT_SOURCE *src) /* Function: al_destroy_user_event_source */ -void al_destroy_user_event_source(ALLEGRO_EVENT_SOURCE *src) +void al_destroy_user_event_source(A5O_EVENT_SOURCE *src) { if (src) { _al_event_source_free(src); @@ -214,8 +214,8 @@ void al_destroy_user_event_source(ALLEGRO_EVENT_SOURCE *src) /* Function: al_emit_user_event */ -bool al_emit_user_event(ALLEGRO_EVENT_SOURCE *src, - ALLEGRO_EVENT *event, void (*dtor)(ALLEGRO_USER_EVENT *)) +bool al_emit_user_event(A5O_EVENT_SOURCE *src, + A5O_EVENT *event, void (*dtor)(A5O_USER_EVENT *)) { size_t num_queues; bool rc; @@ -224,7 +224,7 @@ bool al_emit_user_event(ALLEGRO_EVENT_SOURCE *src, ASSERT(event); if (dtor) { - ALLEGRO_USER_EVENT_DESCRIPTOR *descr = al_malloc(sizeof(*descr)); + A5O_USER_EVENT_DESCRIPTOR *descr = al_malloc(sizeof(*descr)); descr->refcount = 0; descr->dtor = dtor; event->user.__internal__descr = descr; @@ -235,7 +235,7 @@ bool al_emit_user_event(ALLEGRO_EVENT_SOURCE *src, _al_event_source_lock(src); { - ALLEGRO_EVENT_SOURCE_REAL *rsrc = (ALLEGRO_EVENT_SOURCE_REAL *)src; + A5O_EVENT_SOURCE_REAL *rsrc = (A5O_EVENT_SOURCE_REAL *)src; num_queues = _al_vector_size(&rsrc->queues); if (num_queues > 0) { @@ -261,9 +261,9 @@ bool al_emit_user_event(ALLEGRO_EVENT_SOURCE *src, /* Function: al_set_event_source_data */ -void al_set_event_source_data(ALLEGRO_EVENT_SOURCE *source, intptr_t data) +void al_set_event_source_data(A5O_EVENT_SOURCE *source, intptr_t data) { - ALLEGRO_EVENT_SOURCE_REAL *const rsource = (ALLEGRO_EVENT_SOURCE_REAL *)source; + A5O_EVENT_SOURCE_REAL *const rsource = (A5O_EVENT_SOURCE_REAL *)source; rsource->data = data; } @@ -271,9 +271,9 @@ void al_set_event_source_data(ALLEGRO_EVENT_SOURCE *source, intptr_t data) /* Function: al_get_event_source_data */ -intptr_t al_get_event_source_data(const ALLEGRO_EVENT_SOURCE *source) +intptr_t al_get_event_source_data(const A5O_EVENT_SOURCE *source) { - const ALLEGRO_EVENT_SOURCE_REAL *const rsource = (ALLEGRO_EVENT_SOURCE_REAL *)source; + const A5O_EVENT_SOURCE_REAL *const rsource = (A5O_EVENT_SOURCE_REAL *)source; return rsource->data; } diff --git a/src/file.c b/src/file.c index 0bd335352e..c3d8cd4ccf 100644 --- a/src/file.c +++ b/src/file.c @@ -21,7 +21,7 @@ /* Function: al_fopen */ -ALLEGRO_FILE *al_fopen(const char *path, const char *mode) +A5O_FILE *al_fopen(const char *path, const char *mode) { return al_fopen_interface(al_get_new_file_interface(), path, mode); } @@ -29,10 +29,10 @@ ALLEGRO_FILE *al_fopen(const char *path, const char *mode) /* Function: al_fopen_interface */ -ALLEGRO_FILE *al_fopen_interface(const ALLEGRO_FILE_INTERFACE *drv, +A5O_FILE *al_fopen_interface(const A5O_FILE_INTERFACE *drv, const char *path, const char *mode) { - ALLEGRO_FILE *f = NULL; + A5O_FILE *f = NULL; ASSERT(drv); ASSERT(path); @@ -60,10 +60,10 @@ ALLEGRO_FILE *al_fopen_interface(const ALLEGRO_FILE_INTERFACE *drv, /* Function: al_create_file_handle */ -ALLEGRO_FILE *al_create_file_handle(const ALLEGRO_FILE_INTERFACE *drv, +A5O_FILE *al_create_file_handle(const A5O_FILE_INTERFACE *drv, void *userdata) { - ALLEGRO_FILE *f; + A5O_FILE *f; ASSERT(drv); @@ -83,7 +83,7 @@ ALLEGRO_FILE *al_create_file_handle(const ALLEGRO_FILE_INTERFACE *drv, /* Function: al_fclose */ -bool al_fclose(ALLEGRO_FILE *f) +bool al_fclose(A5O_FILE *f) { if (f) { bool ret = f->vtable->fi_fclose(f); @@ -98,7 +98,7 @@ bool al_fclose(ALLEGRO_FILE *f) /* Function: al_fread */ -size_t al_fread(ALLEGRO_FILE *f, void *ptr, size_t size) +size_t al_fread(A5O_FILE *f, void *ptr, size_t size) { ASSERT(f); ASSERT(ptr || size == 0); @@ -123,7 +123,7 @@ size_t al_fread(ALLEGRO_FILE *f, void *ptr, size_t size) /* Function: al_fwrite */ -size_t al_fwrite(ALLEGRO_FILE *f, const void *ptr, size_t size) +size_t al_fwrite(A5O_FILE *f, const void *ptr, size_t size) { ASSERT(f); ASSERT(ptr || size == 0); @@ -135,7 +135,7 @@ size_t al_fwrite(ALLEGRO_FILE *f, const void *ptr, size_t size) /* Function: al_fflush */ -bool al_fflush(ALLEGRO_FILE *f) +bool al_fflush(A5O_FILE *f) { ASSERT(f); @@ -145,7 +145,7 @@ bool al_fflush(ALLEGRO_FILE *f) /* Function: al_ftell */ -int64_t al_ftell(ALLEGRO_FILE *f) +int64_t al_ftell(A5O_FILE *f) { ASSERT(f); @@ -155,18 +155,18 @@ int64_t al_ftell(ALLEGRO_FILE *f) /* Function: al_fseek */ -bool al_fseek(ALLEGRO_FILE *f, int64_t offset, int whence) +bool al_fseek(A5O_FILE *f, int64_t offset, int whence) { ASSERT(f); /* offset can be negative */ ASSERT( - whence == ALLEGRO_SEEK_SET || - whence == ALLEGRO_SEEK_CUR || - whence == ALLEGRO_SEEK_END + whence == A5O_SEEK_SET || + whence == A5O_SEEK_CUR || + whence == A5O_SEEK_END ); if (f->ungetc_len) { - if (whence == ALLEGRO_SEEK_CUR) { + if (whence == A5O_SEEK_CUR) { offset -= f->ungetc_len; } f->ungetc_len = 0; @@ -178,7 +178,7 @@ bool al_fseek(ALLEGRO_FILE *f, int64_t offset, int whence) /* Function: al_feof */ -bool al_feof(ALLEGRO_FILE *f) +bool al_feof(A5O_FILE *f) { ASSERT(f); @@ -188,7 +188,7 @@ bool al_feof(ALLEGRO_FILE *f) /* Function: al_ferror */ -int al_ferror(ALLEGRO_FILE *f) +int al_ferror(A5O_FILE *f) { ASSERT(f); @@ -198,7 +198,7 @@ int al_ferror(ALLEGRO_FILE *f) /* Function: al_ferrmsg */ -const char *al_ferrmsg(ALLEGRO_FILE *f) +const char *al_ferrmsg(A5O_FILE *f) { const char *msg; @@ -211,7 +211,7 @@ const char *al_ferrmsg(ALLEGRO_FILE *f) /* Function: al_fclearerr */ -void al_fclearerr(ALLEGRO_FILE *f) +void al_fclearerr(A5O_FILE *f) { ASSERT(f); @@ -221,7 +221,7 @@ void al_fclearerr(ALLEGRO_FILE *f) /* Function: al_fgetc */ -int al_fgetc(ALLEGRO_FILE *f) +int al_fgetc(A5O_FILE *f) { uint8_t c; ASSERT(f); @@ -236,7 +236,7 @@ int al_fgetc(ALLEGRO_FILE *f) /* Function: al_fputc */ -int al_fputc(ALLEGRO_FILE *f, int c) +int al_fputc(A5O_FILE *f, int c) { uint8_t b = (c & 0xff); ASSERT(f); @@ -251,7 +251,7 @@ int al_fputc(ALLEGRO_FILE *f, int c) /* Function: al_fread16le */ -int16_t al_fread16le(ALLEGRO_FILE *f) +int16_t al_fread16le(A5O_FILE *f) { unsigned char b[2]; ASSERT(f); @@ -266,7 +266,7 @@ int16_t al_fread16le(ALLEGRO_FILE *f) /* Function: al_fread32le */ -int32_t al_fread32le(ALLEGRO_FILE *f) +int32_t al_fread32le(A5O_FILE *f) { unsigned char b[4]; ASSERT(f); @@ -282,7 +282,7 @@ int32_t al_fread32le(ALLEGRO_FILE *f) /* Function: al_fwrite16le */ -size_t al_fwrite16le(ALLEGRO_FILE *f, int16_t w) +size_t al_fwrite16le(A5O_FILE *f, int16_t w) { uint8_t b1, b2; ASSERT(f); @@ -302,7 +302,7 @@ size_t al_fwrite16le(ALLEGRO_FILE *f, int16_t w) /* Function: al_fwrite32le */ -size_t al_fwrite32le(ALLEGRO_FILE *f, int32_t l) +size_t al_fwrite32le(A5O_FILE *f, int32_t l) { uint8_t b1, b2, b3, b4; ASSERT(f); @@ -330,7 +330,7 @@ size_t al_fwrite32le(ALLEGRO_FILE *f, int32_t l) /* Function: al_fread16be */ -int16_t al_fread16be(ALLEGRO_FILE *f) +int16_t al_fread16be(A5O_FILE *f) { unsigned char b[2]; ASSERT(f); @@ -345,7 +345,7 @@ int16_t al_fread16be(ALLEGRO_FILE *f) /* Function: al_fread32be */ -int32_t al_fread32be(ALLEGRO_FILE *f) +int32_t al_fread32be(A5O_FILE *f) { unsigned char b[4]; ASSERT(f); @@ -361,7 +361,7 @@ int32_t al_fread32be(ALLEGRO_FILE *f) /* Function: al_fwrite16be */ -size_t al_fwrite16be(ALLEGRO_FILE *f, int16_t w) +size_t al_fwrite16be(A5O_FILE *f, int16_t w) { uint8_t b1, b2; ASSERT(f); @@ -381,7 +381,7 @@ size_t al_fwrite16be(ALLEGRO_FILE *f, int16_t w) /* Function: al_fwrite32be */ -size_t al_fwrite32be(ALLEGRO_FILE *f, int32_t l) +size_t al_fwrite32be(A5O_FILE *f, int32_t l) { uint8_t b1, b2, b3, b4; ASSERT(f); @@ -409,7 +409,7 @@ size_t al_fwrite32be(ALLEGRO_FILE *f, int32_t l) /* Function: al_fgets */ -char *al_fgets(ALLEGRO_FILE *f, char * const buf, size_t max) +char *al_fgets(A5O_FILE *f, char * const buf, size_t max) { char *p = buf; int c; @@ -454,9 +454,9 @@ char *al_fgets(ALLEGRO_FILE *f, char * const buf, size_t max) /* Function: al_fget_ustr */ -ALLEGRO_USTR *al_fget_ustr(ALLEGRO_FILE *f) +A5O_USTR *al_fget_ustr(A5O_FILE *f) { - ALLEGRO_USTR *us; + A5O_USTR *us; char buf[128]; if (!al_fgets(f, buf, sizeof(buf))) { @@ -477,7 +477,7 @@ ALLEGRO_USTR *al_fget_ustr(ALLEGRO_FILE *f) /* Function: al_fputs */ -int al_fputs(ALLEGRO_FILE *f, char const *p) +int al_fputs(A5O_FILE *f, char const *p) { size_t n; ASSERT(f); @@ -494,7 +494,7 @@ int al_fputs(ALLEGRO_FILE *f, char const *p) /* Function: al_fungetc */ -int al_fungetc(ALLEGRO_FILE *f, int c) +int al_fungetc(A5O_FILE *f, int c) { ASSERT(f != NULL); @@ -507,7 +507,7 @@ int al_fungetc(ALLEGRO_FILE *f, int c) * implement it, then this ungetc buffer will never be filled, and all * other references to it within this file will always be ignored.) */ - if (f->ungetc_len == ALLEGRO_UNGETC_SIZE) { + if (f->ungetc_len == A5O_UNGETC_SIZE) { return EOF; } @@ -520,7 +520,7 @@ int al_fungetc(ALLEGRO_FILE *f, int c) /* Function: al_fsize */ -int64_t al_fsize(ALLEGRO_FILE *f) +int64_t al_fsize(A5O_FILE *f) { ASSERT(f != NULL); @@ -530,7 +530,7 @@ int64_t al_fsize(ALLEGRO_FILE *f) /* Function: al_get_file_userdata */ -void *al_get_file_userdata(ALLEGRO_FILE *f) +void *al_get_file_userdata(A5O_FILE *f) { ASSERT(f != NULL); @@ -540,10 +540,10 @@ void *al_get_file_userdata(ALLEGRO_FILE *f) /* Function: al_vfprintf */ -int al_vfprintf(ALLEGRO_FILE *pfile, const char *format, va_list args) +int al_vfprintf(A5O_FILE *pfile, const char *format, va_list args) { int rv = -1; - ALLEGRO_USTR *ustr = 0; + A5O_USTR *ustr = 0; size_t size = 0; bool success; @@ -573,7 +573,7 @@ int al_vfprintf(ALLEGRO_FILE *pfile, const char *format, va_list args) /* Function: al_fprintf */ -int al_fprintf(ALLEGRO_FILE *pfile, const char *format, ...) +int al_fprintf(A5O_FILE *pfile, const char *format, ...) { int rv = -1; va_list args; diff --git a/src/file_slice.c b/src/file_slice.c index eed3629473..7f03477104 100644 --- a/src/file_slice.c +++ b/src/file_slice.c @@ -27,21 +27,21 @@ enum { struct SLICE_DATA { - ALLEGRO_FILE *fp; /* parent file handle */ + A5O_FILE *fp; /* parent file handle */ size_t anchor; /* beginning position relative to parent */ size_t pos; /* position relative to anchor */ size_t size; /* size of slice relative to anchor */ int mode; }; -static bool slice_fclose(ALLEGRO_FILE *f) +static bool slice_fclose(A5O_FILE *f) { SLICE_DATA *slice = al_get_file_userdata(f); bool ret; /* seek to end of slice */ if (slice->mode & SLICE_SEEK_END) - ret = al_fseek(slice->fp, slice->anchor + slice->size, ALLEGRO_SEEK_SET); + ret = al_fseek(slice->fp, slice->anchor + slice->size, A5O_SEEK_SET); else ret = true; @@ -50,7 +50,7 @@ static bool slice_fclose(ALLEGRO_FILE *f) return ret; } -static size_t slice_fread(ALLEGRO_FILE *f, void *ptr, size_t size) +static size_t slice_fread(A5O_FILE *f, void *ptr, size_t size) { SLICE_DATA *slice = al_get_file_userdata(f); @@ -79,7 +79,7 @@ static size_t slice_fread(ALLEGRO_FILE *f, void *ptr, size_t size) } } -static size_t slice_fwrite(ALLEGRO_FILE *f, const void *ptr, size_t size) +static size_t slice_fwrite(A5O_FILE *f, const void *ptr, size_t size) { SLICE_DATA *slice = al_get_file_userdata(f); @@ -108,30 +108,30 @@ static size_t slice_fwrite(ALLEGRO_FILE *f, const void *ptr, size_t size) } } -static bool slice_fflush(ALLEGRO_FILE *f) +static bool slice_fflush(A5O_FILE *f) { SLICE_DATA *slice = al_get_file_userdata(f); return al_fflush(slice->fp); } -static int64_t slice_ftell(ALLEGRO_FILE *f) +static int64_t slice_ftell(A5O_FILE *f) { SLICE_DATA *slice = al_get_file_userdata(f); return slice->pos; } -static bool slice_fseek(ALLEGRO_FILE *f, int64_t offset, int whence) +static bool slice_fseek(A5O_FILE *f, int64_t offset, int whence) { SLICE_DATA *slice = al_get_file_userdata(f); - if (whence == ALLEGRO_SEEK_SET) { + if (whence == A5O_SEEK_SET) { offset = slice->anchor + offset; } - else if (whence == ALLEGRO_SEEK_CUR) { + else if (whence == A5O_SEEK_CUR) { offset = slice->anchor + slice->pos + offset; } - else if (whence == ALLEGRO_SEEK_END) { + else if (whence == A5O_SEEK_END) { offset = slice->anchor + slice->size + offset; } else { @@ -147,7 +147,7 @@ static bool slice_fseek(ALLEGRO_FILE *f, int64_t offset, int whence) } } - if (al_fseek(slice->fp, offset, ALLEGRO_SEEK_SET)) { + if (al_fseek(slice->fp, offset, A5O_SEEK_SET)) { slice->pos = offset - slice->anchor; if (slice->pos > slice->size) slice->size = slice->pos; @@ -157,37 +157,37 @@ static bool slice_fseek(ALLEGRO_FILE *f, int64_t offset, int whence) return false; } -static bool slice_feof(ALLEGRO_FILE *f) +static bool slice_feof(A5O_FILE *f) { SLICE_DATA *slice = al_get_file_userdata(f); return slice->pos >= slice->size; } -static int slice_ferror(ALLEGRO_FILE *f) +static int slice_ferror(A5O_FILE *f) { SLICE_DATA *slice = al_get_file_userdata(f); return al_ferror(slice->fp); } -static const char *slice_ferrmsg(ALLEGRO_FILE *f) +static const char *slice_ferrmsg(A5O_FILE *f) { SLICE_DATA *slice = al_get_file_userdata(f); return al_ferrmsg(slice->fp); } -static void slice_fclearerr(ALLEGRO_FILE *f) +static void slice_fclearerr(A5O_FILE *f) { SLICE_DATA *slice = al_get_file_userdata(f); al_fclearerr(slice->fp); } -static off_t slice_fsize(ALLEGRO_FILE *f) +static off_t slice_fsize(A5O_FILE *f) { SLICE_DATA *slice = al_get_file_userdata(f); return slice->size; } -static const ALLEGRO_FILE_INTERFACE fi = +static const A5O_FILE_INTERFACE fi = { NULL, slice_fclose, @@ -206,7 +206,7 @@ static const ALLEGRO_FILE_INTERFACE fi = /* Function: al_fopen_slice */ -ALLEGRO_FILE *al_fopen_slice(ALLEGRO_FILE *fp, size_t initial_size, const char *mode) +A5O_FILE *al_fopen_slice(A5O_FILE *fp, size_t initial_size, const char *mode) { SLICE_DATA *userdata = al_calloc(1, sizeof(*userdata)); int ch; diff --git a/src/file_stdio.c b/src/file_stdio.c index d446b2c459..a0aca93df0 100644 --- a/src/file_stdio.c +++ b/src/file_stdio.c @@ -16,7 +16,7 @@ #include "allegro5/allegro.h" /* enable large file support in gcc/glibc */ -#if defined ALLEGRO_HAVE_FTELLO && defined ALLEGRO_HAVE_FSEEKO +#if defined A5O_HAVE_FTELLO && defined A5O_HAVE_FSEEKO #ifndef _LARGEFILE_SOURCE #define _LARGEFILE_SOURCE #endif @@ -30,16 +30,16 @@ #include "allegro5/internal/aintern.h" #include "allegro5/internal/aintern_file.h" #include "allegro5/internal/aintern_wunicode.h" -#include ALLEGRO_INTERNAL_HEADER +#include A5O_INTERNAL_HEADER -#ifdef ALLEGRO_HAVE_SYS_STAT_H +#ifdef A5O_HAVE_SYS_STAT_H #include #endif -ALLEGRO_DEBUG_CHANNEL("stdio") +A5O_DEBUG_CHANNEL("stdio") /* forward declaration */ -const struct ALLEGRO_FILE_INTERFACE _al_file_interface_stdio; +const struct A5O_FILE_INTERFACE _al_file_interface_stdio; #ifndef PATH_MAX #define PATH_MAX 4096 @@ -54,7 +54,7 @@ typedef struct } USERDATA; -static USERDATA *get_userdata(ALLEGRO_FILE *f) +static USERDATA *get_userdata(A5O_FILE *f) { if (f) return al_get_file_userdata(f); @@ -65,9 +65,9 @@ static USERDATA *get_userdata(ALLEGRO_FILE *f) /* Function: al_fopen_fd */ -ALLEGRO_FILE *al_fopen_fd(int fd, const char *mode) +A5O_FILE *al_fopen_fd(int fd, const char *mode) { - ALLEGRO_FILE *f; + A5O_FILE *f; USERDATA *userdata; FILE *fp; @@ -104,9 +104,9 @@ static void *file_stdio_fopen(const char *path, const char *mode) FILE *fp; USERDATA *userdata; - ALLEGRO_DEBUG("opening %s %s\n", path, mode); + A5O_DEBUG("opening %s %s\n", path, mode); -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS { wchar_t *wpath = _al_win_utf8_to_utf16(path); wchar_t *wmode = _al_win_utf8_to_utf16(mode); @@ -136,7 +136,7 @@ static void *file_stdio_fopen(const char *path, const char *mode) } -static bool file_stdio_fclose(ALLEGRO_FILE *f) +static bool file_stdio_fclose(A5O_FILE *f) { USERDATA *userdata = get_userdata(f); bool ret; @@ -159,7 +159,7 @@ static bool file_stdio_fclose(ALLEGRO_FILE *f) } -static size_t file_stdio_fread(ALLEGRO_FILE *f, void *ptr, size_t size) +static size_t file_stdio_fread(A5O_FILE *f, void *ptr, size_t size) { USERDATA *userdata = get_userdata(f); @@ -185,7 +185,7 @@ static size_t file_stdio_fread(ALLEGRO_FILE *f, void *ptr, size_t size) } -static size_t file_stdio_fwrite(ALLEGRO_FILE *f, const void *ptr, size_t size) +static size_t file_stdio_fwrite(A5O_FILE *f, const void *ptr, size_t size) { USERDATA *userdata = get_userdata(f); size_t ret; @@ -200,7 +200,7 @@ static size_t file_stdio_fwrite(ALLEGRO_FILE *f, const void *ptr, size_t size) } -static bool file_stdio_fflush(ALLEGRO_FILE *f) +static bool file_stdio_fflush(A5O_FILE *f) { USERDATA *userdata = get_userdata(f); @@ -214,14 +214,14 @@ static bool file_stdio_fflush(ALLEGRO_FILE *f) } -static int64_t file_stdio_ftell(ALLEGRO_FILE *f) +static int64_t file_stdio_ftell(A5O_FILE *f) { USERDATA *userdata = get_userdata(f); int64_t ret; -#if defined(ALLEGRO_HAVE_FTELLO) +#if defined(A5O_HAVE_FTELLO) ret = ftello(userdata->fp); -#elif defined(ALLEGRO_HAVE_FTELLI64) +#elif defined(A5O_HAVE_FTELLI64) ret = _ftelli64(userdata->fp); #else ret = ftell(userdata->fp); @@ -235,21 +235,21 @@ static int64_t file_stdio_ftell(ALLEGRO_FILE *f) } -static bool file_stdio_fseek(ALLEGRO_FILE *f, int64_t offset, +static bool file_stdio_fseek(A5O_FILE *f, int64_t offset, int whence) { USERDATA *userdata = get_userdata(f); int rc; switch (whence) { - case ALLEGRO_SEEK_SET: whence = SEEK_SET; break; - case ALLEGRO_SEEK_CUR: whence = SEEK_CUR; break; - case ALLEGRO_SEEK_END: whence = SEEK_END; break; + case A5O_SEEK_SET: whence = SEEK_SET; break; + case A5O_SEEK_CUR: whence = SEEK_CUR; break; + case A5O_SEEK_END: whence = SEEK_END; break; } -#if defined(ALLEGRO_HAVE_FSEEKO) +#if defined(A5O_HAVE_FSEEKO) rc = fseeko(userdata->fp, offset, whence); -#elif defined(ALLEGRO_HAVE_FSEEKI64) +#elif defined(A5O_HAVE_FSEEKI64) rc = _fseeki64(userdata->fp, offset, whence); #else rc = fseek(userdata->fp, offset, whence); @@ -265,7 +265,7 @@ static bool file_stdio_fseek(ALLEGRO_FILE *f, int64_t offset, } -static bool file_stdio_feof(ALLEGRO_FILE *f) +static bool file_stdio_feof(A5O_FILE *f) { USERDATA *userdata = get_userdata(f); @@ -273,7 +273,7 @@ static bool file_stdio_feof(ALLEGRO_FILE *f) } -static int file_stdio_ferror(ALLEGRO_FILE *f) +static int file_stdio_ferror(A5O_FILE *f) { USERDATA *userdata = get_userdata(f); @@ -281,7 +281,7 @@ static int file_stdio_ferror(ALLEGRO_FILE *f) } -static const char *file_stdio_ferrmsg(ALLEGRO_FILE *f) +static const char *file_stdio_ferrmsg(A5O_FILE *f) { USERDATA *userdata = get_userdata(f); @@ -289,7 +289,7 @@ static const char *file_stdio_ferrmsg(ALLEGRO_FILE *f) return ""; /* Note: at this time MinGW has neither strerror_r nor strerror_s. */ -#if defined(ALLEGRO_HAVE_STRERROR_R) +#if defined(A5O_HAVE_STRERROR_R) { int rc = strerror_r(userdata->errnum, userdata->errmsg, sizeof(userdata->errmsg)); @@ -299,7 +299,7 @@ static const char *file_stdio_ferrmsg(ALLEGRO_FILE *f) } #endif -#if defined(ALLEGRO_HAVE_STRERROR_S) +#if defined(A5O_HAVE_STRERROR_S) { errno_t rc = strerror_s(userdata->errmsg, sizeof(userdata->errmsg), userdata->errnum); @@ -313,7 +313,7 @@ static const char *file_stdio_ferrmsg(ALLEGRO_FILE *f) } -static void file_stdio_fclearerr(ALLEGRO_FILE *f) +static void file_stdio_fclearerr(A5O_FILE *f) { USERDATA *userdata = get_userdata(f); @@ -321,7 +321,7 @@ static void file_stdio_fclearerr(ALLEGRO_FILE *f) } -static int file_stdio_fungetc(ALLEGRO_FILE *f, int c) +static int file_stdio_fungetc(A5O_FILE *f, int c) { USERDATA *userdata = get_userdata(f); int rc; @@ -336,7 +336,7 @@ static int file_stdio_fungetc(ALLEGRO_FILE *f, int c) } -static off_t file_stdio_fsize(ALLEGRO_FILE *f) +static off_t file_stdio_fsize(A5O_FILE *f) { int64_t old_pos; int64_t new_pos; @@ -345,21 +345,21 @@ static off_t file_stdio_fsize(ALLEGRO_FILE *f) if (old_pos == -1) return -1; - if (!file_stdio_fseek(f, 0, ALLEGRO_SEEK_END)) + if (!file_stdio_fseek(f, 0, A5O_SEEK_END)) return -1; new_pos = file_stdio_ftell(f); if (new_pos == -1) return -1; - if (!file_stdio_fseek(f, old_pos, ALLEGRO_SEEK_SET)) + if (!file_stdio_fseek(f, old_pos, A5O_SEEK_SET)) return -1; return new_pos; } -const struct ALLEGRO_FILE_INTERFACE _al_file_interface_stdio = +const struct A5O_FILE_INTERFACE _al_file_interface_stdio = { file_stdio_fopen, file_stdio_fclose, @@ -408,10 +408,10 @@ static void mktemp_replace_XX(const char *template, char *dst) } -static ALLEGRO_FILE *make_temp_file(const char *template, char *temp_filename, - ALLEGRO_PATH *path) +static A5O_FILE *make_temp_file(const char *template, char *temp_filename, + A5O_PATH *path) { - ALLEGRO_FILE *f; + A5O_FILE *f; int fd; int i; @@ -426,11 +426,11 @@ static ALLEGRO_FILE *make_temp_file(const char *template, char *temp_filename, mktemp_replace_XX(template, temp_filename); al_set_path_filename(path, temp_filename); -#ifndef ALLEGRO_MSVC - fd = open(al_path_cstr(path, ALLEGRO_NATIVE_PATH_SEP), +#ifndef A5O_MSVC + fd = open(al_path_cstr(path, A5O_NATIVE_PATH_SEP), O_EXCL | O_CREAT | O_RDWR, S_IRWXU); #else - fd = open(al_path_cstr(path, ALLEGRO_NATIVE_PATH_SEP), + fd = open(al_path_cstr(path, A5O_NATIVE_PATH_SEP), O_EXCL | O_CREAT | O_RDWR, _S_IWRITE | _S_IREAD); #endif @@ -447,7 +447,7 @@ static ALLEGRO_FILE *make_temp_file(const char *template, char *temp_filename, if (!f) { al_set_errno(errno); close(fd); - unlink(al_path_cstr(path, ALLEGRO_NATIVE_PATH_SEP)); + unlink(al_path_cstr(path, A5O_NATIVE_PATH_SEP)); return NULL; } @@ -457,14 +457,14 @@ static ALLEGRO_FILE *make_temp_file(const char *template, char *temp_filename, /* Function: al_make_temp_file */ -ALLEGRO_FILE *al_make_temp_file(const char *template, ALLEGRO_PATH **ret_path) +A5O_FILE *al_make_temp_file(const char *template, A5O_PATH **ret_path) { char *temp_filename; - ALLEGRO_PATH *path; - ALLEGRO_FILE *f; + A5O_PATH *path; + A5O_FILE *f; temp_filename = al_malloc(strlen(template) + 1); - path = al_get_standard_path(ALLEGRO_TEMP_PATH); + path = al_get_standard_path(A5O_TEMP_PATH); if (temp_filename && path) f = make_temp_file(template, temp_filename, path); diff --git a/src/fshook.c b/src/fshook.c index a8a91d9a47..d4b67ebcf6 100644 --- a/src/fshook.c +++ b/src/fshook.c @@ -25,9 +25,9 @@ /* Function: al_create_fs_entry */ -ALLEGRO_FS_ENTRY *al_create_fs_entry(const char *path) +A5O_FS_ENTRY *al_create_fs_entry(const char *path) { - const ALLEGRO_FS_INTERFACE *vt = al_get_fs_interface(); + const A5O_FS_INTERFACE *vt = al_get_fs_interface(); ASSERT(vt->fs_create_entry); return vt->fs_create_entry(path); } @@ -35,7 +35,7 @@ ALLEGRO_FS_ENTRY *al_create_fs_entry(const char *path) /* Function: al_destroy_fs_entry */ -void al_destroy_fs_entry(ALLEGRO_FS_ENTRY *fh) +void al_destroy_fs_entry(A5O_FS_ENTRY *fh) { if (fh) { fh->vtable->fs_destroy_entry(fh); @@ -45,7 +45,7 @@ void al_destroy_fs_entry(ALLEGRO_FS_ENTRY *fh) /* Function: al_get_fs_entry_name */ -const char *al_get_fs_entry_name(ALLEGRO_FS_ENTRY *e) +const char *al_get_fs_entry_name(A5O_FS_ENTRY *e) { ASSERT(e != NULL); @@ -55,7 +55,7 @@ const char *al_get_fs_entry_name(ALLEGRO_FS_ENTRY *e) /* Function: al_update_fs_entry */ -bool al_update_fs_entry(ALLEGRO_FS_ENTRY *e) +bool al_update_fs_entry(A5O_FS_ENTRY *e) { ASSERT(e != NULL); @@ -65,7 +65,7 @@ bool al_update_fs_entry(ALLEGRO_FS_ENTRY *e) /* Function: al_get_fs_entry_mode */ -uint32_t al_get_fs_entry_mode(ALLEGRO_FS_ENTRY *e) +uint32_t al_get_fs_entry_mode(A5O_FS_ENTRY *e) { ASSERT(e != NULL); @@ -75,7 +75,7 @@ uint32_t al_get_fs_entry_mode(ALLEGRO_FS_ENTRY *e) /* Function: al_get_fs_entry_atime */ -time_t al_get_fs_entry_atime(ALLEGRO_FS_ENTRY *e) +time_t al_get_fs_entry_atime(A5O_FS_ENTRY *e) { ASSERT(e != NULL); @@ -85,7 +85,7 @@ time_t al_get_fs_entry_atime(ALLEGRO_FS_ENTRY *e) /* Function: al_get_fs_entry_mtime */ -time_t al_get_fs_entry_mtime(ALLEGRO_FS_ENTRY *e) +time_t al_get_fs_entry_mtime(A5O_FS_ENTRY *e) { ASSERT(e != NULL); @@ -95,7 +95,7 @@ time_t al_get_fs_entry_mtime(ALLEGRO_FS_ENTRY *e) /* Function: al_get_fs_entry_ctime */ -time_t al_get_fs_entry_ctime(ALLEGRO_FS_ENTRY *e) +time_t al_get_fs_entry_ctime(A5O_FS_ENTRY *e) { ASSERT(e != NULL); @@ -105,7 +105,7 @@ time_t al_get_fs_entry_ctime(ALLEGRO_FS_ENTRY *e) /* Function: al_get_fs_entry_size */ -off_t al_get_fs_entry_size(ALLEGRO_FS_ENTRY *e) +off_t al_get_fs_entry_size(A5O_FS_ENTRY *e) { ASSERT(e != NULL); @@ -115,7 +115,7 @@ off_t al_get_fs_entry_size(ALLEGRO_FS_ENTRY *e) /* Function: al_remove_fs_entry */ -bool al_remove_fs_entry(ALLEGRO_FS_ENTRY *e) +bool al_remove_fs_entry(A5O_FS_ENTRY *e) { ASSERT(e != NULL); @@ -125,7 +125,7 @@ bool al_remove_fs_entry(ALLEGRO_FS_ENTRY *e) /* Function: al_fs_entry_exists */ -bool al_fs_entry_exists(ALLEGRO_FS_ENTRY *e) +bool al_fs_entry_exists(A5O_FS_ENTRY *e) { ASSERT(e != NULL); @@ -135,7 +135,7 @@ bool al_fs_entry_exists(ALLEGRO_FS_ENTRY *e) /* Function: al_open_directory */ -bool al_open_directory(ALLEGRO_FS_ENTRY *e) +bool al_open_directory(A5O_FS_ENTRY *e) { ASSERT(e != NULL); @@ -145,7 +145,7 @@ bool al_open_directory(ALLEGRO_FS_ENTRY *e) /* Function: al_close_directory */ -bool al_close_directory(ALLEGRO_FS_ENTRY *e) +bool al_close_directory(A5O_FS_ENTRY *e) { ASSERT(e != NULL); @@ -155,7 +155,7 @@ bool al_close_directory(ALLEGRO_FS_ENTRY *e) /* Function: al_read_directory */ -ALLEGRO_FS_ENTRY *al_read_directory(ALLEGRO_FS_ENTRY *e) +A5O_FS_ENTRY *al_read_directory(A5O_FS_ENTRY *e) { ASSERT(e != NULL); @@ -167,7 +167,7 @@ ALLEGRO_FS_ENTRY *al_read_directory(ALLEGRO_FS_ENTRY *e) */ char *al_get_current_directory(void) { - const ALLEGRO_FS_INTERFACE *vt = al_get_fs_interface(); + const A5O_FS_INTERFACE *vt = al_get_fs_interface(); ASSERT(vt->fs_get_current_directory); return vt->fs_get_current_directory(); } @@ -177,7 +177,7 @@ char *al_get_current_directory(void) */ bool al_change_directory(const char *path) { - const ALLEGRO_FS_INTERFACE *vt = al_get_fs_interface(); + const A5O_FS_INTERFACE *vt = al_get_fs_interface(); ASSERT(vt->fs_change_directory); ASSERT(path); @@ -189,7 +189,7 @@ bool al_change_directory(const char *path) */ bool al_make_directory(const char *path) { - const ALLEGRO_FS_INTERFACE *vt = al_get_fs_interface(); + const A5O_FS_INTERFACE *vt = al_get_fs_interface(); ASSERT(path); ASSERT(vt->fs_make_directory); @@ -201,7 +201,7 @@ bool al_make_directory(const char *path) */ bool al_filename_exists(const char *path) { - const ALLEGRO_FS_INTERFACE *vt = al_get_fs_interface(); + const A5O_FS_INTERFACE *vt = al_get_fs_interface(); ASSERT(path != NULL); ASSERT(vt->fs_filename_exists); @@ -213,7 +213,7 @@ bool al_filename_exists(const char *path) */ bool al_remove_filename(const char *path) { - const ALLEGRO_FS_INTERFACE *vt = al_get_fs_interface(); + const A5O_FS_INTERFACE *vt = al_get_fs_interface(); ASSERT(vt->fs_remove_filename); ASSERT(path != NULL); @@ -223,7 +223,7 @@ bool al_remove_filename(const char *path) /* Function: al_open_fs_entry */ -ALLEGRO_FILE *al_open_fs_entry(ALLEGRO_FS_ENTRY *e, const char *mode) +A5O_FILE *al_open_fs_entry(A5O_FS_ENTRY *e, const char *mode) { ASSERT(e != NULL); @@ -239,15 +239,15 @@ ALLEGRO_FILE *al_open_fs_entry(ALLEGRO_FS_ENTRY *e, const char *mode) /* Function: al_for_each_fs_entry */ -int al_for_each_fs_entry(ALLEGRO_FS_ENTRY *dir, - int (*callback)(ALLEGRO_FS_ENTRY *dir, void *extra), +int al_for_each_fs_entry(A5O_FS_ENTRY *dir, + int (*callback)(A5O_FS_ENTRY *dir, void *extra), void *extra) { - ALLEGRO_FS_ENTRY *entry; + A5O_FS_ENTRY *entry; if (!dir || !al_open_directory(dir)) { al_set_errno(ENOENT); - return ALLEGRO_FOR_EACH_FS_ENTRY_ERROR; + return A5O_FOR_EACH_FS_ENTRY_ERROR; } for (entry = al_read_directory(dir); entry; entry = al_read_directory(dir)) { @@ -255,21 +255,21 @@ int al_for_each_fs_entry(ALLEGRO_FS_ENTRY *dir, int result = callback(entry, extra); /* Recurse if requested and needed. Only OK allows recursion. */ - if (result == ALLEGRO_FOR_EACH_FS_ENTRY_OK) { - if (al_get_fs_entry_mode(entry) & ALLEGRO_FILEMODE_ISDIR) { + if (result == A5O_FOR_EACH_FS_ENTRY_OK) { + if (al_get_fs_entry_mode(entry) & A5O_FILEMODE_ISDIR) { result = al_for_each_fs_entry(entry, callback, extra); } } al_destroy_fs_entry(entry); - if ((result == ALLEGRO_FOR_EACH_FS_ENTRY_STOP) || - (result == ALLEGRO_FOR_EACH_FS_ENTRY_ERROR)) { + if ((result == A5O_FOR_EACH_FS_ENTRY_STOP) || + (result == A5O_FOR_EACH_FS_ENTRY_ERROR)) { return result; } } - return ALLEGRO_FOR_EACH_FS_ENTRY_OK; + return A5O_FOR_EACH_FS_ENTRY_OK; } diff --git a/src/fshook_stdio.c b/src/fshook_stdio.c index 82645ca637..ba65a4ea4e 100644 --- a/src/fshook_stdio.c +++ b/src/fshook_stdio.c @@ -28,12 +28,12 @@ #include "allegro5/allegro.h" #include "allegro5/internal/aintern.h" #include "allegro5/internal/aintern_wunicode.h" -#include ALLEGRO_INTERNAL_HEADER +#include A5O_INTERNAL_HEADER -ALLEGRO_DEBUG_CHANNEL("fshook") +A5O_DEBUG_CHANNEL("fshook") /* Enable large file support in gcc/glibc. */ -#if defined ALLEGRO_HAVE_FTELLO && defined ALLEGRO_HAVE_FSEEKO +#if defined A5O_HAVE_FTELLO && defined A5O_HAVE_FSEEKO #define _LARGEFILE_SOURCE #define _FILE_OFFSET_BITS 64 #endif @@ -51,24 +51,24 @@ ALLEGRO_DEBUG_CHANNEL("fshook") #include "allegro5/internal/aintern_file.h" #include "allegro5/internal/aintern_fshook.h" -#ifdef ALLEGRO_HAVE_SYS_STAT_H +#ifdef A5O_HAVE_SYS_STAT_H #include #endif -#ifdef ALLEGRO_HAVE_DIRENT_H +#ifdef A5O_HAVE_DIRENT_H #include #include #define NAMLEN(dirent) (strlen((dirent)->d_name)) #else #define dirent direct #define NAMLEN(dirent) ((dirent)->d_namlen) - #ifdef ALLEGRO_HAVE_SYS_NDIR_H + #ifdef A5O_HAVE_SYS_NDIR_H #include #endif - #ifdef ALLEGRO_HAVE_SYS_DIR_H + #ifdef A5O_HAVE_SYS_DIR_H #include #endif - #ifdef ALLEGRO_HAVE_NDIR_H + #ifdef A5O_HAVE_NDIR_H #include #endif #endif @@ -83,14 +83,14 @@ ALLEGRO_DEBUG_CHANNEL("fshook") #define S_IXGRP (0) #endif -#ifdef ALLEGRO_HAVE_SYS_TIME +#ifdef A5O_HAVE_SYS_TIME #include #endif -#ifdef ALLEGRO_HAVE_TIME_H +#ifdef A5O_HAVE_TIME_H #include #endif -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS #include #include "fshook_win.inc" @@ -131,13 +131,13 @@ ALLEGRO_DEBUG_CHANNEL("fshook") #endif -typedef struct ALLEGRO_FS_ENTRY_STDIO ALLEGRO_FS_ENTRY_STDIO; +typedef struct A5O_FS_ENTRY_STDIO A5O_FS_ENTRY_STDIO; -struct ALLEGRO_FS_ENTRY_STDIO +struct A5O_FS_ENTRY_STDIO { - ALLEGRO_FS_ENTRY fs_entry; /* must be first */ + A5O_FS_ENTRY fs_entry; /* must be first */ WRAP_CHAR *abs_path; -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS char *abs_path_utf8; #define ABS_PATH_UTF8 abs_path_utf8 #else @@ -149,8 +149,8 @@ struct ALLEGRO_FS_ENTRY_STDIO }; -static void fs_update_stat_mode(ALLEGRO_FS_ENTRY_STDIO *fp_stdio); -static bool fs_stdio_update_entry(ALLEGRO_FS_ENTRY *fp); +static void fs_update_stat_mode(A5O_FS_ENTRY_STDIO *fp_stdio); +static bool fs_stdio_update_entry(A5O_FS_ENTRY *fp); /* Make an absolute path given a potentially relative path. @@ -158,7 +158,7 @@ static bool fs_stdio_update_entry(ALLEGRO_FS_ENTRY *fp); */ static WRAP_CHAR *make_absolute_path_inner(const WRAP_CHAR *tail) { -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS /* We use _wfullpath to get the proper drive letter semantics on Windows. */ wchar_t *abs_path = _wfullpath(NULL, tail, 0); @@ -178,12 +178,12 @@ static WRAP_CHAR *make_absolute_path_inner(const WRAP_CHAR *tail) return abs_path; #else char cwd[PATH_MAX]; - ALLEGRO_PATH *cwdpath = NULL; - ALLEGRO_PATH *tailpath = NULL; + A5O_PATH *cwdpath = NULL; + A5O_PATH *tailpath = NULL; char *ret = NULL; if (!getcwd(cwd, sizeof(cwd))) { - ALLEGRO_WARN("Unable to get current working directory.\n"); + A5O_WARN("Unable to get current working directory.\n"); al_set_errno(errno); goto Error; } @@ -202,7 +202,7 @@ static WRAP_CHAR *make_absolute_path_inner(const WRAP_CHAR *tail) al_make_path_canonical(tailpath); } - ret = strdup(al_path_cstr(tailpath, ALLEGRO_NATIVE_PATH_SEP)); + ret = strdup(al_path_cstr(tailpath, A5O_NATIVE_PATH_SEP)); Error: @@ -216,7 +216,7 @@ static WRAP_CHAR *make_absolute_path_inner(const WRAP_CHAR *tail) static WRAP_CHAR *make_absolute_path(const char *tail) { WRAP_CHAR *abs_path = NULL; -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS wchar_t *wtail = _al_win_utf8_to_utf16(tail); if (wtail) { abs_path = make_absolute_path_inner(wtail); @@ -229,9 +229,9 @@ static WRAP_CHAR *make_absolute_path(const char *tail) } -static ALLEGRO_FS_ENTRY *create_abs_path_entry(const WRAP_CHAR *abs_path) +static A5O_FS_ENTRY *create_abs_path_entry(const WRAP_CHAR *abs_path) { - ALLEGRO_FS_ENTRY_STDIO *fh; + A5O_FS_ENTRY_STDIO *fh; size_t len; fh = al_calloc(1, sizeof(*fh)); @@ -250,7 +250,7 @@ static ALLEGRO_FS_ENTRY *create_abs_path_entry(const WRAP_CHAR *abs_path) } memcpy(fh->abs_path, abs_path, len * sizeof(WRAP_CHAR)); -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS fh->abs_path_utf8 = _al_win_utf16_to_utf8(fh->abs_path); if (!fh->abs_path_utf8) { al_free(fh->abs_path); @@ -259,17 +259,17 @@ static ALLEGRO_FS_ENTRY *create_abs_path_entry(const WRAP_CHAR *abs_path) } #endif - ALLEGRO_DEBUG("Creating entry for %s\n", fh->ABS_PATH_UTF8); + A5O_DEBUG("Creating entry for %s\n", fh->ABS_PATH_UTF8); - fs_stdio_update_entry((ALLEGRO_FS_ENTRY *) fh); + fs_stdio_update_entry((A5O_FS_ENTRY *) fh); - return (ALLEGRO_FS_ENTRY *) fh; + return (A5O_FS_ENTRY *) fh; } -static ALLEGRO_FS_ENTRY *fs_stdio_create_entry(const char *orig_path) +static A5O_FS_ENTRY *fs_stdio_create_entry(const char *orig_path) { - ALLEGRO_FS_ENTRY *ret = NULL; + A5O_FS_ENTRY *ret = NULL; WRAP_CHAR *abs_path; abs_path = make_absolute_path(orig_path); @@ -281,11 +281,11 @@ static ALLEGRO_FS_ENTRY *fs_stdio_create_entry(const char *orig_path) } -#if defined(ALLEGRO_UNIX) || defined(ALLEGRO_MACOSX) +#if defined(A5O_UNIX) || defined(A5O_MACOSX) static bool unix_hidden_file(const char *path) { /* Filenames beginning with dot are considered hidden. */ - const char *p = strrchr(path, ALLEGRO_NATIVE_PATH_SEP); + const char *p = strrchr(path, A5O_NATIVE_PATH_SEP); if (p) p++; else @@ -295,59 +295,59 @@ static bool unix_hidden_file(const char *path) #endif -static void fs_update_stat_mode(ALLEGRO_FS_ENTRY_STDIO *fp_stdio) +static void fs_update_stat_mode(A5O_FS_ENTRY_STDIO *fp_stdio) { fp_stdio->stat_mode = 0; if (S_ISDIR(fp_stdio->st.st_mode)) - fp_stdio->stat_mode |= ALLEGRO_FILEMODE_ISDIR; + fp_stdio->stat_mode |= A5O_FILEMODE_ISDIR; else /* marks special unix files as files... might want to add enum items for symlink, CHAR, BLOCK and SOCKET files. */ - fp_stdio->stat_mode |= ALLEGRO_FILEMODE_ISFILE; + fp_stdio->stat_mode |= A5O_FILEMODE_ISFILE; /* if (S_ISREG(fh->st.st_mode)) - fh->stat_mode |= ALLEGRO_FILEMODE_ISFILE; + fh->stat_mode |= A5O_FILEMODE_ISFILE; */ if (fp_stdio->st.st_mode & (S_IRUSR | S_IRGRP)) - fp_stdio->stat_mode |= ALLEGRO_FILEMODE_READ; + fp_stdio->stat_mode |= A5O_FILEMODE_READ; if (fp_stdio->st.st_mode & (S_IWUSR | S_IWGRP)) - fp_stdio->stat_mode |= ALLEGRO_FILEMODE_WRITE; + fp_stdio->stat_mode |= A5O_FILEMODE_WRITE; if (fp_stdio->st.st_mode & (S_IXUSR | S_IXGRP)) - fp_stdio->stat_mode |= ALLEGRO_FILEMODE_EXECUTE; + fp_stdio->stat_mode |= A5O_FILEMODE_EXECUTE; -#if defined(ALLEGRO_WINDOWS) +#if defined(A5O_WINDOWS) { DWORD attrib = GetFileAttributes(fp_stdio->abs_path); if (attrib & FILE_ATTRIBUTE_HIDDEN) - fp_stdio->stat_mode |= ALLEGRO_FILEMODE_HIDDEN; + fp_stdio->stat_mode |= A5O_FILEMODE_HIDDEN; } #endif -#if defined(ALLEGRO_MACOSX) && defined(UF_HIDDEN) +#if defined(A5O_MACOSX) && defined(UF_HIDDEN) { /* OSX hidden files can both start with the dot as well as having this flag set... * Note that this flag does not exist on all versions of OS X (Tiger * doesn't seem to have it) so we need to test for it. */ if (fp_stdio->st.st_flags & UF_HIDDEN) - fp_stdio->stat_mode |= ALLEGRO_FILEMODE_HIDDEN; + fp_stdio->stat_mode |= A5O_FILEMODE_HIDDEN; } #endif -#if defined(ALLEGRO_UNIX) || defined(ALLEGRO_MACOSX) - if (0 == (fp_stdio->stat_mode & ALLEGRO_FILEMODE_HIDDEN)) { +#if defined(A5O_UNIX) || defined(A5O_MACOSX) + if (0 == (fp_stdio->stat_mode & A5O_FILEMODE_HIDDEN)) { if (unix_hidden_file(fp_stdio->abs_path)) { - fp_stdio->stat_mode |= ALLEGRO_FILEMODE_HIDDEN; + fp_stdio->stat_mode |= A5O_FILEMODE_HIDDEN; } } #endif } -static bool fs_stdio_update_entry(ALLEGRO_FS_ENTRY *fp) +static bool fs_stdio_update_entry(A5O_FS_ENTRY *fp) { - ALLEGRO_FS_ENTRY_STDIO *fp_stdio = (ALLEGRO_FS_ENTRY_STDIO *) fp; + A5O_FS_ENTRY_STDIO *fp_stdio = (A5O_FS_ENTRY_STDIO *) fp; int ret; ret = WRAP_STAT(fp_stdio->abs_path, &(fp_stdio->st)); @@ -362,11 +362,11 @@ static bool fs_stdio_update_entry(ALLEGRO_FS_ENTRY *fp) } -static bool fs_stdio_open_directory(ALLEGRO_FS_ENTRY *fp) +static bool fs_stdio_open_directory(A5O_FS_ENTRY *fp) { - ALLEGRO_FS_ENTRY_STDIO *fp_stdio = (ALLEGRO_FS_ENTRY_STDIO *) fp; + A5O_FS_ENTRY_STDIO *fp_stdio = (A5O_FS_ENTRY_STDIO *) fp; - if (!(fp_stdio->stat_mode & ALLEGRO_FILEMODE_ISDIR)) + if (!(fp_stdio->stat_mode & A5O_FILEMODE_ISDIR)) return false; fp_stdio->dir = WRAP_OPENDIR(fp_stdio->abs_path); @@ -379,9 +379,9 @@ static bool fs_stdio_open_directory(ALLEGRO_FS_ENTRY *fp) } -static bool fs_stdio_close_directory(ALLEGRO_FS_ENTRY *fp) +static bool fs_stdio_close_directory(A5O_FS_ENTRY *fp) { - ALLEGRO_FS_ENTRY_STDIO *fp_stdio = (ALLEGRO_FS_ENTRY_STDIO *) fp; + A5O_FS_ENTRY_STDIO *fp_stdio = (A5O_FS_ENTRY_STDIO *) fp; int rc; if (!fp_stdio->dir) { @@ -400,13 +400,13 @@ static bool fs_stdio_close_directory(ALLEGRO_FS_ENTRY *fp) } -static ALLEGRO_FS_ENTRY *fs_stdio_read_directory(ALLEGRO_FS_ENTRY *fp) +static A5O_FS_ENTRY *fs_stdio_read_directory(A5O_FS_ENTRY *fp) { - ALLEGRO_FS_ENTRY_STDIO *fp_stdio = (ALLEGRO_FS_ENTRY_STDIO *) fp; + A5O_FS_ENTRY_STDIO *fp_stdio = (A5O_FS_ENTRY_STDIO *) fp; // FIXME: Must use readdir_r as Allegro allows file functions being // called from different threads. WRAP_DIRENT_TYPE *ent; - ALLEGRO_FS_ENTRY *ret; + A5O_FS_ENTRY *ret; ASSERT(fp_stdio->dir); @@ -420,7 +420,7 @@ static ALLEGRO_FS_ENTRY *fs_stdio_read_directory(ALLEGRO_FS_ENTRY *fp) } while (0 == WRAP_STRCMP(ent->d_name, WRAP_LIT(".")) || 0 == WRAP_STRCMP(ent->d_name, WRAP_LIT(".."))); -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS { wchar_t buf[MAX_PATH]; int buflen; @@ -444,7 +444,7 @@ static ALLEGRO_FS_ENTRY *fs_stdio_read_directory(ALLEGRO_FS_ENTRY *fp) } memcpy(buf, fp_stdio->abs_path, abs_path_len); if ( (abs_path_len >= 1) && - buf[abs_path_len - 1] == ALLEGRO_NATIVE_PATH_SEP) + buf[abs_path_len - 1] == A5O_NATIVE_PATH_SEP) { /* do NOT add a new separator if we have one already */ memcpy(buf + abs_path_len, ent->d_name, ent_name_len); @@ -452,7 +452,7 @@ static ALLEGRO_FS_ENTRY *fs_stdio_read_directory(ALLEGRO_FS_ENTRY *fp) } else { /* append separator */ - buf[abs_path_len] = ALLEGRO_NATIVE_PATH_SEP; + buf[abs_path_len] = A5O_NATIVE_PATH_SEP; memcpy(buf + abs_path_len + 1, ent->d_name, ent_name_len); buf[abs_path_len + 1 + ent_name_len] = '\0'; } @@ -464,12 +464,12 @@ static ALLEGRO_FS_ENTRY *fs_stdio_read_directory(ALLEGRO_FS_ENTRY *fp) } -static void fs_stdio_destroy_entry(ALLEGRO_FS_ENTRY *fh_) +static void fs_stdio_destroy_entry(A5O_FS_ENTRY *fh_) { - ALLEGRO_FS_ENTRY_STDIO *fh = (ALLEGRO_FS_ENTRY_STDIO *) fh_; + A5O_FS_ENTRY_STDIO *fh = (A5O_FS_ENTRY_STDIO *) fh_; al_free(fh->abs_path); -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS al_free(fh->abs_path_utf8); #endif @@ -480,41 +480,41 @@ static void fs_stdio_destroy_entry(ALLEGRO_FS_ENTRY *fh_) } -static off_t fs_stdio_entry_size(ALLEGRO_FS_ENTRY *fp) +static off_t fs_stdio_entry_size(A5O_FS_ENTRY *fp) { - ALLEGRO_FS_ENTRY_STDIO *ent = (ALLEGRO_FS_ENTRY_STDIO *) fp; + A5O_FS_ENTRY_STDIO *ent = (A5O_FS_ENTRY_STDIO *) fp; ASSERT(ent); return ent->st.st_size; } -static uint32_t fs_stdio_entry_mode(ALLEGRO_FS_ENTRY *fp) +static uint32_t fs_stdio_entry_mode(A5O_FS_ENTRY *fp) { - ALLEGRO_FS_ENTRY_STDIO *ent = (ALLEGRO_FS_ENTRY_STDIO *) fp; + A5O_FS_ENTRY_STDIO *ent = (A5O_FS_ENTRY_STDIO *) fp; ASSERT(ent); return ent->stat_mode; } -static time_t fs_stdio_entry_atime(ALLEGRO_FS_ENTRY *fp) +static time_t fs_stdio_entry_atime(A5O_FS_ENTRY *fp) { - ALLEGRO_FS_ENTRY_STDIO *ent = (ALLEGRO_FS_ENTRY_STDIO *) fp; + A5O_FS_ENTRY_STDIO *ent = (A5O_FS_ENTRY_STDIO *) fp; ASSERT(ent); return ent->st.st_atime; } -static time_t fs_stdio_entry_mtime(ALLEGRO_FS_ENTRY *fp) +static time_t fs_stdio_entry_mtime(A5O_FS_ENTRY *fp) { - ALLEGRO_FS_ENTRY_STDIO *ent = (ALLEGRO_FS_ENTRY_STDIO *) fp; + A5O_FS_ENTRY_STDIO *ent = (A5O_FS_ENTRY_STDIO *) fp; ASSERT(ent); return ent->st.st_mtime; } -static time_t fs_stdio_entry_ctime(ALLEGRO_FS_ENTRY *fp) +static time_t fs_stdio_entry_ctime(A5O_FS_ENTRY *fp) { - ALLEGRO_FS_ENTRY_STDIO *ent = (ALLEGRO_FS_ENTRY_STDIO *) fp; + A5O_FS_ENTRY_STDIO *ent = (A5O_FS_ENTRY_STDIO *) fp; ASSERT(ent); return ent->st.st_ctime; } @@ -522,7 +522,7 @@ static time_t fs_stdio_entry_ctime(ALLEGRO_FS_ENTRY *fp) static char *fs_stdio_get_current_directory(void) { -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS wchar_t *wcwd; char *cwd; @@ -557,7 +557,7 @@ static bool fs_stdio_change_directory(const char *path) { int ret = -1; -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS wchar_t *wpath = _al_win_utf8_to_utf16(path); if (wpath) { ret = _wchdir(wpath); @@ -596,7 +596,7 @@ static bool do_make_directory(WRAP_CHAR *abs_path) p = abs_path + 1; -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS /* Skip drive letter. */ if (end - abs_path >= 3 && abs_path[1] == ':' @@ -608,7 +608,7 @@ static bool do_make_directory(WRAP_CHAR *abs_path) for ( ; p < end; p++) { const WRAP_CHAR c = *p; - if (c == ALLEGRO_NATIVE_PATH_SEP || c == '/') { + if (c == A5O_NATIVE_PATH_SEP || c == '/') { *p = '\0'; ret = mkdir_exists(abs_path); *p = c; @@ -633,9 +633,9 @@ static bool fs_stdio_make_directory(const char *tail) } -static bool fs_stdio_entry_exists(ALLEGRO_FS_ENTRY *fp) +static bool fs_stdio_entry_exists(A5O_FS_ENTRY *fp) { - ALLEGRO_FS_ENTRY_STDIO *fp_stdio = (ALLEGRO_FS_ENTRY_STDIO *) fp; + A5O_FS_ENTRY_STDIO *fp_stdio = (A5O_FS_ENTRY_STDIO *) fp; WRAP_STAT_TYPE st; if (WRAP_STAT(fp_stdio->abs_path, &st) != 0) { @@ -655,7 +655,7 @@ static bool fs_stdio_filename_exists(const char *path) bool ret = false; ASSERT(path); -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS { /* Pass an path created by _wfullpath() to avoid issues * with stat() failing when there is a trailing slash. @@ -680,17 +680,17 @@ static bool fs_stdio_filename_exists(const char *path) } -static bool fs_stdio_remove_entry(ALLEGRO_FS_ENTRY *fp) +static bool fs_stdio_remove_entry(A5O_FS_ENTRY *fp) { - ALLEGRO_FS_ENTRY_STDIO *fp_stdio = (ALLEGRO_FS_ENTRY_STDIO *) fp; + A5O_FS_ENTRY_STDIO *fp_stdio = (A5O_FS_ENTRY_STDIO *) fp; int err; ASSERT(fp); - if (fs_stdio_entry_mode(fp) & ALLEGRO_FILEMODE_ISDIR) { + if (fs_stdio_entry_mode(fp) & A5O_FILEMODE_ISDIR) { err = WRAP_RMDIR(fp_stdio->abs_path); } - else if (fs_stdio_entry_mode(fp) & ALLEGRO_FILEMODE_ISFILE) { + else if (fs_stdio_entry_mode(fp) & A5O_FILEMODE_ISFILE) { err = WRAP_UNLINK(fp_stdio->abs_path); } else { @@ -709,12 +709,12 @@ static bool fs_stdio_remove_entry(ALLEGRO_FS_ENTRY *fp) static bool fs_stdio_remove_filename(const char *path) { - ALLEGRO_FS_ENTRY *fp; + A5O_FS_ENTRY *fp; bool rc; fp = fs_stdio_create_entry(path); if (!fp) { - ALLEGRO_WARN("Cannot remove %s.", path); + A5O_WARN("Cannot remove %s.", path); return false; } @@ -724,17 +724,17 @@ static bool fs_stdio_remove_filename(const char *path) } -static const char *fs_stdio_name(ALLEGRO_FS_ENTRY *fp) +static const char *fs_stdio_name(A5O_FS_ENTRY *fp) { - ALLEGRO_FS_ENTRY_STDIO *fp_stdio = (ALLEGRO_FS_ENTRY_STDIO *) fp; + A5O_FS_ENTRY_STDIO *fp_stdio = (A5O_FS_ENTRY_STDIO *) fp; return fp_stdio->ABS_PATH_UTF8; } -static ALLEGRO_FILE *fs_stdio_open_file(ALLEGRO_FS_ENTRY *fp, const char *mode) +static A5O_FILE *fs_stdio_open_file(A5O_FS_ENTRY *fp, const char *mode) { - ALLEGRO_FS_ENTRY_STDIO *fp_stdio = (ALLEGRO_FS_ENTRY_STDIO *) fp; + A5O_FS_ENTRY_STDIO *fp_stdio = (A5O_FS_ENTRY_STDIO *) fp; /* XXX on Windows it would be nicer to use the UTF-16 abs_path field * directly @@ -744,7 +744,7 @@ static ALLEGRO_FILE *fs_stdio_open_file(ALLEGRO_FS_ENTRY *fp, const char *mode) } -struct ALLEGRO_FS_INTERFACE _al_fs_interface_stdio = { +struct A5O_FS_INTERFACE _al_fs_interface_stdio = { fs_stdio_create_entry, fs_stdio_destroy_entry, fs_stdio_name, diff --git a/src/fshook_win.inc b/src/fshook_win.inc index 87997c7637..17e8f3ff1b 100644 --- a/src/fshook_win.inc +++ b/src/fshook_win.inc @@ -15,7 +15,7 @@ #include -#if defined(ALLEGRO_MSVC) +#if defined(A5O_MSVC) #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) @@ -259,6 +259,6 @@ static int _tclosedir(_TDIR* dirp) return rc; } -#endif /* ALLEGRO_MSVC */ +#endif /* A5O_MSVC */ /* vim: set ft=c sts=3 sw=3 et: */ diff --git a/src/fullscreen_mode.c b/src/fullscreen_mode.c index dd35316456..ff97ca6873 100644 --- a/src/fullscreen_mode.c +++ b/src/fullscreen_mode.c @@ -22,16 +22,16 @@ */ int al_get_num_display_modes(void) { - ALLEGRO_SYSTEM *system = al_get_system_driver(); + A5O_SYSTEM *system = al_get_system_driver(); return system->vt->get_num_display_modes(); } /* Function: al_get_display_mode */ -ALLEGRO_DISPLAY_MODE *al_get_display_mode(int index, ALLEGRO_DISPLAY_MODE *mode) +A5O_DISPLAY_MODE *al_get_display_mode(int index, A5O_DISPLAY_MODE *mode) { - ALLEGRO_SYSTEM *system = al_get_system_driver(); + A5O_SYSTEM *system = al_get_system_driver(); return system->vt->get_display_mode(index, mode); } diff --git a/src/gp2xwiz/wiz_display_fb.c b/src/gp2xwiz/wiz_display_fb.c index a82c0bc862..35befc752f 100644 --- a/src/gp2xwiz/wiz_display_fb.c +++ b/src/gp2xwiz/wiz_display_fb.c @@ -18,14 +18,14 @@ #include "allegro5/internal/aintern_bitmap.h" #include "allegro5/internal/aintern_opengl.h" -ALLEGRO_DEBUG_CHANNEL("display") +A5O_DEBUG_CHANNEL("display") -static ALLEGRO_DISPLAY_INTERFACE *gp2xwiz_vt; +static A5O_DISPLAY_INTERFACE *gp2xwiz_vt; static bool set_gfx_mode = false; /* Create a new X11 display, which maps directly to a GLX window. */ -static ALLEGRO_DISPLAY *gp2xwiz_create_display_fb(int w, int h) +static A5O_DISPLAY *gp2xwiz_create_display_fb(int w, int h) { (void)w; (void)h; @@ -36,10 +36,10 @@ static ALLEGRO_DISPLAY *gp2xwiz_create_display_fb(int w, int h) lc_init_rest(); - ALLEGRO_DISPLAY_GP2XWIZ_FB *d = al_calloc(1, sizeof *d); - ALLEGRO_DISPLAY *display = (void *)d; + A5O_DISPLAY_GP2XWIZ_FB *d = al_calloc(1, sizeof *d); + A5O_DISPLAY *display = (void *)d; - ALLEGRO_SYSTEM_GP2XWIZ *system = (void *)al_get_system_driver(); + A5O_SYSTEM_GP2XWIZ *system = (void *)al_get_system_driver(); display->w = 320; display->h = 240; @@ -47,10 +47,10 @@ static ALLEGRO_DISPLAY *gp2xwiz_create_display_fb(int w, int h) display->refresh_rate = 60; display->flags = al_get_new_display_flags(); - display->flags |= ALLEGRO_FULLSCREEN; + display->flags |= A5O_FULLSCREEN; /* Add ourself to the list of displays. */ - ALLEGRO_DISPLAY_GP2XWIZ_FB **add; + A5O_DISPLAY_GP2XWIZ_FB **add; add = _al_vector_alloc_back(&system->system.displays); *add = d; @@ -58,23 +58,23 @@ static ALLEGRO_DISPLAY *gp2xwiz_create_display_fb(int w, int h) _al_event_source_init(&display->es); /* Create a backbuffer and point it to the framebuffer */ - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); d->backbuffer = al_create_bitmap(320, 240); d->screen_mem = d->backbuffer->memory; d->backbuffer->memory = (unsigned char *)lc_fb1; set_gfx_mode = true; - ALLEGRO_DEBUG("Display created successfully\n"); + A5O_DEBUG("Display created successfully\n"); return display; } -static void gp2xwiz_destroy_display_fb(ALLEGRO_DISPLAY *d) +static void gp2xwiz_destroy_display_fb(A5O_DISPLAY *d) { - ALLEGRO_SYSTEM_GP2XWIZ *s = (void *)al_get_system_driver(); - ALLEGRO_DISPLAY_GP2XWIZ_FB *wiz_disp = (void *)d; + A5O_SYSTEM_GP2XWIZ *s = (void *)al_get_system_driver(); + A5O_DISPLAY_GP2XWIZ_FB *wiz_disp = (void *)d; _al_vector_find_and_delete(&s->system.displays, &d); @@ -93,19 +93,19 @@ static void gp2xwiz_destroy_display_fb(ALLEGRO_DISPLAY *d) } -static bool gp2xwiz_set_current_display_fb(ALLEGRO_DISPLAY *d) +static bool gp2xwiz_set_current_display_fb(A5O_DISPLAY *d) { (void)d; return true; } -static void gp2xwiz_flip_display_fb(ALLEGRO_DISPLAY *d) +static void gp2xwiz_flip_display_fb(A5O_DISPLAY *d) { (void)d; } -static void gp2xwiz_update_display_region_fb(ALLEGRO_DISPLAY *d, int x, int y, +static void gp2xwiz_update_display_region_fb(A5O_DISPLAY *d, int x, int y, int w, int h) { (void)x; @@ -115,14 +115,14 @@ static void gp2xwiz_update_display_region_fb(ALLEGRO_DISPLAY *d, int x, int y, gp2xwiz_flip_display_fb(d); } -static bool gp2xwiz_acknowledge_resize_fb(ALLEGRO_DISPLAY *d) +static bool gp2xwiz_acknowledge_resize_fb(A5O_DISPLAY *d) { (void)d; return false; } -static bool gp2xwiz_resize_display_fb(ALLEGRO_DISPLAY *d, int w, int h) +static bool gp2xwiz_resize_display_fb(A5O_DISPLAY *d, int w, int h) { (void)d; (void)w; @@ -131,8 +131,8 @@ static bool gp2xwiz_resize_display_fb(ALLEGRO_DISPLAY *d, int w, int h) } -static bool gp2xwiz_is_compatible_bitmap_fb(ALLEGRO_DISPLAY *display, - ALLEGRO_BITMAP *bitmap) +static bool gp2xwiz_is_compatible_bitmap_fb(A5O_DISPLAY *display, + A5O_BITMAP *bitmap) { (void)display; (void)bitmap; @@ -140,7 +140,7 @@ static bool gp2xwiz_is_compatible_bitmap_fb(ALLEGRO_DISPLAY *display, } -static void gp2xwiz_get_window_position_fb(ALLEGRO_DISPLAY *display, int *x, int *y) +static void gp2xwiz_get_window_position_fb(A5O_DISPLAY *display, int *x, int *y) { (void)display; *x = 0; @@ -148,22 +148,22 @@ static void gp2xwiz_get_window_position_fb(ALLEGRO_DISPLAY *display, int *x, int } -static bool gp2xwiz_wait_for_vsync_fb(ALLEGRO_DISPLAY *display) +static bool gp2xwiz_wait_for_vsync_fb(A5O_DISPLAY *display) { (void)display; return false; } -static ALLEGRO_BITMAP *gp2xwiz_get_backbuffer_fb(ALLEGRO_DISPLAY *display) +static A5O_BITMAP *gp2xwiz_get_backbuffer_fb(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_GP2XWIZ_FB *d = (void *)display; + A5O_DISPLAY_GP2XWIZ_FB *d = (void *)display; return d->backbuffer; } /* Obtain a reference to this driver. */ -ALLEGRO_DISPLAY_INTERFACE *_al_display_gp2xwiz_framebuffer_driver(void) +A5O_DISPLAY_INTERFACE *_al_display_gp2xwiz_framebuffer_driver(void) { if (gp2xwiz_vt) return gp2xwiz_vt; diff --git a/src/gp2xwiz/wiz_display_opengl.c b/src/gp2xwiz/wiz_display_opengl.c index 665faa734a..bdbccb43dc 100644 --- a/src/gp2xwiz/wiz_display_opengl.c +++ b/src/gp2xwiz/wiz_display_opengl.c @@ -18,16 +18,16 @@ #include "allegro5/internal/aintern_bitmap.h" #include "allegro5/internal/aintern_opengl.h" -ALLEGRO_DEBUG_CHANNEL("display") +A5O_DEBUG_CHANNEL("display") -static ALLEGRO_DISPLAY_INTERFACE *gp2xwiz_vt; +static A5O_DISPLAY_INTERFACE *gp2xwiz_vt; static bool set_gfx_mode = false; /* Helper to set up GL state as we want it. */ -static void setup_gl(ALLEGRO_DISPLAY *d) +static void setup_gl(A5O_DISPLAY *d) { - ALLEGRO_OGL_EXTRAS *ogl = d->ogl_extras; + A5O_OGL_EXTRAS *ogl = d->ogl_extras; glViewport(0, 0, d->w, d->h); @@ -44,7 +44,7 @@ static void setup_gl(ALLEGRO_DISPLAY *d) /* Create a new X11 display, which maps directly to a GLX window. */ -static ALLEGRO_DISPLAY *gp2xwiz_create_display_ogl(int w, int h) +static A5O_DISPLAY *gp2xwiz_create_display_ogl(int w, int h) { (void)w; (void)h; @@ -53,14 +53,14 @@ static ALLEGRO_DISPLAY *gp2xwiz_create_display_ogl(int w, int h) if (set_gfx_mode) return NULL; - ALLEGRO_DISPLAY_GP2XWIZ_OGL *d = al_calloc(1, sizeof *d); - ALLEGRO_DISPLAY *display = (void*)d; - ALLEGRO_OGL_EXTRAS *ogl = al_calloc(1, sizeof *ogl); + A5O_DISPLAY_GP2XWIZ_OGL *d = al_calloc(1, sizeof *d); + A5O_DISPLAY *display = (void*)d; + A5O_OGL_EXTRAS *ogl = al_calloc(1, sizeof *ogl); EGLint numConfigs; display->ogl_extras = ogl; - ALLEGRO_SYSTEM_GP2XWIZ *system = (void *)al_get_system_driver(); + A5O_SYSTEM_GP2XWIZ *system = (void *)al_get_system_driver(); display->w = 320; display->h = 240; @@ -69,17 +69,17 @@ static ALLEGRO_DISPLAY *gp2xwiz_create_display_ogl(int w, int h) display->flags = al_get_new_display_flags(); // FIXME: default? Is this the right place to set this? - display->flags |= ALLEGRO_OPENGL; -#ifdef ALLEGRO_CFG_OPENGLES2 - display->flags |= ALLEGRO_PROGRAMMABLE_PIPELINE; + display->flags |= A5O_OPENGL; +#ifdef A5O_CFG_OPENGLES2 + display->flags |= A5O_PROGRAMMABLE_PIPELINE; #endif -#ifdef ALLEGRO_CFG_OPENGLES - display->flags |= ALLEGRO_OPENGL_ES_PROFILE; +#ifdef A5O_CFG_OPENGLES + display->flags |= A5O_OPENGL_ES_PROFILE; #endif - display->flags |= ALLEGRO_FULLSCREEN; + display->flags |= A5O_FULLSCREEN; /* Add ourself to the list of displays. */ - ALLEGRO_DISPLAY_GP2XWIZ_OGL **add; + A5O_DISPLAY_GP2XWIZ_OGL **add; add = _al_vector_alloc_back(&system->system.displays); *add = d; @@ -106,7 +106,7 @@ static ALLEGRO_DISPLAY *gp2xwiz_create_display_ogl(int w, int h) eglInitialize(d->egl_display, &majorVersion, &minorVersion); - ALLEGRO_DEBUG("EGL Version: %d.%d\n", majorVersion, minorVersion); + A5O_DEBUG("EGL Version: %d.%d\n", majorVersion, minorVersion); eglChooseConfig(d->egl_display, attrib_list, &d->egl_config, 1, &numConfigs); @@ -119,35 +119,35 @@ static ALLEGRO_DISPLAY *gp2xwiz_create_display_ogl(int w, int h) //eglSwapInterval(d->egl_display, EGL_MAX_SWAP_INTERVAL); - ALLEGRO_DEBUG("GP2X Wiz window created.\n"); + A5O_DEBUG("GP2X Wiz window created.\n"); // FIXME: - ALLEGRO_DEBUG("Calling _al_ogl_manage_extensions\n"); + A5O_DEBUG("Calling _al_ogl_manage_extensions\n"); _al_ogl_manage_extensions(display); - ALLEGRO_DEBUG("Calling _al_ogl_set_extensions\n"); + A5O_DEBUG("Calling _al_ogl_set_extensions\n"); _al_ogl_set_extensions(ogl->extension_api); // FIXME // We don't have this extra_settings stuff set up right - //if (display->extra_settings.settings[ALLEGRO_COMPATIBLE_DISPLAY]) + //if (display->extra_settings.settings[A5O_COMPATIBLE_DISPLAY]) setup_gl(display); set_gfx_mode = true; - ALLEGRO_DEBUG("Display created successfully\n"); + A5O_DEBUG("Display created successfully\n"); return display; } -static void gp2xwiz_destroy_display_ogl(ALLEGRO_DISPLAY *d) +static void gp2xwiz_destroy_display_ogl(A5O_DISPLAY *d) { - ALLEGRO_SYSTEM_GP2XWIZ *s = (void *)al_get_system_driver(); - ALLEGRO_DISPLAY_GP2XWIZ_OGL *wiz_disp = (void *)d; + A5O_SYSTEM_GP2XWIZ *s = (void *)al_get_system_driver(); + A5O_DISPLAY_GP2XWIZ_OGL *wiz_disp = (void *)d; while (d->bitmaps._size > 0) { - ALLEGRO_BITMAP **bptr = _al_vector_ref_back(&d->bitmaps); - ALLEGRO_BITMAP *b = *bptr; + A5O_BITMAP **bptr = _al_vector_ref_back(&d->bitmaps); + A5O_BITMAP *b = *bptr; _al_convert_to_memory_bitmap(b); } @@ -174,20 +174,20 @@ static void gp2xwiz_destroy_display_ogl(ALLEGRO_DISPLAY *d) } -static bool gp2xwiz_set_current_display_ogl(ALLEGRO_DISPLAY *d) +static bool gp2xwiz_set_current_display_ogl(A5O_DISPLAY *d) { (void)d; return true; } -static void gp2xwiz_flip_display_ogl(ALLEGRO_DISPLAY *d) +static void gp2xwiz_flip_display_ogl(A5O_DISPLAY *d) { - ALLEGRO_DISPLAY_GP2XWIZ_OGL *wiz_disp = (ALLEGRO_DISPLAY_GP2XWIZ_OGL *)d; + A5O_DISPLAY_GP2XWIZ_OGL *wiz_disp = (A5O_DISPLAY_GP2XWIZ_OGL *)d; eglSwapBuffers(wiz_disp->egl_display, wiz_disp->egl_surface); } -static void gp2xwiz_update_display_region_ogl(ALLEGRO_DISPLAY *d, int x, int y, +static void gp2xwiz_update_display_region_ogl(A5O_DISPLAY *d, int x, int y, int w, int h) { (void)x; @@ -197,14 +197,14 @@ static void gp2xwiz_update_display_region_ogl(ALLEGRO_DISPLAY *d, int x, int y, gp2xwiz_flip_display_ogl(d); } -static bool gp2xwiz_acknowledge_resize_ogl(ALLEGRO_DISPLAY *d) +static bool gp2xwiz_acknowledge_resize_ogl(A5O_DISPLAY *d) { (void)d; return false; } -static bool gp2xwiz_resize_display_ogl(ALLEGRO_DISPLAY *d, int w, int h) +static bool gp2xwiz_resize_display_ogl(A5O_DISPLAY *d, int w, int h) { (void)d; (void)w; @@ -213,8 +213,8 @@ static bool gp2xwiz_resize_display_ogl(ALLEGRO_DISPLAY *d, int w, int h) } -static bool gp2xwiz_is_compatible_bitmap_ogl(ALLEGRO_DISPLAY *display, - ALLEGRO_BITMAP *bitmap) +static bool gp2xwiz_is_compatible_bitmap_ogl(A5O_DISPLAY *display, + A5O_BITMAP *bitmap) { (void)display; (void)bitmap; @@ -222,7 +222,7 @@ static bool gp2xwiz_is_compatible_bitmap_ogl(ALLEGRO_DISPLAY *display, } -static void gp2xwiz_get_window_position_ogl(ALLEGRO_DISPLAY *display, int *x, int *y) +static void gp2xwiz_get_window_position_ogl(A5O_DISPLAY *display, int *x, int *y) { (void)display; *x = 0; @@ -230,14 +230,14 @@ static void gp2xwiz_get_window_position_ogl(ALLEGRO_DISPLAY *display, int *x, in } -static bool gp2xwiz_wait_for_vsync_ogl(ALLEGRO_DISPLAY *display) +static bool gp2xwiz_wait_for_vsync_ogl(A5O_DISPLAY *display) { (void)display; return false; } /* Obtain a reference to this driver. */ -ALLEGRO_DISPLAY_INTERFACE *_al_display_gp2xwiz_opengl_driver(void) +A5O_DISPLAY_INTERFACE *_al_display_gp2xwiz_opengl_driver(void) { if (gp2xwiz_vt) return gp2xwiz_vt; diff --git a/src/gp2xwiz/wiz_joystick.c b/src/gp2xwiz/wiz_joystick.c index 6688359d74..7addcfaa0d 100644 --- a/src/gp2xwiz/wiz_joystick.c +++ b/src/gp2xwiz/wiz_joystick.c @@ -32,16 +32,16 @@ #include "allegro5/internal/aintern_joystick.h" #include "allegro5/internal/aintern_gp2xwiz.h" -static ALLEGRO_JOYSTICK joy; +static A5O_JOYSTICK joy; -static ALLEGRO_JOYSTICK_STATE joystate; -static ALLEGRO_THREAD *wiz_joystick_thread; +static A5O_JOYSTICK_STATE joystate; +static A5O_THREAD *wiz_joystick_thread; const int POLLS_PER_SECOND = 60; #define BUTTON(x) (buttons & x) -static void joywiz_fill_joystate(ALLEGRO_JOYSTICK_STATE *state) +static void joywiz_fill_joystate(A5O_JOYSTICK_STATE *state) { uint32_t buttons = lc_getbuttons(); @@ -81,14 +81,14 @@ static void joywiz_fill_joystate(ALLEGRO_JOYSTICK_STATE *state) } -static void generate_axis_event(ALLEGRO_JOYSTICK *joy, int stick, int axis, float pos) +static void generate_axis_event(A5O_JOYSTICK *joy, int stick, int axis, float pos) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (!_al_event_source_needs_to_generate_event(&joy->es)) return; - event.joystick.type = ALLEGRO_EVENT_JOYSTICK_AXIS; + event.joystick.type = A5O_EVENT_JOYSTICK_AXIS; event.joystick.timestamp = al_get_time(); event.joystick.stick = stick; event.joystick.axis = axis; @@ -98,9 +98,9 @@ static void generate_axis_event(ALLEGRO_JOYSTICK *joy, int stick, int axis, floa } -static void generate_button_event(ALLEGRO_JOYSTICK *joy, int button, ALLEGRO_EVENT_TYPE event_type) +static void generate_button_event(A5O_JOYSTICK *joy, int button, A5O_EVENT_TYPE event_type) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (!_al_event_source_needs_to_generate_event(&joy->es)) return; @@ -115,10 +115,10 @@ static void generate_button_event(ALLEGRO_JOYSTICK *joy, int button, ALLEGRO_EVE _al_event_source_emit_event(&joy->es, &event); } -static void *joywiz_thread_proc(ALLEGRO_THREAD *thread, void *unused) +static void *joywiz_thread_proc(A5O_THREAD *thread, void *unused) { - ALLEGRO_JOYSTICK_STATE oldstate; - memset(&oldstate, 0, sizeof(ALLEGRO_JOYSTICK_STATE)); + A5O_JOYSTICK_STATE oldstate; + memset(&oldstate, 0, sizeof(A5O_JOYSTICK_STATE)); (void)unused; @@ -134,11 +134,11 @@ static void *joywiz_thread_proc(ALLEGRO_THREAD *thread, void *unused) } int i; for (i = 0; i < 10; i++) { - ALLEGRO_EVENT_TYPE type; + A5O_EVENT_TYPE type; if (oldstate.button[i] == 0) - type = ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN; + type = A5O_EVENT_JOYSTICK_BUTTON_DOWN; else - type = ALLEGRO_EVENT_JOYSTICK_BUTTON_UP; + type = A5O_EVENT_JOYSTICK_BUTTON_UP; if (joystate.button[i] != oldstate.button[i]) { generate_button_event(&joy, i, type); } @@ -155,7 +155,7 @@ static void joywiz_fill_joy(void) joy.info.num_sticks = 1; joy.info.num_buttons = 10; - joy.info.stick[0].flags = ALLEGRO_JOYFLAG_DIGITAL; + joy.info.stick[0].flags = A5O_JOYFLAG_DIGITAL; joy.info.stick[0].num_axes = 2; joy.info.stick[0].name = "Wiz D-pad"; joy.info.stick[0].axis[0].name = "Left-right axis"; @@ -183,7 +183,7 @@ static bool joywiz_init_joystick(void) _al_event_source_init(&joy.es); - memset(&joystate, 0, sizeof(ALLEGRO_JOYSTICK_STATE)); + memset(&joystate, 0, sizeof(A5O_JOYSTICK_STATE)); wiz_joystick_thread = al_create_thread(joywiz_thread_proc, NULL); if (!wiz_joystick_thread) { @@ -207,18 +207,18 @@ static int joywiz_get_num_joysticks(void) return 1; } -static ALLEGRO_JOYSTICK *joywiz_get_joystick(int num) +static A5O_JOYSTICK *joywiz_get_joystick(int num) { (void)num; /* Only 1 supported now */ return &joy; } -static void joywiz_release_joystick(ALLEGRO_JOYSTICK *joy) +static void joywiz_release_joystick(A5O_JOYSTICK *joy) { (void)joy; } -static void joywiz_get_joystick_state(ALLEGRO_JOYSTICK *joy, ALLEGRO_JOYSTICK_STATE *ret_state) +static void joywiz_get_joystick_state(A5O_JOYSTICK *joy, A5O_JOYSTICK_STATE *ret_state) { _al_event_source_lock(&joy->es); { @@ -230,7 +230,7 @@ static void joywiz_get_joystick_state(ALLEGRO_JOYSTICK *joy, ALLEGRO_JOYSTICK_ST /* the driver vtable */ -ALLEGRO_JOYSTICK_DRIVER _al_joydrv_gp2xwiz = +A5O_JOYSTICK_DRIVER _al_joydrv_gp2xwiz = { AL_JOY_TYPE_GP2XWIZ, "", diff --git a/src/gp2xwiz/wiz_system.c b/src/gp2xwiz/wiz_system.c index 941ec72248..1baf9dcc78 100644 --- a/src/gp2xwiz/wiz_system.c +++ b/src/gp2xwiz/wiz_system.c @@ -21,11 +21,11 @@ #include "allegro5/internal/aintern_gp2xwiz.h" #include "allegro5/platform/aintwiz.h" -static ALLEGRO_SYSTEM_INTERFACE *gp2xwiz_vt; +static A5O_SYSTEM_INTERFACE *gp2xwiz_vt; -static ALLEGRO_SYSTEM *gp2xwiz_initialize(int flags) +static A5O_SYSTEM *gp2xwiz_initialize(int flags) { - ALLEGRO_SYSTEM_GP2XWIZ *s; + A5O_SYSTEM_GP2XWIZ *s; (void)flags; @@ -33,7 +33,7 @@ static ALLEGRO_SYSTEM *gp2xwiz_initialize(int flags) s = al_calloc(1, sizeof *s); - _al_vector_init(&s->system.displays, sizeof (ALLEGRO_DISPLAY *)); + _al_vector_init(&s->system.displays, sizeof (A5O_DISPLAY *)); s->system.vt = gp2xwiz_vt; @@ -43,12 +43,12 @@ static ALLEGRO_SYSTEM *gp2xwiz_initialize(int flags) static void gp2xwiz_shutdown_system(void) { /* Close all open displays. */ - ALLEGRO_SYSTEM *s = al_get_system_driver(); - ALLEGRO_SYSTEM_GP2XWIZ *sx = (void *)s; + A5O_SYSTEM *s = al_get_system_driver(); + A5O_SYSTEM_GP2XWIZ *sx = (void *)s; while (_al_vector_size(&s->displays) > 0) { - ALLEGRO_DISPLAY **dptr = _al_vector_ref(&s->displays, 0); - ALLEGRO_DISPLAY *d = *dptr; + A5O_DISPLAY **dptr = _al_vector_ref(&s->displays, 0); + A5O_DISPLAY *d = *dptr; al_destroy_display(d); } _al_vector_free(&s->displays); @@ -59,27 +59,27 @@ static void gp2xwiz_shutdown_system(void) } -static ALLEGRO_DISPLAY_INTERFACE *gp2xwiz_get_display_driver(void) +static A5O_DISPLAY_INTERFACE *gp2xwiz_get_display_driver(void) { - if (al_get_new_display_flags() & ALLEGRO_OPENGL) + if (al_get_new_display_flags() & A5O_OPENGL) return _al_display_gp2xwiz_opengl_driver(); else return _al_display_gp2xwiz_framebuffer_driver(); } -static ALLEGRO_KEYBOARD_DRIVER *gp2xwiz_get_keyboard_driver(void) +static A5O_KEYBOARD_DRIVER *gp2xwiz_get_keyboard_driver(void) { //return _al_gp2xwiz_keyboard_driver; return NULL; } -static ALLEGRO_MOUSE_DRIVER *gp2xwiz_get_mouse_driver(void) +static A5O_MOUSE_DRIVER *gp2xwiz_get_mouse_driver(void) { //return _al_gp2xwiz_mouse_driver; return NULL; } -static ALLEGRO_JOYSTICK_DRIVER *gp2xwiz_get_joystick_driver(void) +static A5O_JOYSTICK_DRIVER *gp2xwiz_get_joystick_driver(void) { return _al_joystick_driver_list[0].driver; } @@ -89,7 +89,7 @@ static int gp2xwiz_get_num_video_adapters(void) return 1; } -static bool gp2xwiz_get_monitor_info(int adapter, ALLEGRO_MONITOR_INFO *info) +static bool gp2xwiz_get_monitor_info(int adapter, A5O_MONITOR_INFO *info) { (void)adapter; info->x1 = 0; @@ -120,28 +120,28 @@ static int gp2xwiz_get_num_display_modes(void) } -static ALLEGRO_DISPLAY_MODE *gp2xwiz_get_display_mode(int index, - ALLEGRO_DISPLAY_MODE *mode) +static A5O_DISPLAY_MODE *gp2xwiz_get_display_mode(int index, + A5O_DISPLAY_MODE *mode) { (void)index; ASSERT(index == 0); mode->width = 320; mode->height = 240; - mode->format = ALLEGRO_PIXEL_FORMAT_RGB_565; + mode->format = A5O_PIXEL_FORMAT_RGB_565; mode->refresh_rate = 60; return mode; } /* Internal function to get a reference to this driver. */ -ALLEGRO_SYSTEM_INTERFACE *_al_system_gp2xwiz_driver(void) +A5O_SYSTEM_INTERFACE *_al_system_gp2xwiz_driver(void) { if (gp2xwiz_vt) return gp2xwiz_vt; gp2xwiz_vt = al_calloc(1, sizeof *gp2xwiz_vt); - gp2xwiz_vt->id = ALLEGRO_SYSTEM_ID_GP2XWIZ; + gp2xwiz_vt->id = A5O_SYSTEM_ID_GP2XWIZ; gp2xwiz_vt->initialize = gp2xwiz_initialize; gp2xwiz_vt->get_display_driver = gp2xwiz_get_display_driver; gp2xwiz_vt->get_keyboard_driver = gp2xwiz_get_keyboard_driver; @@ -168,7 +168,7 @@ ALLEGRO_SYSTEM_INTERFACE *_al_system_gp2xwiz_driver(void) */ void _al_register_system_interfaces(void) { - ALLEGRO_SYSTEM_INTERFACE **add; + A5O_SYSTEM_INTERFACE **add; add = _al_vector_alloc_back(&_al_system_interfaces); *add = _al_system_gp2xwiz_driver(); diff --git a/src/haptic.c b/src/haptic.c index ed23f14046..d4e77867c9 100644 --- a/src/haptic.c +++ b/src/haptic.c @@ -26,15 +26,15 @@ /* the active haptic driver */ -static ALLEGRO_HAPTIC_DRIVER *haptic_driver = NULL; +static A5O_HAPTIC_DRIVER *haptic_driver = NULL; /* Function: al_install_haptic */ bool al_install_haptic(void) { - ALLEGRO_SYSTEM *sysdrv; - ALLEGRO_HAPTIC_DRIVER *hapdrv; + A5O_SYSTEM *sysdrv; + A5O_HAPTIC_DRIVER *hapdrv; if (haptic_driver) return true; @@ -81,7 +81,7 @@ bool al_is_haptic_installed(void) /* Function: al_is_joystick_haptic */ -bool al_is_joystick_haptic(ALLEGRO_JOYSTICK *dev) +bool al_is_joystick_haptic(A5O_JOYSTICK *dev) { ASSERT(dev); ASSERT(haptic_driver); @@ -92,7 +92,7 @@ bool al_is_joystick_haptic(ALLEGRO_JOYSTICK *dev) /* Function: al_is_mouse_haptic */ -bool al_is_mouse_haptic(ALLEGRO_MOUSE *dev) +bool al_is_mouse_haptic(A5O_MOUSE *dev) { ASSERT(dev); ASSERT(haptic_driver); @@ -103,7 +103,7 @@ bool al_is_mouse_haptic(ALLEGRO_MOUSE *dev) /* Function: al_is_keyboard_haptic */ -bool al_is_keyboard_haptic(ALLEGRO_KEYBOARD *dev) +bool al_is_keyboard_haptic(A5O_KEYBOARD *dev) { ASSERT(dev); ASSERT(haptic_driver); @@ -114,7 +114,7 @@ bool al_is_keyboard_haptic(ALLEGRO_KEYBOARD *dev) /* Function: al_is_display_haptic */ -bool al_is_display_haptic(ALLEGRO_DISPLAY *dev) +bool al_is_display_haptic(A5O_DISPLAY *dev) { ASSERT(dev); ASSERT(haptic_driver); @@ -124,7 +124,7 @@ bool al_is_display_haptic(ALLEGRO_DISPLAY *dev) /* Function: al_is_touch_input_haptic */ -bool al_is_touch_input_haptic(ALLEGRO_TOUCH_INPUT *dev) +bool al_is_touch_input_haptic(A5O_TOUCH_INPUT *dev) { ASSERT(dev); ASSERT(haptic_driver); @@ -134,7 +134,7 @@ bool al_is_touch_input_haptic(ALLEGRO_TOUCH_INPUT *dev) /* Function: al_get_haptic_from_joystick */ -ALLEGRO_HAPTIC *al_get_haptic_from_joystick(ALLEGRO_JOYSTICK *dev) +A5O_HAPTIC *al_get_haptic_from_joystick(A5O_JOYSTICK *dev) { ASSERT(dev); ASSERT(haptic_driver); @@ -145,7 +145,7 @@ ALLEGRO_HAPTIC *al_get_haptic_from_joystick(ALLEGRO_JOYSTICK *dev) /* Function: al_get_haptic_from_mouse */ -ALLEGRO_HAPTIC *al_get_haptic_from_mouse(ALLEGRO_MOUSE *dev) +A5O_HAPTIC *al_get_haptic_from_mouse(A5O_MOUSE *dev) { ASSERT(dev); ASSERT(haptic_driver); @@ -156,7 +156,7 @@ ALLEGRO_HAPTIC *al_get_haptic_from_mouse(ALLEGRO_MOUSE *dev) /* Function: al_get_haptic_from_keyboard */ -ALLEGRO_HAPTIC *al_get_haptic_from_keyboard(ALLEGRO_KEYBOARD *dev) +A5O_HAPTIC *al_get_haptic_from_keyboard(A5O_KEYBOARD *dev) { ASSERT(dev); ASSERT(haptic_driver); @@ -167,7 +167,7 @@ ALLEGRO_HAPTIC *al_get_haptic_from_keyboard(ALLEGRO_KEYBOARD *dev) /* Function: al_get_haptic_from_display */ -ALLEGRO_HAPTIC *al_get_haptic_from_display(ALLEGRO_DISPLAY *dev) +A5O_HAPTIC *al_get_haptic_from_display(A5O_DISPLAY *dev) { ASSERT(dev); ASSERT(haptic_driver); @@ -178,7 +178,7 @@ ALLEGRO_HAPTIC *al_get_haptic_from_display(ALLEGRO_DISPLAY *dev) /* Function: al_get_haptic_from_touch_input */ -ALLEGRO_HAPTIC *al_get_haptic_from_touch_input(ALLEGRO_TOUCH_INPUT *dev) +A5O_HAPTIC *al_get_haptic_from_touch_input(A5O_TOUCH_INPUT *dev) { ASSERT(dev); ASSERT(haptic_driver); @@ -189,7 +189,7 @@ ALLEGRO_HAPTIC *al_get_haptic_from_touch_input(ALLEGRO_TOUCH_INPUT *dev) /* Function: al_is_haptic_active */ -bool al_is_haptic_active(ALLEGRO_HAPTIC *hap) +bool al_is_haptic_active(A5O_HAPTIC *hap) { ASSERT(hap); ASSERT(haptic_driver); @@ -200,7 +200,7 @@ bool al_is_haptic_active(ALLEGRO_HAPTIC *hap) /* Function: al_get_haptic_capabilities */ -int al_get_haptic_capabilities(ALLEGRO_HAPTIC *hap) +int al_get_haptic_capabilities(A5O_HAPTIC *hap) { ASSERT(hap); ASSERT(haptic_driver); @@ -210,14 +210,14 @@ int al_get_haptic_capabilities(ALLEGRO_HAPTIC *hap) /* Function: al_is_haptic_capable */ -bool al_is_haptic_capable(ALLEGRO_HAPTIC * hap, int query) { +bool al_is_haptic_capable(A5O_HAPTIC * hap, int query) { int capabilities = al_get_haptic_capabilities(hap); return (capabilities & query) == query; } /* Function: al_get_haptic_gain */ -double al_get_haptic_gain(ALLEGRO_HAPTIC *hap) +double al_get_haptic_gain(A5O_HAPTIC *hap) { ASSERT(hap); ASSERT(haptic_driver); @@ -228,7 +228,7 @@ double al_get_haptic_gain(ALLEGRO_HAPTIC *hap) /* Function: al_set_haptic_gain */ -bool al_set_haptic_gain(ALLEGRO_HAPTIC *hap, double gain) +bool al_set_haptic_gain(A5O_HAPTIC *hap, double gain) { ASSERT(hap); ASSERT(haptic_driver); @@ -238,7 +238,7 @@ bool al_set_haptic_gain(ALLEGRO_HAPTIC *hap, double gain) /* Function: al_get_haptic_autocenter */ -double al_get_haptic_autocenter(ALLEGRO_HAPTIC *hap) +double al_get_haptic_autocenter(A5O_HAPTIC *hap) { ASSERT(hap); ASSERT(haptic_driver); @@ -249,7 +249,7 @@ double al_get_haptic_autocenter(ALLEGRO_HAPTIC *hap) /* Function: al_set_haptic_autocenter */ -bool al_set_haptic_autocenter(ALLEGRO_HAPTIC *hap, double intensity) +bool al_set_haptic_autocenter(A5O_HAPTIC *hap, double intensity) { ASSERT(hap); ASSERT(haptic_driver); @@ -261,7 +261,7 @@ bool al_set_haptic_autocenter(ALLEGRO_HAPTIC *hap, double intensity) /* Function: al_get_max_haptic_effects */ -int al_get_max_haptic_effects(ALLEGRO_HAPTIC *hap) +int al_get_max_haptic_effects(A5O_HAPTIC *hap) { ASSERT(hap); ASSERT(haptic_driver); @@ -272,7 +272,7 @@ int al_get_max_haptic_effects(ALLEGRO_HAPTIC *hap) /* Function: al_is_haptic_effect_ok */ -bool al_is_haptic_effect_ok(ALLEGRO_HAPTIC *hap, ALLEGRO_HAPTIC_EFFECT *effect) +bool al_is_haptic_effect_ok(A5O_HAPTIC *hap, A5O_HAPTIC_EFFECT *effect) { ASSERT(hap); ASSERT(haptic_driver); @@ -283,8 +283,8 @@ bool al_is_haptic_effect_ok(ALLEGRO_HAPTIC *hap, ALLEGRO_HAPTIC_EFFECT *effect) /* Function: al_upload_haptic_effect */ -bool al_upload_haptic_effect(ALLEGRO_HAPTIC *hap, - ALLEGRO_HAPTIC_EFFECT *effect, ALLEGRO_HAPTIC_EFFECT_ID *id) +bool al_upload_haptic_effect(A5O_HAPTIC *hap, + A5O_HAPTIC_EFFECT *effect, A5O_HAPTIC_EFFECT_ID *id) { ASSERT(hap); ASSERT(haptic_driver); @@ -295,7 +295,7 @@ bool al_upload_haptic_effect(ALLEGRO_HAPTIC *hap, /* Function: al_play_haptic_effect */ -bool al_play_haptic_effect(ALLEGRO_HAPTIC_EFFECT_ID *id, int loop) +bool al_play_haptic_effect(A5O_HAPTIC_EFFECT_ID *id, int loop) { ASSERT(haptic_driver); ASSERT(id); @@ -306,8 +306,8 @@ bool al_play_haptic_effect(ALLEGRO_HAPTIC_EFFECT_ID *id, int loop) /* Function: al_upload_and_play_haptic_effect */ -bool al_upload_and_play_haptic_effect(ALLEGRO_HAPTIC *hap, - ALLEGRO_HAPTIC_EFFECT *effect, ALLEGRO_HAPTIC_EFFECT_ID *id, int loop) +bool al_upload_and_play_haptic_effect(A5O_HAPTIC *hap, + A5O_HAPTIC_EFFECT *effect, A5O_HAPTIC_EFFECT_ID *id, int loop) { ASSERT(hap); ASSERT(effect); @@ -327,7 +327,7 @@ bool al_upload_and_play_haptic_effect(ALLEGRO_HAPTIC *hap, /* Function: al_stop_haptic_effect */ -bool al_stop_haptic_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) +bool al_stop_haptic_effect(A5O_HAPTIC_EFFECT_ID *id) { ASSERT(id); @@ -337,7 +337,7 @@ bool al_stop_haptic_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) /* Function: al_is_haptic_effect_playing */ -bool al_is_haptic_effect_playing(ALLEGRO_HAPTIC_EFFECT_ID *id) +bool al_is_haptic_effect_playing(A5O_HAPTIC_EFFECT_ID *id) { ASSERT(id); @@ -346,21 +346,21 @@ bool al_is_haptic_effect_playing(ALLEGRO_HAPTIC_EFFECT_ID *id) /* Function: al_get_haptic_effect_duration */ -double al_get_haptic_effect_duration(ALLEGRO_HAPTIC_EFFECT * effect) +double al_get_haptic_effect_duration(A5O_HAPTIC_EFFECT * effect) { return effect->replay.delay + effect->replay.length; } /* Function: al_rumble_haptic */ -bool al_rumble_haptic(ALLEGRO_HAPTIC *hap, - double intensity, double duration, ALLEGRO_HAPTIC_EFFECT_ID *id) +bool al_rumble_haptic(A5O_HAPTIC *hap, + double intensity, double duration, A5O_HAPTIC_EFFECT_ID *id) { - ALLEGRO_HAPTIC_EFFECT effect; + A5O_HAPTIC_EFFECT effect; ASSERT(hap); ASSERT(id); - effect.type = ALLEGRO_HAPTIC_RUMBLE; + effect.type = A5O_HAPTIC_RUMBLE; effect.data.rumble.strong_magnitude = intensity; effect.data.rumble.weak_magnitude = intensity; effect.replay.delay = 0.0; @@ -371,7 +371,7 @@ bool al_rumble_haptic(ALLEGRO_HAPTIC *hap, /* Function: al_release_haptic_effect */ -bool al_release_haptic_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) +bool al_release_haptic_effect(A5O_HAPTIC_EFFECT_ID *id) { ASSERT(haptic_driver); ASSERT(id); @@ -382,7 +382,7 @@ bool al_release_haptic_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) /* Function: al_release_haptic */ -bool al_release_haptic(ALLEGRO_HAPTIC *haptic) +bool al_release_haptic(A5O_HAPTIC *haptic) { ASSERT(haptic_driver); ASSERT(haptic); diff --git a/src/inline.c b/src/inline.c index 6237d2e858..2a106be91e 100644 --- a/src/inline.c +++ b/src/inline.c @@ -20,7 +20,7 @@ // apple's cross-compiler already adds the symbols for the "extern __inline__" // declared variants, so the ones here are duplicates and the linker dies -#ifndef ALLEGRO_IPHONE +#ifndef A5O_IPHONE #define AL_INLINE(type, name, args, code) \ extern type name args; \ @@ -29,8 +29,8 @@ #include "allegro5/allegro.h" #include "allegro5/internal/aintern.h" -#ifdef ALLEGRO_INTERNAL_HEADER - #include ALLEGRO_INTERNAL_HEADER +#ifdef A5O_INTERNAL_HEADER + #include A5O_INTERNAL_HEADER #endif /* not used now */ diff --git a/src/iphone/EAGLView.h b/src/iphone/EAGLView.h index 5fd8a2fd29..73fc30e91d 100644 --- a/src/iphone/EAGLView.h +++ b/src/iphone/EAGLView.h @@ -15,7 +15,7 @@ Note that setting the view non-opaque will only work if the EAGL surface has an @private EAGLContext *context; - ALLEGRO_DISPLAY *allegro_display; + A5O_DISPLAY *allegro_display; /* OpenGL names for the renderbuffer and framebuffers used to render to this view */ GLuint viewRenderbuffer, viewFramebuffer; @@ -44,7 +44,7 @@ Note that setting the view non-opaque will only work if the EAGL surface has an - (void)make_current; - (void)flip; - (void)reset_framebuffer; -- (void)set_allegro_display:(ALLEGRO_DISPLAY *)display; +- (void)set_allegro_display:(A5O_DISPLAY *)display; - (BOOL) createFramebuffer; - (void) destroyFramebuffer; - (BOOL)orientation_supported:(UIInterfaceOrientation)o; diff --git a/src/iphone/EAGLView.m b/src/iphone/EAGLView.m index ae0218be4e..4b38f51cde 100644 --- a/src/iphone/EAGLView.m +++ b/src/iphone/EAGLView.m @@ -9,7 +9,7 @@ #include "allegro5/allegro_iphone.h" #include "allegro5/internal/aintern_iphone.h" -ALLEGRO_DEBUG_CHANNEL("iphone") +A5O_DEBUG_CHANNEL("iphone") typedef struct touch_t { @@ -56,8 +56,8 @@ + (Class)layerClass { return [CAEAGLLayer class]; } -- (void)set_allegro_display:(ALLEGRO_DISPLAY *)display { - ALLEGRO_DISPLAY_IPHONE *d = (ALLEGRO_DISPLAY_IPHONE *)display; +- (void)set_allegro_display:(A5O_DISPLAY *)display { + A5O_DISPLAY_IPHONE *d = (A5O_DISPLAY_IPHONE *)display; allegro_display = display; @@ -65,7 +65,7 @@ - (void)set_allegro_display:(ALLEGRO_DISPLAY *)display { CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer; NSString *color_format = kEAGLColorFormatRGBA8; - if (display->extra_settings.settings[ALLEGRO_COLOR_SIZE] == 16) + if (display->extra_settings.settings[A5O_COLOR_SIZE] == 16) color_format = kEAGLColorFormatRGB565; eaglLayer.opaque = YES; @@ -73,24 +73,24 @@ - (void)set_allegro_display:(ALLEGRO_DISPLAY *)display { [NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking, color_format, kEAGLDrawablePropertyColorFormat, nil]; - if (display->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { - ALLEGRO_INFO("Attempting to create ES2 context\n"); + if (display->flags & A5O_PROGRAMMABLE_PIPELINE) { + A5O_INFO("Attempting to create ES2 context\n"); context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; if (context == nil) { - ALLEGRO_WARN("ES2 context could not be created. Attempting to create ES1 context instead.\n"); - display->flags &= ~ ALLEGRO_PROGRAMMABLE_PIPELINE; + A5O_WARN("ES2 context could not be created. Attempting to create ES1 context instead.\n"); + display->flags &= ~ A5O_PROGRAMMABLE_PIPELINE; context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1]; } } else { - ALLEGRO_INFO("Attempting to create ES1 context.\n"); + A5O_INFO("Attempting to create ES1 context.\n"); context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1]; } - ALLEGRO_INFO("Context is %p\n", context); + A5O_INFO("Context is %p\n", context); if (!context || ![EAGLContext setCurrentContext:context]) { - ALLEGRO_ERROR("context is nil or setCurrentContext failed.\n"); + A5O_ERROR("context is nil or setCurrentContext failed.\n"); [self release]; return; } @@ -99,12 +99,12 @@ - (void)set_allegro_display:(ALLEGRO_DISPLAY *)display { [self setMultipleTouchEnabled:YES]; - ALLEGRO_INFO("Created EAGLView.\n"); + A5O_INFO("Created EAGLView.\n"); } - (id)initWithFrame:(CGRect)frame { - ALLEGRO_DEBUG("Creating UIView.\n"); + A5O_DEBUG("Creating UIView.\n"); self = [super initWithFrame:frame]; @@ -133,7 +133,7 @@ - (void)flip { } - (void)send_resize_event { - ALLEGRO_DISPLAY *display = allegro_display; + A5O_DISPLAY *display = allegro_display; int x = self.frame.origin.x; int y = self.frame.origin.y; @@ -142,8 +142,8 @@ - (void)send_resize_event { _al_event_source_lock(&display->es); if (_al_event_source_needs_to_generate_event(&display->es)) { - ALLEGRO_EVENT event; - event.display.type = ALLEGRO_EVENT_DISPLAY_RESIZE; + A5O_EVENT event; + event.display.type = A5O_EVENT_DISPLAY_RESIZE; event.display.timestamp = al_get_time(); event.display.x = x; event.display.y = y; @@ -172,23 +172,23 @@ - (void)layoutSubviews { - (BOOL)orientation_supported:(UIInterfaceOrientation) o { if (!allegro_display) return NO; - ALLEGRO_DISPLAY_IPHONE *d = (ALLEGRO_DISPLAY_IPHONE *)allegro_display; + A5O_DISPLAY_IPHONE *d = (A5O_DISPLAY_IPHONE *)allegro_display; if (d->extra->adapter != 0) return NO; - ALLEGRO_EXTRA_DISPLAY_SETTINGS *options = &allegro_display->extra_settings; - int supported = options->settings[ALLEGRO_SUPPORTED_ORIENTATIONS]; - if (o == UIInterfaceOrientationPortrait) return supported & ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES; - if (o == UIInterfaceOrientationLandscapeLeft) return supported & ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES; - if (o == UIInterfaceOrientationPortraitUpsideDown) return supported & ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES; - if (o == UIInterfaceOrientationLandscapeRight) return supported & ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES; + A5O_EXTRA_DISPLAY_SETTINGS *options = &allegro_display->extra_settings; + int supported = options->settings[A5O_SUPPORTED_ORIENTATIONS]; + if (o == UIInterfaceOrientationPortrait) return supported & A5O_DISPLAY_ORIENTATION_0_DEGREES; + if (o == UIInterfaceOrientationLandscapeLeft) return supported & A5O_DISPLAY_ORIENTATION_90_DEGREES; + if (o == UIInterfaceOrientationPortraitUpsideDown) return supported & A5O_DISPLAY_ORIENTATION_180_DEGREES; + if (o == UIInterfaceOrientationLandscapeRight) return supported & A5O_DISPLAY_ORIENTATION_270_DEGREES; return NO; } - (BOOL)createFramebuffer { - ALLEGRO_DISPLAY_IPHONE *d = (ALLEGRO_DISPLAY_IPHONE *)allegro_display; + A5O_DISPLAY_IPHONE *d = (A5O_DISPLAY_IPHONE *)allegro_display; if (d->extra->adapter == 0 && [self respondsToSelector:@selector(contentScaleFactor)]) { scale = self.contentScaleFactor = [[UIScreen mainScreen] scale]; - ALLEGRO_INFO("Screen scale is %f\n", self.contentScaleFactor); + A5O_INFO("Screen scale is %f\n", self.contentScaleFactor); } else { scale = 1.0f; @@ -205,11 +205,11 @@ - (BOOL)createFramebuffer { glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth); glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight); - ALLEGRO_INFO("Creating GL framebuffer %dx%d.\n", backingWidth, backingHeight); + A5O_INFO("Creating GL framebuffer %dx%d.\n", backingWidth, backingHeight); - if (allegro_display->extra_settings.settings[ALLEGRO_DEPTH_SIZE]) { + if (allegro_display->extra_settings.settings[A5O_DEPTH_SIZE]) { GLint depth_stencil_format; - if (allegro_display->extra_settings.settings[ALLEGRO_STENCIL_SIZE]) { + if (allegro_display->extra_settings.settings[A5O_STENCIL_SIZE]) { depth_stencil_format = GL_DEPTH24_STENCIL8_OES; } else { @@ -219,7 +219,7 @@ - (BOOL)createFramebuffer { glBindRenderbufferOES(GL_RENDERBUFFER_OES, depthRenderbuffer); glRenderbufferStorageOES(GL_RENDERBUFFER_OES, depth_stencil_format, backingWidth, backingHeight); glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, depthRenderbuffer); - if (allegro_display->extra_settings.settings[ALLEGRO_STENCIL_SIZE]) { + if (allegro_display->extra_settings.settings[A5O_STENCIL_SIZE]) { glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_STENCIL_ATTACHMENT_OES, GL_RENDERBUFFER_OES, depthRenderbuffer); } } diff --git a/src/iphone/ViewController.h b/src/iphone/ViewController.h index 71da38fca2..6e4ef7e496 100644 --- a/src/iphone/ViewController.h +++ b/src/iphone/ViewController.h @@ -1,12 +1,12 @@ #import -struct ALLEGRO_DISPLAY; +struct A5O_DISPLAY; @interface ViewController : UIViewController { @public int adapter; - struct ALLEGRO_DISPLAY *display; + struct A5O_DISPLAY *display; } - (void) create_view; diff --git a/src/iphone/ViewController.m b/src/iphone/ViewController.m index d5c8f3cc1a..5556f62524 100644 --- a/src/iphone/ViewController.m +++ b/src/iphone/ViewController.m @@ -4,7 +4,7 @@ #include "allegroAppDelegate.h" -ALLEGRO_DEBUG_CHANNEL("iphone"); +A5O_DEBUG_CHANNEL("iphone"); @implementation ViewController @@ -19,7 +19,7 @@ - (void)loadView - (void)viewDidLoad { - ALLEGRO_DEBUG("Loading view controller.\n"); + A5O_DEBUG("Loading view controller.\n"); display = NULL; } @@ -30,7 +30,7 @@ - (void)viewDidUnload - (BOOL)shouldAutorotate { - ALLEGRO_DISPLAY_IPHONE *d = (ALLEGRO_DISPLAY_IPHONE *)display; + A5O_DISPLAY_IPHONE *d = (A5O_DISPLAY_IPHONE *)display; if (display == NULL) return YES; if (d->extra->adapter != 0) { @@ -61,33 +61,33 @@ - (BOOL)shouldAutorotate - (NSUInteger)supportedInterfaceOrientations { if (!display) return UIInterfaceOrientationMaskAll; - ALLEGRO_DISPLAY_IPHONE *d = (ALLEGRO_DISPLAY_IPHONE *)display; + A5O_DISPLAY_IPHONE *d = (A5O_DISPLAY_IPHONE *)display; if (d->extra->adapter != 0) return UIInterfaceOrientationMaskAll; - ALLEGRO_EXTRA_DISPLAY_SETTINGS *options = &display->extra_settings; - int supported = options->settings[ALLEGRO_SUPPORTED_ORIENTATIONS]; + A5O_EXTRA_DISPLAY_SETTINGS *options = &display->extra_settings; + int supported = options->settings[A5O_SUPPORTED_ORIENTATIONS]; int mask = 0; switch (supported) { default: - case ALLEGRO_DISPLAY_ORIENTATION_ALL: + case A5O_DISPLAY_ORIENTATION_ALL: mask = UIInterfaceOrientationMaskAll; break; - case ALLEGRO_DISPLAY_ORIENTATION_PORTRAIT: + case A5O_DISPLAY_ORIENTATION_PORTRAIT: mask = UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown; break; - case ALLEGRO_DISPLAY_ORIENTATION_LANDSCAPE: + case A5O_DISPLAY_ORIENTATION_LANDSCAPE: mask = UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight; break; - case ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES: + case A5O_DISPLAY_ORIENTATION_0_DEGREES: mask = UIInterfaceOrientationMaskPortrait; break; - case ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES: + case A5O_DISPLAY_ORIENTATION_90_DEGREES: mask = UIInterfaceOrientationMaskLandscapeRight; break; - case ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES: + case A5O_DISPLAY_ORIENTATION_180_DEGREES: mask = UIInterfaceOrientationMaskPortraitUpsideDown; break; - case ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES: + case A5O_DISPLAY_ORIENTATION_270_DEGREES: mask = UIInterfaceOrientationMaskLandscapeLeft; break; } @@ -97,7 +97,7 @@ - (NSUInteger)supportedInterfaceOrientations - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - ALLEGRO_DISPLAY_IPHONE *d = (ALLEGRO_DISPLAY_IPHONE *)display; + A5O_DISPLAY_IPHONE *d = (A5O_DISPLAY_IPHONE *)display; if (display == NULL) return YES; if (d->extra->adapter != 0) { diff --git a/src/iphone/allegroAppDelegate.h b/src/iphone/allegroAppDelegate.h index 424a043998..4fd1ae914c 100644 --- a/src/iphone/allegroAppDelegate.h +++ b/src/iphone/allegroAppDelegate.h @@ -2,7 +2,7 @@ #include #import "ViewController.h" -struct ALLEGRO_DISPLAY_IPHONE_EXTRA { +struct A5O_DISPLAY_IPHONE_EXTRA { bool failed; ViewController *vc; UIWindow *window; @@ -15,7 +15,7 @@ struct ALLEGRO_DISPLAY_IPHONE_EXTRA { @interface allegroAppDelegate : NSObject { @public - ALLEGRO_DISPLAY *main_display; + A5O_DISPLAY *main_display; } + (void)run:(int)argc:(char **)argv; diff --git a/src/iphone/allegroAppDelegate.m b/src/iphone/allegroAppDelegate.m index 003ffe1292..cfbff237e3 100644 --- a/src/iphone/allegroAppDelegate.m +++ b/src/iphone/allegroAppDelegate.m @@ -8,7 +8,7 @@ #include "allegro5/allegro_iphone.h" #include "allegro5/internal/aintern_opengl.h" -ALLEGRO_DEBUG_CHANNEL("iphone") +A5O_DEBUG_CHANNEL("iphone") void _al_iphone_run_user_main(void); @@ -19,7 +19,7 @@ static UIScreen *airplay_screen = NULL; static bool airplay_connected = false; -ALLEGRO_MUTEX *_al_iphone_display_hotplug_mutex = NULL; +A5O_MUTEX *_al_iphone_display_hotplug_mutex = NULL; /* Screen handling */ @interface iphone_screen : NSObject @@ -30,14 +30,14 @@ @interface iphone_screen : NSObject UIWindow *window; ViewController *vc; EAGLView *view; - ALLEGRO_DISPLAY *display; + A5O_DISPLAY *display; } @end @implementation iphone_screen @end -void _al_iphone_disconnect(ALLEGRO_DISPLAY *display) +void _al_iphone_disconnect(A5O_DISPLAY *display) { (void)display; @@ -46,9 +46,9 @@ void _al_iphone_disconnect(ALLEGRO_DISPLAY *display) static NSMutableArray *iphone_screens; -static int iphone_get_adapter(ALLEGRO_DISPLAY *display) +static int iphone_get_adapter(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_IPHONE *d = (ALLEGRO_DISPLAY_IPHONE *)display; + A5O_DISPLAY_IPHONE *d = (A5O_DISPLAY_IPHONE *)display; return d->extra->adapter; } @@ -72,13 +72,13 @@ static int iphone_get_adapter(ALLEGRO_DISPLAY *display) return ret; } -static iphone_screen *iphone_get_screen(ALLEGRO_DISPLAY *display) +static iphone_screen *iphone_get_screen(A5O_DISPLAY *display) { int adapter = iphone_get_adapter(display); return iphone_get_screen_by_adapter(adapter); } -bool _al_iphone_is_display_connected(ALLEGRO_DISPLAY *display) +bool _al_iphone_is_display_connected(A5O_DISPLAY *display) { iphone_screen *scr = iphone_get_screen(display); return scr && (scr->display == display); @@ -103,9 +103,9 @@ static void iphone_remove_screen(UIScreen *screen) al_unlock_mutex(_al_iphone_display_hotplug_mutex); } -void _al_iphone_destroy_screen(ALLEGRO_DISPLAY *display) +void _al_iphone_destroy_screen(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_IPHONE *d = (ALLEGRO_DISPLAY_IPHONE *)display; + A5O_DISPLAY_IPHONE *d = (A5O_DISPLAY_IPHONE *)display; if (d->extra->adapter == 0) { global_delegate->main_display = NULL; @@ -141,7 +141,7 @@ static void iphone_create_screens(void) /* Function: al_iphone_get_window */ -UIWindow *al_iphone_get_window(ALLEGRO_DISPLAY *display) +UIWindow *al_iphone_get_window(A5O_DISPLAY *display) { al_lock_mutex(_al_iphone_display_hotplug_mutex); iphone_screen *scr = iphone_get_screen(display); @@ -155,7 +155,7 @@ static void iphone_create_screens(void) /* Function: al_iphone_get_view */ -UIView *al_iphone_get_view(ALLEGRO_DISPLAY *display) +UIView *al_iphone_get_view(A5O_DISPLAY *display) { iphone_screen *scr = iphone_get_screen(display); if (scr == NULL) { @@ -168,34 +168,34 @@ static int iphone_orientation_to_allegro(UIDeviceOrientation orientation) { switch (orientation) { case UIDeviceOrientationPortrait: - return ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES; + return A5O_DISPLAY_ORIENTATION_0_DEGREES; case UIDeviceOrientationPortraitUpsideDown: - return ALLEGRO_DISPLAY_ORIENTATION_180_DEGREES; + return A5O_DISPLAY_ORIENTATION_180_DEGREES; case UIDeviceOrientationLandscapeRight: - return ALLEGRO_DISPLAY_ORIENTATION_90_DEGREES; + return A5O_DISPLAY_ORIENTATION_90_DEGREES; case UIDeviceOrientationLandscapeLeft: - return ALLEGRO_DISPLAY_ORIENTATION_270_DEGREES; + return A5O_DISPLAY_ORIENTATION_270_DEGREES; case UIDeviceOrientationFaceUp: - return ALLEGRO_DISPLAY_ORIENTATION_FACE_UP; + return A5O_DISPLAY_ORIENTATION_FACE_UP; case UIDeviceOrientationFaceDown: - return ALLEGRO_DISPLAY_ORIENTATION_FACE_DOWN; + return A5O_DISPLAY_ORIENTATION_FACE_DOWN; default: - return ALLEGRO_DISPLAY_ORIENTATION_UNKNOWN; + return A5O_DISPLAY_ORIENTATION_UNKNOWN; } } -static void iphone_send_orientation_event(ALLEGRO_DISPLAY* display, int orientation) +static void iphone_send_orientation_event(A5O_DISPLAY* display, int orientation) { _al_event_source_lock(&display->es); if (_al_event_source_needs_to_generate_event(&display->es)) { - ALLEGRO_EVENT event; - event.display.type = ALLEGRO_EVENT_DISPLAY_ORIENTATION; + A5O_EVENT event; + event.display.type = A5O_EVENT_DISPLAY_ORIENTATION; event.display.timestamp = al_get_time(); event.display.source = display; event.display.orientation = orientation; @@ -205,7 +205,7 @@ static void iphone_send_orientation_event(ALLEGRO_DISPLAY* display, int orientat } -void _al_iphone_acknowledge_drawing_halt(ALLEGRO_DISPLAY *display) +void _al_iphone_acknowledge_drawing_halt(A5O_DISPLAY *display) { (void)display; waiting_for_program_halt = false; @@ -217,23 +217,23 @@ void al_iphone_set_statusbar_orientation(int o) { UIInterfaceOrientation orientation = UIInterfaceOrientationPortrait; - if (o == ALLEGRO_IPHONE_STATUSBAR_ORIENTATION_PORTRAIT) + if (o == A5O_IPHONE_STATUSBAR_ORIENTATION_PORTRAIT) orientation = UIInterfaceOrientationPortrait; - else if (o == ALLEGRO_IPHONE_STATUSBAR_ORIENTATION_PORTRAIT_UPSIDE_DOWN) + else if (o == A5O_IPHONE_STATUSBAR_ORIENTATION_PORTRAIT_UPSIDE_DOWN) orientation = UIInterfaceOrientationPortraitUpsideDown; - else if (o == ALLEGRO_IPHONE_STATUSBAR_ORIENTATION_LANDSCAPE_RIGHT) + else if (o == A5O_IPHONE_STATUSBAR_ORIENTATION_LANDSCAPE_RIGHT) orientation = UIInterfaceOrientationLandscapeRight; - else if (o == ALLEGRO_IPHONE_STATUSBAR_ORIENTATION_LANDSCAPE_LEFT) + else if (o == A5O_IPHONE_STATUSBAR_ORIENTATION_LANDSCAPE_LEFT) orientation = UIInterfaceOrientationLandscapeLeft; [app setStatusBarOrientation:orientation animated:NO]; } -bool _al_iphone_add_view(ALLEGRO_DISPLAY *display) +bool _al_iphone_add_view(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_IPHONE *d = (ALLEGRO_DISPLAY_IPHONE *)display; + A5O_DISPLAY_IPHONE *d = (A5O_DISPLAY_IPHONE *)display; - d->extra = al_calloc(1, sizeof(ALLEGRO_DISPLAY_IPHONE_EXTRA)); + d->extra = al_calloc(1, sizeof(A5O_DISPLAY_IPHONE_EXTRA)); int adapter = al_get_new_display_adapter(); if (adapter < 0) adapter = 0; @@ -272,25 +272,25 @@ bool _al_iphone_add_view(ALLEGRO_DISPLAY *display) * * But to stay compatible with how things worked at first we still support the * 6-orientations way as well - but only if the display has a sole supported - * orientation of ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES. + * orientation of A5O_DISPLAY_ORIENTATION_0_DEGREES. */ - ALLEGRO_EXTRA_DISPLAY_SETTINGS *options = &display->extra_settings; - int supported = options->settings[ALLEGRO_SUPPORTED_ORIENTATIONS]; - if (supported == ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES) { + A5O_EXTRA_DISPLAY_SETTINGS *options = &display->extra_settings; + int supported = options->settings[A5O_SUPPORTED_ORIENTATIONS]; + if (supported == A5O_DISPLAY_ORIENTATION_0_DEGREES) { [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; } return true; } -void _al_iphone_make_view_current(ALLEGRO_DISPLAY *display) +void _al_iphone_make_view_current(A5O_DISPLAY *display) { iphone_screen *scr = iphone_get_screen(display); if (scr) [scr->view make_current]; } -void _al_iphone_recreate_framebuffer(ALLEGRO_DISPLAY *display) +void _al_iphone_recreate_framebuffer(A5O_DISPLAY *display) { iphone_screen *scr = iphone_get_screen(display); if (scr) { @@ -303,14 +303,14 @@ void _al_iphone_recreate_framebuffer(ALLEGRO_DISPLAY *display) } } -void _al_iphone_flip_view(ALLEGRO_DISPLAY *display) +void _al_iphone_flip_view(A5O_DISPLAY *display) { iphone_screen *scr = iphone_get_screen(display); if (scr) [scr->view flip]; } -void _al_iphone_reset_framebuffer(ALLEGRO_DISPLAY *display) +void _al_iphone_reset_framebuffer(A5O_DISPLAY *display) { iphone_screen *scr = iphone_get_screen(display); if (scr) @@ -362,12 +362,12 @@ void _al_iphone_get_screen_size(int adapter, int *w, int *h) } } -int _al_iphone_get_orientation(ALLEGRO_DISPLAY *display) +int _al_iphone_get_orientation(A5O_DISPLAY *display) { if (display) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS *options = &display->extra_settings; - int supported = options->settings[ALLEGRO_SUPPORTED_ORIENTATIONS]; - if (supported != ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES) { + A5O_EXTRA_DISPLAY_SETTINGS *options = &display->extra_settings; + int supported = options->settings[A5O_SUPPORTED_ORIENTATIONS]; + if (supported != A5O_DISPLAY_ORIENTATION_0_DEGREES) { iphone_screen *scr = iphone_get_screen(display); UIInterfaceOrientation o = scr->vc.interfaceOrientation; UIDeviceOrientation od = (int)o; /* They are compatible. */ @@ -380,7 +380,7 @@ int _al_iphone_get_orientation(ALLEGRO_DISPLAY *display) if (NULL != device) return iphone_orientation_to_allegro([device orientation]); else - return ALLEGRO_DISPLAY_ORIENTATION_UNKNOWN; + return A5O_DISPLAY_ORIENTATION_UNKNOWN; } @implementation allegroAppDelegate @@ -402,7 +402,7 @@ - (void)orientation_change:(NSNotification *)notification } - (void)applicationDidFinishLaunching:(UIApplication *)application { - ALLEGRO_INFO("App launched.\n"); + A5O_INFO("App launched.\n"); global_delegate = self; app = application; @@ -424,19 +424,19 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { /* This may never get called on iOS 4 */ - (void)applicationWillTerminate:(UIApplication *)application { (void)application; - ALLEGRO_EVENT event; - ALLEGRO_DISPLAY *d = main_display; - ALLEGRO_SYSTEM_IPHONE *iphone = (void *)al_get_system_driver(); + A5O_EVENT event; + A5O_DISPLAY *d = main_display; + A5O_SYSTEM_IPHONE *iphone = (void *)al_get_system_driver(); iphone->wants_shutdown = true; - ALLEGRO_INFO("Terminating.\n"); + A5O_INFO("Terminating.\n"); [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; _al_event_source_lock(&d->es); if (_al_event_source_needs_to_generate_event(&d->es)) { - event.display.type = ALLEGRO_EVENT_DISPLAY_CLOSE; + event.display.type = A5O_EVENT_DISPLAY_CLOSE; event.display.timestamp = al_get_time(); _al_event_source_emit_event(&d->es, &event); } @@ -450,16 +450,16 @@ - (void)applicationWillTerminate:(UIApplication *)application { } - (void)applicationWillResignActive:(UIApplication *)application { - ALLEGRO_DISPLAY *d = main_display; - ALLEGRO_EVENT event; + A5O_DISPLAY *d = main_display; + A5O_EVENT event; (void)application; - ALLEGRO_INFO("Application becoming inactive.\n"); + A5O_INFO("Application becoming inactive.\n"); _al_event_source_lock(&d->es); if (_al_event_source_needs_to_generate_event(&d->es)) { - event.display.type = ALLEGRO_EVENT_DISPLAY_SWITCH_OUT; + event.display.type = A5O_EVENT_DISPLAY_SWITCH_OUT; event.display.timestamp = al_current_time(); _al_event_source_emit_event(&d->es, &event); } @@ -467,19 +467,19 @@ - (void)applicationWillResignActive:(UIApplication *)application { } - (void)applicationDidBecomeActive:(UIApplication *)application { - ALLEGRO_DISPLAY *d = main_display; - ALLEGRO_EVENT event; + A5O_DISPLAY *d = main_display; + A5O_EVENT event; (void)application; - ALLEGRO_INFO("Application becoming active.\n"); + A5O_INFO("Application becoming active.\n"); if (!d) return; _al_event_source_lock(&d->es); if (_al_event_source_needs_to_generate_event(&d->es)) { - event.display.type = ALLEGRO_EVENT_DISPLAY_SWITCH_IN; + event.display.type = A5O_EVENT_DISPLAY_SWITCH_IN; event.display.timestamp = al_current_time(); _al_event_source_emit_event(&d->es, &event); } @@ -487,18 +487,18 @@ - (void)applicationDidBecomeActive:(UIApplication *)application { } - (void)applicationDidEnterBackground:(UIApplication *)application { - ALLEGRO_DISPLAY *d = main_display; - ALLEGRO_EVENT event; + A5O_DISPLAY *d = main_display; + A5O_EVENT event; (void)application; - ALLEGRO_INFO("Application entering background.\n"); + A5O_INFO("Application entering background.\n"); waiting_for_program_halt = true; _al_event_source_lock(&d->es); if (_al_event_source_needs_to_generate_event(&d->es)) { - event.display.type = ALLEGRO_EVENT_DISPLAY_HALT_DRAWING; + event.display.type = A5O_EVENT_DISPLAY_HALT_DRAWING; event.display.timestamp = al_current_time(); _al_event_source_emit_event(&d->es, &event); } @@ -511,16 +511,16 @@ - (void)applicationDidEnterBackground:(UIApplication *)application { } - (void)applicationWillEnterForeground:(UIApplication *)application { - ALLEGRO_DISPLAY *d = main_display; - ALLEGRO_EVENT event; + A5O_DISPLAY *d = main_display; + A5O_EVENT event; (void)application; - ALLEGRO_INFO("Application coming back to foreground.\n"); + A5O_INFO("Application coming back to foreground.\n"); _al_event_source_lock(&d->es); if (_al_event_source_needs_to_generate_event(&d->es)) { - event.display.type = ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING; + event.display.type = A5O_EVENT_DISPLAY_RESUME_DRAWING; event.display.timestamp = al_current_time(); _al_event_source_emit_event(&d->es, &event); } @@ -531,8 +531,8 @@ - (void)applicationWillEnterForeground:(UIApplication *)application { * it and otherwise things simply don't work (the screen just stays black). */ - (void)add_view:(NSValue *)value { - ALLEGRO_DISPLAY *d = [value pointerValue]; - ALLEGRO_DISPLAY_IPHONE *disp = (ALLEGRO_DISPLAY_IPHONE *)d; + A5O_DISPLAY *d = [value pointerValue]; + A5O_DISPLAY_IPHONE *disp = (A5O_DISPLAY_IPHONE *)d; int adapter = iphone_get_adapter(d); if (adapter == 0) { @@ -590,14 +590,14 @@ - (void)handleScreenConnectNotification:(NSNotification*)aNotification { airplay_screen = [aNotification object]; - ALLEGRO_DISPLAY *display = main_display; + A5O_DISPLAY *display = main_display; if (!display) return; _al_event_source_lock(&display->es); if (_al_event_source_needs_to_generate_event(&display->es)) { - ALLEGRO_EVENT event; - event.display.type = ALLEGRO_EVENT_DISPLAY_CONNECTED; + A5O_EVENT event; + event.display.type = A5O_EVENT_DISPLAY_CONNECTED; event.display.timestamp = al_get_time(); event.display.source = display; _al_event_source_emit_event(&display->es, &event); @@ -607,9 +607,9 @@ - (void)handleScreenConnectNotification:(NSNotification*)aNotification - (void)handleScreenDisconnectNotification:(NSNotification*)aNotification { - ALLEGRO_DISPLAY *display = main_display; - ALLEGRO_DISPLAY_IPHONE *idisplay = (ALLEGRO_DISPLAY_IPHONE *)display; - ALLEGRO_DISPLAY_IPHONE_EXTRA *extra; + A5O_DISPLAY *display = main_display; + A5O_DISPLAY_IPHONE *idisplay = (A5O_DISPLAY_IPHONE *)display; + A5O_DISPLAY_IPHONE_EXTRA *extra; if (!display) return; @@ -620,8 +620,8 @@ - (void)handleScreenDisconnectNotification:(NSNotification*)aNotification _al_event_source_lock(&display->es); if (_al_event_source_needs_to_generate_event(&display->es)) { - ALLEGRO_EVENT event; - event.display.type = ALLEGRO_EVENT_DISPLAY_DISCONNECTED; + A5O_EVENT event; + event.display.type = A5O_EVENT_DISPLAY_DISCONNECTED; event.display.timestamp = al_get_time(); event.display.source = display; _al_event_source_emit_event(&display->es, &event); diff --git a/src/iphone/iphone.h b/src/iphone/iphone.h index ac73302367..9285189c61 100644 --- a/src/iphone/iphone.h +++ b/src/iphone/iphone.h @@ -1,6 +1,6 @@ #ifndef __al_included_iphone_h #define __al_included_iphone_h -void _al_iphone_acknowledge_drawing_halt(ALLEGRO_DISPLAY *display); +void _al_iphone_acknowledge_drawing_halt(A5O_DISPLAY *display); #endif diff --git a/src/iphone/iphone_clipboard.m b/src/iphone/iphone_clipboard.m index 8ab60ef139..06ef9776a5 100644 --- a/src/iphone/iphone_clipboard.m +++ b/src/iphone/iphone_clipboard.m @@ -28,9 +28,9 @@ #include "allegroAppDelegate.h" #include -ALLEGRO_DEBUG_CHANNEL("iphone") +A5O_DEBUG_CHANNEL("iphone") -#ifndef ALLEGRO_IPHONE +#ifndef A5O_IPHONE #error Something is wrong with the makefile #endif @@ -40,7 +40,7 @@ #endif -static char *iphone_get_clipboard_text(ALLEGRO_DISPLAY *display) +static char *iphone_get_clipboard_text(A5O_DISPLAY *display) { const char *utf8; NSString *pbtext; @@ -59,14 +59,14 @@ return text; } -static bool iphone_set_clipboard_text(ALLEGRO_DISPLAY *display, const char *text) +static bool iphone_set_clipboard_text(A5O_DISPLAY *display, const char *text) { NSData *data = [NSData dataWithBytes:text length:strlen(text)]; [[UIPasteboard generalPasteboard] setData:data forPasteboardType:(NSString *)kUTTypeUTF8PlainText]; return true; } -static bool iphone_has_clipboard_text(ALLEGRO_DISPLAY *display) +static bool iphone_has_clipboard_text(A5O_DISPLAY *display) { NSString *pbtext; @@ -75,7 +75,7 @@ static bool iphone_has_clipboard_text(ALLEGRO_DISPLAY *display) return (pbtext != nil); } -void _al_iphone_add_clipboard_functions(ALLEGRO_DISPLAY_INTERFACE *vt) +void _al_iphone_add_clipboard_functions(A5O_DISPLAY_INTERFACE *vt) { vt->set_clipboard_text = iphone_set_clipboard_text; vt->get_clipboard_text = iphone_get_clipboard_text; diff --git a/src/iphone/iphone_display.m b/src/iphone/iphone_display.m index 59f3024d8b..20d88eadab 100644 --- a/src/iphone/iphone_display.m +++ b/src/iphone/iphone_display.m @@ -8,20 +8,20 @@ #include "iphone.h" #include "allegroAppDelegate.h" -ALLEGRO_DEBUG_CHANNEL("iphone") +A5O_DEBUG_CHANNEL("iphone") -static ALLEGRO_DISPLAY_INTERFACE *vt; +static A5O_DISPLAY_INTERFACE *vt; static float _screen_iscale = 1.0; static float _screen_x, _screen_y; static float _screen_w, _screen_h; static bool _screen_hack; -bool _al_iphone_is_display_connected(ALLEGRO_DISPLAY *display); +bool _al_iphone_is_display_connected(A5O_DISPLAY *display); void _al_iphone_connect_airplay(void); -extern ALLEGRO_MUTEX *_al_iphone_display_hotplug_mutex; +extern A5O_MUTEX *_al_iphone_display_hotplug_mutex; -void _al_iphone_setup_opengl_view(ALLEGRO_DISPLAY *d, bool manage_backbuffer) +void _al_iphone_setup_opengl_view(A5O_DISPLAY *d, bool manage_backbuffer) { int w, h; @@ -38,7 +38,7 @@ void _al_iphone_setup_opengl_view(ALLEGRO_DISPLAY *d, bool manage_backbuffer) } } -void _al_iphone_translate_from_screen(ALLEGRO_DISPLAY *d, int *x, int *y) +void _al_iphone_translate_from_screen(A5O_DISPLAY *d, int *x, int *y) { if (!_screen_hack) return; // See _al_iphone_setup_opengl_view @@ -53,51 +53,51 @@ void _al_iphone_translate_from_screen(ALLEGRO_DISPLAY *d, int *x, int *y) } } -void _al_iphone_clip(ALLEGRO_BITMAP const *bitmap, int x_1, int y_1, int x_2, int y_2) +void _al_iphone_clip(A5O_BITMAP const *bitmap, int x_1, int y_1, int x_2, int y_2) { - ALLEGRO_BITMAP *oglb = (void *)(bitmap->parent ? bitmap->parent : bitmap); + A5O_BITMAP *oglb = (void *)(bitmap->parent ? bitmap->parent : bitmap); int h = oglb->h; glScissor(x_1, h - y_2, x_2 - x_1, y_2 - y_1); } -static void set_rgba8888(ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds) +static void set_rgba8888(A5O_EXTRA_DISPLAY_SETTINGS *eds) { - eds->settings[ALLEGRO_RED_SIZE] = 8; - eds->settings[ALLEGRO_GREEN_SIZE] = 8; - eds->settings[ALLEGRO_BLUE_SIZE] = 8; - eds->settings[ALLEGRO_ALPHA_SIZE] = 8; - eds->settings[ALLEGRO_RED_SHIFT] = 0; - eds->settings[ALLEGRO_GREEN_SHIFT] = 8; - eds->settings[ALLEGRO_BLUE_SHIFT] = 16; - eds->settings[ALLEGRO_ALPHA_SHIFT] = 24; - eds->settings[ALLEGRO_COLOR_SIZE] = 32; + eds->settings[A5O_RED_SIZE] = 8; + eds->settings[A5O_GREEN_SIZE] = 8; + eds->settings[A5O_BLUE_SIZE] = 8; + eds->settings[A5O_ALPHA_SIZE] = 8; + eds->settings[A5O_RED_SHIFT] = 0; + eds->settings[A5O_GREEN_SHIFT] = 8; + eds->settings[A5O_BLUE_SHIFT] = 16; + eds->settings[A5O_ALPHA_SHIFT] = 24; + eds->settings[A5O_COLOR_SIZE] = 32; } -static void set_rgb565(ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds) +static void set_rgb565(A5O_EXTRA_DISPLAY_SETTINGS *eds) { - eds->settings[ALLEGRO_RED_SIZE] = 5; - eds->settings[ALLEGRO_GREEN_SIZE] = 6; - eds->settings[ALLEGRO_BLUE_SIZE] = 5; - eds->settings[ALLEGRO_ALPHA_SIZE] = 0; - eds->settings[ALLEGRO_RED_SHIFT] = 0; - eds->settings[ALLEGRO_GREEN_SHIFT] = 5; - eds->settings[ALLEGRO_BLUE_SHIFT] = 11; - eds->settings[ALLEGRO_ALPHA_SHIFT] = 0; - eds->settings[ALLEGRO_COLOR_SIZE] = 16; + eds->settings[A5O_RED_SIZE] = 5; + eds->settings[A5O_GREEN_SIZE] = 6; + eds->settings[A5O_BLUE_SIZE] = 5; + eds->settings[A5O_ALPHA_SIZE] = 0; + eds->settings[A5O_RED_SHIFT] = 0; + eds->settings[A5O_GREEN_SHIFT] = 5; + eds->settings[A5O_BLUE_SHIFT] = 11; + eds->settings[A5O_ALPHA_SHIFT] = 0; + eds->settings[A5O_COLOR_SIZE] = 16; } #define VISUALS_COUNT 6 void _al_iphone_update_visuals(void) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS *ref; - ALLEGRO_SYSTEM_IPHONE *system = (void *)al_get_system_driver(); + A5O_EXTRA_DISPLAY_SETTINGS *ref; + A5O_SYSTEM_IPHONE *system = (void *)al_get_system_driver(); ref = _al_get_new_display_settings(); /* If we aren't called the first time, only updated scores. */ if (system->visuals) { for (int i = 0; i < system->visuals_count; i++) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds = system->visuals[i]; + A5O_EXTRA_DISPLAY_SETTINGS *eds = system->visuals[i]; eds->score = _al_score_display_settings(eds, ref); } return; @@ -107,13 +107,13 @@ void _al_iphone_update_visuals(void) system->visuals_count = VISUALS_COUNT; for (int i = 0; i < VISUALS_COUNT; i++) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds = al_calloc(1, sizeof *eds); - eds->settings[ALLEGRO_RENDER_METHOD] = 1; - eds->settings[ALLEGRO_COMPATIBLE_DISPLAY] = 1; - eds->settings[ALLEGRO_SWAP_METHOD] = 2; - eds->settings[ALLEGRO_VSYNC] = 1; - eds->settings[ALLEGRO_SUPPORTED_ORIENTATIONS] = - ref->settings[ALLEGRO_SUPPORTED_ORIENTATIONS]; + A5O_EXTRA_DISPLAY_SETTINGS *eds = al_calloc(1, sizeof *eds); + eds->settings[A5O_RENDER_METHOD] = 1; + eds->settings[A5O_COMPATIBLE_DISPLAY] = 1; + eds->settings[A5O_SWAP_METHOD] = 2; + eds->settings[A5O_VSYNC] = 1; + eds->settings[A5O_SUPPORTED_ORIENTATIONS] = + ref->settings[A5O_SUPPORTED_ORIENTATIONS]; switch (i) { case 0: set_rgba8888(eds); @@ -123,21 +123,21 @@ void _al_iphone_update_visuals(void) break; case 2: set_rgba8888(eds); - eds->settings[ALLEGRO_DEPTH_SIZE] = 16; + eds->settings[A5O_DEPTH_SIZE] = 16; break; case 3: set_rgb565(eds); - eds->settings[ALLEGRO_DEPTH_SIZE] = 16; + eds->settings[A5O_DEPTH_SIZE] = 16; break; case 4: set_rgba8888(eds); - eds->settings[ALLEGRO_DEPTH_SIZE] = 24; - eds->settings[ALLEGRO_STENCIL_SIZE] = 8; + eds->settings[A5O_DEPTH_SIZE] = 24; + eds->settings[A5O_STENCIL_SIZE] = 8; break; case 5: set_rgb565(eds); - eds->settings[ALLEGRO_DEPTH_SIZE] = 24; - eds->settings[ALLEGRO_STENCIL_SIZE] = 8; + eds->settings[A5O_DEPTH_SIZE] = 24; + eds->settings[A5O_STENCIL_SIZE] = 8; break; } @@ -147,11 +147,11 @@ void _al_iphone_update_visuals(void) } } -static ALLEGRO_DISPLAY *iphone_create_display(int w, int h) +static A5O_DISPLAY *iphone_create_display(int w, int h) { - ALLEGRO_DISPLAY_IPHONE *d = al_calloc(1, sizeof *d); - ALLEGRO_DISPLAY *display = (void*)d; - ALLEGRO_OGL_EXTRAS *ogl = al_calloc(1, sizeof *ogl); + A5O_DISPLAY_IPHONE *d = al_calloc(1, sizeof *d); + A5O_DISPLAY *display = (void*)d; + A5O_OGL_EXTRAS *ogl = al_calloc(1, sizeof *ogl); display->ogl_extras = ogl; display->vt = _al_get_iphone_display_interface(); display->flags = al_get_new_display_flags(); @@ -165,17 +165,17 @@ void _al_iphone_update_visuals(void) _al_iphone_connect_airplay(); } - if (display->flags & ALLEGRO_FULLSCREEN_WINDOW) { + if (display->flags & A5O_FULLSCREEN_WINDOW) { _al_iphone_get_screen_size(adapter, &w, &h); } display->w = w; display->h = h; - ALLEGRO_SYSTEM_IPHONE *system = (void *)al_get_system_driver(); + A5O_SYSTEM_IPHONE *system = (void *)al_get_system_driver(); /* Add ourself to the list of displays. */ - ALLEGRO_DISPLAY_IPHONE **add; + A5O_DISPLAY_IPHONE **add; add = _al_vector_alloc_back(&system->system.displays); *add = d; @@ -184,20 +184,20 @@ void _al_iphone_update_visuals(void) _al_iphone_update_visuals(); - ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds[system->visuals_count]; + A5O_EXTRA_DISPLAY_SETTINGS *eds[system->visuals_count]; memcpy(eds, system->visuals, sizeof(*eds) * system->visuals_count); qsort(eds, system->visuals_count, sizeof(*eds), _al_display_settings_sorter); - ALLEGRO_INFO("Chose visual no. %i\n", eds[0]->index); + A5O_INFO("Chose visual no. %i\n", eds[0]->index); - memcpy(&display->extra_settings, eds[0], sizeof(ALLEGRO_EXTRA_DISPLAY_SETTINGS)); + memcpy(&display->extra_settings, eds[0], sizeof(A5O_EXTRA_DISPLAY_SETTINGS)); - display->flags |= ALLEGRO_OPENGL; -#ifdef ALLEGRO_CFG_OPENGLES2 - display->flags |= ALLEGRO_PROGRAMMABLE_PIPELINE; + display->flags |= A5O_OPENGL; +#ifdef A5O_CFG_OPENGLES2 + display->flags |= A5O_PROGRAMMABLE_PIPELINE; #endif -#ifdef ALLEGRO_CFG_OPENGLES - display->flags |= ALLEGRO_OPENGL_ES_PROFILE; +#ifdef A5O_CFG_OPENGLES + display->flags |= A5O_OPENGL_ES_PROFILE; #endif /* This will add an OpenGL view with an OpenGL context, then return. */ @@ -220,23 +220,23 @@ void _al_iphone_update_visuals(void) /* Fill in opengl version */ const int v = display->ogl_extras->ogl_info.version; - display->extra_settings.settings[ALLEGRO_OPENGL_MAJOR_VERSION] = (v >> 24) & 0xFF; - display->extra_settings.settings[ALLEGRO_OPENGL_MINOR_VERSION] = (v >> 16) & 0xFF; + display->extra_settings.settings[A5O_OPENGL_MAJOR_VERSION] = (v >> 24) & 0xFF; + display->extra_settings.settings[A5O_OPENGL_MINOR_VERSION] = (v >> 16) & 0xFF; return display; } -static void iphone_destroy_display(ALLEGRO_DISPLAY *d) +static void iphone_destroy_display(A5O_DISPLAY *d) { - ALLEGRO_DISPLAY_IPHONE *idisplay = (ALLEGRO_DISPLAY_IPHONE *)d; - ALLEGRO_DISPLAY_IPHONE_EXTRA *extra = idisplay->extra; + A5O_DISPLAY_IPHONE *idisplay = (A5O_DISPLAY_IPHONE *)d; + A5O_DISPLAY_IPHONE_EXTRA *extra = idisplay->extra; bool disconnected = extra->disconnected; _al_set_current_display_only(d); while (d->bitmaps._size > 0) { - ALLEGRO_BITMAP **bptr = (ALLEGRO_BITMAP **)_al_vector_ref_back(&d->bitmaps); - ALLEGRO_BITMAP *b = *bptr; + A5O_BITMAP **bptr = (A5O_BITMAP **)_al_vector_ref_back(&d->bitmaps); + A5O_BITMAP *b = *bptr; _al_convert_to_memory_bitmap(b); } @@ -247,13 +247,13 @@ static void iphone_destroy_display(ALLEGRO_DISPLAY *d) _al_iphone_disconnect(d); } - ALLEGRO_SYSTEM_IPHONE *system = (void *)al_get_system_driver(); + A5O_SYSTEM_IPHONE *system = (void *)al_get_system_driver(); _al_vector_find_and_delete(&system->system.displays, &d); [[UIApplication sharedApplication] setIdleTimerDisabled:FALSE]; } -static bool iphone_set_current_display(ALLEGRO_DISPLAY *d) +static bool iphone_set_current_display(A5O_DISPLAY *d) { (void)d; _al_iphone_make_view_current(d); @@ -261,7 +261,7 @@ static bool iphone_set_current_display(ALLEGRO_DISPLAY *d) return true; } -static int iphone_get_orientation(ALLEGRO_DISPLAY *d) +static int iphone_get_orientation(A5O_DISPLAY *d) { return _al_iphone_get_orientation(d); } @@ -270,8 +270,8 @@ static int iphone_get_orientation(ALLEGRO_DISPLAY *d) /* There can be only one window and only one OpenGL context, so all bitmaps * are compatible. */ -static bool iphone_is_compatible_bitmap(ALLEGRO_DISPLAY *display, - ALLEGRO_BITMAP *bitmap) +static bool iphone_is_compatible_bitmap(A5O_DISPLAY *display, + A5O_BITMAP *bitmap) { (void)display; (void)bitmap; @@ -279,7 +279,7 @@ static bool iphone_is_compatible_bitmap(ALLEGRO_DISPLAY *display, } /* Resizing is not possible. */ -static bool iphone_resize_display(ALLEGRO_DISPLAY *d, int w, int h) +static bool iphone_resize_display(A5O_DISPLAY *d, int w, int h) { (void)d; (void)w; @@ -290,7 +290,7 @@ static bool iphone_resize_display(ALLEGRO_DISPLAY *d, int w, int h) /* The icon must be provided in the Info.plist file, it cannot be changed * at runtime. */ -static void iphone_set_icons(ALLEGRO_DISPLAY *d, int num_icons, ALLEGRO_BITMAP *bitmaps[]) +static void iphone_set_icons(A5O_DISPLAY *d, int num_icons, A5O_BITMAP *bitmaps[]) { (void)d; (void)num_icons; @@ -298,14 +298,14 @@ static void iphone_set_icons(ALLEGRO_DISPLAY *d, int num_icons, ALLEGRO_BITMAP * } /* There is no way to leave fullscreen so no window title is visible. */ -static void iphone_set_window_title(ALLEGRO_DISPLAY *display, char const *title) +static void iphone_set_window_title(A5O_DISPLAY *display, char const *title) { (void)display; (void)title; } /* The window always spans the entire screen right now. */ -static void iphone_set_window_position(ALLEGRO_DISPLAY *display, int x, int y) +static void iphone_set_window_position(A5O_DISPLAY *display, int x, int y) { (void)display; (void)x; @@ -313,7 +313,7 @@ static void iphone_set_window_position(ALLEGRO_DISPLAY *display, int x, int y) } /* The window cannot be constrained. */ -static bool iphone_set_window_constraints(ALLEGRO_DISPLAY *display, +static bool iphone_set_window_constraints(A5O_DISPLAY *display, int min_w, int min_h, int max_w, int max_h) { (void)display; @@ -325,7 +325,7 @@ static bool iphone_set_window_constraints(ALLEGRO_DISPLAY *display, } /* Always fullscreen. */ -static bool iphone_set_display_flag(ALLEGRO_DISPLAY *display, +static bool iphone_set_display_flag(A5O_DISPLAY *display, int flag, bool onoff) { (void)display; @@ -334,7 +334,7 @@ static bool iphone_set_display_flag(ALLEGRO_DISPLAY *display, return false; } -static void iphone_get_window_position(ALLEGRO_DISPLAY *display, int *x, int *y) +static void iphone_get_window_position(A5O_DISPLAY *display, int *x, int *y) { (void)display; *x = 0; @@ -342,7 +342,7 @@ static void iphone_get_window_position(ALLEGRO_DISPLAY *display, int *x, int *y) } /* The window cannot be constrained. */ -static bool iphone_get_window_constraints(ALLEGRO_DISPLAY *display, +static bool iphone_get_window_constraints(A5O_DISPLAY *display, int *min_w, int *min_h, int *max_w, int *max_h) { (void)display; @@ -353,18 +353,18 @@ static bool iphone_get_window_constraints(ALLEGRO_DISPLAY *display, return false; } -static bool iphone_wait_for_vsync(ALLEGRO_DISPLAY *display) +static bool iphone_wait_for_vsync(A5O_DISPLAY *display) { (void)display; return false; } -static void iphone_flip_display(ALLEGRO_DISPLAY *d) +static void iphone_flip_display(A5O_DISPLAY *d) { _al_iphone_flip_view(d); } -static void iphone_update_display_region(ALLEGRO_DISPLAY *d, int x, int y, +static void iphone_update_display_region(A5O_DISPLAY *d, int x, int y, int w, int h) { (void)x; @@ -374,43 +374,43 @@ static void iphone_update_display_region(ALLEGRO_DISPLAY *d, int x, int y, iphone_flip_display(d); } -static bool iphone_acknowledge_resize(ALLEGRO_DISPLAY *d) +static bool iphone_acknowledge_resize(A5O_DISPLAY *d) { _al_iphone_recreate_framebuffer(d); _al_iphone_setup_opengl_view(d, true); return true; } -static bool iphone_set_mouse_cursor(ALLEGRO_DISPLAY *display, - ALLEGRO_MOUSE_CURSOR *cursor) +static bool iphone_set_mouse_cursor(A5O_DISPLAY *display, + A5O_MOUSE_CURSOR *cursor) { (void)display; (void)cursor; return false; } -static bool iphone_set_system_mouse_cursor(ALLEGRO_DISPLAY *display, - ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id) +static bool iphone_set_system_mouse_cursor(A5O_DISPLAY *display, + A5O_SYSTEM_MOUSE_CURSOR cursor_id) { (void)display; (void)cursor_id; return false; } -static bool iphone_show_mouse_cursor(ALLEGRO_DISPLAY *display) +static bool iphone_show_mouse_cursor(A5O_DISPLAY *display) { (void)display; return false; } -static bool iphone_hide_mouse_cursor(ALLEGRO_DISPLAY *display) +static bool iphone_hide_mouse_cursor(A5O_DISPLAY *display) { (void)display; return false; } /* Obtain a reference to this driver. */ -ALLEGRO_DISPLAY_INTERFACE *_al_get_iphone_display_interface(void) +A5O_DISPLAY_INTERFACE *_al_get_iphone_display_interface(void) { if (vt) return vt; diff --git a/src/iphone/iphone_joystick.m b/src/iphone/iphone_joystick.m index 2f142849e6..0bf50c0849 100644 --- a/src/iphone/iphone_joystick.m +++ b/src/iphone/iphone_joystick.m @@ -4,20 +4,20 @@ #include "allegro5/internal/aintern_joystick.h" #include "allegro5/internal/aintern_iphone.h" -ALLEGRO_DEBUG_CHANNEL("iphone") +A5O_DEBUG_CHANNEL("iphone") -typedef struct ALLEGRO_JOYSTICK_IPHONE { - ALLEGRO_JOYSTICK parent; - ALLEGRO_JOYSTICK_STATE joystate; -} ALLEGRO_JOYSTICK_IPHONE; +typedef struct A5O_JOYSTICK_IPHONE { + A5O_JOYSTICK parent; + A5O_JOYSTICK_STATE joystate; +} A5O_JOYSTICK_IPHONE; -static ALLEGRO_JOYSTICK_IPHONE the_joystick; +static A5O_JOYSTICK_IPHONE the_joystick; static bool initialized; static bool ijoy_init_joystick(void) { - ALLEGRO_JOYSTICK_IPHONE *ijoy; - ALLEGRO_JOYSTICK *joy; + A5O_JOYSTICK_IPHONE *ijoy; + A5O_JOYSTICK *joy; ijoy = &the_joystick; @@ -32,7 +32,7 @@ static bool ijoy_init_joystick(void) joy->info.stick[0].axis[0].name = "X"; joy->info.stick[0].axis[1].name = "Y"; joy->info.stick[0].axis[2].name = "Z"; - joy->info.stick[0].flags = ALLEGRO_JOYFLAG_ANALOGUE; + joy->info.stick[0].flags = A5O_JOYFLAG_ANALOGUE; // TODO: What's a good frequency to use here? _al_iphone_accelerometer_control(60); @@ -57,27 +57,27 @@ static int ijoy_num_joysticks(void) return 1; } -static ALLEGRO_JOYSTICK *ijoy_get_joystick(int num) +static A5O_JOYSTICK *ijoy_get_joystick(int num) { if (num != 0) return NULL; - ALLEGRO_DEBUG("Joystick %d acquired.\n", num); + A5O_DEBUG("Joystick %d acquired.\n", num); return &the_joystick.parent; } -static void ijoy_release_joystick(ALLEGRO_JOYSTICK *joy) +static void ijoy_release_joystick(A5O_JOYSTICK *joy) { (void)joy; - ALLEGRO_DEBUG("Joystick released.\n"); + A5O_DEBUG("Joystick released.\n"); initialized = false; } -static void ijoy_get_joystick_state(ALLEGRO_JOYSTICK *joy, ALLEGRO_JOYSTICK_STATE *ret_state) +static void ijoy_get_joystick_state(A5O_JOYSTICK *joy, A5O_JOYSTICK_STATE *ret_state) { - ALLEGRO_JOYSTICK_IPHONE *ijoy = (void *)joy; - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_JOYSTICK_IPHONE *ijoy = (void *)joy; + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); _al_event_source_lock(es); *ret_state = ijoy->joystate; @@ -88,16 +88,16 @@ void _al_iphone_generate_joystick_event(float x, float y, float z) { if (!initialized) return; - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); - ALLEGRO_EVENT event; + A5O_EVENT event; _al_event_source_lock(es); if (_al_event_source_needs_to_generate_event(es)) { float pos[] = {x, y, z}; for (int i = 0; i < 3; i++) { - event.joystick.type = ALLEGRO_EVENT_JOYSTICK_AXIS; + event.joystick.type = A5O_EVENT_JOYSTICK_AXIS; event.joystick.timestamp = al_get_time(); event.joystick.stick = 0; event.joystick.axis = i; @@ -109,19 +109,19 @@ void _al_iphone_generate_joystick_event(float x, float y, float z) _al_event_source_unlock(es); } -static char const *ijoy_get_name(ALLEGRO_JOYSTICK *joy) +static char const *ijoy_get_name(A5O_JOYSTICK *joy) { (void)joy; return "Accelerometer"; } -static bool ijoy_get_active(ALLEGRO_JOYSTICK *joy) +static bool ijoy_get_active(A5O_JOYSTICK *joy) { (void)joy; return true; } -static ALLEGRO_JOYSTICK_DRIVER iphone_joystick_driver = { +static A5O_JOYSTICK_DRIVER iphone_joystick_driver = { AL_ID('I', 'P', 'H', 'O'), "", "", @@ -137,7 +137,7 @@ static bool ijoy_get_active(ALLEGRO_JOYSTICK *joy) ijoy_get_active }; -ALLEGRO_JOYSTICK_DRIVER *_al_get_iphone_joystick_driver(void) +A5O_JOYSTICK_DRIVER *_al_get_iphone_joystick_driver(void) { return &iphone_joystick_driver; } diff --git a/src/iphone/iphone_keyboard.c b/src/iphone/iphone_keyboard.c index 806759729f..95db334901 100644 --- a/src/iphone/iphone_keyboard.c +++ b/src/iphone/iphone_keyboard.c @@ -2,7 +2,7 @@ #include "allegro5/internal/aintern_keyboard.h" #include "allegro5/internal/aintern_events.h" -static ALLEGRO_KEYBOARD the_keyboard; +static A5O_KEYBOARD the_keyboard; static bool iphone_init_keyboard(void) { @@ -17,7 +17,7 @@ static void iphone_exit_keyboard(void) } -static ALLEGRO_KEYBOARD *iphone_get_keyboard(void) +static A5O_KEYBOARD *iphone_get_keyboard(void) { return &the_keyboard; } @@ -34,7 +34,7 @@ static char const *iphone_keycode_to_name(int keycode) return "none"; } -static void iphone_get_keyboard_state(ALLEGRO_KEYBOARD_STATE *ret_state) +static void iphone_get_keyboard_state(A5O_KEYBOARD_STATE *ret_state) { memset(ret_state, 0, sizeof *ret_state); } @@ -44,7 +44,7 @@ static void iphone_clear_keyboard_state(void) return; } -static ALLEGRO_KEYBOARD_DRIVER iphone_keyboard_driver = { +static A5O_KEYBOARD_DRIVER iphone_keyboard_driver = { AL_ID('I','P','H','O'), "", "", @@ -58,7 +58,7 @@ static ALLEGRO_KEYBOARD_DRIVER iphone_keyboard_driver = { iphone_clear_keyboard_state }; -ALLEGRO_KEYBOARD_DRIVER *_al_get_iphone_keyboard_driver(void) +A5O_KEYBOARD_DRIVER *_al_get_iphone_keyboard_driver(void) { return &iphone_keyboard_driver; } diff --git a/src/iphone/iphone_main.m b/src/iphone/iphone_main.m index 204fb7f432..dd5fa5fcd6 100644 --- a/src/iphone/iphone_main.m +++ b/src/iphone/iphone_main.m @@ -4,7 +4,7 @@ #include #include -ALLEGRO_DEBUG_CHANNEL("iphone") +A5O_DEBUG_CHANNEL("iphone") /* Not that there could ever be any arguments on iphone... */ static int global_argc; @@ -12,13 +12,13 @@ extern int _al_mangled_main(int, char **); /* We run the user's "main" in its own thread. */ -static void *user_main(ALLEGRO_THREAD *thread, void *arg) +static void *user_main(A5O_THREAD *thread, void *arg) { (void)thread; - ALLEGRO_INFO("Starting user main.\n"); + A5O_INFO("Starting user main.\n"); _al_mangled_main(global_argc, global_argv); - ALLEGRO_INFO("User main has returned.\n"); - ALLEGRO_SYSTEM_IPHONE *iphone = (void *)al_get_system_driver(); + A5O_INFO("User main has returned.\n"); + A5O_SYSTEM_IPHONE *iphone = (void *)al_get_system_driver(); al_lock_mutex(iphone->mutex); iphone->has_shutdown = true; al_signal_cond(iphone->cond); @@ -41,7 +41,7 @@ */ void _al_iphone_run_user_main(void) { - ALLEGRO_THREAD *thread = al_create_thread(user_main, NULL); + A5O_THREAD *thread = al_create_thread(user_main, NULL); al_start_thread(thread); } diff --git a/src/iphone/iphone_mouse.m b/src/iphone/iphone_mouse.m index de29ff56c8..d4ef4e96d3 100644 --- a/src/iphone/iphone_mouse.m +++ b/src/iphone/iphone_mouse.m @@ -3,12 +3,12 @@ #include "allegro5/internal/aintern_display.h" #include "allegro5/internal/aintern_iphone.h" -typedef struct ALLEGRO_MOUSE_IPHONE { - ALLEGRO_MOUSE parent; - ALLEGRO_MOUSE_STATE state; -} ALLEGRO_MOUSE_IPHONE; +typedef struct A5O_MOUSE_IPHONE { + A5O_MOUSE parent; + A5O_MOUSE_STATE state; +} A5O_MOUSE_IPHONE; -static ALLEGRO_MOUSE_IPHONE the_mouse; +static A5O_MOUSE_IPHONE the_mouse; static bool imouse_installed; @@ -16,9 +16,9 @@ * Helper to generate a mouse event. */ void _al_iphone_generate_mouse_event(unsigned int type, int x, int y, - unsigned int button, ALLEGRO_DISPLAY *d) + unsigned int button, A5O_DISPLAY *d) { - ALLEGRO_EVENT event; + A5O_EVENT event; _al_event_source_lock(&the_mouse.parent.es); @@ -27,10 +27,10 @@ void _al_iphone_generate_mouse_event(unsigned int type, int x, int y, the_mouse.state.x = x; the_mouse.state.y = y; - if (type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN) { + if (type == A5O_EVENT_MOUSE_BUTTON_DOWN) { the_mouse.state.buttons |= (1 << button); } - else if (type == ALLEGRO_EVENT_MOUSE_BUTTON_UP) { + else if (type == A5O_EVENT_MOUSE_BUTTON_UP) { the_mouse.state.buttons &= ~(1 << button); } @@ -75,10 +75,10 @@ static void imouse_exit(void) _al_event_source_free(&the_mouse.parent.es); } -static ALLEGRO_MOUSE *imouse_get_mouse(void) +static A5O_MOUSE *imouse_get_mouse(void) { ASSERT(imouse_installed); - return (ALLEGRO_MOUSE *)&the_mouse; + return (A5O_MOUSE *)&the_mouse; } /* We report multi-touch as different buttons. */ @@ -93,7 +93,7 @@ static unsigned int imouse_get_mouse_num_axes(void) } /* Hard to accomplish on a touch screen. */ -static bool imouse_set_mouse_xy(ALLEGRO_DISPLAY *display, int x, int y) +static bool imouse_set_mouse_xy(A5O_DISPLAY *display, int x, int y) { (void)display; (void)x; @@ -109,7 +109,7 @@ static bool imouse_set_mouse_axis(int which, int z) } /* -static void imouse_get_state(ALLEGRO_MOUSE_STATE *ret_state) +static void imouse_get_state(A5O_MOUSE_STATE *ret_state) { ASSERT(imouse_installed); @@ -120,9 +120,9 @@ static void imouse_get_state(ALLEGRO_MOUSE_STATE *ret_state) _al_event_source_unlock(&the_mouse.parent.es); } */ -void imouse_get_state(ALLEGRO_MOUSE_STATE *ret_state); +void imouse_get_state(A5O_MOUSE_STATE *ret_state); -static ALLEGRO_MOUSE_DRIVER iphone_mouse_driver = { +static A5O_MOUSE_DRIVER iphone_mouse_driver = { AL_ID('I', 'P', 'H', 'O'), "", "", @@ -137,7 +137,7 @@ static void imouse_get_state(ALLEGRO_MOUSE_STATE *ret_state) imouse_get_state }; -ALLEGRO_MOUSE_DRIVER *_al_get_iphone_mouse_driver(void) +A5O_MOUSE_DRIVER *_al_get_iphone_mouse_driver(void) { return &iphone_mouse_driver; } diff --git a/src/iphone/iphone_path.m b/src/iphone/iphone_path.m index 421cf73cd8..f835a33181 100644 --- a/src/iphone/iphone_path.m +++ b/src/iphone/iphone_path.m @@ -2,7 +2,7 @@ #include #include -ALLEGRO_PATH *_al_iphone_get_path(int id) +A5O_PATH *_al_iphone_get_path(int id) { char str[PATH_MAX]; NSString *string; @@ -12,18 +12,18 @@ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; switch (id) { - case ALLEGRO_USER_HOME_PATH: + case A5O_USER_HOME_PATH: string = NSHomeDirectory(); break; - case ALLEGRO_TEMP_PATH: + case A5O_TEMP_PATH: string = NSTemporaryDirectory(); break; - case ALLEGRO_RESOURCES_PATH: + case A5O_RESOURCES_PATH: mainBundle = [NSBundle mainBundle]; string = [mainBundle resourcePath]; break; - case ALLEGRO_USER_SETTINGS_PATH: - case ALLEGRO_USER_DATA_PATH: + case A5O_USER_SETTINGS_PATH: + case A5O_USER_DATA_PATH: array = NSSearchPathForDirectoriesInDomains( NSApplicationSupportDirectory, NSUserDomainMask, @@ -31,14 +31,14 @@ string = (NSString *)[array objectAtIndex:0]; break; - case ALLEGRO_USER_DOCUMENTS_PATH: + case A5O_USER_DOCUMENTS_PATH: array = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, TRUE); string = (NSString *)[array objectAtIndex:0]; break; - case ALLEGRO_EXENAME_PATH: { + case A5O_EXENAME_PATH: { uint32_t size = sizeof(str); if (_NSGetExecutablePath(str, &size) != 0) { [pool drain]; diff --git a/src/iphone/iphone_system.c b/src/iphone/iphone_system.c index e1fd1f7dfe..a4d5fd322a 100644 --- a/src/iphone/iphone_system.c +++ b/src/iphone/iphone_system.c @@ -2,25 +2,25 @@ #include #include -ALLEGRO_DEBUG_CHANNEL("iphone") +A5O_DEBUG_CHANNEL("iphone") -ALLEGRO_SYSTEM_IPHONE *iphone; -static ALLEGRO_SYSTEM_INTERFACE *vt; +A5O_SYSTEM_IPHONE *iphone; +static A5O_SYSTEM_INTERFACE *vt; -extern ALLEGRO_MUTEX *_al_iphone_display_hotplug_mutex; +extern A5O_MUTEX *_al_iphone_display_hotplug_mutex; /* al_init will call this. */ -ALLEGRO_SYSTEM *iphone_initialize(int flags) +A5O_SYSTEM *iphone_initialize(int flags) { (void)flags; iphone = al_calloc(1, sizeof *iphone); - ALLEGRO_SYSTEM *sys = &iphone->system; + A5O_SYSTEM *sys = &iphone->system; iphone->mutex = al_create_mutex(); iphone->cond = al_create_cond(); sys->vt = _al_get_iphone_system_interface(); - _al_vector_init(&sys->displays, sizeof (ALLEGRO_DISPLAY_IPHONE *)); + _al_vector_init(&sys->displays, sizeof (A5O_DISPLAY_IPHONE *)); _al_unix_init_time(); _al_iphone_init_path(); @@ -38,7 +38,7 @@ static void iphone_shutdown_system(void) */ void _al_iphone_await_termination(void) { - ALLEGRO_INFO("Application awaiting termination.\n"); + A5O_INFO("Application awaiting termination.\n"); al_lock_mutex(iphone->mutex); while (!iphone->has_shutdown) { al_wait_cond(iphone->cond, iphone->mutex); @@ -46,7 +46,7 @@ void _al_iphone_await_termination(void) al_unlock_mutex(iphone->mutex); } -static ALLEGRO_DISPLAY_INTERFACE *iphone_get_display_driver(void) +static A5O_DISPLAY_INTERFACE *iphone_get_display_driver(void) { return _al_get_iphone_display_interface(); } @@ -56,7 +56,7 @@ static int iphone_get_num_video_adapters(void) return _al_iphone_get_num_video_adapters(); } -static bool iphone_get_monitor_info(int adapter, ALLEGRO_MONITOR_INFO *info) +static bool iphone_get_monitor_info(int adapter, A5O_MONITOR_INFO *info) { int w, h; _al_iphone_get_screen_size(adapter, &w, &h); @@ -75,14 +75,14 @@ static bool iphone_get_cursor_position(int *ret_x, int *ret_y) return false; } -ALLEGRO_SYSTEM_INTERFACE *_al_get_iphone_system_interface(void) +A5O_SYSTEM_INTERFACE *_al_get_iphone_system_interface(void) { if (vt) return vt; vt = al_calloc(1, sizeof *vt); - vt->id = ALLEGRO_SYSTEM_ID_IPHONE; + vt->id = A5O_SYSTEM_ID_IPHONE; vt->initialize = iphone_initialize; vt->get_display_driver = iphone_get_display_driver; vt->get_keyboard_driver = _al_get_iphone_keyboard_driver; @@ -107,7 +107,7 @@ ALLEGRO_SYSTEM_INTERFACE *_al_get_iphone_system_interface(void) */ void _al_register_system_interfaces(void) { - ALLEGRO_SYSTEM_INTERFACE **add; + A5O_SYSTEM_INTERFACE **add; add = _al_vector_alloc_back(&_al_system_interfaces); *add = _al_get_iphone_system_interface(); diff --git a/src/iphone/iphone_touch_input.m b/src/iphone/iphone_touch_input.m index e57826a100..01d60f8d07 100644 --- a/src/iphone/iphone_touch_input.m +++ b/src/iphone/iphone_touch_input.m @@ -20,30 +20,30 @@ #include "allegro5/internal/aintern_iphone.h" -static ALLEGRO_TOUCH_INPUT_STATE touch_input_state; -static ALLEGRO_MOUSE_STATE mouse_state; -static ALLEGRO_TOUCH_INPUT touch_input; +static A5O_TOUCH_INPUT_STATE touch_input_state; +static A5O_MOUSE_STATE mouse_state; +static A5O_TOUCH_INPUT touch_input; static bool installed = false; -static void generate_touch_input_event(unsigned int type, double timestamp, int id, float x, float y, float dx, float dy, bool primary, ALLEGRO_DISPLAY *disp) +static void generate_touch_input_event(unsigned int type, double timestamp, int id, float x, float y, float dx, float dy, bool primary, A5O_DISPLAY *disp) { - ALLEGRO_EVENT event; + A5O_EVENT event; bool want_touch_event = _al_event_source_needs_to_generate_event(&touch_input.es); bool want_mouse_emulation_event; - if (touch_input.mouse_emulation_mode == ALLEGRO_MOUSE_EMULATION_5_0_x) { + if (touch_input.mouse_emulation_mode == A5O_MOUSE_EMULATION_5_0_x) { want_mouse_emulation_event = _al_event_source_needs_to_generate_event(&touch_input.mouse_emulation_es) && al_is_mouse_installed(); } else { want_mouse_emulation_event = _al_event_source_needs_to_generate_event(&touch_input.mouse_emulation_es) && primary && al_is_mouse_installed(); } - if (touch_input.mouse_emulation_mode == ALLEGRO_MOUSE_EMULATION_NONE) + if (touch_input.mouse_emulation_mode == A5O_MOUSE_EMULATION_NONE) want_mouse_emulation_event = false; - else if (touch_input.mouse_emulation_mode == ALLEGRO_MOUSE_EMULATION_INCLUSIVE) + else if (touch_input.mouse_emulation_mode == A5O_MOUSE_EMULATION_INCLUSIVE) want_touch_event = al_is_mouse_installed() ? (want_touch_event && !primary) : want_touch_event; - else if (touch_input.mouse_emulation_mode == ALLEGRO_MOUSE_EMULATION_EXCLUSIVE) + else if (touch_input.mouse_emulation_mode == A5O_MOUSE_EMULATION_EXCLUSIVE) want_touch_event = al_is_mouse_installed() ? false : want_touch_event; @@ -53,7 +53,7 @@ static void generate_touch_input_event(unsigned int type, double timestamp, int if (want_touch_event) { event.touch.type = type; - event.touch.display = (ALLEGRO_DISPLAY*)disp; + event.touch.display = (A5O_DISPLAY*)disp; event.touch.timestamp = timestamp; event.touch.id = id; event.touch.x = x; @@ -67,27 +67,27 @@ static void generate_touch_input_event(unsigned int type, double timestamp, int _al_event_source_unlock(&touch_input.es); } - if (touch_input.mouse_emulation_mode != ALLEGRO_MOUSE_EMULATION_NONE) { + if (touch_input.mouse_emulation_mode != A5O_MOUSE_EMULATION_NONE) { _al_event_source_lock(&touch_input.mouse_emulation_es); if (want_mouse_emulation_event) { switch (type) { - case ALLEGRO_EVENT_TOUCH_BEGIN: type = ALLEGRO_EVENT_MOUSE_BUTTON_DOWN; break; - case ALLEGRO_EVENT_TOUCH_CANCEL: - case ALLEGRO_EVENT_TOUCH_END: type = ALLEGRO_EVENT_MOUSE_BUTTON_UP; break; - case ALLEGRO_EVENT_TOUCH_MOVE: type = ALLEGRO_EVENT_MOUSE_AXES; break; + case A5O_EVENT_TOUCH_BEGIN: type = A5O_EVENT_MOUSE_BUTTON_DOWN; break; + case A5O_EVENT_TOUCH_CANCEL: + case A5O_EVENT_TOUCH_END: type = A5O_EVENT_MOUSE_BUTTON_UP; break; + case A5O_EVENT_TOUCH_MOVE: type = A5O_EVENT_MOUSE_AXES; break; } event.mouse.type = type; event.mouse.timestamp = timestamp; - event.mouse.display = (ALLEGRO_DISPLAY*)disp; + event.mouse.display = (A5O_DISPLAY*)disp; event.mouse.x = (int)x; event.mouse.y = (int)y; event.mouse.dx = (int)dx; event.mouse.dy = (int)dy; event.mouse.dz = 0; event.mouse.dw = 0; - if (touch_input.mouse_emulation_mode != ALLEGRO_MOUSE_EMULATION_5_0_x) { + if (touch_input.mouse_emulation_mode != A5O_MOUSE_EMULATION_5_0_x) { event.mouse.button = 1; } else { @@ -95,7 +95,7 @@ static void generate_touch_input_event(unsigned int type, double timestamp, int } event.mouse.pressure = 1.0; - if (touch_input.mouse_emulation_mode != ALLEGRO_MOUSE_EMULATION_5_0_x) { + if (touch_input.mouse_emulation_mode != A5O_MOUSE_EMULATION_5_0_x) { al_set_mouse_xy(event.mouse.display, event.mouse.x, event.mouse.y); } @@ -104,9 +104,9 @@ static void generate_touch_input_event(unsigned int type, double timestamp, int mouse_state.x = (int)x; mouse_state.y = (int)y; - if (type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN) + if (type == A5O_EVENT_MOUSE_BUTTON_DOWN) mouse_state.buttons |= id; - else if (type == ALLEGRO_EVENT_MOUSE_BUTTON_UP) + else if (type == A5O_EVENT_MOUSE_BUTTON_UP) mouse_state.buttons &= ~id; _al_event_source_unlock(&touch_input.mouse_emulation_es); @@ -124,7 +124,7 @@ static bool init_touch_input(void) _al_event_source_init(&touch_input.es); _al_event_source_init(&touch_input.mouse_emulation_es); - touch_input.mouse_emulation_mode = ALLEGRO_MOUSE_EMULATION_TRANSPARENT; + touch_input.mouse_emulation_mode = A5O_MOUSE_EMULATION_TRANSPARENT; installed = true; @@ -147,13 +147,13 @@ static void exit_touch_input(void) } -static ALLEGRO_TOUCH_INPUT* get_touch_input(void) +static A5O_TOUCH_INPUT* get_touch_input(void) { return &touch_input; } -static void get_touch_input_state(ALLEGRO_TOUCH_INPUT_STATE *ret_state) +static void get_touch_input_state(A5O_TOUCH_INPUT_STATE *ret_state) { _al_event_source_lock(&touch_input.es); *ret_state = touch_input_state; @@ -167,9 +167,9 @@ static void set_mouse_emulation_mode(int mode) int i; - for (i = 0; i < ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) { + for (i = 0; i < A5O_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) { - ALLEGRO_TOUCH_STATE* touch = touch_input_state.touches + i; + A5O_TOUCH_STATE* touch = touch_input_state.touches + i; if (touch->id > 0) { _al_iphone_touch_input_handle_cancel(touch->id, al_get_time(), @@ -182,11 +182,11 @@ static void set_mouse_emulation_mode(int mode) } -static ALLEGRO_TOUCH_STATE* find_free_touch_state() +static A5O_TOUCH_STATE* find_free_touch_state() { int i; - for (i = 0; i < ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) + for (i = 0; i < A5O_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) if (touch_input_state.touches[i].id <= 0) return touch_input_state.touches + i; @@ -194,11 +194,11 @@ static void set_mouse_emulation_mode(int mode) } -static ALLEGRO_TOUCH_STATE* find_touch_state_with_id(int id) +static A5O_TOUCH_STATE* find_touch_state_with_id(int id) { int i; - for (i = 0; i < ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) + for (i = 0; i < A5O_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) if (touch_input_state.touches[i].id == id) return touch_input_state.touches + i; @@ -207,9 +207,9 @@ static void set_mouse_emulation_mode(int mode) -void _al_iphone_touch_input_handle_begin(int id, double timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY *disp) +void _al_iphone_touch_input_handle_begin(int id, double timestamp, float x, float y, bool primary, A5O_DISPLAY *disp) { - ALLEGRO_TOUCH_STATE* state = find_free_touch_state(); + A5O_TOUCH_STATE* state = find_free_touch_state(); (void)primary; if (NULL == state) @@ -225,14 +225,14 @@ void _al_iphone_touch_input_handle_begin(int id, double timestamp, float x, floa state->display = disp; _al_event_source_unlock(&touch_input.es); - generate_touch_input_event(ALLEGRO_EVENT_TOUCH_BEGIN, timestamp, + generate_touch_input_event(A5O_EVENT_TOUCH_BEGIN, timestamp, state->id, state->x, state->y, state->dx, state->dy, state->primary, disp); } -void _al_iphone_touch_input_handle_end(int id, double timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY *disp) +void _al_iphone_touch_input_handle_end(int id, double timestamp, float x, float y, bool primary, A5O_DISPLAY *disp) { - ALLEGRO_TOUCH_STATE* state = find_touch_state_with_id(id); + A5O_TOUCH_STATE* state = find_touch_state_with_id(id); (void)primary; if (NULL == state) @@ -245,18 +245,18 @@ void _al_iphone_touch_input_handle_end(int id, double timestamp, float x, float state->y = y; _al_event_source_unlock(&touch_input.es); - generate_touch_input_event(ALLEGRO_EVENT_TOUCH_END, timestamp, + generate_touch_input_event(A5O_EVENT_TOUCH_END, timestamp, state->id, state->x, state->y, state->dx, state->dy, state->primary, disp); _al_event_source_lock(&touch_input.es); - memset(state, 0, sizeof(ALLEGRO_TOUCH_STATE)); + memset(state, 0, sizeof(A5O_TOUCH_STATE)); _al_event_source_unlock(&touch_input.es); } -void _al_iphone_touch_input_handle_move(int id, double timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY *disp) +void _al_iphone_touch_input_handle_move(int id, double timestamp, float x, float y, bool primary, A5O_DISPLAY *disp) { - ALLEGRO_TOUCH_STATE* state = find_touch_state_with_id(id); + A5O_TOUCH_STATE* state = find_touch_state_with_id(id); (void)primary; if (NULL == state) @@ -269,14 +269,14 @@ void _al_iphone_touch_input_handle_move(int id, double timestamp, float x, float state->y = y; _al_event_source_unlock(&touch_input.es); - generate_touch_input_event(ALLEGRO_EVENT_TOUCH_MOVE, timestamp, + generate_touch_input_event(A5O_EVENT_TOUCH_MOVE, timestamp, state->id, state->x, state->y, state->dx, state->dy, state->primary, disp); } -void _al_iphone_touch_input_handle_cancel(int id, double timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY *disp) +void _al_iphone_touch_input_handle_cancel(int id, double timestamp, float x, float y, bool primary, A5O_DISPLAY *disp) { - ALLEGRO_TOUCH_STATE* state = find_touch_state_with_id(id); + A5O_TOUCH_STATE* state = find_touch_state_with_id(id); (void)primary; if (NULL == state) @@ -289,11 +289,11 @@ void _al_iphone_touch_input_handle_cancel(int id, double timestamp, float x, flo state->y = y; _al_event_source_unlock(&touch_input.es); - generate_touch_input_event(ALLEGRO_EVENT_TOUCH_CANCEL, timestamp, + generate_touch_input_event(A5O_EVENT_TOUCH_CANCEL, timestamp, state->id, state->x, state->y, state->dx, state->dy, state->primary, disp); _al_event_source_lock(&touch_input.es); - memset(state, 0, sizeof(ALLEGRO_TOUCH_STATE)); + memset(state, 0, sizeof(A5O_TOUCH_STATE)); _al_event_source_unlock(&touch_input.es); } @@ -301,7 +301,7 @@ void _al_iphone_touch_input_handle_cancel(int id, double timestamp, float x, flo /* the driver vtable */ #define TOUCH_INPUT_IPHONE AL_ID('I','T','I','D') -static ALLEGRO_TOUCH_INPUT_DRIVER touch_input_driver = +static A5O_TOUCH_INPUT_DRIVER touch_input_driver = { TOUCH_INPUT_IPHONE, init_touch_input, @@ -312,12 +312,12 @@ void _al_iphone_touch_input_handle_cancel(int id, double timestamp, float x, flo NULL }; -ALLEGRO_TOUCH_INPUT_DRIVER *_al_get_iphone_touch_input_driver(void) +A5O_TOUCH_INPUT_DRIVER *_al_get_iphone_touch_input_driver(void) { return &touch_input_driver; } -void imouse_get_state(ALLEGRO_MOUSE_STATE *ret_state) +void imouse_get_state(A5O_MOUSE_STATE *ret_state) { _al_event_source_lock(&touch_input.es); *ret_state = mouse_state; diff --git a/src/joynu.c b/src/joynu.c index a381f46281..32cde14ea8 100644 --- a/src/joynu.c +++ b/src/joynu.c @@ -19,7 +19,7 @@ */ -#define ALLEGRO_NO_COMPATIBILITY +#define A5O_NO_COMPATIBILITY #include @@ -33,16 +33,16 @@ /* the active joystick driver */ -static ALLEGRO_JOYSTICK_DRIVER *new_joystick_driver = NULL; -static ALLEGRO_EVENT_SOURCE es; +static A5O_JOYSTICK_DRIVER *new_joystick_driver = NULL; +static A5O_EVENT_SOURCE es; /* Function: al_install_joystick */ bool al_install_joystick(void) { - ALLEGRO_SYSTEM *sysdrv; - ALLEGRO_JOYSTICK_DRIVER *joydrv; + A5O_SYSTEM *sysdrv; + A5O_JOYSTICK_DRIVER *joydrv; if (new_joystick_driver) return true; @@ -113,7 +113,7 @@ bool al_reconfigure_joysticks(void) /* Function: al_get_joystick_event_source */ -ALLEGRO_EVENT_SOURCE *al_get_joystick_event_source(void) +A5O_EVENT_SOURCE *al_get_joystick_event_source(void) { if (!new_joystick_driver) return NULL; @@ -122,7 +122,7 @@ ALLEGRO_EVENT_SOURCE *al_get_joystick_event_source(void) -void _al_generate_joystick_event(ALLEGRO_EVENT *event) +void _al_generate_joystick_event(A5O_EVENT *event) { ASSERT(new_joystick_driver); @@ -149,7 +149,7 @@ int al_get_num_joysticks(void) /* Function: al_get_joystick */ -ALLEGRO_JOYSTICK * al_get_joystick(int num) +A5O_JOYSTICK * al_get_joystick(int num) { ASSERT(new_joystick_driver); ASSERT(num >= 0); @@ -161,7 +161,7 @@ ALLEGRO_JOYSTICK * al_get_joystick(int num) /* Function: al_release_joystick */ -void al_release_joystick(ALLEGRO_JOYSTICK *joy) +void al_release_joystick(A5O_JOYSTICK *joy) { ASSERT(new_joystick_driver); ASSERT(joy); @@ -173,7 +173,7 @@ void al_release_joystick(ALLEGRO_JOYSTICK *joy) /* Function: al_get_joystick_active */ -bool al_get_joystick_active(ALLEGRO_JOYSTICK *joy) +bool al_get_joystick_active(A5O_JOYSTICK *joy) { ASSERT(joy); @@ -184,7 +184,7 @@ bool al_get_joystick_active(ALLEGRO_JOYSTICK *joy) /* Function: al_get_joystick_name */ -const char *al_get_joystick_name(ALLEGRO_JOYSTICK *joy) +const char *al_get_joystick_name(A5O_JOYSTICK *joy) { ASSERT(joy); @@ -195,7 +195,7 @@ const char *al_get_joystick_name(ALLEGRO_JOYSTICK *joy) /* Function: al_get_joystick_num_sticks */ -int al_get_joystick_num_sticks(ALLEGRO_JOYSTICK *joy) +int al_get_joystick_num_sticks(A5O_JOYSTICK *joy) { ASSERT(joy); @@ -206,7 +206,7 @@ int al_get_joystick_num_sticks(ALLEGRO_JOYSTICK *joy) /* Function: al_get_joystick_stick_flags */ -int al_get_joystick_stick_flags(ALLEGRO_JOYSTICK *joy, int stick) +int al_get_joystick_stick_flags(A5O_JOYSTICK *joy, int stick) { ASSERT(joy); ASSERT(stick >= 0); @@ -221,7 +221,7 @@ int al_get_joystick_stick_flags(ALLEGRO_JOYSTICK *joy, int stick) /* Function: al_get_joystick_stick_name */ -const char *al_get_joystick_stick_name(ALLEGRO_JOYSTICK *joy, int stick) +const char *al_get_joystick_stick_name(A5O_JOYSTICK *joy, int stick) { ASSERT(joy); ASSERT(stick >= 0); @@ -236,7 +236,7 @@ const char *al_get_joystick_stick_name(ALLEGRO_JOYSTICK *joy, int stick) /* Function: al_get_joystick_num_axes */ -int al_get_joystick_num_axes(ALLEGRO_JOYSTICK *joy, int stick) +int al_get_joystick_num_axes(A5O_JOYSTICK *joy, int stick) { ASSERT(joy); @@ -250,7 +250,7 @@ int al_get_joystick_num_axes(ALLEGRO_JOYSTICK *joy, int stick) /* Function: al_get_joystick_axis_name */ -const char *al_get_joystick_axis_name(ALLEGRO_JOYSTICK *joy, int stick, int axis) +const char *al_get_joystick_axis_name(A5O_JOYSTICK *joy, int stick, int axis) { ASSERT(joy); ASSERT(stick >= 0); @@ -267,7 +267,7 @@ const char *al_get_joystick_axis_name(ALLEGRO_JOYSTICK *joy, int stick, int axis /* Function: al_get_joystick_num_buttons */ -int al_get_joystick_num_buttons(ALLEGRO_JOYSTICK *joy) +int al_get_joystick_num_buttons(A5O_JOYSTICK *joy) { ASSERT(joy); @@ -278,7 +278,7 @@ int al_get_joystick_num_buttons(ALLEGRO_JOYSTICK *joy) /* Function: al_get_joystick_button_name */ -const char *al_get_joystick_button_name(ALLEGRO_JOYSTICK *joy, int button) +const char *al_get_joystick_button_name(A5O_JOYSTICK *joy, int button) { ASSERT(joy); ASSERT(button >= 0); @@ -293,7 +293,7 @@ const char *al_get_joystick_button_name(ALLEGRO_JOYSTICK *joy, int button) /* Function: al_get_joystick_state */ -void al_get_joystick_state(ALLEGRO_JOYSTICK *joy, ALLEGRO_JOYSTICK_STATE *ret_state) +void al_get_joystick_state(A5O_JOYSTICK *joy, A5O_JOYSTICK_STATE *ret_state) { ASSERT(new_joystick_driver); ASSERT(joy); @@ -306,7 +306,7 @@ void al_get_joystick_state(ALLEGRO_JOYSTICK *joy, ALLEGRO_JOYSTICK_STATE *ret_st uint32_t _al_get_joystick_compat_version(void) { - ALLEGRO_CONFIG *system_config = al_get_system_config(); + A5O_CONFIG *system_config = al_get_system_config(); const char* compat_version = al_get_config_value(system_config, "compatibility", "joystick_version"); if (!compat_version || strlen(compat_version) == 0) return al_get_allegro_version(); diff --git a/src/keybdnu.c b/src/keybdnu.c index 9d3e1fb73a..2ffe13c11b 100644 --- a/src/keybdnu.c +++ b/src/keybdnu.c @@ -19,7 +19,7 @@ */ -#define ALLEGRO_NO_COMPATIBILITY +#define A5O_NO_COMPATIBILITY #include "allegro5/allegro.h" #include "allegro5/internal/aintern.h" @@ -31,7 +31,7 @@ /* the active keyboard driver */ -static ALLEGRO_KEYBOARD_DRIVER *new_keyboard_driver = NULL; +static A5O_KEYBOARD_DRIVER *new_keyboard_driver = NULL; /* Provide a default naming for the most common keys. Keys whose @@ -101,9 +101,9 @@ const char *_al_keyboard_common_names[/* leave empty */] = "SCROLLLOCK", "NUMLOCK", "CAPSLOCK" }; -ALLEGRO_STATIC_ASSERT(keybdnu, +A5O_STATIC_ASSERT(keybdnu, sizeof(_al_keyboard_common_names) / sizeof(_al_keyboard_common_names[0]) - == ALLEGRO_KEY_MAX); + == A5O_KEY_MAX); @@ -185,11 +185,11 @@ void al_uninstall_keyboard(void) /* This was in the public API but its only purpose is now served by * al_get_keyboard_event_source(). */ -static ALLEGRO_KEYBOARD *al_get_keyboard(void) +static A5O_KEYBOARD *al_get_keyboard(void) { ASSERT(new_keyboard_driver); { - ALLEGRO_KEYBOARD *kbd = new_keyboard_driver->get_keyboard(); + A5O_KEYBOARD *kbd = new_keyboard_driver->get_keyboard(); ASSERT(kbd); return kbd; @@ -230,7 +230,7 @@ const char *al_keycode_to_name(int keycode) const char *name = NULL; ASSERT(new_keyboard_driver); - ASSERT((keycode >= 0) && (keycode < ALLEGRO_KEY_MAX)); + ASSERT((keycode >= 0) && (keycode < A5O_KEY_MAX)); if (new_keyboard_driver->keycode_to_name) name = new_keyboard_driver->keycode_to_name(keycode); @@ -247,7 +247,7 @@ const char *al_keycode_to_name(int keycode) /* Function: al_get_keyboard_state */ -void al_get_keyboard_state(ALLEGRO_KEYBOARD_STATE *ret_state) +void al_get_keyboard_state(A5O_KEYBOARD_STATE *ret_state) { ASSERT(new_keyboard_driver); ASSERT(ret_state); @@ -259,20 +259,20 @@ void al_get_keyboard_state(ALLEGRO_KEYBOARD_STATE *ret_state) /* Function: al_clear_keyboard_state */ -void al_clear_keyboard_state(ALLEGRO_DISPLAY *display) +void al_clear_keyboard_state(A5O_DISPLAY *display) { ASSERT(new_keyboard_driver); if (display) { - ALLEGRO_EVENT_SOURCE *es = al_get_keyboard_event_source(); - ALLEGRO_KEYBOARD_STATE ks; al_get_keyboard_state(&ks); + A5O_EVENT_SOURCE *es = al_get_keyboard_event_source(); + A5O_KEYBOARD_STATE ks; al_get_keyboard_state(&ks); _al_event_source_lock(es); if (_al_event_source_needs_to_generate_event(es)) { int keycode; - for (keycode = ALLEGRO_KEY_A; keycode < ALLEGRO_KEY_MAX; keycode++) { + for (keycode = A5O_KEY_A; keycode < A5O_KEY_MAX; keycode++) { if (al_key_down(&ks, keycode)) { - ALLEGRO_EVENT event; - event.keyboard.type = ALLEGRO_EVENT_KEY_UP; + A5O_EVENT event; + event.keyboard.type = A5O_EVENT_KEY_UP; event.keyboard.timestamp = al_get_time(); event.keyboard.display = display; event.keyboard.keycode = keycode; @@ -292,7 +292,7 @@ void al_clear_keyboard_state(ALLEGRO_DISPLAY *display) /* Function: al_key_down */ -bool al_key_down(const ALLEGRO_KEYBOARD_STATE *state, int keycode) +bool al_key_down(const A5O_KEYBOARD_STATE *state, int keycode) { return _AL_KEYBOARD_STATE_KEY_DOWN(*state, keycode); } @@ -301,9 +301,9 @@ bool al_key_down(const ALLEGRO_KEYBOARD_STATE *state, int keycode) /* Function: al_get_keyboard_event_source */ -ALLEGRO_EVENT_SOURCE *al_get_keyboard_event_source(void) +A5O_EVENT_SOURCE *al_get_keyboard_event_source(void) { - ALLEGRO_KEYBOARD *keyboard = al_get_keyboard(); + A5O_KEYBOARD *keyboard = al_get_keyboard(); return (keyboard) ? &keyboard->es : NULL; } @@ -315,7 +315,7 @@ static int match_key_name(const char *s) int i; /* Some key names are not intuitive, but this is all we've got. */ - for (i = 1; i < ALLEGRO_KEY_MAX; i++) { + for (i = 1; i < A5O_KEY_MAX; i++) { if (0 == _al_stricmp(s, _al_keyboard_common_names[i])) return i; } @@ -326,13 +326,13 @@ static int match_key_name(const char *s) static unsigned int match_modifier(const char *s) { - if (0 == _al_stricmp(s, "SHIFT")) return ALLEGRO_KEYMOD_SHIFT; - if (0 == _al_stricmp(s, "CTRL")) return ALLEGRO_KEYMOD_CTRL; - if (0 == _al_stricmp(s, "ALT")) return ALLEGRO_KEYMOD_ALT; - if (0 == _al_stricmp(s, "LWIN")) return ALLEGRO_KEYMOD_LWIN; - if (0 == _al_stricmp(s, "RWIN")) return ALLEGRO_KEYMOD_RWIN; - if (0 == _al_stricmp(s, "ALTGR")) return ALLEGRO_KEYMOD_ALTGR; - if (0 == _al_stricmp(s, "COMMAND")) return ALLEGRO_KEYMOD_COMMAND; + if (0 == _al_stricmp(s, "SHIFT")) return A5O_KEYMOD_SHIFT; + if (0 == _al_stricmp(s, "CTRL")) return A5O_KEYMOD_CTRL; + if (0 == _al_stricmp(s, "ALT")) return A5O_KEYMOD_ALT; + if (0 == _al_stricmp(s, "LWIN")) return A5O_KEYMOD_LWIN; + if (0 == _al_stricmp(s, "RWIN")) return A5O_KEYMOD_RWIN; + if (0 == _al_stricmp(s, "ALTGR")) return A5O_KEYMOD_ALTGR; + if (0 == _al_stricmp(s, "COMMAND")) return A5O_KEYMOD_COMMAND; return 0; } @@ -340,7 +340,7 @@ static unsigned int match_modifier(const char *s) int _al_parse_key_binding(const char *s, unsigned int *modifiers) { - ALLEGRO_USTR *us; + A5O_USTR *us; unsigned start = 0; int keycode = 0; diff --git a/src/linux/lhaptic.c b/src/linux/lhaptic.c index b8e759866f..9d6d3354b3 100644 --- a/src/linux/lhaptic.c +++ b/src/linux/lhaptic.c @@ -29,11 +29,11 @@ #include "allegro5/internal/aintern_ljoynu.h" #include "allegro5/platform/aintunix.h" -#ifdef ALLEGRO_HAVE_LINUX_INPUT_H +#ifdef A5O_HAVE_LINUX_INPUT_H #include -ALLEGRO_DEBUG_CHANNEL("lhaptic") +A5O_DEBUG_CHANNEL("lhaptic") /* For compatibility with older kernels. */ @@ -52,12 +52,12 @@ ALLEGRO_DEBUG_CHANNEL("lhaptic") typedef struct { - struct ALLEGRO_HAPTIC parent; /* must be first */ + struct A5O_HAPTIC parent; /* must be first */ bool active; int fd; int flags; int effects[HAPTICS_EFFECTS_MAX]; -} ALLEGRO_HAPTIC_LINUX; +} A5O_HAPTIC_LINUX; #define LONG_BITS (sizeof(long) * 8) @@ -71,43 +71,43 @@ typedef struct static bool lhap_init_haptic(void); static void lhap_exit_haptic(void); -static bool lhap_is_mouse_haptic(ALLEGRO_MOUSE *dev); -static bool lhap_is_joystick_haptic(ALLEGRO_JOYSTICK *); -static bool lhap_is_keyboard_haptic(ALLEGRO_KEYBOARD *dev); -static bool lhap_is_display_haptic(ALLEGRO_DISPLAY *dev); -static bool lhap_is_touch_input_haptic(ALLEGRO_TOUCH_INPUT *dev); - -static ALLEGRO_HAPTIC *lhap_get_from_mouse(ALLEGRO_MOUSE *dev); -static ALLEGRO_HAPTIC *lhap_get_from_joystick(ALLEGRO_JOYSTICK *dev); -static ALLEGRO_HAPTIC *lhap_get_from_keyboard(ALLEGRO_KEYBOARD *dev); -static ALLEGRO_HAPTIC *lhap_get_from_display(ALLEGRO_DISPLAY *dev); -static ALLEGRO_HAPTIC *lhap_get_from_touch_input(ALLEGRO_TOUCH_INPUT *dev); - -static bool lhap_release(ALLEGRO_HAPTIC *haptic); - -static bool lhap_get_active(ALLEGRO_HAPTIC *hap); -static int lhap_get_capabilities(ALLEGRO_HAPTIC *dev); -static double lhap_get_gain(ALLEGRO_HAPTIC *dev); -static bool lhap_set_gain(ALLEGRO_HAPTIC *dev, double); -static int lhap_get_max_effects(ALLEGRO_HAPTIC *dev); - -static bool lhap_is_effect_ok(ALLEGRO_HAPTIC *dev, ALLEGRO_HAPTIC_EFFECT *eff); -static bool lhap_upload_effect(ALLEGRO_HAPTIC *dev, - ALLEGRO_HAPTIC_EFFECT *eff, - ALLEGRO_HAPTIC_EFFECT_ID *id); -static bool lhap_play_effect(ALLEGRO_HAPTIC_EFFECT_ID *id, int loop); -static bool lhap_stop_effect(ALLEGRO_HAPTIC_EFFECT_ID *id); -static bool lhap_is_effect_playing(ALLEGRO_HAPTIC_EFFECT_ID *id); -static bool lhap_release_effect(ALLEGRO_HAPTIC_EFFECT_ID *id); - -static double lhap_get_autocenter(ALLEGRO_HAPTIC *dev); -static bool lhap_set_autocenter(ALLEGRO_HAPTIC *dev, double); +static bool lhap_is_mouse_haptic(A5O_MOUSE *dev); +static bool lhap_is_joystick_haptic(A5O_JOYSTICK *); +static bool lhap_is_keyboard_haptic(A5O_KEYBOARD *dev); +static bool lhap_is_display_haptic(A5O_DISPLAY *dev); +static bool lhap_is_touch_input_haptic(A5O_TOUCH_INPUT *dev); + +static A5O_HAPTIC *lhap_get_from_mouse(A5O_MOUSE *dev); +static A5O_HAPTIC *lhap_get_from_joystick(A5O_JOYSTICK *dev); +static A5O_HAPTIC *lhap_get_from_keyboard(A5O_KEYBOARD *dev); +static A5O_HAPTIC *lhap_get_from_display(A5O_DISPLAY *dev); +static A5O_HAPTIC *lhap_get_from_touch_input(A5O_TOUCH_INPUT *dev); + +static bool lhap_release(A5O_HAPTIC *haptic); + +static bool lhap_get_active(A5O_HAPTIC *hap); +static int lhap_get_capabilities(A5O_HAPTIC *dev); +static double lhap_get_gain(A5O_HAPTIC *dev); +static bool lhap_set_gain(A5O_HAPTIC *dev, double); +static int lhap_get_max_effects(A5O_HAPTIC *dev); + +static bool lhap_is_effect_ok(A5O_HAPTIC *dev, A5O_HAPTIC_EFFECT *eff); +static bool lhap_upload_effect(A5O_HAPTIC *dev, + A5O_HAPTIC_EFFECT *eff, + A5O_HAPTIC_EFFECT_ID *id); +static bool lhap_play_effect(A5O_HAPTIC_EFFECT_ID *id, int loop); +static bool lhap_stop_effect(A5O_HAPTIC_EFFECT_ID *id); +static bool lhap_is_effect_playing(A5O_HAPTIC_EFFECT_ID *id); +static bool lhap_release_effect(A5O_HAPTIC_EFFECT_ID *id); + +static double lhap_get_autocenter(A5O_HAPTIC *dev); +static bool lhap_set_autocenter(A5O_HAPTIC *dev, double); static void lhap_timerclear(struct input_event *evt); -ALLEGRO_HAPTIC_DRIVER _al_hapdrv_linux = +A5O_HAPTIC_DRIVER _al_hapdrv_linux = { - _ALLEGRO_HAPDRV_LINUX, + _A5O_HAPDRV_LINUX, "", "", "Linux haptic(s)", @@ -146,8 +146,8 @@ ALLEGRO_HAPTIC_DRIVER _al_hapdrv_linux = }; -static ALLEGRO_HAPTIC_LINUX haptics[HAPTICS_MAX]; -static ALLEGRO_MUTEX *haptic_mutex = NULL; +static A5O_HAPTIC_LINUX haptics[HAPTICS_MAX]; +static A5O_MUTEX *haptic_mutex = NULL; struct CAP_MAP { @@ -156,22 +156,22 @@ struct CAP_MAP { }; static const struct CAP_MAP cap_map[] = { - { FF_PERIODIC, ALLEGRO_HAPTIC_PERIODIC }, - { FF_RUMBLE, ALLEGRO_HAPTIC_RUMBLE }, - { FF_CONSTANT, ALLEGRO_HAPTIC_CONSTANT }, - { FF_SPRING, ALLEGRO_HAPTIC_SPRING }, - { FF_FRICTION, ALLEGRO_HAPTIC_FRICTION }, - { FF_DAMPER, ALLEGRO_HAPTIC_DAMPER }, - { FF_INERTIA, ALLEGRO_HAPTIC_INERTIA }, - { FF_RAMP, ALLEGRO_HAPTIC_RAMP }, - { FF_SQUARE, ALLEGRO_HAPTIC_SQUARE }, - { FF_TRIANGLE, ALLEGRO_HAPTIC_TRIANGLE }, - { FF_SINE, ALLEGRO_HAPTIC_SINE }, - { FF_SAW_UP, ALLEGRO_HAPTIC_SAW_UP }, - { FF_SAW_DOWN, ALLEGRO_HAPTIC_SAW_DOWN }, - { FF_CUSTOM, ALLEGRO_HAPTIC_CUSTOM }, - { FF_GAIN, ALLEGRO_HAPTIC_GAIN }, - { FF_AUTOCENTER, ALLEGRO_HAPTIC_AUTOCENTER }, + { FF_PERIODIC, A5O_HAPTIC_PERIODIC }, + { FF_RUMBLE, A5O_HAPTIC_RUMBLE }, + { FF_CONSTANT, A5O_HAPTIC_CONSTANT }, + { FF_SPRING, A5O_HAPTIC_SPRING }, + { FF_FRICTION, A5O_HAPTIC_FRICTION }, + { FF_DAMPER, A5O_HAPTIC_DAMPER }, + { FF_INERTIA, A5O_HAPTIC_INERTIA }, + { FF_RAMP, A5O_HAPTIC_RAMP }, + { FF_SQUARE, A5O_HAPTIC_SQUARE }, + { FF_TRIANGLE, A5O_HAPTIC_TRIANGLE }, + { FF_SINE, A5O_HAPTIC_SINE }, + { FF_SAW_UP, A5O_HAPTIC_SAW_UP }, + { FF_SAW_DOWN, A5O_HAPTIC_SAW_DOWN }, + { FF_CUSTOM, A5O_HAPTIC_CUSTOM }, + { FF_GAIN, A5O_HAPTIC_GAIN }, + { FF_AUTOCENTER, A5O_HAPTIC_AUTOCENTER }, { -1, -1 } }; @@ -193,7 +193,7 @@ static bool lhap_init_haptic(void) } -static ALLEGRO_HAPTIC_LINUX *lhap_get_available_haptic(void) +static A5O_HAPTIC_LINUX *lhap_get_available_haptic(void) { int i; @@ -209,9 +209,9 @@ static ALLEGRO_HAPTIC_LINUX *lhap_get_available_haptic(void) /* Converts a generic haptic device to a Linux-specific one. */ -static ALLEGRO_HAPTIC_LINUX *lhap_from_al(ALLEGRO_HAPTIC *hap) +static A5O_HAPTIC_LINUX *lhap_from_al(A5O_HAPTIC *hap) { - return (ALLEGRO_HAPTIC_LINUX *)hap; + return (A5O_HAPTIC_LINUX *)hap; } @@ -228,28 +228,28 @@ static bool lhap_type2lin(__u16 *res, int type) ASSERT(res); switch (type) { - case ALLEGRO_HAPTIC_RUMBLE: + case A5O_HAPTIC_RUMBLE: (*res) = FF_RUMBLE; break; - case ALLEGRO_HAPTIC_PERIODIC: + case A5O_HAPTIC_PERIODIC: (*res) = FF_PERIODIC; break; - case ALLEGRO_HAPTIC_CONSTANT: + case A5O_HAPTIC_CONSTANT: (*res) = FF_CONSTANT; break; - case ALLEGRO_HAPTIC_SPRING: + case A5O_HAPTIC_SPRING: (*res) = FF_SPRING; break; - case ALLEGRO_HAPTIC_FRICTION: + case A5O_HAPTIC_FRICTION: (*res) = FF_FRICTION; break; - case ALLEGRO_HAPTIC_DAMPER: + case A5O_HAPTIC_DAMPER: (*res) = FF_DAMPER; break; - case ALLEGRO_HAPTIC_INERTIA: + case A5O_HAPTIC_INERTIA: (*res) = FF_INERTIA; break; - case ALLEGRO_HAPTIC_RAMP: + case A5O_HAPTIC_RAMP: (*res) = FF_RAMP; break; default: @@ -264,22 +264,22 @@ static bool lhap_wave2lin(__u16 *res, int type) ASSERT(res); switch (type) { - case ALLEGRO_HAPTIC_SQUARE: + case A5O_HAPTIC_SQUARE: (*res) = FF_SQUARE; break; - case ALLEGRO_HAPTIC_TRIANGLE: + case A5O_HAPTIC_TRIANGLE: (*res) = FF_TRIANGLE; break; - case ALLEGRO_HAPTIC_SINE: + case A5O_HAPTIC_SINE: (*res) = FF_SINE; break; - case ALLEGRO_HAPTIC_SAW_UP: + case A5O_HAPTIC_SAW_UP: (*res) = FF_SAW_UP; break; - case ALLEGRO_HAPTIC_SAW_DOWN: + case A5O_HAPTIC_SAW_DOWN: (*res) = FF_SAW_DOWN; break; - case ALLEGRO_HAPTIC_CUSTOM: + case A5O_HAPTIC_CUSTOM: (*res) = FF_CUSTOM; break; default: @@ -319,7 +319,7 @@ static bool lhap_stime2lin(__s16 *res, double sec) /* Converts replay data to Linux-compatible data. */ static bool lhap_replay2lin(struct ff_replay *lin, - struct ALLEGRO_HAPTIC_REPLAY *al) + struct A5O_HAPTIC_REPLAY *al) { return lhap_time2lin(&lin->delay, al->delay) && lhap_time2lin(&lin->length, al->length); @@ -356,7 +356,7 @@ static bool lhap_slevel2lin(__s16 *res, double level) /* Converts an Allegro haptic effect envelope to Linux input API. */ static bool lhap_envelope2lin(struct ff_envelope *lin, - struct ALLEGRO_HAPTIC_ENVELOPE *al) + struct A5O_HAPTIC_ENVELOPE *al) { return lhap_time2lin(&lin->attack_length, al->attack_length) && lhap_time2lin(&lin->fade_length, al->fade_length) @@ -367,7 +367,7 @@ static bool lhap_envelope2lin(struct ff_envelope *lin, /* Converts a rumble effect to Linux input API. */ static bool lhap_rumble2lin(struct ff_rumble_effect *lin, - struct ALLEGRO_HAPTIC_RUMBLE_EFFECT *al) + struct A5O_HAPTIC_RUMBLE_EFFECT *al) { return lhap_level2lin(&lin->strong_magnitude, al->strong_magnitude) && lhap_level2lin(&lin->weak_magnitude, al->weak_magnitude); @@ -376,7 +376,7 @@ static bool lhap_rumble2lin(struct ff_rumble_effect *lin, /* Converts a constant effect to Linux input API. */ static bool lhap_constant2lin(struct ff_constant_effect *lin, - struct ALLEGRO_HAPTIC_CONSTANT_EFFECT *al) + struct A5O_HAPTIC_CONSTANT_EFFECT *al) { return lhap_envelope2lin(&lin->envelope, &al->envelope) && lhap_slevel2lin(&lin->level, al->level); @@ -385,7 +385,7 @@ static bool lhap_constant2lin(struct ff_constant_effect *lin, /* Converts a ramp effect to Linux input API. */ static bool lhap_ramp2lin(struct ff_ramp_effect *lin, - struct ALLEGRO_HAPTIC_RAMP_EFFECT *al) + struct A5O_HAPTIC_RAMP_EFFECT *al) { return lhap_envelope2lin(&lin->envelope, &al->envelope) && lhap_slevel2lin(&lin->start_level, al->start_level) @@ -395,7 +395,7 @@ static bool lhap_ramp2lin(struct ff_ramp_effect *lin, /* Converts a ramp effect to Linux input API. */ static bool lhap_condition2lin(struct ff_condition_effect *lin, - struct ALLEGRO_HAPTIC_CONDITION_EFFECT *al) + struct A5O_HAPTIC_CONDITION_EFFECT *al) { return lhap_slevel2lin(&lin->center, al->center) && lhap_level2lin(&lin->deadband, al->deadband) @@ -408,7 +408,7 @@ static bool lhap_condition2lin(struct ff_condition_effect *lin, /* Converts a periodic effect to linux input API. */ static bool lhap_periodic2lin(struct ff_periodic_effect *lin, - struct ALLEGRO_HAPTIC_PERIODIC_EFFECT *al) + struct A5O_HAPTIC_PERIODIC_EFFECT *al) { /* Custom data is not supported yet, because currently no Linux * haptic driver supports it. @@ -426,7 +426,7 @@ static bool lhap_periodic2lin(struct ff_periodic_effect *lin, /* Converts Allegro haptic effect to Linux input API. */ -static bool lhap_effect2lin(struct ff_effect *lin, ALLEGRO_HAPTIC_EFFECT *al) +static bool lhap_effect2lin(struct ff_effect *lin, A5O_HAPTIC_EFFECT *al) { memset(lin, 0, sizeof(*lin)); @@ -458,14 +458,14 @@ static bool lhap_effect2lin(struct ff_effect *lin, ALLEGRO_HAPTIC_EFFECT *al) } -static bool lhap_get_active(ALLEGRO_HAPTIC *haptic) +static bool lhap_get_active(A5O_HAPTIC *haptic) { - ALLEGRO_HAPTIC_LINUX *lhap = lhap_from_al(haptic); + A5O_HAPTIC_LINUX *lhap = lhap_from_al(haptic); return lhap->active; } -static bool lhap_is_mouse_haptic(ALLEGRO_MOUSE *mouse) +static bool lhap_is_mouse_haptic(A5O_MOUSE *mouse) { (void)mouse; return false; @@ -486,9 +486,9 @@ static bool lhap_fd_can_ff(int fd) } -static bool lhap_is_joystick_haptic(ALLEGRO_JOYSTICK *joy) +static bool lhap_is_joystick_haptic(A5O_JOYSTICK *joy) { - ALLEGRO_JOYSTICK_LINUX *ljoy = (ALLEGRO_JOYSTICK_LINUX *) joy; + A5O_JOYSTICK_LINUX *ljoy = (A5O_JOYSTICK_LINUX *) joy; if (!al_is_joystick_installed()) return false; if (!al_get_joystick_active(joy)) @@ -499,28 +499,28 @@ static bool lhap_is_joystick_haptic(ALLEGRO_JOYSTICK *joy) } -static bool lhap_is_display_haptic(ALLEGRO_DISPLAY *dev) +static bool lhap_is_display_haptic(A5O_DISPLAY *dev) { (void)dev; return false; } -static bool lhap_is_keyboard_haptic(ALLEGRO_KEYBOARD *dev) +static bool lhap_is_keyboard_haptic(A5O_KEYBOARD *dev) { (void)dev; return false; } -static bool lhap_is_touch_input_haptic(ALLEGRO_TOUCH_INPUT *dev) +static bool lhap_is_touch_input_haptic(A5O_TOUCH_INPUT *dev) { (void)dev; return false; } -static ALLEGRO_HAPTIC *lhap_get_from_mouse(ALLEGRO_MOUSE *mouse) +static A5O_HAPTIC *lhap_get_from_mouse(A5O_MOUSE *mouse) { (void)mouse; return NULL; @@ -534,7 +534,7 @@ static bool get_haptic_capabilities(int fd, int *capabilities) int i; if (ioctl(fd, EVIOCGBIT(EV_FF, sizeof(bitmask)), bitmask) < 0) { - ALLEGRO_ERROR("EVIOCGBIT failed for fd %d", fd); + A5O_ERROR("EVIOCGBIT failed for fd %d", fd); return false; } @@ -545,15 +545,15 @@ static bool get_haptic_capabilities(int fd, int *capabilities) } } (*capabilities) = caps; - ALLEGRO_INFO("Capabilities: 0x%x\n", caps); + A5O_INFO("Capabilities: 0x%x\n", caps); return true; } -static ALLEGRO_HAPTIC *lhap_get_from_joystick(ALLEGRO_JOYSTICK *joy) +static A5O_HAPTIC *lhap_get_from_joystick(A5O_JOYSTICK *joy) { - ALLEGRO_JOYSTICK_LINUX *ljoy = (ALLEGRO_JOYSTICK_LINUX *) joy; - ALLEGRO_HAPTIC_LINUX *lhap; + A5O_JOYSTICK_LINUX *ljoy = (A5O_JOYSTICK_LINUX *) joy; + A5O_HAPTIC_LINUX *lhap; int i; if (!al_is_joystick_haptic(joy)) @@ -585,40 +585,40 @@ static ALLEGRO_HAPTIC *lhap_get_from_joystick(ALLEGRO_JOYSTICK *joy) } -static ALLEGRO_HAPTIC *lhap_get_from_display(ALLEGRO_DISPLAY *dev) +static A5O_HAPTIC *lhap_get_from_display(A5O_DISPLAY *dev) { (void)dev; return NULL; } -static ALLEGRO_HAPTIC *lhap_get_from_keyboard(ALLEGRO_KEYBOARD *dev) +static A5O_HAPTIC *lhap_get_from_keyboard(A5O_KEYBOARD *dev) { (void)dev; return NULL; } -static ALLEGRO_HAPTIC *lhap_get_from_touch_input(ALLEGRO_TOUCH_INPUT *dev) +static A5O_HAPTIC *lhap_get_from_touch_input(A5O_TOUCH_INPUT *dev) { (void)dev; return NULL; } -static int lhap_get_capabilities(ALLEGRO_HAPTIC *dev) +static int lhap_get_capabilities(A5O_HAPTIC *dev) { - ALLEGRO_HAPTIC_LINUX *lhap = lhap_from_al(dev); + A5O_HAPTIC_LINUX *lhap = lhap_from_al(dev); return lhap->flags; } -static double lhap_get_gain(ALLEGRO_HAPTIC *dev) +static double lhap_get_gain(A5O_HAPTIC *dev) { - ALLEGRO_HAPTIC_LINUX *lhap = lhap_from_al(dev); + A5O_HAPTIC_LINUX *lhap = lhap_from_al(dev); (void)dev; - if(!al_is_haptic_capable(dev, ALLEGRO_HAPTIC_GAIN)) { + if(!al_is_haptic_capable(dev, A5O_HAPTIC_GAIN)) { return 0.0; } @@ -629,9 +629,9 @@ static double lhap_get_gain(ALLEGRO_HAPTIC *dev) } -static bool lhap_set_gain(ALLEGRO_HAPTIC *dev, double gain) +static bool lhap_set_gain(A5O_HAPTIC *dev, double gain) { - ALLEGRO_HAPTIC_LINUX *lhap = lhap_from_al(dev); + A5O_HAPTIC_LINUX *lhap = lhap_from_al(dev); struct input_event ie; lhap->parent.gain = gain; @@ -646,9 +646,9 @@ static bool lhap_set_gain(ALLEGRO_HAPTIC *dev, double gain) } -static bool lhap_set_autocenter(ALLEGRO_HAPTIC *dev, double autocenter) +static bool lhap_set_autocenter(A5O_HAPTIC *dev, double autocenter) { - ALLEGRO_HAPTIC_LINUX *lhap = lhap_from_al(dev); + A5O_HAPTIC_LINUX *lhap = lhap_from_al(dev); struct input_event ie; lhap->parent.autocenter = autocenter; @@ -662,12 +662,12 @@ static bool lhap_set_autocenter(ALLEGRO_HAPTIC *dev, double autocenter) return true; } -static double lhap_get_autocenter(ALLEGRO_HAPTIC *dev) +static double lhap_get_autocenter(A5O_HAPTIC *dev) { - ALLEGRO_HAPTIC_LINUX *lhap = lhap_from_al(dev); + A5O_HAPTIC_LINUX *lhap = lhap_from_al(dev); (void)dev; - if(!al_is_haptic_capable(dev, ALLEGRO_HAPTIC_AUTOCENTER)) { + if(!al_is_haptic_capable(dev, A5O_HAPTIC_AUTOCENTER)) { return 0.0; } @@ -677,13 +677,13 @@ static double lhap_get_autocenter(ALLEGRO_HAPTIC *dev) return lhap->parent.autocenter; } -int lhap_get_max_effects(ALLEGRO_HAPTIC *dev) +int lhap_get_max_effects(A5O_HAPTIC *dev) { - ALLEGRO_HAPTIC_LINUX *lhap = lhap_from_al(dev); + A5O_HAPTIC_LINUX *lhap = lhap_from_al(dev); int n_effects; if (ioctl(lhap->fd, EVIOCGEFFECTS, &n_effects) < 0) { - ALLEGRO_WARN("EVIOCGEFFECTS failed on fd %d\n", lhap->fd); + A5O_WARN("EVIOCGEFFECTS failed on fd %d\n", lhap->fd); n_effects = HAPTICS_EFFECTS_MAX; } @@ -694,8 +694,8 @@ int lhap_get_max_effects(ALLEGRO_HAPTIC *dev) } -static bool lhap_is_effect_ok(ALLEGRO_HAPTIC *haptic, - ALLEGRO_HAPTIC_EFFECT *effect) +static bool lhap_is_effect_ok(A5O_HAPTIC *haptic, + A5O_HAPTIC_EFFECT *effect) { int caps; struct ff_effect leff; @@ -708,10 +708,10 @@ static bool lhap_is_effect_ok(ALLEGRO_HAPTIC *haptic, } -static bool lhap_upload_effect(ALLEGRO_HAPTIC *dev, - ALLEGRO_HAPTIC_EFFECT *effect, ALLEGRO_HAPTIC_EFFECT_ID *id) +static bool lhap_upload_effect(A5O_HAPTIC *dev, + A5O_HAPTIC_EFFECT *effect, A5O_HAPTIC_EFFECT_ID *id) { - ALLEGRO_HAPTIC_LINUX *lhap = lhap_from_al(dev); + A5O_HAPTIC_LINUX *lhap = lhap_from_al(dev); struct ff_effect leff; int found; int i; @@ -726,7 +726,7 @@ static bool lhap_upload_effect(ALLEGRO_HAPTIC *dev, id->_handle = -1; if (!lhap_effect2lin(&leff, effect)) { - ALLEGRO_WARN("lhap_effect2lin failed"); + A5O_WARN("lhap_effect2lin failed"); return false; } @@ -741,14 +741,14 @@ static bool lhap_upload_effect(ALLEGRO_HAPTIC *dev, /* No more space for an effect. */ if (found < 0) { - ALLEGRO_WARN("No free effect slot."); + A5O_WARN("No free effect slot."); return false; } /* Upload effect. */ leff.id = -1; if (ioctl(lhap->fd, EVIOCSFF, &leff) < 0) { - ALLEGRO_ERROR("EVIOCSFF failed for fd %d\n", lhap->fd); + A5O_ERROR("EVIOCSFF failed for fd %d\n", lhap->fd); return false; } @@ -765,9 +765,9 @@ static bool lhap_upload_effect(ALLEGRO_HAPTIC *dev, } -static bool lhap_play_effect(ALLEGRO_HAPTIC_EFFECT_ID *id, int loops) +static bool lhap_play_effect(A5O_HAPTIC_EFFECT_ID *id, int loops) { - ALLEGRO_HAPTIC_LINUX *lhap = (ALLEGRO_HAPTIC_LINUX *) id->_haptic; + A5O_HAPTIC_LINUX *lhap = (A5O_HAPTIC_LINUX *) id->_haptic; struct input_event play; int fd; double now; @@ -785,7 +785,7 @@ static bool lhap_play_effect(ALLEGRO_HAPTIC_EFFECT_ID *id, int loops) play.value = loops; /* play: 1, stop: 0 */ if (write(fd, (const void *)&play, sizeof(play)) < 0) { - ALLEGRO_ERROR("Effect play failed.\n"); + A5O_ERROR("Effect play failed.\n"); return false; } @@ -800,9 +800,9 @@ static bool lhap_play_effect(ALLEGRO_HAPTIC_EFFECT_ID *id, int loops) } -static bool lhap_stop_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) +static bool lhap_stop_effect(A5O_HAPTIC_EFFECT_ID *id) { - ALLEGRO_HAPTIC_LINUX *lhap = (ALLEGRO_HAPTIC_LINUX *) id->_haptic; + A5O_HAPTIC_LINUX *lhap = (A5O_HAPTIC_LINUX *) id->_haptic; struct input_event play; if (!lhap) @@ -814,7 +814,7 @@ static bool lhap_stop_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) play.code = id->_handle; play.value = 0; if (write(lhap->fd, (const void *)&play, sizeof(play)) < 0) { - ALLEGRO_ERROR("Stop effect failed.\n"); + A5O_ERROR("Stop effect failed.\n"); return false; } id->_playing = false; @@ -822,7 +822,7 @@ static bool lhap_stop_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) } -static bool lhap_is_effect_playing(ALLEGRO_HAPTIC_EFFECT_ID *id) +static bool lhap_is_effect_playing(A5O_HAPTIC_EFFECT_ID *id) { ASSERT(id); @@ -833,14 +833,14 @@ static bool lhap_is_effect_playing(ALLEGRO_HAPTIC_EFFECT_ID *id) } -static bool lhap_release_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) +static bool lhap_release_effect(A5O_HAPTIC_EFFECT_ID *id) { - ALLEGRO_HAPTIC_LINUX *lhap = (ALLEGRO_HAPTIC_LINUX *)id->_haptic; + A5O_HAPTIC_LINUX *lhap = (A5O_HAPTIC_LINUX *)id->_haptic; lhap_stop_effect(id); if (ioctl(lhap->fd, EVIOCRMFF, id->_handle) < 0) { - ALLEGRO_ERROR("EVIOCRMFF failed.\n"); + A5O_ERROR("EVIOCRMFF failed.\n"); return false; } lhap->effects[id->_id] = -1; /* not in use */ @@ -848,9 +848,9 @@ static bool lhap_release_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) } -static bool lhap_release(ALLEGRO_HAPTIC *haptic) +static bool lhap_release(A5O_HAPTIC *haptic) { - ALLEGRO_HAPTIC_LINUX *lhap = lhap_from_al(haptic); + A5O_HAPTIC_LINUX *lhap = lhap_from_al(haptic); ASSERT(haptic); if (!lhap->active) @@ -867,7 +867,7 @@ void lhap_timerclear(struct input_event* evt) evt->input_event_usec = 0; } -#endif /* ALLEGRO_HAVE_LINUX_INPUT_H */ +#endif /* A5O_HAVE_LINUX_INPUT_H */ /* vim: set sts=3 sw=3 et: */ diff --git a/src/linux/ljoynu.c b/src/linux/ljoynu.c index 834b3d0e32..a0209082e8 100644 --- a/src/linux/ljoynu.c +++ b/src/linux/ljoynu.c @@ -25,8 +25,8 @@ #include #include -#define ALLEGRO_NO_KEY_DEFINES -#define ALLEGRO_NO_COMPATIBILITY +#define A5O_NO_KEY_DEFINES +#define A5O_NO_COMPATIBILITY #include "allegro5/allegro.h" #include "allegro5/internal/aintern.h" @@ -34,7 +34,7 @@ #include "allegro5/internal/aintern_joystick.h" #include "allegro5/platform/aintunix.h" -#ifdef ALLEGRO_HAVE_LINUX_INPUT_H +#ifdef A5O_HAVE_LINUX_INPUT_H /* To be safe, include sys/types.h before linux/joystick.h to avoid conflicting * definitions of fd_set. @@ -42,7 +42,7 @@ #include #include -#if defined(ALLEGRO_HAVE_SYS_INOTIFY_H) +#if defined(A5O_HAVE_SYS_INOTIFY_H) #define SUPPORT_HOTPLUG #include #endif @@ -55,7 +55,7 @@ #define ABS_CNT (ABS_MAX+1) #endif -ALLEGRO_DEBUG_CHANNEL("ljoy"); +A5O_DEBUG_CHANNEL("ljoy"); #include "allegro5/internal/aintern_ljoynu.h" @@ -83,7 +83,7 @@ ALLEGRO_DEBUG_CHANNEL("ljoy"); * is from BTN_MISC to BTN_GEAR_UP. */ #define LJOY_BTN_RANGE_START (BTN_MISC) -#if !defined(ALLEGRO_ANDROID) && defined(BTN_TRIGGER_HAPPY) +#if !defined(A5O_ANDROID) && defined(BTN_TRIGGER_HAPPY) #define LJOY_BTN_RANGE_END (BTN_TRIGGER_HAPPY40 + 1) #else #define LJOY_BTN_RANGE_END (BTN_GEAR_UP + 1) @@ -96,22 +96,22 @@ static bool ljoy_init_joystick(void); static void ljoy_exit_joystick(void); static bool ljoy_reconfigure_joysticks(void); static int ljoy_num_joysticks(void); -static ALLEGRO_JOYSTICK *ljoy_get_joystick(int num); -static void ljoy_release_joystick(ALLEGRO_JOYSTICK *joy_); -static void ljoy_get_joystick_state(ALLEGRO_JOYSTICK *joy_, ALLEGRO_JOYSTICK_STATE *ret_state); -static const char *ljoy_get_name(ALLEGRO_JOYSTICK *joy_); -static bool ljoy_get_active(ALLEGRO_JOYSTICK *joy_); +static A5O_JOYSTICK *ljoy_get_joystick(int num); +static void ljoy_release_joystick(A5O_JOYSTICK *joy_); +static void ljoy_get_joystick_state(A5O_JOYSTICK *joy_, A5O_JOYSTICK_STATE *ret_state); +static const char *ljoy_get_name(A5O_JOYSTICK *joy_); +static bool ljoy_get_active(A5O_JOYSTICK *joy_); static void ljoy_process_new_data(void *data); -static void ljoy_generate_axis_event(ALLEGRO_JOYSTICK_LINUX *joy, int stick, int axis, float pos); -static void ljoy_generate_button_event(ALLEGRO_JOYSTICK_LINUX *joy, int button, ALLEGRO_EVENT_TYPE event_type); +static void ljoy_generate_axis_event(A5O_JOYSTICK_LINUX *joy, int stick, int axis, float pos); +static void ljoy_generate_button_event(A5O_JOYSTICK_LINUX *joy, int button, A5O_EVENT_TYPE event_type); /* the driver vtable */ -ALLEGRO_JOYSTICK_DRIVER _al_joydrv_linux = +A5O_JOYSTICK_DRIVER _al_joydrv_linux = { - _ALLEGRO_JOYDRV_LINUX, + _A5O_JOYDRV_LINUX, "", "", "Linux joystick(s)", @@ -128,14 +128,14 @@ ALLEGRO_JOYSTICK_DRIVER _al_joydrv_linux = static unsigned num_joysticks; /* number of joysticks known to the user */ -static _AL_VECTOR joysticks; /* of ALLEGRO_JOYSTICK_LINUX pointers */ +static _AL_VECTOR joysticks; /* of A5O_JOYSTICK_LINUX pointers */ static volatile bool config_needs_merging; -static ALLEGRO_MUTEX *config_mutex; +static A5O_MUTEX *config_mutex; #ifdef SUPPORT_HOTPLUG static int inotify_fd = -1; -static ALLEGRO_THREAD *hotplug_thread; -static ALLEGRO_MUTEX *hotplug_mutex; -static ALLEGRO_COND *hotplug_cond; +static A5O_THREAD *hotplug_thread; +static A5O_MUTEX *hotplug_mutex; +static A5O_COND *hotplug_cond; static bool hotplug_ended = false; #endif @@ -156,7 +156,7 @@ static bool is_joystick_button(int i) || (i >= BTN_JOYSTICK && i <= BTN_DEAD) || (i >= BTN_GAMEPAD && i <= BTN_THUMBR) || (i >= BTN_WHEEL && i <= BTN_GEAR_UP) -#if !defined(ALLEGRO_ANDROID) && defined(BTN_TRIGGER_HAPPY) +#if !defined(A5O_ANDROID) && defined(BTN_TRIGGER_HAPPY) || (i >= BTN_TRIGGER_HAPPY && i <= BTN_TRIGGER_HAPPY40) #endif ; @@ -232,7 +232,7 @@ static bool have_joystick_axis(int fd) -static bool ljoy_detect_device_name(int num, ALLEGRO_USTR *device_name) +static bool ljoy_detect_device_name(int num, A5O_USTR *device_name) { char key[80]; const char *value; @@ -250,14 +250,14 @@ static bool ljoy_detect_device_name(int num, ALLEGRO_USTR *device_name) -static ALLEGRO_JOYSTICK_LINUX *ljoy_by_device_name( - const ALLEGRO_USTR *device_name) +static A5O_JOYSTICK_LINUX *ljoy_by_device_name( + const A5O_USTR *device_name) { unsigned i; for (i = 0; i < _al_vector_size(&joysticks); i++) { - ALLEGRO_JOYSTICK_LINUX **slot = _al_vector_ref(&joysticks, i); - ALLEGRO_JOYSTICK_LINUX *joy = *slot; + A5O_JOYSTICK_LINUX **slot = _al_vector_ref(&joysticks, i); + A5O_JOYSTICK_LINUX *joy = *slot; if (joy && al_ustr_equal(device_name, joy->device_name)) return joy; @@ -270,8 +270,8 @@ static ALLEGRO_JOYSTICK_LINUX *ljoy_by_device_name( static void ljoy_generate_configure_event(void) { - ALLEGRO_EVENT event; - event.joystick.type = ALLEGRO_EVENT_JOYSTICK_CONFIGURATION; + A5O_EVENT event; + event.joystick.type = A5O_EVENT_JOYSTICK_CONFIGURATION; event.joystick.timestamp = al_get_time(); _al_generate_joystick_event(&event); @@ -279,10 +279,10 @@ static void ljoy_generate_configure_event(void) -static ALLEGRO_JOYSTICK_LINUX *ljoy_allocate_structure(void) +static A5O_JOYSTICK_LINUX *ljoy_allocate_structure(void) { - ALLEGRO_JOYSTICK_LINUX **slot; - ALLEGRO_JOYSTICK_LINUX *joy; + A5O_JOYSTICK_LINUX **slot; + A5O_JOYSTICK_LINUX *joy; unsigned i; for (i = 0; i < _al_vector_size(&joysticks); i++) { @@ -301,7 +301,7 @@ static ALLEGRO_JOYSTICK_LINUX *ljoy_allocate_structure(void) -static void inactivate_joy(ALLEGRO_JOYSTICK_LINUX *joy) +static void inactivate_joy(A5O_JOYSTICK_LINUX *joy) { int i; @@ -340,7 +340,7 @@ static void set_axis_mapping(AXIS_MAPPING *map, int stick, int axis, -static bool fill_joystick_axes(ALLEGRO_JOYSTICK_LINUX *joy, int fd) +static bool fill_joystick_axes(A5O_JOYSTICK_LINUX *joy, int fd) { unsigned long abs_bits[NLONGS(ABS_CNT)] = {0}; int stick; @@ -371,7 +371,7 @@ static bool fill_joystick_axes(ALLEGRO_JOYSTICK_LINUX *joy, int fd) if (is_single_axis_throttle(i)) { /* One axis throttle. */ name_throttles++; - joy->parent.info.stick[stick].flags = ALLEGRO_JOYFLAG_ANALOGUE; + joy->parent.info.stick[stick].flags = A5O_JOYFLAG_ANALOGUE; joy->parent.info.stick[stick].num_axes = 1; joy->parent.info.stick[stick].axis[0].name = "X"; joy->parent.info.stick[stick].name = al_malloc(32); @@ -386,9 +386,9 @@ static bool fill_joystick_axes(ALLEGRO_JOYSTICK_LINUX *joy, int fd) /* First axis of new joystick. */ name_sticks++; if (is_hat_axis(i)) { - joy->parent.info.stick[stick].flags = ALLEGRO_JOYFLAG_DIGITAL; + joy->parent.info.stick[stick].flags = A5O_JOYFLAG_DIGITAL; } else { - joy->parent.info.stick[stick].flags = ALLEGRO_JOYFLAG_ANALOGUE; + joy->parent.info.stick[stick].flags = A5O_JOYFLAG_ANALOGUE; } joy->parent.info.stick[stick].num_axes = 2; joy->parent.info.stick[stick].axis[0].name = "X"; @@ -416,7 +416,7 @@ static bool fill_joystick_axes(ALLEGRO_JOYSTICK_LINUX *joy, int fd) -static bool fill_joystick_buttons(ALLEGRO_JOYSTICK_LINUX *joy, int fd) +static bool fill_joystick_buttons(A5O_JOYSTICK_LINUX *joy, int fd) { unsigned long key_bits[NLONGS(KEY_CNT)] = {0}; int b; @@ -430,7 +430,7 @@ static bool fill_joystick_buttons(ALLEGRO_JOYSTICK_LINUX *joy, int fd) for (i = LJOY_BTN_RANGE_START; i < LJOY_BTN_RANGE_END; i++) { if (TEST_BIT(i, key_bits) && is_joystick_button(i)) { joy->button_mapping[b].ev_code = i; - ALLEGRO_DEBUG("Input event code %d maps to button %d\n", i, b); + A5O_DEBUG("Input event code %d maps to button %d\n", i, b); joy->parent.info.button[b].name = al_malloc(32); snprintf((char *)joy->parent.info.button[b].name, 32, "B%d", b+1); @@ -453,10 +453,10 @@ static bool fill_joystick_buttons(ALLEGRO_JOYSTICK_LINUX *joy, int fd) -static void ljoy_device(ALLEGRO_USTR *device_name) { - ALLEGRO_JOYSTICK_LINUX *joy = ljoy_by_device_name(device_name); +static void ljoy_device(A5O_USTR *device_name) { + A5O_JOYSTICK_LINUX *joy = ljoy_by_device_name(device_name); if (joy) { - ALLEGRO_DEBUG("Device %s still exists\n", al_cstr(device_name)); + A5O_DEBUG("Device %s still exists\n", al_cstr(device_name)); joy->marked = true; return; } @@ -467,7 +467,7 @@ static void ljoy_device(ALLEGRO_USTR *device_name) { */ int fd = open(al_cstr(device_name), O_RDWR|O_NONBLOCK); if (fd == -1) { - ALLEGRO_WARN("Failed to open device %s\n", al_cstr(device_name)); + A5O_WARN("Failed to open device %s\n", al_cstr(device_name)); return; } @@ -477,12 +477,12 @@ static void ljoy_device(ALLEGRO_USTR *device_name) { * checking for both axes and buttons, such devices can be excluded. */ if (!have_joystick_button(fd) || !have_joystick_axis(fd)) { - ALLEGRO_DEBUG("Device %s not a joystick\n", al_cstr(device_name)); + A5O_DEBUG("Device %s not a joystick\n", al_cstr(device_name)); close(fd); return; } - ALLEGRO_DEBUG("Device %s is new\n", al_cstr(device_name)); + A5O_DEBUG("Device %s is new\n", al_cstr(device_name)); joy = ljoy_allocate_structure(); joy->fd = fd; @@ -498,7 +498,7 @@ static void ljoy_device(ALLEGRO_USTR *device_name) { * information. */ if (!fill_joystick_axes(joy, fd) || !fill_joystick_buttons(joy, fd)) { - ALLEGRO_ERROR("fill_joystick_info failed %s\n", al_cstr(device_name)); + A5O_ERROR("fill_joystick_info failed %s\n", al_cstr(device_name)); inactivate_joy(joy); close(fd); return; @@ -512,14 +512,14 @@ static void ljoy_device(ALLEGRO_USTR *device_name) { static void ljoy_scan(bool configure) { int num; - ALLEGRO_USTR *device_name; - const ALLEGRO_FS_INTERFACE *fs_interface; + A5O_USTR *device_name; + const A5O_FS_INTERFACE *fs_interface; unsigned i; int t; /* Clear mark bits. */ for (i = 0; i < _al_vector_size(&joysticks); i++) { - ALLEGRO_JOYSTICK_LINUX **joypp = _al_vector_ref(&joysticks, i); + A5O_JOYSTICK_LINUX **joypp = _al_vector_ref(&joysticks, i); (*joypp)->marked = false; } @@ -544,15 +544,15 @@ static void ljoy_scan(bool configure) static char const *folders[] = {"/dev/input/by-path", "/dev/input"}; for (t = 0; t < 2; t++) { bool found = false; - ALLEGRO_FS_ENTRY *dir = al_create_fs_entry(folders[t]); + A5O_FS_ENTRY *dir = al_create_fs_entry(folders[t]); if (al_open_directory(dir)) { static char const *suffix = "-event-joystick"; while (true) { - ALLEGRO_FS_ENTRY *dev = al_read_directory(dir); + A5O_FS_ENTRY *dev = al_read_directory(dir); if (!dev) { break; } - if (al_get_fs_entry_mode(dev) & ALLEGRO_FILEMODE_ISDIR) { + if (al_get_fs_entry_mode(dev) & A5O_FILEMODE_ISDIR) { al_destroy_fs_entry(dev); continue; } @@ -575,7 +575,7 @@ static void ljoy_scan(bool configure) */ break; } - ALLEGRO_WARN("Could not find joysticks in %s\n", folders[t]); + A5O_WARN("Could not find joysticks in %s\n", folders[t]); } al_ustr_free(device_name); @@ -585,11 +585,11 @@ static void ljoy_scan(bool configure) /* Schedule unmarked structures to be inactivated. */ for (i = 0; i < _al_vector_size(&joysticks); i++) { - ALLEGRO_JOYSTICK_LINUX **joypp = _al_vector_ref(&joysticks, i); - ALLEGRO_JOYSTICK_LINUX *joy = *joypp; + A5O_JOYSTICK_LINUX **joypp = _al_vector_ref(&joysticks, i); + A5O_JOYSTICK_LINUX *joy = *joypp; if (joy->config_state == LJOY_STATE_ALIVE && !joy->marked) { - ALLEGRO_DEBUG("Device %s to be inactivated\n", + A5O_DEBUG("Device %s to be inactivated\n", al_cstr(joy->device_name)); joy->config_state = LJOY_STATE_DYING; config_needs_merging = true; @@ -615,8 +615,8 @@ static void ljoy_merge(void) num_joysticks = 0; for (i = 0; i < _al_vector_size(&joysticks); i++) { - ALLEGRO_JOYSTICK_LINUX **slot = _al_vector_ref(&joysticks, i); - ALLEGRO_JOYSTICK_LINUX *joy = *slot; + A5O_JOYSTICK_LINUX **slot = _al_vector_ref(&joysticks, i); + A5O_JOYSTICK_LINUX *joy = *slot; switch (joy->config_state) { case LJOY_STATE_UNUSED: @@ -634,7 +634,7 @@ static void ljoy_merge(void) } } - ALLEGRO_DEBUG("Merge done, num_joysticks=%d\n", num_joysticks); + A5O_DEBUG("Merge done, num_joysticks=%d\n", num_joysticks); } @@ -658,7 +658,7 @@ static void ljoy_config_dev_changed(void *data) al_signal_cond(hotplug_cond); } -static void *hotplug_proc(ALLEGRO_THREAD *thread, void *data) +static void *hotplug_proc(A5O_THREAD *thread, void *data) { (void)data; @@ -690,7 +690,7 @@ static void *hotplug_proc(ALLEGRO_THREAD *thread, void *data) */ static bool ljoy_init_joystick(void) { - _al_vector_init(&joysticks, sizeof(ALLEGRO_JOYSTICK_LINUX *)); + _al_vector_init(&joysticks, sizeof(A5O_JOYSTICK_LINUX *)); num_joysticks = 0; if (!(config_mutex = al_create_mutex())) { @@ -726,10 +726,10 @@ static bool ljoy_init_joystick(void) /* Modern Linux probably only needs to monitor /dev/input. */ inotify_add_watch(inotify_fd, "/dev/input", IN_CREATE|IN_DELETE); _al_unix_start_watching_fd(inotify_fd, ljoy_config_dev_changed, NULL); - ALLEGRO_INFO("Hotplugging enabled\n"); + A5O_INFO("Hotplugging enabled\n"); } else { - ALLEGRO_WARN("Hotplugging not enabled\n"); + A5O_WARN("Hotplugging not enabled\n"); if (inotify_fd != -1) { close(inotify_fd); inotify_fd = -1; @@ -764,7 +764,7 @@ static void ljoy_exit_joystick(void) config_mutex = NULL; for (i = 0; i < (int)_al_vector_size(&joysticks); i++) { - ALLEGRO_JOYSTICK_LINUX **slot = _al_vector_ref(&joysticks, i); + A5O_JOYSTICK_LINUX **slot = _al_vector_ref(&joysticks, i); inactivate_joy(*slot); al_free(*slot); } @@ -807,24 +807,24 @@ static int ljoy_num_joysticks(void) /* ljoy_get_joystick: [primary thread] * - * Returns the address of a ALLEGRO_JOYSTICK structure for the device + * Returns the address of a A5O_JOYSTICK structure for the device * number NUM. */ -static ALLEGRO_JOYSTICK *ljoy_get_joystick(int num) +static A5O_JOYSTICK *ljoy_get_joystick(int num) { - ALLEGRO_JOYSTICK *ret = NULL; + A5O_JOYSTICK *ret = NULL; unsigned i; ASSERT(num >= 0); al_lock_mutex(config_mutex); for (i = 0; i < _al_vector_size(&joysticks); i++) { - ALLEGRO_JOYSTICK_LINUX **slot = _al_vector_ref(&joysticks, i); - ALLEGRO_JOYSTICK_LINUX *joy = *slot; + A5O_JOYSTICK_LINUX **slot = _al_vector_ref(&joysticks, i); + A5O_JOYSTICK_LINUX *joy = *slot; if (ACTIVE_STATE(joy->config_state)) { if (num == 0) { - ret = (ALLEGRO_JOYSTICK *)joy; + ret = (A5O_JOYSTICK *)joy; break; } num--; @@ -842,7 +842,7 @@ static ALLEGRO_JOYSTICK *ljoy_get_joystick(int num) * * Close the device for a joystick then free the joystick structure. */ -static void ljoy_release_joystick(ALLEGRO_JOYSTICK *joy_) +static void ljoy_release_joystick(A5O_JOYSTICK *joy_) { (void)joy_; } @@ -853,10 +853,10 @@ static void ljoy_release_joystick(ALLEGRO_JOYSTICK *joy_) * * Copy the internal joystick state to a user-provided structure. */ -static void ljoy_get_joystick_state(ALLEGRO_JOYSTICK *joy_, ALLEGRO_JOYSTICK_STATE *ret_state) +static void ljoy_get_joystick_state(A5O_JOYSTICK *joy_, A5O_JOYSTICK_STATE *ret_state) { - ALLEGRO_JOYSTICK_LINUX *joy = (ALLEGRO_JOYSTICK_LINUX *) joy_; - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_JOYSTICK_LINUX *joy = (A5O_JOYSTICK_LINUX *) joy_; + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); _al_event_source_lock(es); { @@ -867,24 +867,24 @@ static void ljoy_get_joystick_state(ALLEGRO_JOYSTICK *joy_, ALLEGRO_JOYSTICK_STA -static const char *ljoy_get_name(ALLEGRO_JOYSTICK *joy_) +static const char *ljoy_get_name(A5O_JOYSTICK *joy_) { - ALLEGRO_JOYSTICK_LINUX *joy = (ALLEGRO_JOYSTICK_LINUX *)joy_; + A5O_JOYSTICK_LINUX *joy = (A5O_JOYSTICK_LINUX *)joy_; return joy->name; } -static bool ljoy_get_active(ALLEGRO_JOYSTICK *joy_) +static bool ljoy_get_active(A5O_JOYSTICK *joy_) { - ALLEGRO_JOYSTICK_LINUX *joy = (ALLEGRO_JOYSTICK_LINUX *)joy_; + A5O_JOYSTICK_LINUX *joy = (A5O_JOYSTICK_LINUX *)joy_; return ACTIVE_STATE(joy->config_state); } -static int map_button_number(const ALLEGRO_JOYSTICK_LINUX *joy, int ev_code) +static int map_button_number(const A5O_JOYSTICK_LINUX *joy, int ev_code) { int b; @@ -912,8 +912,8 @@ static float norm_pos(const AXIS_MAPPING *map, float value) */ static void ljoy_process_new_data(void *data) { - ALLEGRO_JOYSTICK_LINUX *joy = data; - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_JOYSTICK_LINUX *joy = data; + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); if (!es) { // Joystick driver not fully initialized @@ -943,8 +943,8 @@ static void ljoy_process_new_data(void *data) ljoy_generate_button_event(joy, number, (value - ? ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN - : ALLEGRO_EVENT_JOYSTICK_BUTTON_UP)); + ? A5O_EVENT_JOYSTICK_BUTTON_DOWN + : A5O_EVENT_JOYSTICK_BUTTON_UP)); } } else if (type == EV_ABS) { @@ -972,17 +972,17 @@ static void ljoy_process_new_data(void *data) * Helper to generate an event after an axis is moved. * The joystick must be locked BEFORE entering this function. */ -static void ljoy_generate_axis_event(ALLEGRO_JOYSTICK_LINUX *joy, int stick, int axis, float pos) +static void ljoy_generate_axis_event(A5O_JOYSTICK_LINUX *joy, int stick, int axis, float pos) { - ALLEGRO_EVENT event; - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_EVENT event; + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); if (!_al_event_source_needs_to_generate_event(es)) return; - event.joystick.type = ALLEGRO_EVENT_JOYSTICK_AXIS; + event.joystick.type = A5O_EVENT_JOYSTICK_AXIS; event.joystick.timestamp = al_get_time(); - event.joystick.id = (ALLEGRO_JOYSTICK *)joy; + event.joystick.id = (A5O_JOYSTICK *)joy; event.joystick.stick = stick; event.joystick.axis = axis; event.joystick.pos = pos; @@ -998,17 +998,17 @@ static void ljoy_generate_axis_event(ALLEGRO_JOYSTICK_LINUX *joy, int stick, int * Helper to generate an event after a button is pressed or released. * The joystick must be locked BEFORE entering this function. */ -static void ljoy_generate_button_event(ALLEGRO_JOYSTICK_LINUX *joy, int button, ALLEGRO_EVENT_TYPE event_type) +static void ljoy_generate_button_event(A5O_JOYSTICK_LINUX *joy, int button, A5O_EVENT_TYPE event_type) { - ALLEGRO_EVENT event; - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_EVENT event; + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); if (!_al_event_source_needs_to_generate_event(es)) return; event.joystick.type = event_type; event.joystick.timestamp = al_get_time(); - event.joystick.id = (ALLEGRO_JOYSTICK *)joy; + event.joystick.id = (A5O_JOYSTICK *)joy; event.joystick.stick = 0; event.joystick.axis = 0; event.joystick.pos = 0.0; @@ -1017,7 +1017,7 @@ static void ljoy_generate_button_event(ALLEGRO_JOYSTICK_LINUX *joy, int button, _al_event_source_emit_event(es, &event); } -#endif /* ALLEGRO_HAVE_LINUX_INPUT_H */ +#endif /* A5O_HAVE_LINUX_INPUT_H */ diff --git a/src/linux/lkeybdnu.c b/src/linux/lkeybdnu.c index d715672af4..f28bc5a054 100644 --- a/src/linux/lkeybdnu.c +++ b/src/linux/lkeybdnu.c @@ -28,7 +28,7 @@ */ -#define ALLEGRO_NO_COMPATIBILITY +#define A5O_NO_COMPATIBILITY #include #include @@ -53,7 +53,7 @@ #include "allegro5/platform/aintunix.h" -ALLEGRO_DEBUG_CHANNEL("keyboard") +A5O_DEBUG_CHANNEL("keyboard") #define PREFIX_I "al-ckey INFO: " @@ -62,25 +62,25 @@ ALLEGRO_DEBUG_CHANNEL("keyboard") -typedef struct ALLEGRO_KEYBOARD_LINUX +typedef struct A5O_KEYBOARD_LINUX { - ALLEGRO_KEYBOARD parent; + A5O_KEYBOARD parent; int fd; struct termios startup_termio; struct termios work_termio; int startup_kbmode; - ALLEGRO_KEYBOARD_STATE state; + A5O_KEYBOARD_STATE state; unsigned int modifiers; // Quit if Ctrl-Alt-Del is pressed. bool three_finger_flag; // Whether to let the LED lights if the . bool key_led_flag; -} ALLEGRO_KEYBOARD_LINUX; +} A5O_KEYBOARD_LINUX; /* the one and only keyboard object */ -static ALLEGRO_KEYBOARD_LINUX the_keyboard; +static A5O_KEYBOARD_LINUX the_keyboard; /* the pid to kill when three finger saluting */ static pid_t main_pid; @@ -90,9 +90,9 @@ static pid_t main_pid; /* forward declarations */ static bool lkeybd_init_keyboard(void); static void lkeybd_exit_keyboard(void); -static ALLEGRO_KEYBOARD *lkeybd_get_keyboard(void); +static A5O_KEYBOARD *lkeybd_get_keyboard(void); static bool lkeybd_set_keyboard_leds(int leds); -static void lkeybd_get_keyboard_state(ALLEGRO_KEYBOARD_STATE *ret_state); +static void lkeybd_get_keyboard_state(A5O_KEYBOARD_STATE *ret_state); static void lkeybd_clear_keyboard_state(void); static void process_new_data(void *unused); @@ -105,7 +105,7 @@ static void handle_key_release(int mycode); /* the driver vtable */ #define KEYDRV_LINUX AL_ID('L','N','X','C') -static ALLEGRO_KEYBOARD_DRIVER keydrv_linux = +static A5O_KEYBOARD_DRIVER keydrv_linux = { KEYDRV_LINUX, "", @@ -136,49 +136,49 @@ _AL_DRIVER_INFO _al_linux_keyboard_driver_list[] = */ -#define KB_MODIFIERS (ALLEGRO_KEYMOD_SHIFT | ALLEGRO_KEYMOD_CTRL | ALLEGRO_KEYMOD_ALT | \ - ALLEGRO_KEYMOD_ALTGR | ALLEGRO_KEYMOD_LWIN | ALLEGRO_KEYMOD_RWIN | \ - ALLEGRO_KEYMOD_MENU) +#define KB_MODIFIERS (A5O_KEYMOD_SHIFT | A5O_KEYMOD_CTRL | A5O_KEYMOD_ALT | \ + A5O_KEYMOD_ALTGR | A5O_KEYMOD_LWIN | A5O_KEYMOD_RWIN | \ + A5O_KEYMOD_MENU) -#define KB_LED_FLAGS (ALLEGRO_KEYMOD_SCROLLLOCK | ALLEGRO_KEYMOD_NUMLOCK | \ - ALLEGRO_KEYMOD_CAPSLOCK) +#define KB_LED_FLAGS (A5O_KEYMOD_SCROLLLOCK | A5O_KEYMOD_NUMLOCK | \ + A5O_KEYMOD_CAPSLOCK) /* lookup table for converting kernel keycodes into Allegro format */ static unsigned char kernel_to_mycode[128] = { - /* 0x00 */ 0, ALLEGRO_KEY_ESCAPE, ALLEGRO_KEY_1, ALLEGRO_KEY_2, - /* 0x04 */ ALLEGRO_KEY_3, ALLEGRO_KEY_4, ALLEGRO_KEY_5, ALLEGRO_KEY_6, - /* 0x08 */ ALLEGRO_KEY_7, ALLEGRO_KEY_8, ALLEGRO_KEY_9, ALLEGRO_KEY_0, - /* 0x0C */ ALLEGRO_KEY_MINUS, ALLEGRO_KEY_EQUALS, ALLEGRO_KEY_BACKSPACE, ALLEGRO_KEY_TAB, - /* 0x10 */ ALLEGRO_KEY_Q, ALLEGRO_KEY_W, ALLEGRO_KEY_E, ALLEGRO_KEY_R, - /* 0x14 */ ALLEGRO_KEY_T, ALLEGRO_KEY_Y, ALLEGRO_KEY_U, ALLEGRO_KEY_I, - /* 0x18 */ ALLEGRO_KEY_O, ALLEGRO_KEY_P, ALLEGRO_KEY_OPENBRACE, ALLEGRO_KEY_CLOSEBRACE, - /* 0x1C */ ALLEGRO_KEY_ENTER, ALLEGRO_KEY_LCTRL, ALLEGRO_KEY_A, ALLEGRO_KEY_S, - /* 0x20 */ ALLEGRO_KEY_D, ALLEGRO_KEY_F, ALLEGRO_KEY_G, ALLEGRO_KEY_H, - /* 0x24 */ ALLEGRO_KEY_J, ALLEGRO_KEY_K, ALLEGRO_KEY_L, ALLEGRO_KEY_SEMICOLON, - /* 0x28 */ ALLEGRO_KEY_QUOTE, ALLEGRO_KEY_TILDE, ALLEGRO_KEY_LSHIFT, ALLEGRO_KEY_BACKSLASH, - /* 0x2C */ ALLEGRO_KEY_Z, ALLEGRO_KEY_X, ALLEGRO_KEY_C, ALLEGRO_KEY_V, - /* 0x30 */ ALLEGRO_KEY_B, ALLEGRO_KEY_N, ALLEGRO_KEY_M, ALLEGRO_KEY_COMMA, - /* 0x34 */ ALLEGRO_KEY_FULLSTOP, ALLEGRO_KEY_SLASH, ALLEGRO_KEY_RSHIFT, ALLEGRO_KEY_PAD_ASTERISK, - /* 0x38 */ ALLEGRO_KEY_ALT, ALLEGRO_KEY_SPACE, ALLEGRO_KEY_CAPSLOCK, ALLEGRO_KEY_F1, - /* 0x3C */ ALLEGRO_KEY_F2, ALLEGRO_KEY_F3, ALLEGRO_KEY_F4, ALLEGRO_KEY_F5, - /* 0x40 */ ALLEGRO_KEY_F6, ALLEGRO_KEY_F7, ALLEGRO_KEY_F8, ALLEGRO_KEY_F9, - /* 0x44 */ ALLEGRO_KEY_F10, ALLEGRO_KEY_NUMLOCK, ALLEGRO_KEY_SCROLLLOCK, ALLEGRO_KEY_PAD_7, - /* 0x48 */ ALLEGRO_KEY_PAD_8, ALLEGRO_KEY_PAD_9, ALLEGRO_KEY_PAD_MINUS, ALLEGRO_KEY_PAD_4, - /* 0x4C */ ALLEGRO_KEY_PAD_5, ALLEGRO_KEY_PAD_6, ALLEGRO_KEY_PAD_PLUS, ALLEGRO_KEY_PAD_1, - /* 0x50 */ ALLEGRO_KEY_PAD_2, ALLEGRO_KEY_PAD_3, ALLEGRO_KEY_PAD_0, ALLEGRO_KEY_PAD_DELETE, - /* 0x54 */ ALLEGRO_KEY_PRINTSCREEN, 0, ALLEGRO_KEY_BACKSLASH2, ALLEGRO_KEY_F11, - /* 0x58 */ ALLEGRO_KEY_F12, 0, 0, 0, + /* 0x00 */ 0, A5O_KEY_ESCAPE, A5O_KEY_1, A5O_KEY_2, + /* 0x04 */ A5O_KEY_3, A5O_KEY_4, A5O_KEY_5, A5O_KEY_6, + /* 0x08 */ A5O_KEY_7, A5O_KEY_8, A5O_KEY_9, A5O_KEY_0, + /* 0x0C */ A5O_KEY_MINUS, A5O_KEY_EQUALS, A5O_KEY_BACKSPACE, A5O_KEY_TAB, + /* 0x10 */ A5O_KEY_Q, A5O_KEY_W, A5O_KEY_E, A5O_KEY_R, + /* 0x14 */ A5O_KEY_T, A5O_KEY_Y, A5O_KEY_U, A5O_KEY_I, + /* 0x18 */ A5O_KEY_O, A5O_KEY_P, A5O_KEY_OPENBRACE, A5O_KEY_CLOSEBRACE, + /* 0x1C */ A5O_KEY_ENTER, A5O_KEY_LCTRL, A5O_KEY_A, A5O_KEY_S, + /* 0x20 */ A5O_KEY_D, A5O_KEY_F, A5O_KEY_G, A5O_KEY_H, + /* 0x24 */ A5O_KEY_J, A5O_KEY_K, A5O_KEY_L, A5O_KEY_SEMICOLON, + /* 0x28 */ A5O_KEY_QUOTE, A5O_KEY_TILDE, A5O_KEY_LSHIFT, A5O_KEY_BACKSLASH, + /* 0x2C */ A5O_KEY_Z, A5O_KEY_X, A5O_KEY_C, A5O_KEY_V, + /* 0x30 */ A5O_KEY_B, A5O_KEY_N, A5O_KEY_M, A5O_KEY_COMMA, + /* 0x34 */ A5O_KEY_FULLSTOP, A5O_KEY_SLASH, A5O_KEY_RSHIFT, A5O_KEY_PAD_ASTERISK, + /* 0x38 */ A5O_KEY_ALT, A5O_KEY_SPACE, A5O_KEY_CAPSLOCK, A5O_KEY_F1, + /* 0x3C */ A5O_KEY_F2, A5O_KEY_F3, A5O_KEY_F4, A5O_KEY_F5, + /* 0x40 */ A5O_KEY_F6, A5O_KEY_F7, A5O_KEY_F8, A5O_KEY_F9, + /* 0x44 */ A5O_KEY_F10, A5O_KEY_NUMLOCK, A5O_KEY_SCROLLLOCK, A5O_KEY_PAD_7, + /* 0x48 */ A5O_KEY_PAD_8, A5O_KEY_PAD_9, A5O_KEY_PAD_MINUS, A5O_KEY_PAD_4, + /* 0x4C */ A5O_KEY_PAD_5, A5O_KEY_PAD_6, A5O_KEY_PAD_PLUS, A5O_KEY_PAD_1, + /* 0x50 */ A5O_KEY_PAD_2, A5O_KEY_PAD_3, A5O_KEY_PAD_0, A5O_KEY_PAD_DELETE, + /* 0x54 */ A5O_KEY_PRINTSCREEN, 0, A5O_KEY_BACKSLASH2, A5O_KEY_F11, + /* 0x58 */ A5O_KEY_F12, 0, 0, 0, /* 0x5C */ 0, 0, 0, 0, - /* 0x60 */ ALLEGRO_KEY_PAD_ENTER, ALLEGRO_KEY_RCTRL, ALLEGRO_KEY_PAD_SLASH, ALLEGRO_KEY_PRINTSCREEN, - /* 0x64 */ ALLEGRO_KEY_ALTGR, ALLEGRO_KEY_PAUSE, ALLEGRO_KEY_HOME, ALLEGRO_KEY_UP, - /* 0x68 */ ALLEGRO_KEY_PGUP, ALLEGRO_KEY_LEFT, ALLEGRO_KEY_RIGHT, ALLEGRO_KEY_END, - /* 0x6C */ ALLEGRO_KEY_DOWN, ALLEGRO_KEY_PGDN, ALLEGRO_KEY_INSERT, ALLEGRO_KEY_DELETE, + /* 0x60 */ A5O_KEY_PAD_ENTER, A5O_KEY_RCTRL, A5O_KEY_PAD_SLASH, A5O_KEY_PRINTSCREEN, + /* 0x64 */ A5O_KEY_ALTGR, A5O_KEY_PAUSE, A5O_KEY_HOME, A5O_KEY_UP, + /* 0x68 */ A5O_KEY_PGUP, A5O_KEY_LEFT, A5O_KEY_RIGHT, A5O_KEY_END, + /* 0x6C */ A5O_KEY_DOWN, A5O_KEY_PGDN, A5O_KEY_INSERT, A5O_KEY_DELETE, /* 0x70 */ 0, 0, 0, 0, - /* 0x74 */ 0, 0, 0, ALLEGRO_KEY_PAUSE, + /* 0x74 */ 0, 0, 0, A5O_KEY_PAUSE, /* 0x78 */ 0, 0, 0, 0, - /* 0x7C */ 0, ALLEGRO_KEY_LWIN, ALLEGRO_KEY_RWIN, ALLEGRO_KEY_MENU + /* 0x7C */ 0, A5O_KEY_LWIN, A5O_KEY_RWIN, A5O_KEY_MENU /* "Two keys are unusual in the sense that their keycode is not constant, * but depends on modifiers. The PrintScrn key will yield keycode 84 when @@ -204,13 +204,13 @@ static const char pad_asciis_no_numlock[NUM_PAD_KEYS] = }; -/* convert Allegro format keycodes into ALLEGRO_KEYMOD_* */ -static const unsigned int modifier_table[ALLEGRO_KEY_MAX - ALLEGRO_KEY_MODIFIERS] = +/* convert Allegro format keycodes into A5O_KEYMOD_* */ +static const unsigned int modifier_table[A5O_KEY_MAX - A5O_KEY_MODIFIERS] = { - ALLEGRO_KEYMOD_SHIFT, ALLEGRO_KEYMOD_SHIFT, ALLEGRO_KEYMOD_CTRL, - ALLEGRO_KEYMOD_CTRL, ALLEGRO_KEYMOD_ALT, ALLEGRO_KEYMOD_ALTGR, - ALLEGRO_KEYMOD_LWIN, ALLEGRO_KEYMOD_RWIN, ALLEGRO_KEYMOD_MENU, - ALLEGRO_KEYMOD_SCROLLLOCK, ALLEGRO_KEYMOD_NUMLOCK, ALLEGRO_KEYMOD_CAPSLOCK + A5O_KEYMOD_SHIFT, A5O_KEYMOD_SHIFT, A5O_KEYMOD_CTRL, + A5O_KEYMOD_CTRL, A5O_KEYMOD_ALT, A5O_KEYMOD_ALTGR, + A5O_KEYMOD_LWIN, A5O_KEYMOD_RWIN, A5O_KEYMOD_MENU, + A5O_KEYMOD_SCROLLLOCK, A5O_KEYMOD_NUMLOCK, A5O_KEYMOD_CAPSLOCK }; @@ -233,10 +233,10 @@ static int keycode_to_char(int keycode) /* build kernel keymap number */ keymap = 0; - if (modifiers & ALLEGRO_KEYMOD_SHIFT) keymap |= 1; - if (modifiers & ALLEGRO_KEYMOD_ALTGR) keymap |= 2; - if (modifiers & ALLEGRO_KEYMOD_CTRL) keymap |= 4; - if (modifiers & ALLEGRO_KEYMOD_ALT) keymap |= 8; + if (modifiers & A5O_KEYMOD_SHIFT) keymap |= 1; + if (modifiers & A5O_KEYMOD_ALTGR) keymap |= 2; + if (modifiers & A5O_KEYMOD_CTRL) keymap |= 4; + if (modifiers & A5O_KEYMOD_ALT) keymap |= 8; /* map keycode to type and value */ kbe.kb_table = keymap; @@ -267,7 +267,7 @@ static int keycode_to_char(int keycode) case KT_LETTER: /* apply capslock translation. */ - if (modifiers & ALLEGRO_KEYMOD_CAPSLOCK) + if (modifiers & A5O_KEYMOD_CAPSLOCK) return ascii ^ 0x20; else return ascii; @@ -279,7 +279,7 @@ static int keycode_to_char(int keycode) case KT_PAD: { int val = KVAL(kbe.kb_value); - if (modifiers & ALLEGRO_KEYMOD_NUMLOCK) { + if (modifiers & A5O_KEYMOD_NUMLOCK) { if ((val >= 0) && (val < NUM_PAD_KEYS)) ascii = pad_asciis[val]; } else { @@ -379,9 +379,9 @@ static bool lkeybd_init_keyboard(void) the_keyboard.key_led_flag = !strncmp(value, "true", 4); } - ALLEGRO_DEBUG("Three finger flag enabled: %s\n", + A5O_DEBUG("Three finger flag enabled: %s\n", the_keyboard.three_finger_flag ? "true" : "false"); - ALLEGRO_DEBUG("Key LED toggle enabled: %s\n", + A5O_DEBUG("Key LED toggle enabled: %s\n", the_keyboard.key_led_flag ? "true" : "false"); /* Initialise the keyboard object for use as an event source. */ @@ -440,11 +440,11 @@ static void lkeybd_exit_keyboard(void) /* lkeybd_get_keyboard: - * Returns the address of a ALLEGRO_KEYBOARD structure representing the keyboard. + * Returns the address of a A5O_KEYBOARD structure representing the keyboard. */ -static ALLEGRO_KEYBOARD *lkeybd_get_keyboard(void) +static A5O_KEYBOARD *lkeybd_get_keyboard(void) { - return (ALLEGRO_KEYBOARD *)&the_keyboard; + return (A5O_KEYBOARD *)&the_keyboard; } @@ -456,9 +456,9 @@ static bool lkeybd_set_keyboard_leds(int leds) { int val = 0; - if (leds & ALLEGRO_KEYMOD_SCROLLLOCK) val |= LED_SCR; - if (leds & ALLEGRO_KEYMOD_NUMLOCK) val |= LED_NUM; - if (leds & ALLEGRO_KEYMOD_CAPSLOCK) val |= LED_CAP; + if (leds & A5O_KEYMOD_SCROLLLOCK) val |= LED_SCR; + if (leds & A5O_KEYMOD_NUMLOCK) val |= LED_NUM; + if (leds & A5O_KEYMOD_CAPSLOCK) val |= LED_CAP; return (ioctl(the_keyboard.fd, KDSETLED, val) == 0) ? true : false; } @@ -468,7 +468,7 @@ static bool lkeybd_set_keyboard_leds(int leds) /* lkeybd_get_keyboard_state: [primary thread] * Copy the current keyboard state into RET_STATE, with any necessary locking. */ -static void lkeybd_get_keyboard_state(ALLEGRO_KEYBOARD_STATE *ret_state) +static void lkeybd_get_keyboard_state(A5O_KEYBOARD_STATE *ret_state) { _al_event_source_lock(&the_keyboard.parent.es); { @@ -535,8 +535,8 @@ static void process_character(unsigned char ch) return; /* process modifiers */ - if (mycode >= ALLEGRO_KEY_MODIFIERS) { - int flag = modifier_table[mycode - ALLEGRO_KEY_MODIFIERS]; + if (mycode >= A5O_KEY_MODIFIERS) { + int flag = modifier_table[mycode - A5O_KEY_MODIFIERS]; if (press) { if (flag & KB_MODIFIERS) the_keyboard.modifiers |= flag; @@ -545,7 +545,7 @@ static void process_character(unsigned char ch) } else { /* XXX: if the user presses LCTRL, then RCTRL, then releases - * LCTRL, the ALLEGRO_KEYMOD_CTRL modifier should still be on. + * LCTRL, the A5O_KEYMOD_CTRL modifier should still be on. */ if (flag & KB_MODIFIERS) the_keyboard.modifiers &= ~flag; @@ -575,9 +575,9 @@ static void process_character(unsigned char ch) /* three-finger salute for killing the program */ if ((the_keyboard.three_finger_flag) - && ((mycode == ALLEGRO_KEY_DELETE) || (mycode == ALLEGRO_KEY_END)) - && (the_keyboard.modifiers & ALLEGRO_KEYMOD_CTRL) - && (the_keyboard.modifiers & ALLEGRO_KEYMOD_ALT)) + && ((mycode == A5O_KEY_DELETE) || (mycode == A5O_KEY_END)) + && (the_keyboard.modifiers & A5O_KEYMOD_CTRL) + && (the_keyboard.modifiers & A5O_KEYMOD_ALT)) { kill(main_pid, SIGTERM); } @@ -590,12 +590,12 @@ static void process_character(unsigned char ch) */ static void handle_key_press(int mycode, unsigned int ascii) { - ALLEGRO_EVENT_TYPE event_type; - ALLEGRO_EVENT event; + A5O_EVENT_TYPE event_type; + A5O_EVENT event; event_type = (_AL_KEYBOARD_STATE_KEY_DOWN(the_keyboard.state, mycode) - ? ALLEGRO_EVENT_KEY_CHAR - : ALLEGRO_EVENT_KEY_DOWN); + ? A5O_EVENT_KEY_CHAR + : A5O_EVENT_KEY_DOWN); /* Maintain the key_down array. */ _AL_KEYBOARD_STATE_SET_KEY_DOWN(the_keyboard.state, mycode); @@ -614,8 +614,8 @@ static void handle_key_press(int mycode, unsigned int ascii) _al_event_source_emit_event(&the_keyboard.parent.es, &event); /* The first press should generate a KEY_CHAR also */ - if (event_type == ALLEGRO_EVENT_KEY_DOWN) { - event.keyboard.type = ALLEGRO_EVENT_KEY_CHAR; + if (event_type == A5O_EVENT_KEY_DOWN) { + event.keyboard.type = A5O_EVENT_KEY_CHAR; event.keyboard.timestamp = al_get_time(); _al_event_source_emit_event(&the_keyboard.parent.es, &event); } @@ -628,7 +628,7 @@ static void handle_key_press(int mycode, unsigned int ascii) */ static void handle_key_release(int mycode) { - ALLEGRO_EVENT event; + A5O_EVENT event; /* This can happen, e.g. when we are switching back into a VT with * ALT+Fn, we only get the release event of the function key. @@ -643,7 +643,7 @@ static void handle_key_release(int mycode) if (!_al_event_source_needs_to_generate_event(&the_keyboard.parent.es)) return; - event.keyboard.type = ALLEGRO_EVENT_KEY_UP; + event.keyboard.type = A5O_EVENT_KEY_UP; event.keyboard.timestamp = al_get_time(); event.keyboard.display = NULL; event.keyboard.keycode = mycode; diff --git a/src/linux/lmsedrv.c b/src/linux/lmsedrv.c index 3a6bcab4fb..28dcb24e00 100644 --- a/src/linux/lmsedrv.c +++ b/src/linux/lmsedrv.c @@ -22,7 +22,7 @@ #include "allegro5/platform/aintunix.h" #include "allegro5/platform/aintlnx.h" -#ifdef ALLEGRO_RASPBERRYPI +#ifdef A5O_RASPBERRYPI #include "allegro5/internal/aintern_raspberrypi.h" #endif @@ -38,7 +38,7 @@ _AL_DRIVER_INFO _al_linux_mouse_driver_list[] = /* { MOUSEDRV_LINUX_IMS, &mousedrv_linux_ims, true },*/ /* { MOUSEDRV_LINUX_PS2, &mousedrv_linux_ps2, true },*/ /* { MOUSEDRV_LINUX_IPS2, &mousedrv_linux_ips2, true },*/ -#if defined ALLEGRO_HAVE_LINUX_INPUT_H || defined ALLEGRO_RASPBERRYPI +#if defined A5O_HAVE_LINUX_INPUT_H || defined A5O_RASPBERRYPI { AL_MOUSEDRV_LINUX_EVDEV, &_al_mousedrv_linux_evdev, true }, #endif { 0, NULL, 0 } diff --git a/src/linux/lmseev.c b/src/linux/lmseev.c index da83804de7..2c32cfdb86 100644 --- a/src/linux/lmseev.c +++ b/src/linux/lmseev.c @@ -21,20 +21,20 @@ */ -#define ALLEGRO_NO_COMPATIBILITY +#define A5O_NO_COMPATIBILITY #include "allegro5/allegro.h" -#ifdef ALLEGRO_HAVE_LINUX_INPUT_H +#ifdef A5O_HAVE_LINUX_INPUT_H -ALLEGRO_DEBUG_CHANNEL("lmseev"); +A5O_DEBUG_CHANNEL("lmseev"); #include "allegro5/internal/aintern.h" #include "allegro5/internal/aintern_mouse.h" #include "allegro5/platform/aintunix.h" #include "allegro5/platform/aintlnx.h" -#ifdef ALLEGRO_RASPBERRYPI +#ifdef A5O_RASPBERRYPI #include "allegro5/internal/aintern_system.h" #include "allegro5/internal/aintern_display.h" #include "allegro5/internal/aintern_vector.h" @@ -52,9 +52,9 @@ ALLEGRO_DEBUG_CHANNEL("lmseev"); typedef struct AL_MOUSE_EVDEV { - ALLEGRO_MOUSE parent; + A5O_MOUSE parent; int fd; - ALLEGRO_MOUSE_STATE state; + A5O_MOUSE_STATE state; } AL_MOUSE_EVDEV; @@ -231,7 +231,7 @@ static void get_axis_value(int fd, AXIS *axis, int type) static int has_event(int fd, unsigned short type, unsigned short code) { const unsigned int len = sizeof(unsigned long)*8; - const unsigned int max = _ALLEGRO_MAX(EV_MAX, _ALLEGRO_MAX(KEY_MAX, _ALLEGRO_MAX(REL_MAX, _ALLEGRO_MAX(ABS_MAX, _ALLEGRO_MAX(LED_MAX, _ALLEGRO_MAX(SND_MAX, FF_MAX)))))); + const unsigned int max = _A5O_MAX(EV_MAX, _A5O_MAX(KEY_MAX, _A5O_MAX(REL_MAX, _A5O_MAX(ABS_MAX, _A5O_MAX(LED_MAX, _A5O_MAX(SND_MAX, FF_MAX)))))); unsigned long bits[(max+len-1)/len]; if (ioctl(fd, EVIOCGBIT(type, max), bits)) { return (bits[code/len] >> (code%len)) & 1; @@ -396,11 +396,11 @@ static void handle_button_event(unsigned int button, bool is_down) if (is_down) { the_mouse.state.buttons |= (1 << (button-1)); - event_type = ALLEGRO_EVENT_MOUSE_BUTTON_DOWN; + event_type = A5O_EVENT_MOUSE_BUTTON_DOWN; } else { the_mouse.state.buttons &=~ (1 << (button-1)); - event_type = ALLEGRO_EVENT_MOUSE_BUTTON_UP; + event_type = A5O_EVENT_MOUSE_BUTTON_UP; } generate_mouse_event( @@ -480,8 +480,8 @@ static void process_abs(const struct input_event *event) static void handle_axis_event(int dx, int dy, int dz) { if (current_tool != no_tool) { - x_axis.out_abs = _ALLEGRO_CLAMP(x_axis.out_min, x_axis.out_abs, x_axis.out_max); - y_axis.out_abs = _ALLEGRO_CLAMP(y_axis.out_min, y_axis.out_abs, y_axis.out_max); + x_axis.out_abs = _A5O_CLAMP(x_axis.out_min, x_axis.out_abs, x_axis.out_max); + y_axis.out_abs = _A5O_CLAMP(y_axis.out_min, y_axis.out_abs, y_axis.out_max); /* There's no range for z */ the_mouse.state.x = x_axis.out_abs; @@ -491,7 +491,7 @@ static void handle_axis_event(int dx, int dy, int dz) dz *= al_get_mouse_wheel_precision(); generate_mouse_event( - ALLEGRO_EVENT_MOUSE_AXES, + A5O_EVENT_MOUSE_AXES, the_mouse.state.x, the_mouse.state.y, the_mouse.state.z, dx, dy, dz, 0); @@ -510,13 +510,13 @@ static int open_mouse_device (const char *device_file) fd = open (device_file, O_RDONLY | O_NONBLOCK); if (fd >= 0) { - ALLEGRO_DEBUG("Opened device %s\n", device_file); + A5O_DEBUG("Opened device %s\n", device_file); /* The device is a mouse if it has a BTN_MOUSE */ if (has_event(fd, EV_KEY, BTN_MOUSE)) { - ALLEGRO_DEBUG("Device %s was a mouse.\n", device_file); + A5O_DEBUG("Device %s was a mouse.\n", device_file); } else { - ALLEGRO_DEBUG("Device %s was not mouse, closing.\n", device_file); + A5O_DEBUG("Device %s was not mouse, closing.\n", device_file); close(fd); fd = -1; } @@ -550,7 +550,7 @@ static bool mouse_init (void) NULL }; int i; - ALLEGRO_DEBUG("Trying /dev/input/event[0-3] devices\n"); + A5O_DEBUG("Trying /dev/input/event[0-3] devices\n"); for (i=0; device_name[i]; i++) { the_mouse.fd = open_mouse_device (device_name[i]); @@ -597,11 +597,11 @@ static void mouse_exit (void) /* mouse_get_mouse: - * Returns the address of a ALLEGRO_MOUSE structure representing the mouse. + * Returns the address of a A5O_MOUSE structure representing the mouse. */ -static ALLEGRO_MOUSE *mouse_get_mouse(void) +static A5O_MOUSE *mouse_get_mouse(void) { - return (ALLEGRO_MOUSE *)&the_mouse; + return (A5O_MOUSE *)&the_mouse; } @@ -634,7 +634,7 @@ static unsigned int mouse_get_mouse_num_axes(void) /* mouse_set_mouse_xy: * */ -static bool mouse_set_mouse_xy(ALLEGRO_DISPLAY *display, int x, int y) +static bool mouse_set_mouse_xy(A5O_DISPLAY *display, int x, int y) { (void)display; @@ -642,8 +642,8 @@ static bool mouse_set_mouse_xy(ALLEGRO_DISPLAY *display, int x, int y) { int dx, dy; - x_axis.out_abs = _ALLEGRO_CLAMP(x_axis.out_min, x, x_axis.out_max); - y_axis.out_abs = _ALLEGRO_CLAMP(y_axis.out_min, y, y_axis.out_max); + x_axis.out_abs = _A5O_CLAMP(x_axis.out_min, x, x_axis.out_max); + y_axis.out_abs = _A5O_CLAMP(y_axis.out_min, y, y_axis.out_max); x_axis.mickeys = 0; y_axis.mickeys = 0; @@ -655,7 +655,7 @@ static bool mouse_set_mouse_xy(ALLEGRO_DISPLAY *display, int x, int y) the_mouse.state.y = y_axis.out_abs; generate_mouse_event( - ALLEGRO_EVENT_MOUSE_AXES, + A5O_EVENT_MOUSE_AXES, the_mouse.state.x, the_mouse.state.y, the_mouse.state.z, dx, dy, 0, 0); @@ -690,7 +690,7 @@ static bool mouse_set_mouse_axis(int which, int z) the_mouse.state.z = z_axis.out_abs; generate_mouse_event( - ALLEGRO_EVENT_MOUSE_AXES, + A5O_EVENT_MOUSE_AXES, the_mouse.state.x, the_mouse.state.y, the_mouse.state.z, 0, 0, dz, 0); @@ -717,8 +717,8 @@ bool _al_evdev_set_mouse_range(int x1, int y1, int x2, int y2) x_axis.out_max = x2; y_axis.out_max = y2; - x_axis.out_abs = _ALLEGRO_CLAMP(x_axis.out_min, x_axis.out_abs, x_axis.out_max); - y_axis.out_abs = _ALLEGRO_CLAMP(y_axis.out_min, y_axis.out_abs, y_axis.out_max); + x_axis.out_abs = _A5O_CLAMP(x_axis.out_min, x_axis.out_abs, x_axis.out_max); + y_axis.out_abs = _A5O_CLAMP(y_axis.out_min, y_axis.out_abs, y_axis.out_max); dx = x_axis.out_abs - the_mouse.state.x; dy = y_axis.out_abs - the_mouse.state.y; @@ -728,7 +728,7 @@ bool _al_evdev_set_mouse_range(int x1, int y1, int x2, int y2) the_mouse.state.y = y_axis.out_abs; generate_mouse_event( - ALLEGRO_EVENT_MOUSE_AXES, + A5O_EVENT_MOUSE_AXES, the_mouse.state.x, the_mouse.state.y, the_mouse.state.z, dx, dy, 0, 0); @@ -744,7 +744,7 @@ bool _al_evdev_set_mouse_range(int x1, int y1, int x2, int y2) /* mouse_get_state: * Copy the current mouse state into RET_STATE, with any necessary locking. */ -static void mouse_get_state(ALLEGRO_MOUSE_STATE *ret_state) +static void mouse_get_state(A5O_MOUSE_STATE *ret_state) { _al_event_source_lock(&the_mouse.parent.es); { @@ -803,7 +803,7 @@ static void generate_mouse_event(unsigned int type, int dx, int dy, int dz, unsigned int button) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (!_al_event_source_needs_to_generate_event(&the_mouse.parent.es)) return; @@ -825,7 +825,7 @@ static void generate_mouse_event(unsigned int type, /* the driver vtable */ -ALLEGRO_MOUSE_DRIVER _al_mousedrv_linux_evdev = +A5O_MOUSE_DRIVER _al_mousedrv_linux_evdev = { AL_MOUSEDRV_LINUX_EVDEV, "", @@ -843,7 +843,7 @@ ALLEGRO_MOUSE_DRIVER _al_mousedrv_linux_evdev = -#endif /* ALLEGRO_HAVE_LINUX_INPUT_H */ +#endif /* A5O_HAVE_LINUX_INPUT_H */ /* * Local Variables: diff --git a/src/macosx/hidjoy-10.4.m b/src/macosx/hidjoy-10.4.m index 55a419ac9b..2935471590 100644 --- a/src/macosx/hidjoy-10.4.m +++ b/src/macosx/hidjoy-10.4.m @@ -22,27 +22,27 @@ #import -#ifndef ALLEGRO_MACOSX +#ifndef A5O_MACOSX #error something is wrong with the makefile #endif -ALLEGRO_DEBUG_CHANNEL("MacOSX") +A5O_DEBUG_CHANNEL("MacOSX") #define _AL_MAX_JOYSTICKS 8 static bool init_joystick(void); static void exit_joystick(void); static int num_joysticks(void); -static ALLEGRO_JOYSTICK* get_joystick(int); -static void release_joystick(ALLEGRO_JOYSTICK*); -static void get_joystick_state(ALLEGRO_JOYSTICK*, ALLEGRO_JOYSTICK_STATE*); +static A5O_JOYSTICK* get_joystick(int); +static void release_joystick(A5O_JOYSTICK*); +static void get_joystick_state(A5O_JOYSTICK*, A5O_JOYSTICK_STATE*); /* OSX HID Joystick * Maintains an array of links which connect a HID cookie to - * an element in the ALLEGRO_JOYSTICK_STATE structure. + * an element in the A5O_JOYSTICK_STATE structure. */ typedef struct { - ALLEGRO_JOYSTICK parent; + A5O_JOYSTICK parent; struct { IOHIDElementCookie cookie; int* ppressed; @@ -56,13 +56,13 @@ int stick, axis; } axis_link[_AL_MAX_JOYSTICK_AXES * _AL_MAX_JOYSTICK_STICKS]; int num_axis_links; - ALLEGRO_JOYSTICK_STATE state; + A5O_JOYSTICK_STATE state; IOHIDDeviceInterface122** interface; IOHIDQueueInterface** queue; CFRunLoopSourceRef source; -} ALLEGRO_JOYSTICK_OSX; +} A5O_JOYSTICK_OSX; -static ALLEGRO_JOYSTICK_OSX joysticks[_AL_MAX_JOYSTICKS]; +static A5O_JOYSTICK_OSX joysticks[_AL_MAX_JOYSTICKS]; static unsigned int joystick_count; /* create_device_iterator: @@ -113,10 +113,10 @@ static BOOL create_interface(io_object_t device, IOHIDDeviceInterface122*** inte */ static void joystick_callback(void *target, IOReturn result, void *refcon __attribute__((unused)), void *sender) { - ALLEGRO_JOYSTICK_OSX* joy = (ALLEGRO_JOYSTICK_OSX*) target; + A5O_JOYSTICK_OSX* joy = (A5O_JOYSTICK_OSX*) target; IOHIDQueueInterface** queue = (IOHIDQueueInterface**) sender; AbsoluteTime past = {0,0}; - ALLEGRO_EVENT_SOURCE *src = al_get_joystick_event_source(); + A5O_EVENT_SOURCE *src = al_get_joystick_event_source(); if (src == NULL) { return; } @@ -132,11 +132,11 @@ static void joystick_callback(void *target, IOReturn result, void *refcon __attr if (*joy->button_link[i].ppressed != newvalue) { *joy->button_link[i].ppressed = newvalue; // emit event - ALLEGRO_EVENT evt; + A5O_EVENT evt; if (newvalue) - evt.type = ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN; + evt.type = A5O_EVENT_JOYSTICK_BUTTON_DOWN; else - evt.type = ALLEGRO_EVENT_JOYSTICK_BUTTON_UP; + evt.type = A5O_EVENT_JOYSTICK_BUTTON_UP; evt.joystick.button = i; _al_event_source_emit_event(src, &evt); } @@ -149,8 +149,8 @@ static void joystick_callback(void *target, IOReturn result, void *refcon __attr joy->axis_link[i].intvalue = newvalue; *joy->axis_link[i].pvalue = (joy->axis_link[i].offset + newvalue) * joy->axis_link[i].multiplier; // emit event - ALLEGRO_EVENT evt; - evt.type = ALLEGRO_EVENT_JOYSTICK_AXIS; + A5O_EVENT evt; + evt.type = A5O_EVENT_JOYSTICK_AXIS; evt.joystick.axis = joy->axis_link[i].axis; evt.joystick.pos = *joy->axis_link[i].pvalue; evt.joystick.stick = joy->axis_link[i].stick; @@ -177,7 +177,7 @@ static void joystick_callback(void *target, IOReturn result, void *refcon __attr */ static void add_device(io_object_t device) { - ALLEGRO_JOYSTICK_OSX* joy; + A5O_JOYSTICK_OSX* joy; NSArray* elements = nil; int num_buttons = 0; BOOL have_x = NO, have_y = NO; @@ -212,11 +212,11 @@ static void add_device(io_object_t device) if (name == nil) { name = [NSString stringWithFormat:@"Button %d", (num_buttons+1)]; } - ALLEGRO_INFO("Found button named \"%s\"\n", [name UTF8String]); + A5O_INFO("Found button named \"%s\"\n", [name UTF8String]); // Say that we want events from this button err = (*queue)->addElement(queue, joy->button_link[num_buttons].cookie, 0); if (err != 0) { - ALLEGRO_WARN("Button named \"%s\" NOT added to event queue\n", [name UTF8String]); + A5O_WARN("Button named \"%s\" NOT added to event queue\n", [name UTF8String]); } else { joy->parent.info.button[num_buttons].name = strdup([name UTF8String]); ++num_buttons; @@ -237,11 +237,11 @@ static void add_device(io_object_t device) if (name == nil) { name = @"X-axis"; } - ALLEGRO_INFO("Found X-axis named \"%s\"\n", [name UTF8String]); + A5O_INFO("Found X-axis named \"%s\"\n", [name UTF8String]); // Say that we want events from this axis err = (*queue)->addElement(queue, joy->axis_link[0].cookie, 0); if (err != 0) { - ALLEGRO_WARN("X-axis named \"%s\" NOT added to event queue\n", [name UTF8String]); + A5O_WARN("X-axis named \"%s\" NOT added to event queue\n", [name UTF8String]); } else { have_x = YES; joy->parent.info.stick[0].axis[0].name = strdup([name UTF8String]); @@ -260,11 +260,11 @@ static void add_device(io_object_t device) if (name == nil) { name = @"Y-axis"; } - ALLEGRO_INFO("Found Y-axis named \"%s\"\n", [name UTF8String]); + A5O_INFO("Found Y-axis named \"%s\"\n", [name UTF8String]); // Say that we want events from this axis err = (*queue)->addElement(queue, joy->axis_link[1].cookie, 0); if (err != 0) { - ALLEGRO_WARN("Y-axis named \"%s\" NOT added to event queue\n", [name UTF8String]); + A5O_WARN("Y-axis named \"%s\" NOT added to event queue\n", [name UTF8String]); } else { have_y = YES; joy->parent.info.stick[0].axis[1].name = strdup([name UTF8String]); @@ -285,13 +285,13 @@ static void add_device(io_object_t device) } // FIXME! -static const char *get_joystick_name(ALLEGRO_JOYSTICK *joy_) +static const char *get_joystick_name(A5O_JOYSTICK *joy_) { (void)joy_; return "Joystick"; } -static bool get_joystick_active(ALLEGRO_JOYSTICK *joy_) +static bool get_joystick_active(A5O_JOYSTICK *joy_) { (void)joy_; return true; @@ -302,9 +302,9 @@ static bool reconfigure_joysticks(void) return false; } -ALLEGRO_JOYSTICK_DRIVER* _al_osx_get_joystick_driver_10_4(void) +A5O_JOYSTICK_DRIVER* _al_osx_get_joystick_driver_10_4(void) { - static ALLEGRO_JOYSTICK_DRIVER* vt = NULL; + static A5O_JOYSTICK_DRIVER* vt = NULL; if (vt == NULL) { vt = al_malloc(sizeof(*vt)); memset(vt, 0, sizeof(*vt)); @@ -349,7 +349,7 @@ static bool init_joystick(void) unsigned int i; CFRunLoopRef current = CFRunLoopGetCurrent(); for (i=0; isource,kCFRunLoopDefaultMode); (*joy->queue)->start(joy->queue); } @@ -369,14 +369,14 @@ static void exit_joystick(void) unsigned int i; CFRunLoopRef current = CFRunLoopGetCurrent(); for (i=0; iqueue)->stop(joy->queue); CFRunLoopRemoveSource(current,joy->source,kCFRunLoopDefaultMode); } }); unsigned int i; for (i=0; i< joystick_count; ++i) { - ALLEGRO_JOYSTICK_OSX* joy = &joysticks[i]; + A5O_JOYSTICK_OSX* joy = &joysticks[i]; CFRelease(joy->source); if (joy->queue) { (*joy->queue)->dispose(joy->queue); @@ -413,11 +413,11 @@ static int num_joysticks(void) /* get_joystick: * Get a pointer to a joystick structure */ -static ALLEGRO_JOYSTICK* get_joystick(int index) +static A5O_JOYSTICK* get_joystick(int index) { - ALLEGRO_JOYSTICK* joy = NULL; + A5O_JOYSTICK* joy = NULL; if (index >= 0 && index < (int) joystick_count) { - joy = (ALLEGRO_JOYSTICK *)&joysticks[index]; + joy = (A5O_JOYSTICK *)&joysticks[index]; } return joy; } @@ -425,7 +425,7 @@ static int num_joysticks(void) /* release_joystick: * Release a pointer that has been obtained */ -static void release_joystick(ALLEGRO_JOYSTICK* joy __attribute__((unused)) ) +static void release_joystick(A5O_JOYSTICK* joy __attribute__((unused)) ) { // No-op } @@ -433,9 +433,9 @@ static void release_joystick(ALLEGRO_JOYSTICK* joy __attribute__((unused)) ) /* get_joystick_state: * Get the current status of a joystick */ -static void get_joystick_state(ALLEGRO_JOYSTICK* ajoy, ALLEGRO_JOYSTICK_STATE* state) +static void get_joystick_state(A5O_JOYSTICK* ajoy, A5O_JOYSTICK_STATE* state) { - ALLEGRO_JOYSTICK_OSX* joy = (ALLEGRO_JOYSTICK_OSX*) ajoy; + A5O_JOYSTICK_OSX* joy = (A5O_JOYSTICK_OSX*) ajoy; memcpy(state, &joy->state,sizeof(*state)); } diff --git a/src/macosx/hidjoy.m b/src/macosx/hidjoy.m index fce924aa45..83682f142c 100644 --- a/src/macosx/hidjoy.m +++ b/src/macosx/hidjoy.m @@ -22,7 +22,7 @@ #import #import -#ifndef ALLEGRO_MACOSX +#ifndef A5O_MACOSX #error something is wrong with the makefile #endif @@ -51,7 +51,7 @@ #define GAMEPAD_USAGE_NUMBER 0x05 typedef struct { - ALLEGRO_JOYSTICK parent; + A5O_JOYSTICK parent; IOHIDElementRef buttons[_AL_MAX_JOYSTICK_BUTTONS]; IOHIDElementRef axes[_AL_MAX_JOYSTICK_STICKS][_AL_MAX_JOYSTICK_AXES]; IOHIDElementRef dpad; @@ -61,18 +61,18 @@ long min[_AL_MAX_JOYSTICK_STICKS][_AL_MAX_JOYSTICK_AXES]; long max[_AL_MAX_JOYSTICK_STICKS][_AL_MAX_JOYSTICK_AXES]; CONFIG_STATE cfg_state; - ALLEGRO_JOYSTICK_STATE state; + A5O_JOYSTICK_STATE state; IOHIDDeviceRef ident; char *name; -} ALLEGRO_JOYSTICK_OSX; +} A5O_JOYSTICK_OSX; static IOHIDManagerRef hidManagerRef; static _AL_VECTOR joysticks; static CONFIG_STATE new_joystick_state = JOY_STATE_ALIVE; static bool initialized = false; -static ALLEGRO_MUTEX *add_mutex; +static A5O_MUTEX *add_mutex; -ALLEGRO_DEBUG_CHANNEL("MacOSX") +A5O_DEBUG_CHANNEL("MacOSX") // function to create matching dictionary (for devices) static CFMutableDictionaryRef CreateDeviceMatchingDictionary( @@ -131,11 +131,11 @@ static CFMutableDictionaryRef CreateDeviceMatchingDictionary( return result; } -static ALLEGRO_JOYSTICK_OSX *find_joystick(IOHIDDeviceRef ident) +static A5O_JOYSTICK_OSX *find_joystick(IOHIDDeviceRef ident) { int i; for (i = 0; i < (int)_al_vector_size(&joysticks); i++) { - ALLEGRO_JOYSTICK_OSX *joy = *(ALLEGRO_JOYSTICK_OSX **)_al_vector_ref(&joysticks, i); + A5O_JOYSTICK_OSX *joy = *(A5O_JOYSTICK_OSX **)_al_vector_ref(&joysticks, i); if (ident == joy->ident) { return joy; } @@ -154,7 +154,7 @@ static CFMutableDictionaryRef CreateDeviceMatchingDictionary( return default_name; } -static void joy_null(ALLEGRO_JOYSTICK_OSX *joy) +static void joy_null(A5O_JOYSTICK_OSX *joy) { int i, j; @@ -170,7 +170,7 @@ static void joy_null(ALLEGRO_JOYSTICK_OSX *joy) } } -static void add_axis(ALLEGRO_JOYSTICK_OSX *joy, int stick_index, int axis_index, int min, int max, char *name, IOHIDElementRef elem) +static void add_axis(A5O_JOYSTICK_OSX *joy, int stick_index, int axis_index, int min, int max, char *name, IOHIDElementRef elem) { if (axis_index >= _AL_MAX_JOYSTICK_AXES) return; @@ -183,7 +183,7 @@ static void add_axis(ALLEGRO_JOYSTICK_OSX *joy, int stick_index, int axis_index, joy->axes[stick_index][axis_index] = elem; } -static void add_elements(CFArrayRef elements, ALLEGRO_JOYSTICK_OSX *joy) +static void add_elements(CFArrayRef elements, A5O_JOYSTICK_OSX *joy) { int i; char default_name[100]; @@ -303,8 +303,8 @@ static void osx_joy_generate_configure_event(void) { if (!initialized) return; - ALLEGRO_EVENT event; - event.joystick.type = ALLEGRO_EVENT_JOYSTICK_CONFIGURATION; + A5O_EVENT event; + event.joystick.type = A5O_EVENT_JOYSTICK_CONFIGURATION; event.joystick.timestamp = al_current_time(); _al_generate_joystick_event(&event); @@ -314,7 +314,7 @@ static void add_joystick_device(IOHIDDeviceRef ref, bool emit_reconfigure_event) { al_lock_mutex(add_mutex); - ALLEGRO_JOYSTICK_OSX *joy = find_joystick(ref); + A5O_JOYSTICK_OSX *joy = find_joystick(ref); if (joy && (joy->cfg_state == JOY_STATE_BORN || joy->cfg_state == JOY_STATE_ALIVE)) { @@ -323,9 +323,9 @@ static void add_joystick_device(IOHIDDeviceRef ref, bool emit_reconfigure_event) } if (joy == NULL) { - joy = al_calloc(1, sizeof(ALLEGRO_JOYSTICK_OSX)); + joy = al_calloc(1, sizeof(A5O_JOYSTICK_OSX)); joy->ident = ref; - ALLEGRO_JOYSTICK_OSX **back = _al_vector_alloc_back(&joysticks); + A5O_JOYSTICK_OSX **back = _al_vector_alloc_back(&joysticks); *back = joy; } @@ -345,7 +345,7 @@ static void add_joystick_device(IOHIDDeviceRef ref, bool emit_reconfigure_event) if (emit_reconfigure_event) osx_joy_generate_configure_event(); - ALLEGRO_INFO("Found joystick (%d buttons, %d sticks)\n", + A5O_INFO("Found joystick (%d buttons, %d sticks)\n", joy->parent.info.num_buttons, joy->parent.info.num_sticks); } @@ -402,7 +402,7 @@ static void device_remove_callback( int i; for (i = 0; i < (int)_al_vector_size(&joysticks); i++) { - ALLEGRO_JOYSTICK_OSX *joy = *(ALLEGRO_JOYSTICK_OSX **)_al_vector_ref(&joysticks, i); + A5O_JOYSTICK_OSX *joy = *(A5O_JOYSTICK_OSX **)_al_vector_ref(&joysticks, i); if (joy->ident == ref) { joy->cfg_state = JOY_STATE_DYING; osx_joy_generate_configure_event(); @@ -411,19 +411,19 @@ static void device_remove_callback( } } -static void osx_joy_generate_axis_event(ALLEGRO_JOYSTICK_OSX *joy, int stick, int axis, float pos) +static void osx_joy_generate_axis_event(A5O_JOYSTICK_OSX *joy, int stick, int axis, float pos) { joy->state.stick[stick].axis[axis] = pos; - ALLEGRO_EVENT event; - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_EVENT event; + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); if (!_al_event_source_needs_to_generate_event(es)) return; - event.joystick.type = ALLEGRO_EVENT_JOYSTICK_AXIS; + event.joystick.type = A5O_EVENT_JOYSTICK_AXIS; event.joystick.timestamp = al_current_time(); - event.joystick.id = (ALLEGRO_JOYSTICK *)joy; + event.joystick.id = (A5O_JOYSTICK *)joy; event.joystick.stick = stick; event.joystick.axis = axis; event.joystick.pos = pos; @@ -432,20 +432,20 @@ static void osx_joy_generate_axis_event(ALLEGRO_JOYSTICK_OSX *joy, int stick, in _al_event_source_emit_event(es, &event); } -static void osx_joy_generate_button_event(ALLEGRO_JOYSTICK_OSX *joy, int button, ALLEGRO_EVENT_TYPE event_type) +static void osx_joy_generate_button_event(A5O_JOYSTICK_OSX *joy, int button, A5O_EVENT_TYPE event_type) { - joy->state.button[button] = event_type == ALLEGRO_EVENT_JOYSTICK_BUTTON_UP ? + joy->state.button[button] = event_type == A5O_EVENT_JOYSTICK_BUTTON_UP ? 0 : 1;; - ALLEGRO_EVENT event; - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_EVENT event; + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); if (!_al_event_source_needs_to_generate_event(es)) return; event.joystick.type = event_type; event.joystick.timestamp = al_current_time(); - event.joystick.id = (ALLEGRO_JOYSTICK *)joy; + event.joystick.id = (A5O_JOYSTICK *)joy; event.joystick.stick = 0; event.joystick.axis = 0; event.joystick.pos = 0.0; @@ -483,21 +483,21 @@ static void value_callback( IOHIDElementRef elem = IOHIDValueGetElement(value); IOHIDDeviceRef ref = IOHIDElementGetDevice(elem); - ALLEGRO_JOYSTICK_OSX *joy = find_joystick(ref); + A5O_JOYSTICK_OSX *joy = find_joystick(ref); if (!joy) return; - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); _al_event_source_lock(es); int i; for (i = 0; i < joy->parent.info.num_buttons; i++) { if (joy->buttons[i] == elem) { - ALLEGRO_EVENT_TYPE type; + A5O_EVENT_TYPE type; if (IOHIDValueGetIntegerValue(value) == 0) - type = ALLEGRO_EVENT_JOYSTICK_BUTTON_UP; + type = A5O_EVENT_JOYSTICK_BUTTON_UP; else - type = ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN; + type = A5O_EVENT_JOYSTICK_BUTTON_DOWN; osx_joy_generate_button_event(joy, i, type); goto done; } @@ -569,7 +569,7 @@ static bool init_joystick(void) ); if (CFGetTypeID(hidManagerRef) != IOHIDManagerGetTypeID()) { - ALLEGRO_ERROR("Unable to create HID Manager\n"); + A5O_ERROR("Unable to create HID Manager\n"); return false; } @@ -626,7 +626,7 @@ static bool init_joystick(void) kCFRunLoopDefaultMode ); - _al_vector_init(&joysticks, sizeof(ALLEGRO_JOYSTICK_OSX *)); + _al_vector_init(&joysticks, sizeof(A5O_JOYSTICK_OSX *)); al_lock_mutex(add_mutex); @@ -688,7 +688,7 @@ static int num_joysticks(void) int i; int count = 0; for (i = 0; i < (int)_al_vector_size(&joysticks); i++) { - ALLEGRO_JOYSTICK_OSX *joy = *(ALLEGRO_JOYSTICK_OSX **)_al_vector_ref(&joysticks, i); + A5O_JOYSTICK_OSX *joy = *(A5O_JOYSTICK_OSX **)_al_vector_ref(&joysticks, i); if (joy->cfg_state == JOY_STATE_ALIVE) { count++; } @@ -700,18 +700,18 @@ static int num_joysticks(void) /* get_joystick: * Get a pointer to a joystick structure */ -static ALLEGRO_JOYSTICK* get_joystick(int index) +static A5O_JOYSTICK* get_joystick(int index) { ASSERT(index >= 0 && index < (int)_al_vector_size(&joysticks)); int i; int count = 0; for (i = 0; i < (int)_al_vector_size(&joysticks); i++) { - ALLEGRO_JOYSTICK_OSX *joy = *(ALLEGRO_JOYSTICK_OSX **)_al_vector_ref(&joysticks, i); + A5O_JOYSTICK_OSX *joy = *(A5O_JOYSTICK_OSX **)_al_vector_ref(&joysticks, i); if (joy->cfg_state == JOY_STATE_ALIVE || joy->cfg_state == JOY_STATE_DYING) { if (count == index) { - return (ALLEGRO_JOYSTICK *)joy; + return (A5O_JOYSTICK *)joy; } count++; } @@ -723,7 +723,7 @@ static int num_joysticks(void) /* release_joystick: * Release a pointer that has been obtained */ -static void release_joystick(ALLEGRO_JOYSTICK* joy __attribute__((unused)) ) +static void release_joystick(A5O_JOYSTICK* joy __attribute__((unused)) ) { // No-op } @@ -731,10 +731,10 @@ static void release_joystick(ALLEGRO_JOYSTICK* joy __attribute__((unused)) ) /* get_joystick_state: * Get the current status of a joystick */ -static void get_joystick_state(ALLEGRO_JOYSTICK *joy_, ALLEGRO_JOYSTICK_STATE *ret_state) +static void get_joystick_state(A5O_JOYSTICK *joy_, A5O_JOYSTICK_STATE *ret_state) { - ALLEGRO_JOYSTICK_OSX *joy = (ALLEGRO_JOYSTICK_OSX *) joy_; - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_JOYSTICK_OSX *joy = (A5O_JOYSTICK_OSX *) joy_; + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); _al_event_source_lock(es); { @@ -748,7 +748,7 @@ static bool reconfigure_joysticks(void) int i; bool ret = false; for (i = 0; i < (int)_al_vector_size(&joysticks); i++) { - ALLEGRO_JOYSTICK_OSX *joy = *(ALLEGRO_JOYSTICK_OSX **)_al_vector_ref(&joysticks, i); + A5O_JOYSTICK_OSX *joy = *(A5O_JOYSTICK_OSX **)_al_vector_ref(&joysticks, i); if (joy->cfg_state == JOY_STATE_DYING) { joy->cfg_state = JOY_STATE_UNUSED; for (i = 0; i < _AL_MAX_JOYSTICK_BUTTONS; i++) { @@ -763,7 +763,7 @@ static bool reconfigure_joysticks(void) } joy_null(joy); memset(joy->buttons, 0, _AL_MAX_JOYSTICK_BUTTONS*sizeof(IOHIDElementRef)); - memset(&joy->state, 0, sizeof(ALLEGRO_JOYSTICK_STATE)); + memset(&joy->state, 0, sizeof(A5O_JOYSTICK_STATE)); joy->dpad=0; } else if (joy->cfg_state == JOY_STATE_BORN) @@ -776,9 +776,9 @@ static bool reconfigure_joysticks(void) return ret; } -static const char *get_joystick_name(ALLEGRO_JOYSTICK *joy_) +static const char *get_joystick_name(A5O_JOYSTICK *joy_) { - ALLEGRO_JOYSTICK_OSX *joy = (ALLEGRO_JOYSTICK_OSX *)joy_; + A5O_JOYSTICK_OSX *joy = (A5O_JOYSTICK_OSX *)joy_; CFStringRef str; str = IOHIDDeviceGetProperty(joy->ident, CFSTR(kIOHIDProductKey)); @@ -798,15 +798,15 @@ static bool reconfigure_joysticks(void) return "Joystick"; } -static bool get_joystick_active(ALLEGRO_JOYSTICK *joy_) +static bool get_joystick_active(A5O_JOYSTICK *joy_) { - ALLEGRO_JOYSTICK_OSX *joy = (ALLEGRO_JOYSTICK_OSX *)joy_; + A5O_JOYSTICK_OSX *joy = (A5O_JOYSTICK_OSX *)joy_; return joy->cfg_state == JOY_STATE_ALIVE || joy->cfg_state == JOY_STATE_DYING; } -ALLEGRO_JOYSTICK_DRIVER* _al_osx_get_joystick_driver_10_5(void) +A5O_JOYSTICK_DRIVER* _al_osx_get_joystick_driver_10_5(void) { - static ALLEGRO_JOYSTICK_DRIVER* vt = NULL; + static A5O_JOYSTICK_DRIVER* vt = NULL; if (vt == NULL) { vt = al_malloc(sizeof(*vt)); memset(vt, 0, sizeof(*vt)); @@ -832,10 +832,10 @@ static bool get_joystick_active(ALLEGRO_JOYSTICK *joy_) -ALLEGRO_JOYSTICK_DRIVER* _al_osx_get_joystick_driver_10_4(void); -ALLEGRO_JOYSTICK_DRIVER* _al_osx_get_joystick_driver_10_5(void); +A5O_JOYSTICK_DRIVER* _al_osx_get_joystick_driver_10_4(void); +A5O_JOYSTICK_DRIVER* _al_osx_get_joystick_driver_10_5(void); -ALLEGRO_JOYSTICK_DRIVER* _al_osx_get_joystick_driver(void) +A5O_JOYSTICK_DRIVER* _al_osx_get_joystick_driver(void) { if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_5) { return _al_osx_get_joystick_driver_10_5(); diff --git a/src/macosx/hidman.m b/src/macosx/hidman.m index 74f6af20c8..315a831854 100644 --- a/src/macosx/hidman.m +++ b/src/macosx/hidman.m @@ -22,7 +22,7 @@ #include "allegro5/internal/aintern_keyboard.h" #include "allegro5/platform/aintosx.h" -#ifndef ALLEGRO_MACOSX +#ifndef A5O_MACOSX #error Something is wrong with the makefile #endif diff --git a/src/macosx/keybd.m b/src/macosx/keybd.m index 6a46309124..ec36dfd334 100644 --- a/src/macosx/keybd.m +++ b/src/macosx/keybd.m @@ -25,7 +25,7 @@ #include "allegro5/internal/aintern_keyboard.h" #include "allegro5/platform/aintosx.h" -#ifndef ALLEGRO_MACOSX +#ifndef A5O_MACOSX #error Something is wrong with the makefile #endif @@ -35,20 +35,20 @@ * and key codes. */ static unsigned const int mod_info[5][3] = { - { NSAlphaShiftKeyMask, ALLEGRO_KEYMOD_CAPSLOCK, ALLEGRO_KEY_CAPSLOCK }, - { NSShiftKeyMask, ALLEGRO_KEYMOD_SHIFT, ALLEGRO_KEY_LSHIFT }, - { NSControlKeyMask, ALLEGRO_KEYMOD_CTRL, ALLEGRO_KEY_LCTRL }, - { NSAlternateKeyMask, ALLEGRO_KEYMOD_ALT, ALLEGRO_KEY_ALT }, - { NSCommandKeyMask, ALLEGRO_KEYMOD_COMMAND, ALLEGRO_KEY_COMMAND } + { NSAlphaShiftKeyMask, A5O_KEYMOD_CAPSLOCK, A5O_KEY_CAPSLOCK }, + { NSShiftKeyMask, A5O_KEYMOD_SHIFT, A5O_KEY_LSHIFT }, + { NSControlKeyMask, A5O_KEYMOD_CTRL, A5O_KEY_LCTRL }, + { NSAlternateKeyMask, A5O_KEYMOD_ALT, A5O_KEY_ALT }, + { NSCommandKeyMask, A5O_KEYMOD_COMMAND, A5O_KEY_COMMAND } }; static bool osx_keyboard_init(void); static void osx_keyboard_exit(void); -static ALLEGRO_KEYBOARD* osx_get_keyboard(void); -static ALLEGRO_KEYBOARD keyboard; -static ALLEGRO_KEYBOARD_STATE kbdstate; +static A5O_KEYBOARD* osx_get_keyboard(void); +static A5O_KEYBOARD keyboard; +static A5O_KEYBOARD_STATE kbdstate; @@ -73,7 +73,7 @@ static int translate_modifier_flags(int osx_mods) /* _al_osx_switch_keyboard_focus: * Handle a focus switch event. */ -void _al_osx_switch_keyboard_focus(ALLEGRO_DISPLAY *dpy, bool switch_in) +void _al_osx_switch_keyboard_focus(A5O_DISPLAY *dpy, bool switch_in) { _al_event_source_lock(&keyboard.es); @@ -87,15 +87,15 @@ void _al_osx_switch_keyboard_focus(ALLEGRO_DISPLAY *dpy, bool switch_in) -static void _handle_key_press(ALLEGRO_DISPLAY* dpy, int unicode, int scancode, +static void _handle_key_press(A5O_DISPLAY* dpy, int unicode, int scancode, int modifiers, bool is_repeat) { _al_event_source_lock(&keyboard.es); { /* Generate the press event if necessary. */ if (_al_event_source_needs_to_generate_event(&keyboard.es)) { - ALLEGRO_EVENT event; - event.keyboard.type = ALLEGRO_EVENT_KEY_DOWN; + A5O_EVENT event; + event.keyboard.type = A5O_EVENT_KEY_DOWN; event.keyboard.timestamp = al_get_time(); event.keyboard.display = dpy; event.keyboard.keycode = scancode; @@ -111,7 +111,7 @@ static void _handle_key_press(ALLEGRO_DISPLAY* dpy, int unicode, int scancode, if (unicode >= 0xF700 && unicode <= 0xF747) { unicode = 0; } - event.keyboard.type = ALLEGRO_EVENT_KEY_CHAR; + event.keyboard.type = A5O_EVENT_KEY_CHAR; event.keyboard.unichar = unicode; event.keyboard.modifiers = modifiers; event.keyboard.repeat = is_repeat; @@ -126,14 +126,14 @@ static void _handle_key_press(ALLEGRO_DISPLAY* dpy, int unicode, int scancode, -static void _handle_key_release(ALLEGRO_DISPLAY* dpy, int modifiers, int scancode) +static void _handle_key_release(A5O_DISPLAY* dpy, int modifiers, int scancode) { _al_event_source_lock(&keyboard.es); { /* Generate the release event if necessary. */ if (_al_event_source_needs_to_generate_event(&keyboard.es)) { - ALLEGRO_EVENT event; - event.keyboard.type = ALLEGRO_EVENT_KEY_UP; + A5O_EVENT event; + event.keyboard.type = A5O_EVENT_KEY_UP; event.keyboard.timestamp = al_get_time(); event.keyboard.display = dpy; event.keyboard.keycode = scancode; @@ -152,38 +152,38 @@ static void _handle_key_release(ALLEGRO_DISPLAY* dpy, int modifiers, int scancod /* Mac keycode to Allegro scancode conversion table */ static const int mac_to_scancode[128] = { - /* 0x00 */ ALLEGRO_KEY_A, ALLEGRO_KEY_S, ALLEGRO_KEY_D, ALLEGRO_KEY_F, - /* 0x04 */ ALLEGRO_KEY_H, ALLEGRO_KEY_G, ALLEGRO_KEY_Z, ALLEGRO_KEY_X, - /* 0x08 */ ALLEGRO_KEY_C, ALLEGRO_KEY_V, 0, ALLEGRO_KEY_B, - /* 0x0c */ ALLEGRO_KEY_Q, ALLEGRO_KEY_W, ALLEGRO_KEY_E, ALLEGRO_KEY_R, - /* 0x10 */ ALLEGRO_KEY_Y, ALLEGRO_KEY_T, ALLEGRO_KEY_1, ALLEGRO_KEY_2, - /* 0x14 */ ALLEGRO_KEY_3, ALLEGRO_KEY_4, ALLEGRO_KEY_6, ALLEGRO_KEY_5, - /* 0x18 */ ALLEGRO_KEY_EQUALS, ALLEGRO_KEY_9, ALLEGRO_KEY_7, ALLEGRO_KEY_MINUS, - /* 0x1c */ ALLEGRO_KEY_8, ALLEGRO_KEY_0, ALLEGRO_KEY_CLOSEBRACE, ALLEGRO_KEY_O, - /* 0x20 */ ALLEGRO_KEY_U, ALLEGRO_KEY_OPENBRACE, ALLEGRO_KEY_I, ALLEGRO_KEY_P, - /* 0x24 */ ALLEGRO_KEY_ENTER, ALLEGRO_KEY_L, ALLEGRO_KEY_J, ALLEGRO_KEY_QUOTE, - /* 0x28 */ ALLEGRO_KEY_K, ALLEGRO_KEY_SEMICOLON, ALLEGRO_KEY_BACKSLASH, ALLEGRO_KEY_COMMA, - /* 0x2c */ ALLEGRO_KEY_SLASH, ALLEGRO_KEY_N, ALLEGRO_KEY_M, ALLEGRO_KEY_FULLSTOP, - /* 0x30 */ ALLEGRO_KEY_TAB, ALLEGRO_KEY_SPACE, ALLEGRO_KEY_BACKQUOTE, ALLEGRO_KEY_BACKSPACE, - /* 0x34 */ ALLEGRO_KEY_ENTER, ALLEGRO_KEY_ESCAPE, 0, ALLEGRO_KEY_COMMAND, - /* 0x38 */ ALLEGRO_KEY_LSHIFT, ALLEGRO_KEY_CAPSLOCK, ALLEGRO_KEY_ALT, ALLEGRO_KEY_LEFT, - /* 0x3c */ ALLEGRO_KEY_RIGHT, ALLEGRO_KEY_DOWN, ALLEGRO_KEY_UP, 0, - /* 0x40 */ 0, ALLEGRO_KEY_FULLSTOP, 0, ALLEGRO_KEY_PAD_ASTERISK, - /* 0x44 */ 0, ALLEGRO_KEY_PAD_PLUS, 0, ALLEGRO_KEY_NUMLOCK, - /* 0x48 */ 0, 0, 0, ALLEGRO_KEY_PAD_SLASH, - /* 0x4c */ ALLEGRO_KEY_PAD_ENTER,0, ALLEGRO_KEY_PAD_MINUS, 0, - /* 0x50 */ 0, ALLEGRO_KEY_PAD_EQUALS, ALLEGRO_KEY_PAD_0, ALLEGRO_KEY_PAD_1, - /* 0x54 */ ALLEGRO_KEY_PAD_2, ALLEGRO_KEY_PAD_3, ALLEGRO_KEY_PAD_4, ALLEGRO_KEY_PAD_5, - /* 0x58 */ ALLEGRO_KEY_PAD_6, ALLEGRO_KEY_PAD_7, 0, ALLEGRO_KEY_PAD_8, - /* 0x5c */ ALLEGRO_KEY_PAD_9, 0, 0, 0, - /* 0x60 */ ALLEGRO_KEY_F5, ALLEGRO_KEY_F6, ALLEGRO_KEY_F7, ALLEGRO_KEY_F3, - /* 0x64 */ ALLEGRO_KEY_F8, ALLEGRO_KEY_F9, 0, ALLEGRO_KEY_F11, - /* 0x68 */ 0, ALLEGRO_KEY_PRINTSCREEN,0, ALLEGRO_KEY_SCROLLLOCK, - /* 0x6c */ 0, ALLEGRO_KEY_F10, 0, ALLEGRO_KEY_F12, - /* 0x70 */ 0, ALLEGRO_KEY_PAUSE, ALLEGRO_KEY_INSERT, ALLEGRO_KEY_HOME, - /* 0x74 */ ALLEGRO_KEY_PGUP, ALLEGRO_KEY_DELETE, ALLEGRO_KEY_F4, ALLEGRO_KEY_END, - /* 0x78 */ ALLEGRO_KEY_F2, ALLEGRO_KEY_PGDN, ALLEGRO_KEY_F1, ALLEGRO_KEY_LEFT, - /* 0x7c */ ALLEGRO_KEY_RIGHT, ALLEGRO_KEY_DOWN, ALLEGRO_KEY_UP, 0 + /* 0x00 */ A5O_KEY_A, A5O_KEY_S, A5O_KEY_D, A5O_KEY_F, + /* 0x04 */ A5O_KEY_H, A5O_KEY_G, A5O_KEY_Z, A5O_KEY_X, + /* 0x08 */ A5O_KEY_C, A5O_KEY_V, 0, A5O_KEY_B, + /* 0x0c */ A5O_KEY_Q, A5O_KEY_W, A5O_KEY_E, A5O_KEY_R, + /* 0x10 */ A5O_KEY_Y, A5O_KEY_T, A5O_KEY_1, A5O_KEY_2, + /* 0x14 */ A5O_KEY_3, A5O_KEY_4, A5O_KEY_6, A5O_KEY_5, + /* 0x18 */ A5O_KEY_EQUALS, A5O_KEY_9, A5O_KEY_7, A5O_KEY_MINUS, + /* 0x1c */ A5O_KEY_8, A5O_KEY_0, A5O_KEY_CLOSEBRACE, A5O_KEY_O, + /* 0x20 */ A5O_KEY_U, A5O_KEY_OPENBRACE, A5O_KEY_I, A5O_KEY_P, + /* 0x24 */ A5O_KEY_ENTER, A5O_KEY_L, A5O_KEY_J, A5O_KEY_QUOTE, + /* 0x28 */ A5O_KEY_K, A5O_KEY_SEMICOLON, A5O_KEY_BACKSLASH, A5O_KEY_COMMA, + /* 0x2c */ A5O_KEY_SLASH, A5O_KEY_N, A5O_KEY_M, A5O_KEY_FULLSTOP, + /* 0x30 */ A5O_KEY_TAB, A5O_KEY_SPACE, A5O_KEY_BACKQUOTE, A5O_KEY_BACKSPACE, + /* 0x34 */ A5O_KEY_ENTER, A5O_KEY_ESCAPE, 0, A5O_KEY_COMMAND, + /* 0x38 */ A5O_KEY_LSHIFT, A5O_KEY_CAPSLOCK, A5O_KEY_ALT, A5O_KEY_LEFT, + /* 0x3c */ A5O_KEY_RIGHT, A5O_KEY_DOWN, A5O_KEY_UP, 0, + /* 0x40 */ 0, A5O_KEY_FULLSTOP, 0, A5O_KEY_PAD_ASTERISK, + /* 0x44 */ 0, A5O_KEY_PAD_PLUS, 0, A5O_KEY_NUMLOCK, + /* 0x48 */ 0, 0, 0, A5O_KEY_PAD_SLASH, + /* 0x4c */ A5O_KEY_PAD_ENTER,0, A5O_KEY_PAD_MINUS, 0, + /* 0x50 */ 0, A5O_KEY_PAD_EQUALS, A5O_KEY_PAD_0, A5O_KEY_PAD_1, + /* 0x54 */ A5O_KEY_PAD_2, A5O_KEY_PAD_3, A5O_KEY_PAD_4, A5O_KEY_PAD_5, + /* 0x58 */ A5O_KEY_PAD_6, A5O_KEY_PAD_7, 0, A5O_KEY_PAD_8, + /* 0x5c */ A5O_KEY_PAD_9, 0, 0, 0, + /* 0x60 */ A5O_KEY_F5, A5O_KEY_F6, A5O_KEY_F7, A5O_KEY_F3, + /* 0x64 */ A5O_KEY_F8, A5O_KEY_F9, 0, A5O_KEY_F11, + /* 0x68 */ 0, A5O_KEY_PRINTSCREEN,0, A5O_KEY_SCROLLLOCK, + /* 0x6c */ 0, A5O_KEY_F10, 0, A5O_KEY_F12, + /* 0x70 */ 0, A5O_KEY_PAUSE, A5O_KEY_INSERT, A5O_KEY_HOME, + /* 0x74 */ A5O_KEY_PGUP, A5O_KEY_DELETE, A5O_KEY_F4, A5O_KEY_END, + /* 0x78 */ A5O_KEY_F2, A5O_KEY_PGDN, A5O_KEY_F1, A5O_KEY_LEFT, + /* 0x7c */ A5O_KEY_RIGHT, A5O_KEY_DOWN, A5O_KEY_UP, 0 }; @@ -191,11 +191,11 @@ static void _handle_key_release(ALLEGRO_DISPLAY* dpy, int modifiers, int scancod /* get_state: * Copy a snapshot of the keyboard state into the user's structure */ -static void get_state(ALLEGRO_KEYBOARD_STATE *ret_state) +static void get_state(A5O_KEYBOARD_STATE *ret_state) { _al_event_source_lock(&keyboard.es); { - memcpy(ret_state, &kbdstate, sizeof(ALLEGRO_KEYBOARD_STATE)); + memcpy(ret_state, &kbdstate, sizeof(A5O_KEYBOARD_STATE)); } _al_event_source_unlock(&keyboard.es); } @@ -216,7 +216,7 @@ static void clear_state(void) -static ALLEGRO_KEYBOARD_DRIVER keyboard_macosx = +static A5O_KEYBOARD_DRIVER keyboard_macosx = { KEYBOARD_MACOSX, "", @@ -225,8 +225,8 @@ static void clear_state(void) osx_keyboard_init, osx_keyboard_exit, osx_get_keyboard, - NULL, // ALLEGRO_METHOD(bool, set_leds, (int leds)); - NULL, // ALLEGRO_METHOD(const char *, keycode_to_name, (int keycode)); + NULL, // A5O_METHOD(bool, set_leds, (int leds)); + NULL, // A5O_METHOD(const char *, keycode_to_name, (int keycode)); get_state, clear_state, }; @@ -244,7 +244,7 @@ static void clear_state(void) /* _al_osx_get_keyboard_driver: * Returns the keyboard driver. */ -ALLEGRO_KEYBOARD_DRIVER* _al_osx_get_keyboard_driver(void) +A5O_KEYBOARD_DRIVER* _al_osx_get_keyboard_driver(void) { return &keyboard_macosx; } @@ -254,7 +254,7 @@ static void clear_state(void) /* _al_osx_keyboard_handler: * Keyboard "interrupt" handler. */ -void _al_osx_keyboard_handler(int pressed, NSEvent *event, ALLEGRO_DISPLAY* dpy) +void _al_osx_keyboard_handler(int pressed, NSEvent *event, A5O_DISPLAY* dpy) { /* We need to distinguish between the raw character code (needed for * ctrl and alt) and the "shifted" character code when neither of these @@ -273,7 +273,7 @@ void _al_osx_keyboard_handler(int pressed, NSEvent *event, ALLEGRO_DISPLAY* dpy) const unichar upper_character =([upper_characters length] > 0) ? [upper_characters characterAtIndex: 0] : 0; bool is_repeat = pressed ? ([event isARepeat] == YES) : false; /* Special processing to send character 1 for CTRL-A, 2 for CTRL-B etc. */ - if ((key_shifts & ALLEGRO_KEYMOD_CTRL) && (isalpha(raw_character))) + if ((key_shifts & A5O_KEYMOD_CTRL) && (isalpha(raw_character))) _handle_key_press(dpy, tolower(raw_character) - 'a' + 1, scancode, key_shifts, is_repeat); else _handle_key_press(dpy, upper_character, scancode, key_shifts, is_repeat); @@ -288,7 +288,7 @@ void _al_osx_keyboard_handler(int pressed, NSEvent *event, ALLEGRO_DISPLAY* dpy) /* _al_osx_keyboard_modifier: * Handles keyboard modifiers changes. */ -void _al_osx_keyboard_modifiers(unsigned int modifiers, ALLEGRO_DISPLAY* dpy) +void _al_osx_keyboard_modifiers(unsigned int modifiers, A5O_DISPLAY* dpy) { static unsigned int old_modifiers = 0; int i, changed; @@ -348,7 +348,7 @@ static void osx_keyboard_exit(void) /* osx_get_keyboard: * Returns the keyboard object. */ -static ALLEGRO_KEYBOARD* osx_get_keyboard(void) +static A5O_KEYBOARD* osx_get_keyboard(void) { return &keyboard; } diff --git a/src/macosx/osxclipboard.m b/src/macosx/osxclipboard.m index 9eae91b984..2d73581570 100644 --- a/src/macosx/osxclipboard.m +++ b/src/macosx/osxclipboard.m @@ -26,7 +26,7 @@ #include "allegro5/platform/aintosx.h" #include "./osxgl.h" -#ifndef ALLEGRO_MACOSX +#ifndef A5O_MACOSX #error Something is wrong with the makefile #endif @@ -35,7 +35,7 @@ #define NSAppKitVersionNumber10_6 1038 #endif -static NSString *osx_get_text_format(ALLEGRO_DISPLAY *display) +static NSString *osx_get_text_format(A5O_DISPLAY *display) { (void) display; @@ -54,7 +54,7 @@ #endif } -static bool osx_set_clipboard_text(ALLEGRO_DISPLAY *display, const char *text) +static bool osx_set_clipboard_text(A5O_DISPLAY *display, const char *text) { NSAutoreleasePool *pool; NSPasteboard *pasteboard; @@ -75,7 +75,7 @@ static bool osx_set_clipboard_text(ALLEGRO_DISPLAY *display, const char *text) return ok == YES; } -static char * osx_get_clipboard_text(ALLEGRO_DISPLAY *display) +static char * osx_get_clipboard_text(A5O_DISPLAY *display) { NSAutoreleasePool *pool; NSPasteboard *pasteboard; @@ -110,7 +110,7 @@ static bool osx_set_clipboard_text(ALLEGRO_DISPLAY *display, const char *text) return text; } -static bool osx_has_clipboard_text(ALLEGRO_DISPLAY *display) +static bool osx_has_clipboard_text(A5O_DISPLAY *display) { NSAutoreleasePool *pool; NSPasteboard *pasteboard; @@ -136,7 +136,7 @@ static bool osx_has_clipboard_text(ALLEGRO_DISPLAY *display) return result; } -void _al_osx_add_clipboard_functions(ALLEGRO_DISPLAY_INTERFACE *vt) +void _al_osx_add_clipboard_functions(A5O_DISPLAY_INTERFACE *vt) { vt->set_clipboard_text = osx_set_clipboard_text; vt->get_clipboard_text = osx_get_clipboard_text; diff --git a/src/macosx/osxgl.h b/src/macosx/osxgl.h index c460df701f..b241657748 100644 --- a/src/macosx/osxgl.h +++ b/src/macosx/osxgl.h @@ -12,16 +12,16 @@ #define AL_OSX_NUM_PFA 64 @interface ALWindow : NSWindow { - ALLEGRO_DISPLAY* display; + A5O_DISPLAY* display; } -@property ALLEGRO_DISPLAY *display; +@property A5O_DISPLAY *display; @end -/* This is our version of ALLEGRO_DISPLAY with driver specific extra data. */ -typedef struct ALLEGRO_DISPLAY_OSX_WIN { - ALLEGRO_DISPLAY parent; +/* This is our version of A5O_DISPLAY with driver specific extra data. */ +typedef struct A5O_DISPLAY_OSX_WIN { + A5O_DISPLAY parent; int depth; NSOpenGLContext* ctx; NSOpenGLPixelFormatAttribute attributes[AL_OSX_NUM_PFA]; @@ -36,22 +36,22 @@ typedef struct ALLEGRO_DISPLAY_OSX_WIN { BOOL single_buffer; CGDisplayModeRef original_mode; BOOL send_halt_events; - ALLEGRO_MUTEX *halt_mutex; - ALLEGRO_COND *halt_cond; + A5O_MUTEX *halt_mutex; + A5O_COND *halt_cond; BOOL halt_event_acknowledged; /* For new (10.14+) vsyncing. */ CVDisplayLinkRef display_link; - ALLEGRO_MUTEX *flip_mutex; - ALLEGRO_COND *flip_cond; + A5O_MUTEX *flip_mutex; + A5O_COND *flip_cond; int num_flips; /* These two store the old window size when restoring from a FS window. */ int old_w; int old_h; -} ALLEGRO_DISPLAY_OSX_WIN; +} A5O_DISPLAY_OSX_WIN; -/* This is our version of ALLEGRO_MOUSE_CURSOR */ -typedef struct ALLEGRO_MOUSE_CURSOR_OSX +/* This is our version of A5O_MOUSE_CURSOR */ +typedef struct A5O_MOUSE_CURSOR_OSX { NSCursor *cursor; -} ALLEGRO_MOUSE_CURSOR_OSX; +} A5O_MOUSE_CURSOR_OSX; diff --git a/src/macosx/osxgl.m b/src/macosx/osxgl.m index c35883d484..7b2f7204ff 100644 --- a/src/macosx/osxgl.m +++ b/src/macosx/osxgl.m @@ -27,14 +27,14 @@ #include "allegro5/platform/aintosx.h" #include "./osxgl.h" #include "allegro5/allegro_osx.h" -#ifndef ALLEGRO_MACOSX +#ifndef A5O_MACOSX #error something is wrong with the makefile #endif #import #import -ALLEGRO_DEBUG_CHANNEL("MacOSX") +A5O_DEBUG_CHANNEL("MacOSX") /* Many Cocoa methods can only be called from the main thread, but Allegro runs the user's code on a separate thread or threads. It relies on `dispatch_sync` or @@ -79,7 +79,7 @@ * in a separate thread which renders TLS values incorrect. */ typedef struct OSX_DISPLAY_PARAMS { - ALLEGRO_DISPLAY_OSX_WIN* dpy; + A5O_DISPLAY_OSX_WIN* dpy; int new_window_pos_x; int new_window_pos_y; int new_display_adapter; @@ -94,73 +94,73 @@ * need an extra parameter or not (eg, colour depth). */ static const unsigned int allegro_to_osx_settings[][3] = { - { ALLEGRO_RED_SIZE, 0, 0}, // Not supported per component - { ALLEGRO_GREEN_SIZE, 0, 0}, // Not supported per component - { ALLEGRO_BLUE_SIZE, 0, 0}, // Not supported per component - { ALLEGRO_ALPHA_SIZE, NSOpenGLPFAAlphaSize, 1}, - { ALLEGRO_RED_SHIFT, 0, 0}, // Not available - { ALLEGRO_GREEN_SHIFT, 0, 0}, // Not available - { ALLEGRO_BLUE_SHIFT, 0, 0}, // Not available - { ALLEGRO_ALPHA_SHIFT, 0, 0}, // Not available - { ALLEGRO_ACC_RED_SIZE, NSOpenGLPFAAccumSize, 1}, // Correct? - { ALLEGRO_ACC_GREEN_SIZE, NSOpenGLPFAAccumSize, 1}, // Correct? - { ALLEGRO_ACC_BLUE_SIZE, NSOpenGLPFAAccumSize, 1}, // Correct? - { ALLEGRO_ACC_ALPHA_SIZE, NSOpenGLPFAAccumSize, 1}, // Correct? - { ALLEGRO_STEREO, NSOpenGLPFAStereo, 0}, - { ALLEGRO_AUX_BUFFERS, NSOpenGLPFAAuxBuffers, 1}, - { ALLEGRO_COLOR_SIZE, NSOpenGLPFAColorSize, 1}, - { ALLEGRO_DEPTH_SIZE, NSOpenGLPFADepthSize, 1}, - { ALLEGRO_STENCIL_SIZE, NSOpenGLPFAStencilSize, 1}, - { ALLEGRO_SAMPLE_BUFFERS, NSOpenGLPFASampleBuffers, 1}, - { ALLEGRO_SAMPLES, NSOpenGLPFASamples, 1}, - //{ ALLEGRO_RENDER_METHOD, NSOpenGLPFAAccelerated, 0}, handled separately - { ALLEGRO_FLOAT_COLOR, NSOpenGLPFAColorFloat, 0}, - { ALLEGRO_FLOAT_DEPTH, 0, 0}, - //{ ALLEGRO_SINGLE_BUFFER , 0, 0}, handled separately - { ALLEGRO_SWAP_METHOD, 0, 0}, - { ALLEGRO_COMPATIBLE_DISPLAY, 0, 0}, - { ALLEGRO_DISPLAY_OPTIONS_COUNT, 0, 0} + { A5O_RED_SIZE, 0, 0}, // Not supported per component + { A5O_GREEN_SIZE, 0, 0}, // Not supported per component + { A5O_BLUE_SIZE, 0, 0}, // Not supported per component + { A5O_ALPHA_SIZE, NSOpenGLPFAAlphaSize, 1}, + { A5O_RED_SHIFT, 0, 0}, // Not available + { A5O_GREEN_SHIFT, 0, 0}, // Not available + { A5O_BLUE_SHIFT, 0, 0}, // Not available + { A5O_ALPHA_SHIFT, 0, 0}, // Not available + { A5O_ACC_RED_SIZE, NSOpenGLPFAAccumSize, 1}, // Correct? + { A5O_ACC_GREEN_SIZE, NSOpenGLPFAAccumSize, 1}, // Correct? + { A5O_ACC_BLUE_SIZE, NSOpenGLPFAAccumSize, 1}, // Correct? + { A5O_ACC_ALPHA_SIZE, NSOpenGLPFAAccumSize, 1}, // Correct? + { A5O_STEREO, NSOpenGLPFAStereo, 0}, + { A5O_AUX_BUFFERS, NSOpenGLPFAAuxBuffers, 1}, + { A5O_COLOR_SIZE, NSOpenGLPFAColorSize, 1}, + { A5O_DEPTH_SIZE, NSOpenGLPFADepthSize, 1}, + { A5O_STENCIL_SIZE, NSOpenGLPFAStencilSize, 1}, + { A5O_SAMPLE_BUFFERS, NSOpenGLPFASampleBuffers, 1}, + { A5O_SAMPLES, NSOpenGLPFASamples, 1}, + //{ A5O_RENDER_METHOD, NSOpenGLPFAAccelerated, 0}, handled separately + { A5O_FLOAT_COLOR, NSOpenGLPFAColorFloat, 0}, + { A5O_FLOAT_DEPTH, 0, 0}, + //{ A5O_SINGLE_BUFFER , 0, 0}, handled separately + { A5O_SWAP_METHOD, 0, 0}, + { A5O_COMPATIBLE_DISPLAY, 0, 0}, + { A5O_DISPLAY_OPTIONS_COUNT, 0, 0} }; static const int number_of_settings = sizeof(allegro_to_osx_settings)/sizeof(*allegro_to_osx_settings); static const char *allegro_pixel_format_names[] = { - "ALLEGRO_RED_SIZE", - "ALLEGRO_GREEN_SIZE", - "ALLEGRO_BLUE_SIZE", - "ALLEGRO_ALPHA_SIZE", - "ALLEGRO_RED_SHIFT", - "ALLEGRO_GREEN_SHIFT", - "ALLEGRO_BLUE_SHIFT", - "ALLEGRO_ALPHA_SHIFT", - "ALLEGRO_ACC_RED_SIZE", - "ALLEGRO_ACC_GREEN_SIZE", - "ALLEGRO_ACC_BLUE_SIZE", - "ALLEGRO_ACC_ALPHA_SIZE", - "ALLEGRO_STEREO", - "ALLEGRO_AUX_BUFFERS", - "ALLEGRO_COLOR_SIZE", - "ALLEGRO_DEPTH_SIZE", - "ALLEGRO_STENCIL_SIZE", - "ALLEGRO_SAMPLE_BUFFERS", - "ALLEGRO_SAMPLES", - "ALLEGRO_RENDER_METHOD", - "ALLEGRO_FLOAT_COLOR", - "ALLEGRO_FLOAT_DEPTH", - "ALLEGRO_SINGLE_BUFFER", - "ALLEGRO_SWAP_METHOD", - "ALLEGRO_COMPATIBLE_DISPLAY", - "ALLEGRO_DISPLAY_OPTIONS_COUNT" + "A5O_RED_SIZE", + "A5O_GREEN_SIZE", + "A5O_BLUE_SIZE", + "A5O_ALPHA_SIZE", + "A5O_RED_SHIFT", + "A5O_GREEN_SHIFT", + "A5O_BLUE_SHIFT", + "A5O_ALPHA_SHIFT", + "A5O_ACC_RED_SIZE", + "A5O_ACC_GREEN_SIZE", + "A5O_ACC_BLUE_SIZE", + "A5O_ACC_ALPHA_SIZE", + "A5O_STEREO", + "A5O_AUX_BUFFERS", + "A5O_COLOR_SIZE", + "A5O_DEPTH_SIZE", + "A5O_STENCIL_SIZE", + "A5O_SAMPLE_BUFFERS", + "A5O_SAMPLES", + "A5O_RENDER_METHOD", + "A5O_FLOAT_COLOR", + "A5O_FLOAT_DEPTH", + "A5O_SINGLE_BUFFER", + "A5O_SWAP_METHOD", + "A5O_COMPATIBLE_DISPLAY", + "A5O_DISPLAY_OPTIONS_COUNT" }; /* Module functions */ -ALLEGRO_DISPLAY_INTERFACE* _al_osx_get_display_driver(void); -ALLEGRO_DISPLAY_INTERFACE* _al_osx_get_display_driver_win(void); -ALLEGRO_DISPLAY_INTERFACE* _al_osx_get_display_driver_fs(void); +A5O_DISPLAY_INTERFACE* _al_osx_get_display_driver(void); +A5O_DISPLAY_INTERFACE* _al_osx_get_display_driver_win(void); +A5O_DISPLAY_INTERFACE* _al_osx_get_display_driver_fs(void); static NSOpenGLContext* osx_create_shareable_context(NSOpenGLPixelFormat* fmt, unsigned int* group); -static bool set_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff); -static bool resize_display_win(ALLEGRO_DISPLAY *d, int w, int h); -static bool resize_display_win_main_thread(ALLEGRO_DISPLAY *d, int w, int h); +static bool set_display_flag(A5O_DISPLAY *display, int flag, bool onoff); +static bool resize_display_win(A5O_DISPLAY *d, int w, int h); +static bool resize_display_win_main_thread(A5O_DISPLAY *d, int w, int h); static void clear_to_black(NSOpenGLContext *context) { @@ -185,7 +185,7 @@ static void clear_to_black(NSOpenGLContext *context) * Actually change the current cursor. This can be called fom any thread * but ensures that the change is only called from the main thread. */ -static void _al_osx_change_cursor(ALLEGRO_DISPLAY_OSX_WIN *dpy, NSCursor* cursor) +static void _al_osx_change_cursor(A5O_DISPLAY_OSX_WIN *dpy, NSCursor* cursor) { NSCursor* old = dpy->cursor; dpy->cursor = [cursor retain]; @@ -210,10 +210,10 @@ @interface ALOpenGLView : NSOpenGLView #endif { /* This is passed onto the event functions so we know where the event came from */ - ALLEGRO_DISPLAY* dpy_ptr; + A5O_DISPLAY* dpy_ptr; } --(void)setAllegroDisplay: (ALLEGRO_DISPLAY*) ptr; --(ALLEGRO_DISPLAY*) allegroDisplay; +-(void)setAllegroDisplay: (A5O_DISPLAY*) ptr; +-(A5O_DISPLAY*) allegroDisplay; -(void) reshape; -(BOOL) acceptsFirstResponder; -(void) keyDown:(NSEvent*) event; @@ -260,7 +260,7 @@ -(BOOL) canBecomeKeyWindow // main thread only -(void) zoom:(id)sender { - self.display->flags ^= ALLEGRO_MAXIMIZED; + self.display->flags ^= A5O_MAXIMIZED; [super zoom:sender]; } @@ -283,7 +283,7 @@ void _al_osx_mouse_was_installed(BOOL install) { dispatch_sync(dispatch_get_main_queue(), ^{ unsigned int i; for (i = 0; i < _al_vector_size(dpys); ++i) { - ALLEGRO_DISPLAY_OSX_WIN* dpy = *(ALLEGRO_DISPLAY_OSX_WIN**) _al_vector_ref(dpys, i); + A5O_DISPLAY_OSX_WIN* dpy = *(A5O_DISPLAY_OSX_WIN**) _al_vector_ref(dpys, i); NSWindow* window = dpy->win; if (window) { [window setAcceptsMouseMovedEvents: _osx_mouse_installed]; @@ -307,7 +307,7 @@ -(void) prepareOpenGL /* setDisplay: * Set the display this view is associated with */ --(void) setAllegroDisplay: (ALLEGRO_DISPLAY*) ptr +-(void) setAllegroDisplay: (A5O_DISPLAY*) ptr { dpy_ptr = ptr; } @@ -315,7 +315,7 @@ -(void) setAllegroDisplay: (ALLEGRO_DISPLAY*) ptr /* display * return the display this view is associated with */ --(ALLEGRO_DISPLAY*) allegroDisplay +-(A5O_DISPLAY*) allegroDisplay { return dpy_ptr; } @@ -326,7 +326,7 @@ - (void) reshape { [super reshape]; - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) dpy_ptr; + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) dpy_ptr; if (dpy->tracking) { [self removeTrackingArea: dpy->tracking]; dpy->tracking = create_tracking_area(self); @@ -418,7 +418,7 @@ -(void) mouseMoved: (NSEvent*) evt -(void) cursorUpdate: (NSEvent*) evt { if (_osx_mouse_installed) { - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) dpy_ptr; + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) dpy_ptr; _al_osx_change_cursor(dpy, dpy->cursor); } } @@ -429,7 +429,7 @@ -(void) scrollWheel: (NSEvent*) evt } /* Cursor handling */ - (void) viewDidMoveToWindow { - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) dpy_ptr; + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) dpy_ptr; if (dpy->tracking) { [self removeTrackingArea: dpy->tracking]; } @@ -438,7 +438,7 @@ - (void) viewDidMoveToWindow { } - (void) viewWillMoveToWindow: (NSWindow*) newWindow { - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) dpy_ptr; + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) dpy_ptr; (void)newWindow; if (([self window] != nil) && (dpy->tracking != 0)) { [self removeTrackingArea:dpy->tracking]; @@ -448,8 +448,8 @@ - (void) viewWillMoveToWindow: (NSWindow*) newWindow { -(void) mouseEntered: (NSEvent*) evt { - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) dpy_ptr; - ALLEGRO_EVENT_SOURCE* src = &([self allegroDisplay]->es); + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) dpy_ptr; + A5O_EVENT_SOURCE* src = &([self allegroDisplay]->es); if (dpy->show_cursor) { [dpy->cursor set]; } @@ -463,8 +463,8 @@ -(void) mouseEntered: (NSEvent*) evt } -(void) mouseExited: (NSEvent*) evt { - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) dpy_ptr; - ALLEGRO_EVENT_SOURCE* src = &([self allegroDisplay]->es); + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) dpy_ptr; + A5O_EVENT_SOURCE* src = &([self allegroDisplay]->es); if (!dpy->show_cursor) { [NSCursor unhide]; } @@ -480,10 +480,10 @@ -(void) mouseExited: (NSEvent*) evt - (BOOL)windowShouldClose:(id)sender { (void)sender; - ALLEGRO_EVENT_SOURCE* src = &([self allegroDisplay]->es); + A5O_EVENT_SOURCE* src = &([self allegroDisplay]->es); _al_event_source_lock(src); - ALLEGRO_EVENT evt; - evt.type = ALLEGRO_EVENT_DISPLAY_CLOSE; + A5O_EVENT evt; + evt.type = A5O_EVENT_DISPLAY_CLOSE; _al_event_source_emit_event(src, &evt); _al_event_source_unlock(src); return NO; @@ -493,27 +493,27 @@ - (BOOL)windowShouldClose:(id)sender -(void) viewDidChangeBackingProperties { [super viewDidChangeBackingProperties]; - if (!(al_get_display_flags(dpy_ptr) & ALLEGRO_RESIZABLE) && + if (!(al_get_display_flags(dpy_ptr) & A5O_RESIZABLE) && dpy_ptr->ogl_extras) { resize_display_win_main_thread(dpy_ptr, al_get_display_width(dpy_ptr), al_get_display_height(dpy_ptr)); } else { - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) dpy_ptr; + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) dpy_ptr; NSWindow *window = dpy->win; NSRect rc = [window frame]; NSRect content = [window contentRectForFrameRect: rc]; content = [self convertRectToBacking: content]; - ALLEGRO_EVENT_SOURCE *es = &dpy->parent.es; + A5O_EVENT_SOURCE *es = &dpy->parent.es; _al_event_source_lock(es); if (_al_event_source_needs_to_generate_event(es)) { - ALLEGRO_EVENT event; - event.display.type = ALLEGRO_EVENT_DISPLAY_RESIZE; + A5O_EVENT event; + event.display.type = A5O_EVENT_DISPLAY_RESIZE; event.display.timestamp = al_get_time(); event.display.width = NSWidth(content); event.display.height = NSHeight(content); _al_event_source_emit_event(es, &event); - ALLEGRO_INFO("Window finished resizing %d x %d\n", event.display.width, event.display.height); + A5O_INFO("Window finished resizing %d x %d\n", event.display.width, event.display.height); } _al_event_source_unlock(es); } @@ -522,8 +522,8 @@ -(void) viewDidChangeBackingProperties -(void) viewWillStartLiveResize { - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) dpy_ptr; - ALLEGRO_EVENT_SOURCE *es = &dpy->parent.es; + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) dpy_ptr; + A5O_EVENT_SOURCE *es = &dpy->parent.es; if (dpy->send_halt_events) { al_lock_mutex(dpy->halt_mutex); @@ -532,8 +532,8 @@ -(void) viewWillStartLiveResize _al_event_source_lock(es); if (_al_event_source_needs_to_generate_event(es)) { - ALLEGRO_EVENT event; - event.display.type = ALLEGRO_EVENT_DISPLAY_HALT_DRAWING; + A5O_EVENT event; + event.display.type = A5O_EVENT_DISPLAY_HALT_DRAWING; event.display.timestamp = al_get_time(); _al_event_source_emit_event(es, &event); } @@ -551,27 +551,27 @@ -(void) viewDidEndLiveResize { [super viewDidEndLiveResize]; - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) dpy_ptr; + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) dpy_ptr; NSWindow *window = dpy->win; NSRect rc = [window frame]; NSRect content = [window contentRectForFrameRect: rc]; #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 content = [self convertRectToBacking: content]; #endif - ALLEGRO_EVENT_SOURCE *es = &dpy->parent.es; + A5O_EVENT_SOURCE *es = &dpy->parent.es; _al_event_source_lock(es); if (_al_event_source_needs_to_generate_event(es)) { - ALLEGRO_EVENT event; - event.display.type = ALLEGRO_EVENT_DISPLAY_RESIZE; + A5O_EVENT event; + event.display.type = A5O_EVENT_DISPLAY_RESIZE; event.display.timestamp = al_get_time(); event.display.width = NSWidth(content); event.display.height = NSHeight(content); _al_event_source_emit_event(es, &event); - ALLEGRO_INFO("Window finished resizing %d x %d\n", event.display.width, event.display.height); + A5O_INFO("Window finished resizing %d x %d\n", event.display.width, event.display.height); if (dpy->send_halt_events) { - event.display.type = ALLEGRO_EVENT_DISPLAY_RESUME_DRAWING; + event.display.type = A5O_EVENT_DISPLAY_RESUME_DRAWING; _al_event_source_emit_event(es, &event); } } @@ -583,11 +583,11 @@ -(void) viewDidEndLiveResize -(void) windowDidBecomeMain:(NSNotification*) notification { (void)notification; - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) dpy_ptr; - ALLEGRO_EVENT_SOURCE* src = &([self allegroDisplay]->es); + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) dpy_ptr; + A5O_EVENT_SOURCE* src = &([self allegroDisplay]->es); _al_event_source_lock(src); - ALLEGRO_EVENT evt; - evt.type = ALLEGRO_EVENT_DISPLAY_SWITCH_IN; + A5O_EVENT evt; + evt.type = A5O_EVENT_DISPLAY_SWITCH_IN; _al_event_source_emit_event(src, &evt); _al_osx_switch_keyboard_focus(dpy_ptr, true); _al_event_source_unlock(src); @@ -596,10 +596,10 @@ -(void) windowDidBecomeMain:(NSNotification*) notification -(void) windowDidResignMain:(NSNotification*) notification { (void)notification; - ALLEGRO_EVENT_SOURCE* src = &([self allegroDisplay]->es); + A5O_EVENT_SOURCE* src = &([self allegroDisplay]->es); _al_event_source_lock(src); - ALLEGRO_EVENT evt; - evt.type = ALLEGRO_EVENT_DISPLAY_SWITCH_OUT; + A5O_EVENT evt; + evt.type = A5O_EVENT_DISPLAY_SWITCH_OUT; _al_event_source_emit_event(src, &evt); _al_osx_switch_keyboard_focus(dpy_ptr, false); _al_event_source_unlock(src); @@ -607,20 +607,20 @@ -(void) windowDidResignMain:(NSNotification*) notification -(void) windowDidResize:(NSNotification*) notification { (void)notification; - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) dpy_ptr; + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) dpy_ptr; NSWindow *window = dpy->win; NSRect rc = [window frame]; NSRect content = [window contentRectForFrameRect: rc]; #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 content = [self convertRectToBacking: content]; #endif - ALLEGRO_EVENT_SOURCE *es = &dpy->parent.es; + A5O_EVENT_SOURCE *es = &dpy->parent.es; /* Restore max. constraints when the window has been un-maximized. * Note: isZoomed will return false in FullScreen mode. */ if (dpy_ptr->use_constraints && - !(dpy_ptr->flags & ALLEGRO_FULLSCREEN_WINDOW) && ![window isZoomed]) + !(dpy_ptr->flags & A5O_FULLSCREEN_WINDOW) && ![window isZoomed]) { float scale_factor = 1.0; #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 @@ -636,13 +636,13 @@ -(void) windowDidResize:(NSNotification*) notification _al_event_source_lock(es); if (_al_event_source_needs_to_generate_event(es)) { - ALLEGRO_EVENT event; - event.display.type = ALLEGRO_EVENT_DISPLAY_RESIZE; + A5O_EVENT event; + event.display.type = A5O_EVENT_DISPLAY_RESIZE; event.display.timestamp = al_get_time(); event.display.width = NSWidth(content); event.display.height = NSHeight(content); _al_event_source_emit_event(es, &event); - ALLEGRO_INFO("Window was resized %d x %d\n", event.display.width, event.display.height); + A5O_INFO("Window was resized %d x %d\n", event.display.width, event.display.height); } _al_event_source_unlock(es); } @@ -650,21 +650,21 @@ -(void) windowDidResize:(NSNotification*) notification -(void)windowWillEnterFullScreen:(NSNotification *)notification { (void)notification; - ALLEGRO_DISPLAY *display = dpy_ptr; - display->flags |= ALLEGRO_FULLSCREEN_WINDOW; + A5O_DISPLAY *display = dpy_ptr; + display->flags |= A5O_FULLSCREEN_WINDOW; } -(void)windowWillExitFullScreen:(NSNotification *)notification { (void)notification; - ALLEGRO_DISPLAY *display = dpy_ptr; - display->flags &= ~ALLEGRO_FULLSCREEN_WINDOW; + A5O_DISPLAY *display = dpy_ptr; + display->flags &= ~A5O_FULLSCREEN_WINDOW; } -(void) enterFullScreenWindowMode { #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 - ALLEGRO_DISPLAY_OSX_WIN *dpy = (ALLEGRO_DISPLAY_OSX_WIN*) dpy_ptr; + A5O_DISPLAY_OSX_WIN *dpy = (A5O_DISPLAY_OSX_WIN*) dpy_ptr; NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; int flags = NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar; [dict setObject:[NSNumber numberWithInt: flags] forKey:NSFullScreenModeApplicationPresentationOptions]; @@ -679,7 +679,7 @@ -(void) enterFullScreenWindowMode /* Toggles maximize state. In OSX 10.10 this is the same as double clicking the title bar. */ -(void) maximize { - ALLEGRO_DISPLAY_OSX_WIN *dpy = (ALLEGRO_DISPLAY_OSX_WIN*) dpy_ptr; + A5O_DISPLAY_OSX_WIN *dpy = (A5O_DISPLAY_OSX_WIN*) dpy_ptr; [dpy->win performZoom: nil]; } @@ -695,7 +695,7 @@ -(NSRect) windowWillUseStandardFrame: NSSize max_size; if (dpy_ptr->use_constraints) { - if (dpy_ptr->flags & ALLEGRO_MAXIMIZED) { + if (dpy_ptr->flags & A5O_MAXIMIZED) { max_size.width = FLT_MAX; max_size.height = FLT_MAX; newFrame.size.width = max_size.width; @@ -720,7 +720,7 @@ -(NSRect) windowWillUseStandardFrame: -(void) exitFullScreenWindowMode { - ALLEGRO_DISPLAY_OSX_WIN *dpy = (ALLEGRO_DISPLAY_OSX_WIN*) dpy_ptr; + A5O_DISPLAY_OSX_WIN *dpy = (A5O_DISPLAY_OSX_WIN*) dpy_ptr; /* Going from a fullscreen window to a smaller window, the mouse may end up outside * the window when it was inside before (not possible the other way.) This causes a @@ -730,14 +730,14 @@ -(void) exitFullScreenWindowMode [dpy->win orderOut: dpy->view]; [self exitFullScreenModeWithOptions: nil]; /* Restore the title bar disabled in enterFullScreenWindowMode. */ - if (!(dpy_ptr->flags & ALLEGRO_FRAMELESS)) { + if (!(dpy_ptr->flags & A5O_FRAMELESS)) { [dpy->win setStyleMask: [dpy->win styleMask] | NSWindowStyleMaskTitled]; } } -(void) finishExitingFullScreenWindowMode { - ALLEGRO_DISPLAY_OSX_WIN *dpy = (ALLEGRO_DISPLAY_OSX_WIN*) dpy_ptr; + A5O_DISPLAY_OSX_WIN *dpy = (A5O_DISPLAY_OSX_WIN*) dpy_ptr; [dpy->win center]; [dpy->win makeKeyAndOrderFront: dpy->view]; @@ -750,8 +750,8 @@ -(void) finishExitingFullScreenWindowMode /* set_current_display: * Set the current windowed display to be current. */ -static bool set_current_display(ALLEGRO_DISPLAY* d) { - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) d; +static bool set_current_display(A5O_DISPLAY* d) { + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) d; if (dpy->ctx != nil) { [dpy->ctx makeCurrentContext]; } @@ -760,9 +760,9 @@ static bool set_current_display(ALLEGRO_DISPLAY* d) { } /* Helper to set up GL state as we want it. */ -static void setup_gl(ALLEGRO_DISPLAY *d) +static void setup_gl(A5O_DISPLAY *d) { - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) d; + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) d; [dpy->ctx performSelectorOnMainThread:@selector(update) withObject:nil waitUntilDone:YES]; _al_ogl_setup_gl(d); } @@ -771,16 +771,16 @@ static void setup_gl(ALLEGRO_DISPLAY *d) /* Fills the array of NSOpenGLPixelFormatAttributes, which has a specfied * maximum size, with the options appropriate for the display. */ -static void osx_set_opengl_pixelformat_attributes(ALLEGRO_DISPLAY_OSX_WIN *dpy) +static void osx_set_opengl_pixelformat_attributes(A5O_DISPLAY_OSX_WIN *dpy) { int i, n; bool want_double_buffer; NSOpenGLPixelFormatAttribute *a; - ALLEGRO_EXTRA_DISPLAY_SETTINGS *extras; + A5O_EXTRA_DISPLAY_SETTINGS *extras; /* The following combination of flags indicates that multi-sampling is * requested. */ - const int sample_flags = (1<parent.flags & ALLEGRO_FULLSCREEN) { + if (dpy->parent.flags & A5O_FULLSCREEN) { *a = NSOpenGLPFAFullScreen; a++; // Take over the screen. *a = NSOpenGLPFAScreenMask; a++; @@ -808,7 +808,7 @@ static void osx_set_opengl_pixelformat_attributes(ALLEGRO_DISPLAY_OSX_WIN *dpy) /* Find the requested colour depth */ if (extras) - dpy->depth = extras->settings[ALLEGRO_COLOR_SIZE]; + dpy->depth = extras->settings[A5O_COLOR_SIZE]; if (!dpy->depth) { /* Use default */ NSScreen *screen; int adapter = al_get_new_display_adapter(); @@ -822,7 +822,7 @@ static void osx_set_opengl_pixelformat_attributes(ALLEGRO_DISPLAY_OSX_WIN *dpy) dpy->depth = 32; if (dpy->depth == 15) dpy->depth = 16; - ALLEGRO_DEBUG("Using default colour depth %d\n", dpy->depth); + A5O_DEBUG("Using default colour depth %d\n", dpy->depth); } *a = NSOpenGLPFAColorSize; a++; *a = dpy->depth; a++; @@ -838,8 +838,8 @@ static void osx_set_opengl_pixelformat_attributes(ALLEGRO_DISPLAY_OSX_WIN *dpy) /* Should we set double buffering? If it's not required we don't care * and go with the default. */ - if (extras && (extras->required & (1 << ALLEGRO_SINGLE_BUFFER)) && - extras->settings[ALLEGRO_SINGLE_BUFFER]) { + if (extras && (extras->required & (1 << A5O_SINGLE_BUFFER)) && + extras->settings[A5O_SINGLE_BUFFER]) { want_double_buffer = false; dpy->single_buffer = true; } @@ -850,7 +850,7 @@ static void osx_set_opengl_pixelformat_attributes(ALLEGRO_DISPLAY_OSX_WIN *dpy) /* Detect if multi-sampling is requested */ /* Or "NSOpenGLPFASupersample" ? */ if (extras && (extras->required & sample_flags) && - (extras->settings[ALLEGRO_SAMPLES]||extras->settings[ALLEGRO_SAMPLE_BUFFERS])) { + (extras->settings[A5O_SAMPLES]||extras->settings[A5O_SAMPLE_BUFFERS])) { *a = NSOpenGLPFAMultisample; a++; } @@ -869,11 +869,11 @@ static void osx_set_opengl_pixelformat_attributes(ALLEGRO_DISPLAY_OSX_WIN *dpy) if (extras->settings[i]) { *a = allegro_to_osx_settings[n][1]; a++; *a = extras->settings[i]; a++; - ALLEGRO_DEBUG("Passing pixel format attribute %s = %d\n", allegro_pixel_format_names[n], extras->settings[i]); + A5O_DEBUG("Passing pixel format attribute %s = %d\n", allegro_pixel_format_names[n], extras->settings[i]); } } else if (extras->settings[i]) { /* Boolean, just turn this on */ *a = allegro_to_osx_settings[n][1]; a++; - ALLEGRO_DEBUG("Passing pixel format attribute %s = %d\n", allegro_pixel_format_names[n], extras->settings[i]); + A5O_DEBUG("Passing pixel format attribute %s = %d\n", allegro_pixel_format_names[n], extras->settings[i]); } } } @@ -881,7 +881,7 @@ static void osx_set_opengl_pixelformat_attributes(ALLEGRO_DISPLAY_OSX_WIN *dpy) /* Accelerated is always preferred, so we only set this for required not * for suggested. */ - if (extras->required & ALLEGRO_RENDER_METHOD) { + if (extras->required & A5O_RENDER_METHOD) { *a++ = NSOpenGLPFAAccelerated; } } @@ -890,7 +890,7 @@ static void osx_set_opengl_pixelformat_attributes(ALLEGRO_DISPLAY_OSX_WIN *dpy) /* Set the extra_settings[] array in the display, to report which options * we have selected. */ -static void osx_get_opengl_pixelformat_attributes(ALLEGRO_DISPLAY_OSX_WIN *dpy) +static void osx_get_opengl_pixelformat_attributes(A5O_DISPLAY_OSX_WIN *dpy) { int n; @@ -910,7 +910,7 @@ static void osx_get_opengl_pixelformat_attributes(ALLEGRO_DISPLAY_OSX_WIN *dpy) CGLPixelFormatObj pixel_format = CGLGetPixelFormat(ctx); GLint screen_id; CGLGetVirtualScreen(ctx, &screen_id); - ALLEGRO_DEBUG("Screen has ID %d\n", (int)screen_id); + A5O_DEBUG("Screen has ID %d\n", (int)screen_id); for (n = 0; n < number_of_settings; n++) { /* Go through the list of options and relist the ones that we have * set to Allegro's option list. @@ -930,7 +930,7 @@ static void osx_get_opengl_pixelformat_attributes(ALLEGRO_DISPLAY_OSX_WIN *dpy) value = 1; dpy->parent.extra_settings.settings[al_setting] = value; - ALLEGRO_DEBUG("Pixel format attribute %s set to %d\n", allegro_pixel_format_names[n], value); + A5O_DEBUG("Pixel format attribute %s set to %d\n", allegro_pixel_format_names[n], value); } #else /* CGLGetPixelFormat does not exist on Tiger, so we need to do something @@ -956,7 +956,7 @@ static void osx_get_opengl_pixelformat_attributes(ALLEGRO_DISPLAY_OSX_WIN *dpy) if (allegro_to_osx_settings[n][2]) value = a[1]; dpy->parent.extra_settings.settings[al_setting] = value; - ALLEGRO_DEBUG("Setting pixel format attribute %d to %d\n", al_setting, value); + A5O_DEBUG("Setting pixel format attribute %d to %d\n", al_setting, value); } /* Advance to next option */ if (allegro_to_osx_settings[n][2]) /* Has a parameter in the list */ @@ -965,24 +965,24 @@ static void osx_get_opengl_pixelformat_attributes(ALLEGRO_DISPLAY_OSX_WIN *dpy) } } #endif - dpy->parent.extra_settings.settings[ALLEGRO_COMPATIBLE_DISPLAY] = 1; + dpy->parent.extra_settings.settings[A5O_COMPATIBLE_DISPLAY] = 1; // Fill in the missing colour format options, as best we can - ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds = &dpy->parent.extra_settings; - if (eds->settings[ALLEGRO_COLOR_SIZE] == 0) { - eds->settings[ALLEGRO_COLOR_SIZE] = 32; - eds->settings[ALLEGRO_RED_SIZE] = 8; - eds->settings[ALLEGRO_GREEN_SIZE] = 8; - eds->settings[ALLEGRO_BLUE_SIZE] = 8; - eds->settings[ALLEGRO_ALPHA_SIZE] = 8; - eds->settings[ALLEGRO_RED_SHIFT] = 0; - eds->settings[ALLEGRO_GREEN_SHIFT] = 8; - eds->settings[ALLEGRO_BLUE_SHIFT] = 16; - eds->settings[ALLEGRO_ALPHA_SHIFT] = 24; + A5O_EXTRA_DISPLAY_SETTINGS *eds = &dpy->parent.extra_settings; + if (eds->settings[A5O_COLOR_SIZE] == 0) { + eds->settings[A5O_COLOR_SIZE] = 32; + eds->settings[A5O_RED_SIZE] = 8; + eds->settings[A5O_GREEN_SIZE] = 8; + eds->settings[A5O_BLUE_SIZE] = 8; + eds->settings[A5O_ALPHA_SIZE] = 8; + eds->settings[A5O_RED_SHIFT] = 0; + eds->settings[A5O_GREEN_SHIFT] = 8; + eds->settings[A5O_BLUE_SHIFT] = 16; + eds->settings[A5O_ALPHA_SHIFT] = 24; } else { - int size = eds->settings[ALLEGRO_ALPHA_SIZE]; + int size = eds->settings[A5O_ALPHA_SIZE]; if (!size) { - switch (eds->settings[ALLEGRO_COLOR_SIZE]) { + switch (eds->settings[A5O_COLOR_SIZE]) { case 32: size = 8; break; @@ -996,28 +996,28 @@ static void osx_get_opengl_pixelformat_attributes(ALLEGRO_DISPLAY_OSX_WIN *dpy) break; } } - if (!eds->settings[ALLEGRO_RED_SIZE]) - eds->settings[ALLEGRO_RED_SIZE] = size; - if (!eds->settings[ALLEGRO_BLUE_SIZE]) - eds->settings[ALLEGRO_BLUE_SIZE] = size; - if (!eds->settings[ALLEGRO_GREEN_SIZE]) - eds->settings[ALLEGRO_GREEN_SIZE] = size; - if (!eds->settings[ALLEGRO_RED_SHIFT]) - eds->settings[ALLEGRO_RED_SHIFT] = 0; - if (!eds->settings[ALLEGRO_GREEN_SHIFT]) - eds->settings[ALLEGRO_GREEN_SHIFT] = eds->settings[ALLEGRO_RED_SIZE]; - if (!eds->settings[ALLEGRO_BLUE_SHIFT]) - eds->settings[ALLEGRO_BLUE_SHIFT] = eds->settings[ALLEGRO_GREEN_SIZE]+eds->settings[ALLEGRO_GREEN_SHIFT]; - if (!eds->settings[ALLEGRO_ALPHA_SHIFT]) - eds->settings[ALLEGRO_ALPHA_SHIFT] = eds->settings[ALLEGRO_BLUE_SIZE]+eds->settings[ALLEGRO_BLUE_SHIFT]; + if (!eds->settings[A5O_RED_SIZE]) + eds->settings[A5O_RED_SIZE] = size; + if (!eds->settings[A5O_BLUE_SIZE]) + eds->settings[A5O_BLUE_SIZE] = size; + if (!eds->settings[A5O_GREEN_SIZE]) + eds->settings[A5O_GREEN_SIZE] = size; + if (!eds->settings[A5O_RED_SHIFT]) + eds->settings[A5O_RED_SHIFT] = 0; + if (!eds->settings[A5O_GREEN_SHIFT]) + eds->settings[A5O_GREEN_SHIFT] = eds->settings[A5O_RED_SIZE]; + if (!eds->settings[A5O_BLUE_SHIFT]) + eds->settings[A5O_BLUE_SHIFT] = eds->settings[A5O_GREEN_SIZE]+eds->settings[A5O_GREEN_SHIFT]; + if (!eds->settings[A5O_ALPHA_SHIFT]) + eds->settings[A5O_ALPHA_SHIFT] = eds->settings[A5O_BLUE_SIZE]+eds->settings[A5O_BLUE_SHIFT]; } } /* This function must be run on the main thread */ -static void osx_run_fullscreen_display(ALLEGRO_DISPLAY_OSX_WIN* dpy) +static void osx_run_fullscreen_display(A5O_DISPLAY_OSX_WIN* dpy) { ASSERT_MAIN_THREAD(); - ALLEGRO_DISPLAY* display = &dpy->parent; + A5O_DISPLAY* display = &dpy->parent; while (dpy->in_fullscreen) { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; // Collect an event @@ -1081,19 +1081,19 @@ static void osx_run_fullscreen_display(ALLEGRO_DISPLAY_OSX_WIN* dpy) NSOpenGLContext* compat = nil; for (i = 0; i < _al_vector_size(dpys); ++i) { - ALLEGRO_DISPLAY_OSX_WIN* other = *(ALLEGRO_DISPLAY_OSX_WIN**) _al_vector_ref(dpys, i); + A5O_DISPLAY_OSX_WIN* other = *(A5O_DISPLAY_OSX_WIN**) _al_vector_ref(dpys, i); compat = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext: other->ctx]; if (compat != nil) { // OK, we can share with this one *group = other->display_group; - ALLEGRO_DEBUG("Sharing display group %d\n", *group); + A5O_DEBUG("Sharing display group %d\n", *group); break; } } if (compat == nil) { // Set to a new group *group = next_display_group++; - ALLEGRO_DEBUG("Creating new display group %d\n", *group); + A5O_DEBUG("Creating new display group %d\n", *group); compat = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext: nil]; } return compat; @@ -1115,7 +1115,7 @@ static CVReturn display_link_callback(CVDisplayLinkRef display_link, (void)output_time; (void)flags_in; (void)flags_out; - ALLEGRO_DISPLAY_OSX_WIN *dpy = (ALLEGRO_DISPLAY_OSX_WIN*)user_info; + A5O_DISPLAY_OSX_WIN *dpy = (A5O_DISPLAY_OSX_WIN*)user_info; al_lock_mutex(dpy->flip_mutex); dpy->num_flips += 1; @@ -1125,7 +1125,7 @@ static CVReturn display_link_callback(CVDisplayLinkRef display_link, return kCVReturnSuccess; } -static void init_new_vsync(ALLEGRO_DISPLAY_OSX_WIN *dpy) +static void init_new_vsync(A5O_DISPLAY_OSX_WIN *dpy) { dpy->flip_cond = al_create_cond(); dpy->flip_mutex = al_create_mutex(); @@ -1137,7 +1137,7 @@ static void init_new_vsync(ALLEGRO_DISPLAY_OSX_WIN *dpy) CVDisplayLinkStart(dpy->display_link); } -static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) +static void init_halt_events(A5O_DISPLAY_OSX_WIN *dpy) { const char* value = al_get_config_value(al_get_system_config(), "osx", "allow_live_resize"); if (value && strcmp(value, "false") == 0) { @@ -1153,10 +1153,10 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) /* create_display_fs: * Create a fullscreen display - capture the display */ -static ALLEGRO_DISPLAY* create_display_fs(int w, int h) +static A5O_DISPLAY* create_display_fs(int w, int h) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - ALLEGRO_DEBUG("Switching to fullscreen mode sized %dx%d\n", w, h); + A5O_DEBUG("Switching to fullscreen mode sized %dx%d\n", w, h); #define IS_LION (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_7) @@ -1164,23 +1164,23 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) [pool drain]; return NULL; } - ALLEGRO_DISPLAY_OSX_WIN* dpy = al_malloc(sizeof(ALLEGRO_DISPLAY_OSX_WIN)); + A5O_DISPLAY_OSX_WIN* dpy = al_malloc(sizeof(A5O_DISPLAY_OSX_WIN)); if (dpy == NULL) { [pool drain]; return NULL; } memset(dpy, 0, sizeof(*dpy)); - ALLEGRO_DISPLAY* display = &dpy->parent; + A5O_DISPLAY* display = &dpy->parent; - /* Set up the ALLEGRO_DISPLAY part */ + /* Set up the A5O_DISPLAY part */ display->vt = _al_osx_get_display_driver_fs(); display->refresh_rate = al_get_new_display_refresh_rate(); - display->flags = al_get_new_display_flags() | ALLEGRO_OPENGL | ALLEGRO_FULLSCREEN; -#ifdef ALLEGRO_CFG_OPENGLES2 - display.flags |= ALLEGRO_PROGRAMMABLE_PIPELINE; + display->flags = al_get_new_display_flags() | A5O_OPENGL | A5O_FULLSCREEN; +#ifdef A5O_CFG_OPENGLES2 + display.flags |= A5O_PROGRAMMABLE_PIPELINE; #endif -#ifdef ALLEGRO_CFG_OPENGLES - display.flags |= ALLEGRO_OPENGL_ES_PROFILE; +#ifdef A5O_CFG_OPENGLES + display.flags |= A5O_OPENGL_ES_PROFILE; #endif display->w = w; display->h = h; @@ -1208,7 +1208,7 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) NSOpenGLPixelFormat* fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes: dpy->attributes]; if (fmt == nil) { - ALLEGRO_DEBUG("Could not set pixel format\n"); + A5O_DEBUG("Could not set pixel format\n"); [pool drain]; return NULL; } @@ -1217,7 +1217,7 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) NSOpenGLContext* context = osx_create_shareable_context(fmt, &dpy->display_group); [fmt release]; if (context == nil) { - ALLEGRO_DEBUG("Could not create rendering context\n"); + A5O_DEBUG("Could not create rendering context\n"); [pool drain]; return NULL; } @@ -1309,8 +1309,8 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) [context makeCurrentContext]; // Set up the Allegro OpenGL implementation - display->ogl_extras = al_malloc(sizeof(ALLEGRO_OGL_EXTRAS)); - memset(display->ogl_extras, 0, sizeof(ALLEGRO_OGL_EXTRAS)); + display->ogl_extras = al_malloc(sizeof(A5O_OGL_EXTRAS)); + memset(display->ogl_extras, 0, sizeof(A5O_OGL_EXTRAS)); _al_ogl_manage_extensions(&dpy->parent); _al_ogl_set_extensions(dpy->parent.ogl_extras->extension_api); display->ogl_extras->is_shared = true; @@ -1320,11 +1320,11 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) /* Turn on vsyncing possibly. The old way doesn't work on new OSX's, but works better than the new way when it does work. */ #if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 - if (_al_get_new_display_settings()->settings[ALLEGRO_VSYNC] == 1) { + if (_al_get_new_display_settings()->settings[A5O_VSYNC] == 1) { init_new_vsync(dpy); } #else - if (_al_get_new_display_settings()->settings[ALLEGRO_VSYNC] == 1) { + if (_al_get_new_display_settings()->settings[A5O_VSYNC] == 1) { GLint swapInterval = 1; [dpy->ctx setValues:&swapInterval forParameter: NSOpenGLCPSwapInterval]; } @@ -1340,7 +1340,7 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) clear_to_black(dpy->ctx); /* Add to the display list */ - ALLEGRO_DISPLAY **add = _al_vector_alloc_back(&al_get_system_driver()->displays); + A5O_DISPLAY **add = _al_vector_alloc_back(&al_get_system_driver()->displays); *add = display; dpy->in_fullscreen = YES; // Begin the 'private' event loop @@ -1359,26 +1359,26 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) * Works, but I can't get the display to respond to a resize request * properly - EG */ -static ALLEGRO_DISPLAY* create_display_fs(int w, int h) +static A5O_DISPLAY* create_display_fs(int w, int h) { - ALLEGRO_DEBUG("Creating full screen mode sized %dx%d\n", w, h); + A5O_DEBUG("Creating full screen mode sized %dx%d\n", w, h); if (al_get_new_display_adapter() >= al_get_num_video_adapters()) return NULL; - ALLEGRO_DISPLAY_OSX_WIN* dpy = al_malloc(sizeof(ALLEGRO_DISPLAY_OSX_WIN)); + A5O_DISPLAY_OSX_WIN* dpy = al_malloc(sizeof(A5O_DISPLAY_OSX_WIN)); if (dpy == NULL) { return NULL; } memset(dpy, 0, sizeof(*dpy)); - /* Set up the ALLEGRO_DISPLAY part */ + /* Set up the A5O_DISPLAY part */ dpy->parent.vt = _al_osx_get_display_driver_win(); dpy->parent.refresh_rate = al_get_new_display_refresh_rate(); - dpy->parent.flags = al_get_new_display_flags() | ALLEGRO_OPENGL | ALLEGRO_FULLSCREEN; -#ifdef ALLEGRO_CFG_OPENGLES2 - dpy->parent.flags |= ALLEGRO_PROGRAMMABLE_PIPELINE; + dpy->parent.flags = al_get_new_display_flags() | A5O_OPENGL | A5O_FULLSCREEN; +#ifdef A5O_CFG_OPENGLES2 + dpy->parent.flags |= A5O_PROGRAMMABLE_PIPELINE; #endif -#ifdef ALLEGRO_CFG_OPENGLES - dpy->parent.flags |= ALLEGRO_OPENGL_ES_PROFILE; +#ifdef A5O_CFG_OPENGLES + dpy->parent.flags |= A5O_OPENGL_ES_PROFILE; #endif dpy->parent.w = w; dpy->parent.h = h; @@ -1473,8 +1473,8 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) [[dpy->win contentView] enterFullScreenMode: screen withOptions: nil]; // Set up the Allegro OpenGL implementation - dpy->parent.ogl_extras = al_malloc(sizeof(ALLEGRO_OGL_EXTRAS)); - memset(dpy->parent.ogl_extras, 0, sizeof(ALLEGRO_OGL_EXTRAS)); + dpy->parent.ogl_extras = al_malloc(sizeof(A5O_OGL_EXTRAS)); + memset(dpy->parent.ogl_extras, 0, sizeof(A5O_OGL_EXTRAS)); _al_ogl_manage_extensions(&dpy->parent); _al_ogl_set_extensions(dpy->parent.ogl_extras->extension_api); dpy->parent.ogl_extras->is_shared = true; @@ -1484,11 +1484,11 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) /* Turn on vsyncing possibly. The old way doesn't work on new OSX's, but works better than the new way when it does work. */ #if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 - if (_al_get_new_display_settings()->settings[ALLEGRO_VSYNC] == 1) { + if (_al_get_new_display_settings()->settings[A5O_VSYNC] == 1) { init_new_vsync(dpy); } #else - if (_al_get_new_display_settings()->settings[ALLEGRO_VSYNC] == 1) { + if (_al_get_new_display_settings()->settings[A5O_VSYNC] == 1) { GLint swapInterval = 1; [dpy->ctx setValues:&swapInterval forParameter: NSOpenGLCPSwapInterval]; } @@ -1504,7 +1504,7 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) clear_to_black(dpy->ctx); /* Add to the display list */ - ALLEGRO_DISPLAY **add = _al_vector_alloc_back(&al_get_system_driver()->displays); + A5O_DISPLAY **add = _al_vector_alloc_back(&al_get_system_driver()->displays); *add = &dpy->parent; dpy->in_fullscreen = YES; @@ -1517,13 +1517,13 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) * to be its content view * Call from user thread. */ -static ALLEGRO_DISPLAY* create_display_win(int w, int h) { +static A5O_DISPLAY* create_display_win(int w, int h) { ASSERT_USER_THREAD(); NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; /* Create a temporary view so that we can check whether a fullscreen * window can be created. */ - if (al_get_new_display_flags() & ALLEGRO_FULLSCREEN_WINDOW) { + if (al_get_new_display_flags() & A5O_FULLSCREEN_WINDOW) { __block BOOL ok; dispatch_sync(dispatch_get_main_queue(), ^{ NSRect rc = NSMakeRect(0, 0, w, h); @@ -1533,32 +1533,32 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) [view release]; }); if (!ok) { - ALLEGRO_DEBUG("Cannot create FULLSCREEN_WINDOW"); + A5O_DEBUG("Cannot create FULLSCREEN_WINDOW"); return NULL; } } - ALLEGRO_DEBUG("Creating window sized %dx%d\n", w, h); + A5O_DEBUG("Creating window sized %dx%d\n", w, h); if (al_get_new_display_adapter() >= al_get_num_video_adapters()) { [pool drain]; return NULL; } - ALLEGRO_DISPLAY_OSX_WIN* dpy = al_malloc(sizeof(ALLEGRO_DISPLAY_OSX_WIN)); + A5O_DISPLAY_OSX_WIN* dpy = al_malloc(sizeof(A5O_DISPLAY_OSX_WIN)); if (dpy == NULL) { [pool drain]; return NULL; } memset(dpy, 0, sizeof(*dpy)); - ALLEGRO_DISPLAY* display = &dpy->parent; - /* Set up the ALLEGRO_DISPLAY part */ + A5O_DISPLAY* display = &dpy->parent; + /* Set up the A5O_DISPLAY part */ display->vt = _al_osx_get_display_driver_win(); display->refresh_rate = al_get_new_display_refresh_rate(); - display->flags = al_get_new_display_flags() | ALLEGRO_OPENGL | ALLEGRO_WINDOWED; -#ifdef ALLEGRO_CFG_OPENGLES2 - display->flags |= ALLEGRO_PROGRAMMABLE_PIPELINE; + display->flags = al_get_new_display_flags() | A5O_OPENGL | A5O_WINDOWED; +#ifdef A5O_CFG_OPENGLES2 + display->flags |= A5O_PROGRAMMABLE_PIPELINE; #endif -#ifdef ALLEGRO_CFG_OPENGLES - display->flags |= ALLEGRO_OPENGL_ES_PROFILE; +#ifdef A5O_CFG_OPENGLES + display->flags |= A5O_OPENGL_ES_PROFILE; #endif display->w = w; display->h = h; @@ -1592,11 +1592,11 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) ALWindow *alwin = dpy->win = [ALWindow alloc]; NSWindow* win = alwin; NSScreen *screen; - unsigned int mask = (display->flags & ALLEGRO_FRAMELESS) ? NSWindowStyleMaskBorderless : + unsigned int mask = (display->flags & A5O_FRAMELESS) ? NSWindowStyleMaskBorderless : (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable); - if (display->flags & ALLEGRO_RESIZABLE) + if (display->flags & A5O_RESIZABLE) mask |= NSWindowStyleMaskResizable; - if (display->flags & ALLEGRO_FULLSCREEN) + if (display->flags & A5O_FULLSCREEN) mask |= NSWindowStyleMaskResizable; if ((adapter >= 0) && @@ -1619,8 +1619,8 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) defer: NO screen: screen ]; - alwin.display = (ALLEGRO_DISPLAY *)dpy; - if (display->flags & ALLEGRO_RESIZABLE) { + alwin.display = (A5O_DISPLAY *)dpy; + if (display->flags & A5O_RESIZABLE) { if ([win respondsToSelector:NSSelectorFromString(@"setCollectionBehavior:")]) { [win setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; } @@ -1630,7 +1630,7 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) ALOpenGLView* view = [[ALOpenGLView alloc] initWithFrame: rc]; dpy->ctx = osx_create_shareable_context(fmt, &dpy->display_group); if (dpy->ctx == nil) { - ALLEGRO_DEBUG("Could not create rendering context\n"); + A5O_DEBUG("Could not create rendering context\n"); [view release]; [fmt release]; @@ -1654,7 +1654,7 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) MINIMUM_HEIGHT / screen_scale_factor)]; /* Maximize the window and update its width & height information */ - if (display->flags & ALLEGRO_MAXIMIZED) { + if (display->flags & A5O_MAXIMIZED) { [win setFrame: [screen visibleFrame] display: true animate: false]; NSRect content = [win contentRectForFrameRect: [win frame]]; display->w = content.size.width; @@ -1691,7 +1691,7 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) } [fmt release]; [view release]; - if (display->flags & ALLEGRO_FULLSCREEN_WINDOW) { + if (display->flags & A5O_FULLSCREEN_WINDOW) { NSRect sc = [[dpy->win screen] frame]; dpy->parent.w = sc.size.width; dpy->parent.h = sc.size.height; @@ -1701,9 +1701,9 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) [dpy->ctx makeCurrentContext]; /* Print out OpenGL version info */ - ALLEGRO_INFO("OpenGL Version: %s\n", glGetString(GL_VERSION)); - ALLEGRO_INFO("Vendor: %s\n", glGetString(GL_VENDOR)); - ALLEGRO_INFO("Renderer: %s\n", glGetString(GL_RENDERER)); + A5O_INFO("OpenGL Version: %s\n", glGetString(GL_VERSION)); + A5O_INFO("Vendor: %s\n", glGetString(GL_VENDOR)); + A5O_INFO("Renderer: %s\n", glGetString(GL_RENDERER)); /* Set up a pixel format to describe the mode we want. */ osx_set_opengl_pixelformat_attributes(dpy); @@ -1712,8 +1712,8 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) osx_get_opengl_pixelformat_attributes(dpy); // Set up the Allegro OpenGL implementation - display->ogl_extras = al_malloc(sizeof(ALLEGRO_OGL_EXTRAS)); - memset(display->ogl_extras, 0, sizeof(ALLEGRO_OGL_EXTRAS)); + display->ogl_extras = al_malloc(sizeof(A5O_OGL_EXTRAS)); + memset(display->ogl_extras, 0, sizeof(A5O_OGL_EXTRAS)); _al_ogl_manage_extensions(display); _al_ogl_set_extensions(display->ogl_extras->extension_api); display->ogl_extras->is_shared = true; @@ -1721,11 +1721,11 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) /* Turn on vsyncing possibly. The old way doesn't work on new OSX's, but works better than the new way when it does work. */ #if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 - if (_al_get_new_display_settings()->settings[ALLEGRO_VSYNC] == 1) { + if (_al_get_new_display_settings()->settings[A5O_VSYNC] == 1) { init_new_vsync(dpy); } #else - if (_al_get_new_display_settings()->settings[ALLEGRO_VSYNC] == 1) { + if (_al_get_new_display_settings()->settings[A5O_VSYNC] == 1) { GLint swapInterval = 1; [dpy->ctx setValues:&swapInterval forParameter: NSOpenGLCPSwapInterval]; } @@ -1741,13 +1741,13 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) clear_to_black(dpy->ctx); /* Add to the display list */ - ALLEGRO_DISPLAY **add = _al_vector_alloc_back(&al_get_system_driver()->displays); + A5O_DISPLAY **add = _al_vector_alloc_back(&al_get_system_driver()->displays); *add = display; dpy->in_fullscreen = NO; - if (display->flags & ALLEGRO_FULLSCREEN_WINDOW) { - display->flags ^= ALLEGRO_FULLSCREEN_WINDOW; /* Not set yet */ - set_display_flag(display, ALLEGRO_FULLSCREEN_WINDOW, true); + if (display->flags & A5O_FULLSCREEN_WINDOW) { + display->flags ^= A5O_FULLSCREEN_WINDOW; /* Not set yet */ + set_display_flag(display, A5O_FULLSCREEN_WINDOW, true); } [pool drain]; @@ -1760,13 +1760,13 @@ static void init_halt_events(ALLEGRO_DISPLAY_OSX_WIN *dpy) * Destroy display, actually close the window or exit fullscreen on the main thread * Called from user thread */ -static void destroy_display(ALLEGRO_DISPLAY* d) +static void destroy_display(A5O_DISPLAY* d) { ASSERT_USER_THREAD(); NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - ALLEGRO_DISPLAY *old_dpy = al_get_current_display(); - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) d; - ALLEGRO_DISPLAY_OSX_WIN* other = NULL; + A5O_DISPLAY *old_dpy = al_get_current_display(); + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) d; + A5O_DISPLAY_OSX_WIN* other = NULL; unsigned int i; // Set the display as the current display; needed because we need to @@ -1779,7 +1779,7 @@ static void destroy_display(ALLEGRO_DISPLAY* d) // Check for other displays in this display group _AL_VECTOR* dpys = &al_get_system_driver()->displays; for (i = 0; i < _al_vector_size(dpys); ++i) { - ALLEGRO_DISPLAY_OSX_WIN* d = *(ALLEGRO_DISPLAY_OSX_WIN**) _al_vector_ref(dpys, i); + A5O_DISPLAY_OSX_WIN* d = *(A5O_DISPLAY_OSX_WIN**) _al_vector_ref(dpys, i); if (d->display_group == dpy->display_group && (d!=dpy)) { other = d; break; @@ -1789,8 +1789,8 @@ static void destroy_display(ALLEGRO_DISPLAY* d) // Found another compatible display. Transfer our bitmaps to it. _AL_VECTOR* bmps = &dpy->parent.bitmaps; for (i = 0; i<_al_vector_size(bmps); ++i) { - ALLEGRO_BITMAP **add = _al_vector_alloc_back(&other->parent.bitmaps); - ALLEGRO_BITMAP **ref = _al_vector_ref(bmps, i); + A5O_BITMAP **add = _al_vector_alloc_back(&other->parent.bitmaps); + A5O_BITMAP **ref = _al_vector_ref(bmps, i); *add = *ref; (*add)->_display = &(other->parent); } @@ -1798,25 +1798,25 @@ static void destroy_display(ALLEGRO_DISPLAY* d) else { // This is the last in its group. Convert all its bitmaps to memory bmps while (dpy->parent.bitmaps._size > 0) { - ALLEGRO_BITMAP **bptr = _al_vector_ref_back(&dpy->parent.bitmaps); - ALLEGRO_BITMAP *bmp = *bptr; + A5O_BITMAP **bptr = _al_vector_ref_back(&dpy->parent.bitmaps); + A5O_BITMAP *bmp = *bptr; _al_convert_to_memory_bitmap(bmp); } } _al_vector_free(&dpy->parent.bitmaps); - ALLEGRO_DISPLAY* display = &dpy->parent; - ALLEGRO_OGL_EXTRAS *ogl = display->ogl_extras; + A5O_DISPLAY* display = &dpy->parent; + A5O_OGL_EXTRAS *ogl = display->ogl_extras; _al_vector_find_and_delete(&al_get_system_driver()->displays, &display); if (ogl->backbuffer) { _al_ogl_destroy_backbuffer(ogl->backbuffer); ogl->backbuffer = NULL; - ALLEGRO_DEBUG("destroy backbuffer.\n"); + A5O_DEBUG("destroy backbuffer.\n"); } dispatch_sync(dispatch_get_main_queue(), ^{ // Disconnect from its view or exit fullscreen mode [dpy->ctx clearDrawable]; // Unlock the screen - if (display->flags & ALLEGRO_FULLSCREEN) { + if (display->flags & A5O_FULLSCREEN) { CGDisplaySetDisplayMode(dpy->display_id, dpy->original_mode, NULL); CGDisplayModeRelease(dpy->original_mode); #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 @@ -1827,7 +1827,7 @@ static void destroy_display(ALLEGRO_DISPLAY* d) CGDisplayRelease(dpy->display_id); dpy->in_fullscreen = false; } - else if (display->flags & ALLEGRO_FULLSCREEN_WINDOW) { + else if (display->flags & A5O_FULLSCREEN_WINDOW) { #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 if (dpy->win) { [dpy->view exitFullScreenModeWithOptions: nil]; @@ -1872,11 +1872,11 @@ static void destroy_display(ALLEGRO_DISPLAY* d) * Create a display either fullscreen or windowed depending on flags * Call from user thread */ -static ALLEGRO_DISPLAY* create_display(int w, int h) +static A5O_DISPLAY* create_display(int w, int h) { ASSERT_USER_THREAD(); int flags = al_get_new_display_flags(); - if (flags & ALLEGRO_FULLSCREEN) { + if (flags & A5O_FULLSCREEN) { return create_display_fs(w,h); } else { @@ -1886,12 +1886,12 @@ static void destroy_display(ALLEGRO_DISPLAY* d) /* Note: in windowed mode, contexts always behave like single-buffered * though in fact they are composited offscreen */ -static void flip_display(ALLEGRO_DISPLAY *disp) +static void flip_display(A5O_DISPLAY *disp) { - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) disp; + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) disp; - ALLEGRO_BITMAP *old_target = NULL; - if (!((ALLEGRO_BITMAP_EXTRA_OPENGL *)disp->ogl_extras->opengl_target->extra)->is_backbuffer) { + A5O_BITMAP *old_target = NULL; + if (!((A5O_BITMAP_EXTRA_OPENGL *)disp->ogl_extras->opengl_target->extra)->is_backbuffer) { old_target = al_get_target_bitmap(); al_set_target_backbuffer(disp); } @@ -1918,7 +1918,7 @@ static void flip_display(ALLEGRO_DISPLAY *disp) } } -static void update_display_region(ALLEGRO_DISPLAY *disp, +static void update_display_region(A5O_DISPLAY *disp, int x, int y, int width, int height) { (void)x; @@ -1932,11 +1932,11 @@ static void update_display_region(ALLEGRO_DISPLAY *disp, * creates a custom system cursor from the bitmap bmp. * (x_focus, y_focus) indicates the cursor hot-spot. */ -ALLEGRO_MOUSE_CURSOR *_al_osx_create_mouse_cursor(ALLEGRO_BITMAP *bmp, +A5O_MOUSE_CURSOR *_al_osx_create_mouse_cursor(A5O_BITMAP *bmp, int x_focus, int y_focus) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - ALLEGRO_MOUSE_CURSOR_OSX *cursor = NULL; + A5O_MOUSE_CURSOR_OSX *cursor = NULL; if (!bmp) { [pool drain]; @@ -1950,15 +1950,15 @@ static void update_display_region(ALLEGRO_DISPLAY *disp, [cursor_image release]; [pool drain]; - return (ALLEGRO_MOUSE_CURSOR *)cursor; + return (A5O_MOUSE_CURSOR *)cursor; } /* _al_osx_destroy_mouse_cursor: * destroys a mouse cursor previously created with _al_osx_create_mouse_cursor */ -void _al_osx_destroy_mouse_cursor(ALLEGRO_MOUSE_CURSOR *curs) +void _al_osx_destroy_mouse_cursor(A5O_MOUSE_CURSOR *curs) { - ALLEGRO_MOUSE_CURSOR_OSX *cursor = (ALLEGRO_MOUSE_CURSOR_OSX *) curs; + A5O_MOUSE_CURSOR_OSX *cursor = (A5O_MOUSE_CURSOR_OSX *) curs; unsigned i; if (!cursor) @@ -1968,8 +1968,8 @@ void _al_osx_destroy_mouse_cursor(ALLEGRO_MOUSE_CURSOR *curs) _AL_VECTOR* dpys = &al_get_system_driver()->displays; for (i = 0; i < _al_vector_size(dpys); ++i) { - ALLEGRO_DISPLAY* dpy = *(ALLEGRO_DISPLAY**) _al_vector_ref(dpys, i); - ALLEGRO_DISPLAY_OSX_WIN *osx_dpy = (ALLEGRO_DISPLAY_OSX_WIN*) dpy; + A5O_DISPLAY* dpy = *(A5O_DISPLAY**) _al_vector_ref(dpys, i); + A5O_DISPLAY_OSX_WIN *osx_dpy = (A5O_DISPLAY_OSX_WIN*) dpy; if (osx_dpy->cursor == cursor->cursor) { _al_osx_change_cursor(osx_dpy, [NSCursor arrowCursor]); @@ -1984,11 +1984,11 @@ void _al_osx_destroy_mouse_cursor(ALLEGRO_MOUSE_CURSOR *curs) * change the mouse cursor for the active window to the cursor previously * allocated by osx_create_mouse_cursor */ -static bool osx_set_mouse_cursor(ALLEGRO_DISPLAY *display, - ALLEGRO_MOUSE_CURSOR *cursor) +static bool osx_set_mouse_cursor(A5O_DISPLAY *display, + A5O_MOUSE_CURSOR *cursor) { - ALLEGRO_DISPLAY_OSX_WIN *dpy = (ALLEGRO_DISPLAY_OSX_WIN *)display; - ALLEGRO_MOUSE_CURSOR_OSX *osxcursor = (ALLEGRO_MOUSE_CURSOR_OSX *)cursor; + A5O_DISPLAY_OSX_WIN *dpy = (A5O_DISPLAY_OSX_WIN *)display; + A5O_MOUSE_CURSOR_OSX *osxcursor = (A5O_MOUSE_CURSOR_OSX *)cursor; _al_osx_change_cursor(dpy, osxcursor->cursor); @@ -2000,47 +2000,47 @@ static bool osx_set_mouse_cursor(ALLEGRO_DISPLAY *display, * NOTE: Allegro defines four of these, but OS X has no dedicated "busy" or * "question" cursors, so we just set an arrow in those cases. */ -static bool osx_set_system_mouse_cursor(ALLEGRO_DISPLAY *display, - ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id) +static bool osx_set_system_mouse_cursor(A5O_DISPLAY *display, + A5O_SYSTEM_MOUSE_CURSOR cursor_id) { - ALLEGRO_DISPLAY_OSX_WIN *dpy = (ALLEGRO_DISPLAY_OSX_WIN *)display; + A5O_DISPLAY_OSX_WIN *dpy = (A5O_DISPLAY_OSX_WIN *)display; NSCursor *requested_cursor = NULL; switch (cursor_id) { - case ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT: - case ALLEGRO_SYSTEM_MOUSE_CURSOR_ARROW: - case ALLEGRO_SYSTEM_MOUSE_CURSOR_BUSY: - case ALLEGRO_SYSTEM_MOUSE_CURSOR_QUESTION: - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NE: - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_SW: - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NW: - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_SE: - case ALLEGRO_SYSTEM_MOUSE_CURSOR_PROGRESS: - case ALLEGRO_SYSTEM_MOUSE_CURSOR_ALT_SELECT: + case A5O_SYSTEM_MOUSE_CURSOR_DEFAULT: + case A5O_SYSTEM_MOUSE_CURSOR_ARROW: + case A5O_SYSTEM_MOUSE_CURSOR_BUSY: + case A5O_SYSTEM_MOUSE_CURSOR_QUESTION: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_NE: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_SW: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_NW: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_SE: + case A5O_SYSTEM_MOUSE_CURSOR_PROGRESS: + case A5O_SYSTEM_MOUSE_CURSOR_ALT_SELECT: requested_cursor = [NSCursor arrowCursor]; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_UNAVAILABLE: + case A5O_SYSTEM_MOUSE_CURSOR_UNAVAILABLE: requested_cursor = [NSCursor operationNotAllowedCursor]; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_EDIT: + case A5O_SYSTEM_MOUSE_CURSOR_EDIT: requested_cursor = [NSCursor IBeamCursor]; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_N: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_N: requested_cursor = [NSCursor resizeUpCursor]; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_S: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_S: requested_cursor = [NSCursor resizeDownCursor]; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_E: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_E: requested_cursor = [NSCursor resizeRightCursor]; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_W: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_W: requested_cursor = [NSCursor resizeLeftCursor]; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_PRECISION: + case A5O_SYSTEM_MOUSE_CURSOR_PRECISION: requested_cursor = [NSCursor crosshairCursor]; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_LINK: + case A5O_SYSTEM_MOUSE_CURSOR_LINK: requested_cursor = [NSCursor pointingHandCursor]; break; default: @@ -2054,28 +2054,28 @@ static bool osx_set_system_mouse_cursor(ALLEGRO_DISPLAY *display, /* (show|hide)_cursor: Cursor show or hide. The same function works for both windowed and fullscreen. */ -static bool show_cursor(ALLEGRO_DISPLAY *d) +static bool show_cursor(A5O_DISPLAY *d) { - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) d; + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) d; dpy->show_cursor = YES; [NSCursor unhide]; return true; } -static bool hide_cursor(ALLEGRO_DISPLAY *d) +static bool hide_cursor(A5O_DISPLAY *d) { - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) d; + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) d; dpy->show_cursor = NO; [NSCursor hide]; return true; } /* Call from main thread. */ -static bool acknowledge_resize_display_win_main_thread(ALLEGRO_DISPLAY *d) +static bool acknowledge_resize_display_win_main_thread(A5O_DISPLAY *d) { ASSERT_MAIN_THREAD(); - ALLEGRO_DISPLAY_OSX_WIN *dpy = (ALLEGRO_DISPLAY_OSX_WIN *)d; + A5O_DISPLAY_OSX_WIN *dpy = (A5O_DISPLAY_OSX_WIN *)d; NSWindow* window = dpy->win; NSRect frame = [window frame]; NSRect content = [window contentRectForFrameRect: frame]; @@ -2084,14 +2084,14 @@ static bool acknowledge_resize_display_win_main_thread(ALLEGRO_DISPLAY *d) #endif /* At any moment when a window has been changed its size we either - * clear ALLEGRO_MAXIMIZED flag (e.g. resize was done by a human) + * clear A5O_MAXIMIZED flag (e.g. resize was done by a human) * or restore the flag back (at the end of live resize caused by zoom). * Note: affects zoom:(id)sender (if you will debug it). */ - if (!(d->flags & ALLEGRO_FULLSCREEN_WINDOW) && ![window isZoomed]) - d->flags &= ~ALLEGRO_MAXIMIZED; - else if (!(d->flags & ALLEGRO_MAXIMIZED)) - d->flags |= ALLEGRO_MAXIMIZED; + if (!(d->flags & A5O_FULLSCREEN_WINDOW) && ![window isZoomed]) + d->flags &= ~A5O_MAXIMIZED; + else if (!(d->flags & A5O_MAXIMIZED)) + d->flags |= A5O_MAXIMIZED; d->w = NSWidth(content); d->h = NSHeight(content); @@ -2100,7 +2100,7 @@ static bool acknowledge_resize_display_win_main_thread(ALLEGRO_DISPLAY *d) } /* Call from user thread */ -static bool acknowledge_resize_display_win(ALLEGRO_DISPLAY *d) { +static bool acknowledge_resize_display_win(A5O_DISPLAY *d) { ASSERT_USER_THREAD(); dispatch_sync(dispatch_get_main_queue(), ^{ acknowledge_resize_display_win_main_thread(d); @@ -2114,11 +2114,11 @@ static bool acknowledge_resize_display_win(ALLEGRO_DISPLAY *d) { * Change the size of the display by altering the window size or changing the screen mode * This must be called from the User thread */ -static bool resize_display_win(ALLEGRO_DISPLAY *d, int w, int h) +static bool resize_display_win(A5O_DISPLAY *d, int w, int h) { ASSERT_USER_THREAD(); /* Don't resize a fullscreen window */ - if (d->flags & ALLEGRO_FULLSCREEN_WINDOW) { + if (d->flags & A5O_FULLSCREEN_WINDOW) { return false; } bool __block rc; @@ -2128,7 +2128,7 @@ static bool resize_display_win(ALLEGRO_DISPLAY *d, int w, int h) // must be done on the thread the user calls it from, not the main thread setup_gl(d); // Only update the old values in response to user-initiated resizes. - ALLEGRO_DISPLAY_OSX_WIN *dpy = (ALLEGRO_DISPLAY_OSX_WIN *)d; + A5O_DISPLAY_OSX_WIN *dpy = (A5O_DISPLAY_OSX_WIN *)d; dpy->old_w = w; dpy->old_h = h; return rc; @@ -2138,10 +2138,10 @@ static bool resize_display_win(ALLEGRO_DISPLAY *d, int w, int h) * Change the size of the display by altering the window size or changing the screen mode * This must be called from the Main thread */ -static bool resize_display_win_main_thread(ALLEGRO_DISPLAY *d, int w, int h) +static bool resize_display_win_main_thread(A5O_DISPLAY *d, int w, int h) { ASSERT_MAIN_THREAD(); - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) d; + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) d; NSWindow* window = dpy->win; NSRect current; float scale_factor = 1.0; @@ -2155,8 +2155,8 @@ static bool resize_display_win_main_thread(ALLEGRO_DISPLAY *d, int w, int h) } #endif - w = _ALLEGRO_MAX(w, MINIMUM_WIDTH / scale_factor); - h = _ALLEGRO_MAX(h, MINIMUM_HEIGHT / scale_factor); + w = _A5O_MAX(w, MINIMUM_WIDTH / scale_factor); + h = _A5O_MAX(h, MINIMUM_HEIGHT / scale_factor); if (d->use_constraints) { if (d->min_w > 0 && w < d->min_w) { @@ -2166,7 +2166,7 @@ static bool resize_display_win_main_thread(ALLEGRO_DISPLAY *d, int w, int h) h = d->min_h; } /* Don't use max. constraints when a window is maximized. */ - if (!(d->flags & ALLEGRO_MAXIMIZED)) { + if (!(d->flags & A5O_MAXIMIZED)) { if (d->max_w > 0 && w > d->max_w) { w = d->max_w; } @@ -2190,11 +2190,11 @@ static bool resize_display_win_main_thread(ALLEGRO_DISPLAY *d, int w, int h) return acknowledge_resize_display_win_main_thread(d); } -static bool resize_display_fs(ALLEGRO_DISPLAY *d, int w, int h) +static bool resize_display_fs(A5O_DISPLAY *d, int w, int h) { - ALLEGRO_DEBUG("Resize full screen display to %d x %d\n", w, h); + A5O_DEBUG("Resize full screen display to %d x %d\n", w, h); bool success = true; - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) d; + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) d; #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 CFDictionaryRef current = CGDisplayCurrentMode(dpy->display_id); CFNumberRef bps = (CFNumberRef) CFDictionaryGetValue(current, kCGDisplayBitsPerPixel); @@ -2233,7 +2233,7 @@ static bool resize_display_fs(ALLEGRO_DISPLAY *d, int w, int h) CFRelease(bps); CFRelease(modes); if (!mode) { - ALLEGRO_DEBUG("Can't resize fullscreen display\n"); + A5O_DEBUG("Can't resize fullscreen display\n"); return false; } @@ -2252,10 +2252,10 @@ static bool resize_display_fs(ALLEGRO_DISPLAY *d, int w, int h) return success; } -static bool is_compatible_bitmap(ALLEGRO_DISPLAY* disp, ALLEGRO_BITMAP* bmp) +static bool is_compatible_bitmap(A5O_DISPLAY* disp, A5O_BITMAP* bmp) { return (_al_get_bitmap_display(bmp) == disp) - || (((ALLEGRO_DISPLAY_OSX_WIN*) _al_get_bitmap_display(bmp))->display_group == ((ALLEGRO_DISPLAY_OSX_WIN*) disp)->display_group); + || (((A5O_DISPLAY_OSX_WIN*) _al_get_bitmap_display(bmp))->display_group == ((A5O_DISPLAY_OSX_WIN*) disp)->display_group); } /* set_window_position: @@ -2264,10 +2264,10 @@ static bool is_compatible_bitmap(ALLEGRO_DISPLAY* disp, ALLEGRO_BITMAP* bmp) * the top left corner, OS X from the bottom up to the bottom left corner. * Call from user thread. */ -static void set_window_position(ALLEGRO_DISPLAY* display, int x, int y) +static void set_window_position(A5O_DISPLAY* display, int x, int y) { ASSERT_USER_THREAD(); - ALLEGRO_DISPLAY_OSX_WIN* d = (ALLEGRO_DISPLAY_OSX_WIN*) display; + A5O_DISPLAY_OSX_WIN* d = (A5O_DISPLAY_OSX_WIN*) display; NSWindow* window = d->win; int primary_y = _al_osx_get_primary_screen_y(); @@ -2279,7 +2279,7 @@ static void set_window_position(ALLEGRO_DISPLAY* display, int x, int y) NSArray *screen_list = [NSScreen screens]; int found_screen = -1; for (int i = 0; i < al_get_num_video_adapters(); i++) { - ALLEGRO_MONITOR_INFO info; + A5O_MONITOR_INFO info; al_get_monitor_info(i, &info); if (x > info.x1 && x < info.x2 && y > info.y1 && y < info.y2) { found_screen = i; @@ -2318,10 +2318,10 @@ static void set_window_position(ALLEGRO_DISPLAY* display, int x, int y) * set_window_position. * Call from user thread. */ -static void get_window_position(ALLEGRO_DISPLAY* display, int* px, int* py) +static void get_window_position(A5O_DISPLAY* display, int* px, int* py) { ASSERT_USER_THREAD(); - ALLEGRO_DISPLAY_OSX_WIN* d = (ALLEGRO_DISPLAY_OSX_WIN*) display; + A5O_DISPLAY_OSX_WIN* d = (A5O_DISPLAY_OSX_WIN*) display; NSWindow* window = d->win; int primary_y = _al_osx_get_primary_screen_y(); @@ -2343,7 +2343,7 @@ static void get_window_position(ALLEGRO_DISPLAY* display, int* px, int* py) }); } -static bool set_window_constraints(ALLEGRO_DISPLAY* display, +static bool set_window_constraints(A5O_DISPLAY* display, int min_w, int min_h, int max_w, int max_h) { if (min_w > 0 && min_w < MINIMUM_WIDTH) { @@ -2361,7 +2361,7 @@ static bool set_window_constraints(ALLEGRO_DISPLAY* display, return true; } -static bool get_window_constraints(ALLEGRO_DISPLAY* display, +static bool get_window_constraints(A5O_DISPLAY* display, int* min_w, int* min_h, int* max_w, int* max_h) { *min_w = display->min_w; @@ -2376,11 +2376,11 @@ static bool get_window_constraints(ALLEGRO_DISPLAY* display, * Resize the window if needed. * Call from user thread. */ -static void apply_window_constraints(ALLEGRO_DISPLAY *display, +static void apply_window_constraints(A5O_DISPLAY *display, bool onoff) { ASSERT_USER_THREAD(); - ALLEGRO_DISPLAY_OSX_WIN* d = (ALLEGRO_DISPLAY_OSX_WIN*) display; + A5O_DISPLAY_OSX_WIN* d = (A5O_DISPLAY_OSX_WIN*) display; NSWindow* window = d->win; float __block scale_factor = 1.0; @@ -2425,10 +2425,10 @@ static void apply_window_constraints(ALLEGRO_DISPLAY *display, * Set the title of the window with this display * Call from user thread */ -static void set_window_title(ALLEGRO_DISPLAY *display, const char *title) +static void set_window_title(A5O_DISPLAY *display, const char *title) { ASSERT_USER_THREAD(); - ALLEGRO_DISPLAY_OSX_WIN* dpy = (ALLEGRO_DISPLAY_OSX_WIN*) display; + A5O_DISPLAY_OSX_WIN* dpy = (A5O_DISPLAY_OSX_WIN*) display; NSString* string = [[NSString alloc] initWithUTF8String:title]; [dpy->win performSelectorOnMainThread:@selector(setTitle:) withObject:string waitUntilDone:YES]; [string release]; @@ -2439,11 +2439,11 @@ static void set_window_title(ALLEGRO_DISPLAY *display, const char *title) * ignore the display parameter * Call from user thread */ -static void set_icons(ALLEGRO_DISPLAY *display, int num_icons, ALLEGRO_BITMAP* bitmaps[]) +static void set_icons(A5O_DISPLAY *display, int num_icons, A5O_BITMAP* bitmaps[]) { ASSERT_USER_THREAD(); /* Multiple icons not yet implemented. */ - ALLEGRO_BITMAP *bitmap = bitmaps[num_icons - 1]; + A5O_BITMAP *bitmap = bitmaps[num_icons - 1]; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSImage *image = NSImageFromAllegroBitmap(bitmap); (void)display; @@ -2458,7 +2458,7 @@ static void set_icons(ALLEGRO_DISPLAY *display, int num_icons, ALLEGRO_BITMAP* b * Change settings for an already active display * Call from user thread. */ -static bool set_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff) +static bool set_display_flag(A5O_DISPLAY *display, int flag, bool onoff) { ASSERT_USER_THREAD(); #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 @@ -2467,7 +2467,7 @@ static bool set_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff) if (!display) return false; - ALLEGRO_DISPLAY_OSX_WIN *dpy = (ALLEGRO_DISPLAY_OSX_WIN *)display; + A5O_DISPLAY_OSX_WIN *dpy = (A5O_DISPLAY_OSX_WIN *)display; ALWindow *win = dpy->win; if (!win) @@ -2478,17 +2478,17 @@ static bool set_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff) NSWindowStyleMask mask = [win styleMask]; ALOpenGLView *view = (ALOpenGLView *)dpy->view; switch (flag) { - case ALLEGRO_FRAMELESS: + case A5O_FRAMELESS: if (onoff) - display->flags |= ALLEGRO_FRAMELESS; + display->flags |= A5O_FRAMELESS; else - display->flags &= ~ALLEGRO_FRAMELESS; + display->flags &= ~A5O_FRAMELESS; /* BUGS: - This causes the keyboard focus to be lost. - On 10.10, disabling the frameless mode causes the title bar to be partially drawn (resizing the window makes it appear again). */ - ALLEGRO_DEBUG("Toggle FRAME for display %p to %d\n", dpy, onoff); + A5O_DEBUG("Toggle FRAME for display %p to %d\n", dpy, onoff); if (onoff) mask &= ~(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable); else @@ -2498,28 +2498,28 @@ static bool set_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff) /* When going from frameless to frameful, the title gets reset, so we have to manually put it back. */ [win setTitle:title]; break; - case ALLEGRO_RESIZABLE: - ALLEGRO_DEBUG("Toggle RESIZABLE for display %p to %d\n", dpy, onoff); + case A5O_RESIZABLE: + A5O_DEBUG("Toggle RESIZABLE for display %p to %d\n", dpy, onoff); if (onoff) { - display->flags |= ALLEGRO_RESIZABLE; + display->flags |= A5O_RESIZABLE; mask |= NSWindowStyleMaskResizable; } else { - display->flags &= ~ALLEGRO_RESIZABLE; + display->flags &= ~A5O_RESIZABLE; mask &= ~NSWindowStyleMaskResizable; } [win setStyleMask:mask]; break; - case ALLEGRO_MAXIMIZED: + case A5O_MAXIMIZED: retcode= true; - if ((!!(display->flags & ALLEGRO_MAXIMIZED)) == onoff) + if ((!!(display->flags & A5O_MAXIMIZED)) == onoff) break; if (onoff) - display->flags |= ALLEGRO_MAXIMIZED; + display->flags |= A5O_MAXIMIZED; else - display->flags &= ~ALLEGRO_MAXIMIZED; + display->flags &= ~A5O_MAXIMIZED; [view maximize]; break; - case ALLEGRO_FULLSCREEN_WINDOW: + case A5O_FULLSCREEN_WINDOW: if (onoff) { [view enterFullScreenWindowMode]; NSRect sc = [[win screen] frame]; @@ -2527,10 +2527,10 @@ static bool set_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff) sc = [win convertRectToBacking: sc]; #endif resize_display_win_main_thread(display, sc.size.width, sc.size.height); - display->flags |= ALLEGRO_FULLSCREEN_WINDOW; + display->flags |= A5O_FULLSCREEN_WINDOW; } else { [view exitFullScreenWindowMode]; - display->flags &= ~ALLEGRO_FULLSCREEN_WINDOW; + display->flags &= ~A5O_FULLSCREEN_WINDOW; resize_display_win_main_thread(display, dpy->old_w, dpy->old_h); [view finishExitingFullScreenWindowMode]; } @@ -2548,21 +2548,21 @@ static bool set_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff) #endif } -static void acknowledge_drawing_halt(ALLEGRO_DISPLAY *display) +static void acknowledge_drawing_halt(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_OSX_WIN *dpy = (ALLEGRO_DISPLAY_OSX_WIN *)display; + A5O_DISPLAY_OSX_WIN *dpy = (A5O_DISPLAY_OSX_WIN *)display; al_lock_mutex(dpy->halt_mutex); dpy->halt_event_acknowledged = true; al_signal_cond(dpy->halt_cond); al_unlock_mutex(dpy->halt_mutex); } -ALLEGRO_DISPLAY_INTERFACE* _al_osx_get_display_driver_win(void) +A5O_DISPLAY_INTERFACE* _al_osx_get_display_driver_win(void) { - static ALLEGRO_DISPLAY_INTERFACE* vt = NULL; + static A5O_DISPLAY_INTERFACE* vt = NULL; if (vt == NULL) { vt = al_malloc(sizeof(*vt)); - memset(vt, 0, sizeof(ALLEGRO_DISPLAY_INTERFACE)); + memset(vt, 0, sizeof(A5O_DISPLAY_INTERFACE)); vt->create_display = create_display_win; vt->destroy_display = destroy_display; vt->set_current_display = set_current_display; @@ -2594,12 +2594,12 @@ static void acknowledge_drawing_halt(ALLEGRO_DISPLAY *display) return vt; } -ALLEGRO_DISPLAY_INTERFACE* _al_osx_get_display_driver_fs(void) +A5O_DISPLAY_INTERFACE* _al_osx_get_display_driver_fs(void) { - static ALLEGRO_DISPLAY_INTERFACE* vt = NULL; + static A5O_DISPLAY_INTERFACE* vt = NULL; if (vt == NULL) { vt = al_malloc(sizeof(*vt)); - memset(vt, 0, sizeof(ALLEGRO_DISPLAY_INTERFACE)); + memset(vt, 0, sizeof(A5O_DISPLAY_INTERFACE)); vt->create_display = create_display_fs; vt->destroy_display = destroy_display; vt->set_current_display = set_current_display; @@ -2620,12 +2620,12 @@ static void acknowledge_drawing_halt(ALLEGRO_DISPLAY *display) } /* Mini VT just for creating displays */ -ALLEGRO_DISPLAY_INTERFACE* _al_osx_get_display_driver(void) +A5O_DISPLAY_INTERFACE* _al_osx_get_display_driver(void) { - static ALLEGRO_DISPLAY_INTERFACE* vt = NULL; + static A5O_DISPLAY_INTERFACE* vt = NULL; if (vt == NULL) { vt = al_malloc(sizeof(*vt)); - memset(vt, 0, sizeof(ALLEGRO_DISPLAY_INTERFACE)); + memset(vt, 0, sizeof(A5O_DISPLAY_INTERFACE)); vt->create_display = create_display; } return vt; @@ -2633,9 +2633,9 @@ static void acknowledge_drawing_halt(ALLEGRO_DISPLAY *display) /* Function: al_osx_get_window */ -NSWindow* al_osx_get_window(ALLEGRO_DISPLAY *display) +NSWindow* al_osx_get_window(A5O_DISPLAY *display) { if (!display) return NULL; - return ((ALLEGRO_DISPLAY_OSX_WIN *)display)->win; + return ((A5O_DISPLAY_OSX_WIN *)display)->win; } diff --git a/src/macosx/qzmouse.m b/src/macosx/qzmouse.m index 7579940813..40c2a3db06 100644 --- a/src/macosx/qzmouse.m +++ b/src/macosx/qzmouse.m @@ -26,28 +26,28 @@ #include "allegro5/internal/aintern_keyboard.h" #include "allegro5/platform/aintosx.h" #include "./osxgl.h" -#ifndef ALLEGRO_MACOSX +#ifndef A5O_MACOSX #error Something is wrong with the makefile #endif -ALLEGRO_DEBUG_CHANNEL("MacOSX"); +A5O_DEBUG_CHANNEL("MacOSX"); -typedef struct ALLEGRO_MOUSE AL_MOUSE; -typedef struct ALLEGRO_MOUSE_STATE AL_MOUSE_STATE; +typedef struct A5O_MOUSE AL_MOUSE; +typedef struct A5O_MOUSE_STATE AL_MOUSE_STATE; static bool osx_init_mouse(void); static unsigned int osx_get_mouse_num_buttons(void); static unsigned int osx_get_mouse_num_axes(void); static bool osx_set_mouse_axis(int axis, int value); -static ALLEGRO_MOUSE* osx_get_mouse(void); +static A5O_MOUSE* osx_get_mouse(void); /* Mouse info - includes extra info for OS X */ static struct { - ALLEGRO_MOUSE parent; + A5O_MOUSE parent; unsigned int button_count; unsigned int axis_count; int minx, miny, maxx, maxy; - ALLEGRO_MOUSE_STATE state; + A5O_MOUSE_STATE state; float z_axis, w_axis; BOOL warped; int warped_x, warped_y; @@ -56,13 +56,13 @@ void _al_osx_clear_mouse_state(void) { - memset(&osx_mouse.state, 0, sizeof(ALLEGRO_MOUSE_STATE)); + memset(&osx_mouse.state, 0, sizeof(A5O_MOUSE_STATE)); } /* _al_osx_switch_keyboard_focus: * Handle a focus switch event. */ -void _al_osx_switch_mouse_focus(ALLEGRO_DISPLAY *dpy, bool switch_in) +void _al_osx_switch_mouse_focus(A5O_DISPLAY *dpy, bool switch_in) { _al_event_source_lock(&osx_mouse.parent.es); @@ -77,9 +77,9 @@ void _al_osx_switch_mouse_focus(ALLEGRO_DISPLAY *dpy, bool switch_in) /* osx_get_mouse: * Return the Allegro mouse structure */ -static ALLEGRO_MOUSE* osx_get_mouse(void) +static A5O_MOUSE* osx_get_mouse(void) { - return (ALLEGRO_MOUSE*) &osx_mouse.parent; + return (A5O_MOUSE*) &osx_mouse.parent; } /* _al_osx_mouse_generate_event: @@ -87,7 +87,7 @@ void _al_osx_switch_mouse_focus(ALLEGRO_DISPLAY *dpy, bool switch_in) * and push it into a queue. * First check that the event is wanted. */ -void _al_osx_mouse_generate_event(NSEvent* evt, ALLEGRO_DISPLAY* dpy) +void _al_osx_mouse_generate_event(NSEvent* evt, A5O_DISPLAY* dpy) { NSPoint pos; int type, b_change = 0, b = 0; @@ -96,7 +96,7 @@ void _al_osx_mouse_generate_event(NSEvent* evt, ALLEGRO_DISPLAY* dpy) switch ([evt type]) { case NSMouseMoved: - type = ALLEGRO_EVENT_MOUSE_AXES; + type = A5O_EVENT_MOUSE_AXES; dx = [evt deltaX]; dy = [evt deltaY]; pressure = [evt pressure]; @@ -104,7 +104,7 @@ void _al_osx_mouse_generate_event(NSEvent* evt, ALLEGRO_DISPLAY* dpy) case NSLeftMouseDragged: case NSRightMouseDragged: case NSOtherMouseDragged: - type = ALLEGRO_EVENT_MOUSE_AXES; + type = A5O_EVENT_MOUSE_AXES; b = [evt buttonNumber]+1; dx = [evt deltaX]; dy = [evt deltaY]; @@ -113,7 +113,7 @@ void _al_osx_mouse_generate_event(NSEvent* evt, ALLEGRO_DISPLAY* dpy) case NSLeftMouseDown: case NSRightMouseDown: case NSOtherMouseDown: - type = ALLEGRO_EVENT_MOUSE_BUTTON_DOWN; + type = A5O_EVENT_MOUSE_BUTTON_DOWN; b = [evt buttonNumber]+1; b_change = 1; osx_mouse.state.buttons |= (1 << (b-1)); @@ -122,14 +122,14 @@ void _al_osx_mouse_generate_event(NSEvent* evt, ALLEGRO_DISPLAY* dpy) case NSLeftMouseUp: case NSRightMouseUp: case NSOtherMouseUp: - type = ALLEGRO_EVENT_MOUSE_BUTTON_UP; + type = A5O_EVENT_MOUSE_BUTTON_UP; b = [evt buttonNumber]+1; b_change = 1; osx_mouse.state.buttons &= ~(1 << (b-1)); pressure = [evt pressure]; break; case NSScrollWheel: - type = ALLEGRO_EVENT_MOUSE_AXES; + type = A5O_EVENT_MOUSE_AXES; dx = 0; dy = 0; osx_mouse.w_axis += al_get_mouse_wheel_precision() * [evt deltaX]; @@ -138,13 +138,13 @@ void _al_osx_mouse_generate_event(NSEvent* evt, ALLEGRO_DISPLAY* dpy) dz = osx_mouse.z_axis - osx_mouse.state.z; break; case NSMouseEntered: - type = ALLEGRO_EVENT_MOUSE_ENTER_DISPLAY; + type = A5O_EVENT_MOUSE_ENTER_DISPLAY; b = [evt buttonNumber]+1; dx = [evt deltaX]; dy = [evt deltaY]; break; case NSMouseExited: - type = ALLEGRO_EVENT_MOUSE_LEAVE_DISPLAY; + type = A5O_EVENT_MOUSE_LEAVE_DISPLAY; b = [evt buttonNumber]+1; dx = [evt deltaX]; dy = [evt deltaY]; @@ -174,17 +174,17 @@ void _al_osx_mouse_generate_event(NSEvent* evt, ALLEGRO_DISPLAY* dpy) } dx *= scaling_factor; dy *= scaling_factor; - if (osx_mouse.warped && type == ALLEGRO_EVENT_MOUSE_AXES) { + if (osx_mouse.warped && type == A5O_EVENT_MOUSE_AXES) { dx -= osx_mouse.warped_x; dy -= osx_mouse.warped_y; osx_mouse.warped = FALSE; } _al_event_source_lock(&osx_mouse.parent.es); - if ((within || b_change || type == ALLEGRO_EVENT_MOUSE_LEAVE_DISPLAY) + if ((within || b_change || type == A5O_EVENT_MOUSE_LEAVE_DISPLAY) && _al_event_source_needs_to_generate_event(&osx_mouse.parent.es)) { - ALLEGRO_EVENT new_event; - ALLEGRO_MOUSE_EVENT* mouse_event = &new_event.mouse; + A5O_EVENT new_event; + A5O_MOUSE_EVENT* mouse_event = &new_event.mouse; mouse_event->type = type; // Note: we use 'allegro time' rather than the time stamp // from the event @@ -233,7 +233,7 @@ static bool osx_init_mouse(void) NSString* desc = nil; _al_osx_hid_scan(HID_MOUSE, &devices); - ALLEGRO_INFO("Detected %d pointing devices\n", devices.count); + A5O_INFO("Detected %d pointing devices\n", devices.count); for (i=0; imanufacturer ? device->manufacturer : "", device->product ? device->product : ""]; - ALLEGRO_INFO("Device %d is a \"%s\"\n", i, [desc UTF8String]); + A5O_INFO("Device %d is a \"%s\"\n", i, [desc UTF8String]); for (j = 0; j < device->num_elements; j++) { switch (device->element[j].type) { @@ -257,7 +257,7 @@ static bool osx_init_mouse(void) break; } } - ALLEGRO_INFO("Detected %d axes and %d buttons\n", axes, buttons); + A5O_INFO("Detected %d axes and %d buttons\n", axes, buttons); /* When mouse events reach the application, it is not clear which * device generated them, so effectively the largest number of @@ -268,14 +268,14 @@ static bool osx_init_mouse(void) if (buttons > max_buttons) max_buttons = buttons; } _al_osx_hid_free(&devices); - ALLEGRO_INFO("Device effectively has %d axes and %d buttons\n", axes, buttons); + A5O_INFO("Device effectively has %d axes and %d buttons\n", axes, buttons); if (max_buttons <= 0) return false; _al_event_source_init(&osx_mouse.parent.es); osx_mouse.button_count = max_buttons; osx_mouse.axis_count = max_axes; osx_mouse.warped = FALSE; - memset(&osx_mouse.state, 0, sizeof(ALLEGRO_MOUSE_STATE)); + memset(&osx_mouse.state, 0, sizeof(A5O_MOUSE_STATE)); _al_osx_mouse_was_installed(YES); [pool drain]; return true; @@ -306,21 +306,21 @@ static unsigned int osx_get_mouse_num_axes(void) } -static void osx_get_mouse_state(ALLEGRO_MOUSE_STATE *ret_state) +static void osx_get_mouse_state(A5O_MOUSE_STATE *ret_state) { _al_event_source_lock(&osx_mouse.parent.es); - memcpy(ret_state, &osx_mouse.state, sizeof(ALLEGRO_MOUSE_STATE)); + memcpy(ret_state, &osx_mouse.state, sizeof(A5O_MOUSE_STATE)); _al_event_source_unlock(&osx_mouse.parent.es); } /* osx_set_mouse_xy: * Set the current mouse position */ -static bool osx_set_mouse_xy(ALLEGRO_DISPLAY *dpy_, int x, int y) +static bool osx_set_mouse_xy(A5O_DISPLAY *dpy_, int x, int y) { CGPoint pos; CGDirectDisplayID display = 0; - ALLEGRO_DISPLAY_OSX_WIN *dpy = (ALLEGRO_DISPLAY_OSX_WIN *)dpy_; + A5O_DISPLAY_OSX_WIN *dpy = (A5O_DISPLAY_OSX_WIN *)dpy_; float scaling_factor = 1.0; #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 scaling_factor = [[NSScreen mainScreen] backingScaleFactor]; @@ -328,8 +328,8 @@ static bool osx_set_mouse_xy(ALLEGRO_DISPLAY *dpy_, int x, int y) x /= scaling_factor; y /= scaling_factor; - if ((dpy) && !(dpy->parent.flags & ALLEGRO_FULLSCREEN) && - !(dpy->parent.flags & ALLEGRO_FULLSCREEN_WINDOW) && (dpy->win)) { + if ((dpy) && !(dpy->parent.flags & A5O_FULLSCREEN) && + !(dpy->parent.flags & A5O_FULLSCREEN_WINDOW) && (dpy->win)) { NSWindow *window = dpy->win; NSRect content = [window contentRectForFrameRect: [window frame]]; NSRect frame = [[window screen] frame]; @@ -356,13 +356,13 @@ static bool osx_set_mouse_xy(ALLEGRO_DISPLAY *dpy_, int x, int y) _al_event_source_lock(&osx_mouse.parent.es); if (_al_event_source_needs_to_generate_event(&osx_mouse.parent.es)) { - ALLEGRO_EVENT new_event; - ALLEGRO_MOUSE_EVENT* mouse_event = &new_event.mouse; - mouse_event->type = ALLEGRO_EVENT_MOUSE_WARPED; + A5O_EVENT new_event; + A5O_MOUSE_EVENT* mouse_event = &new_event.mouse; + mouse_event->type = A5O_EVENT_MOUSE_WARPED; // Note: we use 'allegro time' rather than the time stamp // from the event mouse_event->timestamp = al_get_time(); - mouse_event->display = (ALLEGRO_DISPLAY *)dpy; + mouse_event->display = (A5O_DISPLAY *)dpy; mouse_event->button = 0; mouse_event->x = x; mouse_event->y = y; @@ -412,7 +412,7 @@ static bool osx_set_mouse_axis(int axis, int value) return result; } /* Mouse driver */ -static ALLEGRO_MOUSE_DRIVER osx_mouse_driver = +static A5O_MOUSE_DRIVER osx_mouse_driver = { 0, //int msedrv_id; "OSXMouse", //const char *msedrv_name; @@ -420,14 +420,14 @@ static bool osx_set_mouse_axis(int axis, int value) "OSX Mouse", //const char *msedrv_ascii_name; osx_init_mouse, //AL_METHOD(bool, init_mouse, (void)); osx_exit_mouse, //AL_METHOD(void, exit_mouse, (void)); - osx_get_mouse, //AL_METHOD(ALLEGRO_MOUSE*, get_mouse, (void)); + osx_get_mouse, //AL_METHOD(A5O_MOUSE*, get_mouse, (void)); osx_get_mouse_num_buttons, //AL_METHOD(unsigned int, get_mouse_num_buttons, (void)); osx_get_mouse_num_axes, //AL_METHOD(unsigned int, get_mouse_num_axes, (void)); osx_set_mouse_xy, //AL_METHOD(bool, set_mouse_xy, (int x, int y)); osx_set_mouse_axis, //AL_METHOD(bool, set_mouse_axis, (int which, int value)); - osx_get_mouse_state, //AL_METHOD(void, get_mouse_state, (ALLEGRO_MOUSE_STATE *ret_state)); + osx_get_mouse_state, //AL_METHOD(void, get_mouse_state, (A5O_MOUSE_STATE *ret_state)); }; -ALLEGRO_MOUSE_DRIVER* _al_osx_get_mouse_driver(void) +A5O_MOUSE_DRIVER* _al_osx_get_mouse_driver(void) { return &osx_mouse_driver; } diff --git a/src/macosx/system.m b/src/macosx/system.m index 6a38f2922d..ad308c83aa 100644 --- a/src/macosx/system.m +++ b/src/macosx/system.m @@ -21,7 +21,7 @@ #include "allegro5/internal/aintern_osxclipboard.h" #include -#ifndef ALLEGRO_MACOSX +#ifndef A5O_MACOSX #error something is wrong with the makefile #endif @@ -30,7 +30,7 @@ #include #include -ALLEGRO_DEBUG_CHANNEL("MacOSX") +A5O_DEBUG_CHANNEL("MacOSX") /* These are used to warn the dock about the application */ struct CPSProcessSerNum @@ -43,15 +43,15 @@ extern OSErr CPSSetFrontProcess(struct CPSProcessSerNum *psn); -static ALLEGRO_SYSTEM* osx_sys_init(int flags); -ALLEGRO_SYSTEM_INTERFACE *_al_system_osx_driver(void); +static A5O_SYSTEM* osx_sys_init(int flags); +A5O_SYSTEM_INTERFACE *_al_system_osx_driver(void); static void osx_sys_exit(void); /* Global variables */ NSBundle *_al_osx_bundle = NULL; static _AL_VECTOR osx_display_modes; -static ALLEGRO_SYSTEM osx_system; +static A5O_SYSTEM osx_system; /* _al_osx_tell_dock: * Tell the dock about us; promote us from a console app to a graphical app @@ -103,7 +103,7 @@ int _al_osx_bootstrap_ok(void) /* osx_sys_init: * Initalizes the MacOS X system driver. */ -static ALLEGRO_SYSTEM* osx_sys_init(int flags) +static A5O_SYSTEM* osx_sys_init(int flags) { (void)flags; @@ -115,7 +115,7 @@ int _al_osx_bootstrap_ok(void) #endif /* Initialise the vt and display list */ osx_system.vt = _al_system_osx_driver(); - _al_vector_init(&osx_system.displays, sizeof(ALLEGRO_DISPLAY*)); + _al_vector_init(&osx_system.displays, sizeof(A5O_DISPLAY*)); // `_al_osx_tell_dock` is better done after creating a display. Support old behavior for compatability. bool do_osx_tell_dock = true; @@ -132,9 +132,9 @@ int _al_osx_bootstrap_ok(void) /* Mark the beginning of time. */ _al_unix_init_time(); - _al_vector_init(&osx_display_modes, sizeof(ALLEGRO_DISPLAY_MODE)); + _al_vector_init(&osx_display_modes, sizeof(A5O_DISPLAY_MODE)); - ALLEGRO_DEBUG("system driver initialised.\n"); + A5O_DEBUG("system driver initialised.\n"); return &osx_system; } @@ -146,7 +146,7 @@ int _al_osx_bootstrap_ok(void) static void osx_sys_exit(void) { _al_vector_free(&osx_display_modes); - ALLEGRO_DEBUG("system driver shutdown.\n"); + A5O_DEBUG("system driver shutdown.\n"); } @@ -157,8 +157,8 @@ static void osx_sys_exit(void) */ static int _al_osx_get_num_display_modes(void) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS *extras = _al_get_new_display_settings(); - ALLEGRO_EXTRA_DISPLAY_SETTINGS temp; + A5O_EXTRA_DISPLAY_SETTINGS *extras = _al_get_new_display_settings(); + A5O_EXTRA_DISPLAY_SETTINGS temp; int refresh_rate = al_get_new_display_refresh_rate(); int adapter = al_get_new_display_adapter(); int depth = 0; @@ -167,8 +167,8 @@ static int _al_osx_get_num_display_modes(void) CFIndex i; if (extras) - depth = extras->settings[ALLEGRO_COLOR_SIZE]; - memset(&temp, 0, sizeof(ALLEGRO_EXTRA_DISPLAY_SETTINGS)); + depth = extras->settings[A5O_COLOR_SIZE]; + memset(&temp, 0, sizeof(A5O_EXTRA_DISPLAY_SETTINGS)); display = CGMainDisplayID(); /* Get display ID for the requested display */ @@ -190,61 +190,61 @@ static int _al_osx_get_num_display_modes(void) #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 /* Note: modes is owned by OSX and must not be released */ modes = CGDisplayAvailableModes(display); - ALLEGRO_INFO("detected %d display modes.\n", (int)CFArrayGetCount(modes)); + A5O_INFO("detected %d display modes.\n", (int)CFArrayGetCount(modes)); for (i = 0; i < CFArrayGetCount(modes); i++) { - ALLEGRO_DISPLAY_MODE *mode; + A5O_DISPLAY_MODE *mode; CFDictionaryRef dict = (CFDictionaryRef)CFArrayGetValueAtIndex(modes, i); CFNumberRef number; int value, samples; number = CFDictionaryGetValue(dict, kCGDisplayBitsPerPixel); CFNumberGetValue(number, kCFNumberIntType, &value); - ALLEGRO_INFO("Mode %d has colour depth %d.\n", (int)i, value); + A5O_INFO("Mode %d has colour depth %d.\n", (int)i, value); if (depth && value != depth) { - ALLEGRO_WARN("Skipping mode %d (requested colour depth %d).\n", (int)i, depth); + A5O_WARN("Skipping mode %d (requested colour depth %d).\n", (int)i, depth); continue; } number = CFDictionaryGetValue(dict, kCGDisplayRefreshRate); CFNumberGetValue(number, kCFNumberIntType, &value); - ALLEGRO_INFO("Mode %d has colour depth %d.\n", (int)i, value); + A5O_INFO("Mode %d has colour depth %d.\n", (int)i, value); if (refresh_rate && value != refresh_rate) { - ALLEGRO_WARN("Skipping mode %d (requested refresh rate %d).\n", (int)i, refresh_rate); + A5O_WARN("Skipping mode %d (requested refresh rate %d).\n", (int)i, refresh_rate); continue; } - mode = (ALLEGRO_DISPLAY_MODE *)_al_vector_alloc_back(&osx_display_modes); + mode = (A5O_DISPLAY_MODE *)_al_vector_alloc_back(&osx_display_modes); number = CFDictionaryGetValue(dict, kCGDisplayWidth); CFNumberGetValue(number, kCFNumberIntType, &mode->width); number = CFDictionaryGetValue(dict, kCGDisplayHeight); CFNumberGetValue(number, kCFNumberIntType, &mode->height); number = CFDictionaryGetValue(dict, kCGDisplayRefreshRate); CFNumberGetValue(number, kCFNumberIntType, &mode->refresh_rate); - ALLEGRO_INFO("Mode %d is %dx%d@%dHz\n", (int)i, mode->width, mode->height, mode->refresh_rate); + A5O_INFO("Mode %d is %dx%d@%dHz\n", (int)i, mode->width, mode->height, mode->refresh_rate); number = CFDictionaryGetValue(dict, kCGDisplayBitsPerPixel); - CFNumberGetValue(number, kCFNumberIntType, &temp.settings[ALLEGRO_COLOR_SIZE]); + CFNumberGetValue(number, kCFNumberIntType, &temp.settings[A5O_COLOR_SIZE]); number = CFDictionaryGetValue(dict, kCGDisplaySamplesPerPixel); CFNumberGetValue(number, kCFNumberIntType, &samples); number = CFDictionaryGetValue(dict, kCGDisplayBitsPerSample); CFNumberGetValue(number, kCFNumberIntType, &value); - ALLEGRO_INFO("Mode %d has %d bits per pixel, %d samples per pixel and %d bits per sample\n", - (int)i, temp.settings[ALLEGRO_COLOR_SIZE], samples, value); + A5O_INFO("Mode %d has %d bits per pixel, %d samples per pixel and %d bits per sample\n", + (int)i, temp.settings[A5O_COLOR_SIZE], samples, value); if (samples >= 3) { - temp.settings[ALLEGRO_RED_SIZE] = value; - temp.settings[ALLEGRO_GREEN_SIZE] = value; - temp.settings[ALLEGRO_BLUE_SIZE] = value; + temp.settings[A5O_RED_SIZE] = value; + temp.settings[A5O_GREEN_SIZE] = value; + temp.settings[A5O_BLUE_SIZE] = value; if (samples == 4) - temp.settings[ALLEGRO_ALPHA_SIZE] = value; + temp.settings[A5O_ALPHA_SIZE] = value; } _al_fill_display_settings(&temp); mode->format = _al_deduce_color_format(&temp); } #else modes = CGDisplayCopyAllDisplayModes(display, NULL); - ALLEGRO_INFO("detected %d display modes.\n", (int)CFArrayGetCount(modes)); + A5O_INFO("detected %d display modes.\n", (int)CFArrayGetCount(modes)); for (i = 0; i < CFArrayGetCount(modes); i++) { - ALLEGRO_DISPLAY_MODE *amode; + A5O_DISPLAY_MODE *amode; CGDisplayModeRef mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(modes, i); CFStringRef pixel_encoding = CGDisplayModeCopyPixelEncoding(mode); @@ -299,35 +299,35 @@ static int _al_osx_get_num_display_modes(void) CFRelease(pixel_encoding); /* Check if this mode is ok in terms of depth and refresh rate */ - ALLEGRO_INFO("Mode %d has colour depth %d.\n", (int)i, bpp); + A5O_INFO("Mode %d has colour depth %d.\n", (int)i, bpp); if (depth && bpp != depth) { - ALLEGRO_WARN("Skipping mode %d (requested colour depth %d).\n", (int)i, depth); + A5O_WARN("Skipping mode %d (requested colour depth %d).\n", (int)i, depth); continue; } mode_refresh_rate = CGDisplayModeGetRefreshRate(mode); - ALLEGRO_INFO("Mode %d has a refresh rate of %d.\n", (int)i, mode_refresh_rate); + A5O_INFO("Mode %d has a refresh rate of %d.\n", (int)i, mode_refresh_rate); if (refresh_rate && mode_refresh_rate != refresh_rate) { - ALLEGRO_WARN("Skipping mode %d (requested refresh rate %d).\n", (int)i, refresh_rate); + A5O_WARN("Skipping mode %d (requested refresh rate %d).\n", (int)i, refresh_rate); continue; } /* Yes, it's fine */ - amode = (ALLEGRO_DISPLAY_MODE *)_al_vector_alloc_back(&osx_display_modes); + amode = (A5O_DISPLAY_MODE *)_al_vector_alloc_back(&osx_display_modes); amode->width = CGDisplayModeGetWidth(mode); amode->height = CGDisplayModeGetHeight(mode); amode->refresh_rate = mode_refresh_rate; - ALLEGRO_INFO("Mode %d is %dx%d@%dHz\n", (int)i, amode->width, amode->height, amode->refresh_rate); + A5O_INFO("Mode %d is %dx%d@%dHz\n", (int)i, amode->width, amode->height, amode->refresh_rate); - temp.settings[ALLEGRO_COLOR_SIZE] = bpp; - ALLEGRO_INFO("Mode %d has %d bits per pixel, %d samples per pixel and %d bits per sample\n", - (int)i, temp.settings[ALLEGRO_COLOR_SIZE], samples, value); + temp.settings[A5O_COLOR_SIZE] = bpp; + A5O_INFO("Mode %d has %d bits per pixel, %d samples per pixel and %d bits per sample\n", + (int)i, temp.settings[A5O_COLOR_SIZE], samples, value); if (samples >= 3) { - temp.settings[ALLEGRO_RED_SIZE] = value; - temp.settings[ALLEGRO_GREEN_SIZE] = value; - temp.settings[ALLEGRO_BLUE_SIZE] = value; + temp.settings[A5O_RED_SIZE] = value; + temp.settings[A5O_GREEN_SIZE] = value; + temp.settings[A5O_BLUE_SIZE] = value; if (samples == 4) - temp.settings[ALLEGRO_ALPHA_SIZE] = value; + temp.settings[A5O_ALPHA_SIZE] = value; } _al_fill_display_settings(&temp); amode->format = _al_deduce_color_format(&temp); @@ -343,11 +343,11 @@ static int _al_osx_get_num_display_modes(void) * _al_osx_get_num_display_modes: * Gets the number of available display modes */ -static ALLEGRO_DISPLAY_MODE *_al_osx_get_display_mode(int index, ALLEGRO_DISPLAY_MODE *mode) +static A5O_DISPLAY_MODE *_al_osx_get_display_mode(int index, A5O_DISPLAY_MODE *mode) { if ((unsigned)index >= _al_vector_size(&osx_display_modes)) return NULL; - memcpy(mode, _al_vector_ref(&osx_display_modes, index), sizeof(ALLEGRO_DISPLAY_MODE)); + memcpy(mode, _al_vector_ref(&osx_display_modes, index), sizeof(A5O_DISPLAY_MODE)); return mode; } @@ -365,7 +365,7 @@ static int osx_get_num_video_adapters(void) if (screen_list) num = [screen_list count]; - ALLEGRO_INFO("Detected %d displays\n", num); + A5O_INFO("Detected %d displays\n", num); return num; } @@ -407,7 +407,7 @@ float _al_osx_get_global_scale_factor(void) /* osx_get_monitor_info: * Return the details of one monitor */ -static bool osx_get_monitor_info(int adapter, ALLEGRO_MONITOR_INFO* info) +static bool osx_get_monitor_info(int adapter, A5O_MONITOR_INFO* info) { int count = osx_get_num_video_adapters(); int primary_y = _al_osx_get_primary_screen_y(); @@ -437,7 +437,7 @@ static bool osx_get_monitor_info(int adapter, ALLEGRO_MONITOR_INFO* info) info->x2 = (int) (rc.origin.x * global_scale_factor + rc.size.width * scale_factor); info->y1 = (int) (global_scale_factor * (primary_y - (rc.size.height + rc.origin.y))); info->y2 = (int) (info->y1 + scale_factor * rc.size.height); - ALLEGRO_INFO("Display %d has coordinates (%d, %d) - (%d, %d)\n", + A5O_INFO("Display %d has coordinates (%d, %d) - (%d, %d)\n", adapter, info->x1, info->y1, info->x2, info->y2); return true; } @@ -456,7 +456,7 @@ static bool osx_get_monitor_info(int adapter, ALLEGRO_MONITOR_INFO* info) info->x2 = (int) (rc.origin.x + rc.size.width); info->y1 = (int) rc.origin.y; info->y2 = (int) (rc.origin.y + rc.size.height); - ALLEGRO_INFO("Display %d has coordinates (%d, %d) - (%d, %d)\n", + A5O_INFO("Display %d has coordinates (%d, %d) - (%d, %d)\n", adapter, info->x1, info->y1, info->x2, info->y2); return true; } @@ -502,7 +502,7 @@ static bool osx_inhibit_screensaver(bool inhibit) [delegate performSelectorOnMainThread: @selector(setInhibitScreenSaver:) withObject: [NSNumber numberWithBool:inhibit ? YES : NO] waitUntilDone: NO]; - ALLEGRO_INFO("Stop screensaver\n"); + A5O_INFO("Stop screensaver\n"); return true; } @@ -510,7 +510,7 @@ static bool osx_inhibit_screensaver(bool inhibit) * Create an NSImage from an Allegro bitmap * This could definitely be speeded up if necessary. */ -NSImage* NSImageFromAllegroBitmap(ALLEGRO_BITMAP* bmp) +NSImage* NSImageFromAllegroBitmap(A5O_BITMAP* bmp) { int w = al_get_bitmap_width(bmp); int h = al_get_bitmap_height(bmp); @@ -525,11 +525,11 @@ static bool osx_inhibit_screensaver(bool inhibit) colorSpaceName:NSDeviceRGBColorSpace bytesPerRow: 0 // Calculate yourself bitsPerPixel:0 ];// Calculate yourself - al_lock_bitmap(bmp, ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_READONLY); + al_lock_bitmap(bmp, A5O_PIXEL_FORMAT_ANY, A5O_LOCK_READONLY); int x, y; for (y = 0; yid = ALLEGRO_SYSTEM_ID_MACOSX; + vt->id = A5O_SYSTEM_ID_MACOSX; vt->initialize = osx_sys_init; vt->get_display_driver = _al_osx_get_display_driver; vt->get_keyboard_driver = _al_osx_get_keyboard_driver; @@ -603,38 +603,38 @@ static void osx_thread_exit(ALLEGRO_THREAD *thread) */ void _al_register_system_interfaces() { - ALLEGRO_SYSTEM_INTERFACE **add; + A5O_SYSTEM_INTERFACE **add; add = _al_vector_alloc_back(&_al_system_interfaces); *add = _al_system_osx_driver(); } /* Implementation of get_path */ -ALLEGRO_PATH *_al_osx_get_path(int id) +A5O_PATH *_al_osx_get_path(int id) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSString* ans = nil; NSArray* paths = nil; NSString *org_name = [[NSString alloc] initWithUTF8String: al_get_org_name()]; NSString *app_name = [[NSString alloc] initWithUTF8String: al_get_app_name()]; - ALLEGRO_PATH *path = NULL; + A5O_PATH *path = NULL; switch (id) { - case ALLEGRO_RESOURCES_PATH: + case A5O_RESOURCES_PATH: if (_al_osx_bundle) { ans = [_al_osx_bundle resourcePath]; path = al_create_path_for_directory([ans UTF8String]); } else { /* Otherwise, return the executable pathname */ - path = _al_osx_get_path(ALLEGRO_EXENAME_PATH); + path = _al_osx_get_path(A5O_EXENAME_PATH); al_set_path_filename(path, NULL); } break; - case ALLEGRO_TEMP_PATH: + case A5O_TEMP_PATH: ans = NSTemporaryDirectory(); path = al_create_path_for_directory([ans UTF8String]); break; - case ALLEGRO_USER_DATA_PATH: + case A5O_USER_DATA_PATH: paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); @@ -647,11 +647,11 @@ void _al_register_system_interfaces() } path = al_create_path_for_directory([ans UTF8String]); break; - case ALLEGRO_USER_HOME_PATH: + case A5O_USER_HOME_PATH: ans = NSHomeDirectory(); path = al_create_path_for_directory([ans UTF8String]); break; - case ALLEGRO_USER_DOCUMENTS_PATH: + case A5O_USER_DOCUMENTS_PATH: paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); @@ -659,7 +659,7 @@ void _al_register_system_interfaces() ans = [paths objectAtIndex: 0]; path = al_create_path_for_directory([ans UTF8String]); break; - case ALLEGRO_EXENAME_PATH: { + case A5O_EXENAME_PATH: { char exepath[PATH_MAX]; uint32_t size = sizeof(exepath); if (_NSGetExecutablePath(exepath, &size) == 0) @@ -668,7 +668,7 @@ void _al_register_system_interfaces() path = al_create_path([ans UTF8String]); break; } - case ALLEGRO_USER_SETTINGS_PATH: + case A5O_USER_SETTINGS_PATH: paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, @@ -703,11 +703,11 @@ void _al_osx_post_quit(void) _AL_VECTOR* dpys = &al_get_system_driver()->displays; // Iterate through all existing displays for (i = 0; i < _al_vector_size(dpys); ++i) { - ALLEGRO_DISPLAY* dpy = *(ALLEGRO_DISPLAY**) _al_vector_ref(dpys, i); - ALLEGRO_EVENT_SOURCE* src = &(dpy->es); + A5O_DISPLAY* dpy = *(A5O_DISPLAY**) _al_vector_ref(dpys, i); + A5O_EVENT_SOURCE* src = &(dpy->es); _al_event_source_lock(src); - ALLEGRO_EVENT evt; - evt.type = ALLEGRO_EVENT_DISPLAY_CLOSE; + A5O_EVENT evt; + evt.type = A5O_EVENT_DISPLAY_CLOSE; // Send event _al_event_source_emit_event(src, &evt); _al_event_source_unlock(src); diff --git a/src/math.c b/src/math.c index 30b7bbcea3..3a3d0ce0ed 100644 --- a/src/math.c +++ b/src/math.c @@ -20,7 +20,7 @@ #include "allegro5/allegro.h" -#ifdef ALLEGRO_MSVC +#ifdef A5O_MSVC #define hypotf(x, y) _hypotf((x), (y)) #endif diff --git a/src/memblit.c b/src/memblit.c index 584721ba30..dc3d66ae6f 100644 --- a/src/memblit.c +++ b/src/memblit.c @@ -23,14 +23,14 @@ #include "allegro5/internal/aintern_tri_soft.h" #include -#define MIN _ALLEGRO_MIN -#define MAX _ALLEGRO_MAX +#define MIN _A5O_MIN +#define MAX _A5O_MAX static void _al_draw_transformed_scaled_bitmap_memory( - ALLEGRO_BITMAP *src, ALLEGRO_COLOR tint, + A5O_BITMAP *src, A5O_COLOR tint, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int flags); -static void _al_draw_bitmap_region_memory_fast(ALLEGRO_BITMAP *bitmap, +static void _al_draw_bitmap_region_memory_fast(A5O_BITMAP *bitmap, int sx, int sy, int sw, int sh, int dx, int dy, int flags); @@ -130,8 +130,8 @@ static void _al_draw_bitmap_region_memory_fast(ALLEGRO_BITMAP *bitmap, } -void _al_draw_bitmap_region_memory(ALLEGRO_BITMAP *src, - ALLEGRO_COLOR tint, +void _al_draw_bitmap_region_memory(A5O_BITMAP *src, + A5O_COLOR tint, int sx, int sy, int sw, int sh, int dx, int dy, int flags) { @@ -161,20 +161,20 @@ void _al_draw_bitmap_region_memory(ALLEGRO_BITMAP *src, } -static void _al_draw_transformed_bitmap_memory(ALLEGRO_BITMAP *src, - ALLEGRO_COLOR tint, +static void _al_draw_transformed_bitmap_memory(A5O_BITMAP *src, + A5O_COLOR tint, int sx, int sy, int sw, int sh, int dw, int dh, - ALLEGRO_TRANSFORM* local_trans, int flags) + A5O_TRANSFORM* local_trans, int flags) { float xsf[4], ysf[4]; int tl = 0, tr = 1, bl = 3, br = 2; int tmp; - ALLEGRO_VERTEX v[4]; + A5O_VERTEX v[4]; ASSERT(_al_pixel_format_is_real(al_get_bitmap_format(src))); /* Decide what order to take corners in. */ - if (flags & ALLEGRO_FLIP_VERTICAL) { + if (flags & A5O_FLIP_VERTICAL) { tl = 3; tr = 2; bl = 0; @@ -186,7 +186,7 @@ static void _al_draw_transformed_bitmap_memory(ALLEGRO_BITMAP *src, bl = 3; br = 2; } - if (flags & ALLEGRO_FLIP_HORIZONTAL) { + if (flags & A5O_FLIP_HORIZONTAL) { tmp = tl; tl = tr; tr = tmp; @@ -236,7 +236,7 @@ static void _al_draw_transformed_bitmap_memory(ALLEGRO_BITMAP *src, v[bl].v = sy + sh; v[bl].color = tint; - al_lock_bitmap(src, ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_READONLY); + al_lock_bitmap(src, A5O_PIXEL_FORMAT_ANY, A5O_LOCK_READONLY); _al_triangle_2d(src, &v[tl], &v[tr], &v[br]); _al_triangle_2d(src, &v[tl], &v[br], &v[bl]); @@ -246,10 +246,10 @@ static void _al_draw_transformed_bitmap_memory(ALLEGRO_BITMAP *src, static void _al_draw_transformed_scaled_bitmap_memory( - ALLEGRO_BITMAP *src, ALLEGRO_COLOR tint, + A5O_BITMAP *src, A5O_COLOR tint, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int flags) { - ALLEGRO_TRANSFORM local_trans; + A5O_TRANSFORM local_trans; al_identity_transform(&local_trans); al_translate_transform(&local_trans, dx, dy); @@ -260,13 +260,13 @@ static void _al_draw_transformed_scaled_bitmap_memory( } -static void _al_draw_bitmap_region_memory_fast(ALLEGRO_BITMAP *bitmap, +static void _al_draw_bitmap_region_memory_fast(A5O_BITMAP *bitmap, int sx, int sy, int sw, int sh, int dx, int dy, int flags) { - ALLEGRO_LOCKED_REGION *src_region; - ALLEGRO_LOCKED_REGION *dst_region; - ALLEGRO_BITMAP *dest = al_get_target_bitmap(); + A5O_LOCKED_REGION *src_region; + A5O_LOCKED_REGION *dst_region; + A5O_BITMAP *dest = al_get_target_bitmap(); int dw = sw, dh = sh; ASSERT(_al_pixel_format_is_real(al_get_bitmap_format(bitmap))); @@ -282,12 +282,12 @@ static void _al_draw_bitmap_region_memory_fast(ALLEGRO_BITMAP *bitmap, CLIPPER(bitmap, sx, sy, sw, sh, dest, dx, dy, dw, dh, 1, 1, flags) if (!(src_region = al_lock_bitmap_region(bitmap, sx, sy, sw, sh, - ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_READONLY))) { + A5O_PIXEL_FORMAT_ANY, A5O_LOCK_READONLY))) { return; } if (!(dst_region = al_lock_bitmap_region(dest, dx, dy, sw, sh, - ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_WRITEONLY))) { + A5O_PIXEL_FORMAT_ANY, A5O_LOCK_WRITEONLY))) { al_unlock_bitmap(bitmap); return; } diff --git a/src/memdraw.c b/src/memdraw.c index 847e245ae4..cefdc047e8 100644 --- a/src/memdraw.c +++ b/src/memdraw.c @@ -35,10 +35,10 @@ typedef struct { } float4; -void _al_draw_pixel_memory(ALLEGRO_BITMAP *bitmap, float x, float y, - ALLEGRO_COLOR *color) +void _al_draw_pixel_memory(A5O_BITMAP *bitmap, float x, float y, + A5O_COLOR *color) { - ALLEGRO_COLOR result; + A5O_COLOR result; int ix, iy; /* * Probably not worth it to check for identity @@ -51,9 +51,9 @@ void _al_draw_pixel_memory(ALLEGRO_BITMAP *bitmap, float x, float y, } -void _al_clear_bitmap_by_locking(ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR *color) +void _al_clear_bitmap_by_locking(A5O_BITMAP *bitmap, A5O_COLOR *color) { - ALLEGRO_LOCKED_REGION *lr; + A5O_LOCKED_REGION *lr; int x1, y1, w, h; int x, y; unsigned char *line_ptr; @@ -62,7 +62,7 @@ void _al_clear_bitmap_by_locking(ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR *color) * video bitmaps which are not the current target, or when locked. */ ASSERT(bitmap); - ASSERT((al_get_bitmap_flags(bitmap) & (ALLEGRO_MEMORY_BITMAP | _ALLEGRO_INTERNAL_OPENGL)) || + ASSERT((al_get_bitmap_flags(bitmap) & (A5O_MEMORY_BITMAP | _A5O_INTERNAL_OPENGL)) || _al_pixel_format_is_compressed(al_get_bitmap_format(bitmap))); x1 = bitmap->cl; @@ -74,7 +74,7 @@ void _al_clear_bitmap_by_locking(ALLEGRO_BITMAP *bitmap, ALLEGRO_COLOR *color) return; /* XXX what about pre-locked bitmaps? */ - lr = al_lock_bitmap_region(bitmap, x1, y1, w, h, ALLEGRO_PIXEL_FORMAT_ANY, 0); + lr = al_lock_bitmap_region(bitmap, x1, y1, w, h, A5O_PIXEL_FORMAT_ANY, 0); if (!lr) return; diff --git a/src/memory.c b/src/memory.c index d855199e41..8addcf3dd0 100644 --- a/src/memory.c +++ b/src/memory.c @@ -20,13 +20,13 @@ /* globals */ -static ALLEGRO_MEMORY_INTERFACE *mem = NULL; +static A5O_MEMORY_INTERFACE *mem = NULL; /* Function: al_set_memory_interface */ -void al_set_memory_interface(ALLEGRO_MEMORY_INTERFACE *memory_interface) +void al_set_memory_interface(A5O_MEMORY_INTERFACE *memory_interface) { mem = memory_interface; } diff --git a/src/misc/list.c b/src/misc/list.c index 9a047b9a47..758479dd08 100644 --- a/src/misc/list.c +++ b/src/misc/list.c @@ -28,7 +28,7 @@ #include "allegro5/internal/aintern_list.h" -ALLEGRO_DEBUG_CHANNEL("list") +A5O_DEBUG_CHANNEL("list") /* Definition of list, holds root and size. */ @@ -109,7 +109,7 @@ static _AL_LIST* list_do_create(size_t capacity, size_t extra_item_size) memory_ptr = (uint8_t*)al_malloc(memory_size); if (NULL == memory_ptr) { - ALLEGRO_ERROR("Out of memory."); + A5O_ERROR("Out of memory."); return NULL; } @@ -246,7 +246,7 @@ _AL_LIST* _al_list_create_static(size_t capacity) { if (capacity < 1) { - ALLEGRO_ERROR("Cannot create static list without any capacity."); + A5O_ERROR("Cannot create static list without any capacity."); return NULL; } diff --git a/src/monitor.c b/src/monitor.c index 39a987f952..e540d079ed 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -22,7 +22,7 @@ */ int al_get_num_video_adapters(void) { - ALLEGRO_SYSTEM *system = al_get_system_driver(); + A5O_SYSTEM *system = al_get_system_driver(); if (system && system->vt && system->vt->get_num_video_adapters) { return system->vt->get_num_video_adapters(); @@ -35,7 +35,7 @@ int al_get_num_video_adapters(void) */ int al_get_monitor_refresh_rate(int adapter) { - ALLEGRO_SYSTEM *system = al_get_system_driver(); + A5O_SYSTEM *system = al_get_system_driver(); if (adapter < al_get_num_video_adapters()) { if (system && system->vt && system->vt->get_monitor_refresh_rate) { @@ -49,9 +49,9 @@ int al_get_monitor_refresh_rate(int adapter) /* Function: al_get_monitor_info */ -bool al_get_monitor_info(int adapter, ALLEGRO_MONITOR_INFO *info) +bool al_get_monitor_info(int adapter, A5O_MONITOR_INFO *info) { - ALLEGRO_SYSTEM *system = al_get_system_driver(); + A5O_SYSTEM *system = al_get_system_driver(); if (adapter < al_get_num_video_adapters()) { if (system && system->vt && system->vt->get_monitor_info) { @@ -67,7 +67,7 @@ bool al_get_monitor_info(int adapter, ALLEGRO_MONITOR_INFO *info) */ int al_get_monitor_dpi(int adapter) { - ALLEGRO_SYSTEM *system = al_get_system_driver(); + A5O_SYSTEM *system = al_get_system_driver(); if (adapter < al_get_num_video_adapters()) { if (system && system->vt && system->vt->get_monitor_dpi) { diff --git a/src/mouse_cursor.c b/src/mouse_cursor.c index ed256a8196..ad0310b8ed 100644 --- a/src/mouse_cursor.c +++ b/src/mouse_cursor.c @@ -21,10 +21,10 @@ /* Function: al_create_mouse_cursor */ -ALLEGRO_MOUSE_CURSOR *al_create_mouse_cursor(ALLEGRO_BITMAP *bmp, +A5O_MOUSE_CURSOR *al_create_mouse_cursor(A5O_BITMAP *bmp, int x_focus, int y_focus) { - ALLEGRO_SYSTEM *sysdrv = al_get_system_driver(); + A5O_SYSTEM *sysdrv = al_get_system_driver(); ASSERT(bmp); ASSERT(sysdrv->vt->create_mouse_cursor); @@ -34,9 +34,9 @@ ALLEGRO_MOUSE_CURSOR *al_create_mouse_cursor(ALLEGRO_BITMAP *bmp, /* Function: al_destroy_mouse_cursor */ -void al_destroy_mouse_cursor(ALLEGRO_MOUSE_CURSOR *cursor) +void al_destroy_mouse_cursor(A5O_MOUSE_CURSOR *cursor) { - ALLEGRO_SYSTEM *sysdrv; + A5O_SYSTEM *sysdrv; if (!cursor) { return; @@ -51,7 +51,7 @@ void al_destroy_mouse_cursor(ALLEGRO_MOUSE_CURSOR *cursor) /* Function: al_set_mouse_cursor */ -bool al_set_mouse_cursor(ALLEGRO_DISPLAY *display, ALLEGRO_MOUSE_CURSOR *cursor) +bool al_set_mouse_cursor(A5O_DISPLAY *display, A5O_MOUSE_CURSOR *cursor) { if (!cursor) { return false; @@ -68,18 +68,18 @@ bool al_set_mouse_cursor(ALLEGRO_DISPLAY *display, ALLEGRO_MOUSE_CURSOR *cursor) /* Function: al_set_system_mouse_cursor */ -bool al_set_system_mouse_cursor(ALLEGRO_DISPLAY *display, - ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id) +bool al_set_system_mouse_cursor(A5O_DISPLAY *display, + A5O_SYSTEM_MOUSE_CURSOR cursor_id) { - /* XXX should you be able to set ALLEGRO_SYSTEM_MOUSE_CURSOR_NONE? */ - ASSERT(cursor_id > ALLEGRO_SYSTEM_MOUSE_CURSOR_NONE); - ASSERT(cursor_id < ALLEGRO_NUM_SYSTEM_MOUSE_CURSORS); + /* XXX should you be able to set A5O_SYSTEM_MOUSE_CURSOR_NONE? */ + ASSERT(cursor_id > A5O_SYSTEM_MOUSE_CURSOR_NONE); + ASSERT(cursor_id < A5O_NUM_SYSTEM_MOUSE_CURSORS); ASSERT(display); - if (cursor_id <= ALLEGRO_SYSTEM_MOUSE_CURSOR_NONE) { + if (cursor_id <= A5O_SYSTEM_MOUSE_CURSOR_NONE) { return false; } - if (cursor_id > ALLEGRO_NUM_SYSTEM_MOUSE_CURSORS) { + if (cursor_id > A5O_NUM_SYSTEM_MOUSE_CURSORS) { return false; } if (!display) { @@ -93,7 +93,7 @@ bool al_set_system_mouse_cursor(ALLEGRO_DISPLAY *display, /* Function: al_show_mouse_cursor */ -bool al_show_mouse_cursor(ALLEGRO_DISPLAY *display) +bool al_show_mouse_cursor(A5O_DISPLAY *display) { if (display) { ASSERT(display->vt->show_mouse_cursor); @@ -106,7 +106,7 @@ bool al_show_mouse_cursor(ALLEGRO_DISPLAY *display) /* Function: al_hide_mouse_cursor */ -bool al_hide_mouse_cursor(ALLEGRO_DISPLAY *display) +bool al_hide_mouse_cursor(A5O_DISPLAY *display) { if (display) { ASSERT(display->vt->hide_mouse_cursor); diff --git a/src/mousenu.c b/src/mousenu.c index b162bb3a62..ad857b17cf 100644 --- a/src/mousenu.c +++ b/src/mousenu.c @@ -19,7 +19,7 @@ */ -#define ALLEGRO_NO_COMPATIBILITY +#define A5O_NO_COMPATIBILITY #include "allegro5/allegro.h" #include "allegro5/internal/aintern.h" @@ -31,7 +31,7 @@ /* the active keyboard driver */ -static ALLEGRO_MOUSE_DRIVER *new_mouse_driver = NULL; +static A5O_MOUSE_DRIVER *new_mouse_driver = NULL; @@ -115,9 +115,9 @@ void al_uninstall_mouse(void) /* This was in the public API but its only purpose is now served by * al_get_mouse_event_source(). */ -static ALLEGRO_MOUSE *al_get_mouse(void) +static A5O_MOUSE *al_get_mouse(void) { - ALLEGRO_MOUSE *mse; + A5O_MOUSE *mse; ASSERT(new_mouse_driver); @@ -153,7 +153,7 @@ unsigned int al_get_mouse_num_axes(void) /* Function: al_set_mouse_xy */ -bool al_set_mouse_xy(ALLEGRO_DISPLAY *display, int x, int y) +bool al_set_mouse_xy(A5O_DISPLAY *display, int x, int y) { ASSERT(new_mouse_driver); ASSERT(new_mouse_driver->set_mouse_xy); @@ -194,9 +194,9 @@ bool al_set_mouse_axis(int which, int value) ASSERT(new_mouse_driver); ASSERT(new_mouse_driver->set_mouse_axis); ASSERT(which >= 2); - ASSERT(which < 4 + ALLEGRO_MOUSE_MAX_EXTRA_AXES); + ASSERT(which < 4 + A5O_MOUSE_MAX_EXTRA_AXES); - if (which >= 2 && which < 4 + ALLEGRO_MOUSE_MAX_EXTRA_AXES) + if (which >= 2 && which < 4 + A5O_MOUSE_MAX_EXTRA_AXES) return new_mouse_driver->set_mouse_axis(which, value); else return false; @@ -206,7 +206,7 @@ bool al_set_mouse_axis(int which, int value) /* Function: al_get_mouse_state */ -void al_get_mouse_state(ALLEGRO_MOUSE_STATE *ret_state) +void al_get_mouse_state(A5O_MOUSE_STATE *ret_state) { ASSERT(new_mouse_driver); ASSERT(ret_state); @@ -218,11 +218,11 @@ void al_get_mouse_state(ALLEGRO_MOUSE_STATE *ret_state) /* Function: al_get_mouse_state_axis */ -int al_get_mouse_state_axis(const ALLEGRO_MOUSE_STATE *state, int axis) +int al_get_mouse_state_axis(const A5O_MOUSE_STATE *state, int axis) { ASSERT(state); ASSERT(axis >= 0); - ASSERT(axis < (4 + ALLEGRO_MOUSE_MAX_EXTRA_AXES)); + ASSERT(axis < (4 + A5O_MOUSE_MAX_EXTRA_AXES)); switch (axis) { case 0: @@ -242,7 +242,7 @@ int al_get_mouse_state_axis(const ALLEGRO_MOUSE_STATE *state, int axis) /* Function: al_mouse_button_down */ -bool al_mouse_button_down(const ALLEGRO_MOUSE_STATE *state, int button) +bool al_mouse_button_down(const A5O_MOUSE_STATE *state, int button) { ASSERT(state); ASSERT(button > 0); @@ -255,7 +255,7 @@ bool al_mouse_button_down(const ALLEGRO_MOUSE_STATE *state, int button) */ bool al_can_get_mouse_cursor_position(void) { - ALLEGRO_SYSTEM *alsys = al_get_system_driver(); + A5O_SYSTEM *alsys = al_get_system_driver(); return alsys->vt->get_cursor_position; } @@ -265,7 +265,7 @@ bool al_can_get_mouse_cursor_position(void) */ bool al_get_mouse_cursor_position(int *ret_x, int *ret_y) { - ALLEGRO_SYSTEM *alsys = al_get_system_driver(); + A5O_SYSTEM *alsys = al_get_system_driver(); ASSERT(ret_x); ASSERT(ret_y); @@ -283,9 +283,9 @@ bool al_get_mouse_cursor_position(int *ret_x, int *ret_y) /* Function: al_grab_mouse */ -bool al_grab_mouse(ALLEGRO_DISPLAY *display) +bool al_grab_mouse(A5O_DISPLAY *display) { - ALLEGRO_SYSTEM *alsys = al_get_system_driver(); + A5O_SYSTEM *alsys = al_get_system_driver(); if (alsys->vt->grab_mouse) return alsys->vt->grab_mouse(display); @@ -299,7 +299,7 @@ bool al_grab_mouse(ALLEGRO_DISPLAY *display) */ bool al_ungrab_mouse(void) { - ALLEGRO_SYSTEM *alsys = al_get_system_driver(); + A5O_SYSTEM *alsys = al_get_system_driver(); if (alsys->vt->ungrab_mouse) return alsys->vt->ungrab_mouse(); @@ -311,9 +311,9 @@ bool al_ungrab_mouse(void) /* Function: al_get_mouse_event_source */ -ALLEGRO_EVENT_SOURCE *al_get_mouse_event_source(void) +A5O_EVENT_SOURCE *al_get_mouse_event_source(void) { - ALLEGRO_MOUSE *mouse = al_get_mouse(); + A5O_MOUSE *mouse = al_get_mouse(); return (mouse) ? &mouse->es : NULL; } @@ -324,7 +324,7 @@ ALLEGRO_EVENT_SOURCE *al_get_mouse_event_source(void) */ void al_set_mouse_wheel_precision(int precision) { - ALLEGRO_SYSTEM *alsys = al_get_system_driver(); + A5O_SYSTEM *alsys = al_get_system_driver(); ASSERT(alsys); if (precision < 1) precision = 1; @@ -337,7 +337,7 @@ void al_set_mouse_wheel_precision(int precision) */ int al_get_mouse_wheel_precision(void) { - ALLEGRO_SYSTEM *alsys = al_get_system_driver(); + A5O_SYSTEM *alsys = al_get_system_driver(); ASSERT(alsys); return alsys->mouse_wheel_precision; } diff --git a/src/opengl/extensions.c b/src/opengl/extensions.c index 4409cc47b0..b23ecf1534 100644 --- a/src/opengl/extensions.c +++ b/src/opengl/extensions.c @@ -29,45 +29,45 @@ #include "allegro5/internal/aintern_system.h" /* We need some driver specific details not worth of a vtable entry. */ -#if defined ALLEGRO_WINDOWS +#if defined A5O_WINDOWS #include "../win/wgl.h" -#elif defined ALLEGRO_UNIX && !defined ALLEGRO_EXCLUDE_GLX +#elif defined A5O_UNIX && !defined A5O_EXCLUDE_GLX #include "allegro5/internal/aintern_xdisplay.h" #include "allegro5/internal/aintern_xsystem.h" #endif -#if defined __APPLE__ && !defined ALLEGRO_IPHONE +#if defined __APPLE__ && !defined A5O_IPHONE #include -#elif !defined ALLEGRO_CFG_OPENGLES +#elif !defined A5O_CFG_OPENGLES #include #endif -ALLEGRO_DEBUG_CHANNEL("opengl") +A5O_DEBUG_CHANNEL("opengl") -#ifdef ALLEGRO_HAVE_DYNAMIC_LINK +#ifdef A5O_HAVE_DYNAMIC_LINK #include /* Handle for dynamic library libGL.so */ static void *__libgl_handle = NULL; /* Pointer to glXGetProcAddressARB */ typedef void *(*GLXGETPROCADDRESSARBPROC) (const GLubyte *); static GLXGETPROCADDRESSARBPROC alXGetProcAddress; -#else /* #ifdef ALLEGRO_HAVE_DYNAMIC_LINK */ +#else /* #ifdef A5O_HAVE_DYNAMIC_LINK */ /* Tries static linking */ - /* FIXME: set ALLEGRO_GLXGETPROCADDRESSARB on configure time, if + /* FIXME: set A5O_GLXGETPROCADDRESSARB on configure time, if * glXGetProcAddressARB must be used! */ - #if defined ALLEGRO_GLXGETPROCADDRESSARB + #if defined A5O_GLXGETPROCADDRESSARB #define alXGetProcAddress glXGetProcAddressARB - #elif defined ALLEGRO_RASPBERRYPI + #elif defined A5O_RASPBERRYPI #define alXGetProcAddress eglGetProcAddress #else #define alXGetProcAddress glXGetProcAddress #endif -#endif /* #ifdef ALLEGRO_HAVE_DYNAMIC_LINK */ +#endif /* #ifdef A5O_HAVE_DYNAMIC_LINK */ -#ifdef ALLEGRO_MACOSX +#ifdef A5O_MACOSX #include static CFBundleRef opengl_bundle_ref; #endif @@ -75,17 +75,17 @@ ALLEGRO_DEBUG_CHANNEL("opengl") /* Define the GL API pointers. * Example: - * _ALLEGRO_glBlendEquation_t _al_glBlendEquation = NULL; + * _A5O_glBlendEquation_t _al_glBlendEquation = NULL; */ -#define AGL_API(type, name, args) _ALLEGRO_gl##name##_t _al_gl##name = NULL; +#define AGL_API(type, name, args) _A5O_gl##name##_t _al_gl##name = NULL; # include "allegro5/opengl/GLext/gl_ext_api.h" #undef AGL_API -#ifdef ALLEGRO_WINDOWS -#define AGL_API(type, name, args) _ALLEGRO_wgl##name##_t _al_wgl##name = NULL; +#ifdef A5O_WINDOWS +#define AGL_API(type, name, args) _A5O_wgl##name##_t _al_wgl##name = NULL; # include "allegro5/opengl/GLext/wgl_ext_api.h" #undef AGL_API -#elif defined ALLEGRO_UNIX -#define AGL_API(type, name, args) _ALLEGRO_glX##name##_t _al_glX##name = NULL; +#elif defined A5O_UNIX +#define AGL_API(type, name, args) _A5O_glX##name##_t _al_glX##name = NULL; # include "allegro5/opengl/GLext/glx_ext_api.h" #undef AGL_API #endif @@ -117,14 +117,14 @@ static uint32_t parse_opengl_version(const char *s) l = strtol(p, &end, 10); if (errno) break; - v[n] = _ALLEGRO_CLAMP(0, l, 255); + v[n] = _A5O_CLAMP(0, l, 255); if (*end != '.') break; p = end + 1; /* skip dot */ } ver = (v[0] << 24) | (v[1] << 16) | (v[2] << 8) | v[3]; - ALLEGRO_DEBUG("Parsed '%s' as 0x%08x\n", s, ver); + A5O_DEBUG("Parsed '%s' as 0x%08x\n", s, ver); return ver; } @@ -137,7 +137,7 @@ static uint32_t _al_ogl_version(void) "force_opengl_version"); if (value) { uint32_t v = parse_opengl_version(value); - ALLEGRO_INFO("OpenGL version forced to %d.%d.%d.%d.\n", + A5O_INFO("OpenGL version forced to %d.%d.%d.%d.\n", (v >> 24) & 0xff, (v >> 16) & 0xff, (v >> 8) & 0xff, @@ -149,7 +149,7 @@ static uint32_t _al_ogl_version(void) str = (const char *)glGetString(GL_VERSION); if (str) { - #ifdef ALLEGRO_CFG_OPENGLES + #ifdef A5O_CFG_OPENGLES char *str2 = strstr(str, "ES "); if (str2) str = str2 + 3; @@ -160,7 +160,7 @@ static uint32_t _al_ogl_version(void) /* The OpenGL driver does not return a version * number. However it probably supports at least OpenGL 1.0 */ - return _ALLEGRO_OPENGL_VERSION_1_0; + return _A5O_OPENGL_VERSION_1_0; } } @@ -188,13 +188,13 @@ static void print_extensions(char const *extension) *start = '\0'; if (*extension != '\0') extension++; - ALLEGRO_DEBUG("%s\n", buf); + A5O_DEBUG("%s\n", buf); } } -#if !defined ALLEGRO_CFG_OPENGLES +#if !defined A5O_CFG_OPENGLES /* Print all extensions the OpenGL 3.0 way. */ static void print_extensions_3_0(void) { @@ -204,7 +204,7 @@ static void print_extensions_3_0(void) glGetIntegerv(GL_NUM_EXTENSIONS, &n); for (i = 0; i < n; i++) { name = glGetStringi(GL_EXTENSIONS, i); - ALLEGRO_DEBUG("%s\n", name); + A5O_DEBUG("%s\n", name); } } #endif @@ -215,7 +215,7 @@ static void print_extensions_3_0(void) */ uint32_t al_get_opengl_version(void) { - ALLEGRO_DISPLAY *ogl_disp; + A5O_DISPLAY *ogl_disp; ogl_disp = al_get_current_display(); if (!ogl_disp || !ogl_disp->ogl_extras) @@ -233,17 +233,17 @@ uint32_t al_get_opengl_version(void) */ int al_get_opengl_variant(void) { -#if defined ALLEGRO_CFG_OPENGLES - return ALLEGRO_OPENGL_ES; +#if defined A5O_CFG_OPENGLES + return A5O_OPENGL_ES; #else - return ALLEGRO_DESKTOP_OPENGL; + return A5O_DESKTOP_OPENGL; #endif } /* Create the extension list */ -static ALLEGRO_OGL_EXT_LIST *create_extension_list(void) +static A5O_OGL_EXT_LIST *create_extension_list(void) { - ALLEGRO_OGL_EXT_LIST *ret = al_calloc(1, sizeof(ALLEGRO_OGL_EXT_LIST)); + A5O_OGL_EXT_LIST *ret = al_calloc(1, sizeof(A5O_OGL_EXT_LIST)); if (!ret) { return NULL; @@ -255,9 +255,9 @@ static ALLEGRO_OGL_EXT_LIST *create_extension_list(void) /* Create the extension API table */ -static ALLEGRO_OGL_EXT_API *create_extension_api_table(void) +static A5O_OGL_EXT_API *create_extension_api_table(void) { - ALLEGRO_OGL_EXT_API *ret = al_calloc(1, sizeof(ALLEGRO_OGL_EXT_API)); + A5O_OGL_EXT_API *ret = al_calloc(1, sizeof(A5O_OGL_EXT_API)); if (!ret) { return NULL; @@ -276,22 +276,22 @@ typedef void (*VOID_FPTR)(void); static VOID_FPTR load_extension(const char* name) { VOID_FPTR fptr = NULL; -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS fptr = (VOID_FPTR)wglGetProcAddress(name); -#elif defined ALLEGRO_UNIX +#elif defined A5O_UNIX fptr = (VOID_FPTR)alXGetProcAddress((const GLubyte*)name); -#elif defined ALLEGRO_MACOSX +#elif defined A5O_MACOSX CFStringRef cfstr = CFStringCreateWithCStringNoCopy(NULL, name, kCFStringEncodingUTF8, kCFAllocatorNull); if (cfstr) { fptr = (VOID_FPTR)CFBundleGetFunctionPointerForName(opengl_bundle_ref, cfstr); CFRelease(cfstr); } -#elif defined ALLEGRO_SDL +#elif defined A5O_SDL fptr = SDL_GL_GetProcAddress(name); #endif if (fptr) { - ALLEGRO_DEBUG("%s successfully loaded (%p)\n", name, fptr); + A5O_DEBUG("%s successfully loaded (%p)\n", name, fptr); } return fptr; } @@ -301,65 +301,65 @@ static VOID_FPTR load_extension(const char* name) /* Load the extension API addresses into the table. * Should only be done on context creation. */ -static void load_extensions(ALLEGRO_OGL_EXT_API *ext) +static void load_extensions(A5O_OGL_EXT_API *ext) { if (!ext) { return; } -#ifdef ALLEGRO_UNIX -#ifdef ALLEGRO_HAVE_DYNAMIC_LINK +#ifdef A5O_UNIX +#ifdef A5O_HAVE_DYNAMIC_LINK if (!alXGetProcAddress) { return; } #endif #endif -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS #define AGL_API(type, name, args) \ - ext->name = (_ALLEGRO_gl##name##_t)load_extension("gl" #name); + ext->name = (_A5O_gl##name##_t)load_extension("gl" #name); #include "allegro5/opengl/GLext/gl_ext_api.h" #undef AGL_API #define AGL_API(type, name, args) \ - ext->name = (_ALLEGRO_wgl##name##_t)load_extension("wgl" #name); + ext->name = (_A5O_wgl##name##_t)load_extension("wgl" #name); #include "allegro5/opengl/GLext/wgl_ext_api.h" #undef AGL_API -#elif defined ALLEGRO_UNIX +#elif defined A5O_UNIX #define AGL_API(type, name, args) \ - ext->name = (_ALLEGRO_gl##name##_t)load_extension("gl" #name); + ext->name = (_A5O_gl##name##_t)load_extension("gl" #name); #include "allegro5/opengl/GLext/gl_ext_api.h" #undef AGL_API #define AGL_API(type, name, args) \ - ext->name = (_ALLEGRO_glX##name##_t)load_extension("glX" #name); + ext->name = (_A5O_glX##name##_t)load_extension("glX" #name); #include "allegro5/opengl/GLext/glx_ext_api.h" #undef AGL_API -#elif defined ALLEGRO_MACOSX +#elif defined A5O_MACOSX #define AGL_API(type, name, args) \ - ext->name = (_ALLEGRO_gl##name##_t)load_extension("gl" # name); + ext->name = (_A5O_gl##name##_t)load_extension("gl" # name); #include "allegro5/opengl/GLext/gl_ext_api.h" #undef AGL_API -#elif defined ALLEGRO_SDL +#elif defined A5O_SDL #define AGL_API(type, name, args) \ - ext->name = (_ALLEGRO_gl##name##_t)load_extension("gl" # name); + ext->name = (_A5O_gl##name##_t)load_extension("gl" # name); #include "allegro5/opengl/GLext/gl_ext_api.h" @@ -374,7 +374,7 @@ static void load_extensions(ALLEGRO_OGL_EXT_API *ext) /* Set the GL API pointers to the current table * Should only be called on context switches. */ -void _al_ogl_set_extensions(ALLEGRO_OGL_EXT_API *ext) +void _al_ogl_set_extensions(A5O_OGL_EXT_API *ext) { if (!ext) { return; @@ -384,12 +384,12 @@ void _al_ogl_set_extensions(ALLEGRO_OGL_EXT_API *ext) # include "allegro5/opengl/GLext/gl_ext_api.h" #undef AGL_API -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS #define AGL_API(type, name, args) _al_wgl##name = ext->name; # include "allegro5/opengl/GLext/wgl_ext_api.h" #undef AGL_API -#elif defined ALLEGRO_UNIX +#elif defined A5O_UNIX #define AGL_API(type, name, args) _al_glX##name = ext->name; # include "allegro5/opengl/GLext/glx_ext_api.h" #undef AGL_API @@ -399,7 +399,7 @@ void _al_ogl_set_extensions(ALLEGRO_OGL_EXT_API *ext) /* Destroys the extension API table */ -static void destroy_extension_api_table(ALLEGRO_OGL_EXT_API *ext) +static void destroy_extension_api_table(A5O_OGL_EXT_API *ext) { if (ext) { al_free(ext); @@ -409,7 +409,7 @@ static void destroy_extension_api_table(ALLEGRO_OGL_EXT_API *ext) /* Destroys the extension list */ -static void destroy_extension_list(ALLEGRO_OGL_EXT_LIST *list) +static void destroy_extension_list(A5O_OGL_EXT_LIST *list) { if (list) { al_free(list); @@ -452,17 +452,17 @@ int _al_ogl_look_for_an_extension(const char *name, const GLubyte *extensions) static bool _ogl_is_extension_supported(const char *extension, - ALLEGRO_DISPLAY *disp) + A5O_DISPLAY *disp) { int ret = 0; GLubyte const *ext_str; -#if !defined ALLEGRO_CFG_OPENGLES +#if !defined A5O_CFG_OPENGLES int v = al_get_opengl_version(); #endif (void)disp; -#if !defined ALLEGRO_CFG_OPENGLES - if (disp->flags & ALLEGRO_OPENGL_3_0 || v >= _ALLEGRO_OPENGL_VERSION_3_0) { +#if !defined A5O_CFG_OPENGLES + if (disp->flags & A5O_OPENGL_3_0 || v >= _A5O_OPENGL_VERSION_3_0) { int i; GLint ext_cnt; glGetIntegerv(GL_NUM_EXTENSIONS, &ext_cnt); @@ -483,10 +483,10 @@ static bool _ogl_is_extension_supported(const char *extension, ret = _al_ogl_look_for_an_extension(extension, ext_str); } -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS if (!ret && strncmp(extension, "WGL", 3) == 0) { - ALLEGRO_DISPLAY_WGL *wgl_disp = (void*)disp; - _ALLEGRO_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB; + A5O_DISPLAY_WGL *wgl_disp = (void*)disp; + _A5O_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB; if (!wgl_disp->dc) return false; @@ -499,10 +499,10 @@ static bool _ogl_is_extension_supported(const char *extension, } } -#elif defined ALLEGRO_UNIX && !defined ALLEGRO_EXCLUDE_GLX +#elif defined A5O_UNIX && !defined A5O_EXCLUDE_GLX if (!ret && strncmp(extension, "GLX", 3) == 0) { - ALLEGRO_SYSTEM_XGLX *sys = (void*)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx_disp = (void*)disp; + A5O_SYSTEM_XGLX *sys = (void*)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx_disp = (void*)disp; char const *ext; if (!sys->gfxdisplay) @@ -523,7 +523,7 @@ static bool _ogl_is_extension_supported(const char *extension, static bool _ogl_is_extension_with_version_supported( - const char *extension, ALLEGRO_DISPLAY *disp, uint32_t ver) + const char *extension, A5O_DISPLAY *disp, uint32_t ver) { char const *value; @@ -538,7 +538,7 @@ static bool _ogl_is_extension_with_version_supported( value = al_get_config_value(al_get_system_config(), "opengl_disabled_extensions", extension); if (value) { - ALLEGRO_WARN("%s found in [opengl_disabled_extensions].\n", + A5O_WARN("%s found in [opengl_disabled_extensions].\n", extension); return false; } @@ -559,13 +559,13 @@ static bool _ogl_is_extension_with_version_supported( */ bool al_have_opengl_extension(const char *extension) { - ALLEGRO_DISPLAY *disp; + A5O_DISPLAY *disp; disp = al_get_current_display(); if (!disp) return false; - if (!(disp->flags & ALLEGRO_OPENGL)) + if (!(disp->flags & A5O_OPENGL)) return false; return _ogl_is_extension_supported(extension, disp); @@ -578,34 +578,34 @@ bool al_have_opengl_extension(const char *extension) void *al_get_opengl_proc_address(const char *name) { void *symbol = NULL; -#ifdef ALLEGRO_MACOSX +#ifdef A5O_MACOSX CFStringRef function; #endif - ALLEGRO_DISPLAY *disp; + A5O_DISPLAY *disp; disp = al_get_current_display(); if (!disp) return NULL; - if (!(disp->flags & ALLEGRO_OPENGL)) + if (!(disp->flags & A5O_OPENGL)) return NULL; -#if defined ALLEGRO_WINDOWS +#if defined A5O_WINDOWS /* For once Windows is the easiest platform to use :) * It provides a standardized way to get a function address * But of course there is a drawback : the symbol is only valid * under the current context :P */ { - ALLEGRO_DISPLAY_WGL *wgl_disp = (void*)disp; + A5O_DISPLAY_WGL *wgl_disp = (void*)disp; if (!wgl_disp->dc) return NULL; symbol = wglGetProcAddress(name); } -#elif defined ALLEGRO_UNIX -#if defined ALLEGRO_HAVE_DYNAMIC_LINK +#elif defined A5O_UNIX +#if defined A5O_HAVE_DYNAMIC_LINK if (alXGetProcAddress) #endif { @@ -613,13 +613,13 @@ void *al_get_opengl_proc_address(const char *name) * address. Unfortunately glXGetProcAddress is an extension * and may not be available on all platforms */ -#if defined ALLEGRO_RASPBERRYPI +#if defined A5O_RASPBERRYPI symbol = alXGetProcAddress(name); #else symbol = alXGetProcAddress((const GLubyte *)name); #endif } -#elif defined ALLEGRO_HAVE_DYNAMIC_LINK +#elif defined A5O_HAVE_DYNAMIC_LINK else { /* Hack if glXGetProcAddress is not available : * we try to find the symbol into libGL.so @@ -628,7 +628,7 @@ void *al_get_opengl_proc_address(const char *name) symbol = dlsym(__al_handle, name); } } -#elif defined ALLEGRO_MACOSX +#elif defined A5O_MACOSX function = CFStringCreateWithCString(kCFAllocatorDefault, name, kCFStringEncodingASCII); if (function) { @@ -640,16 +640,16 @@ void *al_get_opengl_proc_address(const char *name) if (!symbol) { -#if defined ALLEGRO_HAVE_DYNAMIC_LINK +#if defined A5O_HAVE_DYNAMIC_LINK if (!alXGetProcAddress) { - ALLEGRO_WARN("get_proc_address: libdl::dlsym: %s\n", dlerror()); + A5O_WARN("get_proc_address: libdl::dlsym: %s\n", dlerror()); } #endif - ALLEGRO_WARN("get_proc_address : Unable to load symbol %s\n", name); + A5O_WARN("get_proc_address : Unable to load symbol %s\n", name); } else { - ALLEGRO_DEBUG("get_proc_address : Symbol %s successfully loaded\n", name); + A5O_DEBUG("get_proc_address : Symbol %s successfully loaded\n", name); } return symbol; } @@ -692,7 +692,7 @@ static void fill_in_info_struct(const GLubyte *rendereru, OPENGL_INFO *info) /* Read OpenGL properties */ info->version = _al_ogl_version(); - ALLEGRO_INFO("Assumed OpenGL version: %d.%d.%d.%d\n", + A5O_INFO("Assumed OpenGL version: %d.%d.%d.%d\n", (info->version >> 24) & 0xff, (info->version >> 16) & 0xff, (info->version >> 8) & 0xff, @@ -707,14 +707,14 @@ static void fill_in_info_struct(const GLubyte *rendereru, OPENGL_INFO *info) * This functions fills the extensions API table and extension list * structures and displays on the log file which extensions are available. */ -void _al_ogl_manage_extensions(ALLEGRO_DISPLAY *gl_disp) +void _al_ogl_manage_extensions(A5O_DISPLAY *gl_disp) { //const GLubyte *buf; -#if defined ALLEGRO_MACOSX +#if defined A5O_MACOSX CFURLRef bundle_url; #endif - ALLEGRO_OGL_EXT_API *ext_api; - ALLEGRO_OGL_EXT_LIST *ext_list; + A5O_OGL_EXT_API *ext_api; + A5O_OGL_EXT_LIST *ext_list; /* Some functions depend on knowing the version of opengl in use */ fill_in_info_struct(glGetString(GL_RENDERER), &(gl_disp->ogl_extras->ogl_info)); @@ -723,16 +723,16 @@ void _al_ogl_manage_extensions(ALLEGRO_DISPLAY *gl_disp) * We should use glGetStringi(GL_EXTENSIONS, i) for OpenGL 3.0+ * but it doesn't seem to work until later. */ - if (gl_disp->ogl_extras->ogl_info.version < _ALLEGRO_OPENGL_VERSION_3_0) { - ALLEGRO_DEBUG("OpenGL Extensions:\n"); + if (gl_disp->ogl_extras->ogl_info.version < _A5O_OPENGL_VERSION_3_0) { + A5O_DEBUG("OpenGL Extensions:\n"); print_extensions((char const *)glGetString(GL_EXTENSIONS)); } /* Print out GLU version */ //buf = gluGetString(GLU_VERSION); - //ALLEGRO_INFO("GLU Version : %s\n", buf); + //A5O_INFO("GLU Version : %s\n", buf); -#ifdef ALLEGRO_HAVE_DYNAMIC_LINK +#ifdef A5O_HAVE_DYNAMIC_LINK /* Get glXGetProcAddress entry */ __libgl_handle = dlopen("libGL.so", RTLD_LAZY); if (__libgl_handle) { @@ -748,19 +748,19 @@ void _al_ogl_manage_extensions(ALLEGRO_DISPLAY *gl_disp) } } else { - ALLEGRO_WARN("Failed to dlopen libGL.so : %s\n", dlerror()); + A5O_WARN("Failed to dlopen libGL.so : %s\n", dlerror()); } - ALLEGRO_INFO("glXGetProcAddress Extension: %s\n", + A5O_INFO("glXGetProcAddress Extension: %s\n", alXGetProcAddress ? "Supported" : "Unsupported"); -#elif defined ALLEGRO_UNIX +#elif defined A5O_UNIX #ifdef ALLEGROGL_GLXGETPROCADDRESSARB - ALLEGRO_INFO("glXGetProcAddressARB Extension: supported\n"); + A5O_INFO("glXGetProcAddressARB Extension: supported\n"); #else - ALLEGRO_INFO("glXGetProcAddress Extension: supported\n"); + A5O_INFO("glXGetProcAddress Extension: supported\n"); #endif #endif -#ifdef ALLEGRO_MACOSX +#ifdef A5O_MACOSX bundle_url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, CFSTR ("/System/Library/Frameworks/OpenGL.framework"), @@ -769,10 +769,10 @@ void _al_ogl_manage_extensions(ALLEGRO_DISPLAY *gl_disp) CFRelease(bundle_url); #endif -#if defined ALLEGRO_UNIX && !defined ALLEGRO_EXCLUDE_GLX - ALLEGRO_DEBUG("GLX Extensions:\n"); - ALLEGRO_SYSTEM_XGLX *glx_sys = (void*)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx_disp = (void *)gl_disp; +#if defined A5O_UNIX && !defined A5O_EXCLUDE_GLX + A5O_DEBUG("GLX Extensions:\n"); + A5O_SYSTEM_XGLX *glx_sys = (void*)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx_disp = (void *)gl_disp; char const *ext = glXQueryExtensionsString( glx_sys->gfxdisplay, glx_disp->xscreen); if (!ext) { @@ -787,12 +787,12 @@ void _al_ogl_manage_extensions(ALLEGRO_DISPLAY *gl_disp) load_extensions(ext_api); gl_disp->ogl_extras->extension_api = ext_api; -#if !defined ALLEGRO_CFG_OPENGLES +#if !defined A5O_CFG_OPENGLES /* Need that symbol already so can't wait until it is assigned later. */ glGetStringi = ext_api->GetStringi; - if (gl_disp->ogl_extras->ogl_info.version >= _ALLEGRO_OPENGL_VERSION_3_0) { - ALLEGRO_DEBUG("OpenGL Extensions:\n"); + if (gl_disp->ogl_extras->ogl_info.version >= _A5O_OPENGL_VERSION_3_0) { + A5O_DEBUG("OpenGL Extensions:\n"); print_extensions_3_0(); } #endif @@ -803,26 +803,26 @@ void _al_ogl_manage_extensions(ALLEGRO_DISPLAY *gl_disp) /* Fill the list. */ #define AGL_EXT(name, ver) { \ - ext_list->ALLEGRO_GL_##name = \ + ext_list->A5O_GL_##name = \ _ogl_is_extension_with_version_supported("GL_" #name, gl_disp, \ - _ALLEGRO_OPENGL_VERSION_##ver); \ + _A5O_OPENGL_VERSION_##ver); \ } #include "allegro5/opengl/GLext/gl_ext_list.h" #undef AGL_EXT -#ifdef ALLEGRO_UNIX +#ifdef A5O_UNIX #define AGL_EXT(name, ver) { \ - ext_list->ALLEGRO_GLX_##name = \ + ext_list->A5O_GLX_##name = \ _ogl_is_extension_with_version_supported("GLX_" #name, gl_disp, \ - _ALLEGRO_OPENGL_VERSION_##ver); \ + _A5O_OPENGL_VERSION_##ver); \ } #include "allegro5/opengl/GLext/glx_ext_list.h" #undef AGL_EXT -#elif defined ALLEGRO_WINDOWS +#elif defined A5O_WINDOWS #define AGL_EXT(name, ver) { \ - ext_list->ALLEGRO_WGL_##name = \ + ext_list->A5O_WGL_##name = \ _ogl_is_extension_with_version_supported("WGL_" #name, gl_disp, \ - _ALLEGRO_OPENGL_VERSION_##ver); \ + _A5O_OPENGL_VERSION_##ver); \ } #include "allegro5/opengl/GLext/wgl_ext_list.h" #undef AGL_EXT @@ -835,12 +835,12 @@ void _al_ogl_manage_extensions(ALLEGRO_DISPLAY *gl_disp) /* Note: Voodoo (even V5) don't seem to correctly support * packed pixel formats. Disabling them for those cards. */ - ext_list->ALLEGRO_GL_EXT_packed_pixels &= !gl_disp->ogl_extras->ogl_info.is_voodoo; + ext_list->A5O_GL_EXT_packed_pixels &= !gl_disp->ogl_extras->ogl_info.is_voodoo; - if (ext_list->ALLEGRO_GL_EXT_packed_pixels) { + if (ext_list->A5O_GL_EXT_packed_pixels) { - ALLEGRO_INFO("Packed Pixels formats available\n"); + A5O_INFO("Packed Pixels formats available\n"); /* XXX On NV cards, we want to use BGRA instead of RGBA for speed */ /* Fills the __allegro_gl_texture_format array */ @@ -860,51 +860,51 @@ void _al_ogl_manage_extensions(ALLEGRO_DISPLAY *gl_disp) { const char *vendor = (const char *)glGetString(GL_VENDOR); if (strstr(vendor, "NVIDIA Corporation")) { - if (!ext_list->ALLEGRO_GL_NV_fragment_program2 - || !ext_list->ALLEGRO_GL_NV_vertex_program3) { - ext_list->ALLEGRO_GL_ARB_texture_non_power_of_two = 0; + if (!ext_list->A5O_GL_NV_fragment_program2 + || !ext_list->A5O_GL_NV_vertex_program3) { + ext_list->A5O_GL_ARB_texture_non_power_of_two = 0; } } else if (strstr(vendor, "ATI Technologies")) { - if (gl_disp->ogl_extras->ogl_info.version >= _ALLEGRO_OPENGL_VERSION_3_0) { + if (gl_disp->ogl_extras->ogl_info.version >= _A5O_OPENGL_VERSION_3_0) { /* Assume okay. */ } else if (!strstr((const char *)glGetString(GL_EXTENSIONS), "GL_ARB_texture_non_power_of_two") - && gl_disp->ogl_extras->ogl_info.version >= _ALLEGRO_OPENGL_VERSION_2_0) { - ext_list->ALLEGRO_GL_ARB_texture_non_power_of_two = 0; + && gl_disp->ogl_extras->ogl_info.version >= _A5O_OPENGL_VERSION_2_0) { + ext_list->A5O_GL_ARB_texture_non_power_of_two = 0; } } } { int *s = gl_disp->extra_settings.settings; - glGetIntegerv(GL_MAX_TEXTURE_SIZE, s + ALLEGRO_MAX_BITMAP_SIZE); + glGetIntegerv(GL_MAX_TEXTURE_SIZE, s + A5O_MAX_BITMAP_SIZE); - if (gl_disp->ogl_extras->ogl_info.version >= _ALLEGRO_OPENGL_VERSION_2_0) - s[ALLEGRO_SUPPORT_SEPARATE_ALPHA] = 1; - - s[ALLEGRO_SUPPORT_NPOT_BITMAP] = - ext_list->ALLEGRO_GL_ARB_texture_non_power_of_two || - ext_list->ALLEGRO_GL_OES_texture_npot; - ALLEGRO_INFO("Use of non-power-of-two textures %s.\n", - s[ALLEGRO_SUPPORT_NPOT_BITMAP] ? "enabled" : "disabled"); -#if defined ALLEGRO_CFG_OPENGLES - if (gl_disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { - s[ALLEGRO_CAN_DRAW_INTO_BITMAP] = true; + if (gl_disp->ogl_extras->ogl_info.version >= _A5O_OPENGL_VERSION_2_0) + s[A5O_SUPPORT_SEPARATE_ALPHA] = 1; + + s[A5O_SUPPORT_NPOT_BITMAP] = + ext_list->A5O_GL_ARB_texture_non_power_of_two || + ext_list->A5O_GL_OES_texture_npot; + A5O_INFO("Use of non-power-of-two textures %s.\n", + s[A5O_SUPPORT_NPOT_BITMAP] ? "enabled" : "disabled"); +#if defined A5O_CFG_OPENGLES + if (gl_disp->flags & A5O_PROGRAMMABLE_PIPELINE) { + s[A5O_CAN_DRAW_INTO_BITMAP] = true; } else { - s[ALLEGRO_CAN_DRAW_INTO_BITMAP] = - ext_list->ALLEGRO_GL_OES_framebuffer_object; + s[A5O_CAN_DRAW_INTO_BITMAP] = + ext_list->A5O_GL_OES_framebuffer_object; } - ALLEGRO_INFO("Use of FBO to draw to textures %s.\n", - s[ALLEGRO_CAN_DRAW_INTO_BITMAP] ? "enabled" : + A5O_INFO("Use of FBO to draw to textures %s.\n", + s[A5O_CAN_DRAW_INTO_BITMAP] ? "enabled" : "disabled"); #else - s[ALLEGRO_CAN_DRAW_INTO_BITMAP] = - ext_list->ALLEGRO_GL_EXT_framebuffer_object; - ALLEGRO_INFO("Use of FBO to draw to textures %s.\n", - s[ALLEGRO_CAN_DRAW_INTO_BITMAP] ? "enabled" : + s[A5O_CAN_DRAW_INTO_BITMAP] = + ext_list->A5O_GL_EXT_framebuffer_object; + A5O_INFO("Use of FBO to draw to textures %s.\n", + s[A5O_CAN_DRAW_INTO_BITMAP] ? "enabled" : "disabled"); #endif } @@ -914,14 +914,14 @@ void _al_ogl_manage_extensions(ALLEGRO_DISPLAY *gl_disp) /* Function: al_get_opengl_extension_list */ -ALLEGRO_OGL_EXT_LIST *al_get_opengl_extension_list(void) +A5O_OGL_EXT_LIST *al_get_opengl_extension_list(void) { - ALLEGRO_DISPLAY *disp; + A5O_DISPLAY *disp; disp = al_get_current_display(); ASSERT(disp); - if (!(disp->flags & ALLEGRO_OPENGL)) + if (!(disp->flags & A5O_OPENGL)) return NULL; ASSERT(disp->ogl_extras); @@ -930,17 +930,17 @@ ALLEGRO_OGL_EXT_LIST *al_get_opengl_extension_list(void) -void _al_ogl_unmanage_extensions(ALLEGRO_DISPLAY *gl_disp) +void _al_ogl_unmanage_extensions(A5O_DISPLAY *gl_disp) { destroy_extension_api_table(gl_disp->ogl_extras->extension_api); destroy_extension_list(gl_disp->ogl_extras->extension_list); gl_disp->ogl_extras->extension_api = NULL; gl_disp->ogl_extras->extension_list = NULL; -#ifdef ALLEGRO_MACOSX +#ifdef A5O_MACOSX CFRelease(opengl_bundle_ref); #endif -#ifdef ALLEGRO_HAVE_DYNAMIC_LINK +#ifdef A5O_HAVE_DYNAMIC_LINK if (__libgl_handle) { dlclose(__libgl_handle); __libgl_handle = NULL; diff --git a/src/opengl/ogl_bitmap.c b/src/opengl/ogl_bitmap.c index 657d7d365b..7ffdbe0ec1 100644 --- a/src/opengl/ogl_bitmap.c +++ b/src/opengl/ogl_bitmap.c @@ -28,13 +28,13 @@ #include "allegro5/internal/aintern_system.h" #include "allegro5/internal/aintern_transform.h" -#if defined ALLEGRO_ANDROID +#if defined A5O_ANDROID #include "allegro5/internal/aintern_android.h" #endif #include "ogl_helpers.h" -ALLEGRO_DEBUG_CHANNEL("opengl") +A5O_DEBUG_CHANNEL("opengl") /* OpenGL does not support "locking", i.e. direct access to a memory * buffer with pixel data. Instead, the data can be copied from/to @@ -87,8 +87,8 @@ ALLEGRO_DEBUG_CHANNEL("opengl") #define get_glformat(f, c) _al_ogl_get_glformat((f), (c)) int _al_ogl_get_glformat(int format, int component) { - #if !defined ALLEGRO_CFG_OPENGLES - static int glformats[ALLEGRO_NUM_PIXEL_FORMATS][3] = { + #if !defined A5O_CFG_OPENGLES + static int glformats[A5O_NUM_PIXEL_FORMATS][3] = { /* Skip pseudo formats */ {0, 0, 0}, {0, 0, 0}, @@ -124,13 +124,13 @@ int _al_ogl_get_glformat(int format, int component) {GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_UNSIGNED_INT_8_8_8_8, GL_RGBA}, /* RGBA_DXT5 */ }; - if (al_get_opengl_version() >= _ALLEGRO_OPENGL_VERSION_3_0) { - glformats[ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8][0] = GL_RED; - glformats[ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8][2] = GL_RED; + if (al_get_opengl_version() >= _A5O_OPENGL_VERSION_3_0) { + glformats[A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8][0] = GL_RED; + glformats[A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8][2] = GL_RED; } #else // TODO: Check supported formats by various GLES versions - static const int glformats[ALLEGRO_NUM_PIXEL_FORMATS][3] = { + static const int glformats[A5O_NUM_PIXEL_FORMATS][3] = { /* Skip pseudo formats */ {0, 0, 0}, {0, 0, 0}, @@ -170,7 +170,7 @@ int _al_ogl_get_glformat(int format, int component) return glformats[format][component]; } -static ALLEGRO_BITMAP_INTERFACE glbmp_vt; +static A5O_BITMAP_INTERFACE glbmp_vt; #define SWAP(type, x, y) {type temp = x; x = y; y = temp;} @@ -183,12 +183,12 @@ char const *_al_gl_error_string(GLenum e) ERR(GL_INVALID_ENUM) ERR(GL_INVALID_VALUE) ERR(GL_INVALID_OPERATION) -#ifdef ALLEGRO_CFG_OPENGL_FIXED_FUNCTION +#ifdef A5O_CFG_OPENGL_FIXED_FUNCTION ERR(GL_STACK_OVERFLOW) ERR(GL_STACK_UNDERFLOW) #endif ERR(GL_OUT_OF_MEMORY) -#ifdef ALLEGRO_CFG_OPENGL_PROGRAMMABLE_PIPELINE +#ifdef A5O_CFG_OPENGL_PROGRAMMABLE_PIPELINE ERR(GL_INVALID_FRAMEBUFFER_OPERATION) #endif } @@ -201,16 +201,16 @@ static INLINE void transform_vertex(float* x, float* y, float* z) al_transform_coordinates_3d(al_get_current_transform(), x, y, z); } -static void draw_quad(ALLEGRO_BITMAP *bitmap, - ALLEGRO_COLOR tint, +static void draw_quad(A5O_BITMAP *bitmap, + A5O_COLOR tint, float sx, float sy, float sw, float sh, int flags) { float tex_l, tex_t, tex_r, tex_b, w, h, true_w, true_h; float dw = sw, dh = sh; - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap = bitmap->extra; - ALLEGRO_OGL_BITMAP_VERTEX *verts; - ALLEGRO_DISPLAY *disp = al_get_current_display(); + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap = bitmap->extra; + A5O_OGL_BITMAP_VERTEX *verts; + A5O_DISPLAY *disp = al_get_current_display(); (void)flags; @@ -292,15 +292,15 @@ static void draw_quad(ALLEGRO_BITMAP *bitmap, #undef SWAP -static void ogl_draw_bitmap_region(ALLEGRO_BITMAP *bitmap, - ALLEGRO_COLOR tint, float sx, float sy, +static void ogl_draw_bitmap_region(A5O_BITMAP *bitmap, + A5O_COLOR tint, float sx, float sy, float sw, float sh, int flags) { // FIXME: hack // FIXME: need format conversion if they don't match - ALLEGRO_BITMAP *target = al_get_target_bitmap(); - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_target; - ALLEGRO_DISPLAY *disp = _al_get_bitmap_display(target); + A5O_BITMAP *target = al_get_target_bitmap(); + A5O_BITMAP_EXTRA_OPENGL *ogl_target; + A5O_DISPLAY *disp = _al_get_bitmap_display(target); /* For sub-bitmaps */ if (target->parent) { @@ -309,9 +309,9 @@ static void ogl_draw_bitmap_region(ALLEGRO_BITMAP *bitmap, ogl_target = target->extra; - if (!(al_get_bitmap_flags(bitmap) & ALLEGRO_MEMORY_BITMAP) && !bitmap->locked && + if (!(al_get_bitmap_flags(bitmap) & A5O_MEMORY_BITMAP) && !bitmap->locked && !target->locked) { - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_source = bitmap->extra; + A5O_BITMAP_EXTRA_OPENGL *ogl_source = bitmap->extra; if (ogl_source->is_backbuffer) { /* Our source bitmap is the OpenGL backbuffer, the target * is an OpenGL texture. @@ -390,17 +390,17 @@ static int pot(int x) -static GLint ogl_bitmap_wrap(ALLEGRO_BITMAP_WRAP wrap) +static GLint ogl_bitmap_wrap(A5O_BITMAP_WRAP wrap) { switch (wrap) { default: - case ALLEGRO_BITMAP_WRAP_DEFAULT: + case A5O_BITMAP_WRAP_DEFAULT: return GL_CLAMP_TO_EDGE; - case ALLEGRO_BITMAP_WRAP_REPEAT: + case A5O_BITMAP_WRAP_REPEAT: return GL_REPEAT; - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: return GL_CLAMP_TO_EDGE; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: return GL_MIRRORED_REPEAT; } } @@ -409,9 +409,9 @@ static GLint ogl_bitmap_wrap(ALLEGRO_BITMAP_WRAP wrap) // FIXME: need to do all the logic AllegroGL does, checking extensions, // proxy textures, formats, limits ... -static bool ogl_upload_bitmap(ALLEGRO_BITMAP *bitmap) +static bool ogl_upload_bitmap(A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap = bitmap->extra; + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap = bitmap->extra; int w = bitmap->w; int h = bitmap->h; int bitmap_format = al_get_bitmap_format(bitmap); @@ -428,10 +428,10 @@ static bool ogl_upload_bitmap(ALLEGRO_BITMAP *bitmap) glGenTextures(1, &ogl_bitmap->texture); e = glGetError(); if (e) { - ALLEGRO_ERROR("glGenTextures failed: %s\n", _al_gl_error_string(e)); + A5O_ERROR("glGenTextures failed: %s\n", _al_gl_error_string(e)); } else { - ALLEGRO_DEBUG("Created new OpenGL texture %d (%dx%d, format %s)\n", + A5O_DEBUG("Created new OpenGL texture %d (%dx%d, format %s)\n", ogl_bitmap->texture, ogl_bitmap->true_w, ogl_bitmap->true_h, _al_pixel_format_name(bitmap_format)); @@ -440,54 +440,54 @@ static bool ogl_upload_bitmap(ALLEGRO_BITMAP *bitmap) glBindTexture(GL_TEXTURE_2D, ogl_bitmap->texture); e = glGetError(); if (e) { - ALLEGRO_ERROR("glBindTexture for texture %d failed (%s).\n", + A5O_ERROR("glBindTexture for texture %d failed (%s).\n", ogl_bitmap->texture, _al_gl_error_string(e)); } /* Wrap, Min/Mag should always come before glTexImage2D so the texture is "complete" */ // NOTE: on OGLES CLAMP_TO_EDGE is only one supported with NPOT textures - ALLEGRO_BITMAP_WRAP wrap_u, wrap_v; + A5O_BITMAP_WRAP wrap_u, wrap_v; _al_get_bitmap_wrap(bitmap, &wrap_u, &wrap_v); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, ogl_bitmap_wrap(wrap_u)); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, ogl_bitmap_wrap(wrap_v)); - filter = (bitmap_flags & ALLEGRO_MIPMAP) ? 2 : 0; - if (bitmap_flags & ALLEGRO_MIN_LINEAR) { + filter = (bitmap_flags & A5O_MIPMAP) ? 2 : 0; + if (bitmap_flags & A5O_MIN_LINEAR) { filter++; } glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filters[filter]); filter = 0; - if (bitmap_flags & ALLEGRO_MAG_LINEAR) { + if (bitmap_flags & A5O_MAG_LINEAR) { filter++; } glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filters[filter]); // TODO: To support anisotropy, we would need an API for it. Something // like: -// al_set_new_bitmap_option(ALLEGRO_ANISOTROPY, 16.0); +// al_set_new_bitmap_option(A5O_ANISOTROPY, 16.0); #if 0 - if (al_get_opengl_extension_list()->ALLEGRO_GL_EXT_texture_filter_anisotropic) { + if (al_get_opengl_extension_list()->A5O_GL_EXT_texture_filter_anisotropic) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy); } #endif - if (bitmap_flags & ALLEGRO_MIPMAP) { + if (bitmap_flags & A5O_MIPMAP) { /* If using FBOs, use glGenerateMipmapEXT instead of the GL_GENERATE_MIPMAP * texture parameter. GL_GENERATE_MIPMAP is deprecated in GL 3.0 so we * may want to use the new method in other cases as well. */ - if (al_get_opengl_extension_list()->ALLEGRO_GL_EXT_framebuffer_object || - al_get_opengl_extension_list()->ALLEGRO_GL_OES_framebuffer_object || + if (al_get_opengl_extension_list()->A5O_GL_EXT_framebuffer_object || + al_get_opengl_extension_list()->A5O_GL_OES_framebuffer_object || IS_OPENGLES /* FIXME */) { post_generate_mipmap = true; } else { -#ifdef ALLEGRO_CFG_OPENGL_FIXED_FUNCTION +#ifdef A5O_CFG_OPENGL_FIXED_FUNCTION glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); e = glGetError(); if (e) { - ALLEGRO_ERROR("glTexParameteri for texture %d failed (%s).\n", + A5O_ERROR("glTexParameteri for texture %d failed (%s).\n", ogl_bitmap->texture, _al_gl_error_string(e)); } #endif @@ -503,7 +503,7 @@ static bool ogl_upload_bitmap(ALLEGRO_BITMAP *bitmap) if (!IS_OPENGLES) { if (ogl_bitmap->true_w != bitmap->w || ogl_bitmap->true_h != bitmap->h || - bitmap_format == ALLEGRO_PIXEL_FORMAT_ABGR_F32) { + bitmap_format == A5O_PIXEL_FORMAT_ABGR_F32) { unsigned char *buf; buf = al_calloc(ogl_bitmap->true_h, ogl_bitmap->true_w); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); @@ -536,7 +536,7 @@ static bool ogl_upload_bitmap(ALLEGRO_BITMAP *bitmap) } if (e) { - ALLEGRO_ERROR("glTexImage2D for format %s, size %dx%d failed (%s)\n", + A5O_ERROR("glTexImage2D for format %s, size %dx%d failed (%s)\n", _al_pixel_format_name(bitmap_format), ogl_bitmap->true_w, ogl_bitmap->true_h, _al_gl_error_string(e)); @@ -551,7 +551,7 @@ static bool ogl_upload_bitmap(ALLEGRO_BITMAP *bitmap) glGenerateMipmapEXT(GL_TEXTURE_2D); e = glGetError(); if (e) { - ALLEGRO_ERROR("glGenerateMipmapEXT for texture %d failed (%s).\n", + A5O_ERROR("glGenerateMipmapEXT for texture %d failed (%s).\n", ogl_bitmap->texture, _al_gl_error_string(e)); } } @@ -566,10 +566,10 @@ static bool ogl_upload_bitmap(ALLEGRO_BITMAP *bitmap) -static void ogl_update_clipping_rectangle(ALLEGRO_BITMAP *bitmap) +static void ogl_update_clipping_rectangle(A5O_BITMAP *bitmap) { - ALLEGRO_DISPLAY *ogl_disp = al_get_current_display(); - ALLEGRO_BITMAP *target_bitmap = bitmap; + A5O_DISPLAY *ogl_disp = al_get_current_display(); + A5O_BITMAP *target_bitmap = bitmap; if (bitmap->parent) { target_bitmap = bitmap->parent; @@ -582,12 +582,12 @@ static void ogl_update_clipping_rectangle(ALLEGRO_BITMAP *bitmap) -static void ogl_destroy_bitmap(ALLEGRO_BITMAP *bitmap) +static void ogl_destroy_bitmap(A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap = bitmap->extra; - ALLEGRO_DISPLAY *disp; - ALLEGRO_DISPLAY *bmp_disp; - ALLEGRO_DISPLAY *old_disp = NULL; + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap = bitmap->extra; + A5O_DISPLAY *disp; + A5O_DISPLAY *bmp_disp; + A5O_DISPLAY *old_disp = NULL; ASSERT(!al_is_sub_bitmap(bitmap)); @@ -619,10 +619,10 @@ static void ogl_destroy_bitmap(ALLEGRO_BITMAP *bitmap) -static void ogl_bitmap_pointer_changed(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP *old) +static void ogl_bitmap_pointer_changed(A5O_BITMAP *bitmap, + A5O_BITMAP *old) { - ALLEGRO_BITMAP_EXTRA_OPENGL *extra = bitmap->extra; + A5O_BITMAP_EXTRA_OPENGL *extra = bitmap->extra; if (extra && extra->fbo_info) { ASSERT(extra->fbo_info->owner == old); extra->fbo_info->owner = bitmap; @@ -630,12 +630,12 @@ static void ogl_bitmap_pointer_changed(ALLEGRO_BITMAP *bitmap, } -static bool can_flip_blocks(ALLEGRO_PIXEL_FORMAT format) +static bool can_flip_blocks(A5O_PIXEL_FORMAT format) { switch (format) { - case ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1: - case ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3: - case ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5: + case A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1: + case A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3: + case A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5: return true; default: return false; @@ -643,14 +643,14 @@ static bool can_flip_blocks(ALLEGRO_PIXEL_FORMAT format) } -static void ogl_flip_blocks(ALLEGRO_LOCKED_REGION *lr, int wc, int hc) +static void ogl_flip_blocks(A5O_LOCKED_REGION *lr, int wc, int hc) { #define SWAP(x, y) do { unsigned char t = x; x = y; y = t; } while (0) int x, y; unsigned char* data = lr->data; ASSERT(can_flip_blocks(lr->format)); switch (lr->format) { - case ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1: { + case A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1: { for (y = 0; y < hc; y++) { unsigned char* row = data; for (x = 0; x < wc; x++) { @@ -668,7 +668,7 @@ static void ogl_flip_blocks(ALLEGRO_LOCKED_REGION *lr, int wc, int hc) } break; } - case ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3: { + case A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3: { for (y = 0; y < hc; y++) { unsigned char* row = data; for (x = 0; x < wc; x++) { @@ -695,7 +695,7 @@ static void ogl_flip_blocks(ALLEGRO_LOCKED_REGION *lr, int wc, int hc) } break; } - case ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5: { + case A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5: { for (y = 0; y < hc; y++) { unsigned char* row = data; for (x = 0; x < wc; x++) { @@ -744,13 +744,13 @@ static void ogl_flip_blocks(ALLEGRO_LOCKED_REGION *lr, int wc, int hc) #undef SWAP } -static ALLEGRO_LOCKED_REGION *ogl_lock_compressed_region(ALLEGRO_BITMAP *bitmap, +static A5O_LOCKED_REGION *ogl_lock_compressed_region(A5O_BITMAP *bitmap, int x, int y, int w, int h, int flags) { -#if !defined ALLEGRO_CFG_OPENGLES - ALLEGRO_BITMAP_EXTRA_OPENGL *const ogl_bitmap = bitmap->extra; - ALLEGRO_DISPLAY *disp; - ALLEGRO_DISPLAY *old_disp = NULL; +#if !defined A5O_CFG_OPENGLES + A5O_BITMAP_EXTRA_OPENGL *const ogl_bitmap = bitmap->extra; + A5O_DISPLAY *disp; + A5O_DISPLAY *old_disp = NULL; GLenum e; bool ok = true; int bitmap_format = al_get_bitmap_format(bitmap); @@ -769,7 +769,7 @@ static ALLEGRO_LOCKED_REGION *ogl_lock_compressed_region(ALLEGRO_BITMAP *bitmap, return NULL; } - if (flags & ALLEGRO_LOCK_WRITEONLY) { + if (flags & A5O_LOCK_WRITEONLY) { int pitch = wc * block_size; ogl_bitmap->lock_buffer = al_malloc(pitch * hc); if (ogl_bitmap->lock_buffer == NULL) { @@ -805,7 +805,7 @@ static ALLEGRO_LOCKED_REGION *ogl_lock_compressed_region(ALLEGRO_BITMAP *bitmap, glPixelStorei(GL_PACK_ALIGNMENT, 1); e = glGetError(); if (e) { - ALLEGRO_ERROR("glPixelStorei(GL_PACK_ALIGNMENT, %d) failed (%s).\n", + A5O_ERROR("glPixelStorei(GL_PACK_ALIGNMENT, %d) failed (%s).\n", 1, _al_gl_error_string(e)); ok = false; } @@ -819,14 +819,14 @@ static ALLEGRO_LOCKED_REGION *ogl_lock_compressed_region(ALLEGRO_BITMAP *bitmap, glGetCompressedTexImage(GL_TEXTURE_2D, 0, ogl_bitmap->lock_buffer); e = glGetError(); if (e) { - ALLEGRO_ERROR("glGetCompressedTexImage for format %s failed (%s).\n", + A5O_ERROR("glGetCompressedTexImage for format %s failed (%s).\n", _al_pixel_format_name(bitmap_format), _al_gl_error_string(e)); al_free(ogl_bitmap->lock_buffer); ogl_bitmap->lock_buffer = NULL; ok = false; } else { - if (flags == ALLEGRO_LOCK_READWRITE) { + if (flags == A5O_LOCK_READWRITE) { /* Need to make the locked memory contiguous, as * glCompressedTexSubImage2D cannot read strided * memory. */ @@ -873,7 +873,7 @@ static ALLEGRO_LOCKED_REGION *ogl_lock_compressed_region(ALLEGRO_BITMAP *bitmap, return &bitmap->locked_region; } - ALLEGRO_ERROR("Failed to lock region\n"); + A5O_ERROR("Failed to lock region\n"); ASSERT(ogl_bitmap->lock_buffer == NULL); return NULL; #else @@ -888,13 +888,13 @@ static ALLEGRO_LOCKED_REGION *ogl_lock_compressed_region(ALLEGRO_BITMAP *bitmap, } -static void ogl_unlock_compressed_region(ALLEGRO_BITMAP *bitmap) +static void ogl_unlock_compressed_region(A5O_BITMAP *bitmap) { -#if !defined ALLEGRO_CFG_OPENGLES - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap = bitmap->extra; +#if !defined A5O_CFG_OPENGLES + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap = bitmap->extra; int lock_format = bitmap->locked_region.format; - ALLEGRO_DISPLAY *old_disp = NULL; - ALLEGRO_DISPLAY *disp; + A5O_DISPLAY *old_disp = NULL; + A5O_DISPLAY *disp; GLenum e; int block_size = al_get_pixel_block_size(lock_format); int block_width = al_get_pixel_block_width(lock_format); @@ -907,7 +907,7 @@ static void ogl_unlock_compressed_region(ALLEGRO_BITMAP *bitmap) * to lock earlier */ ASSERT(can_flip_blocks(bitmap->locked_region.format)); - if ((bitmap->lock_flags & ALLEGRO_LOCK_READONLY)) { + if ((bitmap->lock_flags & A5O_LOCK_READONLY)) { goto EXIT; } @@ -932,7 +932,7 @@ static void ogl_unlock_compressed_region(ALLEGRO_BITMAP *bitmap) glPixelStorei(GL_UNPACK_ALIGNMENT, 1); e = glGetError(); if (e) { - ALLEGRO_ERROR("glPixelStorei(GL_UNPACK_ALIGNMENT, %d) failed (%s).\n", + A5O_ERROR("glPixelStorei(GL_UNPACK_ALIGNMENT, %d) failed (%s).\n", 1, _al_gl_error_string(e)); } } @@ -947,7 +947,7 @@ static void ogl_unlock_compressed_region(ALLEGRO_BITMAP *bitmap) e = glGetError(); if (e) { - ALLEGRO_ERROR("glCompressedTexSubImage2D for format %s failed (%s).\n", + A5O_ERROR("glCompressedTexSubImage2D for format %s failed (%s).\n", _al_pixel_format_name(lock_format), _al_gl_error_string(e)); } @@ -967,27 +967,27 @@ static void ogl_unlock_compressed_region(ALLEGRO_BITMAP *bitmap) #endif } -static void ogl_backup_dirty_bitmap(ALLEGRO_BITMAP *b) +static void ogl_backup_dirty_bitmap(A5O_BITMAP *b) { - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap = b->extra; - ALLEGRO_LOCKED_REGION *lr; + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap = b->extra; + A5O_LOCKED_REGION *lr; int bitmap_flags = al_get_bitmap_flags(b); if (b->parent) return; - if ((bitmap_flags & ALLEGRO_MEMORY_BITMAP) || - (bitmap_flags & ALLEGRO_NO_PRESERVE_TEXTURE) || + if ((bitmap_flags & A5O_MEMORY_BITMAP) || + (bitmap_flags & A5O_NO_PRESERVE_TEXTURE) || !b->dirty || ogl_bitmap->is_backbuffer) return; - ALLEGRO_DEBUG("Backing up dirty bitmap %p\n", b); + A5O_DEBUG("Backing up dirty bitmap %p\n", b); lr = al_lock_bitmap( b, _al_get_bitmap_memory_format(b), - ALLEGRO_LOCK_READONLY + A5O_LOCK_READONLY ); if (lr) { @@ -1003,12 +1003,12 @@ static void ogl_backup_dirty_bitmap(ALLEGRO_BITMAP *b) b->dirty = false; } else { - ALLEGRO_WARN("Failed to lock dirty bitmap %p\n", b); + A5O_WARN("Failed to lock dirty bitmap %p\n", b); } } /* Obtain a reference to this driver. */ -static ALLEGRO_BITMAP_INTERFACE *ogl_bitmap_driver(void) +static A5O_BITMAP_INTERFACE *ogl_bitmap_driver(void) { if (glbmp_vt.draw_bitmap_region) { return &glbmp_vt; @@ -1019,7 +1019,7 @@ static ALLEGRO_BITMAP_INTERFACE *ogl_bitmap_driver(void) glbmp_vt.update_clipping_rectangle = ogl_update_clipping_rectangle; glbmp_vt.destroy_bitmap = ogl_destroy_bitmap; glbmp_vt.bitmap_pointer_changed = ogl_bitmap_pointer_changed; -#if defined(ALLEGRO_CFG_OPENGLES) +#if defined(A5O_CFG_OPENGLES) glbmp_vt.lock_region = _al_ogl_lock_region_gles; glbmp_vt.unlock_region = _al_ogl_unlock_region_gles; #else @@ -1035,16 +1035,16 @@ static ALLEGRO_BITMAP_INTERFACE *ogl_bitmap_driver(void) -ALLEGRO_BITMAP *_al_ogl_create_bitmap(ALLEGRO_DISPLAY *d, int w, int h, +A5O_BITMAP *_al_ogl_create_bitmap(A5O_DISPLAY *d, int w, int h, int format, int flags) { - ALLEGRO_BITMAP *bitmap; - ALLEGRO_BITMAP_EXTRA_OPENGL *extra; + A5O_BITMAP *bitmap; + A5O_BITMAP_EXTRA_OPENGL *extra; int true_w; int true_h; int block_width; int block_height; - ALLEGRO_SYSTEM *system = al_get_system_driver(); + A5O_SYSTEM *system = al_get_system_driver(); (void)d; format = _al_get_real_pixel_format(d, format); @@ -1056,13 +1056,13 @@ ALLEGRO_BITMAP *_al_ogl_create_bitmap(ALLEGRO_DISPLAY *d, int w, int h, true_h = _al_get_least_multiple(h, block_height); if (_al_pixel_format_is_compressed(format)) { - if (!al_get_opengl_extension_list()->ALLEGRO_GL_EXT_texture_compression_s3tc) { - ALLEGRO_DEBUG("Device does not support S3TC compressed textures.\n"); + if (!al_get_opengl_extension_list()->A5O_GL_EXT_texture_compression_s3tc) { + A5O_DEBUG("Device does not support S3TC compressed textures.\n"); return NULL; } } - if (!d->extra_settings.settings[ALLEGRO_SUPPORT_NPOT_BITMAP]) { + if (!d->extra_settings.settings[A5O_SUPPORT_NPOT_BITMAP]) { true_w = pot(true_w); true_h = pot(true_h); } @@ -1089,21 +1089,21 @@ ALLEGRO_BITMAP *_al_ogl_create_bitmap(ALLEGRO_DISPLAY *d, int w, int h, bitmap = al_calloc(1, sizeof *bitmap); ASSERT(bitmap); - bitmap->extra = al_calloc(1, sizeof(ALLEGRO_BITMAP_EXTRA_OPENGL)); + bitmap->extra = al_calloc(1, sizeof(A5O_BITMAP_EXTRA_OPENGL)); ASSERT(bitmap->extra); extra = bitmap->extra; bitmap->vt = ogl_bitmap_driver(); bitmap->_memory_format = - _al_pixel_format_is_compressed(format) ? ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE : format; + _al_pixel_format_is_compressed(format) ? A5O_PIXEL_FORMAT_ABGR_8888_LE : format; bitmap->pitch = true_w * al_get_pixel_size(bitmap->_memory_format); bitmap->_format = format; - bitmap->_flags = flags | _ALLEGRO_INTERNAL_OPENGL; + bitmap->_flags = flags | _A5O_INTERNAL_OPENGL; extra->true_w = true_w; extra->true_h = true_h; - if (!(flags & ALLEGRO_NO_PRESERVE_TEXTURE)) { + if (!(flags & A5O_NO_PRESERVE_TEXTURE)) { bitmap->memory = al_calloc(1, al_get_pixel_size(bitmap->_memory_format)*w*h); } @@ -1117,14 +1117,14 @@ ALLEGRO_BITMAP *_al_ogl_create_bitmap(ALLEGRO_DISPLAY *d, int w, int h, * 'ptr' should be tightly packed or NULL if no texture data * upload is desired. */ -void _al_ogl_upload_bitmap_memory(ALLEGRO_BITMAP *bitmap, int format, void *ptr) +void _al_ogl_upload_bitmap_memory(A5O_BITMAP *bitmap, int format, void *ptr) { int w = bitmap->w; int h = bitmap->h; int pixsize = al_get_pixel_size(format); int y; - ALLEGRO_BITMAP *tmp; - ALLEGRO_LOCKED_REGION *lr; + A5O_BITMAP *tmp; + A5O_LOCKED_REGION *lr; uint8_t *dst; uint8_t *src; @@ -1135,7 +1135,7 @@ void _al_ogl_upload_bitmap_memory(ALLEGRO_BITMAP *bitmap, int format, void *ptr) ASSERT(tmp); if (ptr != NULL) { - lr = al_lock_bitmap(tmp, format, ALLEGRO_LOCK_WRITEONLY); + lr = al_lock_bitmap(tmp, format, A5O_LOCK_WRITEONLY); ASSERT(lr); dst = (uint8_t *)lr->data; @@ -1151,20 +1151,20 @@ void _al_ogl_upload_bitmap_memory(ALLEGRO_BITMAP *bitmap, int format, void *ptr) al_unlock_bitmap(tmp); } - ((ALLEGRO_BITMAP_EXTRA_OPENGL *)bitmap->extra)->texture = - ((ALLEGRO_BITMAP_EXTRA_OPENGL *)tmp->extra)->texture; - ((ALLEGRO_BITMAP_EXTRA_OPENGL *)tmp->extra)->texture = 0; + ((A5O_BITMAP_EXTRA_OPENGL *)bitmap->extra)->texture = + ((A5O_BITMAP_EXTRA_OPENGL *)tmp->extra)->texture; + ((A5O_BITMAP_EXTRA_OPENGL *)tmp->extra)->texture = 0; al_destroy_bitmap(tmp); } /* Function: al_get_opengl_texture */ -GLuint al_get_opengl_texture(ALLEGRO_BITMAP *bitmap) +GLuint al_get_opengl_texture(A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP_EXTRA_OPENGL *extra; + A5O_BITMAP_EXTRA_OPENGL *extra; if (bitmap->parent) bitmap = bitmap->parent; - if (!(al_get_bitmap_flags(bitmap) & _ALLEGRO_INTERNAL_OPENGL)) + if (!(al_get_bitmap_flags(bitmap) & _A5O_INTERNAL_OPENGL)) return 0; extra = bitmap->extra; return extra->texture; @@ -1172,12 +1172,12 @@ GLuint al_get_opengl_texture(ALLEGRO_BITMAP *bitmap) /* Function: al_remove_opengl_fbo */ -void al_remove_opengl_fbo(ALLEGRO_BITMAP *bitmap) +void al_remove_opengl_fbo(A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap; + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap; if (bitmap->parent) bitmap = bitmap->parent; - if (!(al_get_bitmap_flags(bitmap) & _ALLEGRO_INTERNAL_OPENGL)) + if (!(al_get_bitmap_flags(bitmap) & _A5O_INTERNAL_OPENGL)) return; ogl_bitmap = bitmap->extra; if (!ogl_bitmap->fbo_info) @@ -1186,7 +1186,7 @@ void al_remove_opengl_fbo(ALLEGRO_BITMAP *bitmap) ASSERT(ogl_bitmap->fbo_info->fbo_state > FBO_INFO_UNUSED); ASSERT(ogl_bitmap->fbo_info->fbo != 0); - ALLEGRO_FBO_INFO *info = ogl_bitmap->fbo_info; + A5O_FBO_INFO *info = ogl_bitmap->fbo_info; _al_ogl_del_fbo(info); if (info->fbo_state == FBO_INFO_PERSISTENT) { @@ -1199,13 +1199,13 @@ void al_remove_opengl_fbo(ALLEGRO_BITMAP *bitmap) /* Function: al_get_opengl_fbo */ -GLuint al_get_opengl_fbo(ALLEGRO_BITMAP *bitmap) +GLuint al_get_opengl_fbo(A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap; + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap; if (bitmap->parent) bitmap = bitmap->parent; - if (!(al_get_bitmap_flags(bitmap) & _ALLEGRO_INTERNAL_OPENGL)) + if (!(al_get_bitmap_flags(bitmap) & _A5O_INTERNAL_OPENGL)) return 0; ogl_bitmap = bitmap->extra; @@ -1225,17 +1225,17 @@ GLuint al_get_opengl_fbo(ALLEGRO_BITMAP *bitmap) /* Function: al_get_opengl_texture_size */ -bool al_get_opengl_texture_size(ALLEGRO_BITMAP *bitmap, int *w, int *h) +bool al_get_opengl_texture_size(A5O_BITMAP *bitmap, int *w, int *h) { /* The designers of OpenGL ES 1.0 forgot to add a function to query * texture sizes, so this will be the only way there to get the texture * size. On normal OpenGL also glGetTexLevelParameter could be used. */ - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap; + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap; if (bitmap->parent) bitmap = bitmap->parent; - if (!(al_get_bitmap_flags(bitmap) & _ALLEGRO_INTERNAL_OPENGL)) { + if (!(al_get_bitmap_flags(bitmap) & _A5O_INTERNAL_OPENGL)) { *w = 0; *h = 0; return false; @@ -1249,7 +1249,7 @@ bool al_get_opengl_texture_size(ALLEGRO_BITMAP *bitmap, int *w, int *h) /* Function: al_get_opengl_texture_position */ -void al_get_opengl_texture_position(ALLEGRO_BITMAP *bitmap, int *u, int *v) +void al_get_opengl_texture_position(A5O_BITMAP *bitmap, int *u, int *v) { ASSERT(bitmap); ASSERT(u); diff --git a/src/opengl/ogl_display.c b/src/opengl/ogl_display.c index 7ae4db2959..d9e4895db3 100644 --- a/src/opengl/ogl_display.c +++ b/src/opengl/ogl_display.c @@ -21,25 +21,25 @@ #include "allegro5/internal/aintern_pixels.h" #include "allegro5/transformations.h" -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE #include "allegro5/internal/aintern_iphone.h" #endif -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID #include "allegro5/internal/aintern_android.h" #endif #include "ogl_helpers.h" -ALLEGRO_DEBUG_CHANNEL("opengl") +A5O_DEBUG_CHANNEL("opengl") /* Helper to set up GL state as we want it. */ -void _al_ogl_setup_gl(ALLEGRO_DISPLAY *d) +void _al_ogl_setup_gl(A5O_DISPLAY *d) { - ALLEGRO_OGL_EXTRAS *ogl = d->ogl_extras; + A5O_OGL_EXTRAS *ogl = d->ogl_extras; if (ogl->backbuffer) { - ALLEGRO_BITMAP *target = al_get_target_bitmap(); + A5O_BITMAP *target = al_get_target_bitmap(); _al_ogl_resize_backbuffer(ogl->backbuffer, d->w, d->h); /* If we are currently targetting the backbuffer, we need to update the * transformations. */ @@ -55,9 +55,9 @@ void _al_ogl_setup_gl(ALLEGRO_DISPLAY *d) } -void _al_ogl_set_target_bitmap(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap) +void _al_ogl_set_target_bitmap(A5O_DISPLAY *display, A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP *target = bitmap; + A5O_BITMAP *target = bitmap; if (bitmap->parent) target = bitmap->parent; @@ -76,8 +76,8 @@ void _al_ogl_set_target_bitmap(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap) } -void _al_ogl_unset_target_bitmap(ALLEGRO_DISPLAY *display, - ALLEGRO_BITMAP *target) +void _al_ogl_unset_target_bitmap(A5O_DISPLAY *display, + A5O_BITMAP *target) { if (!target) return; @@ -87,15 +87,15 @@ void _al_ogl_unset_target_bitmap(ALLEGRO_DISPLAY *display, /* Function: al_set_current_opengl_context */ -void al_set_current_opengl_context(ALLEGRO_DISPLAY *display) +void al_set_current_opengl_context(A5O_DISPLAY *display) { ASSERT(display); - if (!(display->flags & ALLEGRO_OPENGL)) + if (!(display->flags & A5O_OPENGL)) return; if (display) { - ALLEGRO_BITMAP *bmp = al_get_target_bitmap(); + A5O_BITMAP *bmp = al_get_target_bitmap(); if (bmp && _al_get_bitmap_display(bmp) && _al_get_bitmap_display(bmp) != display) { al_set_target_bitmap(NULL); @@ -106,7 +106,7 @@ void al_set_current_opengl_context(ALLEGRO_DISPLAY *display) } -void _al_ogl_setup_bitmap_clipping(const ALLEGRO_BITMAP *bitmap) +void _al_ogl_setup_bitmap_clipping(const A5O_BITMAP *bitmap) { int x_1, y_1, x_2, y_2, h; bool use_scissor = true; @@ -147,7 +147,7 @@ void _al_ogl_setup_bitmap_clipping(const ALLEGRO_BITMAP *bitmap) else { glEnable(GL_SCISSOR_TEST); - #ifdef ALLEGRO_IPHONE + #ifdef A5O_IPHONE _al_iphone_clip(bitmap, x_1, y_1, x_2, y_2); #else /* OpenGL is upside down, so must adjust y_2 to the height. */ @@ -157,16 +157,16 @@ void _al_ogl_setup_bitmap_clipping(const ALLEGRO_BITMAP *bitmap) } -ALLEGRO_BITMAP *_al_ogl_get_backbuffer(ALLEGRO_DISPLAY *d) +A5O_BITMAP *_al_ogl_get_backbuffer(A5O_DISPLAY *d) { - return (ALLEGRO_BITMAP *)d->ogl_extras->backbuffer; + return (A5O_BITMAP *)d->ogl_extras->backbuffer; } -bool _al_ogl_resize_backbuffer(ALLEGRO_BITMAP *b, int w, int h) +bool _al_ogl_resize_backbuffer(A5O_BITMAP *b, int w, int h) { int pitch; - ALLEGRO_BITMAP_EXTRA_OPENGL *extra = b->extra; + A5O_BITMAP_EXTRA_OPENGL *extra = b->extra; pitch = w * al_get_pixel_size(al_get_bitmap_format(b)); @@ -191,22 +191,22 @@ bool _al_ogl_resize_backbuffer(ALLEGRO_BITMAP *b, int w, int h) } -ALLEGRO_BITMAP* _al_ogl_create_backbuffer(ALLEGRO_DISPLAY *disp) +A5O_BITMAP* _al_ogl_create_backbuffer(A5O_DISPLAY *disp) { - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_backbuffer; - ALLEGRO_BITMAP *backbuffer; + A5O_BITMAP_EXTRA_OPENGL *ogl_backbuffer; + A5O_BITMAP *backbuffer; int format; - ALLEGRO_DEBUG("Creating backbuffer\n"); + A5O_DEBUG("Creating backbuffer\n"); // FIXME: _al_deduce_color_format would work fine if the display paramerers // are filled in, for OpenGL ES if (IS_OPENGLES) { - if (disp->extra_settings.settings[ALLEGRO_COLOR_SIZE] == 16) { - format = ALLEGRO_PIXEL_FORMAT_RGB_565; + if (disp->extra_settings.settings[A5O_COLOR_SIZE] == 16) { + format = A5O_PIXEL_FORMAT_RGB_565; } else { - format = ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE; + format = A5O_PIXEL_FORMAT_ABGR_8888_LE; } } else { @@ -216,24 +216,24 @@ ALLEGRO_BITMAP* _al_ogl_create_backbuffer(ALLEGRO_DISPLAY *disp) */ if (al_get_pixel_size(format) == 3) { /* Or should we use RGBA? Maybe only if not Nvidia cards? */ - format = ALLEGRO_PIXEL_FORMAT_ABGR_8888; + format = A5O_PIXEL_FORMAT_ABGR_8888; } } - ALLEGRO_TRACE_CHANNEL_LEVEL("display", 1)("Deduced format %s for backbuffer.\n", + A5O_TRACE_CHANNEL_LEVEL("display", 1)("Deduced format %s for backbuffer.\n", _al_pixel_format_name(format)); /* Now that the display backbuffer has a format, update extra_settings so * the user can query it back. */ - _al_set_color_components(format, &disp->extra_settings, ALLEGRO_REQUIRE); + _al_set_color_components(format, &disp->extra_settings, A5O_REQUIRE); disp->backbuffer_format = format; - ALLEGRO_DEBUG("Creating backbuffer bitmap\n"); - /* Using ALLEGRO_NO_PRESERVE_TEXTURE prevents extra memory being allocated */ + A5O_DEBUG("Creating backbuffer bitmap\n"); + /* Using A5O_NO_PRESERVE_TEXTURE prevents extra memory being allocated */ backbuffer = _al_ogl_create_bitmap(disp, disp->w, disp->h, - format, ALLEGRO_VIDEO_BITMAP | ALLEGRO_NO_PRESERVE_TEXTURE); + format, A5O_VIDEO_BITMAP | A5O_NO_PRESERVE_TEXTURE); if (!backbuffer) { - ALLEGRO_DEBUG("Backbuffer bitmap creation failed.\n"); + A5O_DEBUG("Backbuffer bitmap creation failed.\n"); return NULL; } @@ -247,7 +247,7 @@ ALLEGRO_BITMAP* _al_ogl_create_backbuffer(ALLEGRO_DISPLAY *disp) al_identity_transform(&backbuffer->proj_transform); al_orthographic_transform(&backbuffer->proj_transform, 0, 0, -1.0, disp->w, disp->h, 1.0); - ALLEGRO_TRACE_CHANNEL_LEVEL("display", 1)( + A5O_TRACE_CHANNEL_LEVEL("display", 1)( "Created backbuffer bitmap (actual format: %s)\n", _al_pixel_format_name(al_get_bitmap_format(backbuffer))); @@ -261,7 +261,7 @@ ALLEGRO_BITMAP* _al_ogl_create_backbuffer(ALLEGRO_DISPLAY *disp) } -void _al_ogl_destroy_backbuffer(ALLEGRO_BITMAP *b) +void _al_ogl_destroy_backbuffer(A5O_BITMAP *b) { al_destroy_bitmap(b); } diff --git a/src/opengl/ogl_draw.c b/src/opengl/ogl_draw.c index 4f2b5a8e60..1a9a722fb4 100644 --- a/src/opengl/ogl_draw.c +++ b/src/opengl/ogl_draw.c @@ -19,31 +19,31 @@ #include "allegro5/internal/aintern_memdraw.h" #include "allegro5/internal/aintern_opengl.h" -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID #include "allegro5/internal/aintern_android.h" #endif #include "ogl_helpers.h" -ALLEGRO_DEBUG_CHANNEL("opengl") +A5O_DEBUG_CHANNEL("opengl") /* FIXME: For some reason x86_64 Android crashes for me when calling * glBlendColor - so adding this hack to disable it. */ -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID #if defined(__x86_64__) || defined(__i686__) -#define ALLEGRO_ANDROID_HACK_X86_64 +#define A5O_ANDROID_HACK_X86_64 #endif #endif -static void try_const_color(ALLEGRO_DISPLAY *ogl_disp, ALLEGRO_COLOR *c) +static void try_const_color(A5O_DISPLAY *ogl_disp, A5O_COLOR *c) { - #ifdef ALLEGRO_CFG_OPENGLES - #ifndef ALLEGRO_CFG_OPENGLES2 + #ifdef A5O_CFG_OPENGLES + #ifndef A5O_CFG_OPENGLES2 return; #endif // Only OpenGL ES 2.0 has glBlendColor - if (ogl_disp->ogl_extras->ogl_info.version < _ALLEGRO_OPENGL_VERSION_2_0) { + if (ogl_disp->ogl_extras->ogl_info.version < _A5O_OPENGL_VERSION_2_0) { return; } #else @@ -52,15 +52,15 @@ static void try_const_color(ALLEGRO_DISPLAY *ogl_disp, ALLEGRO_COLOR *c) glBlendColor(c->r, c->g, c->b, c->a); } -bool _al_opengl_set_blender(ALLEGRO_DISPLAY *ogl_disp) +bool _al_opengl_set_blender(A5O_DISPLAY *ogl_disp) { int op, src_color, dst_color, op_alpha, src_alpha, dst_alpha; - ALLEGRO_COLOR const_color; + A5O_COLOR const_color; const int blend_modes[10] = { GL_ZERO, GL_ONE, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_SRC_COLOR, GL_DST_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_ONE_MINUS_DST_COLOR, -#if defined(ALLEGRO_CFG_OPENGLES2) || !defined(ALLEGRO_CFG_OPENGLES) +#if defined(A5O_CFG_OPENGLES2) || !defined(A5O_CFG_OPENGLES) GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR #else GL_ONE, GL_ONE @@ -76,25 +76,25 @@ bool _al_opengl_set_blender(ALLEGRO_DISPLAY *ogl_disp) &op_alpha, &src_alpha, &dst_alpha); const_color = al_get_bitmap_blend_color(); /* glBlendFuncSeparate was only included with OpenGL 1.4 */ -#if !defined ALLEGRO_CFG_OPENGLES - if (ogl_disp->ogl_extras->ogl_info.version >= _ALLEGRO_OPENGL_VERSION_1_4) { +#if !defined A5O_CFG_OPENGLES + if (ogl_disp->ogl_extras->ogl_info.version >= _A5O_OPENGL_VERSION_1_4) { #else /* FIXME: At this time (09/2014) there are a lot of Android phones that * don't support glBlendFuncSeparate even though they claim OpenGL ES 2.0 * support. Rather than not work on 20-25% of phones, we just don't support * separate blending on Android for now. */ -#if defined ALLEGRO_ANDROID && !defined ALLEGRO_CFG_OPENGLES3 +#if defined A5O_ANDROID && !defined A5O_CFG_OPENGLES3 if (false) { #else - if (ogl_disp->ogl_extras->ogl_info.version >= _ALLEGRO_OPENGL_VERSION_2_0) { + if (ogl_disp->ogl_extras->ogl_info.version >= _A5O_OPENGL_VERSION_2_0) { #endif #endif glEnable(GL_BLEND); try_const_color(ogl_disp, &const_color); glBlendFuncSeparate(blend_modes[src_color], blend_modes[dst_color], blend_modes[src_alpha], blend_modes[dst_alpha]); - if (ogl_disp->ogl_extras->ogl_info.version >= _ALLEGRO_OPENGL_VERSION_2_0) { + if (ogl_disp->ogl_extras->ogl_info.version >= _A5O_OPENGL_VERSION_2_0) { glBlendEquationSeparate( blend_equations[op], blend_equations[op_alpha]); @@ -110,7 +110,7 @@ bool _al_opengl_set_blender(ALLEGRO_DISPLAY *ogl_disp) glBlendFunc(blend_modes[src_color], blend_modes[dst_color]); } else { - ALLEGRO_ERROR("Blender unsupported with this OpenGL version (%d %d %d %d %d %d)\n", + A5O_ERROR("Blender unsupported with this OpenGL version (%d %d %d %d %d %d)\n", op, src_color, dst_color, op_alpha, src_alpha, dst_alpha); return false; } @@ -122,11 +122,11 @@ bool _al_opengl_set_blender(ALLEGRO_DISPLAY *ogl_disp) * based on what the user has set up. FIXME: OpenGL only right now. */ -static void vert_ptr_on(ALLEGRO_DISPLAY *display, int n, GLint t, int stride, void *v) +static void vert_ptr_on(A5O_DISPLAY *display, int n, GLint t, int stride, void *v) { /* Only use this shader stuff with GLES2+ or equivalent */ - if (display->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { -#ifdef ALLEGRO_CFG_OPENGL_PROGRAMMABLE_PIPELINE + if (display->flags & A5O_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_OPENGL_PROGRAMMABLE_PIPELINE if (display->ogl_extras->varlocs.pos_loc >= 0) { glVertexAttribPointer(display->ogl_extras->varlocs.pos_loc, n, t, false, stride, v); glEnableVertexAttribArray(display->ogl_extras->varlocs.pos_loc); @@ -134,33 +134,33 @@ static void vert_ptr_on(ALLEGRO_DISPLAY *display, int n, GLint t, int stride, vo #endif } else { -#ifdef ALLEGRO_CFG_OPENGL_FIXED_FUNCTION +#ifdef A5O_CFG_OPENGL_FIXED_FUNCTION glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(n, t, stride, v); #endif } } -static void vert_ptr_off(ALLEGRO_DISPLAY *display) +static void vert_ptr_off(A5O_DISPLAY *display) { - if (display->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { -#ifdef ALLEGRO_CFG_OPENGL_PROGRAMMABLE_PIPELINE + if (display->flags & A5O_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_OPENGL_PROGRAMMABLE_PIPELINE if (display->ogl_extras->varlocs.pos_loc >= 0) { glDisableVertexAttribArray(display->ogl_extras->varlocs.pos_loc); } #endif } else { -#ifdef ALLEGRO_CFG_OPENGL_FIXED_FUNCTION +#ifdef A5O_CFG_OPENGL_FIXED_FUNCTION glDisableClientState(GL_VERTEX_ARRAY); #endif } } -static void color_ptr_on(ALLEGRO_DISPLAY *display, int n, GLint t, int stride, void *v) +static void color_ptr_on(A5O_DISPLAY *display, int n, GLint t, int stride, void *v) { - if (display->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { -#ifdef ALLEGRO_CFG_OPENGL_PROGRAMMABLE_PIPELINE + if (display->flags & A5O_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_OPENGL_PROGRAMMABLE_PIPELINE if (display->ogl_extras->varlocs.color_loc >= 0) { glVertexAttribPointer(display->ogl_extras->varlocs.color_loc, n, t, false, stride, v); glEnableVertexAttribArray(display->ogl_extras->varlocs.color_loc); @@ -168,33 +168,33 @@ static void color_ptr_on(ALLEGRO_DISPLAY *display, int n, GLint t, int stride, v #endif } else { -#ifdef ALLEGRO_CFG_OPENGL_FIXED_FUNCTION +#ifdef A5O_CFG_OPENGL_FIXED_FUNCTION glEnableClientState(GL_COLOR_ARRAY); glColorPointer(n, t, stride, v); #endif } } -static void color_ptr_off(ALLEGRO_DISPLAY *display) +static void color_ptr_off(A5O_DISPLAY *display) { - if (display->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { -#ifdef ALLEGRO_CFG_OPENGL_PROGRAMMABLE_PIPELINE + if (display->flags & A5O_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_OPENGL_PROGRAMMABLE_PIPELINE if (display->ogl_extras->varlocs.color_loc >= 0) { glDisableVertexAttribArray(display->ogl_extras->varlocs.color_loc); } #endif } else { -#ifdef ALLEGRO_CFG_OPENGL_FIXED_FUNCTION +#ifdef A5O_CFG_OPENGL_FIXED_FUNCTION glDisableClientState(GL_COLOR_ARRAY); #endif } } -static void tex_ptr_on(ALLEGRO_DISPLAY *display, int n, GLint t, int stride, void *v) +static void tex_ptr_on(A5O_DISPLAY *display, int n, GLint t, int stride, void *v) { - if (display->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { -#ifdef ALLEGRO_CFG_OPENGL_PROGRAMMABLE_PIPELINE + if (display->flags & A5O_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_OPENGL_PROGRAMMABLE_PIPELINE if (display->ogl_extras->varlocs.texcoord_loc >= 0) { glVertexAttribPointer(display->ogl_extras->varlocs.texcoord_loc, n, t, false, stride, v); glEnableVertexAttribArray(display->ogl_extras->varlocs.texcoord_loc); @@ -202,34 +202,34 @@ static void tex_ptr_on(ALLEGRO_DISPLAY *display, int n, GLint t, int stride, voi #endif } else { -#ifdef ALLEGRO_CFG_OPENGL_FIXED_FUNCTION +#ifdef A5O_CFG_OPENGL_FIXED_FUNCTION glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(n, t, stride, v); #endif } } -static void tex_ptr_off(ALLEGRO_DISPLAY *display) +static void tex_ptr_off(A5O_DISPLAY *display) { - if (display->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { -#ifdef ALLEGRO_CFG_OPENGL_PROGRAMMABLE_PIPELINE + if (display->flags & A5O_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_OPENGL_PROGRAMMABLE_PIPELINE if (display->ogl_extras->varlocs.texcoord_loc >= 0) { glDisableVertexAttribArray(display->ogl_extras->varlocs.texcoord_loc); } #endif } else { -#ifdef ALLEGRO_CFG_OPENGL_FIXED_FUNCTION +#ifdef A5O_CFG_OPENGL_FIXED_FUNCTION glDisableClientState(GL_TEXTURE_COORD_ARRAY); #endif } } -static void ogl_clear(ALLEGRO_DISPLAY *d, ALLEGRO_COLOR *color) +static void ogl_clear(A5O_DISPLAY *d, A5O_COLOR *color) { - ALLEGRO_DISPLAY *ogl_disp = (void *)d; - ALLEGRO_BITMAP *target = al_get_target_bitmap(); - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_target; + A5O_DISPLAY *ogl_disp = (void *)d; + A5O_BITMAP *target = al_get_target_bitmap(); + A5O_BITMAP_EXTRA_OPENGL *ogl_target; float r, g, b, a; if (target->parent) @@ -252,11 +252,11 @@ static void ogl_clear(ALLEGRO_DISPLAY *d, ALLEGRO_COLOR *color) } -static void ogl_draw_pixel(ALLEGRO_DISPLAY *d, float x, float y, - ALLEGRO_COLOR *color) +static void ogl_draw_pixel(A5O_DISPLAY *d, float x, float y, + A5O_COLOR *color) { - ALLEGRO_BITMAP *target = al_get_target_bitmap(); - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_target; + A5O_BITMAP *target = al_get_target_bitmap(); + A5O_BITMAP_EXTRA_OPENGL *ogl_target; GLfloat vert[2]; GLfloat color_array[4]; @@ -296,28 +296,28 @@ static void ogl_draw_pixel(ALLEGRO_DISPLAY *d, float x, float y, color_ptr_off(d); } -static void* ogl_prepare_vertex_cache(ALLEGRO_DISPLAY* disp, +static void* ogl_prepare_vertex_cache(A5O_DISPLAY* disp, int num_new_vertices) { disp->num_cache_vertices += num_new_vertices; if (!disp->vertex_cache) { - disp->vertex_cache = al_malloc(num_new_vertices * sizeof(ALLEGRO_OGL_BITMAP_VERTEX)); + disp->vertex_cache = al_malloc(num_new_vertices * sizeof(A5O_OGL_BITMAP_VERTEX)); disp->vertex_cache_size = num_new_vertices; } else if (disp->num_cache_vertices > disp->vertex_cache_size) { disp->vertex_cache = al_realloc(disp->vertex_cache, - 2 * disp->num_cache_vertices * sizeof(ALLEGRO_OGL_BITMAP_VERTEX)); + 2 * disp->num_cache_vertices * sizeof(A5O_OGL_BITMAP_VERTEX)); disp->vertex_cache_size = 2 * disp->num_cache_vertices; } - return (ALLEGRO_OGL_BITMAP_VERTEX*)disp->vertex_cache + + return (A5O_OGL_BITMAP_VERTEX*)disp->vertex_cache + (disp->num_cache_vertices - num_new_vertices); } -static void ogl_flush_vertex_cache(ALLEGRO_DISPLAY *disp) +static void ogl_flush_vertex_cache(A5O_DISPLAY *disp) { GLuint current_texture; - ALLEGRO_OGL_EXTRAS *o = disp->ogl_extras; + A5O_OGL_EXTRAS *o = disp->ogl_extras; (void)o; /* not used in all ports */ if (!disp->vertex_cache) @@ -330,8 +330,8 @@ static void ogl_flush_vertex_cache(ALLEGRO_DISPLAY *disp) return; } - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { -#ifdef ALLEGRO_CFG_OPENGL_PROGRAMMABLE_PIPELINE + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_OPENGL_PROGRAMMABLE_PIPELINE if (disp->ogl_extras->varlocs.use_tex_loc >= 0) { glUniform1i(disp->ogl_extras->varlocs.use_tex_loc, 1); } @@ -346,8 +346,8 @@ static void ogl_flush_vertex_cache(ALLEGRO_DISPLAY *disp) glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint*)¤t_texture); if (current_texture != disp->cache_texture) { - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { -#ifdef ALLEGRO_CFG_OPENGL_PROGRAMMABLE_PIPELINE + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_OPENGL_PROGRAMMABLE_PIPELINE /* Use texture unit 0 */ glActiveTexture(GL_TEXTURE0); if (disp->ogl_extras->varlocs.tex_loc >= 0) @@ -357,21 +357,21 @@ static void ogl_flush_vertex_cache(ALLEGRO_DISPLAY *disp) glBindTexture(GL_TEXTURE_2D, disp->cache_texture); } -#if !defined(ALLEGRO_CFG_OPENGLES) && !defined(ALLEGRO_MACOSX) - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { - int stride = sizeof(ALLEGRO_OGL_BITMAP_VERTEX); +#if !defined(A5O_CFG_OPENGLES) && !defined(A5O_MACOSX) + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { + int stride = sizeof(A5O_OGL_BITMAP_VERTEX); int bytes = disp->num_cache_vertices * stride; /* We create the VAO and VBO on first use. */ if (o->vao == 0) { glGenVertexArrays(1, &o->vao); - ALLEGRO_DEBUG("new VAO: %u\n", o->vao); + A5O_DEBUG("new VAO: %u\n", o->vao); } glBindVertexArray(o->vao); if (o->vbo == 0) { glGenBuffers(1, &o->vbo); - ALLEGRO_DEBUG("new VBO: %u\n", o->vbo); + A5O_DEBUG("new VBO: %u\n", o->vbo); } glBindBuffer(GL_ARRAY_BUFFER, o->vbo); @@ -383,34 +383,34 @@ static void ogl_flush_vertex_cache(ALLEGRO_DISPLAY *disp) */ if (o->varlocs.pos_loc >= 0) { glVertexAttribPointer(o->varlocs.pos_loc, 3, GL_FLOAT, false, stride, - (void *)offsetof(ALLEGRO_OGL_BITMAP_VERTEX, x)); + (void *)offsetof(A5O_OGL_BITMAP_VERTEX, x)); glEnableVertexAttribArray(o->varlocs.pos_loc); } if (o->varlocs.texcoord_loc >= 0) { glVertexAttribPointer(o->varlocs.texcoord_loc, 2, GL_FLOAT, false, stride, - (void *)offsetof(ALLEGRO_OGL_BITMAP_VERTEX, tx)); + (void *)offsetof(A5O_OGL_BITMAP_VERTEX, tx)); glEnableVertexAttribArray(o->varlocs.texcoord_loc); } if (o->varlocs.color_loc >= 0) { glVertexAttribPointer(o->varlocs.color_loc, 4, GL_FLOAT, false, stride, - (void *)offsetof(ALLEGRO_OGL_BITMAP_VERTEX, r)); + (void *)offsetof(A5O_OGL_BITMAP_VERTEX, r)); glEnableVertexAttribArray(o->varlocs.color_loc); } } else #endif { - vert_ptr_on(disp, 3, GL_FLOAT, sizeof(ALLEGRO_OGL_BITMAP_VERTEX), - (char *)(disp->vertex_cache) + offsetof(ALLEGRO_OGL_BITMAP_VERTEX, x)); - tex_ptr_on(disp, 2, GL_FLOAT, sizeof(ALLEGRO_OGL_BITMAP_VERTEX), - (char*)(disp->vertex_cache) + offsetof(ALLEGRO_OGL_BITMAP_VERTEX, tx)); - color_ptr_on(disp, 4, GL_FLOAT, sizeof(ALLEGRO_OGL_BITMAP_VERTEX), - (char*)(disp->vertex_cache) + offsetof(ALLEGRO_OGL_BITMAP_VERTEX, r)); - -#ifdef ALLEGRO_CFG_OPENGL_FIXED_FUNCTION - if (!(disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE)) + vert_ptr_on(disp, 3, GL_FLOAT, sizeof(A5O_OGL_BITMAP_VERTEX), + (char *)(disp->vertex_cache) + offsetof(A5O_OGL_BITMAP_VERTEX, x)); + tex_ptr_on(disp, 2, GL_FLOAT, sizeof(A5O_OGL_BITMAP_VERTEX), + (char*)(disp->vertex_cache) + offsetof(A5O_OGL_BITMAP_VERTEX, tx)); + color_ptr_on(disp, 4, GL_FLOAT, sizeof(A5O_OGL_BITMAP_VERTEX), + (char*)(disp->vertex_cache) + offsetof(A5O_OGL_BITMAP_VERTEX, r)); + +#ifdef A5O_CFG_OPENGL_FIXED_FUNCTION + if (!(disp->flags & A5O_PROGRAMMABLE_PIPELINE)) glDisableClientState(GL_NORMAL_ARRAY); #endif } @@ -422,13 +422,13 @@ static void ogl_flush_vertex_cache(ALLEGRO_DISPLAY *disp) { int e = glGetError(); if (e) { - ALLEGRO_WARN("glDrawArrays failed: %s\n", _al_gl_error_string(e)); + A5O_WARN("glDrawArrays failed: %s\n", _al_gl_error_string(e)); } } #endif -#if !defined ALLEGRO_CFG_OPENGLES && !defined ALLEGRO_MACOSX - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { +#if !defined A5O_CFG_OPENGLES && !defined A5O_MACOSX + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { if (o->varlocs.pos_loc >= 0) glDisableVertexAttribArray(o->varlocs.pos_loc); if (o->varlocs.texcoord_loc >= 0) @@ -448,8 +448,8 @@ static void ogl_flush_vertex_cache(ALLEGRO_DISPLAY *disp) disp->num_cache_vertices = 0; - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { -#ifdef ALLEGRO_CFG_OPENGL_PROGRAMMABLE_PIPELINE + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_OPENGL_PROGRAMMABLE_PIPELINE if (disp->ogl_extras->varlocs.use_tex_loc >= 0) glUniform1i(disp->ogl_extras->varlocs.use_tex_loc, 0); #endif @@ -459,13 +459,13 @@ static void ogl_flush_vertex_cache(ALLEGRO_DISPLAY *disp) } } -static void ogl_update_transformation(ALLEGRO_DISPLAY* disp, - ALLEGRO_BITMAP *target) +static void ogl_update_transformation(A5O_DISPLAY* disp, + A5O_BITMAP *target) { - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { -#ifdef ALLEGRO_CFG_SHADER_GLSL + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_SHADER_GLSL GLint loc = disp->ogl_extras->varlocs.projview_matrix_loc; - ALLEGRO_TRANSFORM projview; + A5O_TRANSFORM projview; al_copy_transform(&projview, &target->transform); al_compose_transform(&projview, &target->proj_transform); al_copy_transform(&disp->projview_transform, &projview); @@ -475,7 +475,7 @@ static void ogl_update_transformation(ALLEGRO_DISPLAY* disp, } #endif } else { -#ifdef ALLEGRO_CFG_OPENGL_FIXED_FUNCTION +#ifdef A5O_CFG_OPENGL_FIXED_FUNCTION glMatrixMode(GL_PROJECTION); glLoadMatrixf((float *)target->proj_transform.m); glMatrixMode(GL_MODELVIEW); @@ -484,7 +484,7 @@ static void ogl_update_transformation(ALLEGRO_DISPLAY* disp, } if (target->parent) { - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_extra = target->parent->extra; + A5O_BITMAP_EXTRA_OPENGL *ogl_extra = target->parent->extra; /* glViewport requires the bottom-left coordinate of the corner. */ glViewport(target->xofs, ogl_extra->true_h - (target->yofs + target->h), target->w, target->h); } else { @@ -492,11 +492,11 @@ static void ogl_update_transformation(ALLEGRO_DISPLAY* disp, } } -static void ogl_clear_depth_buffer(ALLEGRO_DISPLAY *display, float x) +static void ogl_clear_depth_buffer(A5O_DISPLAY *display, float x) { (void)display; -#if defined(ALLEGRO_CFG_OPENGLES) +#if defined(A5O_CFG_OPENGLES) glClearDepthf(x); #else glClearDepth(x); @@ -509,7 +509,7 @@ static void ogl_clear_depth_buffer(ALLEGRO_DISPLAY *display, float x) } /* Add drawing commands to the vtable. */ -void _al_ogl_add_drawing_functions(ALLEGRO_DISPLAY_INTERFACE *vt) +void _al_ogl_add_drawing_functions(A5O_DISPLAY_INTERFACE *vt) { vt->clear = ogl_clear; vt->draw_pixel = ogl_draw_pixel; diff --git a/src/opengl/ogl_fbo.c b/src/opengl/ogl_fbo.c index dcb01fb379..5724fe66e6 100644 --- a/src/opengl/ogl_fbo.c +++ b/src/opengl/ogl_fbo.c @@ -21,29 +21,29 @@ #include "allegro5/internal/aintern_opengl.h" #include "allegro5/internal/aintern_pixels.h" -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID #include #include "allegro5/internal/aintern_android.h" -#elif defined ALLEGRO_IPHONE +#elif defined A5O_IPHONE #include "allegro5/internal/aintern_iphone.h" #endif #include "ogl_helpers.h" -ALLEGRO_DEBUG_CHANNEL("opengl") +A5O_DEBUG_CHANNEL("opengl") /* forward declarations */ -static void setup_fbo_backbuffer(ALLEGRO_DISPLAY *display, - ALLEGRO_BITMAP *bitmap); -static void use_fbo_for_bitmap(ALLEGRO_DISPLAY *display, - ALLEGRO_BITMAP *bitmap, ALLEGRO_FBO_INFO *info); +static void setup_fbo_backbuffer(A5O_DISPLAY *display, + A5O_BITMAP *bitmap); +static void use_fbo_for_bitmap(A5O_DISPLAY *display, + A5O_BITMAP *bitmap, A5O_FBO_INFO *info); /* glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT..) not supported on some Androids. * We keep track of it manually. */ -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID static GLint _al_gl_curr_fbo = 0; @@ -70,14 +70,14 @@ GLint _al_ogl_bind_framebuffer(GLint fbo) } e = glGetError(); if (e) { - ALLEGRO_DEBUG("glBindFramebufferEXT failed (%s)", + A5O_DEBUG("glBindFramebufferEXT failed (%s)", _al_gl_error_string(e)); } _al_android_set_curr_fbo(fbo); return old_fbo; } -#else /* !ALLEGRO_ANDROID */ +#else /* !A5O_ANDROID */ GLint _al_ogl_bind_framebuffer(GLint fbo) { @@ -87,10 +87,10 @@ GLint _al_ogl_bind_framebuffer(GLint fbo) return old_fbo; } -#endif /* !ALLEGRO_ANDROID */ +#endif /* !A5O_ANDROID */ -void _al_ogl_reset_fbo_info(ALLEGRO_FBO_INFO *info) +void _al_ogl_reset_fbo_info(A5O_FBO_INFO *info) { info->fbo_state = FBO_INFO_UNUSED; info->fbo = 0; @@ -105,24 +105,24 @@ void _al_ogl_reset_fbo_info(ALLEGRO_FBO_INFO *info) } -#if (!defined ALLEGRO_CFG_OPENGLES) || defined ALLEGRO_CFG_OPENGLES3 +#if (!defined A5O_CFG_OPENGLES) || defined A5O_CFG_OPENGLES3 static void check_gl_error(void) { GLint e = glGetError(); if (e) { - ALLEGRO_ERROR("OpenGL call failed! (%s)\n", + A5O_ERROR("OpenGL call failed! (%s)\n", _al_gl_error_string(e)); } } #endif -static void detach_depth_buffer(ALLEGRO_FBO_INFO *info) +static void detach_depth_buffer(A5O_FBO_INFO *info) { -#ifndef ALLEGRO_RASPBERRYPI +#ifndef A5O_RASPBERRYPI if (info->buffers.depth_buffer == 0) return; - ALLEGRO_DEBUG("Deleting depth render buffer: %u\n", + A5O_DEBUG("Deleting depth render buffer: %u\n", info->buffers.depth_buffer); glDeleteRenderbuffersEXT(1, &info->buffers.depth_buffer); info->buffers.depth_buffer = 0; @@ -133,12 +133,12 @@ static void detach_depth_buffer(ALLEGRO_FBO_INFO *info) } -static void detach_multisample_buffer(ALLEGRO_FBO_INFO *info) +static void detach_multisample_buffer(A5O_FBO_INFO *info) { -#ifndef ALLEGRO_RASPBERRYPI +#ifndef A5O_RASPBERRYPI if (info->buffers.multisample_buffer == 0) return; - ALLEGRO_DEBUG("Deleting multisample render buffer: %u\n", + A5O_DEBUG("Deleting multisample render buffer: %u\n", info->buffers.depth_buffer); glDeleteRenderbuffersEXT(1, &info->buffers.multisample_buffer); info->buffers.multisample_buffer = 0; @@ -150,13 +150,13 @@ static void detach_multisample_buffer(ALLEGRO_FBO_INFO *info) -static void attach_depth_buffer(ALLEGRO_FBO_INFO *info) +static void attach_depth_buffer(A5O_FBO_INFO *info) { -#if !defined ALLEGRO_RASPBERRYPI +#if !defined A5O_RASPBERRYPI GLuint rb; GLenum gldepth = GL_DEPTH_COMPONENT16; - ALLEGRO_BITMAP *b = info->owner; + A5O_BITMAP *b = info->owner; int bits = al_get_bitmap_depth(b); if (info->buffers.depth_buffer != 0) { @@ -172,11 +172,11 @@ static void attach_depth_buffer(ALLEGRO_FBO_INFO *info) return; if (info->buffers.depth_buffer == 0) { - ALLEGRO_DISPLAY *display = _al_get_bitmap_display(info->owner); + A5O_DISPLAY *display = _al_get_bitmap_display(info->owner); int w = al_get_bitmap_width(info->owner); int h = al_get_bitmap_height(info->owner); -#if !defined ALLEGRO_CFG_OPENGLES || defined ALLEGRO_CFG_OPENGLES3 +#if !defined A5O_CFG_OPENGLES || defined A5O_CFG_OPENGLES3 if (bits == 24) gldepth = GL_DEPTH_COMPONENT24; #endif @@ -186,16 +186,16 @@ static void attach_depth_buffer(ALLEGRO_FBO_INFO *info) int samples = al_get_bitmap_samples(info->owner); bool extension_supported; -#ifdef ALLEGRO_CFG_OPENGLES +#ifdef A5O_CFG_OPENGLES (void)display; extension_supported = al_have_opengl_extension("EXT_multisampled_render_to_texture"); #else - extension_supported = display->ogl_extras->extension_list->ALLEGRO_GL_EXT_framebuffer_multisample; + extension_supported = display->ogl_extras->extension_list->A5O_GL_EXT_framebuffer_multisample; #endif if (samples == 0 || !extension_supported) glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, gldepth, w, h); -#if !defined ALLEGRO_CFG_OPENGLES || defined ALLEGRO_CFG_OPENGLES3 +#if !defined A5O_CFG_OPENGLES || defined A5O_CFG_OPENGLES3 else glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples, gldepth, w, h); @@ -211,18 +211,18 @@ static void attach_depth_buffer(ALLEGRO_FBO_INFO *info) info->buffers.depth = bits; GLint e = glGetError(); if (e) { - ALLEGRO_ERROR("glRenderbufferStorage failed! bits=%d w=%d h=%d (%s)\n", + A5O_ERROR("glRenderbufferStorage failed! bits=%d w=%d h=%d (%s)\n", bits, w, h, _al_gl_error_string(e)); } else { - ALLEGRO_DEBUG("Depth render buffer created: %u\n", + A5O_DEBUG("Depth render buffer created: %u\n", info->buffers.depth_buffer); } glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, rb); if (glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT) { - ALLEGRO_ERROR("attaching depth renderbuffer failed\n"); + A5O_ERROR("attaching depth renderbuffer failed\n"); } glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); @@ -231,10 +231,10 @@ static void attach_depth_buffer(ALLEGRO_FBO_INFO *info) } -static void attach_multisample_buffer(ALLEGRO_FBO_INFO *info) +static void attach_multisample_buffer(A5O_FBO_INFO *info) { -#if !defined ALLEGRO_CFG_OPENGLES || defined ALLEGRO_CFG_OPENGLES3 - ALLEGRO_BITMAP *b = info->owner; +#if !defined A5O_CFG_OPENGLES || defined A5O_CFG_OPENGLES3 + A5O_BITMAP *b = info->owner; int samples = al_get_bitmap_samples(b); if (info->buffers.multisample_buffer != 0) { @@ -248,11 +248,11 @@ static void attach_multisample_buffer(ALLEGRO_FBO_INFO *info) if (!samples) return; - ALLEGRO_DISPLAY *display = _al_get_bitmap_display(info->owner); - if (!display->ogl_extras->extension_list->ALLEGRO_GL_EXT_framebuffer_multisample) + A5O_DISPLAY *display = _al_get_bitmap_display(info->owner); + if (!display->ogl_extras->extension_list->A5O_GL_EXT_framebuffer_multisample) return; -#ifdef ALLEGRO_CFG_OPENGLES +#ifdef A5O_CFG_OPENGLES (void)display; #else @@ -275,11 +275,11 @@ static void attach_multisample_buffer(ALLEGRO_FBO_INFO *info) info->buffers.samples = samples; e = glGetError(); if (e) { - ALLEGRO_ERROR("glRenderbufferStorage failed! samples=%d w=%d h=%d (%s)\n", + A5O_ERROR("glRenderbufferStorage failed! samples=%d w=%d h=%d (%s)\n", samples, w, h, _al_gl_error_string(e)); } else { - ALLEGRO_DEBUG("Multisample render buffer created: %u\n", + A5O_DEBUG("Multisample render buffer created: %u\n", info->buffers.multisample_buffer); } @@ -287,7 +287,7 @@ static void attach_multisample_buffer(ALLEGRO_FBO_INFO *info) GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, rb); if (glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT) { - ALLEGRO_ERROR("attaching multisample renderbuffer failed\n"); + A5O_ERROR("attaching multisample renderbuffer failed\n"); } glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); @@ -299,10 +299,10 @@ static void attach_multisample_buffer(ALLEGRO_FBO_INFO *info) } -bool _al_ogl_create_persistent_fbo(ALLEGRO_BITMAP *bitmap) +bool _al_ogl_create_persistent_fbo(A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap; - ALLEGRO_FBO_INFO *info; + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap; + A5O_FBO_INFO *info; GLint old_fbo, e; if (bitmap->parent) @@ -321,7 +321,7 @@ bool _al_ogl_create_persistent_fbo(ALLEGRO_BITMAP *bitmap) ASSERT(!ogl_bitmap->fbo_info); - info = al_malloc(sizeof(ALLEGRO_FBO_INFO)); + info = al_malloc(sizeof(A5O_FBO_INFO)); info->owner = bitmap; if (ANDROID_PROGRAMMABLE_PIPELINE(al_get_current_display())) { glGenFramebuffers(1, &info->fbo); @@ -347,7 +347,7 @@ bool _al_ogl_create_persistent_fbo(ALLEGRO_BITMAP *bitmap) e = glGetError(); if (e) { - ALLEGRO_DEBUG("glFrameBufferTexture2DEXT failed! fbo=%d texture=%d (%s)\n", + A5O_DEBUG("glFrameBufferTexture2DEXT failed! fbo=%d texture=%d (%s)\n", info->fbo, ogl_bitmap->texture, _al_gl_error_string(e)); } @@ -359,7 +359,7 @@ bool _al_ogl_create_persistent_fbo(ALLEGRO_BITMAP *bitmap) if (UNLESS_ANDROID_OR_RPI( glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT)) { - ALLEGRO_ERROR("FBO incomplete.\n"); + A5O_ERROR("FBO incomplete.\n"); _al_ogl_bind_framebuffer(old_fbo); glDeleteFramebuffersEXT(1, &info->fbo); al_free(info); @@ -371,42 +371,42 @@ bool _al_ogl_create_persistent_fbo(ALLEGRO_BITMAP *bitmap) info->fbo_state = FBO_INFO_PERSISTENT; info->last_use_time = al_get_time(); ogl_bitmap->fbo_info = info; - ALLEGRO_DEBUG("Persistent FBO: %u\n", info->fbo); + A5O_DEBUG("Persistent FBO: %u\n", info->fbo); return true; } -ALLEGRO_FBO_INFO *_al_ogl_persist_fbo(ALLEGRO_DISPLAY *display, - ALLEGRO_FBO_INFO *transient_fbo_info) +A5O_FBO_INFO *_al_ogl_persist_fbo(A5O_DISPLAY *display, + A5O_FBO_INFO *transient_fbo_info) { - ALLEGRO_OGL_EXTRAS *extras = display->ogl_extras; + A5O_OGL_EXTRAS *extras = display->ogl_extras; int i; ASSERT(transient_fbo_info->fbo_state == FBO_INFO_TRANSIENT); - for (i = 0; i < ALLEGRO_MAX_OPENGL_FBOS; i++) { + for (i = 0; i < A5O_MAX_OPENGL_FBOS; i++) { if (transient_fbo_info == &extras->fbos[i]) { - ALLEGRO_FBO_INFO *new_info = al_malloc(sizeof(ALLEGRO_FBO_INFO)); + A5O_FBO_INFO *new_info = al_malloc(sizeof(A5O_FBO_INFO)); *new_info = *transient_fbo_info; new_info->fbo_state = FBO_INFO_PERSISTENT; _al_ogl_reset_fbo_info(transient_fbo_info); - ALLEGRO_DEBUG("Persistent FBO: %u\n", new_info->fbo); + A5O_DEBUG("Persistent FBO: %u\n", new_info->fbo); return new_info; } } - ALLEGRO_ERROR("Could not find FBO %u in pool\n", transient_fbo_info->fbo); + A5O_ERROR("Could not find FBO %u in pool\n", transient_fbo_info->fbo); return transient_fbo_info; } -static ALLEGRO_FBO_INFO *ogl_find_unused_fbo(ALLEGRO_DISPLAY *display) +static A5O_FBO_INFO *ogl_find_unused_fbo(A5O_DISPLAY *display) { - ALLEGRO_OGL_EXTRAS *extras = display->ogl_extras; + A5O_OGL_EXTRAS *extras = display->ogl_extras; double min_time = DBL_MAX; int min_time_index = -1; int i; - for (i = 0; i < ALLEGRO_MAX_OPENGL_FBOS; i++) { + for (i = 0; i < A5O_MAX_OPENGL_FBOS; i++) { if (extras->fbos[i].fbo_state == FBO_INFO_UNUSED) return &extras->fbos[i]; if (extras->fbos[i].last_use_time < min_time) { @@ -419,11 +419,11 @@ static ALLEGRO_FBO_INFO *ogl_find_unused_fbo(ALLEGRO_DISPLAY *display) } -void _al_ogl_del_fbo(ALLEGRO_FBO_INFO *info) +void _al_ogl_del_fbo(A5O_FBO_INFO *info) { - ALLEGRO_BITMAP_EXTRA_OPENGL *extra = info->owner->extra; + A5O_BITMAP_EXTRA_OPENGL *extra = info->owner->extra; extra->fbo_info = NULL; - ALLEGRO_DEBUG("Deleting FBO: %u\n", info->fbo); + A5O_DEBUG("Deleting FBO: %u\n", info->fbo); if (ANDROID_PROGRAMMABLE_PIPELINE(al_get_current_display())) { glDeleteFramebuffers(1, &info->fbo); } @@ -438,9 +438,9 @@ void _al_ogl_del_fbo(ALLEGRO_FBO_INFO *info) } -static ALLEGRO_FBO_INFO *ogl_new_fbo(ALLEGRO_DISPLAY *display) +static A5O_FBO_INFO *ogl_new_fbo(A5O_DISPLAY *display) { - ALLEGRO_FBO_INFO *info; + A5O_FBO_INFO *info; GLint e; info = ogl_find_unused_fbo(display); @@ -462,19 +462,19 @@ static ALLEGRO_FBO_INFO *ogl_new_fbo(ALLEGRO_DISPLAY *display) } e = glGetError(); if (e) { - ALLEGRO_ERROR("glGenFramebuffersEXT failed\n"); + A5O_ERROR("glGenFramebuffersEXT failed\n"); _al_ogl_reset_fbo_info(info); return NULL; } - ALLEGRO_DEBUG("Created FBO: %u\n", info->fbo); + A5O_DEBUG("Created FBO: %u\n", info->fbo); return info; } -void _al_ogl_setup_fbo(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap) +void _al_ogl_setup_fbo(A5O_DISPLAY *display, A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap; + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap; if (bitmap->parent) bitmap = bitmap->parent; @@ -505,19 +505,19 @@ void _al_ogl_setup_fbo(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap) * * [1] https://www.opengl.org/registry/specs/EXT/framebuffer_multisample.txt */ -void _al_ogl_finalize_fbo(ALLEGRO_DISPLAY *display, - ALLEGRO_BITMAP *bitmap) +void _al_ogl_finalize_fbo(A5O_DISPLAY *display, + A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP_EXTRA_OPENGL *extra = bitmap->extra; + A5O_BITMAP_EXTRA_OPENGL *extra = bitmap->extra; if (!extra) return; - ALLEGRO_FBO_INFO *info = extra->fbo_info; + A5O_FBO_INFO *info = extra->fbo_info; (void)display; if (!info) return; if (!info->buffers.multisample_buffer) return; - #ifndef ALLEGRO_CFG_OPENGLES + #ifndef A5O_CFG_OPENGLES int w = al_get_bitmap_width(bitmap); int h = al_get_bitmap_height(bitmap); @@ -539,30 +539,30 @@ void _al_ogl_finalize_fbo(ALLEGRO_DISPLAY *display, } -static void setup_fbo_backbuffer(ALLEGRO_DISPLAY *display, - ALLEGRO_BITMAP *bitmap) +static void setup_fbo_backbuffer(A5O_DISPLAY *display, + A5O_BITMAP *bitmap) { display->ogl_extras->opengl_target = bitmap; // The IS_OPENGLES part is a hack. if (IS_OPENGLES || - display->ogl_extras->extension_list->ALLEGRO_GL_EXT_framebuffer_object || - display->ogl_extras->extension_list->ALLEGRO_GL_OES_framebuffer_object) + display->ogl_extras->extension_list->A5O_GL_EXT_framebuffer_object || + display->ogl_extras->extension_list->A5O_GL_OES_framebuffer_object) { _al_ogl_bind_framebuffer(0); } -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE _al_iphone_setup_opengl_view(display, false); #endif } -bool _al_ogl_setup_fbo_non_backbuffer(ALLEGRO_DISPLAY *display, - ALLEGRO_BITMAP *bitmap) +bool _al_ogl_setup_fbo_non_backbuffer(A5O_DISPLAY *display, + A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap = bitmap->extra; - ALLEGRO_FBO_INFO *info; + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap = bitmap->extra; + A5O_FBO_INFO *info; ASSERT(bitmap->parent == NULL); @@ -575,8 +575,8 @@ bool _al_ogl_setup_fbo_non_backbuffer(ALLEGRO_DISPLAY *display, * FBOs though (currently.) */ if (IS_OPENGLES || - al_get_opengl_extension_list()->ALLEGRO_GL_EXT_framebuffer_object || - al_get_opengl_extension_list()->ALLEGRO_GL_OES_framebuffer_object) + al_get_opengl_extension_list()->A5O_GL_EXT_framebuffer_object || + al_get_opengl_extension_list()->A5O_GL_OES_framebuffer_object) { info = ogl_new_fbo(display); } @@ -591,10 +591,10 @@ bool _al_ogl_setup_fbo_non_backbuffer(ALLEGRO_DISPLAY *display, } -static void use_fbo_for_bitmap(ALLEGRO_DISPLAY *display, - ALLEGRO_BITMAP *bitmap, ALLEGRO_FBO_INFO *info) +static void use_fbo_for_bitmap(A5O_DISPLAY *display, + A5O_BITMAP *bitmap, A5O_FBO_INFO *info) { - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap = bitmap->extra; + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap = bitmap->extra; GLint e; if (info->fbo_state == FBO_INFO_UNUSED) @@ -616,14 +616,14 @@ static void use_fbo_for_bitmap(ALLEGRO_DISPLAY *display, if (!info->buffers.multisample_buffer) { /* Attach the texture. */ -#ifdef ALLEGRO_CFG_OPENGLES +#ifdef A5O_CFG_OPENGLES if (ANDROID_PROGRAMMABLE_PIPELINE(al_get_current_display())) { if (al_get_bitmap_samples(bitmap) == 0 || !al_have_opengl_extension("EXT_multisampled_render_to_texture")) { glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, ogl_bitmap->texture, 0); } -#if ((!defined ALLEGRO_CFG_OPENGLES || defined ALLEGRO_CFG_OPENGLES3) && !defined ALLEGRO_IPHONE) -#if (!defined ALLEGRO_ANDROID) || (__ANDROID_API__ >= 28) /* Android: glFramebufferTexture2DMultisampleEXT exists in newer libGLESv[23].so */ +#if ((!defined A5O_CFG_OPENGLES || defined A5O_CFG_OPENGLES3) && !defined A5O_IPHONE) +#if (!defined A5O_ANDROID) || (__ANDROID_API__ >= 28) /* Android: glFramebufferTexture2DMultisampleEXT exists in newer libGLESv[23].so */ else { glFramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, ogl_bitmap->texture, @@ -642,7 +642,7 @@ static void use_fbo_for_bitmap(ALLEGRO_DISPLAY *display, e = glGetError(); if (e) { - ALLEGRO_DEBUG("glFrameBufferTexture2DEXT failed! fbo=%d texture=%d (%s)\n", + A5O_DEBUG("glFrameBufferTexture2DEXT failed! fbo=%d texture=%d (%s)\n", info->fbo, ogl_bitmap->texture, _al_gl_error_string(e)); } } @@ -655,9 +655,9 @@ static void use_fbo_for_bitmap(ALLEGRO_DISPLAY *display, * texture. So no reason to keep re-trying, output a log * message and switch to (extremely slow) software mode. */ - ALLEGRO_ERROR("Could not use FBO for bitmap with format %s.\n", + A5O_ERROR("Could not use FBO for bitmap with format %s.\n", _al_pixel_format_name(al_get_bitmap_format(bitmap))); - ALLEGRO_ERROR("*** SWITCHING TO SOFTWARE MODE ***\n"); + A5O_ERROR("*** SWITCHING TO SOFTWARE MODE ***\n"); _al_ogl_bind_framebuffer(0); glDeleteFramebuffersEXT(1, &info->fbo); _al_ogl_reset_fbo_info(info); diff --git a/src/opengl/ogl_helpers.h b/src/opengl/ogl_helpers.h index 0da30b644c..d2fc43a66b 100644 --- a/src/opengl/ogl_helpers.h +++ b/src/opengl/ogl_helpers.h @@ -6,19 +6,19 @@ /* Some definitions to smooth out the code in the opengl directory. */ -#ifdef ALLEGRO_CFG_OPENGLES +#ifdef A5O_CFG_OPENGLES #define IS_OPENGLES (true) #else #define IS_OPENGLES (false) #endif -#ifdef ALLEGRO_IPHONE +#ifdef A5O_IPHONE #define IS_IPHONE (true) #else #define IS_IPHONE (false) #endif -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID #define IS_ANDROID (true) #define IS_ANDROID_AND(x) (x) #else @@ -26,13 +26,13 @@ #define IS_ANDROID_AND(x) (false) #endif -#ifdef ALLEGRO_RASPBERRYPI +#ifdef A5O_RASPBERRYPI #define IS_RASPBERRYPI (true) #else #define IS_RASPBERRYPI (false) #endif -#if defined(ALLEGRO_ANDROID) || defined(ALLEGRO_RASPBERRYPI) +#if defined(A5O_ANDROID) || defined(A5O_RASPBERRYPI) #define UNLESS_ANDROID_OR_RPI(x) (0) #else #define UNLESS_ANDROID_OR_RPI(x) (x) @@ -40,9 +40,9 @@ /* Android uses different functions/symbol names depending on ES version */ #define ANDROID_PROGRAMMABLE_PIPELINE(dpy) \ - IS_ANDROID_AND(al_get_display_flags(dpy) & ALLEGRO_PROGRAMMABLE_PIPELINE) + IS_ANDROID_AND(al_get_display_flags(dpy) & A5O_PROGRAMMABLE_PIPELINE) -#if defined ALLEGRO_CFG_OPENGLES2 +#if defined A5O_CFG_OPENGLES2 #ifndef GL_EXT_draw_buffers #define GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT0 #endif @@ -64,7 +64,7 @@ #define glFramebufferRenderbufferEXT glFramebufferRenderbuffer #define glDeleteRenderbuffersEXT glDeleteRenderbuffers #define GL_DEPTH_ATTACHMENT_EXT GL_DEPTH_ATTACHMENT -#elif defined ALLEGRO_CFG_OPENGLES +#elif defined A5O_CFG_OPENGLES /* Note: This works because all the constants are the same, e.g. * GL_FRAMEBUFFER_OES == GL_FRAMEBUFFER_EXT == 0x8D40 * And so we can use the OpenGL framebuffer extension in the same was diff --git a/src/opengl/ogl_lock.c b/src/opengl/ogl_lock.c index 4c048f6516..d55c682105 100644 --- a/src/opengl/ogl_lock.c +++ b/src/opengl/ogl_lock.c @@ -26,9 +26,9 @@ * #ifdefs everywhere. Combined with huge functions, that made the previous * version very hard to follow and prone to break. */ -#if !defined(ALLEGRO_CFG_OPENGLES) +#if !defined(A5O_CFG_OPENGLES) -ALLEGRO_DEBUG_CHANNEL("opengl") +A5O_DEBUG_CHANNEL("opengl") #define get_glformat(f, c) _al_ogl_get_glformat((f), (c)) @@ -64,8 +64,8 @@ static int ogl_pitch(int w, int pixel_size) static bool exactly_15bpp(int pixel_format) { - return pixel_format == ALLEGRO_PIXEL_FORMAT_RGB_555 - || pixel_format == ALLEGRO_PIXEL_FORMAT_BGR_555; + return pixel_format == A5O_PIXEL_FORMAT_RGB_555 + || pixel_format == A5O_PIXEL_FORMAT_BGR_555; } @@ -75,42 +75,42 @@ static bool exactly_15bpp(int pixel_format) */ static bool ogl_lock_region_backbuffer( - ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, + A5O_BITMAP *bitmap, A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int x, int gl_y, int w, int h, int format, int flags); static bool ogl_lock_region_nonbb_writeonly( - ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, + A5O_BITMAP *bitmap, A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int x, int gl_y, int w, int h, int format); static bool ogl_lock_region_nonbb_readwrite( - ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, + A5O_BITMAP *bitmap, A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int x, int gl_y, int w, int h, int format, bool* restore_fbo); static bool ogl_lock_region_nonbb_readwrite_fbo( - ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, + A5O_BITMAP *bitmap, A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int x, int gl_y, int w, int h, int format); static bool ogl_lock_region_nonbb_readwrite_nonfbo( - ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, + A5O_BITMAP *bitmap, A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int x, int gl_y, int w, int h, int format); -ALLEGRO_LOCKED_REGION *_al_ogl_lock_region_new(ALLEGRO_BITMAP *bitmap, +A5O_LOCKED_REGION *_al_ogl_lock_region_new(A5O_BITMAP *bitmap, int x, int y, int w, int h, int format, int flags) { - ALLEGRO_BITMAP_EXTRA_OPENGL * const ogl_bitmap = bitmap->extra; + A5O_BITMAP_EXTRA_OPENGL * const ogl_bitmap = bitmap->extra; const GLint gl_y = bitmap->h - y - h; - ALLEGRO_DISPLAY *disp; - ALLEGRO_DISPLAY *old_disp = NULL; - ALLEGRO_BITMAP *old_target = al_get_target_bitmap(); + A5O_DISPLAY *disp; + A5O_DISPLAY *old_disp = NULL; + A5O_BITMAP *old_target = al_get_target_bitmap(); GLenum e; bool ok; bool restore_fbo = false; bool reset_alignment = false; - if (format == ALLEGRO_PIXEL_FORMAT_ANY) { + if (format == A5O_PIXEL_FORMAT_ANY) { /* Never pick compressed formats with ANY, as it interacts weirdly with * existing code (e.g. al_get_pixel_size() etc) */ int bitmap_format = al_get_bitmap_format(bitmap); if (_al_pixel_format_is_compressed(bitmap_format)) { // XXX Get a good format from the driver? - format = ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE; + format = A5O_PIXEL_FORMAT_ABGR_8888_LE; } else { format = bitmap_format; @@ -146,7 +146,7 @@ ALLEGRO_LOCKED_REGION *_al_ogl_lock_region_new(ALLEGRO_BITMAP *bitmap, glPixelStorei(GL_PACK_ALIGNMENT, pixel_alignment); e = glGetError(); if (e) { - ALLEGRO_ERROR("glPixelStorei(GL_PACK_ALIGNMENT, %d) failed (%s).\n", + A5O_ERROR("glPixelStorei(GL_PACK_ALIGNMENT, %d) failed (%s).\n", pixel_alignment, _al_gl_error_string(e)); ok = false; } @@ -155,17 +155,17 @@ ALLEGRO_LOCKED_REGION *_al_ogl_lock_region_new(ALLEGRO_BITMAP *bitmap, if (ok) { if (ogl_bitmap->is_backbuffer) { - ALLEGRO_DEBUG("Locking backbuffer\n"); + A5O_DEBUG("Locking backbuffer\n"); ok = ogl_lock_region_backbuffer(bitmap, ogl_bitmap, x, gl_y, w, h, format, flags); } - else if (flags & ALLEGRO_LOCK_WRITEONLY) { - ALLEGRO_DEBUG("Locking non-backbuffer WRITEONLY\n"); + else if (flags & A5O_LOCK_WRITEONLY) { + A5O_DEBUG("Locking non-backbuffer WRITEONLY\n"); ok = ogl_lock_region_nonbb_writeonly(bitmap, ogl_bitmap, x, gl_y, w, h, format); } else { - ALLEGRO_DEBUG("Locking non-backbuffer READWRITE\n"); + A5O_DEBUG("Locking non-backbuffer READWRITE\n"); ok = ogl_lock_region_nonbb_readwrite(bitmap, ogl_bitmap, x, gl_y, w, h, format, &restore_fbo); } @@ -200,14 +200,14 @@ ALLEGRO_LOCKED_REGION *_al_ogl_lock_region_new(ALLEGRO_BITMAP *bitmap, return &bitmap->locked_region; } - ALLEGRO_ERROR("Failed to lock region\n"); + A5O_ERROR("Failed to lock region\n"); ASSERT(ogl_bitmap->lock_buffer == NULL); return NULL; } static bool ogl_lock_region_backbuffer( - ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, + A5O_BITMAP *bitmap, A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int x, int gl_y, int w, int h, int format, int flags) { const int pixel_size = al_get_pixel_size(format); @@ -219,14 +219,14 @@ static bool ogl_lock_region_backbuffer( return false; } - if (!(flags & ALLEGRO_LOCK_WRITEONLY)) { + if (!(flags & A5O_LOCK_WRITEONLY)) { glReadPixels(x, gl_y, w, h, get_glformat(format, 2), get_glformat(format, 1), ogl_bitmap->lock_buffer); e = glGetError(); if (e) { - ALLEGRO_ERROR("glReadPixels for format %s failed (%s).\n", + A5O_ERROR("glReadPixels for format %s failed (%s).\n", _al_pixel_format_name(format), _al_gl_error_string(e)); al_free(ogl_bitmap->lock_buffer); ogl_bitmap->lock_buffer = NULL; @@ -243,7 +243,7 @@ static bool ogl_lock_region_backbuffer( static bool ogl_lock_region_nonbb_writeonly( - ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, + A5O_BITMAP *bitmap, A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int x, int gl_y, int w, int h, int format) { const int pixel_size = al_get_pixel_size(format); @@ -265,7 +265,7 @@ static bool ogl_lock_region_nonbb_writeonly( static bool ogl_lock_region_nonbb_readwrite( - ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, + A5O_BITMAP *bitmap, A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int x, int gl_y, int w, int h, int format, bool* restore_fbo) { bool ok; @@ -279,12 +279,12 @@ static bool ogl_lock_region_nonbb_readwrite( _al_ogl_setup_fbo_non_backbuffer(_al_get_bitmap_display(bitmap), bitmap); if (ogl_bitmap->fbo_info) { - ALLEGRO_DEBUG("Locking non-backbuffer READWRITE with fbo\n"); + A5O_DEBUG("Locking non-backbuffer READWRITE with fbo\n"); ok = ogl_lock_region_nonbb_readwrite_fbo(bitmap, ogl_bitmap, x, gl_y, w, h, format); } else { - ALLEGRO_DEBUG("Locking non-backbuffer READWRITE no fbo\n"); + A5O_DEBUG("Locking non-backbuffer READWRITE no fbo\n"); ok = ogl_lock_region_nonbb_readwrite_nonfbo(bitmap, ogl_bitmap, x, gl_y, w, h, format); } @@ -294,7 +294,7 @@ static bool ogl_lock_region_nonbb_readwrite( static bool ogl_lock_region_nonbb_readwrite_fbo( - ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, + A5O_BITMAP *bitmap, A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int x, int gl_y, int w, int h, int format) { const int pixel_size = al_get_pixel_size(format); @@ -306,7 +306,7 @@ static bool ogl_lock_region_nonbb_readwrite_fbo( glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &old_fbo); e = glGetError(); if (e) { - ALLEGRO_ERROR("glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT) failed (%s).\n", + A5O_ERROR("glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT) failed (%s).\n", _al_gl_error_string(e)); return false; } @@ -316,7 +316,7 @@ static bool ogl_lock_region_nonbb_readwrite_fbo( glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, ogl_bitmap->fbo_info->fbo); e = glGetError(); if (e) { - ALLEGRO_ERROR("glBindFramebufferEXT failed (%s).\n", + A5O_ERROR("glBindFramebufferEXT failed (%s).\n", _al_gl_error_string(e)); ok = false; } @@ -335,7 +335,7 @@ static bool ogl_lock_region_nonbb_readwrite_fbo( ogl_bitmap->lock_buffer); e = glGetError(); if (e) { - ALLEGRO_ERROR("glReadPixels for format %s failed (%s).\n", + A5O_ERROR("glReadPixels for format %s failed (%s).\n", _al_pixel_format_name(format), _al_gl_error_string(e)); } } @@ -357,7 +357,7 @@ static bool ogl_lock_region_nonbb_readwrite_fbo( static bool ogl_lock_region_nonbb_readwrite_nonfbo( - ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, + A5O_BITMAP *bitmap, A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int x, int gl_y, int w, int h, int format) { /* No FBO - fallback to reading the entire texture */ @@ -382,7 +382,7 @@ static bool ogl_lock_region_nonbb_readwrite_nonfbo( e = glGetError(); if (e) { - ALLEGRO_ERROR("glGetTexImage for format %s failed (%s).\n", + A5O_ERROR("glGetTexImage for format %s failed (%s).\n", _al_pixel_format_name(format), _al_gl_error_string(e)); al_free(ogl_bitmap->lock_buffer); ogl_bitmap->lock_buffer = NULL; @@ -406,26 +406,26 @@ static bool ogl_lock_region_nonbb_readwrite_nonfbo( * Unlocking */ -static void ogl_unlock_region_non_readonly(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap); -static void ogl_unlock_region_backbuffer(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y); -static void ogl_unlock_region_nonbb_fbo(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format); -static void ogl_unlock_region_nonbb_fbo_writeonly(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format); -static void ogl_unlock_region_nonbb_fbo_readwrite(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y); -static void ogl_unlock_region_nonbb_nonfbo(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y); - - -void _al_ogl_unlock_region_new(ALLEGRO_BITMAP *bitmap) +static void ogl_unlock_region_non_readonly(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap); +static void ogl_unlock_region_backbuffer(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y); +static void ogl_unlock_region_nonbb_fbo(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format); +static void ogl_unlock_region_nonbb_fbo_writeonly(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format); +static void ogl_unlock_region_nonbb_fbo_readwrite(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y); +static void ogl_unlock_region_nonbb_nonfbo(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y); + + +void _al_ogl_unlock_region_new(A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap = bitmap->extra; + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap = bitmap->extra; - if (bitmap->lock_flags & ALLEGRO_LOCK_READONLY) { - ALLEGRO_DEBUG("Unlocking non-backbuffer READONLY\n"); + if (bitmap->lock_flags & A5O_LOCK_READONLY) { + A5O_DEBUG("Unlocking non-backbuffer READONLY\n"); } else { ogl_unlock_region_non_readonly(bitmap, ogl_bitmap); @@ -436,13 +436,13 @@ void _al_ogl_unlock_region_new(ALLEGRO_BITMAP *bitmap) } -static void ogl_unlock_region_non_readonly(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap) +static void ogl_unlock_region_non_readonly(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap) { const int lock_format = bitmap->locked_region.format; const int gl_y = bitmap->h - bitmap->lock_y - bitmap->lock_h; - ALLEGRO_DISPLAY *old_disp = NULL; - ALLEGRO_DISPLAY *disp; + A5O_DISPLAY *old_disp = NULL; + A5O_DISPLAY *disp; int orig_format; bool biased_alpha = false; bool reset_alignment = false; @@ -471,7 +471,7 @@ static void ogl_unlock_region_non_readonly(ALLEGRO_BITMAP *bitmap, glPixelStorei(GL_UNPACK_ALIGNMENT, pixel_alignment); e = glGetError(); if (e) { - ALLEGRO_ERROR("glPixelStorei(GL_UNPACK_ALIGNMENT, %d) failed (%s).\n", + A5O_ERROR("glPixelStorei(GL_UNPACK_ALIGNMENT, %d) failed (%s).\n", pixel_alignment, _al_gl_error_string(e)); } } @@ -485,29 +485,29 @@ static void ogl_unlock_region_non_readonly(ALLEGRO_BITMAP *bitmap, } if (ogl_bitmap->is_backbuffer) { - ALLEGRO_DEBUG("Unlocking backbuffer\n"); + A5O_DEBUG("Unlocking backbuffer\n"); ogl_unlock_region_backbuffer(bitmap, ogl_bitmap, gl_y); } else { glBindTexture(GL_TEXTURE_2D, ogl_bitmap->texture); if (ogl_bitmap->fbo_info) { - ALLEGRO_DEBUG("Unlocking non-backbuffer (FBO)\n"); + A5O_DEBUG("Unlocking non-backbuffer (FBO)\n"); ogl_unlock_region_nonbb_fbo(bitmap, ogl_bitmap, gl_y, orig_format); } else { - ALLEGRO_DEBUG("Unlocking non-backbuffer (non-FBO)\n"); + A5O_DEBUG("Unlocking non-backbuffer (non-FBO)\n"); ogl_unlock_region_nonbb_nonfbo(bitmap, ogl_bitmap, gl_y); } /* If using FBOs, we need to regenerate mipmaps explicitly now. */ /* XXX why don't we check ogl_bitmap->fbo_info? */ - if ((al_get_bitmap_flags(bitmap) & ALLEGRO_MIPMAP) && - al_get_opengl_extension_list()->ALLEGRO_GL_EXT_framebuffer_object) + if ((al_get_bitmap_flags(bitmap) & A5O_MIPMAP) && + al_get_opengl_extension_list()->A5O_GL_EXT_framebuffer_object) { glGenerateMipmapEXT(GL_TEXTURE_2D); e = glGetError(); if (e) { - ALLEGRO_ERROR("glGenerateMipmapEXT for texture %d failed (%s).\n", + A5O_ERROR("glGenerateMipmapEXT for texture %d failed (%s).\n", ogl_bitmap->texture, _al_gl_error_string(e)); } } @@ -526,16 +526,16 @@ static void ogl_unlock_region_non_readonly(ALLEGRO_BITMAP *bitmap, } -static void ogl_unlock_region_backbuffer(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y) +static void ogl_unlock_region_backbuffer(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y) { const int lock_format = bitmap->locked_region.format; bool popmatrix = false; GLenum e; GLint program = 0; - ALLEGRO_DISPLAY *display = al_get_current_display(); + A5O_DISPLAY *display = al_get_current_display(); - if (display->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { + if (display->flags & A5O_PROGRAMMABLE_PIPELINE) { // FIXME: This is a hack where we temporarily disable the active shader. // It will only work on Desktop OpenGL in non-strict mode where we even // can switch back to the fixed pipeline. The correct way would be to not @@ -547,7 +547,7 @@ static void ogl_unlock_region_backbuffer(ALLEGRO_BITMAP *bitmap, } /* glWindowPos2i may not be available. */ - if (al_get_opengl_version() >= _ALLEGRO_OPENGL_VERSION_1_4) { + if (al_get_opengl_version() >= _A5O_OPENGL_VERSION_1_4) { glWindowPos2i(bitmap->lock_x, gl_y); } else { @@ -573,7 +573,7 @@ static void ogl_unlock_region_backbuffer(ALLEGRO_BITMAP *bitmap, ogl_bitmap->lock_buffer); e = glGetError(); if (e) { - ALLEGRO_ERROR("glDrawPixels for format %s failed (%s).\n", + A5O_ERROR("glDrawPixels for format %s failed (%s).\n", _al_pixel_format_name(lock_format), _al_gl_error_string(e)); } @@ -587,23 +587,23 @@ static void ogl_unlock_region_backbuffer(ALLEGRO_BITMAP *bitmap, } -static void ogl_unlock_region_nonbb_fbo(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format) +static void ogl_unlock_region_nonbb_fbo(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format) { - if (bitmap->lock_flags & ALLEGRO_LOCK_WRITEONLY) { - ALLEGRO_DEBUG("Unlocking non-backbuffer FBO WRITEONLY\n"); + if (bitmap->lock_flags & A5O_LOCK_WRITEONLY) { + A5O_DEBUG("Unlocking non-backbuffer FBO WRITEONLY\n"); ogl_unlock_region_nonbb_fbo_writeonly(bitmap, ogl_bitmap, gl_y, orig_format); } else { - ALLEGRO_DEBUG("Unlocking non-backbuffer FBO READWRITE\n"); + A5O_DEBUG("Unlocking non-backbuffer FBO READWRITE\n"); ogl_unlock_region_nonbb_fbo_readwrite(bitmap, ogl_bitmap, gl_y); } } -static void ogl_unlock_region_nonbb_fbo_writeonly(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format) +static void ogl_unlock_region_nonbb_fbo_writeonly(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format) { const int lock_format = bitmap->locked_region.format; const int orig_pixel_size = al_get_pixel_size(orig_format); @@ -629,7 +629,7 @@ static void ogl_unlock_region_nonbb_fbo_writeonly(ALLEGRO_BITMAP *bitmap, tmpbuf); e = glGetError(); if (e) { - ALLEGRO_ERROR("glTexSubImage2D for format %d failed (%s).\n", + A5O_ERROR("glTexSubImage2D for format %d failed (%s).\n", lock_format, _al_gl_error_string(e)); } @@ -637,8 +637,8 @@ static void ogl_unlock_region_nonbb_fbo_writeonly(ALLEGRO_BITMAP *bitmap, } -static void ogl_unlock_region_nonbb_fbo_readwrite(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y) +static void ogl_unlock_region_nonbb_fbo_readwrite(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y) { const int lock_format = bitmap->locked_region.format; GLenum e; @@ -652,30 +652,30 @@ static void ogl_unlock_region_nonbb_fbo_readwrite(ALLEGRO_BITMAP *bitmap, e = glGetError(); if (e) { - ALLEGRO_ERROR("glTexSubImage2D for format %s failed (%s).\n", + A5O_ERROR("glTexSubImage2D for format %s failed (%s).\n", _al_pixel_format_name(lock_format), _al_gl_error_string(e)); glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &tex_internalformat); - ALLEGRO_DEBUG("x/y/w/h: %d/%d/%d/%d, internal format: %d\n", + A5O_DEBUG("x/y/w/h: %d/%d/%d/%d, internal format: %d\n", bitmap->lock_x, gl_y, bitmap->lock_w, bitmap->lock_h, tex_internalformat); } } -static void ogl_unlock_region_nonbb_nonfbo(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y) +static void ogl_unlock_region_nonbb_nonfbo(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y) { const int lock_format = bitmap->locked_region.format; unsigned char *start_ptr; GLenum e; - if (bitmap->lock_flags & ALLEGRO_LOCK_WRITEONLY) { - ALLEGRO_DEBUG("Unlocking non-backbuffer non-FBO WRITEONLY\n"); + if (bitmap->lock_flags & A5O_LOCK_WRITEONLY) { + A5O_DEBUG("Unlocking non-backbuffer non-FBO WRITEONLY\n"); start_ptr = ogl_bitmap->lock_buffer; } else { - ALLEGRO_DEBUG("Unlocking non-backbuffer non-FBO READWRITE\n"); + A5O_DEBUG("Unlocking non-backbuffer non-FBO READWRITE\n"); glPixelStorei(GL_UNPACK_ROW_LENGTH, ogl_bitmap->true_w); start_ptr = (unsigned char *)bitmap->lock_data + (bitmap->lock_h - 1) * bitmap->locked_region.pitch; @@ -690,7 +690,7 @@ static void ogl_unlock_region_nonbb_nonfbo(ALLEGRO_BITMAP *bitmap, e = glGetError(); if (e) { - ALLEGRO_ERROR("glTexSubImage2D for format %s failed (%s).\n", + A5O_ERROR("glTexSubImage2D for format %s failed (%s).\n", _al_pixel_format_name(lock_format), _al_gl_error_string(e)); } } diff --git a/src/opengl/ogl_lock_es.c b/src/opengl/ogl_lock_es.c index b4d14498c6..c3d4e353d0 100644 --- a/src/opengl/ogl_lock_es.c +++ b/src/opengl/ogl_lock_es.c @@ -19,7 +19,7 @@ #include "allegro5/internal/aintern_opengl.h" #include "allegro5/internal/aintern_pixels.h" -#if defined ALLEGRO_ANDROID +#if defined A5O_ANDROID #include "allegro5/internal/aintern_android.h" #endif @@ -30,9 +30,9 @@ * The version for desktop GL is in ogl_lock.c. They are pretty similar again * so probably could consider unifying them again. */ -#if defined(ALLEGRO_CFG_OPENGLES) +#if defined(A5O_CFG_OPENGLES) -ALLEGRO_DEBUG_CHANNEL("opengl") +A5O_DEBUG_CHANNEL("opengl") #define get_glformat(f, c) _al_ogl_get_glformat((f), (c)) @@ -71,37 +71,37 @@ static int ogl_pitch(int w, int pixel_size) * Locking */ -static ALLEGRO_LOCKED_REGION *ogl_lock_region_bb_readonly( - ALLEGRO_BITMAP *bitmap, int x, int y, int w, int h, int real_format); -static ALLEGRO_LOCKED_REGION *ogl_lock_region_bb_proxy(ALLEGRO_BITMAP *bitmap, +static A5O_LOCKED_REGION *ogl_lock_region_bb_readonly( + A5O_BITMAP *bitmap, int x, int y, int w, int h, int real_format); +static A5O_LOCKED_REGION *ogl_lock_region_bb_proxy(A5O_BITMAP *bitmap, int x, int y, int w, int h, int real_format, int flags); -static ALLEGRO_LOCKED_REGION *ogl_lock_region_nonbb(ALLEGRO_BITMAP *bitmap, +static A5O_LOCKED_REGION *ogl_lock_region_nonbb(A5O_BITMAP *bitmap, int x, int y, int w, int h, int real_format, int flags); static bool ogl_lock_region_nonbb_writeonly( - ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, + A5O_BITMAP *bitmap, A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int x, int gl_y, int w, int h, int real_format); static bool ogl_lock_region_nonbb_readwrite( - ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, + A5O_BITMAP *bitmap, A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int x, int gl_y, int w, int h, int real_format, bool* restore_fbo); static bool ogl_lock_region_nonbb_readwrite_fbo( - ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, + A5O_BITMAP *bitmap, A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int x, int gl_y, int w, int h, int real_format); -ALLEGRO_LOCKED_REGION *_al_ogl_lock_region_gles(ALLEGRO_BITMAP *bitmap, +A5O_LOCKED_REGION *_al_ogl_lock_region_gles(A5O_BITMAP *bitmap, int x, int y, int w, int h, int format, int flags) { - ALLEGRO_BITMAP_EXTRA_OPENGL * const ogl_bitmap = bitmap->extra; - ALLEGRO_DISPLAY *disp; + A5O_BITMAP_EXTRA_OPENGL * const ogl_bitmap = bitmap->extra; + A5O_DISPLAY *disp; int real_format; - if (format == ALLEGRO_PIXEL_FORMAT_ANY) { + if (format == A5O_PIXEL_FORMAT_ANY) { /* Never pick compressed formats with ANY, as it interacts weirdly with * existing code (e.g. al_get_pixel_size() etc) */ int bitmap_format = al_get_bitmap_format(bitmap); if (_al_pixel_format_is_compressed(bitmap_format)) { // XXX Get a good format from the driver? - format = ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE; + format = A5O_PIXEL_FORMAT_ABGR_8888_LE; } else { format = bitmap_format; @@ -112,7 +112,7 @@ ALLEGRO_LOCKED_REGION *_al_ogl_lock_region_gles(ALLEGRO_BITMAP *bitmap, real_format = _al_get_real_pixel_format(disp, format); if (ogl_bitmap->is_backbuffer) { - if (flags & ALLEGRO_LOCK_READONLY) { + if (flags & A5O_LOCK_READONLY) { return ogl_lock_region_bb_readonly(bitmap, x, y, w, h, real_format); } else { @@ -126,10 +126,10 @@ ALLEGRO_LOCKED_REGION *_al_ogl_lock_region_gles(ALLEGRO_BITMAP *bitmap, } -static ALLEGRO_LOCKED_REGION *ogl_lock_region_bb_readonly( - ALLEGRO_BITMAP *bitmap, int x, int y, int w, int h, int real_format) +static A5O_LOCKED_REGION *ogl_lock_region_bb_readonly( + A5O_BITMAP *bitmap, int x, int y, int w, int h, int real_format) { - ALLEGRO_BITMAP_EXTRA_OPENGL * const ogl_bitmap = bitmap->extra; + A5O_BITMAP_EXTRA_OPENGL * const ogl_bitmap = bitmap->extra; const int pixel_size = al_get_pixel_size(real_format); const int pitch = ogl_pitch(w, pixel_size); const int gl_y = bitmap->h - y - h; @@ -137,7 +137,7 @@ static ALLEGRO_LOCKED_REGION *ogl_lock_region_bb_readonly( ogl_bitmap->lock_buffer = al_malloc(pitch * h); if (ogl_bitmap->lock_buffer == NULL) { - ALLEGRO_ERROR("Out of memory\n"); + A5O_ERROR("Out of memory\n"); return false; } @@ -149,21 +149,21 @@ static ALLEGRO_LOCKED_REGION *ogl_lock_region_bb_readonly( ogl_bitmap->lock_buffer); e = glGetError(); if (e) { - ALLEGRO_ERROR("glReadPixels for format %s failed (%s).\n", - _al_pixel_format_name(ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE), _al_gl_error_string(e)); + A5O_ERROR("glReadPixels for format %s failed (%s).\n", + _al_pixel_format_name(A5O_PIXEL_FORMAT_ABGR_8888_LE), _al_gl_error_string(e)); al_free(ogl_bitmap->lock_buffer); ogl_bitmap->lock_buffer = NULL; return false; } - ALLEGRO_DEBUG("Converting from format %d -> %d\n", - ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, real_format); + A5O_DEBUG("Converting from format %d -> %d\n", + A5O_PIXEL_FORMAT_ABGR_8888_LE, real_format); /* That's right, we convert in-place. * (safe as long as dst size <= src size, which it always is) */ _al_convert_bitmap_data(ogl_bitmap->lock_buffer, - ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, + A5O_PIXEL_FORMAT_ABGR_8888_LE, ogl_pitch(w, 4), ogl_bitmap->lock_buffer, real_format, @@ -179,24 +179,24 @@ static ALLEGRO_LOCKED_REGION *ogl_lock_region_bb_readonly( } -static ALLEGRO_LOCKED_REGION *ogl_lock_region_bb_proxy(ALLEGRO_BITMAP *bitmap, +static A5O_LOCKED_REGION *ogl_lock_region_bb_proxy(A5O_BITMAP *bitmap, int x, int y, int w, int h, int real_format, int flags) { - ALLEGRO_BITMAP_EXTRA_OPENGL * const ogl_bitmap = bitmap->extra; - ALLEGRO_BITMAP *proxy; - ALLEGRO_LOCKED_REGION *lr; + A5O_BITMAP_EXTRA_OPENGL * const ogl_bitmap = bitmap->extra; + A5O_BITMAP *proxy; + A5O_LOCKED_REGION *lr; const int pixel_size = al_get_pixel_size(real_format); const int pitch = ogl_pitch(w, pixel_size); - ALLEGRO_DEBUG("Creating backbuffer proxy bitmap\n"); + A5O_DEBUG("Creating backbuffer proxy bitmap\n"); proxy = _al_create_bitmap_params(al_get_current_display(), - w, h, real_format, ALLEGRO_VIDEO_BITMAP|ALLEGRO_NO_PRESERVE_TEXTURE, + w, h, real_format, A5O_VIDEO_BITMAP|A5O_NO_PRESERVE_TEXTURE, 0, 0); if (!proxy) { return NULL; } - ALLEGRO_DEBUG("Locking backbuffer proxy bitmap\n"); + A5O_DEBUG("Locking backbuffer proxy bitmap\n"); proxy->lock_x = 0; proxy->lock_y = 0; proxy->lock_w = w; @@ -208,8 +208,8 @@ static ALLEGRO_LOCKED_REGION *ogl_lock_region_bb_proxy(ALLEGRO_BITMAP *bitmap, return NULL; } - if (!(flags & ALLEGRO_LOCK_WRITEONLY)) { - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_proxy = proxy->extra; + if (!(flags & A5O_LOCK_WRITEONLY)) { + A5O_BITMAP_EXTRA_OPENGL *ogl_proxy = proxy->extra; const int gl_y = bitmap->h - y - h; GLenum e; @@ -221,20 +221,20 @@ static ALLEGRO_LOCKED_REGION *ogl_lock_region_bb_proxy(ALLEGRO_BITMAP *bitmap, ogl_proxy->lock_buffer); e = glGetError(); if (e) { - ALLEGRO_ERROR("glReadPixels for format %s failed (%s).\n", - _al_pixel_format_name(ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE), _al_gl_error_string(e)); + A5O_ERROR("glReadPixels for format %s failed (%s).\n", + _al_pixel_format_name(A5O_PIXEL_FORMAT_ABGR_8888_LE), _al_gl_error_string(e)); al_destroy_bitmap(proxy); return NULL; } - ALLEGRO_DEBUG("Converting from format %d -> %d\n", - ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, real_format); + A5O_DEBUG("Converting from format %d -> %d\n", + A5O_PIXEL_FORMAT_ABGR_8888_LE, real_format); /* That's right, we convert in-place. * (safe as long as dst size <= src size, which it always is) */ _al_convert_bitmap_data(ogl_proxy->lock_buffer, - ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, + A5O_PIXEL_FORMAT_ABGR_8888_LE, ogl_pitch(w, 4), ogl_proxy->lock_buffer, real_format, @@ -250,14 +250,14 @@ static ALLEGRO_LOCKED_REGION *ogl_lock_region_bb_proxy(ALLEGRO_BITMAP *bitmap, } -static ALLEGRO_LOCKED_REGION *ogl_lock_region_nonbb(ALLEGRO_BITMAP *bitmap, +static A5O_LOCKED_REGION *ogl_lock_region_nonbb(A5O_BITMAP *bitmap, int x, int y, int w, int h, int real_format, int flags) { - ALLEGRO_BITMAP_EXTRA_OPENGL * const ogl_bitmap = bitmap->extra; + A5O_BITMAP_EXTRA_OPENGL * const ogl_bitmap = bitmap->extra; const int gl_y = bitmap->h - y - h; - ALLEGRO_DISPLAY *disp; - ALLEGRO_DISPLAY *old_disp = NULL; - ALLEGRO_BITMAP *old_target = al_get_target_bitmap(); + A5O_DISPLAY *disp; + A5O_DISPLAY *old_disp = NULL; + A5O_BITMAP *old_target = al_get_target_bitmap(); bool ok; bool restore_fbo = false; @@ -286,21 +286,21 @@ static ALLEGRO_LOCKED_REGION *ogl_lock_region_nonbb(ALLEGRO_BITMAP *bitmap, glPixelStorei(GL_PACK_ALIGNMENT, pixel_alignment); e = glGetError(); if (e) { - ALLEGRO_ERROR("glPixelStorei(GL_PACK_ALIGNMENT, %d) failed (%s).\n", + A5O_ERROR("glPixelStorei(GL_PACK_ALIGNMENT, %d) failed (%s).\n", pixel_alignment, _al_gl_error_string(e)); ok = false; } } if (ok) { - if (flags & ALLEGRO_LOCK_WRITEONLY) { - ALLEGRO_DEBUG("Locking non-backbuffer WRITEONLY\n"); + if (flags & A5O_LOCK_WRITEONLY) { + A5O_DEBUG("Locking non-backbuffer WRITEONLY\n"); ok = ogl_lock_region_nonbb_writeonly(bitmap, ogl_bitmap, x, gl_y, w, h, real_format); } else { - ALLEGRO_DEBUG("Locking non-backbuffer %s\n", - (flags & ALLEGRO_LOCK_READONLY) ? "READONLY" : "READWRITE"); + A5O_DEBUG("Locking non-backbuffer %s\n", + (flags & A5O_LOCK_READONLY) ? "READONLY" : "READWRITE"); ok = ogl_lock_region_nonbb_readwrite(bitmap, ogl_bitmap, x, gl_y, w, h, real_format, &restore_fbo); } @@ -331,14 +331,14 @@ static ALLEGRO_LOCKED_REGION *ogl_lock_region_nonbb(ALLEGRO_BITMAP *bitmap, return &bitmap->locked_region; } - ALLEGRO_ERROR("Failed to lock region\n"); + A5O_ERROR("Failed to lock region\n"); ASSERT(ogl_bitmap->lock_buffer == NULL); return NULL; } static bool ogl_lock_region_nonbb_writeonly( - ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, + A5O_BITMAP *bitmap, A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int x, int gl_y, int w, int h, int real_format) { const int pixel_size = al_get_pixel_size(real_format); @@ -366,7 +366,7 @@ static bool ogl_lock_region_nonbb_writeonly( static bool ogl_lock_region_nonbb_readwrite( - ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, + A5O_BITMAP *bitmap, A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int x, int gl_y, int w, int h, int real_format, bool* restore_fbo) { bool ok; @@ -385,7 +385,7 @@ static bool ogl_lock_region_nonbb_readwrite( x, gl_y, w, h, real_format); } else { - ALLEGRO_ERROR("no fbo\n"); + A5O_ERROR("no fbo\n"); ok = false; } @@ -394,7 +394,7 @@ static bool ogl_lock_region_nonbb_readwrite( static bool ogl_lock_region_nonbb_readwrite_fbo( - ALLEGRO_BITMAP *bitmap, ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, + A5O_BITMAP *bitmap, A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int x, int gl_y, int w, int h, int real_format) { const int pixel_size = al_get_pixel_size(real_format); @@ -409,7 +409,7 @@ static bool ogl_lock_region_nonbb_readwrite_fbo( old_fbo = _al_ogl_bind_framebuffer(ogl_bitmap->fbo_info->fbo); e = glGetError(); if (e) { - ALLEGRO_ERROR("glBindFramebufferEXT failed (%s).\n", + A5O_ERROR("glBindFramebufferEXT failed (%s).\n", _al_gl_error_string(e)); return false; } @@ -421,7 +421,7 @@ static bool ogl_lock_region_nonbb_readwrite_fbo( * memory is needed to complete the lock. */ if (ok) { - size_t size = _ALLEGRO_MAX(pitch * h, ogl_pitch(w, 4) * h); + size_t size = _A5O_MAX(pitch * h, ogl_pitch(w, 4) * h); ogl_bitmap->lock_buffer = al_malloc(size); if (ogl_bitmap->lock_buffer == NULL) { ok = false; @@ -437,8 +437,8 @@ static bool ogl_lock_region_nonbb_readwrite_fbo( ogl_bitmap->lock_buffer); e = glGetError(); if (e) { - ALLEGRO_ERROR("glReadPixels for format %s failed (%s).\n", - _al_pixel_format_name(ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE), _al_gl_error_string(e)); + A5O_ERROR("glReadPixels for format %s failed (%s).\n", + _al_pixel_format_name(A5O_PIXEL_FORMAT_ABGR_8888_LE), _al_gl_error_string(e)); al_free(ogl_bitmap->lock_buffer); ogl_bitmap->lock_buffer = NULL; ok = false; @@ -446,14 +446,14 @@ static bool ogl_lock_region_nonbb_readwrite_fbo( } if (ok) { - ALLEGRO_DEBUG("Converting from format %d -> %d\n", - ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, real_format); + A5O_DEBUG("Converting from format %d -> %d\n", + A5O_PIXEL_FORMAT_ABGR_8888_LE, real_format); /* That's right, we convert in-place. * (safe as long as dst size <= src size, which it always is) */ _al_convert_bitmap_data(ogl_bitmap->lock_buffer, - ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, + A5O_PIXEL_FORMAT_ABGR_8888_LE, ogl_pitch(w, 4), ogl_bitmap->lock_buffer, real_format, @@ -479,24 +479,24 @@ static bool ogl_lock_region_nonbb_readwrite_fbo( * Unlocking */ -static void ogl_unlock_region_bb_proxy(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap); -static void ogl_unlock_region_nonbb(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap); -static void ogl_unlock_region_nonbb_2(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format); -static void ogl_unlock_region_nonbb_nonfbo_conv(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format); -static void ogl_unlock_region_nonbb_nonfbo_noconv(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format); +static void ogl_unlock_region_bb_proxy(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap); +static void ogl_unlock_region_nonbb(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap); +static void ogl_unlock_region_nonbb_2(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format); +static void ogl_unlock_region_nonbb_nonfbo_conv(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format); +static void ogl_unlock_region_nonbb_nonfbo_noconv(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format); -void _al_ogl_unlock_region_gles(ALLEGRO_BITMAP *bitmap) +void _al_ogl_unlock_region_gles(A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap = bitmap->extra; + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap = bitmap->extra; - if (bitmap->lock_flags & ALLEGRO_LOCK_READONLY) { - ALLEGRO_DEBUG("Unlocking READONLY\n"); + if (bitmap->lock_flags & A5O_LOCK_READONLY) { + A5O_DEBUG("Unlocking READONLY\n"); ASSERT(ogl_bitmap->lock_proxy == NULL); } else if (ogl_bitmap->lock_proxy != NULL) { @@ -511,23 +511,23 @@ void _al_ogl_unlock_region_gles(ALLEGRO_BITMAP *bitmap) } -static void ogl_unlock_region_bb_proxy(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap) +static void ogl_unlock_region_bb_proxy(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap) { - ALLEGRO_BITMAP *proxy = ogl_bitmap->lock_proxy; + A5O_BITMAP *proxy = ogl_bitmap->lock_proxy; ASSERT(proxy); ASSERT(ogl_bitmap->lock_buffer == NULL); - ALLEGRO_DEBUG("Unlocking backbuffer proxy bitmap\n"); + A5O_DEBUG("Unlocking backbuffer proxy bitmap\n"); _al_ogl_unlock_region_gles(proxy); proxy->locked = false; - ALLEGRO_DEBUG("Drawing proxy to backbuffer\n"); + A5O_DEBUG("Drawing proxy to backbuffer\n"); { - ALLEGRO_DISPLAY *disp; - ALLEGRO_STATE state0; - ALLEGRO_TRANSFORM t; + A5O_DISPLAY *disp; + A5O_STATE state0; + A5O_TRANSFORM t; bool held; disp = al_get_current_display(); @@ -535,34 +535,34 @@ static void ogl_unlock_region_bb_proxy(ALLEGRO_BITMAP *bitmap, if (held) { al_hold_bitmap_drawing(false); } - al_store_state(&state0, ALLEGRO_STATE_TARGET_BITMAP | - ALLEGRO_STATE_TRANSFORM | ALLEGRO_STATE_BLENDER | - ALLEGRO_STATE_PROJECTION_TRANSFORM); + al_store_state(&state0, A5O_STATE_TARGET_BITMAP | + A5O_STATE_TRANSFORM | A5O_STATE_BLENDER | + A5O_STATE_PROJECTION_TRANSFORM); { al_set_target_bitmap(bitmap); al_identity_transform(&t); al_use_transform(&t); al_orthographic_transform(&t, 0, 0, -1, disp->w, disp->h, 1); al_use_projection_transform(&t); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_draw_bitmap(proxy, bitmap->lock_x, bitmap->lock_y, 0); } al_restore_state(&state0); al_hold_bitmap_drawing(held); } - ALLEGRO_DEBUG("Destroying backbuffer proxy bitmap\n"); + A5O_DEBUG("Destroying backbuffer proxy bitmap\n"); al_destroy_bitmap(proxy); ogl_bitmap->lock_proxy = NULL; } -static void ogl_unlock_region_nonbb(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap) +static void ogl_unlock_region_nonbb(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap) { const int gl_y = bitmap->h - bitmap->lock_y - bitmap->lock_h; - ALLEGRO_DISPLAY *old_disp = NULL; - ALLEGRO_DISPLAY *disp; + A5O_DISPLAY *old_disp = NULL; + A5O_DISPLAY *disp; int orig_format; GLenum e; @@ -584,14 +584,14 @@ static void ogl_unlock_region_nonbb(ALLEGRO_BITMAP *bitmap, /* If using FBOs, we need to regenerate mipmaps explicitly now. */ /* XXX why don't we check ogl_bitmap->fbo_info? */ - if ((al_get_bitmap_flags(bitmap) & ALLEGRO_MIPMAP) && - (al_get_opengl_extension_list()->ALLEGRO_GL_OES_framebuffer_object || + if ((al_get_bitmap_flags(bitmap) & A5O_MIPMAP) && + (al_get_opengl_extension_list()->A5O_GL_OES_framebuffer_object || IS_OPENGLES) /* FIXME */) { glGenerateMipmapEXT(GL_TEXTURE_2D); e = glGetError(); if (e) { - ALLEGRO_ERROR("glGenerateMipmapEXT for texture %d failed (%s).\n", + A5O_ERROR("glGenerateMipmapEXT for texture %d failed (%s).\n", ogl_bitmap->texture, _al_gl_error_string(e)); } } @@ -602,52 +602,52 @@ static void ogl_unlock_region_nonbb(ALLEGRO_BITMAP *bitmap, } -static void ogl_unlock_region_nonbb_2(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format) +static void ogl_unlock_region_nonbb_2(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format) { GLint fbo; GLenum e; -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID fbo = _al_android_get_curr_fbo(); #else glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &fbo); #endif glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID _al_android_set_curr_fbo(0); #endif glBindTexture(GL_TEXTURE_2D, ogl_bitmap->texture); e = glGetError(); if (e) { - ALLEGRO_ERROR("glBindTexture failed (%s).\n", _al_gl_error_string(e)); + A5O_ERROR("glBindTexture failed (%s).\n", _al_gl_error_string(e)); } /* Differs from desktop code. */ - ALLEGRO_DEBUG("Unlocking non-backbuffer (non-FBO)\n"); + A5O_DEBUG("Unlocking non-backbuffer (non-FBO)\n"); if (bitmap->locked_region.format != orig_format) { - ALLEGRO_DEBUG( + A5O_DEBUG( "Unlocking non-backbuffer non-FBO with conversion (%d -> %d)\n", bitmap->locked_region.format, orig_format); ogl_unlock_region_nonbb_nonfbo_conv(bitmap, ogl_bitmap, gl_y, orig_format); } else { - ALLEGRO_DEBUG("Unlocking non-backbuffer non-FBO without conversion\n"); + A5O_DEBUG("Unlocking non-backbuffer non-FBO without conversion\n"); ogl_unlock_region_nonbb_nonfbo_noconv(bitmap, ogl_bitmap, gl_y, orig_format); } glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo); -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID _al_android_set_curr_fbo(fbo); #endif } -static void ogl_unlock_region_nonbb_nonfbo_conv(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format) +static void ogl_unlock_region_nonbb_nonfbo_conv(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format) { const int lock_format = bitmap->locked_region.format; const int orig_pixel_size = al_get_pixel_size(orig_format); @@ -675,7 +675,7 @@ static void ogl_unlock_region_nonbb_nonfbo_conv(ALLEGRO_BITMAP *bitmap, tmpbuf); e = glGetError(); if (e) { - ALLEGRO_ERROR("glTexSubImage2D for format %d failed (%s).\n", + A5O_ERROR("glTexSubImage2D for format %d failed (%s).\n", lock_format, _al_gl_error_string(e)); } @@ -683,8 +683,8 @@ static void ogl_unlock_region_nonbb_nonfbo_conv(ALLEGRO_BITMAP *bitmap, } -static void ogl_unlock_region_nonbb_nonfbo_noconv(ALLEGRO_BITMAP *bitmap, - ALLEGRO_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format) +static void ogl_unlock_region_nonbb_nonfbo_noconv(A5O_BITMAP *bitmap, + A5O_BITMAP_EXTRA_OPENGL *ogl_bitmap, int gl_y, int orig_format) { const int lock_format = bitmap->locked_region.format; const int orig_pixel_size = al_get_pixel_size(orig_format); @@ -693,7 +693,7 @@ static void ogl_unlock_region_nonbb_nonfbo_noconv(ALLEGRO_BITMAP *bitmap, glPixelStorei(GL_UNPACK_ALIGNMENT, ogl_pixel_alignment(orig_pixel_size)); e = glGetError(); if (e) { - ALLEGRO_ERROR("glPixelStorei for format %s failed (%s).\n", + A5O_ERROR("glPixelStorei for format %s failed (%s).\n", _al_pixel_format_name(lock_format), _al_gl_error_string(e)); } @@ -705,7 +705,7 @@ static void ogl_unlock_region_nonbb_nonfbo_noconv(ALLEGRO_BITMAP *bitmap, ogl_bitmap->lock_buffer); e = glGetError(); if (e) { - ALLEGRO_ERROR("glTexSubImage2D for format %s failed (%s).\n", + A5O_ERROR("glTexSubImage2D for format %s failed (%s).\n", _al_pixel_format_name(lock_format), _al_gl_error_string(e)); } } diff --git a/src/opengl/ogl_render_state.c b/src/opengl/ogl_render_state.c index 574e3db2ce..17463a0f18 100644 --- a/src/opengl/ogl_render_state.c +++ b/src/opengl/ogl_render_state.c @@ -3,9 +3,9 @@ #include "allegro5/internal/aintern_display.h" #include "allegro5/internal/aintern_opengl.h" -ALLEGRO_DEBUG_CHANNEL("opengl") +A5O_DEBUG_CHANNEL("opengl") -/* Note: synched to ALLEGRO_RENDER_FUNCTION values as array indices */ +/* Note: synched to A5O_RENDER_FUNCTION values as array indices */ static int _gl_funcs[] = { GL_NEVER, GL_ALWAYS, @@ -17,16 +17,16 @@ static int _gl_funcs[] = { GL_GEQUAL }; -void _al_ogl_update_render_state(ALLEGRO_DISPLAY *display) +void _al_ogl_update_render_state(A5O_DISPLAY *display) { - _ALLEGRO_RENDER_STATE *r = &display->render_state; + _A5O_RENDER_STATE *r = &display->render_state; /* TODO: We could store the previous state and/or mark updated states to * avoid so many redundant OpenGL calls. */ - if (display->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { -#ifdef ALLEGRO_CFG_SHADER_GLSL + if (display->flags & A5O_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_SHADER_GLSL GLint atloc = display->ogl_extras->varlocs.alpha_test_loc; GLint floc = display->ogl_extras->varlocs.alpha_func_loc; GLint tvloc = display->ogl_extras->varlocs.alpha_test_val_loc; @@ -39,7 +39,7 @@ void _al_ogl_update_render_state(ALLEGRO_DISPLAY *display) #endif } else { -#ifdef ALLEGRO_CFG_OPENGL_FIXED_FUNCTION +#ifdef A5O_CFG_OPENGL_FIXED_FUNCTION if (r->alpha_test == 0) glDisable(GL_ALPHA_TEST); else @@ -54,10 +54,10 @@ void _al_ogl_update_render_state(ALLEGRO_DISPLAY *display) glEnable(GL_DEPTH_TEST); glDepthFunc(_gl_funcs[r->depth_function]); - glDepthMask((r->write_mask & ALLEGRO_MASK_DEPTH) ? GL_TRUE : GL_FALSE); + glDepthMask((r->write_mask & A5O_MASK_DEPTH) ? GL_TRUE : GL_FALSE); glColorMask( - (r->write_mask & ALLEGRO_MASK_RED) ? GL_TRUE : GL_FALSE, - (r->write_mask & ALLEGRO_MASK_GREEN) ? GL_TRUE : GL_FALSE, - (r->write_mask & ALLEGRO_MASK_BLUE) ? GL_TRUE : GL_FALSE, - (r->write_mask & ALLEGRO_MASK_ALPHA) ? GL_TRUE : GL_FALSE); + (r->write_mask & A5O_MASK_RED) ? GL_TRUE : GL_FALSE, + (r->write_mask & A5O_MASK_GREEN) ? GL_TRUE : GL_FALSE, + (r->write_mask & A5O_MASK_BLUE) ? GL_TRUE : GL_FALSE, + (r->write_mask & A5O_MASK_ALPHA) ? GL_TRUE : GL_FALSE); } diff --git a/src/opengl/ogl_shader.c b/src/opengl/ogl_shader.c index 21762c2ae7..b668da898d 100644 --- a/src/opengl/ogl_shader.c +++ b/src/opengl/ogl_shader.c @@ -22,78 +22,78 @@ #include "allegro5/internal/aintern_opengl.h" #include "allegro5/internal/aintern_shader.h" -#ifdef ALLEGRO_MSVC +#ifdef A5O_MSVC #define snprintf _snprintf #endif -#ifdef ALLEGRO_CFG_SHADER_GLSL +#ifdef A5O_CFG_SHADER_GLSL -ALLEGRO_DEBUG_CHANNEL("shader") +A5O_DEBUG_CHANNEL("shader") static _AL_VECTOR shaders; -static ALLEGRO_MUTEX *shaders_mutex; +static A5O_MUTEX *shaders_mutex; -typedef struct ALLEGRO_SHADER_GLSL_S ALLEGRO_SHADER_GLSL_S; +typedef struct A5O_SHADER_GLSL_S A5O_SHADER_GLSL_S; -struct ALLEGRO_SHADER_GLSL_S +struct A5O_SHADER_GLSL_S { - ALLEGRO_SHADER shader; + A5O_SHADER shader; GLuint vertex_shader; GLuint pixel_shader; GLuint program_object; - ALLEGRO_OGL_VARLOCS varlocs; + A5O_OGL_VARLOCS varlocs; }; /* forward declarations */ -static struct ALLEGRO_SHADER_INTERFACE shader_glsl_vt; -static void lookup_varlocs(ALLEGRO_OGL_VARLOCS *varlocs, GLuint program); +static struct A5O_SHADER_INTERFACE shader_glsl_vt; +static void lookup_varlocs(A5O_OGL_VARLOCS *varlocs, GLuint program); static bool check_gl_error(const char* name) { GLenum err = glGetError(); if (err != 0) { - ALLEGRO_WARN("%s (%s)\n", name, _al_gl_error_string(err)); + A5O_WARN("%s (%s)\n", name, _al_gl_error_string(err)); return false; } return true; } -ALLEGRO_SHADER *_al_create_shader_glsl(ALLEGRO_SHADER_PLATFORM platform) +A5O_SHADER *_al_create_shader_glsl(A5O_SHADER_PLATFORM platform) { - ALLEGRO_SHADER_GLSL_S *shader = al_calloc(1, sizeof(ALLEGRO_SHADER_GLSL_S)); + A5O_SHADER_GLSL_S *shader = al_calloc(1, sizeof(A5O_SHADER_GLSL_S)); if (!shader) return NULL; shader->shader.platform = platform; shader->shader.vt = &shader_glsl_vt; - _al_vector_init(&shader->shader.bitmaps, sizeof(ALLEGRO_BITMAP *)); + _al_vector_init(&shader->shader.bitmaps, sizeof(A5O_BITMAP *)); al_lock_mutex(shaders_mutex); { - ALLEGRO_SHADER **back = (ALLEGRO_SHADER **)_al_vector_alloc_back(&shaders); - *back = (ALLEGRO_SHADER *)shader; + A5O_SHADER **back = (A5O_SHADER **)_al_vector_alloc_back(&shaders); + *back = (A5O_SHADER *)shader; } al_unlock_mutex(shaders_mutex); - return (ALLEGRO_SHADER *)shader; + return (A5O_SHADER *)shader; } -static bool glsl_attach_shader_source(ALLEGRO_SHADER *shader, - ALLEGRO_SHADER_TYPE type, const char *source) +static bool glsl_attach_shader_source(A5O_SHADER *shader, + A5O_SHADER_TYPE type, const char *source) { GLint status; GLchar error_buf[4096]; - ALLEGRO_SHADER_GLSL_S *gl_shader = (ALLEGRO_SHADER_GLSL_S *)shader; - ALLEGRO_DISPLAY *display = al_get_current_display(); + A5O_SHADER_GLSL_S *gl_shader = (A5O_SHADER_GLSL_S *)shader; + A5O_DISPLAY *display = al_get_current_display(); ASSERT(display); - ASSERT(display->flags & ALLEGRO_OPENGL); + ASSERT(display->flags & A5O_OPENGL); if (source == NULL) { - if (type == ALLEGRO_VERTEX_SHADER) { + if (type == A5O_VERTEX_SHADER) { if (gl_shader->vertex_shader) { glDetachShader(gl_shader->program_object, gl_shader->vertex_shader); glDeleteShader(gl_shader->vertex_shader); @@ -112,7 +112,7 @@ static bool glsl_attach_shader_source(ALLEGRO_SHADER *shader, else { GLuint *handle; GLenum gl_type; - if (type == ALLEGRO_VERTEX_SHADER) { + if (type == A5O_VERTEX_SHADER) { handle = &(gl_shader->vertex_shader); gl_type = GL_VERTEX_SHADER; } @@ -136,7 +136,7 @@ static bool glsl_attach_shader_source(ALLEGRO_SHADER *shader, else { shader->log = al_ustr_new(error_buf); } - ALLEGRO_ERROR("Compile error: %s\n", error_buf); + A5O_ERROR("Compile error: %s\n", error_buf); glDeleteShader(*handle); return false; } @@ -145,10 +145,10 @@ static bool glsl_attach_shader_source(ALLEGRO_SHADER *shader, return true; } -static bool glsl_build_shader(ALLEGRO_SHADER *shader) +static bool glsl_build_shader(A5O_SHADER *shader) { GLint status; - ALLEGRO_SHADER_GLSL_S *gl_shader = (ALLEGRO_SHADER_GLSL_S *)shader; + A5O_SHADER_GLSL_S *gl_shader = (A5O_SHADER_GLSL_S *)shader; GLchar error_buf[4096]; if (gl_shader->vertex_shader == 0 && gl_shader->pixel_shader == 0) @@ -181,7 +181,7 @@ static bool glsl_build_shader(ALLEGRO_SHADER *shader) else { shader->log = al_ustr_new(error_buf); } - ALLEGRO_ERROR("Link error: %s\n", error_buf); + A5O_ERROR("Link error: %s\n", error_buf); glDeleteProgram(gl_shader->program_object); return false; } @@ -192,25 +192,25 @@ static bool glsl_build_shader(ALLEGRO_SHADER *shader) return true; } -static bool glsl_use_shader(ALLEGRO_SHADER *shader, ALLEGRO_DISPLAY *display, +static bool glsl_use_shader(A5O_SHADER *shader, A5O_DISPLAY *display, bool set_projview_matrix_from_display) { - ALLEGRO_SHADER_GLSL_S *gl_shader; + A5O_SHADER_GLSL_S *gl_shader; GLuint program_object; GLenum err; - if (!(display->flags & ALLEGRO_OPENGL)) { + if (!(display->flags & A5O_OPENGL)) { return false; } - gl_shader = (ALLEGRO_SHADER_GLSL_S *)shader; + gl_shader = (A5O_SHADER_GLSL_S *)shader; program_object = gl_shader->program_object; glGetError(); /* clear error */ glUseProgram(program_object); err = glGetError(); if (err != GL_NO_ERROR) { - ALLEGRO_WARN("glUseProgram(%u) failed: %s\n", program_object, + A5O_WARN("glUseProgram(%u) failed: %s\n", program_object, _al_gl_error_string(err)); display->ogl_extras->program_object = 0; return false; @@ -238,16 +238,16 @@ static bool glsl_use_shader(ALLEGRO_SHADER *shader, ALLEGRO_DISPLAY *display, return true; } -static void glsl_unuse_shader(ALLEGRO_SHADER *shader, ALLEGRO_DISPLAY *display) +static void glsl_unuse_shader(A5O_SHADER *shader, A5O_DISPLAY *display) { (void)shader; (void)display; glUseProgram(0); } -static void glsl_destroy_shader(ALLEGRO_SHADER *shader) +static void glsl_destroy_shader(A5O_SHADER *shader) { - ALLEGRO_SHADER_GLSL_S *gl_shader = (ALLEGRO_SHADER_GLSL_S *)shader; + A5O_SHADER_GLSL_S *gl_shader = (A5O_SHADER_GLSL_S *)shader; al_lock_mutex(shaders_mutex); _al_vector_find_and_delete(&shaders, &shader); @@ -259,22 +259,22 @@ static void glsl_destroy_shader(ALLEGRO_SHADER *shader) al_free(shader); } -static bool glsl_set_shader_sampler(ALLEGRO_SHADER *shader, - const char *name, ALLEGRO_BITMAP *bitmap, int unit) +static bool glsl_set_shader_sampler(A5O_SHADER *shader, + const char *name, A5O_BITMAP *bitmap, int unit) { - ALLEGRO_SHADER_GLSL_S *gl_shader = (ALLEGRO_SHADER_GLSL_S *)shader; + A5O_SHADER_GLSL_S *gl_shader = (A5O_SHADER_GLSL_S *)shader; GLint handle; GLuint texture; - if (bitmap && al_get_bitmap_flags(bitmap) & ALLEGRO_MEMORY_BITMAP) { - ALLEGRO_WARN("Cannot use memory bitmap for sampler\n"); + if (bitmap && al_get_bitmap_flags(bitmap) & A5O_MEMORY_BITMAP) { + A5O_WARN("Cannot use memory bitmap for sampler\n"); return false; } handle = glGetUniformLocation(gl_shader->program_object, name); if (handle < 0) { - ALLEGRO_WARN("No uniform variable '%s' in shader program\n", name); + A5O_WARN("No uniform variable '%s' in shader program\n", name); return false; } @@ -288,16 +288,16 @@ static bool glsl_set_shader_sampler(ALLEGRO_SHADER *shader, return check_gl_error(name); } -static bool glsl_set_shader_matrix(ALLEGRO_SHADER *shader, - const char *name, const ALLEGRO_TRANSFORM *matrix) +static bool glsl_set_shader_matrix(A5O_SHADER *shader, + const char *name, const A5O_TRANSFORM *matrix) { - ALLEGRO_SHADER_GLSL_S *gl_shader = (ALLEGRO_SHADER_GLSL_S *)shader; + A5O_SHADER_GLSL_S *gl_shader = (A5O_SHADER_GLSL_S *)shader; GLint handle; handle = glGetUniformLocation(gl_shader->program_object, name); if (handle < 0) { - ALLEGRO_WARN("No uniform variable '%s' in shader program\n", name); + A5O_WARN("No uniform variable '%s' in shader program\n", name); return false; } @@ -306,16 +306,16 @@ static bool glsl_set_shader_matrix(ALLEGRO_SHADER *shader, return check_gl_error(name); } -static bool glsl_set_shader_int(ALLEGRO_SHADER *shader, +static bool glsl_set_shader_int(A5O_SHADER *shader, const char *name, int i) { - ALLEGRO_SHADER_GLSL_S *gl_shader = (ALLEGRO_SHADER_GLSL_S *)shader; + A5O_SHADER_GLSL_S *gl_shader = (A5O_SHADER_GLSL_S *)shader; GLint handle; handle = glGetUniformLocation(gl_shader->program_object, name); if (handle < 0) { - ALLEGRO_WARN("No uniform variable '%s' in shader program\n", name); + A5O_WARN("No uniform variable '%s' in shader program\n", name); return false; } @@ -324,16 +324,16 @@ static bool glsl_set_shader_int(ALLEGRO_SHADER *shader, return check_gl_error(name); } -static bool glsl_set_shader_float(ALLEGRO_SHADER *shader, +static bool glsl_set_shader_float(A5O_SHADER *shader, const char *name, float f) { - ALLEGRO_SHADER_GLSL_S *gl_shader = (ALLEGRO_SHADER_GLSL_S *)shader; + A5O_SHADER_GLSL_S *gl_shader = (A5O_SHADER_GLSL_S *)shader; GLint handle; handle = glGetUniformLocation(gl_shader->program_object, name); if (handle < 0) { - ALLEGRO_WARN("No uniform variable '%s' in shader program\n", name); + A5O_WARN("No uniform variable '%s' in shader program\n", name); return false; } @@ -342,16 +342,16 @@ static bool glsl_set_shader_float(ALLEGRO_SHADER *shader, return check_gl_error(name); } -static bool glsl_set_shader_int_vector(ALLEGRO_SHADER *shader, +static bool glsl_set_shader_int_vector(A5O_SHADER *shader, const char *name, int num_components, const int *i, int num_elems) { - ALLEGRO_SHADER_GLSL_S *gl_shader = (ALLEGRO_SHADER_GLSL_S *)shader; + A5O_SHADER_GLSL_S *gl_shader = (A5O_SHADER_GLSL_S *)shader; GLint handle; handle = glGetUniformLocation(gl_shader->program_object, name); if (handle < 0) { - ALLEGRO_WARN("No uniform variable '%s' in shader program\n", name); + A5O_WARN("No uniform variable '%s' in shader program\n", name); return false; } @@ -376,16 +376,16 @@ static bool glsl_set_shader_int_vector(ALLEGRO_SHADER *shader, return check_gl_error(name); } -static bool glsl_set_shader_float_vector(ALLEGRO_SHADER *shader, +static bool glsl_set_shader_float_vector(A5O_SHADER *shader, const char *name, int num_components, const float *f, int num_elems) { - ALLEGRO_SHADER_GLSL_S *gl_shader = (ALLEGRO_SHADER_GLSL_S *)shader; + A5O_SHADER_GLSL_S *gl_shader = (A5O_SHADER_GLSL_S *)shader; GLint handle; handle = glGetUniformLocation(gl_shader->program_object, name); if (handle < 0) { - ALLEGRO_WARN("No uniform variable '%s' in shader program\n", name); + A5O_WARN("No uniform variable '%s' in shader program\n", name); return false; } @@ -410,13 +410,13 @@ static bool glsl_set_shader_float_vector(ALLEGRO_SHADER *shader, return check_gl_error(name); } -static bool glsl_set_shader_bool(ALLEGRO_SHADER *shader, +static bool glsl_set_shader_bool(A5O_SHADER *shader, const char *name, bool b) { return glsl_set_shader_int(shader, name, b); } -static struct ALLEGRO_SHADER_INTERFACE shader_glsl_vt = +static struct A5O_SHADER_INTERFACE shader_glsl_vt = { glsl_attach_shader_source, glsl_build_shader, @@ -434,27 +434,27 @@ static struct ALLEGRO_SHADER_INTERFACE shader_glsl_vt = glsl_set_shader_bool }; -static void lookup_varlocs(ALLEGRO_OGL_VARLOCS *varlocs, GLuint program) +static void lookup_varlocs(A5O_OGL_VARLOCS *varlocs, GLuint program) { unsigned i; - varlocs->pos_loc = glGetAttribLocation(program, ALLEGRO_SHADER_VAR_POS); - varlocs->color_loc = glGetAttribLocation(program, ALLEGRO_SHADER_VAR_COLOR); - varlocs->projview_matrix_loc = glGetUniformLocation(program, ALLEGRO_SHADER_VAR_PROJVIEW_MATRIX); - varlocs->texcoord_loc = glGetAttribLocation(program, ALLEGRO_SHADER_VAR_TEXCOORD); - varlocs->use_tex_loc = glGetUniformLocation(program, ALLEGRO_SHADER_VAR_USE_TEX); - varlocs->tex_loc = glGetUniformLocation(program, ALLEGRO_SHADER_VAR_TEX); - varlocs->use_tex_matrix_loc = glGetUniformLocation(program, ALLEGRO_SHADER_VAR_USE_TEX_MATRIX); - varlocs->tex_matrix_loc = glGetUniformLocation(program, ALLEGRO_SHADER_VAR_TEX_MATRIX); - varlocs->alpha_test_loc = glGetUniformLocation(program, ALLEGRO_SHADER_VAR_ALPHA_TEST); - varlocs->alpha_func_loc = glGetUniformLocation(program, ALLEGRO_SHADER_VAR_ALPHA_FUNCTION); - varlocs->alpha_test_val_loc = glGetUniformLocation(program, ALLEGRO_SHADER_VAR_ALPHA_TEST_VALUE); - - for (i = 0; i < _ALLEGRO_PRIM_MAX_USER_ATTR; i++) { + varlocs->pos_loc = glGetAttribLocation(program, A5O_SHADER_VAR_POS); + varlocs->color_loc = glGetAttribLocation(program, A5O_SHADER_VAR_COLOR); + varlocs->projview_matrix_loc = glGetUniformLocation(program, A5O_SHADER_VAR_PROJVIEW_MATRIX); + varlocs->texcoord_loc = glGetAttribLocation(program, A5O_SHADER_VAR_TEXCOORD); + varlocs->use_tex_loc = glGetUniformLocation(program, A5O_SHADER_VAR_USE_TEX); + varlocs->tex_loc = glGetUniformLocation(program, A5O_SHADER_VAR_TEX); + varlocs->use_tex_matrix_loc = glGetUniformLocation(program, A5O_SHADER_VAR_USE_TEX_MATRIX); + varlocs->tex_matrix_loc = glGetUniformLocation(program, A5O_SHADER_VAR_TEX_MATRIX); + varlocs->alpha_test_loc = glGetUniformLocation(program, A5O_SHADER_VAR_ALPHA_TEST); + varlocs->alpha_func_loc = glGetUniformLocation(program, A5O_SHADER_VAR_ALPHA_FUNCTION); + varlocs->alpha_test_val_loc = glGetUniformLocation(program, A5O_SHADER_VAR_ALPHA_TEST_VALUE); + + for (i = 0; i < _A5O_PRIM_MAX_USER_ATTR; i++) { /* al_user_attr_##0 */ - char user_attr_name[sizeof(ALLEGRO_SHADER_VAR_USER_ATTR "999")]; + char user_attr_name[sizeof(A5O_SHADER_VAR_USER_ATTR "999")]; - snprintf(user_attr_name, sizeof(user_attr_name), ALLEGRO_SHADER_VAR_USER_ATTR "%d", i); + snprintf(user_attr_name, sizeof(user_attr_name), A5O_SHADER_VAR_USER_ATTR "%d", i); varlocs->user_attr_loc[i] = glGetAttribLocation(program, user_attr_name); } @@ -462,7 +462,7 @@ static void lookup_varlocs(ALLEGRO_OGL_VARLOCS *varlocs, GLuint program) } bool _al_glsl_set_projview_matrix(GLint projview_matrix_loc, - const ALLEGRO_TRANSFORM *t) + const A5O_TRANSFORM *t) { if (projview_matrix_loc >= 0) { glUniformMatrix4fv(projview_matrix_loc, 1, false, (float *)t->m); @@ -474,7 +474,7 @@ bool _al_glsl_set_projview_matrix(GLint projview_matrix_loc, void _al_glsl_init_shaders(void) { - _al_vector_init(&shaders, sizeof(ALLEGRO_SHADER *)); + _al_vector_init(&shaders, sizeof(A5O_SHADER *)); shaders_mutex = al_create_mutex(); } @@ -493,11 +493,11 @@ void _al_glsl_unuse_shaders(void) al_lock_mutex(shaders_mutex); for (i = 0; i < _al_vector_size(&shaders); i++) { unsigned j; - ALLEGRO_SHADER *shader = *((ALLEGRO_SHADER **)_al_vector_ref(&shaders, i)); + A5O_SHADER *shader = *((A5O_SHADER **)_al_vector_ref(&shaders, i)); for (j = 0; j < _al_vector_size(&shader->bitmaps); j++) { - ALLEGRO_BITMAP *bitmap = - *((ALLEGRO_BITMAP **)_al_vector_ref(&shader->bitmaps, j)); + A5O_BITMAP *bitmap = + *((A5O_BITMAP **)_al_vector_ref(&shader->bitmaps, j)); _al_set_bitmap_shader_field(bitmap, NULL); } } @@ -508,14 +508,14 @@ void _al_glsl_unuse_shaders(void) /* Function: al_get_opengl_program_object */ -GLuint al_get_opengl_program_object(ALLEGRO_SHADER *shader) +GLuint al_get_opengl_program_object(A5O_SHADER *shader) { ASSERT(shader); -#ifdef ALLEGRO_CFG_SHADER_GLSL - if (shader->platform != ALLEGRO_SHADER_GLSL) +#ifdef A5O_CFG_SHADER_GLSL + if (shader->platform != A5O_SHADER_GLSL) return 0; - return ((ALLEGRO_SHADER_GLSL_S *)shader)->program_object; + return ((A5O_SHADER_GLSL_S *)shader)->program_object; #else return 0; #endif diff --git a/src/path.c b/src/path.c index ef957db33f..58bfe9a9fd 100644 --- a/src/path.c +++ b/src/path.c @@ -28,9 +28,9 @@ /* get_segment: * Return the i'th directory component of a path. */ -static ALLEGRO_USTR *get_segment(const ALLEGRO_PATH *path, unsigned i) +static A5O_USTR *get_segment(const A5O_PATH *path, unsigned i) { - ALLEGRO_USTR **seg = _al_vector_ref(&path->segments, i); + A5O_USTR **seg = _al_vector_ref(&path->segments, i); return *seg; } @@ -38,7 +38,7 @@ static ALLEGRO_USTR *get_segment(const ALLEGRO_PATH *path, unsigned i) /* get_segment_cstr: * Return the i'th directory component of a path as a C string. */ -static const char *get_segment_cstr(const ALLEGRO_PATH *path, unsigned i) +static const char *get_segment_cstr(const A5O_PATH *path, unsigned i) { return al_cstr(get_segment(path, i)); } @@ -47,7 +47,7 @@ static const char *get_segment_cstr(const ALLEGRO_PATH *path, unsigned i) /* replace_backslashes: * Replace backslashes by slashes. */ -static void replace_backslashes(ALLEGRO_USTR *path) +static void replace_backslashes(A5O_USTR *path) { al_ustr_find_replace_cstr(path, 0, "\\", "/"); } @@ -76,21 +76,21 @@ static void replace_backslashes(ALLEGRO_USTR *path) * * c ::= any character but '/' */ -static bool parse_path_string(const ALLEGRO_USTR *str, ALLEGRO_PATH *path) +static bool parse_path_string(const A5O_USTR *str, A5O_PATH *path) { - ALLEGRO_USTR_INFO dot_info; - ALLEGRO_USTR_INFO dotdot_info; - const ALLEGRO_USTR * dot = al_ref_cstr(&dot_info, "."); - const ALLEGRO_USTR * dotdot = al_ref_cstr(&dotdot_info, ".."); + A5O_USTR_INFO dot_info; + A5O_USTR_INFO dotdot_info; + const A5O_USTR * dot = al_ref_cstr(&dot_info, "."); + const A5O_USTR * dotdot = al_ref_cstr(&dotdot_info, ".."); - ALLEGRO_USTR *piece = al_ustr_new(""); + A5O_USTR *piece = al_ustr_new(""); int pos = 0; bool on_windows; /* We compile the drive handling code on non-Windows platforms to prevent * it becoming broken. */ -#ifdef ALLEGRO_WINDOWS +#ifdef A5O_WINDOWS on_windows = true; #else on_windows = false; @@ -153,22 +153,22 @@ static bool parse_path_string(const ALLEGRO_USTR *str, ALLEGRO_PATH *path) /* Function: al_create_path */ -ALLEGRO_PATH *al_create_path(const char *str) +A5O_PATH *al_create_path(const char *str) { - ALLEGRO_PATH *path; + A5O_PATH *path; - path = al_malloc(sizeof(ALLEGRO_PATH)); + path = al_malloc(sizeof(A5O_PATH)); if (!path) return NULL; path->drive = al_ustr_new(""); path->filename = al_ustr_new(""); - _al_vector_init(&path->segments, sizeof(ALLEGRO_USTR *)); + _al_vector_init(&path->segments, sizeof(A5O_USTR *)); path->basename = al_ustr_new(""); path->full_string = al_ustr_new(""); if (str != NULL) { - ALLEGRO_USTR *copy = al_ustr_new(str); + A5O_USTR *copy = al_ustr_new(str); replace_backslashes(copy); if (!parse_path_string(copy, path)) { @@ -185,11 +185,11 @@ ALLEGRO_PATH *al_create_path(const char *str) /* Function: al_create_path_for_directory */ -ALLEGRO_PATH *al_create_path_for_directory(const char *str) +A5O_PATH *al_create_path_for_directory(const char *str) { - ALLEGRO_PATH *path = al_create_path(str); + A5O_PATH *path = al_create_path(str); if (al_ustr_length(path->filename)) { - ALLEGRO_USTR *last = path->filename; + A5O_USTR *last = path->filename; path->filename = al_ustr_new(""); al_append_path_component(path, al_cstr(last)); al_ustr_free(last); @@ -200,9 +200,9 @@ ALLEGRO_PATH *al_create_path_for_directory(const char *str) /* Function: al_clone_path */ -ALLEGRO_PATH *al_clone_path(const ALLEGRO_PATH *path) +A5O_PATH *al_clone_path(const A5O_PATH *path) { - ALLEGRO_PATH *clone; + A5O_PATH *clone; unsigned int i; ASSERT(path); @@ -216,7 +216,7 @@ ALLEGRO_PATH *al_clone_path(const ALLEGRO_PATH *path) al_ustr_assign(clone->filename, path->filename); for (i = 0; i < _al_vector_size(&path->segments); i++) { - ALLEGRO_USTR **slot = _al_vector_alloc_back(&clone->segments); + A5O_USTR **slot = _al_vector_alloc_back(&clone->segments); (*slot) = al_ustr_dup(get_segment(path, i)); } @@ -226,7 +226,7 @@ ALLEGRO_PATH *al_clone_path(const ALLEGRO_PATH *path) /* Function: al_get_path_num_components */ -int al_get_path_num_components(const ALLEGRO_PATH *path) +int al_get_path_num_components(const A5O_PATH *path) { ASSERT(path); @@ -236,7 +236,7 @@ int al_get_path_num_components(const ALLEGRO_PATH *path) /* Function: al_get_path_component */ -const char *al_get_path_component(const ALLEGRO_PATH *path, int i) +const char *al_get_path_component(const A5O_PATH *path, int i) { ASSERT(path); ASSERT(i < (int)_al_vector_size(&path->segments)); @@ -252,7 +252,7 @@ const char *al_get_path_component(const ALLEGRO_PATH *path, int i) /* Function: al_replace_path_component */ -void al_replace_path_component(ALLEGRO_PATH *path, int i, const char *s) +void al_replace_path_component(A5O_PATH *path, int i, const char *s) { ASSERT(path); ASSERT(s); @@ -269,7 +269,7 @@ void al_replace_path_component(ALLEGRO_PATH *path, int i, const char *s) /* Function: al_remove_path_component */ -void al_remove_path_component(ALLEGRO_PATH *path, int i) +void al_remove_path_component(A5O_PATH *path, int i) { ASSERT(path); ASSERT(i < (int)_al_vector_size(&path->segments)); @@ -286,9 +286,9 @@ void al_remove_path_component(ALLEGRO_PATH *path, int i) /* Function: al_insert_path_component */ -void al_insert_path_component(ALLEGRO_PATH *path, int i, const char *s) +void al_insert_path_component(A5O_PATH *path, int i, const char *s) { - ALLEGRO_USTR **slot; + A5O_USTR **slot; ASSERT(path); ASSERT(i <= (int)_al_vector_size(&path->segments)); @@ -304,7 +304,7 @@ void al_insert_path_component(ALLEGRO_PATH *path, int i, const char *s) /* Function: al_get_path_tail */ -const char *al_get_path_tail(const ALLEGRO_PATH *path) +const char *al_get_path_tail(const A5O_PATH *path) { ASSERT(path); @@ -317,7 +317,7 @@ const char *al_get_path_tail(const ALLEGRO_PATH *path) /* Function: al_drop_path_tail */ -void al_drop_path_tail(ALLEGRO_PATH *path) +void al_drop_path_tail(A5O_PATH *path) { if (al_get_path_num_components(path) > 0) { al_remove_path_component(path, -1); @@ -327,14 +327,14 @@ void al_drop_path_tail(ALLEGRO_PATH *path) /* Function: al_append_path_component */ -void al_append_path_component(ALLEGRO_PATH *path, const char *s) +void al_append_path_component(A5O_PATH *path, const char *s) { - ALLEGRO_USTR **slot = _al_vector_alloc_back(&path->segments); + A5O_USTR **slot = _al_vector_alloc_back(&path->segments); (*slot) = al_ustr_new(s); } -static bool path_is_absolute(const ALLEGRO_PATH *path) +static bool path_is_absolute(const A5O_PATH *path) { /* If the first segment is empty, we have an absolute path. */ return (_al_vector_size(&path->segments) > 0) @@ -344,7 +344,7 @@ static bool path_is_absolute(const ALLEGRO_PATH *path) /* Function: al_join_paths */ -bool al_join_paths(ALLEGRO_PATH *path, const ALLEGRO_PATH *tail) +bool al_join_paths(A5O_PATH *path, const A5O_PATH *tail) { unsigned i; ASSERT(path); @@ -371,7 +371,7 @@ bool al_join_paths(ALLEGRO_PATH *path, const ALLEGRO_PATH *tail) /* Function: al_rebase_path */ -bool al_rebase_path(const ALLEGRO_PATH *head, ALLEGRO_PATH *tail) +bool al_rebase_path(const A5O_PATH *head, A5O_PATH *tail) { unsigned i; ASSERT(head); @@ -392,8 +392,8 @@ bool al_rebase_path(const ALLEGRO_PATH *head, ALLEGRO_PATH *tail) } -static void path_to_ustr(const ALLEGRO_PATH *path, int32_t delim, - ALLEGRO_USTR *str) +static void path_to_ustr(const A5O_PATH *path, int32_t delim, + A5O_USTR *str) { unsigned i; @@ -410,14 +410,14 @@ static void path_to_ustr(const ALLEGRO_PATH *path, int32_t delim, /* Function: al_path_cstr */ -const char *al_path_cstr(const ALLEGRO_PATH *path, char delim) +const char *al_path_cstr(const A5O_PATH *path, char delim) { return al_cstr(al_path_ustr(path, delim)); } /* Function: al_path_ustr */ -const ALLEGRO_USTR *al_path_ustr(const ALLEGRO_PATH *path, char delim) +const A5O_USTR *al_path_ustr(const A5O_PATH *path, char delim) { path_to_ustr(path, delim, path->full_string); return path->full_string; @@ -426,7 +426,7 @@ const ALLEGRO_USTR *al_path_ustr(const ALLEGRO_PATH *path, char delim) /* Function: al_destroy_path */ -void al_destroy_path(ALLEGRO_PATH *path) +void al_destroy_path(A5O_PATH *path) { unsigned i; @@ -465,7 +465,7 @@ void al_destroy_path(ALLEGRO_PATH *path) /* Function: al_set_path_drive */ -void al_set_path_drive(ALLEGRO_PATH *path, const char *drive) +void al_set_path_drive(A5O_PATH *path, const char *drive) { ASSERT(path); @@ -478,7 +478,7 @@ void al_set_path_drive(ALLEGRO_PATH *path, const char *drive) /* Function: al_get_path_drive */ -const char *al_get_path_drive(const ALLEGRO_PATH *path) +const char *al_get_path_drive(const A5O_PATH *path) { ASSERT(path); @@ -488,7 +488,7 @@ const char *al_get_path_drive(const ALLEGRO_PATH *path) /* Function: al_set_path_filename */ -void al_set_path_filename(ALLEGRO_PATH *path, const char *filename) +void al_set_path_filename(A5O_PATH *path, const char *filename) { ASSERT(path); @@ -501,7 +501,7 @@ void al_set_path_filename(ALLEGRO_PATH *path, const char *filename) /* Function: al_get_path_filename */ -const char *al_get_path_filename(const ALLEGRO_PATH *path) +const char *al_get_path_filename(const A5O_PATH *path) { ASSERT(path); @@ -511,7 +511,7 @@ const char *al_get_path_filename(const ALLEGRO_PATH *path) /* Function: al_get_path_extension */ -const char *al_get_path_extension(const ALLEGRO_PATH *path) +const char *al_get_path_extension(const A5O_PATH *path) { int pos; ASSERT(path); @@ -526,7 +526,7 @@ const char *al_get_path_extension(const ALLEGRO_PATH *path) /* Function: al_set_path_extension */ -bool al_set_path_extension(ALLEGRO_PATH *path, char const *extension) +bool al_set_path_extension(A5O_PATH *path, char const *extension) { int dot; ASSERT(path); @@ -546,7 +546,7 @@ bool al_set_path_extension(ALLEGRO_PATH *path, char const *extension) /* Function: al_get_path_basename */ -const char *al_get_path_basename(const ALLEGRO_PATH *path) +const char *al_get_path_basename(const A5O_PATH *path) { int dot; ASSERT(path); @@ -563,7 +563,7 @@ const char *al_get_path_basename(const ALLEGRO_PATH *path) /* Function: al_make_path_canonical */ -bool al_make_path_canonical(ALLEGRO_PATH *path) +bool al_make_path_canonical(A5O_PATH *path) { unsigned i; ASSERT(path); diff --git a/src/pixels.c b/src/pixels.c index e1b8421fe1..4643bfacd4 100644 --- a/src/pixels.c +++ b/src/pixels.c @@ -18,14 +18,14 @@ #include "allegro5/allegro.h" #include "allegro5/internal/aintern_pixels.h" -ALLEGRO_DEBUG_CHANNEL("pixels") +A5O_DEBUG_CHANNEL("pixels") /* lookup table for scaling 8 bit integers up to floats [0.0, 1.0] */ #include "pixel_tables.inc" static int pixel_sizes[] = { - 0, /* ALLEGRO_PIXEL_FORMAT_ANY */ + 0, /* A5O_PIXEL_FORMAT_ANY */ 0, 0, 2, @@ -34,7 +34,7 @@ static int pixel_sizes[] = { 3, 4, 4, - 4, /* ALLEGRO_PIXEL_FORMAT_ARGB_8888 */ + 4, /* A5O_PIXEL_FORMAT_ARGB_8888 */ 4, 2, 3, @@ -49,17 +49,17 @@ static int pixel_sizes[] = { 2, 4, 4, - 16, /* ALLEGRO_PIXEL_FORMAT_ABGR_F32 */ - 4, /* ALLEGRO_PIXEL_FORMAT_ABGR_LE */ - 2, /* ALLEGRO_PIXEL_FORMAT_RGBA_4444 */ - 1, /* ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8 */ + 16, /* A5O_PIXEL_FORMAT_ABGR_F32 */ + 4, /* A5O_PIXEL_FORMAT_ABGR_LE */ + 2, /* A5O_PIXEL_FORMAT_RGBA_4444 */ + 1, /* A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8 */ 0, 0, 0, }; static int pixel_bits[] = { - 0, /* ALLEGRO_PIXEL_FORMAT_ANY */ + 0, /* A5O_PIXEL_FORMAT_ANY */ 0, 0, 15, @@ -68,7 +68,7 @@ static int pixel_bits[] = { 24, 32, 32, - 32, /* ALLEGRO_PIXEL_FORMAT_ARGB_8888 */ + 32, /* A5O_PIXEL_FORMAT_ARGB_8888 */ 32, 16, 24, @@ -83,17 +83,17 @@ static int pixel_bits[] = { 15, 32, 32, - 128, /* ALLEGRO_PIXEL_FORMAT_ABGR_F32 */ - 32, /* ALLEGRO_PIXEL_FORMAT_ABGR_LE */ - 16, /* ALLEGRO_PIXEL_FORMAT_RGBA_4444 */ - 8, /* ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8 */ + 128, /* A5O_PIXEL_FORMAT_ABGR_F32 */ + 32, /* A5O_PIXEL_FORMAT_ABGR_LE */ + 16, /* A5O_PIXEL_FORMAT_RGBA_4444 */ + 8, /* A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8 */ 0, 0, 0, }; static int pixel_block_widths[] = { - 0, /* ALLEGRO_PIXEL_FORMAT_ANY */ + 0, /* A5O_PIXEL_FORMAT_ANY */ 0, 0, 1, @@ -102,7 +102,7 @@ static int pixel_block_widths[] = { 1, 1, 1, - 1, /* ALLEGRO_PIXEL_FORMAT_ARGB_8888 */ + 1, /* A5O_PIXEL_FORMAT_ARGB_8888 */ 1, 1, 1, @@ -117,17 +117,17 @@ static int pixel_block_widths[] = { 1, 1, 1, - 1, /* ALLEGRO_PIXEL_FORMAT_ABGR_F32 */ - 1, /* ALLEGRO_PIXEL_FORMAT_ABGR_LE */ - 1, /* ALLEGRO_PIXEL_FORMAT_RGBA_4444 */ - 1, /* ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8 */ + 1, /* A5O_PIXEL_FORMAT_ABGR_F32 */ + 1, /* A5O_PIXEL_FORMAT_ABGR_LE */ + 1, /* A5O_PIXEL_FORMAT_RGBA_4444 */ + 1, /* A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8 */ 4, 4, 4, }; static int pixel_block_heights[] = { - 0, /* ALLEGRO_PIXEL_FORMAT_ANY */ + 0, /* A5O_PIXEL_FORMAT_ANY */ 0, 0, 1, @@ -136,7 +136,7 @@ static int pixel_block_heights[] = { 1, 1, 1, - 1, /* ALLEGRO_PIXEL_FORMAT_ARGB_8888 */ + 1, /* A5O_PIXEL_FORMAT_ARGB_8888 */ 1, 1, 1, @@ -151,17 +151,17 @@ static int pixel_block_heights[] = { 1, 1, 1, - 1, /* ALLEGRO_PIXEL_FORMAT_ABGR_F32 */ - 1, /* ALLEGRO_PIXEL_FORMAT_ABGR_LE */ - 1, /* ALLEGRO_PIXEL_FORMAT_RGBA_4444 */ - 1, /* ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8 */ + 1, /* A5O_PIXEL_FORMAT_ABGR_F32 */ + 1, /* A5O_PIXEL_FORMAT_ABGR_LE */ + 1, /* A5O_PIXEL_FORMAT_RGBA_4444 */ + 1, /* A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8 */ 4, 4, 4, }; static int pixel_block_sizes[] = { - 0, /* ALLEGRO_PIXEL_FORMAT_ANY */ + 0, /* A5O_PIXEL_FORMAT_ANY */ 0, 0, 2, @@ -170,7 +170,7 @@ static int pixel_block_sizes[] = { 3, 4, 4, - 4, /* ALLEGRO_PIXEL_FORMAT_ARGB_8888 */ + 4, /* A5O_PIXEL_FORMAT_ARGB_8888 */ 4, 2, 3, @@ -185,17 +185,17 @@ static int pixel_block_sizes[] = { 2, 4, 4, - 16, /* ALLEGRO_PIXEL_FORMAT_ABGR_F32 */ - 4, /* ALLEGRO_PIXEL_FORMAT_ABGR_LE */ - 2, /* ALLEGRO_PIXEL_FORMAT_RGBA_4444 */ - 1, /* ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8 */ + 16, /* A5O_PIXEL_FORMAT_ABGR_F32 */ + 4, /* A5O_PIXEL_FORMAT_ABGR_LE */ + 2, /* A5O_PIXEL_FORMAT_RGBA_4444 */ + 1, /* A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8 */ 8, 16, 16, }; -static bool format_alpha_table[ALLEGRO_NUM_PIXEL_FORMATS] = { - false, /* neutral (ALLEGRO_PIXEL_FORMAT_ANY) */ +static bool format_alpha_table[A5O_NUM_PIXEL_FORMATS] = { + false, /* neutral (A5O_PIXEL_FORMAT_ANY) */ false, true, false, @@ -204,7 +204,7 @@ static bool format_alpha_table[ALLEGRO_NUM_PIXEL_FORMATS] = { false, false, true, - true, /* ALLEGRO_PIXEL_FORMAT_ARGB_8888 */ + true, /* A5O_PIXEL_FORMAT_ARGB_8888 */ true, true, false, @@ -219,16 +219,16 @@ static bool format_alpha_table[ALLEGRO_NUM_PIXEL_FORMATS] = { false, false, false, - true, /* ALLEGRO_PIXEL_FORMAT_ABGR_F32 */ - true, /* ALLEGRO_PIXEL_FORMAT_ABGR_LE */ - true, /* ALLEGRO_PIXEL_FORMAT_RGBA_4444 */ - false, /* ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8 */ + true, /* A5O_PIXEL_FORMAT_ABGR_F32 */ + true, /* A5O_PIXEL_FORMAT_ABGR_LE */ + true, /* A5O_PIXEL_FORMAT_RGBA_4444 */ + false, /* A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8 */ true, true, true, }; -static char const *pixel_format_names[ALLEGRO_NUM_PIXEL_FORMATS + 1] = { +static char const *pixel_format_names[A5O_NUM_PIXEL_FORMATS + 1] = { "ANY", "ANY_NO_ALPHA", "ANY_WITH_ALPHA", @@ -263,9 +263,9 @@ static char const *pixel_format_names[ALLEGRO_NUM_PIXEL_FORMATS + 1] = { "INVALID" }; -static bool format_is_real[ALLEGRO_NUM_PIXEL_FORMATS] = +static bool format_is_real[A5O_NUM_PIXEL_FORMATS] = { - false, /* ALLEGRO_PIXEL_FORMAT_ANY */ + false, /* A5O_PIXEL_FORMAT_ANY */ false, false, false, @@ -274,7 +274,7 @@ static bool format_is_real[ALLEGRO_NUM_PIXEL_FORMATS] = false, false, false, - true, /* ALLEGRO_PIXEL_FORMAT_ARGB_8888 */ + true, /* A5O_PIXEL_FORMAT_ARGB_8888 */ true, true, true, @@ -289,18 +289,18 @@ static bool format_is_real[ALLEGRO_NUM_PIXEL_FORMATS] = true, true, true, - true, /* ALLEGRO_PIXEL_FORMAT_ABGR_F32 */ - true, /* ALLEGRO_PIXEL_FORMAT_ABGR_LE */ - true, /* ALLEGRO_PIXEL_FORMAT_RGBA_4444 */ - true, /* ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8 */ + true, /* A5O_PIXEL_FORMAT_ABGR_F32 */ + true, /* A5O_PIXEL_FORMAT_ABGR_LE */ + true, /* A5O_PIXEL_FORMAT_RGBA_4444 */ + true, /* A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8 */ true, true, true, }; -static bool format_is_video_only[ALLEGRO_NUM_PIXEL_FORMATS] = +static bool format_is_video_only[A5O_NUM_PIXEL_FORMATS] = { - false, /* ALLEGRO_PIXEL_FORMAT_ANY */ + false, /* A5O_PIXEL_FORMAT_ANY */ false, false, false, @@ -309,7 +309,7 @@ static bool format_is_video_only[ALLEGRO_NUM_PIXEL_FORMATS] = false, false, false, - false, /* ALLEGRO_PIXEL_FORMAT_ARGB_8888 */ + false, /* A5O_PIXEL_FORMAT_ARGB_8888 */ false, false, false, @@ -324,18 +324,18 @@ static bool format_is_video_only[ALLEGRO_NUM_PIXEL_FORMATS] = false, false, false, - false, /* ALLEGRO_PIXEL_FORMAT_ABGR_F32 */ - false, /* ALLEGRO_PIXEL_FORMAT_ABGR_LE */ - false, /* ALLEGRO_PIXEL_FORMAT_RGBA_4444 */ - false, /* ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8 */ + false, /* A5O_PIXEL_FORMAT_ABGR_F32 */ + false, /* A5O_PIXEL_FORMAT_ABGR_LE */ + false, /* A5O_PIXEL_FORMAT_RGBA_4444 */ + false, /* A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8 */ true, true, true, }; -static bool format_is_compressed[ALLEGRO_NUM_PIXEL_FORMATS] = +static bool format_is_compressed[A5O_NUM_PIXEL_FORMATS] = { - false, /* ALLEGRO_PIXEL_FORMAT_ANY */ + false, /* A5O_PIXEL_FORMAT_ANY */ false, false, false, @@ -344,7 +344,7 @@ static bool format_is_compressed[ALLEGRO_NUM_PIXEL_FORMATS] = false, false, false, - false, /* ALLEGRO_PIXEL_FORMAT_ARGB_8888 */ + false, /* A5O_PIXEL_FORMAT_ARGB_8888 */ false, false, false, @@ -359,10 +359,10 @@ static bool format_is_compressed[ALLEGRO_NUM_PIXEL_FORMATS] = false, false, false, - false, /* ALLEGRO_PIXEL_FORMAT_ABGR_F32 */ - false, /* ALLEGRO_PIXEL_FORMAT_ABGR_LE */ - false, /* ALLEGRO_PIXEL_FORMAT_RGBA_4444 */ - false, /* ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8 */ + false, /* A5O_PIXEL_FORMAT_ABGR_F32 */ + false, /* A5O_PIXEL_FORMAT_ABGR_LE */ + false, /* A5O_PIXEL_FORMAT_RGBA_4444 */ + false, /* A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8 */ true, true, true, @@ -418,7 +418,7 @@ bool _al_pixel_format_has_alpha(int format) bool _al_pixel_format_is_real(int format) { ASSERT(format >= 0); - ASSERT(format < ALLEGRO_NUM_PIXEL_FORMATS); + ASSERT(format < A5O_NUM_PIXEL_FORMATS); return format_is_real[format]; } @@ -426,7 +426,7 @@ bool _al_pixel_format_is_real(int format) bool _al_pixel_format_is_video_only(int format) { ASSERT(format >= 0); - ASSERT(format < ALLEGRO_NUM_PIXEL_FORMATS); + ASSERT(format < A5O_NUM_PIXEL_FORMATS); return format_is_video_only[format]; } @@ -434,7 +434,7 @@ bool _al_pixel_format_is_video_only(int format) bool _al_pixel_format_is_compressed(int format) { ASSERT(format >= 0); - ASSERT(format < ALLEGRO_NUM_PIXEL_FORMATS); + ASSERT(format < A5O_NUM_PIXEL_FORMATS); return format_is_compressed[format]; } @@ -443,7 +443,7 @@ bool _al_pixel_format_is_compressed(int format) /* We use al_get_display_format() as a hint for the preferred RGB ordering when * nothing else is specified. */ -static bool try_display_format(ALLEGRO_DISPLAY *display, int *format) +static bool try_display_format(A5O_DISPLAY *display, int *format) { int best_format; int bytes; @@ -463,14 +463,14 @@ static bool try_display_format(ALLEGRO_DISPLAY *display, int *format) if (_al_pixel_format_has_alpha(*format) && !_al_pixel_format_has_alpha(best_format)) { switch (best_format) { - case ALLEGRO_PIXEL_FORMAT_RGBX_8888: - *format = ALLEGRO_PIXEL_FORMAT_RGBA_8888; + case A5O_PIXEL_FORMAT_RGBX_8888: + *format = A5O_PIXEL_FORMAT_RGBA_8888; return true; - case ALLEGRO_PIXEL_FORMAT_XRGB_8888: - *format = ALLEGRO_PIXEL_FORMAT_ARGB_8888; + case A5O_PIXEL_FORMAT_XRGB_8888: + *format = A5O_PIXEL_FORMAT_ARGB_8888; return true; - case ALLEGRO_PIXEL_FORMAT_XBGR_8888: - *format = ALLEGRO_PIXEL_FORMAT_ABGR_8888; + case A5O_PIXEL_FORMAT_XBGR_8888: + *format = A5O_PIXEL_FORMAT_ABGR_8888; return true; default: return false; @@ -479,14 +479,14 @@ static bool try_display_format(ALLEGRO_DISPLAY *display, int *format) if (!_al_pixel_format_has_alpha(*format) && _al_pixel_format_has_alpha(best_format)) { switch (best_format) { - case ALLEGRO_PIXEL_FORMAT_RGBA_8888: - *format = ALLEGRO_PIXEL_FORMAT_RGBX_8888; + case A5O_PIXEL_FORMAT_RGBA_8888: + *format = A5O_PIXEL_FORMAT_RGBX_8888; return true; - case ALLEGRO_PIXEL_FORMAT_ARGB_8888: - *format = ALLEGRO_PIXEL_FORMAT_XRGB_8888; + case A5O_PIXEL_FORMAT_ARGB_8888: + *format = A5O_PIXEL_FORMAT_XRGB_8888; return true; - case ALLEGRO_PIXEL_FORMAT_ABGR_8888: - *format = ALLEGRO_PIXEL_FORMAT_XBGR_8888; + case A5O_PIXEL_FORMAT_ABGR_8888: + *format = A5O_PIXEL_FORMAT_XBGR_8888; return true; default: return false; @@ -497,37 +497,37 @@ static bool try_display_format(ALLEGRO_DISPLAY *display, int *format) } -int _al_get_real_pixel_format(ALLEGRO_DISPLAY *display, int format) +int _al_get_real_pixel_format(A5O_DISPLAY *display, int format) { /* Pick an appropriate format if the user is vague */ switch (format) { - case ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA: - case ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA: + case A5O_PIXEL_FORMAT_ANY_NO_ALPHA: + case A5O_PIXEL_FORMAT_ANY_32_NO_ALPHA: if (!try_display_format(display, &format)) - format = ALLEGRO_PIXEL_FORMAT_XRGB_8888; + format = A5O_PIXEL_FORMAT_XRGB_8888; break; - case ALLEGRO_PIXEL_FORMAT_ANY: - case ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA: - case ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA: + case A5O_PIXEL_FORMAT_ANY: + case A5O_PIXEL_FORMAT_ANY_WITH_ALPHA: + case A5O_PIXEL_FORMAT_ANY_32_WITH_ALPHA: if (!try_display_format(display, &format)) -#if defined ALLEGRO_CFG_OPENGLES // OPENGLES doesn't have ARGB_8888 - format = ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE; +#if defined A5O_CFG_OPENGLES // OPENGLES doesn't have ARGB_8888 + format = A5O_PIXEL_FORMAT_ABGR_8888_LE; #else - format = ALLEGRO_PIXEL_FORMAT_ARGB_8888; + format = A5O_PIXEL_FORMAT_ARGB_8888; #endif break; - case ALLEGRO_PIXEL_FORMAT_ANY_15_NO_ALPHA: - format = ALLEGRO_PIXEL_FORMAT_RGB_555; + case A5O_PIXEL_FORMAT_ANY_15_NO_ALPHA: + format = A5O_PIXEL_FORMAT_RGB_555; break; - case ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA: + case A5O_PIXEL_FORMAT_ANY_16_NO_ALPHA: if (!try_display_format(display, &format)) - format = ALLEGRO_PIXEL_FORMAT_RGB_565; + format = A5O_PIXEL_FORMAT_RGB_565; break; - case ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA: - format = ALLEGRO_PIXEL_FORMAT_RGBA_4444; + case A5O_PIXEL_FORMAT_ANY_16_WITH_ALPHA: + format = A5O_PIXEL_FORMAT_RGBA_4444; break; - case ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA: - format = ALLEGRO_PIXEL_FORMAT_RGB_888; + case A5O_PIXEL_FORMAT_ANY_24_NO_ALPHA: + format = A5O_PIXEL_FORMAT_RGB_888; break; default: /* Already a real format - don't change it. */ @@ -539,9 +539,9 @@ int _al_get_real_pixel_format(ALLEGRO_DISPLAY *display, int format) } -char const *_al_pixel_format_name(ALLEGRO_PIXEL_FORMAT format) +char const *_al_pixel_format_name(A5O_PIXEL_FORMAT format) { - if (format >= ALLEGRO_NUM_PIXEL_FORMATS) format = ALLEGRO_NUM_PIXEL_FORMATS; + if (format >= A5O_NUM_PIXEL_FORMATS) format = A5O_NUM_PIXEL_FORMATS; return pixel_format_names[format]; } @@ -550,10 +550,10 @@ char const *_al_pixel_format_name(ALLEGRO_PIXEL_FORMAT format) /* Function: al_map_rgba */ -ALLEGRO_COLOR al_map_rgba( +A5O_COLOR al_map_rgba( unsigned char r, unsigned char g, unsigned char b, unsigned char a) { - ALLEGRO_COLOR color; + A5O_COLOR color; _AL_MAP_RGBA(color, r, g, b, a); return color; } @@ -561,10 +561,10 @@ ALLEGRO_COLOR al_map_rgba( /* Function: al_premul_rgba */ -ALLEGRO_COLOR al_premul_rgba( +A5O_COLOR al_premul_rgba( unsigned char r, unsigned char g, unsigned char b, unsigned char a) { - ALLEGRO_COLOR color; + A5O_COLOR color; _AL_MAP_RGBA(color, r * a / 255, g * a / 255, b * a / 255, a); return color; } @@ -572,7 +572,7 @@ ALLEGRO_COLOR al_premul_rgba( /* Function: al_map_rgb */ -ALLEGRO_COLOR al_map_rgb( +A5O_COLOR al_map_rgb( unsigned char r, unsigned char g, unsigned char b) { return al_map_rgba(r, g, b, 255); @@ -581,9 +581,9 @@ ALLEGRO_COLOR al_map_rgb( /* Function: al_map_rgba_f */ -ALLEGRO_COLOR al_map_rgba_f(float r, float g, float b, float a) +A5O_COLOR al_map_rgba_f(float r, float g, float b, float a) { - ALLEGRO_COLOR color; + A5O_COLOR color; color.r = r; color.g = g; color.b = b; @@ -594,9 +594,9 @@ ALLEGRO_COLOR al_map_rgba_f(float r, float g, float b, float a) /* Function: al_premul_rgba_f */ -ALLEGRO_COLOR al_premul_rgba_f(float r, float g, float b, float a) +A5O_COLOR al_premul_rgba_f(float r, float g, float b, float a) { - ALLEGRO_COLOR color; + A5O_COLOR color; color.r = r * a; color.g = g * a; color.b = b * a; @@ -607,7 +607,7 @@ ALLEGRO_COLOR al_premul_rgba_f(float r, float g, float b, float a) /* Function: al_map_rgb_f */ -ALLEGRO_COLOR al_map_rgb_f(float r, float g, float b) +A5O_COLOR al_map_rgb_f(float r, float g, float b) { return al_map_rgba_f(r, g, b, 1.0f); } @@ -618,7 +618,7 @@ ALLEGRO_COLOR al_map_rgb_f(float r, float g, float b) /* Function: al_unmap_rgba */ -void al_unmap_rgba(ALLEGRO_COLOR color, +void al_unmap_rgba(A5O_COLOR color, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a) { *r = color.r * 255.0f; @@ -630,7 +630,7 @@ void al_unmap_rgba(ALLEGRO_COLOR color, /* Function: al_unmap_rgb */ -void al_unmap_rgb(ALLEGRO_COLOR color, +void al_unmap_rgb(A5O_COLOR color, unsigned char *r, unsigned char *g, unsigned char *b) { unsigned char tmp; @@ -641,7 +641,7 @@ void al_unmap_rgb(ALLEGRO_COLOR color, /* Function: al_unmap_rgba_f */ -void al_unmap_rgba_f(ALLEGRO_COLOR color, +void al_unmap_rgba_f(A5O_COLOR color, float *r, float *g, float *b, float *a) { *r = color.r; @@ -653,7 +653,7 @@ void al_unmap_rgba_f(ALLEGRO_COLOR color, /* Function: al_unmap_rgb_f */ -void al_unmap_rgb_f(ALLEGRO_COLOR color, float *r, float *g, float *b) +void al_unmap_rgb_f(A5O_COLOR color, float *r, float *g, float *b) { float tmp; diff --git a/src/raspberrypi/pidisplay.c b/src/raspberrypi/pidisplay.c index 63a1363e27..69b2af4ce9 100644 --- a/src/raspberrypi/pidisplay.c +++ b/src/raspberrypi/pidisplay.c @@ -18,7 +18,7 @@ #define DEFAULT_CURSOR_WIDTH 17 #define DEFAULT_CURSOR_HEIGHT 28 -static ALLEGRO_DISPLAY_INTERFACE *vt; +static A5O_DISPLAY_INTERFACE *vt; static EGLDisplay egl_display; static EGLSurface egl_window; @@ -32,7 +32,7 @@ static VC_RECT_T src_rect; static bool cursor_added = false; static float mouse_scale_ratio_x = 1.0f, mouse_scale_ratio_y = 1.0f; -struct ALLEGRO_DISPLAY_RASPBERRYPI_EXTRA { +struct A5O_DISPLAY_RASPBERRYPI_EXTRA { }; static int pot(int n) @@ -44,7 +44,7 @@ static int pot(int n) return i; } -static void set_cursor_data(ALLEGRO_DISPLAY_RASPBERRYPI *d, uint32_t *data, int width, int height) +static void set_cursor_data(A5O_DISPLAY_RASPBERRYPI *d, uint32_t *data, int width, int height) { al_free(d->cursor_data); int spitch = sizeof(uint32_t) * width; @@ -60,13 +60,13 @@ static void set_cursor_data(ALLEGRO_DISPLAY_RASPBERRYPI *d, uint32_t *data, int d->cursor_height = height; } -static void delete_cursor_data(ALLEGRO_DISPLAY_RASPBERRYPI *d) +static void delete_cursor_data(A5O_DISPLAY_RASPBERRYPI *d) { al_free(d->cursor_data); d->cursor_data = NULL; } -static void show_cursor(ALLEGRO_DISPLAY_RASPBERRYPI *d) +static void show_cursor(A5O_DISPLAY_RASPBERRYPI *d) { if (d->cursor_data == NULL) { return; @@ -91,7 +91,7 @@ static void show_cursor(ALLEGRO_DISPLAY_RASPBERRYPI *d) vc_dispmanx_resource_write_data(cursor_resource, VC_IMAGE_ARGB8888, dpitch, d->cursor_data, &r); vc_dispmanx_update_submit_sync(dispman_update); - ALLEGRO_MOUSE_STATE state; + A5O_MOUSE_STATE state; al_get_mouse_state(&state); dst_rect.x = state.x+d->cursor_offset_x; @@ -123,13 +123,13 @@ static void show_cursor(ALLEGRO_DISPLAY_RASPBERRYPI *d) cursor_added = true; } else { - ALLEGRO_DISPLAY *disp = (ALLEGRO_DISPLAY *)d; + A5O_DISPLAY *disp = (A5O_DISPLAY *)d; VC_RECT_T src, dst; src.x = 0; src.y = 0; src.width = d->cursor_width << 16; src.height = d->cursor_height << 16; - ALLEGRO_MOUSE_STATE st; + A5O_MOUSE_STATE st; al_get_mouse_state(&st); st.x = (st.x+0.5) * d->screen_width / disp->w; st.y = (st.y+0.5) * d->screen_height / disp->h; @@ -153,7 +153,7 @@ static void show_cursor(ALLEGRO_DISPLAY_RASPBERRYPI *d) } } -static void hide_cursor(ALLEGRO_DISPLAY_RASPBERRYPI *d) +static void hide_cursor(A5O_DISPLAY_RASPBERRYPI *d) { (void)d; @@ -169,9 +169,9 @@ static void hide_cursor(ALLEGRO_DISPLAY_RASPBERRYPI *d) } /* Helper to set up GL state as we want it. */ -static void setup_gl(ALLEGRO_DISPLAY *d) +static void setup_gl(A5O_DISPLAY *d) { - ALLEGRO_OGL_EXTRAS *ogl = d->ogl_extras; + A5O_OGL_EXTRAS *ogl = d->ogl_extras; if (ogl->backbuffer) _al_ogl_resize_backbuffer(ogl->backbuffer, d->w, d->h); @@ -210,9 +210,9 @@ void _al_raspberrypi_get_screen_info(int *dx, int *dy, p2 += strlen("fbheight="); int w = atoi(p); int h = atoi(p2); - const ALLEGRO_FILE_INTERFACE *file_interface = al_get_new_file_interface(); + const A5O_FILE_INTERFACE *file_interface = al_get_new_file_interface(); al_set_standard_file_interface(); - ALLEGRO_CONFIG *cfg = al_load_config_file("/boot/config.txt"); + A5O_CONFIG *cfg = al_load_config_file("/boot/config.txt"); if (cfg) { const char *disable_overscan = al_get_config_value( @@ -264,10 +264,10 @@ void _al_raspberrypi_get_mouse_scale_ratios(float *x, float *y) *y = mouse_scale_ratio_y; } -static bool pi_create_display(ALLEGRO_DISPLAY *display) +static bool pi_create_display(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_RASPBERRYPI *d = (void *)display; - ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds = _al_get_new_display_settings(); + A5O_DISPLAY_RASPBERRYPI *d = (void *)display; + A5O_EXTRA_DISPLAY_SETTINGS *eds = _al_get_new_display_settings(); egl_display = eglGetDisplay(EGL_DEFAULT_DISPLAY); if (egl_display == EGL_NO_DISPLAY) { @@ -291,18 +291,18 @@ static bool pi_create_display(ALLEGRO_DISPLAY *display) EGL_NONE }; - attrib_list[1] = eds->settings[ALLEGRO_DEPTH_SIZE]; - attrib_list[3] = eds->settings[ALLEGRO_STENCIL_SIZE]; + attrib_list[1] = eds->settings[A5O_DEPTH_SIZE]; + attrib_list[3] = eds->settings[A5O_STENCIL_SIZE]; - if (eds->settings[ALLEGRO_RED_SIZE] || eds->settings[ALLEGRO_GREEN_SIZE] || - eds->settings[ALLEGRO_BLUE_SIZE] || - eds->settings[ALLEGRO_ALPHA_SIZE]) { - attrib_list[5] = eds->settings[ALLEGRO_RED_SIZE]; - attrib_list[7] = eds->settings[ALLEGRO_GREEN_SIZE]; - attrib_list[9] = eds->settings[ALLEGRO_BLUE_SIZE]; - attrib_list[11] = eds->settings[ALLEGRO_ALPHA_SIZE]; + if (eds->settings[A5O_RED_SIZE] || eds->settings[A5O_GREEN_SIZE] || + eds->settings[A5O_BLUE_SIZE] || + eds->settings[A5O_ALPHA_SIZE]) { + attrib_list[5] = eds->settings[A5O_RED_SIZE]; + attrib_list[7] = eds->settings[A5O_GREEN_SIZE]; + attrib_list[9] = eds->settings[A5O_BLUE_SIZE]; + attrib_list[11] = eds->settings[A5O_ALPHA_SIZE]; } - else if (eds->settings[ALLEGRO_COLOR_SIZE] == 16) { + else if (eds->settings[A5O_COLOR_SIZE] == 16) { attrib_list[5] = 5; attrib_list[7] = 6; attrib_list[9] = 5; @@ -318,7 +318,7 @@ static bool pi_create_display(ALLEGRO_DISPLAY *display) eglBindAPI(EGL_OPENGL_ES_API); - int es_ver = (display->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) ? + int es_ver = (display->flags & A5O_PROGRAMMABLE_PIPELINE) ? 2 : 1; static EGLint ctxattr[3] = { @@ -396,36 +396,36 @@ static bool pi_create_display(ALLEGRO_DISPLAY *display) return true; } -static ALLEGRO_DISPLAY *raspberrypi_create_display(int w, int h) +static A5O_DISPLAY *raspberrypi_create_display(int w, int h) { - ALLEGRO_DISPLAY_RASPBERRYPI *d = al_calloc(1, sizeof *d); - ALLEGRO_DISPLAY *display = (void*)d; - ALLEGRO_OGL_EXTRAS *ogl = al_calloc(1, sizeof *ogl); + A5O_DISPLAY_RASPBERRYPI *d = al_calloc(1, sizeof *d); + A5O_DISPLAY *display = (void*)d; + A5O_OGL_EXTRAS *ogl = al_calloc(1, sizeof *ogl); display->ogl_extras = ogl; display->vt = _al_get_raspberrypi_display_interface(); display->flags = al_get_new_display_flags(); - ALLEGRO_SYSTEM_RASPBERRYPI *system = (void *)al_get_system_driver(); + A5O_SYSTEM_RASPBERRYPI *system = (void *)al_get_system_driver(); /* Add ourself to the list of displays. */ - ALLEGRO_DISPLAY_RASPBERRYPI **add; + A5O_DISPLAY_RASPBERRYPI **add; add = _al_vector_alloc_back(&system->system.displays); *add = d; /* Each display is an event source. */ _al_event_source_init(&display->es); - display->extra_settings.settings[ALLEGRO_COMPATIBLE_DISPLAY] = 1; + display->extra_settings.settings[A5O_COMPATIBLE_DISPLAY] = 1; display->w = w; display->h = h; - display->flags |= ALLEGRO_OPENGL; -#ifdef ALLEGRO_CFG_OPENGLES2 - display->flags |= ALLEGRO_PROGRAMMABLE_PIPELINE; + display->flags |= A5O_OPENGL; +#ifdef A5O_CFG_OPENGLES2 + display->flags |= A5O_PROGRAMMABLE_PIPELINE; #endif -#ifdef ALLEGRO_CFG_OPENGLES - display->flags |= ALLEGRO_OPENGL_ES_PROFILE; +#ifdef A5O_CFG_OPENGLES + display->flags |= A5O_OPENGL_ES_PROFILE; #endif if (!pi_create_display(display)) { @@ -475,7 +475,7 @@ static ALLEGRO_DISPLAY *raspberrypi_create_display(int w, int h) setup_gl(display); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA); + al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA); if (al_is_mouse_installed() && !getenv("DISPLAY")) { _al_evdev_set_mouse_range(0, 0, display->w-1, display->h-1); @@ -485,15 +485,15 @@ static ALLEGRO_DISPLAY *raspberrypi_create_display(int w, int h) /* Fill in opengl version */ const int v = display->ogl_extras->ogl_info.version; - display->extra_settings.settings[ALLEGRO_OPENGL_MAJOR_VERSION] = (v >> 24) & 0xFF; - display->extra_settings.settings[ALLEGRO_OPENGL_MINOR_VERSION] = (v >> 16) & 0xFF; + display->extra_settings.settings[A5O_OPENGL_MAJOR_VERSION] = (v >> 24) & 0xFF; + display->extra_settings.settings[A5O_OPENGL_MINOR_VERSION] = (v >> 16) & 0xFF; return display; } -static void raspberrypi_destroy_display(ALLEGRO_DISPLAY *d) +static void raspberrypi_destroy_display(A5O_DISPLAY *d) { - ALLEGRO_DISPLAY_RASPBERRYPI *pidisplay = (ALLEGRO_DISPLAY_RASPBERRYPI *)d; + A5O_DISPLAY_RASPBERRYPI *pidisplay = (A5O_DISPLAY_RASPBERRYPI *)d; hide_cursor(pidisplay); delete_cursor_data(pidisplay); @@ -501,14 +501,14 @@ static void raspberrypi_destroy_display(ALLEGRO_DISPLAY *d) _al_set_current_display_only(d); while (d->bitmaps._size > 0) { - ALLEGRO_BITMAP **bptr = (ALLEGRO_BITMAP **)_al_vector_ref_back(&d->bitmaps); - ALLEGRO_BITMAP *b = *bptr; + A5O_BITMAP **bptr = (A5O_BITMAP **)_al_vector_ref_back(&d->bitmaps); + A5O_BITMAP *b = *bptr; _al_convert_to_memory_bitmap(b); } _al_event_source_free(&d->es); - ALLEGRO_SYSTEM_RASPBERRYPI *system = (void *)al_get_system_driver(); + A5O_SYSTEM_RASPBERRYPI *system = (void *)al_get_system_driver(); _al_vector_find_and_delete(&system->system.displays, &d); eglMakeCurrent(egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); @@ -528,7 +528,7 @@ static void raspberrypi_destroy_display(ALLEGRO_DISPLAY *d) } } -static bool raspberrypi_set_current_display(ALLEGRO_DISPLAY *d) +static bool raspberrypi_set_current_display(A5O_DISPLAY *d) { (void)d; // FIXME @@ -536,10 +536,10 @@ static bool raspberrypi_set_current_display(ALLEGRO_DISPLAY *d) return true; } -static int raspberrypi_get_orientation(ALLEGRO_DISPLAY *d) +static int raspberrypi_get_orientation(A5O_DISPLAY *d) { (void)d; - return ALLEGRO_DISPLAY_ORIENTATION_0_DEGREES; + return A5O_DISPLAY_ORIENTATION_0_DEGREES; } @@ -547,8 +547,8 @@ static int raspberrypi_get_orientation(ALLEGRO_DISPLAY *d) * are compatible. */ static bool raspberrypi_is_compatible_bitmap( - ALLEGRO_DISPLAY *display, - ALLEGRO_BITMAP *bitmap + A5O_DISPLAY *display, + A5O_BITMAP *bitmap ) { (void)display; (void)bitmap; @@ -556,7 +556,7 @@ static bool raspberrypi_is_compatible_bitmap( } /* Resizing is not possible. */ -static bool raspberrypi_resize_display(ALLEGRO_DISPLAY *d, int w, int h) +static bool raspberrypi_resize_display(A5O_DISPLAY *d, int w, int h) { (void)d; (void)w; @@ -567,7 +567,7 @@ static bool raspberrypi_resize_display(ALLEGRO_DISPLAY *d, int w, int h) /* The icon must be provided in the Info.plist file, it cannot be changed * at runtime. */ -static void raspberrypi_set_icons(ALLEGRO_DISPLAY *d, int num_icons, ALLEGRO_BITMAP *bitmaps[]) +static void raspberrypi_set_icons(A5O_DISPLAY *d, int num_icons, A5O_BITMAP *bitmaps[]) { (void)d; (void)num_icons; @@ -575,14 +575,14 @@ static void raspberrypi_set_icons(ALLEGRO_DISPLAY *d, int num_icons, ALLEGRO_BIT } /* There is no way to leave fullscreen so no window title is visible. */ -static void raspberrypi_set_window_title(ALLEGRO_DISPLAY *display, char const *title) +static void raspberrypi_set_window_title(A5O_DISPLAY *display, char const *title) { (void)display; (void)title; } /* The window always spans the entire screen right now. */ -static void raspberrypi_set_window_position(ALLEGRO_DISPLAY *display, int x, int y) +static void raspberrypi_set_window_position(A5O_DISPLAY *display, int x, int y) { (void)display; (void)x; @@ -590,7 +590,7 @@ static void raspberrypi_set_window_position(ALLEGRO_DISPLAY *display, int x, int } /* The window cannot be constrained. */ -static bool raspberrypi_set_window_constraints(ALLEGRO_DISPLAY *display, +static bool raspberrypi_set_window_constraints(A5O_DISPLAY *display, int min_w, int min_h, int max_w, int max_h) { (void)display; @@ -602,7 +602,7 @@ static bool raspberrypi_set_window_constraints(ALLEGRO_DISPLAY *display, } /* Always fullscreen. */ -static bool raspberrypi_set_display_flag(ALLEGRO_DISPLAY *display, +static bool raspberrypi_set_display_flag(A5O_DISPLAY *display, int flag, bool onoff) { (void)display; @@ -611,7 +611,7 @@ static bool raspberrypi_set_display_flag(ALLEGRO_DISPLAY *display, return false; } -static void raspberrypi_get_window_position(ALLEGRO_DISPLAY *display, int *x, int *y) +static void raspberrypi_get_window_position(A5O_DISPLAY *display, int *x, int *y) { (void)display; *x = 0; @@ -619,7 +619,7 @@ static void raspberrypi_get_window_position(ALLEGRO_DISPLAY *display, int *x, in } /* The window cannot be constrained. */ -static bool raspberrypi_get_window_constraints(ALLEGRO_DISPLAY *display, +static bool raspberrypi_get_window_constraints(A5O_DISPLAY *display, int *min_w, int *min_h, int *max_w, int *max_h) { (void)display; @@ -630,22 +630,22 @@ static bool raspberrypi_get_window_constraints(ALLEGRO_DISPLAY *display, return false; } -static bool raspberrypi_wait_for_vsync(ALLEGRO_DISPLAY *display) +static bool raspberrypi_wait_for_vsync(A5O_DISPLAY *display) { (void)display; return false; } -static void raspberrypi_flip_display(ALLEGRO_DISPLAY *disp) +static void raspberrypi_flip_display(A5O_DISPLAY *disp) { eglSwapBuffers(egl_display, egl_window); if (cursor_added) { - show_cursor((ALLEGRO_DISPLAY_RASPBERRYPI *)disp); + show_cursor((A5O_DISPLAY_RASPBERRYPI *)disp); } } -static void raspberrypi_update_display_region(ALLEGRO_DISPLAY *d, int x, int y, +static void raspberrypi_update_display_region(A5O_DISPLAY *d, int x, int y, int w, int h) { (void)x; @@ -655,36 +655,36 @@ static void raspberrypi_update_display_region(ALLEGRO_DISPLAY *d, int x, int y, raspberrypi_flip_display(d); } -static bool raspberrypi_acknowledge_resize(ALLEGRO_DISPLAY *d) +static bool raspberrypi_acknowledge_resize(A5O_DISPLAY *d) { setup_gl(d); return true; } -static bool raspberrypi_show_mouse_cursor(ALLEGRO_DISPLAY *display) +static bool raspberrypi_show_mouse_cursor(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_RASPBERRYPI *d = (void *)display; + A5O_DISPLAY_RASPBERRYPI *d = (void *)display; hide_cursor(d); show_cursor(d); return true; } -static bool raspberrypi_hide_mouse_cursor(ALLEGRO_DISPLAY *display) +static bool raspberrypi_hide_mouse_cursor(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_RASPBERRYPI *d = (void *)display; + A5O_DISPLAY_RASPBERRYPI *d = (void *)display; hide_cursor(d); return true; } -static bool raspberrypi_set_mouse_cursor(ALLEGRO_DISPLAY *display, ALLEGRO_MOUSE_CURSOR *cursor) +static bool raspberrypi_set_mouse_cursor(A5O_DISPLAY *display, A5O_MOUSE_CURSOR *cursor) { - ALLEGRO_DISPLAY_RASPBERRYPI *d = (void *)display; - ALLEGRO_MOUSE_CURSOR_RASPBERRYPI *pi_cursor = (void *)cursor; + A5O_DISPLAY_RASPBERRYPI *d = (void *)display; + A5O_MOUSE_CURSOR_RASPBERRYPI *pi_cursor = (void *)cursor; int w = al_get_bitmap_width(pi_cursor->bitmap); int h = al_get_bitmap_height(pi_cursor->bitmap); int pitch = w * sizeof(uint32_t); uint32_t *data = al_malloc(pitch * h); - ALLEGRO_LOCKED_REGION *lr = al_lock_bitmap(pi_cursor->bitmap, ALLEGRO_PIXEL_FORMAT_ARGB_8888, ALLEGRO_LOCK_READONLY); + A5O_LOCKED_REGION *lr = al_lock_bitmap(pi_cursor->bitmap, A5O_PIXEL_FORMAT_ARGB_8888, A5O_LOCK_READONLY); int y; for (y = 0; y < h; y++) { uint8_t *p = (uint8_t *)lr->data + lr->pitch * y; @@ -702,17 +702,17 @@ static bool raspberrypi_set_mouse_cursor(ALLEGRO_DISPLAY *display, ALLEGRO_MOUSE return true; } -static bool raspberrypi_set_system_mouse_cursor(ALLEGRO_DISPLAY *display, ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id) +static bool raspberrypi_set_system_mouse_cursor(A5O_DISPLAY *display, A5O_SYSTEM_MOUSE_CURSOR cursor_id) { (void)cursor_id; - ALLEGRO_DISPLAY_RASPBERRYPI *d = (void *)display; + A5O_DISPLAY_RASPBERRYPI *d = (void *)display; delete_cursor_data(d); set_cursor_data(d, default_cursor, DEFAULT_CURSOR_WIDTH, DEFAULT_CURSOR_HEIGHT); return true; } /* Obtain a reference to this driver. */ -ALLEGRO_DISPLAY_INTERFACE *_al_get_raspberrypi_display_interface(void) +A5O_DISPLAY_INTERFACE *_al_get_raspberrypi_display_interface(void) { if (vt) return vt; diff --git a/src/raspberrypi/pisystem.c b/src/raspberrypi/pisystem.c index bf4d597ca2..0738e8411e 100644 --- a/src/raspberrypi/pisystem.c +++ b/src/raspberrypi/pisystem.c @@ -13,21 +13,21 @@ #include -ALLEGRO_DEBUG_CHANNEL("system") +A5O_DEBUG_CHANNEL("system") -static ALLEGRO_SYSTEM_INTERFACE *pi_vt; +static A5O_SYSTEM_INTERFACE *pi_vt; -static ALLEGRO_SYSTEM *pi_initialize(int flags) +static A5O_SYSTEM *pi_initialize(int flags) { (void)flags; - ALLEGRO_SYSTEM_RASPBERRYPI *s; + A5O_SYSTEM_RASPBERRYPI *s; bcm_host_init(); s = al_calloc(1, sizeof *s); - _al_vector_init(&s->system.displays, sizeof (ALLEGRO_DISPLAY_RASPBERRYPI *)); + _al_vector_init(&s->system.displays, sizeof (A5O_DISPLAY_RASPBERRYPI *)); _al_unix_init_time(); @@ -35,7 +35,7 @@ static ALLEGRO_SYSTEM *pi_initialize(int flags) _al_mutex_init_recursive(&s->lock); s->x11display = XOpenDisplay(0); _al_thread_create(&s->thread, _al_xwin_background_thread, s); - ALLEGRO_INFO("events thread spawned.\n"); + A5O_INFO("events thread spawned.\n"); /* We need to put *some* atom into the ClientMessage we send for * faking mouse movements with al_set_mouse_xy - so let's ask X11 * for one here. @@ -52,15 +52,15 @@ static ALLEGRO_SYSTEM *pi_initialize(int flags) static void pi_shutdown_system(void) { - ALLEGRO_SYSTEM *s = al_get_system_driver(); - ALLEGRO_SYSTEM_RASPBERRYPI *spi = (void *)s; + A5O_SYSTEM *s = al_get_system_driver(); + A5O_SYSTEM_RASPBERRYPI *spi = (void *)s; - ALLEGRO_INFO("shutting down.\n"); + A5O_INFO("shutting down.\n"); /* Close all open displays. */ while (_al_vector_size(&s->displays) > 0) { - ALLEGRO_DISPLAY **dptr = _al_vector_ref(&s->displays, 0); - ALLEGRO_DISPLAY *d = *dptr; + A5O_DISPLAY **dptr = _al_vector_ref(&s->displays, 0); + A5O_DISPLAY *d = *dptr; al_destroy_display(d); } _al_vector_free(&s->displays); @@ -77,7 +77,7 @@ static void pi_shutdown_system(void) al_free(spi); } -static ALLEGRO_KEYBOARD_DRIVER *pi_get_keyboard_driver(void) +static A5O_KEYBOARD_DRIVER *pi_get_keyboard_driver(void) { if (getenv("DISPLAY")) { return _al_xwin_keyboard_driver(); @@ -85,7 +85,7 @@ static ALLEGRO_KEYBOARD_DRIVER *pi_get_keyboard_driver(void) return _al_linux_keyboard_driver_list[0].driver; } -static ALLEGRO_MOUSE_DRIVER *pi_get_mouse_driver(void) +static A5O_MOUSE_DRIVER *pi_get_mouse_driver(void) { if (getenv("DISPLAY")) { return _al_xwin_mouse_driver(); @@ -93,7 +93,7 @@ static ALLEGRO_MOUSE_DRIVER *pi_get_mouse_driver(void) return _al_linux_mouse_driver_list[0].driver; } -static ALLEGRO_JOYSTICK_DRIVER *pi_get_joystick_driver(void) +static A5O_JOYSTICK_DRIVER *pi_get_joystick_driver(void) { return _al_joystick_driver_list[0].driver; } @@ -103,7 +103,7 @@ static int pi_get_num_video_adapters(void) return 1; } -static bool pi_get_monitor_info(int adapter, ALLEGRO_MONITOR_INFO *info) +static bool pi_get_monitor_info(int adapter, A5O_MONITOR_INFO *info) { (void)adapter; int dx, dy, w, h; @@ -125,7 +125,7 @@ static bool pi_get_cursor_position(int *ret_x, int *ret_y) static bool pi_inhibit_screensaver(bool inhibit) { - ALLEGRO_SYSTEM_RASPBERRYPI *system = (void *)al_get_system_driver(); + A5O_SYSTEM_RASPBERRYPI *system = (void *)al_get_system_driver(); system->inhibit_screensaver = inhibit; return true; @@ -136,7 +136,7 @@ static int pi_get_num_display_modes(void) return 1; } -static ALLEGRO_DISPLAY_MODE *pi_get_display_mode(int mode, ALLEGRO_DISPLAY_MODE *dm) +static A5O_DISPLAY_MODE *pi_get_display_mode(int mode, A5O_DISPLAY_MODE *dm) { (void)mode; int dx, dy, w, h; @@ -148,38 +148,38 @@ static ALLEGRO_DISPLAY_MODE *pi_get_display_mode(int mode, ALLEGRO_DISPLAY_MODE return dm; } -static ALLEGRO_MOUSE_CURSOR *pi_create_mouse_cursor(ALLEGRO_BITMAP *bmp, int focus_x_ignored, int focus_y_ignored) +static A5O_MOUSE_CURSOR *pi_create_mouse_cursor(A5O_BITMAP *bmp, int focus_x_ignored, int focus_y_ignored) { (void)focus_x_ignored; (void)focus_y_ignored; - ALLEGRO_STATE state; - al_store_state(&state, ALLEGRO_STATE_NEW_BITMAP_PARAMETERS | ALLEGRO_STATE_TARGET_BITMAP); - al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ARGB_8888); - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); - ALLEGRO_BITMAP *cursor_bmp = al_clone_bitmap(bmp); - ALLEGRO_MOUSE_CURSOR_RASPBERRYPI *cursor = al_malloc(sizeof(ALLEGRO_MOUSE_CURSOR_RASPBERRYPI)); + A5O_STATE state; + al_store_state(&state, A5O_STATE_NEW_BITMAP_PARAMETERS | A5O_STATE_TARGET_BITMAP); + al_set_new_bitmap_format(A5O_PIXEL_FORMAT_ARGB_8888); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); + A5O_BITMAP *cursor_bmp = al_clone_bitmap(bmp); + A5O_MOUSE_CURSOR_RASPBERRYPI *cursor = al_malloc(sizeof(A5O_MOUSE_CURSOR_RASPBERRYPI)); cursor->bitmap = cursor_bmp; al_restore_state(&state); - return (ALLEGRO_MOUSE_CURSOR *)cursor; + return (A5O_MOUSE_CURSOR *)cursor; } -static void pi_destroy_mouse_cursor(ALLEGRO_MOUSE_CURSOR *cursor) +static void pi_destroy_mouse_cursor(A5O_MOUSE_CURSOR *cursor) { - ALLEGRO_MOUSE_CURSOR_RASPBERRYPI *pi_cursor = (void *)cursor; + A5O_MOUSE_CURSOR_RASPBERRYPI *pi_cursor = (void *)cursor; al_destroy_bitmap(pi_cursor->bitmap); al_free(pi_cursor); } /* Internal function to get a reference to this driver. */ -ALLEGRO_SYSTEM_INTERFACE *_al_system_raspberrypi_driver(void) +A5O_SYSTEM_INTERFACE *_al_system_raspberrypi_driver(void) { if (pi_vt) return pi_vt; pi_vt = al_calloc(1, sizeof *pi_vt); - pi_vt->id = ALLEGRO_SYSTEM_ID_RASPBERRYPI; + pi_vt->id = A5O_SYSTEM_ID_RASPBERRYPI; pi_vt->initialize = pi_initialize; pi_vt->get_display_driver = _al_get_raspberrypi_display_interface; pi_vt->get_keyboard_driver = pi_get_keyboard_driver; diff --git a/src/scanline_drawers.inc b/src/scanline_drawers.inc index 8cea12369d..a2afcc3736 100644 --- a/src/scanline_drawers.inc +++ b/src/scanline_drawers.inc @@ -8,9 +8,9 @@ static void shader_solid_any_draw_shade(uintptr_t state, int x1, int y, int x2) { state_solid_any_2d *s = (state_solid_any_2d *) state; - ALLEGRO_COLOR cur_color = s->cur_color; + A5O_COLOR cur_color = s->cur_color; - ALLEGRO_BITMAP *target = s->target; + A5O_BITMAP *target = s->target; if (target->parent) { x1 += target->xofs; @@ -40,7 +40,7 @@ static void shader_solid_any_draw_shade(uintptr_t state, int x1, int y, int x2) { int op, src_mode, dst_mode; int op_alpha, src_alpha, dst_alpha; - ALLEGRO_COLOR const_color; + A5O_COLOR const_color; al_get_separate_bitmap_blender(&op, &src_mode, &dst_mode, &op_alpha, &src_alpha, &dst_alpha); const_color = al_get_blend_color(); @@ -49,71 +49,71 @@ static void shader_solid_any_draw_shade(uintptr_t state, int x1, int y, int x2) const int dst_format = target->locked_region.format; uint8_t *dst_data = (uint8_t *) target->lock_data + y * target->locked_region.pitch + x1 * target->locked_region.pixel_size; - if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ONE && src_alpha == ALLEGRO_ONE && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_INVERSE_ALPHA && dst_alpha == ALLEGRO_INVERSE_ALPHA) { + if (op == A5O_ADD && src_mode == A5O_ONE && src_alpha == A5O_ONE && op_alpha == A5O_ADD && dst_mode == A5O_INVERSE_ALPHA && dst_alpha == A5O_INVERSE_ALPHA) { { { for (; x1 <= x2; x1++) { - ALLEGRO_COLOR src_color = cur_color; + A5O_COLOR src_color = cur_color; { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } } } } - } else if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ALPHA && src_alpha == ALLEGRO_ALPHA && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_INVERSE_ALPHA && dst_alpha == ALLEGRO_INVERSE_ALPHA) { + } else if (op == A5O_ADD && src_mode == A5O_ALPHA && src_alpha == A5O_ALPHA && op_alpha == A5O_ADD && dst_mode == A5O_INVERSE_ALPHA && dst_alpha == A5O_INVERSE_ALPHA) { { { for (; x1 <= x2; x1++) { - ALLEGRO_COLOR src_color = cur_color; + A5O_COLOR src_color = cur_color; { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } } } } - } else if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ONE && src_alpha == ALLEGRO_ONE && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_ONE && dst_alpha == ALLEGRO_ONE) { + } else if (op == A5O_ADD && src_mode == A5O_ONE && src_alpha == A5O_ONE && op_alpha == A5O_ADD && dst_mode == A5O_ONE && dst_alpha == A5O_ONE) { { { for (; x1 <= x2; x1++) { - ALLEGRO_COLOR src_color = cur_color; + A5O_COLOR src_color = cur_color; { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_ONE, A5O_ADD, A5O_ONE, A5O_ONE, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } } } } - } else if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + } else if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888) { { for (; x1 <= x2; x1++) { - ALLEGRO_COLOR src_color = cur_color; + A5O_COLOR src_color = cur_color; { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); _al_blend_inline(&src_color, &dst_color, op, src_mode, dst_mode, op_alpha, src_alpha, dst_alpha, &const_color, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } } @@ -121,11 +121,11 @@ static void shader_solid_any_draw_shade(uintptr_t state, int x1, int y, int x2) } else { { for (; x1 <= x2; x1++) { - ALLEGRO_COLOR src_color = cur_color; + A5O_COLOR src_color = cur_color; { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); _al_blend_inline(&src_color, &dst_color, op, src_mode, dst_mode, op_alpha, src_alpha, dst_alpha, &const_color, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); @@ -142,9 +142,9 @@ static void shader_solid_any_draw_shade(uintptr_t state, int x1, int y, int x2) static void shader_solid_any_draw_opaque(uintptr_t state, int x1, int y, int x2) { state_solid_any_2d *s = (state_solid_any_2d *) state; - ALLEGRO_COLOR cur_color = s->cur_color; + A5O_COLOR cur_color = s->cur_color; - ALLEGRO_BITMAP *target = s->target; + A5O_BITMAP *target = s->target; if (target->parent) { x1 += target->xofs; @@ -177,19 +177,19 @@ static void shader_solid_any_draw_opaque(uintptr_t state, int x1, int y, int x2) const int dst_format = target->locked_region.format; uint8_t *dst_data = (uint8_t *) target->lock_data + y * target->locked_region.pitch + x1 * target->locked_region.pixel_size; - if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888) { { for (; x1 <= x2; x1++) { - ALLEGRO_COLOR src_color = cur_color; + A5O_COLOR src_color = cur_color; - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, src_color, true); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, src_color, true); } } } else { { for (; x1 <= x2; x1++) { - ALLEGRO_COLOR src_color = cur_color; + A5O_COLOR src_color = cur_color; _AL_INLINE_PUT_PIXEL(dst_format, dst_data, src_color, true); @@ -205,9 +205,9 @@ static void shader_grad_any_draw_shade(uintptr_t state, int x1, int y, int x2) { state_grad_any_2d *gs = (state_grad_any_2d *) state; state_solid_any_2d *s = &gs->solid; - ALLEGRO_COLOR cur_color = s->cur_color; + A5O_COLOR cur_color = s->cur_color; - ALLEGRO_BITMAP *target = s->target; + A5O_BITMAP *target = s->target; if (target->parent) { x1 += target->xofs; @@ -242,7 +242,7 @@ static void shader_grad_any_draw_shade(uintptr_t state, int x1, int y, int x2) { int op, src_mode, dst_mode; int op_alpha, src_alpha, dst_alpha; - ALLEGRO_COLOR const_color; + A5O_COLOR const_color; al_get_separate_bitmap_blender(&op, &src_mode, &dst_mode, &op_alpha, &src_alpha, &dst_alpha); const_color = al_get_blend_color(); @@ -251,18 +251,18 @@ static void shader_grad_any_draw_shade(uintptr_t state, int x1, int y, int x2) const int dst_format = target->locked_region.format; uint8_t *dst_data = (uint8_t *) target->lock_data + y * target->locked_region.pitch + x1 * target->locked_region.pixel_size; - if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ONE && src_alpha == ALLEGRO_ONE && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_INVERSE_ALPHA && dst_alpha == ALLEGRO_INVERSE_ALPHA) { + if (op == A5O_ADD && src_mode == A5O_ONE && src_alpha == A5O_ONE && op_alpha == A5O_ADD && dst_mode == A5O_INVERSE_ALPHA && dst_alpha == A5O_INVERSE_ALPHA) { { { for (; x1 <= x2; x1++) { - ALLEGRO_COLOR src_color = cur_color; + A5O_COLOR src_color = cur_color; { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } @@ -274,18 +274,18 @@ static void shader_grad_any_draw_shade(uintptr_t state, int x1, int y, int x2) } } } - } else if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ALPHA && src_alpha == ALLEGRO_ALPHA && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_INVERSE_ALPHA && dst_alpha == ALLEGRO_INVERSE_ALPHA) { + } else if (op == A5O_ADD && src_mode == A5O_ALPHA && src_alpha == A5O_ALPHA && op_alpha == A5O_ADD && dst_mode == A5O_INVERSE_ALPHA && dst_alpha == A5O_INVERSE_ALPHA) { { { for (; x1 <= x2; x1++) { - ALLEGRO_COLOR src_color = cur_color; + A5O_COLOR src_color = cur_color; { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } @@ -297,18 +297,18 @@ static void shader_grad_any_draw_shade(uintptr_t state, int x1, int y, int x2) } } } - } else if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ONE && src_alpha == ALLEGRO_ONE && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_ONE && dst_alpha == ALLEGRO_ONE) { + } else if (op == A5O_ADD && src_mode == A5O_ONE && src_alpha == A5O_ONE && op_alpha == A5O_ADD && dst_mode == A5O_ONE && dst_alpha == A5O_ONE) { { { for (; x1 <= x2; x1++) { - ALLEGRO_COLOR src_color = cur_color; + A5O_COLOR src_color = cur_color; { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_ONE, A5O_ADD, A5O_ONE, A5O_ONE, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } @@ -320,17 +320,17 @@ static void shader_grad_any_draw_shade(uintptr_t state, int x1, int y, int x2) } } } - } else if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + } else if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888) { { for (; x1 <= x2; x1++) { - ALLEGRO_COLOR src_color = cur_color; + A5O_COLOR src_color = cur_color; { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); _al_blend_inline(&src_color, &dst_color, op, src_mode, dst_mode, op_alpha, src_alpha, dst_alpha, &const_color, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } cur_color.r += gs->color_dx.r; @@ -343,11 +343,11 @@ static void shader_grad_any_draw_shade(uintptr_t state, int x1, int y, int x2) } else { { for (; x1 <= x2; x1++) { - ALLEGRO_COLOR src_color = cur_color; + A5O_COLOR src_color = cur_color; { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); _al_blend_inline(&src_color, &dst_color, op, src_mode, dst_mode, op_alpha, src_alpha, dst_alpha, &const_color, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); @@ -370,9 +370,9 @@ static void shader_grad_any_draw_opaque(uintptr_t state, int x1, int y, int x2) { state_grad_any_2d *gs = (state_grad_any_2d *) state; state_solid_any_2d *s = &gs->solid; - ALLEGRO_COLOR cur_color = s->cur_color; + A5O_COLOR cur_color = s->cur_color; - ALLEGRO_BITMAP *target = s->target; + A5O_BITMAP *target = s->target; if (target->parent) { x1 += target->xofs; @@ -410,12 +410,12 @@ static void shader_grad_any_draw_opaque(uintptr_t state, int x1, int y, int x2) const int dst_format = target->locked_region.format; uint8_t *dst_data = (uint8_t *) target->lock_data + y * target->locked_region.pitch + x1 * target->locked_region.pixel_size; - if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888) { { for (; x1 <= x2; x1++) { - ALLEGRO_COLOR src_color = cur_color; + A5O_COLOR src_color = cur_color; - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, src_color, true); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, src_color, true); cur_color.r += gs->color_dx.r; cur_color.g += gs->color_dx.g; @@ -427,7 +427,7 @@ static void shader_grad_any_draw_opaque(uintptr_t state, int x1, int y, int x2) } else { { for (; x1 <= x2; x1++) { - ALLEGRO_COLOR src_color = cur_color; + A5O_COLOR src_color = cur_color; _AL_INLINE_PUT_PIXEL(dst_format, dst_data, src_color, true); @@ -451,7 +451,7 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, float u = s->u; float v = s->v; - ALLEGRO_BITMAP *target = s->target; + A5O_BITMAP *target = s->target; if (target->parent) { x1 += target->xofs; @@ -484,17 +484,17 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, { int op, src_mode, dst_mode; int op_alpha, src_alpha, dst_alpha; - ALLEGRO_COLOR const_color; + A5O_COLOR const_color; al_get_separate_bitmap_blender(&op, &src_mode, &dst_mode, &op_alpha, &src_alpha, &dst_alpha); const_color = al_get_blend_color(); { const int offset_x = s->texture->parent ? s->texture->xofs : 0; const int offset_y = s->texture->parent ? s->texture->yofs : 0; - ALLEGRO_BITMAP *texture = s->texture->parent ? s->texture->parent : s->texture; + A5O_BITMAP *texture = s->texture->parent ? s->texture->parent : s->texture; const int src_format = texture->locked_region.format; const int src_size = texture->locked_region.pixel_size; - ALLEGRO_BITMAP_WRAP wrap_u, wrap_v; + A5O_BITMAP_WRAP wrap_u, wrap_v; _al_get_bitmap_wrap(texture, &wrap_u, &wrap_v); int tile_u = (int) (floorf(u / s->w)); int tile_v = (int) (floorf(v / s->h)); @@ -515,9 +515,9 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, const int dst_format = target->locked_region.format; uint8_t *dst_data = (uint8_t *) target->lock_data + y * target->locked_region.pitch + x1 * target->locked_region.pixel_size; - if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ONE && src_alpha == ALLEGRO_ONE && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_INVERSE_ALPHA && dst_alpha == ALLEGRO_INVERSE_ALPHA) { + if (op == A5O_ADD && src_mode == A5O_ONE && src_alpha == A5O_ONE && op_alpha == A5O_ADD && dst_mode == A5O_INVERSE_ALPHA && dst_alpha == A5O_INVERSE_ALPHA) { - if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -536,13 +536,13 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -551,13 +551,13 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -567,17 +567,17 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, NULL, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, NULL, &result); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -620,13 +620,13 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -635,13 +635,13 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -651,16 +651,16 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } @@ -686,9 +686,9 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, } } } - } else if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ALPHA && src_alpha == ALLEGRO_ALPHA && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_INVERSE_ALPHA && dst_alpha == ALLEGRO_INVERSE_ALPHA) { + } else if (op == A5O_ADD && src_mode == A5O_ALPHA && src_alpha == A5O_ALPHA && op_alpha == A5O_ADD && dst_mode == A5O_INVERSE_ALPHA && dst_alpha == A5O_INVERSE_ALPHA) { - if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -707,13 +707,13 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -722,13 +722,13 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -738,17 +738,17 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, NULL, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, NULL, &result); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -791,13 +791,13 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -806,13 +806,13 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -822,16 +822,16 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } @@ -857,9 +857,9 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, } } } - } else if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ONE && src_alpha == ALLEGRO_ONE && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_ONE && dst_alpha == ALLEGRO_ONE) { + } else if (op == A5O_ADD && src_mode == A5O_ONE && src_alpha == A5O_ONE && op_alpha == A5O_ADD && dst_mode == A5O_ONE && dst_alpha == A5O_ONE) { - if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -878,13 +878,13 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -893,13 +893,13 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -909,17 +909,17 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, NULL, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_ONE, A5O_ADD, A5O_ONE, A5O_ONE, NULL, &result); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -962,13 +962,13 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -977,13 +977,13 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -993,16 +993,16 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_ONE, A5O_ADD, A5O_ONE, A5O_ONE, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } @@ -1028,7 +1028,7 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, } } } - } else if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + } else if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -1047,13 +1047,13 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -1062,13 +1062,13 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -1078,17 +1078,17 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); _al_blend_inline(&src_color, &dst_color, op, src_mode, dst_mode, op_alpha, src_alpha, dst_alpha, &const_color, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -1131,13 +1131,13 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -1146,13 +1146,13 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -1162,14 +1162,14 @@ static void shader_texture_solid_any_draw_shade(uintptr_t state, int x1, int y, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); _al_blend_inline(&src_color, &dst_color, op, src_mode, dst_mode, op_alpha, src_alpha, dst_alpha, &const_color, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); @@ -1209,7 +1209,7 @@ static void shader_texture_solid_any_draw_shade_repeat(uintptr_t state, int x1, float u = s->u; float v = s->v; - ALLEGRO_BITMAP *target = s->target; + A5O_BITMAP *target = s->target; if (target->parent) { x1 += target->xofs; @@ -1242,17 +1242,17 @@ static void shader_texture_solid_any_draw_shade_repeat(uintptr_t state, int x1, { int op, src_mode, dst_mode; int op_alpha, src_alpha, dst_alpha; - ALLEGRO_COLOR const_color; + A5O_COLOR const_color; al_get_separate_bitmap_blender(&op, &src_mode, &dst_mode, &op_alpha, &src_alpha, &dst_alpha); const_color = al_get_blend_color(); { const int offset_x = s->texture->parent ? s->texture->xofs : 0; const int offset_y = s->texture->parent ? s->texture->yofs : 0; - ALLEGRO_BITMAP *texture = s->texture->parent ? s->texture->parent : s->texture; + A5O_BITMAP *texture = s->texture->parent ? s->texture->parent : s->texture; const int src_format = texture->locked_region.format; const int src_size = texture->locked_region.pixel_size; - ALLEGRO_BITMAP_WRAP wrap_u, wrap_v; + A5O_BITMAP_WRAP wrap_u, wrap_v; _al_get_bitmap_wrap(texture, &wrap_u, &wrap_v); int tile_u = (int) (floorf(u / s->w)); int tile_v = (int) (floorf(v / s->h)); @@ -1273,9 +1273,9 @@ static void shader_texture_solid_any_draw_shade_repeat(uintptr_t state, int x1, const int dst_format = target->locked_region.format; uint8_t *dst_data = (uint8_t *) target->lock_data + y * target->locked_region.pitch + x1 * target->locked_region.pixel_size; - if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ONE && src_alpha == ALLEGRO_ONE && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_INVERSE_ALPHA && dst_alpha == ALLEGRO_INVERSE_ALPHA) { + if (op == A5O_ADD && src_mode == A5O_ONE && src_alpha == A5O_ONE && op_alpha == A5O_ADD && dst_mode == A5O_INVERSE_ALPHA && dst_alpha == A5O_INVERSE_ALPHA) { - if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -1295,17 +1295,17 @@ static void shader_texture_solid_any_draw_shade_repeat(uintptr_t state, int x1, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, NULL, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, NULL, &result); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -1349,16 +1349,16 @@ static void shader_texture_solid_any_draw_shade_repeat(uintptr_t state, int x1, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } @@ -1384,9 +1384,9 @@ static void shader_texture_solid_any_draw_shade_repeat(uintptr_t state, int x1, } } } - } else if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ALPHA && src_alpha == ALLEGRO_ALPHA && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_INVERSE_ALPHA && dst_alpha == ALLEGRO_INVERSE_ALPHA) { + } else if (op == A5O_ADD && src_mode == A5O_ALPHA && src_alpha == A5O_ALPHA && op_alpha == A5O_ADD && dst_mode == A5O_INVERSE_ALPHA && dst_alpha == A5O_INVERSE_ALPHA) { - if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -1406,17 +1406,17 @@ static void shader_texture_solid_any_draw_shade_repeat(uintptr_t state, int x1, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, NULL, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, NULL, &result); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -1460,16 +1460,16 @@ static void shader_texture_solid_any_draw_shade_repeat(uintptr_t state, int x1, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } @@ -1495,9 +1495,9 @@ static void shader_texture_solid_any_draw_shade_repeat(uintptr_t state, int x1, } } } - } else if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ONE && src_alpha == ALLEGRO_ONE && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_ONE && dst_alpha == ALLEGRO_ONE) { + } else if (op == A5O_ADD && src_mode == A5O_ONE && src_alpha == A5O_ONE && op_alpha == A5O_ADD && dst_mode == A5O_ONE && dst_alpha == A5O_ONE) { - if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -1517,17 +1517,17 @@ static void shader_texture_solid_any_draw_shade_repeat(uintptr_t state, int x1, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, NULL, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_ONE, A5O_ADD, A5O_ONE, A5O_ONE, NULL, &result); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -1571,16 +1571,16 @@ static void shader_texture_solid_any_draw_shade_repeat(uintptr_t state, int x1, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_ONE, A5O_ADD, A5O_ONE, A5O_ONE, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } @@ -1606,7 +1606,7 @@ static void shader_texture_solid_any_draw_shade_repeat(uintptr_t state, int x1, } } } - } else if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + } else if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -1625,13 +1625,13 @@ static void shader_texture_solid_any_draw_shade_repeat(uintptr_t state, int x1, int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -1640,13 +1640,13 @@ static void shader_texture_solid_any_draw_shade_repeat(uintptr_t state, int x1, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -1656,17 +1656,17 @@ static void shader_texture_solid_any_draw_shade_repeat(uintptr_t state, int x1, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); _al_blend_inline(&src_color, &dst_color, op, src_mode, dst_mode, op_alpha, src_alpha, dst_alpha, &const_color, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -1709,13 +1709,13 @@ static void shader_texture_solid_any_draw_shade_repeat(uintptr_t state, int x1, int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -1724,13 +1724,13 @@ static void shader_texture_solid_any_draw_shade_repeat(uintptr_t state, int x1, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -1740,14 +1740,14 @@ static void shader_texture_solid_any_draw_shade_repeat(uintptr_t state, int x1, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); _al_blend_inline(&src_color, &dst_color, op, src_mode, dst_mode, op_alpha, src_alpha, dst_alpha, &const_color, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); @@ -1787,7 +1787,7 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i float u = s->u; float v = s->v; - ALLEGRO_BITMAP *target = s->target; + A5O_BITMAP *target = s->target; if (target->parent) { x1 += target->xofs; @@ -1820,17 +1820,17 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i { int op, src_mode, dst_mode; int op_alpha, src_alpha, dst_alpha; - ALLEGRO_COLOR const_color; + A5O_COLOR const_color; al_get_separate_bitmap_blender(&op, &src_mode, &dst_mode, &op_alpha, &src_alpha, &dst_alpha); const_color = al_get_blend_color(); { const int offset_x = s->texture->parent ? s->texture->xofs : 0; const int offset_y = s->texture->parent ? s->texture->yofs : 0; - ALLEGRO_BITMAP *texture = s->texture->parent ? s->texture->parent : s->texture; + A5O_BITMAP *texture = s->texture->parent ? s->texture->parent : s->texture; const int src_format = texture->locked_region.format; const int src_size = texture->locked_region.pixel_size; - ALLEGRO_BITMAP_WRAP wrap_u, wrap_v; + A5O_BITMAP_WRAP wrap_u, wrap_v; _al_get_bitmap_wrap(texture, &wrap_u, &wrap_v); int tile_u = (int) (floorf(u / s->w)); int tile_v = (int) (floorf(v / s->h)); @@ -1851,9 +1851,9 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i const int dst_format = target->locked_region.format; uint8_t *dst_data = (uint8_t *) target->lock_data + y * target->locked_region.pitch + x1 * target->locked_region.pixel_size; - if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ONE && src_alpha == ALLEGRO_ONE && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_INVERSE_ALPHA && dst_alpha == ALLEGRO_INVERSE_ALPHA) { + if (op == A5O_ADD && src_mode == A5O_ONE && src_alpha == A5O_ONE && op_alpha == A5O_ADD && dst_mode == A5O_INVERSE_ALPHA && dst_alpha == A5O_INVERSE_ALPHA) { - if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -1872,13 +1872,13 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -1887,13 +1887,13 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -1903,15 +1903,15 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, NULL, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, NULL, &result); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -1954,13 +1954,13 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -1969,13 +1969,13 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -1985,14 +1985,14 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } @@ -2018,9 +2018,9 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i } } } - } else if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ALPHA && src_alpha == ALLEGRO_ALPHA && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_INVERSE_ALPHA && dst_alpha == ALLEGRO_INVERSE_ALPHA) { + } else if (op == A5O_ADD && src_mode == A5O_ALPHA && src_alpha == A5O_ALPHA && op_alpha == A5O_ADD && dst_mode == A5O_INVERSE_ALPHA && dst_alpha == A5O_INVERSE_ALPHA) { - if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -2039,13 +2039,13 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -2054,13 +2054,13 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -2070,15 +2070,15 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, NULL, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, NULL, &result); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -2121,13 +2121,13 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -2136,13 +2136,13 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -2152,14 +2152,14 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } @@ -2185,9 +2185,9 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i } } } - } else if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ONE && src_alpha == ALLEGRO_ONE && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_ONE && dst_alpha == ALLEGRO_ONE) { + } else if (op == A5O_ADD && src_mode == A5O_ONE && src_alpha == A5O_ONE && op_alpha == A5O_ADD && dst_mode == A5O_ONE && dst_alpha == A5O_ONE) { - if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -2206,13 +2206,13 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -2221,13 +2221,13 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -2237,15 +2237,15 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, NULL, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_ONE, A5O_ADD, A5O_ONE, A5O_ONE, NULL, &result); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -2288,13 +2288,13 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -2303,13 +2303,13 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -2319,14 +2319,14 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_ONE, A5O_ADD, A5O_ONE, A5O_ONE, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } @@ -2352,7 +2352,7 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i } } } - } else if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + } else if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -2371,13 +2371,13 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -2386,13 +2386,13 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -2402,15 +2402,15 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); _al_blend_inline(&src_color, &dst_color, op, src_mode, dst_mode, op_alpha, src_alpha, dst_alpha, &const_color, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -2453,13 +2453,13 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -2468,13 +2468,13 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -2484,12 +2484,12 @@ static void shader_texture_solid_any_draw_shade_white(uintptr_t state, int x1, i uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); _al_blend_inline(&src_color, &dst_color, op, src_mode, dst_mode, op_alpha, src_alpha, dst_alpha, &const_color, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); @@ -2529,7 +2529,7 @@ static void shader_texture_solid_any_draw_shade_white_repeat(uintptr_t state, in float u = s->u; float v = s->v; - ALLEGRO_BITMAP *target = s->target; + A5O_BITMAP *target = s->target; if (target->parent) { x1 += target->xofs; @@ -2562,17 +2562,17 @@ static void shader_texture_solid_any_draw_shade_white_repeat(uintptr_t state, in { int op, src_mode, dst_mode; int op_alpha, src_alpha, dst_alpha; - ALLEGRO_COLOR const_color; + A5O_COLOR const_color; al_get_separate_bitmap_blender(&op, &src_mode, &dst_mode, &op_alpha, &src_alpha, &dst_alpha); const_color = al_get_blend_color(); { const int offset_x = s->texture->parent ? s->texture->xofs : 0; const int offset_y = s->texture->parent ? s->texture->yofs : 0; - ALLEGRO_BITMAP *texture = s->texture->parent ? s->texture->parent : s->texture; + A5O_BITMAP *texture = s->texture->parent ? s->texture->parent : s->texture; const int src_format = texture->locked_region.format; const int src_size = texture->locked_region.pixel_size; - ALLEGRO_BITMAP_WRAP wrap_u, wrap_v; + A5O_BITMAP_WRAP wrap_u, wrap_v; _al_get_bitmap_wrap(texture, &wrap_u, &wrap_v); int tile_u = (int) (floorf(u / s->w)); int tile_v = (int) (floorf(v / s->h)); @@ -2593,9 +2593,9 @@ static void shader_texture_solid_any_draw_shade_white_repeat(uintptr_t state, in const int dst_format = target->locked_region.format; uint8_t *dst_data = (uint8_t *) target->lock_data + y * target->locked_region.pitch + x1 * target->locked_region.pixel_size; - if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ONE && src_alpha == ALLEGRO_ONE && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_INVERSE_ALPHA && dst_alpha == ALLEGRO_INVERSE_ALPHA) { + if (op == A5O_ADD && src_mode == A5O_ONE && src_alpha == A5O_ONE && op_alpha == A5O_ADD && dst_mode == A5O_INVERSE_ALPHA && dst_alpha == A5O_INVERSE_ALPHA) { - if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -2615,15 +2615,15 @@ static void shader_texture_solid_any_draw_shade_white_repeat(uintptr_t state, in uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, NULL, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, NULL, &result); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -2667,14 +2667,14 @@ static void shader_texture_solid_any_draw_shade_white_repeat(uintptr_t state, in uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } @@ -2700,9 +2700,9 @@ static void shader_texture_solid_any_draw_shade_white_repeat(uintptr_t state, in } } } - } else if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ALPHA && src_alpha == ALLEGRO_ALPHA && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_INVERSE_ALPHA && dst_alpha == ALLEGRO_INVERSE_ALPHA) { + } else if (op == A5O_ADD && src_mode == A5O_ALPHA && src_alpha == A5O_ALPHA && op_alpha == A5O_ADD && dst_mode == A5O_INVERSE_ALPHA && dst_alpha == A5O_INVERSE_ALPHA) { - if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -2722,15 +2722,15 @@ static void shader_texture_solid_any_draw_shade_white_repeat(uintptr_t state, in uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, NULL, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, NULL, &result); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -2774,14 +2774,14 @@ static void shader_texture_solid_any_draw_shade_white_repeat(uintptr_t state, in uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } @@ -2807,9 +2807,9 @@ static void shader_texture_solid_any_draw_shade_white_repeat(uintptr_t state, in } } } - } else if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ONE && src_alpha == ALLEGRO_ONE && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_ONE && dst_alpha == ALLEGRO_ONE) { + } else if (op == A5O_ADD && src_mode == A5O_ONE && src_alpha == A5O_ONE && op_alpha == A5O_ADD && dst_mode == A5O_ONE && dst_alpha == A5O_ONE) { - if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -2829,15 +2829,15 @@ static void shader_texture_solid_any_draw_shade_white_repeat(uintptr_t state, in uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, NULL, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_ONE, A5O_ADD, A5O_ONE, A5O_ONE, NULL, &result); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -2881,14 +2881,14 @@ static void shader_texture_solid_any_draw_shade_white_repeat(uintptr_t state, in uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_ONE, A5O_ADD, A5O_ONE, A5O_ONE, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } @@ -2914,7 +2914,7 @@ static void shader_texture_solid_any_draw_shade_white_repeat(uintptr_t state, in } } } - } else if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + } else if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -2933,13 +2933,13 @@ static void shader_texture_solid_any_draw_shade_white_repeat(uintptr_t state, in int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -2948,13 +2948,13 @@ static void shader_texture_solid_any_draw_shade_white_repeat(uintptr_t state, in } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -2964,15 +2964,15 @@ static void shader_texture_solid_any_draw_shade_white_repeat(uintptr_t state, in uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); _al_blend_inline(&src_color, &dst_color, op, src_mode, dst_mode, op_alpha, src_alpha, dst_alpha, &const_color, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -3015,13 +3015,13 @@ static void shader_texture_solid_any_draw_shade_white_repeat(uintptr_t state, in int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -3030,13 +3030,13 @@ static void shader_texture_solid_any_draw_shade_white_repeat(uintptr_t state, in } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -3046,12 +3046,12 @@ static void shader_texture_solid_any_draw_shade_white_repeat(uintptr_t state, in uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); _al_blend_inline(&src_color, &dst_color, op, src_mode, dst_mode, op_alpha, src_alpha, dst_alpha, &const_color, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); @@ -3091,7 +3091,7 @@ static void shader_texture_solid_any_draw_opaque(uintptr_t state, int x1, int y, float u = s->u; float v = s->v; - ALLEGRO_BITMAP *target = s->target; + A5O_BITMAP *target = s->target; if (target->parent) { x1 += target->xofs; @@ -3125,10 +3125,10 @@ static void shader_texture_solid_any_draw_opaque(uintptr_t state, int x1, int y, { const int offset_x = s->texture->parent ? s->texture->xofs : 0; const int offset_y = s->texture->parent ? s->texture->yofs : 0; - ALLEGRO_BITMAP *texture = s->texture->parent ? s->texture->parent : s->texture; + A5O_BITMAP *texture = s->texture->parent ? s->texture->parent : s->texture; const int src_format = texture->locked_region.format; const int src_size = texture->locked_region.pixel_size; - ALLEGRO_BITMAP_WRAP wrap_u, wrap_v; + A5O_BITMAP_WRAP wrap_u, wrap_v; _al_get_bitmap_wrap(texture, &wrap_u, &wrap_v); int tile_u = (int) (floorf(u / s->w)); int tile_v = (int) (floorf(v / s->h)); @@ -3149,7 +3149,7 @@ static void shader_texture_solid_any_draw_opaque(uintptr_t state, int x1, int y, const int dst_format = target->locked_region.format; uint8_t *dst_data = (uint8_t *) target->lock_data + y * target->locked_region.pitch + x1 * target->locked_region.pixel_size; - if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -3169,13 +3169,13 @@ static void shader_texture_solid_any_draw_opaque(uintptr_t state, int x1, int y, int src_y = (vv >> 16) + 0; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -3184,13 +3184,13 @@ static void shader_texture_solid_any_draw_opaque(uintptr_t state, int x1, int y, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -3200,12 +3200,12 @@ static void shader_texture_solid_any_draw_opaque(uintptr_t state, int x1, int y, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, src_color, true); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, src_color, true); uu += du_dx; vv += dv_dx; @@ -3225,13 +3225,13 @@ static void shader_texture_solid_any_draw_opaque(uintptr_t state, int x1, int y, int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -3240,13 +3240,13 @@ static void shader_texture_solid_any_draw_opaque(uintptr_t state, int x1, int y, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -3256,12 +3256,12 @@ static void shader_texture_solid_any_draw_opaque(uintptr_t state, int x1, int y, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, src_color, true); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, src_color, true); uu += du_dx; vv += dv_dx; @@ -3304,13 +3304,13 @@ static void shader_texture_solid_any_draw_opaque(uintptr_t state, int x1, int y, int src_y = (vv >> 16) + 0; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -3319,13 +3319,13 @@ static void shader_texture_solid_any_draw_opaque(uintptr_t state, int x1, int y, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -3335,7 +3335,7 @@ static void shader_texture_solid_any_draw_opaque(uintptr_t state, int x1, int y, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); @@ -3360,13 +3360,13 @@ static void shader_texture_solid_any_draw_opaque(uintptr_t state, int x1, int y, int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -3375,13 +3375,13 @@ static void shader_texture_solid_any_draw_opaque(uintptr_t state, int x1, int y, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -3391,7 +3391,7 @@ static void shader_texture_solid_any_draw_opaque(uintptr_t state, int x1, int y, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); SHADE_COLORS(src_color, s->cur_color); @@ -3432,7 +3432,7 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, float u = s->u; float v = s->v; - ALLEGRO_BITMAP *target = s->target; + A5O_BITMAP *target = s->target; if (target->parent) { x1 += target->xofs; @@ -3466,10 +3466,10 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, { const int offset_x = s->texture->parent ? s->texture->xofs : 0; const int offset_y = s->texture->parent ? s->texture->yofs : 0; - ALLEGRO_BITMAP *texture = s->texture->parent ? s->texture->parent : s->texture; + A5O_BITMAP *texture = s->texture->parent ? s->texture->parent : s->texture; const int src_format = texture->locked_region.format; const int src_size = texture->locked_region.pixel_size; - ALLEGRO_BITMAP_WRAP wrap_u, wrap_v; + A5O_BITMAP_WRAP wrap_u, wrap_v; _al_get_bitmap_wrap(texture, &wrap_u, &wrap_v); int tile_u = (int) (floorf(u / s->w)); int tile_v = (int) (floorf(v / s->h)); @@ -3510,13 +3510,13 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, int src_y = (vv >> 16) + 0; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -3525,13 +3525,13 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -3577,13 +3577,13 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -3592,13 +3592,13 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -3667,13 +3667,13 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, int src_y = (vv >> 16) + 0; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -3682,13 +3682,13 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -3734,13 +3734,13 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -3749,13 +3749,13 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -3824,13 +3824,13 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, int src_y = (vv >> 16) + 0; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -3839,13 +3839,13 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -3891,13 +3891,13 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -3906,13 +3906,13 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -3981,13 +3981,13 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, int src_y = (vv >> 16) + 0; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -3996,13 +3996,13 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -4012,7 +4012,7 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, src_color, true); @@ -4035,13 +4035,13 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -4050,13 +4050,13 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -4066,7 +4066,7 @@ static void shader_texture_solid_any_draw_opaque_white(uintptr_t state, int x1, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, src_color, true); @@ -4102,12 +4102,12 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i { state_texture_grad_any_2d *gs = (state_texture_grad_any_2d *) state; state_texture_solid_any_2d *s = &gs->solid; - ALLEGRO_COLOR cur_color = s->cur_color; + A5O_COLOR cur_color = s->cur_color; float u = s->u; float v = s->v; - ALLEGRO_BITMAP *target = s->target; + A5O_BITMAP *target = s->target; if (target->parent) { x1 += target->xofs; @@ -4145,17 +4145,17 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i { int op, src_mode, dst_mode; int op_alpha, src_alpha, dst_alpha; - ALLEGRO_COLOR const_color; + A5O_COLOR const_color; al_get_separate_bitmap_blender(&op, &src_mode, &dst_mode, &op_alpha, &src_alpha, &dst_alpha); const_color = al_get_blend_color(); { const int offset_x = s->texture->parent ? s->texture->xofs : 0; const int offset_y = s->texture->parent ? s->texture->yofs : 0; - ALLEGRO_BITMAP *texture = s->texture->parent ? s->texture->parent : s->texture; + A5O_BITMAP *texture = s->texture->parent ? s->texture->parent : s->texture; const int src_format = texture->locked_region.format; const int src_size = texture->locked_region.pixel_size; - ALLEGRO_BITMAP_WRAP wrap_u, wrap_v; + A5O_BITMAP_WRAP wrap_u, wrap_v; _al_get_bitmap_wrap(texture, &wrap_u, &wrap_v); int tile_u = (int) (floorf(u / s->w)); int tile_v = (int) (floorf(v / s->h)); @@ -4176,9 +4176,9 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i const int dst_format = target->locked_region.format; uint8_t *dst_data = (uint8_t *) target->lock_data + y * target->locked_region.pitch + x1 * target->locked_region.pixel_size; - if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ONE && src_alpha == ALLEGRO_ONE && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_INVERSE_ALPHA && dst_alpha == ALLEGRO_INVERSE_ALPHA) { + if (op == A5O_ADD && src_mode == A5O_ONE && src_alpha == A5O_ONE && op_alpha == A5O_ADD && dst_mode == A5O_INVERSE_ALPHA && dst_alpha == A5O_INVERSE_ALPHA) { - if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -4197,13 +4197,13 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -4212,13 +4212,13 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -4228,17 +4228,17 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); SHADE_COLORS(src_color, cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, NULL, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, NULL, &result); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -4286,13 +4286,13 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -4301,13 +4301,13 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -4317,16 +4317,16 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); SHADE_COLORS(src_color, cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } @@ -4357,9 +4357,9 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i } } } - } else if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ALPHA && src_alpha == ALLEGRO_ALPHA && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_INVERSE_ALPHA && dst_alpha == ALLEGRO_INVERSE_ALPHA) { + } else if (op == A5O_ADD && src_mode == A5O_ALPHA && src_alpha == A5O_ALPHA && op_alpha == A5O_ADD && dst_mode == A5O_INVERSE_ALPHA && dst_alpha == A5O_INVERSE_ALPHA) { - if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -4378,13 +4378,13 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -4393,13 +4393,13 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -4409,17 +4409,17 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); SHADE_COLORS(src_color, cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, NULL, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, NULL, &result); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -4467,13 +4467,13 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -4482,13 +4482,13 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -4498,16 +4498,16 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); SHADE_COLORS(src_color, cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } @@ -4538,9 +4538,9 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i } } } - } else if (op == ALLEGRO_ADD && src_mode == ALLEGRO_ONE && src_alpha == ALLEGRO_ONE && op_alpha == ALLEGRO_ADD && dst_mode == ALLEGRO_ONE && dst_alpha == ALLEGRO_ONE) { + } else if (op == A5O_ADD && src_mode == A5O_ONE && src_alpha == A5O_ONE && op_alpha == A5O_ADD && dst_mode == A5O_ONE && dst_alpha == A5O_ONE) { - if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -4559,13 +4559,13 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -4574,13 +4574,13 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -4590,17 +4590,17 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); SHADE_COLORS(src_color, cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, NULL, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_ONE, A5O_ADD, A5O_ONE, A5O_ONE, NULL, &result); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -4648,13 +4648,13 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -4663,13 +4663,13 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -4679,16 +4679,16 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); SHADE_COLORS(src_color, cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); - _al_blend_alpha_inline(&src_color, &dst_color, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE, NULL, &result); + _al_blend_alpha_inline(&src_color, &dst_color, A5O_ADD, A5O_ONE, A5O_ONE, A5O_ADD, A5O_ONE, A5O_ONE, NULL, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); } @@ -4719,7 +4719,7 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i } } } - } else if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + } else if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -4738,13 +4738,13 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -4753,13 +4753,13 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -4769,17 +4769,17 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); SHADE_COLORS(src_color, cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); + A5O_COLOR dst_color; + A5O_COLOR result; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, dst_color, false); _al_blend_inline(&src_color, &dst_color, op, src_mode, dst_mode, op_alpha, src_alpha, dst_alpha, &const_color, &result); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, result, true); } uu += du_dx; @@ -4827,13 +4827,13 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -4842,13 +4842,13 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -4858,14 +4858,14 @@ static void shader_texture_grad_any_draw_shade(uintptr_t state, int x1, int y, i uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); SHADE_COLORS(src_color, cur_color); { - ALLEGRO_COLOR dst_color; - ALLEGRO_COLOR result; + A5O_COLOR dst_color; + A5O_COLOR result; _AL_INLINE_GET_PIXEL(dst_format, dst_data, dst_color, false); _al_blend_inline(&src_color, &dst_color, op, src_mode, dst_mode, op_alpha, src_alpha, dst_alpha, &const_color, &result); _AL_INLINE_PUT_PIXEL(dst_format, dst_data, result, true); @@ -4907,12 +4907,12 @@ static void shader_texture_grad_any_draw_opaque(uintptr_t state, int x1, int y, { state_texture_grad_any_2d *gs = (state_texture_grad_any_2d *) state; state_texture_solid_any_2d *s = &gs->solid; - ALLEGRO_COLOR cur_color = s->cur_color; + A5O_COLOR cur_color = s->cur_color; float u = s->u; float v = s->v; - ALLEGRO_BITMAP *target = s->target; + A5O_BITMAP *target = s->target; if (target->parent) { x1 += target->xofs; @@ -4951,10 +4951,10 @@ static void shader_texture_grad_any_draw_opaque(uintptr_t state, int x1, int y, { const int offset_x = s->texture->parent ? s->texture->xofs : 0; const int offset_y = s->texture->parent ? s->texture->yofs : 0; - ALLEGRO_BITMAP *texture = s->texture->parent ? s->texture->parent : s->texture; + A5O_BITMAP *texture = s->texture->parent ? s->texture->parent : s->texture; const int src_format = texture->locked_region.format; const int src_size = texture->locked_region.pixel_size; - ALLEGRO_BITMAP_WRAP wrap_u, wrap_v; + A5O_BITMAP_WRAP wrap_u, wrap_v; _al_get_bitmap_wrap(texture, &wrap_u, &wrap_v); int tile_u = (int) (floorf(u / s->w)); int tile_v = (int) (floorf(v / s->h)); @@ -4975,7 +4975,7 @@ static void shader_texture_grad_any_draw_opaque(uintptr_t state, int x1, int y, const int dst_format = target->locked_region.format; uint8_t *dst_data = (uint8_t *) target->lock_data + y * target->locked_region.pitch + x1 * target->locked_region.pixel_size; - if (dst_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888 && src_format == ALLEGRO_PIXEL_FORMAT_ARGB_8888) { + if (dst_format == A5O_PIXEL_FORMAT_ARGB_8888 && src_format == A5O_PIXEL_FORMAT_ARGB_8888) { uint8_t *lock_data = texture->locked_region.data; const int src_pitch = texture->locked_region.pitch; const al_fixed du_dx = al_ftofix(s->du_dx); @@ -4995,13 +4995,13 @@ static void shader_texture_grad_any_draw_opaque(uintptr_t state, int x1, int y, int src_y = (vv >> 16) + 0; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -5010,13 +5010,13 @@ static void shader_texture_grad_any_draw_opaque(uintptr_t state, int x1, int y, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -5026,12 +5026,12 @@ static void shader_texture_grad_any_draw_opaque(uintptr_t state, int x1, int y, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); SHADE_COLORS(src_color, cur_color); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, src_color, true); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, src_color, true); uu += du_dx; vv += dv_dx; @@ -5056,13 +5056,13 @@ static void shader_texture_grad_any_draw_opaque(uintptr_t state, int x1, int y, int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -5071,13 +5071,13 @@ static void shader_texture_grad_any_draw_opaque(uintptr_t state, int x1, int y, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -5087,12 +5087,12 @@ static void shader_texture_grad_any_draw_opaque(uintptr_t state, int x1, int y, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; - _AL_INLINE_GET_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); + A5O_COLOR src_color; + _AL_INLINE_GET_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, src_data, src_color, false); SHADE_COLORS(src_color, cur_color); - _AL_INLINE_PUT_PIXEL(ALLEGRO_PIXEL_FORMAT_ARGB_8888, dst_data, src_color, true); + _AL_INLINE_PUT_PIXEL(A5O_PIXEL_FORMAT_ARGB_8888, dst_data, src_color, true); uu += du_dx; vv += dv_dx; @@ -5140,13 +5140,13 @@ static void shader_texture_grad_any_draw_opaque(uintptr_t state, int x1, int y, int src_y = (vv >> 16) + 0; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -5155,13 +5155,13 @@ static void shader_texture_grad_any_draw_opaque(uintptr_t state, int x1, int y, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -5171,7 +5171,7 @@ static void shader_texture_grad_any_draw_opaque(uintptr_t state, int x1, int y, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); SHADE_COLORS(src_color, cur_color); @@ -5201,13 +5201,13 @@ static void shader_texture_grad_any_draw_opaque(uintptr_t state, int x1, int y, int src_y = (vv >> 16) + vv_ofs; switch (wrap_u) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_u < 0) src_x = 0; if (tile_u > 0) src_x = s->w - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_u % 2) src_x = s->w - 1 - src_x; // REPEAT and DEFAULT. @@ -5216,13 +5216,13 @@ static void shader_texture_grad_any_draw_opaque(uintptr_t state, int x1, int y, } switch (wrap_v) { - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: if (tile_v < 0) src_y = 0; if (tile_v > 0) src_y = s->h - 1; break; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: if (tile_v % 2) src_y = s->h - 1 - src_y; // REPEAT and DEFAULT. @@ -5232,7 +5232,7 @@ static void shader_texture_grad_any_draw_opaque(uintptr_t state, int x1, int y, uint8_t *src_data = lock_data + src_y * src_pitch + src_x * src_size; - ALLEGRO_COLOR src_color; + A5O_COLOR src_color; _AL_INLINE_GET_PIXEL(src_format, src_data, src_color, false); SHADE_COLORS(src_color, cur_color); diff --git a/src/sdl/sdl_display.c b/src/sdl/sdl_display.c index 12fc8f14da..54bfd03a8d 100644 --- a/src/sdl/sdl_display.c +++ b/src/sdl/sdl_display.c @@ -24,27 +24,27 @@ #include "allegro5/internal/aintern_shader.h" #include "allegro5/platform/allegro_internal_sdl.h" -ALLEGRO_DEBUG_CHANNEL("display") +A5O_DEBUG_CHANNEL("display") int _al_win_determine_adapter(void); -static ALLEGRO_DISPLAY_INTERFACE *vt; +static A5O_DISPLAY_INTERFACE *vt; -float _al_sdl_get_display_pixel_ratio(ALLEGRO_DISPLAY *display) +float _al_sdl_get_display_pixel_ratio(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_SDL *sdl = (void *)display; + A5O_DISPLAY_SDL *sdl = (void *)display; int window_width, drawable_width, h; SDL_GetWindowSize(sdl->window, &window_width, &h); SDL_GL_GetDrawableSize(sdl->window, &drawable_width, &h); return drawable_width / (float)window_width; } -ALLEGRO_DISPLAY *_al_sdl_find_display(uint32_t window_id) { +A5O_DISPLAY *_al_sdl_find_display(uint32_t window_id) { unsigned int i; - ALLEGRO_SYSTEM *s = al_get_system_driver(); + A5O_SYSTEM *s = al_get_system_driver(); for (i = 0; i < _al_vector_size(&s->displays); i++) { void **v = (void **)_al_vector_ref(&s->displays, i); - ALLEGRO_DISPLAY_SDL *d = *v; + A5O_DISPLAY_SDL *d = *v; if (SDL_GetWindowID(d->window) == window_id) { return &d->display; break; @@ -55,33 +55,33 @@ ALLEGRO_DISPLAY *_al_sdl_find_display(uint32_t window_id) { void _al_sdl_display_event(SDL_Event *e) { - ALLEGRO_EVENT event; + A5O_EVENT event; event.display.timestamp = al_get_time(); - ALLEGRO_DISPLAY *d = NULL; + A5O_DISPLAY *d = NULL; if (e->type == SDL_WINDOWEVENT) { d = _al_sdl_find_display(e->window.windowID); if (e->window.event == SDL_WINDOWEVENT_FOCUS_GAINED) { - event.display.type = ALLEGRO_EVENT_DISPLAY_SWITCH_IN; + event.display.type = A5O_EVENT_DISPLAY_SWITCH_IN; } if (e->window.event == SDL_WINDOWEVENT_FOCUS_LOST) { - event.display.type = ALLEGRO_EVENT_DISPLAY_SWITCH_OUT; + event.display.type = A5O_EVENT_DISPLAY_SWITCH_OUT; } if (e->window.event == SDL_WINDOWEVENT_CLOSE) { - event.display.type = ALLEGRO_EVENT_DISPLAY_CLOSE; + event.display.type = A5O_EVENT_DISPLAY_CLOSE; } if (e->window.event == SDL_WINDOWEVENT_RESIZED) { float ratio = _al_sdl_get_display_pixel_ratio(d); - event.display.type = ALLEGRO_EVENT_DISPLAY_RESIZE; + event.display.type = A5O_EVENT_DISPLAY_RESIZE; event.display.width = e->window.data1 * ratio; event.display.height = e->window.data2 * ratio; } } if (e->type == SDL_QUIT) { - event.display.type = ALLEGRO_EVENT_DISPLAY_CLOSE; + event.display.type = A5O_EVENT_DISPLAY_CLOSE; /* Use the first display as event source if we have any displays. */ - ALLEGRO_SYSTEM *s = al_get_system_driver(); + A5O_SYSTEM *s = al_get_system_driver(); if (_al_vector_size(&s->displays) > 0) { void **v = (void **)_al_vector_ref(&s->displays, 0); d = *v; @@ -90,7 +90,7 @@ void _al_sdl_display_event(SDL_Event *e) if (!d) return; - ALLEGRO_EVENT_SOURCE *es = &d->es; + A5O_EVENT_SOURCE *es = &d->es; _al_event_source_lock(es); _al_event_source_emit_event(es, &event); _al_event_source_unlock(es); @@ -100,38 +100,38 @@ static void GLoption(int allegro, int sdl) { int i; int x = al_get_new_display_option(allegro, &i); - if (i == ALLEGRO_DONTCARE) + if (i == A5O_DONTCARE) return; SDL_GL_SetAttribute(sdl, x); } -static ALLEGRO_DISPLAY *sdl_create_display_locked(int w, int h) +static A5O_DISPLAY *sdl_create_display_locked(int w, int h) { - ALLEGRO_DISPLAY_SDL *sdl = al_calloc(1, sizeof *sdl); - ALLEGRO_DISPLAY *d = (void *)sdl; + A5O_DISPLAY_SDL *sdl = al_calloc(1, sizeof *sdl); + A5O_DISPLAY *d = (void *)sdl; d->w = w; d->h = h; d->flags = al_get_new_display_flags(); - d->flags |= ALLEGRO_OPENGL; -#ifdef ALLEGRO_CFG_OPENGLES2 - d->flags |= ALLEGRO_PROGRAMMABLE_PIPELINE; + d->flags |= A5O_OPENGL; +#ifdef A5O_CFG_OPENGLES2 + d->flags |= A5O_PROGRAMMABLE_PIPELINE; #endif -#ifdef ALLEGRO_CFG_OPENGLES - d->flags |= ALLEGRO_OPENGL_ES_PROFILE; +#ifdef A5O_CFG_OPENGLES + d->flags |= A5O_OPENGL_ES_PROFILE; #endif int flags = SDL_WINDOW_OPENGL; - if (d->flags & ALLEGRO_FULLSCREEN) + if (d->flags & A5O_FULLSCREEN) flags |= SDL_WINDOW_FULLSCREEN; - if (d->flags & ALLEGRO_FULLSCREEN_WINDOW) + if (d->flags & A5O_FULLSCREEN_WINDOW) flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; - if (d->flags & ALLEGRO_FRAMELESS) + if (d->flags & A5O_FRAMELESS) flags |= SDL_WINDOW_BORDERLESS; - if (d->flags & ALLEGRO_RESIZABLE) + if (d->flags & A5O_RESIZABLE) flags |= SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI; - if (d->flags & ALLEGRO_OPENGL_ES_PROFILE) { + if (d->flags & A5O_OPENGL_ES_PROFILE) { SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); -#ifdef ALLEGRO_CFG_OPENGLES1 +#ifdef A5O_CFG_OPENGLES1 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1); #else SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); @@ -139,29 +139,29 @@ static ALLEGRO_DISPLAY *sdl_create_display_locked(int w, int h) SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); } - GLoption(ALLEGRO_COLOR_SIZE, SDL_GL_BUFFER_SIZE); - GLoption(ALLEGRO_RED_SIZE, SDL_GL_RED_SIZE); - GLoption(ALLEGRO_GREEN_SIZE, SDL_GL_GREEN_SIZE); - GLoption(ALLEGRO_BLUE_SIZE, SDL_GL_BLUE_SIZE); - GLoption(ALLEGRO_ALPHA_SIZE, SDL_GL_ALPHA_SIZE); - GLoption(ALLEGRO_ACC_RED_SIZE, SDL_GL_ACCUM_RED_SIZE); - GLoption(ALLEGRO_ACC_GREEN_SIZE, SDL_GL_ACCUM_GREEN_SIZE); - GLoption(ALLEGRO_ACC_BLUE_SIZE, SDL_GL_ACCUM_BLUE_SIZE); - GLoption(ALLEGRO_ACC_ALPHA_SIZE, SDL_GL_ACCUM_ALPHA_SIZE); - GLoption(ALLEGRO_STEREO, SDL_GL_STEREO); - GLoption(ALLEGRO_DEPTH_SIZE, SDL_GL_DEPTH_SIZE); - GLoption(ALLEGRO_STENCIL_SIZE, SDL_GL_STENCIL_SIZE); - GLoption(ALLEGRO_SAMPLE_BUFFERS, SDL_GL_MULTISAMPLEBUFFERS); - GLoption(ALLEGRO_SAMPLES, SDL_GL_MULTISAMPLESAMPLES); - GLoption(ALLEGRO_OPENGL_MAJOR_VERSION, SDL_GL_CONTEXT_MAJOR_VERSION); - GLoption(ALLEGRO_OPENGL_MINOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION); + GLoption(A5O_COLOR_SIZE, SDL_GL_BUFFER_SIZE); + GLoption(A5O_RED_SIZE, SDL_GL_RED_SIZE); + GLoption(A5O_GREEN_SIZE, SDL_GL_GREEN_SIZE); + GLoption(A5O_BLUE_SIZE, SDL_GL_BLUE_SIZE); + GLoption(A5O_ALPHA_SIZE, SDL_GL_ALPHA_SIZE); + GLoption(A5O_ACC_RED_SIZE, SDL_GL_ACCUM_RED_SIZE); + GLoption(A5O_ACC_GREEN_SIZE, SDL_GL_ACCUM_GREEN_SIZE); + GLoption(A5O_ACC_BLUE_SIZE, SDL_GL_ACCUM_BLUE_SIZE); + GLoption(A5O_ACC_ALPHA_SIZE, SDL_GL_ACCUM_ALPHA_SIZE); + GLoption(A5O_STEREO, SDL_GL_STEREO); + GLoption(A5O_DEPTH_SIZE, SDL_GL_DEPTH_SIZE); + GLoption(A5O_STENCIL_SIZE, SDL_GL_STENCIL_SIZE); + GLoption(A5O_SAMPLE_BUFFERS, SDL_GL_MULTISAMPLEBUFFERS); + GLoption(A5O_SAMPLES, SDL_GL_MULTISAMPLESAMPLES); + GLoption(A5O_OPENGL_MAJOR_VERSION, SDL_GL_CONTEXT_MAJOR_VERSION); + GLoption(A5O_OPENGL_MINOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION); SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, "0"); sdl->window = SDL_CreateWindow(al_get_new_window_title(), sdl->x, sdl->y, d->w, d->h, flags); if (!sdl->window) { - ALLEGRO_ERROR("SDL_CreateWindow failed: %s", SDL_GetError()); + A5O_ERROR("SDL_CreateWindow failed: %s", SDL_GetError()); return NULL; } @@ -171,28 +171,28 @@ static ALLEGRO_DISPLAY *sdl_create_display_locked(int w, int h) // there's no way to query pixel ratio before creating the window, so we // have to compensate afterwards - if (d->flags & ALLEGRO_RESIZABLE && - !(d->flags & ALLEGRO_FULLSCREEN || d->flags & ALLEGRO_FULLSCREEN_WINDOW)) { + if (d->flags & A5O_RESIZABLE && + !(d->flags & A5O_FULLSCREEN || d->flags & A5O_FULLSCREEN_WINDOW)) { int window_width, window_height; SDL_GetWindowSize(sdl->window, &window_width, &window_height); float ratio = _al_sdl_get_display_pixel_ratio(d); - ALLEGRO_DEBUG("resizing the display to %dx%d to match the scaling factor %f\n", (int)(window_width / ratio), (int)(window_height / ratio), ratio); + A5O_DEBUG("resizing the display to %dx%d to match the scaling factor %f\n", (int)(window_width / ratio), (int)(window_height / ratio), ratio); SDL_SetWindowSize(sdl->window, window_width / ratio, window_height / ratio); SDL_GL_GetDrawableSize(sdl->window, &d->w, &d->h); } - ALLEGRO_DISPLAY **add; - ALLEGRO_SYSTEM *system = al_get_system_driver(); + A5O_DISPLAY **add; + A5O_SYSTEM *system = al_get_system_driver(); add = _al_vector_alloc_back(&system->displays); *add = d; _al_event_source_init(&d->es); d->vt = vt; - d->extra_settings.settings[ALLEGRO_COMPATIBLE_DISPLAY] = true; + d->extra_settings.settings[A5O_COMPATIBLE_DISPLAY] = true; d->ogl_extras = al_calloc(1, sizeof *d->ogl_extras); _al_ogl_manage_extensions(d); @@ -202,64 +202,64 @@ static ALLEGRO_DISPLAY *sdl_create_display_locked(int w, int h) /* Fill in opengl version */ const int v = d->ogl_extras->ogl_info.version; - d->extra_settings.settings[ALLEGRO_OPENGL_MAJOR_VERSION] = (v >> 24) & 0xFF; - d->extra_settings.settings[ALLEGRO_OPENGL_MINOR_VERSION] = (v >> 16) & 0xFF; + d->extra_settings.settings[A5O_OPENGL_MAJOR_VERSION] = (v >> 24) & 0xFF; + d->extra_settings.settings[A5O_OPENGL_MINOR_VERSION] = (v >> 16) & 0xFF; return d; } -static ALLEGRO_DISPLAY *sdl_create_display(int w, int h) +static A5O_DISPLAY *sdl_create_display(int w, int h) { - ALLEGRO_SYSTEM_SDL *s = (void *)al_get_system_driver(); + A5O_SYSTEM_SDL *s = (void *)al_get_system_driver(); al_lock_mutex(s->mutex); - ALLEGRO_DISPLAY *d = sdl_create_display_locked(w, h); + A5O_DISPLAY *d = sdl_create_display_locked(w, h); al_unlock_mutex(s->mutex); return d; } -static void convert_display_bitmaps_to_memory_bitmap(ALLEGRO_DISPLAY *d) +static void convert_display_bitmaps_to_memory_bitmap(A5O_DISPLAY *d) { - ALLEGRO_DEBUG("converting display bitmaps to memory bitmaps.\n"); + A5O_DEBUG("converting display bitmaps to memory bitmaps.\n"); while (d->bitmaps._size > 0) { - ALLEGRO_BITMAP **bptr = _al_vector_ref_back(&d->bitmaps); - ALLEGRO_BITMAP *b = *bptr; + A5O_BITMAP **bptr = _al_vector_ref_back(&d->bitmaps); + A5O_BITMAP *b = *bptr; _al_convert_to_memory_bitmap(b); } } static void transfer_display_bitmaps_to_any_other_display( - ALLEGRO_SYSTEM *s, ALLEGRO_DISPLAY *d) + A5O_SYSTEM *s, A5O_DISPLAY *d) { size_t i; - ALLEGRO_DISPLAY *living = NULL; + A5O_DISPLAY *living = NULL; ASSERT(s->displays._size > 1); for (i = 0; i < s->displays._size; i++) { - ALLEGRO_DISPLAY **slot = _al_vector_ref(&s->displays, i); + A5O_DISPLAY **slot = _al_vector_ref(&s->displays, i); living = *slot; if (living != d) break; } - ALLEGRO_DEBUG("transferring display bitmaps to other display.\n"); + A5O_DEBUG("transferring display bitmaps to other display.\n"); for (i = 0; i < d->bitmaps._size; i++) { - ALLEGRO_BITMAP **add = _al_vector_alloc_back(&(living->bitmaps)); - ALLEGRO_BITMAP **ref = _al_vector_ref(&d->bitmaps, i); + A5O_BITMAP **add = _al_vector_alloc_back(&(living->bitmaps)); + A5O_BITMAP **ref = _al_vector_ref(&d->bitmaps, i); *add = *ref; (*add)->_display = living; } } -static void sdl_destroy_display_locked(ALLEGRO_DISPLAY *d) +static void sdl_destroy_display_locked(A5O_DISPLAY *d) { - ALLEGRO_DISPLAY_SDL *sdl = (void *)d; - ALLEGRO_SYSTEM *system = al_get_system_driver(); - ALLEGRO_OGL_EXTRAS *ogl = d->ogl_extras; + A5O_DISPLAY_SDL *sdl = (void *)d; + A5O_SYSTEM *system = al_get_system_driver(); + A5O_OGL_EXTRAS *ogl = d->ogl_extras; bool is_last; - ALLEGRO_DEBUG("destroying display.\n"); + A5O_DEBUG("destroying display.\n"); /* If we're the last display, convert all bitmaps to display independent * (memory) bitmaps. Otherwise, pass all bitmaps to any other living @@ -273,12 +273,12 @@ static void sdl_destroy_display_locked(ALLEGRO_DISPLAY *d) transfer_display_bitmaps_to_any_other_display(system, d); _al_ogl_unmanage_extensions(d); - ALLEGRO_DEBUG("unmanaged extensions.\n"); + A5O_DEBUG("unmanaged extensions.\n"); if (ogl->backbuffer) { _al_ogl_destroy_backbuffer(ogl->backbuffer); ogl->backbuffer = NULL; - ALLEGRO_DEBUG("destroy backbuffer.\n"); + A5O_DEBUG("destroy backbuffer.\n"); } _al_vector_free(&d->bitmaps); @@ -295,39 +295,39 @@ static void sdl_destroy_display_locked(ALLEGRO_DISPLAY *d) al_free(sdl); } -static void sdl_destroy_display(ALLEGRO_DISPLAY *d) +static void sdl_destroy_display(A5O_DISPLAY *d) { - ALLEGRO_SYSTEM_SDL *s = (void *)al_get_system_driver(); + A5O_SYSTEM_SDL *s = (void *)al_get_system_driver(); al_lock_mutex(s->mutex); sdl_destroy_display_locked(d); al_unlock_mutex(s->mutex); } -static bool sdl_set_current_display(ALLEGRO_DISPLAY *d) +static bool sdl_set_current_display(A5O_DISPLAY *d) { - ALLEGRO_DISPLAY_SDL *sdl = (void *)d; + A5O_DISPLAY_SDL *sdl = (void *)d; SDL_GL_MakeCurrent(sdl->window, sdl->context); return true; } -static void sdl_unset_current_display(ALLEGRO_DISPLAY *d) +static void sdl_unset_current_display(A5O_DISPLAY *d) { (void)d; } -static void sdl_flip_display(ALLEGRO_DISPLAY *d) +static void sdl_flip_display(A5O_DISPLAY *d) { - ALLEGRO_DISPLAY_SDL *sdl = (void *)d; + A5O_DISPLAY_SDL *sdl = (void *)d; SDL_GL_SwapWindow(sdl->window); // SDL loses texture contents, for example on resize. al_backup_dirty_bitmaps(d); } -static void sdl_update_display_region(ALLEGRO_DISPLAY *d, int x, int y, +static void sdl_update_display_region(A5O_DISPLAY *d, int x, int y, int width, int height) { - ALLEGRO_DISPLAY_SDL *sdl = (void *)d; + A5O_DISPLAY_SDL *sdl = (void *)d; (void)x; (void)y; (void)width; @@ -335,81 +335,81 @@ static void sdl_update_display_region(ALLEGRO_DISPLAY *d, int x, int y, SDL_GL_SwapWindow(sdl->window); } -static bool sdl_is_compatible_bitmap(ALLEGRO_DISPLAY *display, - ALLEGRO_BITMAP *bitmap) +static bool sdl_is_compatible_bitmap(A5O_DISPLAY *display, + A5O_BITMAP *bitmap) { (void)display; (void)bitmap; return true; } -static bool sdl_set_mouse_cursor(ALLEGRO_DISPLAY *display, - ALLEGRO_MOUSE_CURSOR *cursor) +static bool sdl_set_mouse_cursor(A5O_DISPLAY *display, + A5O_MOUSE_CURSOR *cursor) { - ALLEGRO_MOUSE_CURSOR_SDL *sdl_cursor = (ALLEGRO_MOUSE_CURSOR_SDL *) cursor; + A5O_MOUSE_CURSOR_SDL *sdl_cursor = (A5O_MOUSE_CURSOR_SDL *) cursor; (void)display; SDL_SetCursor(sdl_cursor->cursor); return true; } -static bool sdl_set_system_mouse_cursor(ALLEGRO_DISPLAY *display, - ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id) +static bool sdl_set_system_mouse_cursor(A5O_DISPLAY *display, + A5O_SYSTEM_MOUSE_CURSOR cursor_id) { (void)display; (void)cursor_id; return false; } -static bool sdl_show_mouse_cursor(ALLEGRO_DISPLAY *display) +static bool sdl_show_mouse_cursor(A5O_DISPLAY *display) { (void)display; return SDL_ShowCursor(SDL_ENABLE) == SDL_ENABLE; } -static bool sdl_hide_mouse_cursor(ALLEGRO_DISPLAY *display) +static bool sdl_hide_mouse_cursor(A5O_DISPLAY *display) { (void)display; return SDL_ShowCursor(SDL_DISABLE) == SDL_DISABLE; } -static void sdl_set_window_position(ALLEGRO_DISPLAY *display, int x, int y) +static void sdl_set_window_position(A5O_DISPLAY *display, int x, int y) { - ALLEGRO_DISPLAY_SDL *sdl = (void *)display; + A5O_DISPLAY_SDL *sdl = (void *)display; SDL_SetWindowPosition(sdl->window, x, y); } -static void sdl_get_window_position(ALLEGRO_DISPLAY *display, int *x, int *y) +static void sdl_get_window_position(A5O_DISPLAY *display, int *x, int *y) { - ALLEGRO_DISPLAY_SDL *sdl = (void *)display; + A5O_DISPLAY_SDL *sdl = (void *)display; SDL_GetWindowPosition(sdl->window, x, y); } -static void recreate_textures(ALLEGRO_DISPLAY *display) +static void recreate_textures(A5O_DISPLAY *display) { unsigned int i; for (i = 0; i < _al_vector_size(&display->bitmaps); i++) { - ALLEGRO_BITMAP **bptr = _al_vector_ref(&display->bitmaps, i); - ALLEGRO_BITMAP *bitmap = *bptr; + A5O_BITMAP **bptr = _al_vector_ref(&display->bitmaps, i); + A5O_BITMAP *bitmap = *bptr; int bitmap_flags = al_get_bitmap_flags(bitmap); if (bitmap->parent) continue; - if (bitmap_flags & ALLEGRO_MEMORY_BITMAP) + if (bitmap_flags & A5O_MEMORY_BITMAP) continue; - if (bitmap_flags & ALLEGRO_NO_PRESERVE_TEXTURE) + if (bitmap_flags & A5O_NO_PRESERVE_TEXTURE) continue; _al_ogl_upload_bitmap_memory(bitmap, _al_get_bitmap_memory_format( bitmap), bitmap->memory); } } -static bool sdl_acknowledge_resize(ALLEGRO_DISPLAY *display) +static bool sdl_acknowledge_resize(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_SDL *sdl = (void *)display; + A5O_DISPLAY_SDL *sdl = (void *)display; SDL_GL_GetDrawableSize(sdl->window, &display->w, &display->h); _al_ogl_setup_gl(display); - if (display->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { + if (display->flags & A5O_PROGRAMMABLE_PIPELINE) { display->default_shader = _al_create_default_shader(display); al_use_shader(display->default_shader); } @@ -421,15 +421,15 @@ static bool sdl_acknowledge_resize(ALLEGRO_DISPLAY *display) return true; } -static void sdl_set_window_title(ALLEGRO_DISPLAY *display, char const *title) +static void sdl_set_window_title(A5O_DISPLAY *display, char const *title) { - ALLEGRO_DISPLAY_SDL *sdl = (void *)display; + A5O_DISPLAY_SDL *sdl = (void *)display; SDL_SetWindowTitle(sdl->window, title); } -static bool sdl_resize_display(ALLEGRO_DISPLAY *display, int width, int height) +static bool sdl_resize_display(A5O_DISPLAY *display, int width, int height) { - ALLEGRO_DISPLAY_SDL *sdl = (void *)display; + A5O_DISPLAY_SDL *sdl = (void *)display; // Allegro uses pixels everywhere, while SDL uses screen space for window size int window_width, drawable_width, h; @@ -442,19 +442,19 @@ static bool sdl_resize_display(ALLEGRO_DISPLAY *display, int width, int height) return true; } -static bool sdl_set_display_flag(ALLEGRO_DISPLAY *display, int flag, +static bool sdl_set_display_flag(A5O_DISPLAY *display, int flag, bool flag_onoff) { - ALLEGRO_DISPLAY_SDL *sdl = (void *)display; + A5O_DISPLAY_SDL *sdl = (void *)display; switch (flag) { - case ALLEGRO_FRAMELESS: - /* The ALLEGRO_FRAMELESS flag is backwards. */ + case A5O_FRAMELESS: + /* The A5O_FRAMELESS flag is backwards. */ SDL_SetWindowBordered(sdl->window, !flag_onoff); return true; - case ALLEGRO_FULLSCREEN_WINDOW: + case A5O_FULLSCREEN_WINDOW: SDL_SetWindowFullscreen(sdl->window, flag_onoff ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0); return true; - case ALLEGRO_MAXIMIZED: + case A5O_MAXIMIZED: if (flag_onoff) { SDL_MaximizeWindow(sdl->window); } else { @@ -465,8 +465,8 @@ static bool sdl_set_display_flag(ALLEGRO_DISPLAY *display, int flag, return false; } -static void sdl_set_icons(ALLEGRO_DISPLAY *display, int num_icons, ALLEGRO_BITMAP *bitmaps[]) { - ALLEGRO_DISPLAY_SDL *sdl = (void *)display; +static void sdl_set_icons(A5O_DISPLAY *display, int num_icons, A5O_BITMAP *bitmaps[]) { + A5O_DISPLAY_SDL *sdl = (void *)display; int w = al_get_bitmap_width(bitmaps[0]); int h = al_get_bitmap_height(bitmaps[0]); int data_size = w * h * 4; @@ -487,13 +487,13 @@ static void sdl_set_icons(ALLEGRO_DISPLAY *display, int num_icons, ALLEGRO_BITMA amask = 0xff000000; #endif - ALLEGRO_LOCKED_REGION *lock = al_lock_bitmap(bitmaps[0], ALLEGRO_PIXEL_FORMAT_ABGR_8888, ALLEGRO_LOCK_READONLY); + A5O_LOCKED_REGION *lock = al_lock_bitmap(bitmaps[0], A5O_PIXEL_FORMAT_ABGR_8888, A5O_LOCK_READONLY); if (lock) { int i = 0, y = 0; for (y = 0; y < h; y++) { int x = 0; for (x = 0; x < w; x++) { - ALLEGRO_COLOR c = al_get_pixel(bitmaps[0], x, y); + A5O_COLOR c = al_get_pixel(bitmaps[0], x, y); al_unmap_rgba(c, data+i, data+i+1, data+i+2, data+i+3); i += 4; } @@ -508,7 +508,7 @@ static void sdl_set_icons(ALLEGRO_DISPLAY *display, int num_icons, ALLEGRO_BITMA al_free(data); } -ALLEGRO_DISPLAY_INTERFACE *_al_sdl_display_driver(void) +A5O_DISPLAY_INTERFACE *_al_sdl_display_driver(void) { if (vt) return vt; diff --git a/src/sdl/sdl_event_hack.c b/src/sdl/sdl_event_hack.c index 5d2990857b..b40718b17c 100644 --- a/src/sdl/sdl_event_hack.c +++ b/src/sdl/sdl_event_hack.c @@ -23,14 +23,14 @@ * timer events) to prevent a deadlock in an unbound al_wait_for_event. */ -static ALLEGRO_THREAD *thread; +static A5O_THREAD *thread; static void wakeup_with_fake_timer_event(void) { - ALLEGRO_EVENT_SOURCE *es = al_get_keyboard_event_source(); + A5O_EVENT_SOURCE *es = al_get_keyboard_event_source(); _al_event_source_lock(es); - ALLEGRO_EVENT event; - event.timer.type = ALLEGRO_EVENT_TIMER; + A5O_EVENT event; + event.timer.type = A5O_EVENT_TIMER; event.timer.timestamp = al_get_time(); event.timer.count = 0; event.timer.error = 0; @@ -38,7 +38,7 @@ static void wakeup_with_fake_timer_event(void) _al_event_source_unlock(es); } -static void *wakeup_thread(ALLEGRO_THREAD *thread, void *user) +static void *wakeup_thread(A5O_THREAD *thread, void *user) { al_rest(1); while (!al_get_thread_should_stop(thread)) { diff --git a/src/sdl/sdl_joystick.c b/src/sdl/sdl_joystick.c index 492292d4c9..453566d1fe 100644 --- a/src/sdl/sdl_joystick.c +++ b/src/sdl/sdl_joystick.c @@ -16,20 +16,20 @@ #include "allegro5/internal/aintern_system.h" #include "allegro5/platform/allegro_internal_sdl.h" -ALLEGRO_DEBUG_CHANNEL("SDL") +A5O_DEBUG_CHANNEL("SDL") -typedef struct ALLEGRO_JOYSTICK_SDL +typedef struct A5O_JOYSTICK_SDL { int id; - ALLEGRO_JOYSTICK allegro; + A5O_JOYSTICK allegro; SDL_Joystick *sdl; -} ALLEGRO_JOYSTICK_SDL; +} A5O_JOYSTICK_SDL; -static ALLEGRO_JOYSTICK_DRIVER *vt; +static A5O_JOYSTICK_DRIVER *vt; static int count; -static ALLEGRO_JOYSTICK_SDL *joysticks; +static A5O_JOYSTICK_SDL *joysticks; -static int get_id(ALLEGRO_JOYSTICK *allegro) +static int get_id(A5O_JOYSTICK *allegro) { int i; for (i = 0; i < count; i++) { @@ -39,7 +39,7 @@ static int get_id(ALLEGRO_JOYSTICK *allegro) return -1; } -static SDL_Joystick *get_sdl(ALLEGRO_JOYSTICK *allegro) +static SDL_Joystick *get_sdl(A5O_JOYSTICK *allegro) { int id = get_id(allegro); if (id < 0) @@ -49,13 +49,13 @@ static SDL_Joystick *get_sdl(ALLEGRO_JOYSTICK *allegro) void _al_sdl_joystick_event(SDL_Event *e) { - ALLEGRO_EVENT event; + A5O_EVENT event; memset(&event, 0, sizeof event); event.joystick.timestamp = al_get_time(); if (e->type == SDL_JOYAXISMOTION) { - event.joystick.type = ALLEGRO_EVENT_JOYSTICK_AXIS; + event.joystick.type = A5O_EVENT_JOYSTICK_AXIS; event.joystick.id = &joysticks[e->jaxis.which].allegro; event.joystick.stick = e->jaxis.axis / 2; event.joystick.axis = e->jaxis.axis % 2; @@ -63,7 +63,7 @@ void _al_sdl_joystick_event(SDL_Event *e) event.joystick.button = 0; } else if (e->type == SDL_JOYBUTTONDOWN) { - event.joystick.type = ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN; + event.joystick.type = A5O_EVENT_JOYSTICK_BUTTON_DOWN; event.joystick.id = &joysticks[e->jbutton.which].allegro; event.joystick.stick = 0; event.joystick.axis = 0; @@ -71,7 +71,7 @@ void _al_sdl_joystick_event(SDL_Event *e) event.joystick.button = e->jbutton.button; } else if (e->type == SDL_JOYBUTTONUP) { - event.joystick.type = ALLEGRO_EVENT_JOYSTICK_BUTTON_UP; + event.joystick.type = A5O_EVENT_JOYSTICK_BUTTON_UP; event.joystick.id = &joysticks[e->jbutton.which].allegro; event.joystick.stick = 0; event.joystick.axis = 0; @@ -79,13 +79,13 @@ void _al_sdl_joystick_event(SDL_Event *e) event.joystick.button = e->jbutton.button; } else if (e->type == SDL_JOYDEVICEADDED || e->type == SDL_JOYDEVICEREMOVED) { - event.joystick.type = ALLEGRO_EVENT_JOYSTICK_CONFIGURATION; + event.joystick.type = A5O_EVENT_JOYSTICK_CONFIGURATION; } else { return; } - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); _al_event_source_lock(es); _al_event_source_emit_event(es, &event); _al_event_source_unlock(es); @@ -143,20 +143,20 @@ static int sdl_num_joysticks(void) return count; } -static ALLEGRO_JOYSTICK *sdl_get_joystick(int joyn) +static A5O_JOYSTICK *sdl_get_joystick(int joyn) { return &joysticks[joyn].allegro; } -static void sdl_release_joystick(ALLEGRO_JOYSTICK *joy) +static void sdl_release_joystick(A5O_JOYSTICK *joy) { ASSERT(joy); } -static void sdl_get_joystick_state(ALLEGRO_JOYSTICK *joy, - ALLEGRO_JOYSTICK_STATE *ret_state) +static void sdl_get_joystick_state(A5O_JOYSTICK *joy, + A5O_JOYSTICK_STATE *ret_state) { - ALLEGRO_SYSTEM_INTERFACE *s = _al_sdl_system_driver(); + A5O_SYSTEM_INTERFACE *s = _al_sdl_system_driver(); s->heartbeat(); SDL_Joystick *sdl = get_sdl(joy); @@ -171,19 +171,19 @@ static void sdl_get_joystick_state(ALLEGRO_JOYSTICK *joy, } } -static const char *sdl_get_name(ALLEGRO_JOYSTICK *joy) +static const char *sdl_get_name(A5O_JOYSTICK *joy) { SDL_Joystick *sdl = get_sdl(joy); return SDL_JoystickName(sdl); } -static bool sdl_get_active(ALLEGRO_JOYSTICK *joy) +static bool sdl_get_active(A5O_JOYSTICK *joy) { SDL_Joystick *sdl = get_sdl(joy); return SDL_JoystickGetAttached(sdl); } -ALLEGRO_JOYSTICK_DRIVER *_al_sdl_joystick_driver(void) +A5O_JOYSTICK_DRIVER *_al_sdl_joystick_driver(void) { if (vt) return vt; diff --git a/src/sdl/sdl_keyboard.c b/src/sdl/sdl_keyboard.c index 0f4cb54382..42d2a7c7e2 100644 --- a/src/sdl/sdl_keyboard.c +++ b/src/sdl/sdl_keyboard.c @@ -16,38 +16,38 @@ #include "allegro5/internal/aintern_system.h" #include "allegro5/platform/allegro_internal_sdl.h" -ALLEGRO_DEBUG_CHANNEL("SDL") +A5O_DEBUG_CHANNEL("SDL") -typedef struct ALLEGRO_KEYBOARD_SDL +typedef struct A5O_KEYBOARD_SDL { - ALLEGRO_KEYBOARD keyboard; + A5O_KEYBOARD keyboard; int table[1024]; int inverse[1024]; int unicode[1024]; int inverse_unicode[1024]; bool create_extra_char[1024]; - ALLEGRO_DISPLAY *display; -} ALLEGRO_KEYBOARD_SDL; + A5O_DISPLAY *display; +} A5O_KEYBOARD_SDL; -static ALLEGRO_KEYBOARD_DRIVER *vt; -static ALLEGRO_KEYBOARD_SDL *keyboard; +static A5O_KEYBOARD_DRIVER *vt; +static A5O_KEYBOARD_SDL *keyboard; static unsigned int get_modifiers(int modifiers) { int result = 0; - if (modifiers & KMOD_LSHIFT) result |= ALLEGRO_KEYMOD_SHIFT; - if (modifiers & KMOD_RSHIFT) result |= ALLEGRO_KEYMOD_SHIFT; - if (modifiers & KMOD_LCTRL) result |= ALLEGRO_KEYMOD_CTRL; - if (modifiers & KMOD_RCTRL) result |= ALLEGRO_KEYMOD_CTRL; - if (modifiers & KMOD_LALT) result |= ALLEGRO_KEYMOD_ALT; - if (modifiers & KMOD_RALT) result |= ALLEGRO_KEYMOD_ALT; - if (modifiers & KMOD_LGUI) result |= ALLEGRO_KEYMOD_LWIN; - if (modifiers & KMOD_RGUI) result |= ALLEGRO_KEYMOD_RWIN; - if (modifiers & KMOD_NUM) result |= ALLEGRO_KEYMOD_NUMLOCK; - if (modifiers & KMOD_CAPS) result |= ALLEGRO_KEYMOD_CAPSLOCK; - if (modifiers & KMOD_MODE) result |= ALLEGRO_KEYMOD_ALTGR; + if (modifiers & KMOD_LSHIFT) result |= A5O_KEYMOD_SHIFT; + if (modifiers & KMOD_RSHIFT) result |= A5O_KEYMOD_SHIFT; + if (modifiers & KMOD_LCTRL) result |= A5O_KEYMOD_CTRL; + if (modifiers & KMOD_RCTRL) result |= A5O_KEYMOD_CTRL; + if (modifiers & KMOD_LALT) result |= A5O_KEYMOD_ALT; + if (modifiers & KMOD_RALT) result |= A5O_KEYMOD_ALT; + if (modifiers & KMOD_LGUI) result |= A5O_KEYMOD_LWIN; + if (modifiers & KMOD_RGUI) result |= A5O_KEYMOD_RWIN; + if (modifiers & KMOD_NUM) result |= A5O_KEYMOD_NUMLOCK; + if (modifiers & KMOD_CAPS) result |= A5O_KEYMOD_CAPSLOCK; + if (modifiers & KMOD_MODE) result |= A5O_KEYMOD_ALTGR; return result; } @@ -65,8 +65,8 @@ void _al_sdl_keyboard_event(SDL_Event *e) } return; } - ALLEGRO_EVENT event; - ALLEGRO_EVENT_SOURCE *es = &keyboard->keyboard.es; + A5O_EVENT event; + A5O_EVENT_SOURCE *es = &keyboard->keyboard.es; _al_event_source_lock(es); event.keyboard.timestamp = al_get_time(); event.keyboard.display = NULL; @@ -74,14 +74,14 @@ void _al_sdl_keyboard_event(SDL_Event *e) event.keyboard.repeat = false; if (e->type == SDL_TEXTINPUT) { - ALLEGRO_USTR_INFO info; - ALLEGRO_USTR const *u = al_ref_cstr(&info, e->text.text); + A5O_USTR_INFO info; + A5O_USTR const *u = al_ref_cstr(&info, e->text.text); int pos = 0; while (true) { int32_t c = al_ustr_get_next(u, &pos); if (c <= 0) break; - event.keyboard.type = ALLEGRO_EVENT_KEY_CHAR; + event.keyboard.type = A5O_EVENT_KEY_CHAR; event.keyboard.keycode = c < 1024 ? keyboard->inverse_unicode[c] : 0; event.keyboard.unichar = c; event.keyboard.display = _al_sdl_find_display(e->text.windowID); @@ -90,7 +90,7 @@ void _al_sdl_keyboard_event(SDL_Event *e) } else if (e->type == SDL_KEYDOWN) { - event.keyboard.type = ALLEGRO_EVENT_KEY_DOWN; + event.keyboard.type = A5O_EVENT_KEY_DOWN; event.keyboard.keycode = keyboard->table[e->key.keysym.scancode]; event.keyboard.unichar = keyboard->unicode[e->key.keysym.scancode]; event.keyboard.display = _al_sdl_find_display(e->key.windowID); @@ -99,12 +99,12 @@ void _al_sdl_keyboard_event(SDL_Event *e) } if (keyboard->create_extra_char[e->key.keysym.scancode]) { - event.keyboard.type = ALLEGRO_EVENT_KEY_CHAR; + event.keyboard.type = A5O_EVENT_KEY_CHAR; _al_event_source_emit_event(es, &event); } } else if (e->type == SDL_KEYUP) { - event.keyboard.type = ALLEGRO_EVENT_KEY_UP; + event.keyboard.type = A5O_EVENT_KEY_UP; event.keyboard.keycode = keyboard->table[e->key.keysym.scancode]; event.keyboard.unichar = keyboard->unicode[e->key.keysym.scancode]; event.keyboard.display = _al_sdl_find_display(e->key.windowID); @@ -119,7 +119,7 @@ void _al_sdl_keyboard_event(SDL_Event *e) static void adde(int sdl_scancode, int allegro_keycode, int unicode, bool extra) { if (sdl_scancode >= 1024) { - ALLEGRO_WARN("Cannot map SDL scancode %d.\n", sdl_scancode); + A5O_WARN("Cannot map SDL scancode %d.\n", sdl_scancode); return; } keyboard->table[sdl_scancode] = allegro_keycode; @@ -134,9 +134,9 @@ static void add(int sdl_scancode, int allegro_keycode, int unicode) adde(sdl_scancode, allegro_keycode, unicode, false); } -#define ADD_SAME(X, c) add(SDL_SCANCODE_##X, ALLEGRO_KEY_##X, c) -#define ADD_SAMEC(X) add(SDL_SCANCODE_##X, ALLEGRO_KEY_##X, tolower(#X[0])) -#define ADD_SAMEE(X, c) adde(SDL_SCANCODE_##X, ALLEGRO_KEY_##X, c, true) +#define ADD_SAME(X, c) add(SDL_SCANCODE_##X, A5O_KEY_##X, c) +#define ADD_SAMEC(X) add(SDL_SCANCODE_##X, A5O_KEY_##X, tolower(#X[0])) +#define ADD_SAMEE(X, c) adde(SDL_SCANCODE_##X, A5O_KEY_##X, c, true) static bool sdl_init_keyboard(void) { @@ -180,22 +180,22 @@ static bool sdl_init_keyboard(void) ADD_SAMEC(8); ADD_SAMEC(9); ADD_SAMEC(0); - adde(SDL_SCANCODE_RETURN, ALLEGRO_KEY_ENTER, 13, true); + adde(SDL_SCANCODE_RETURN, A5O_KEY_ENTER, 13, true); ADD_SAMEE(ESCAPE, 27); ADD_SAMEE(BACKSPACE, 8); ADD_SAMEE(TAB, 9); ADD_SAME(SPACE, ' '); ADD_SAME(MINUS, '-'); ADD_SAME(EQUALS, '='); - add(SDL_SCANCODE_LEFTBRACKET, ALLEGRO_KEY_OPENBRACE, '['); - add(SDL_SCANCODE_RIGHTBRACKET, ALLEGRO_KEY_CLOSEBRACE, ']'); + add(SDL_SCANCODE_LEFTBRACKET, A5O_KEY_OPENBRACE, '['); + add(SDL_SCANCODE_RIGHTBRACKET, A5O_KEY_CLOSEBRACE, ']'); ADD_SAME(BACKSLASH, '\\'); add(SDL_SCANCODE_NONUSHASH, 0, '#'); ADD_SAME(SEMICOLON, ';'); - add(SDL_SCANCODE_APOSTROPHE, ALLEGRO_KEY_QUOTE, '\''); - add(SDL_SCANCODE_GRAVE, ALLEGRO_KEY_TILDE, '~'); + add(SDL_SCANCODE_APOSTROPHE, A5O_KEY_QUOTE, '\''); + add(SDL_SCANCODE_GRAVE, A5O_KEY_TILDE, '~'); ADD_SAME(COMMA, ','); - add(SDL_SCANCODE_PERIOD, ALLEGRO_KEY_FULLSTOP, '.'); + add(SDL_SCANCODE_PERIOD, A5O_KEY_FULLSTOP, '.'); ADD_SAME(SLASH, '/'); ADD_SAME(CAPSLOCK, 0); ADD_SAMEE(F1, 0); @@ -215,35 +215,35 @@ static bool sdl_init_keyboard(void) ADD_SAME(PAUSE, 0); ADD_SAMEE(INSERT, 0); ADD_SAMEE(HOME, 0); - add(SDL_SCANCODE_PAGEUP, ALLEGRO_KEY_PGUP, 0); + add(SDL_SCANCODE_PAGEUP, A5O_KEY_PGUP, 0); ADD_SAMEE(DELETE, 0); ADD_SAMEE(END, 0); - add(SDL_SCANCODE_PAGEDOWN, ALLEGRO_KEY_PGDN, 0); + add(SDL_SCANCODE_PAGEDOWN, A5O_KEY_PGDN, 0); ADD_SAMEE(RIGHT, 0); ADD_SAMEE(LEFT, 0); ADD_SAMEE(DOWN, 0); ADD_SAMEE(UP, 0); - add(SDL_SCANCODE_NUMLOCKCLEAR, ALLEGRO_KEY_NUMLOCK, 0); - add(SDL_SCANCODE_KP_DIVIDE, ALLEGRO_KEY_PAD_SLASH, '/'); - add(SDL_SCANCODE_KP_MULTIPLY, ALLEGRO_KEY_PAD_ASTERISK, '*'); - add(SDL_SCANCODE_KP_MINUS, ALLEGRO_KEY_PAD_MINUS, '-'); - add(SDL_SCANCODE_KP_PLUS, ALLEGRO_KEY_PAD_PLUS, '+'); - add(SDL_SCANCODE_KP_ENTER, ALLEGRO_KEY_PAD_ENTER, 13); - add(SDL_SCANCODE_KP_1, ALLEGRO_KEY_PAD_1, '1'); - add(SDL_SCANCODE_KP_2, ALLEGRO_KEY_PAD_2, '2'); - add(SDL_SCANCODE_KP_3, ALLEGRO_KEY_PAD_3, '3'); - add(SDL_SCANCODE_KP_4, ALLEGRO_KEY_PAD_4, '4'); - add(SDL_SCANCODE_KP_5, ALLEGRO_KEY_PAD_5, '5'); - add(SDL_SCANCODE_KP_6, ALLEGRO_KEY_PAD_6, '6'); - add(SDL_SCANCODE_KP_7, ALLEGRO_KEY_PAD_7, '7'); - add(SDL_SCANCODE_KP_8, ALLEGRO_KEY_PAD_8, '8'); - add(SDL_SCANCODE_KP_9, ALLEGRO_KEY_PAD_9, '9'); - add(SDL_SCANCODE_KP_0, ALLEGRO_KEY_PAD_0, '0'); - add(SDL_SCANCODE_KP_PERIOD, ALLEGRO_KEY_PAD_DELETE, 0); + add(SDL_SCANCODE_NUMLOCKCLEAR, A5O_KEY_NUMLOCK, 0); + add(SDL_SCANCODE_KP_DIVIDE, A5O_KEY_PAD_SLASH, '/'); + add(SDL_SCANCODE_KP_MULTIPLY, A5O_KEY_PAD_ASTERISK, '*'); + add(SDL_SCANCODE_KP_MINUS, A5O_KEY_PAD_MINUS, '-'); + add(SDL_SCANCODE_KP_PLUS, A5O_KEY_PAD_PLUS, '+'); + add(SDL_SCANCODE_KP_ENTER, A5O_KEY_PAD_ENTER, 13); + add(SDL_SCANCODE_KP_1, A5O_KEY_PAD_1, '1'); + add(SDL_SCANCODE_KP_2, A5O_KEY_PAD_2, '2'); + add(SDL_SCANCODE_KP_3, A5O_KEY_PAD_3, '3'); + add(SDL_SCANCODE_KP_4, A5O_KEY_PAD_4, '4'); + add(SDL_SCANCODE_KP_5, A5O_KEY_PAD_5, '5'); + add(SDL_SCANCODE_KP_6, A5O_KEY_PAD_6, '6'); + add(SDL_SCANCODE_KP_7, A5O_KEY_PAD_7, '7'); + add(SDL_SCANCODE_KP_8, A5O_KEY_PAD_8, '8'); + add(SDL_SCANCODE_KP_9, A5O_KEY_PAD_9, '9'); + add(SDL_SCANCODE_KP_0, A5O_KEY_PAD_0, '0'); + add(SDL_SCANCODE_KP_PERIOD, A5O_KEY_PAD_DELETE, 0); add(SDL_SCANCODE_NONUSBACKSLASH, 0, '\\'); add(SDL_SCANCODE_APPLICATION, 0, 0); add(SDL_SCANCODE_POWER, 0, 0); - add(SDL_SCANCODE_KP_EQUALS, ALLEGRO_KEY_PAD_EQUALS, '='); + add(SDL_SCANCODE_KP_EQUALS, A5O_KEY_PAD_EQUALS, '='); add(SDL_SCANCODE_F13, 0, 0); add(SDL_SCANCODE_F14, 0, 0); add(SDL_SCANCODE_F15, 0, 0); @@ -350,12 +350,12 @@ static bool sdl_init_keyboard(void) add(SDL_SCANCODE_KP_HEXADECIMAL, 0, 0); ADD_SAME(LCTRL, 0); ADD_SAME(LSHIFT, 0); - add(SDL_SCANCODE_LALT, ALLEGRO_KEY_ALT, 0); - add(SDL_SCANCODE_LGUI, ALLEGRO_KEY_LWIN, 0); + add(SDL_SCANCODE_LALT, A5O_KEY_ALT, 0); + add(SDL_SCANCODE_LGUI, A5O_KEY_LWIN, 0); ADD_SAME(RCTRL, 0); ADD_SAME(RSHIFT, 0); - add(SDL_SCANCODE_RALT, ALLEGRO_KEY_ALTGR, 0); - add(SDL_SCANCODE_RGUI, ALLEGRO_KEY_RWIN, 0); + add(SDL_SCANCODE_RALT, A5O_KEY_ALTGR, 0); + add(SDL_SCANCODE_RGUI, A5O_KEY_RWIN, 0); add(SDL_SCANCODE_MODE, 0, 0); add(SDL_SCANCODE_AUDIONEXT, 0, 0); add(SDL_SCANCODE_AUDIOPREV, 0, 0); @@ -392,7 +392,7 @@ static void sdl_exit_keyboard(void) { } -static ALLEGRO_KEYBOARD *sdl_get_keyboard(void) +static A5O_KEYBOARD *sdl_get_keyboard(void) { return &keyboard->keyboard; } @@ -408,10 +408,10 @@ static char const *sdl_keycode_to_name(int keycode) return SDL_GetScancodeName(keyboard->inverse[keycode]); } -static void sdl_get_keyboard_state(ALLEGRO_KEYBOARD_STATE *ret_state) +static void sdl_get_keyboard_state(A5O_KEYBOARD_STATE *ret_state) { int i, n; - ALLEGRO_SYSTEM_INTERFACE *sdl = _al_sdl_system_driver(); + A5O_SYSTEM_INTERFACE *sdl = _al_sdl_system_driver(); sdl->heartbeat(); const Uint8 *s = SDL_GetKeyboardState(&n); for (i = 0; i < n; i++) { @@ -428,7 +428,7 @@ static void sdl_clear_keyboard_state(void) return; } -ALLEGRO_KEYBOARD_DRIVER *_al_sdl_keyboard_driver(void) +A5O_KEYBOARD_DRIVER *_al_sdl_keyboard_driver(void) { if (vt) return vt; diff --git a/src/sdl/sdl_mouse.c b/src/sdl/sdl_mouse.c index fc9ccb3c43..29fd676b48 100644 --- a/src/sdl/sdl_mouse.c +++ b/src/sdl/sdl_mouse.c @@ -16,32 +16,32 @@ #include "allegro5/internal/aintern_system.h" #include "allegro5/platform/allegro_internal_sdl.h" -ALLEGRO_DEBUG_CHANNEL("SDL") +A5O_DEBUG_CHANNEL("SDL") -typedef struct ALLEGRO_MOUSE_SDL +typedef struct A5O_MOUSE_SDL { - ALLEGRO_MOUSE mouse; - ALLEGRO_MOUSE_STATE state; - ALLEGRO_DISPLAY *display; + A5O_MOUSE mouse; + A5O_MOUSE_STATE state; + A5O_DISPLAY *display; float ratio; -} ALLEGRO_MOUSE_SDL; +} A5O_MOUSE_SDL; -static ALLEGRO_MOUSE_DRIVER *vt; -static ALLEGRO_MOUSE_SDL *mouse; +static A5O_MOUSE_DRIVER *vt; +static A5O_MOUSE_SDL *mouse; -static ALLEGRO_DISPLAY *find_display(uint32_t window_id) +static A5O_DISPLAY *find_display(uint32_t window_id) { - ALLEGRO_DISPLAY *d = _al_sdl_find_display(window_id); + A5O_DISPLAY *d = _al_sdl_find_display(window_id); if (d) { return d; } else { // if there's only one display, we can assume that all // events refer to its coordinate system - ALLEGRO_SYSTEM *s = al_get_system_driver(); + A5O_SYSTEM *s = al_get_system_driver(); if (_al_vector_size(&s->displays) == 1) { void **v = (void **)_al_vector_ref(&s->displays, 0); - ALLEGRO_DISPLAY_SDL *d = *v; + A5O_DISPLAY_SDL *d = *v; return &d->display; } } @@ -53,26 +53,26 @@ void _al_sdl_mouse_event(SDL_Event *e) if (!mouse) return; - ALLEGRO_EVENT_SOURCE *es = &mouse->mouse.es; + A5O_EVENT_SOURCE *es = &mouse->mouse.es; _al_event_source_lock(es); - ALLEGRO_EVENT event; + A5O_EVENT event; memset(&event, 0, sizeof event); event.mouse.timestamp = al_get_time(); - ALLEGRO_DISPLAY *d = NULL; + A5O_DISPLAY *d = NULL; if (e->type == SDL_WINDOWEVENT) { d = find_display(e->window.windowID); mouse->ratio = _al_sdl_get_display_pixel_ratio(d); if (e->window.event == SDL_WINDOWEVENT_ENTER) { - event.mouse.type = ALLEGRO_EVENT_MOUSE_ENTER_DISPLAY; + event.mouse.type = A5O_EVENT_MOUSE_ENTER_DISPLAY; SDL_GetMouseState(&event.mouse.x, &event.mouse.y); event.mouse.x *= mouse->ratio; event.mouse.y *= mouse->ratio; } else { - event.mouse.type = ALLEGRO_EVENT_MOUSE_LEAVE_DISPLAY; + event.mouse.type = A5O_EVENT_MOUSE_LEAVE_DISPLAY; event.mouse.x = mouse->state.x; event.mouse.y = mouse->state.y; event.mouse.z = mouse->state.z; @@ -87,7 +87,7 @@ void _al_sdl_mouse_event(SDL_Event *e) } d = find_display(e->motion.windowID); float ratio = d ? _al_sdl_get_display_pixel_ratio(d) : 1.0; - event.mouse.type = ALLEGRO_EVENT_MOUSE_AXES; + event.mouse.type = A5O_EVENT_MOUSE_AXES; event.mouse.x = e->motion.x * ratio; event.mouse.y = e->motion.y * ratio; event.mouse.z = mouse->state.z; @@ -105,7 +105,7 @@ void _al_sdl_mouse_event(SDL_Event *e) return; } d = find_display(e->wheel.windowID); - event.mouse.type = ALLEGRO_EVENT_MOUSE_AXES; + event.mouse.type = A5O_EVENT_MOUSE_AXES; mouse->state.z += al_get_mouse_wheel_precision() * e->wheel.y; mouse->state.w += al_get_mouse_wheel_precision() * e->wheel.x; event.mouse.x = mouse->state.x; @@ -136,11 +136,11 @@ void _al_sdl_mouse_event(SDL_Event *e) event.mouse.z = mouse->state.z; event.mouse.w = mouse->state.w; if (e->type == SDL_MOUSEBUTTONDOWN) { - event.mouse.type = ALLEGRO_EVENT_MOUSE_BUTTON_DOWN; + event.mouse.type = A5O_EVENT_MOUSE_BUTTON_DOWN; mouse->state.buttons |= 1 << (event.mouse.button - 1); } if (e->type == SDL_MOUSEBUTTONUP) { - event.mouse.type = ALLEGRO_EVENT_MOUSE_BUTTON_UP; + event.mouse.type = A5O_EVENT_MOUSE_BUTTON_UP; mouse->state.buttons &= ~(1 << (event.mouse.button - 1)); } } @@ -164,7 +164,7 @@ static void sdl_exit_mouse(void) { } -static ALLEGRO_MOUSE *sdl_get_mouse(void) +static A5O_MOUSE *sdl_get_mouse(void) { return &mouse->mouse; } @@ -179,9 +179,9 @@ static unsigned int sdl_get_mouse_num_axes(void) return 4; } -static bool sdl_set_mouse_xy(ALLEGRO_DISPLAY *display, int x, int y) +static bool sdl_set_mouse_xy(A5O_DISPLAY *display, int x, int y) { - ALLEGRO_DISPLAY_SDL *sdl = (void *)display; + A5O_DISPLAY_SDL *sdl = (void *)display; float ratio = _al_sdl_get_display_pixel_ratio(display); SDL_WarpMouseInWindow(sdl->window, x / ratio, y / ratio); return true; @@ -194,24 +194,24 @@ static bool sdl_set_mouse_axis(int which, int value) return false; } -static void sdl_get_mouse_state(ALLEGRO_MOUSE_STATE *ret_state) +static void sdl_get_mouse_state(A5O_MOUSE_STATE *ret_state) { int x, y, i; - ALLEGRO_SYSTEM_INTERFACE *sdl = _al_sdl_system_driver(); + A5O_SYSTEM_INTERFACE *sdl = _al_sdl_system_driver(); sdl->heartbeat(); SDL_GetMouseState(&x, &y); ret_state->x = x * mouse->ratio; ret_state->y = y * mouse->ratio; ret_state->z = 0; ret_state->w = 0; - for (i = 0; i < ALLEGRO_MOUSE_MAX_EXTRA_AXES; i++) + for (i = 0; i < A5O_MOUSE_MAX_EXTRA_AXES; i++) ret_state->more_axes[i] = 0; ret_state->buttons = mouse->state.buttons; ret_state->pressure = mouse->state.buttons ? 1.0 : 0.0; /* TODO */ ret_state->display = mouse->display; } -ALLEGRO_MOUSE_DRIVER *_al_sdl_mouse_driver(void) +A5O_MOUSE_DRIVER *_al_sdl_mouse_driver(void) { if (vt) return vt; diff --git a/src/sdl/sdl_system.c b/src/sdl/sdl_system.c index ee70344885..474f777edb 100644 --- a/src/sdl/sdl_system.c +++ b/src/sdl/sdl_system.c @@ -17,11 +17,11 @@ #include "allegro5/platform/allegro_internal_sdl.h" #include "allegro5/internal/aintern_timer.h" -ALLEGRO_DEBUG_CHANNEL("SDL") +A5O_DEBUG_CHANNEL("SDL") -static ALLEGRO_SYSTEM_INTERFACE *vt; +static A5O_SYSTEM_INTERFACE *vt; -#define ALLEGRO_SDL_EVENT_QUEUE_SIZE 8 +#define A5O_SDL_EVENT_QUEUE_SIZE 8 #ifdef DEBUGMODE #define _E(x) if (type == x) return #x; @@ -75,12 +75,12 @@ static char const *event_name(int type) static void sdl_heartbeat(void) { - SDL_Event events[ALLEGRO_SDL_EVENT_QUEUE_SIZE]; - ALLEGRO_SYSTEM_SDL *s = (void *)al_get_system_driver(); + SDL_Event events[A5O_SDL_EVENT_QUEUE_SIZE]; + A5O_SYSTEM_SDL *s = (void *)al_get_system_driver(); al_lock_mutex(s->mutex); SDL_PumpEvents(); int n, i; - while ((n = SDL_PeepEvents(events, ALLEGRO_SDL_EVENT_QUEUE_SIZE, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT)) > 0) { + while ((n = SDL_PeepEvents(events, A5O_SDL_EVENT_QUEUE_SIZE, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT)) > 0) { for (i = 0; i < n; i++) { //printf("event %s\n", event_name(events[i].type)); switch (events[i].type) { @@ -138,10 +138,10 @@ static void sdl_heartbeat(void) al_unlock_mutex(s->mutex); } -static ALLEGRO_SYSTEM *sdl_initialize(int flags) +static A5O_SYSTEM *sdl_initialize(int flags) { (void)flags; - ALLEGRO_SYSTEM_SDL *s = al_calloc(1, sizeof *s); + A5O_SYSTEM_SDL *s = al_calloc(1, sizeof *s); s->system.vt = vt; // TODO: map allegro flags to sdl flags. @@ -151,21 +151,21 @@ static ALLEGRO_SYSTEM *sdl_initialize(int flags) sdl_flags &= ~SDL_INIT_HAPTIC; #endif if (SDL_Init(sdl_flags) < 0) { - ALLEGRO_ERROR("SDL_Init failed: %s", SDL_GetError()); + A5O_ERROR("SDL_Init failed: %s", SDL_GetError()); return NULL; } - _al_vector_init(&s->system.displays, sizeof (ALLEGRO_DISPLAY_SDL *)); + _al_vector_init(&s->system.displays, sizeof (A5O_DISPLAY_SDL *)); return &s->system; } static void sdl_heartbeat_init(void) { - ALLEGRO_SYSTEM_SDL *s = (void *)al_get_system_driver(); + A5O_SYSTEM_SDL *s = (void *)al_get_system_driver(); /* This cannot be done in sdl_initialize because the threading system - * requires a completed ALLEGRO_SYSTEM which only exists after the + * requires a completed A5O_SYSTEM which only exists after the * function returns. This function on the other hand will get called * once the system was created. */ @@ -178,12 +178,12 @@ static void sdl_heartbeat_init(void) static void sdl_shutdown_system(void) { - ALLEGRO_SYSTEM_SDL *s = (void *)al_get_system_driver(); + A5O_SYSTEM_SDL *s = (void *)al_get_system_driver(); /* Close all open displays. */ while (_al_vector_size(&s->system.displays) > 0) { - ALLEGRO_DISPLAY **dptr = _al_vector_ref(&s->system.displays, 0); - ALLEGRO_DISPLAY *d = *dptr; + A5O_DISPLAY **dptr = _al_vector_ref(&s->system.displays, 0); + A5O_DISPLAY *d = *dptr; al_destroy_display(d); } _al_vector_free(&s->system.displays); @@ -193,28 +193,28 @@ static void sdl_shutdown_system(void) SDL_Quit(); } -static ALLEGRO_PATH *sdl_get_path(int id) +static A5O_PATH *sdl_get_path(int id) { - ALLEGRO_PATH *p = NULL; + A5O_PATH *p = NULL; char* dir; switch (id) { - case ALLEGRO_TEMP_PATH: - case ALLEGRO_USER_DOCUMENTS_PATH: - case ALLEGRO_USER_DATA_PATH: - case ALLEGRO_USER_SETTINGS_PATH: + case A5O_TEMP_PATH: + case A5O_USER_DOCUMENTS_PATH: + case A5O_USER_DATA_PATH: + case A5O_USER_SETTINGS_PATH: dir = SDL_GetPrefPath(al_get_org_name(), al_get_app_name()); p = al_create_path_for_directory(dir); - if (id == ALLEGRO_TEMP_PATH) { + if (id == A5O_TEMP_PATH) { al_append_path_component(p, "tmp"); } SDL_free(dir); break; - case ALLEGRO_RESOURCES_PATH: - case ALLEGRO_EXENAME_PATH: - case ALLEGRO_USER_HOME_PATH: + case A5O_RESOURCES_PATH: + case A5O_EXENAME_PATH: + case A5O_USER_HOME_PATH: dir = SDL_GetBasePath(); p = al_create_path_for_directory(dir); - if (id == ALLEGRO_EXENAME_PATH) { + if (id == A5O_EXENAME_PATH) { al_set_path_filename(p, al_get_app_name()); } SDL_free(dir); @@ -223,33 +223,33 @@ static ALLEGRO_PATH *sdl_get_path(int id) return p; } -static ALLEGRO_DISPLAY_INTERFACE *sdl_get_display_driver(void) +static A5O_DISPLAY_INTERFACE *sdl_get_display_driver(void) { return _al_sdl_display_driver(); } -static ALLEGRO_KEYBOARD_DRIVER *sdl_get_keyboard_driver(void) +static A5O_KEYBOARD_DRIVER *sdl_get_keyboard_driver(void) { return _al_sdl_keyboard_driver(); } -static ALLEGRO_MOUSE_DRIVER *sdl_get_mouse_driver(void) +static A5O_MOUSE_DRIVER *sdl_get_mouse_driver(void) { return _al_sdl_mouse_driver(); } -static ALLEGRO_TOUCH_INPUT_DRIVER *sdl_get_touch_input_driver(void) +static A5O_TOUCH_INPUT_DRIVER *sdl_get_touch_input_driver(void) { return _al_sdl_touch_input_driver(); } -static ALLEGRO_JOYSTICK_DRIVER *sdl_get_joystick_driver(void) +static A5O_JOYSTICK_DRIVER *sdl_get_joystick_driver(void) { return _al_sdl_joystick_driver(); } #define ADD(allegro, sdl) if (sdl_format == \ - SDL_PIXELFORMAT_##sdl) return ALLEGRO_PIXEL_FORMAT_##allegro; + SDL_PIXELFORMAT_##sdl) return A5O_PIXEL_FORMAT_##allegro; int _al_sdl_get_allegro_pixel_format(int sdl_format) { ADD(ARGB_8888, ARGB8888) ADD(RGBA_8888, RGBA8888) @@ -259,7 +259,7 @@ int _al_sdl_get_allegro_pixel_format(int sdl_format) { #undef ADD #define ADD(allegro, sdl) if (allegro_format == \ - ALLEGRO_PIXEL_FORMAT_##allegro) return SDL_PIXELFORMAT_##sdl; + A5O_PIXEL_FORMAT_##allegro) return SDL_PIXELFORMAT_##sdl; int _al_sdl_get_sdl_pixel_format(int allegro_format) { ADD(ANY, ABGR8888) ADD(ANY_NO_ALPHA, ABGR8888) @@ -280,7 +280,7 @@ static int sdl_get_num_video_adapters(void) return SDL_GetNumVideoDisplays(); } -static bool sdl_get_monitor_info(int adapter, ALLEGRO_MONITOR_INFO *info) +static bool sdl_get_monitor_info(int adapter, A5O_MONITOR_INFO *info) { SDL_Rect rect; if (SDL_GetDisplayBounds(adapter, &rect) < 0) @@ -292,10 +292,10 @@ static bool sdl_get_monitor_info(int adapter, ALLEGRO_MONITOR_INFO *info) return true; } -static ALLEGRO_MOUSE_CURSOR* sdl_create_mouse_cursor(ALLEGRO_BITMAP *sprite, int xfocus, int yfocus) +static A5O_MOUSE_CURSOR* sdl_create_mouse_cursor(A5O_BITMAP *sprite, int xfocus, int yfocus) { SDL_Cursor *cursor; - ALLEGRO_MOUSE_CURSOR_SDL *sdl_cursor; + A5O_MOUSE_CURSOR_SDL *sdl_cursor; int w = al_get_bitmap_width(sprite); int h = al_get_bitmap_height(sprite); @@ -316,13 +316,13 @@ static ALLEGRO_MOUSE_CURSOR* sdl_create_mouse_cursor(ALLEGRO_BITMAP *sprite, int amask = 0xff000000; #endif - ALLEGRO_LOCKED_REGION *lock = al_lock_bitmap(sprite, ALLEGRO_PIXEL_FORMAT_ABGR_8888, ALLEGRO_LOCK_READONLY); + A5O_LOCKED_REGION *lock = al_lock_bitmap(sprite, A5O_PIXEL_FORMAT_ABGR_8888, A5O_LOCK_READONLY); if (lock) { int i = 0, y = 0; for (y = 0; y < h; y++) { int x = 0; for (x = 0; x < w; x++) { - ALLEGRO_COLOR c = al_get_pixel(sprite, x, y); + A5O_COLOR c = al_get_pixel(sprite, x, y); al_unmap_rgba(c, data+i, data+i+1, data+i+2, data+i+3); i += 4; } @@ -346,12 +346,12 @@ static ALLEGRO_MOUSE_CURSOR* sdl_create_mouse_cursor(ALLEGRO_BITMAP *sprite, int } sdl_cursor->cursor = cursor; - return (ALLEGRO_MOUSE_CURSOR *)sdl_cursor; + return (A5O_MOUSE_CURSOR *)sdl_cursor; } -static void sdl_destroy_mouse_cursor(ALLEGRO_MOUSE_CURSOR *cursor) +static void sdl_destroy_mouse_cursor(A5O_MOUSE_CURSOR *cursor) { - ALLEGRO_MOUSE_CURSOR_SDL *sdl_cursor = (ALLEGRO_MOUSE_CURSOR_SDL *) cursor; + A5O_MOUSE_CURSOR_SDL *sdl_cursor = (A5O_MOUSE_CURSOR_SDL *) cursor; ASSERT(sdl_cursor); SDL_FreeCursor(sdl_cursor->cursor); al_free(sdl_cursor); @@ -373,7 +373,7 @@ static int sdl_get_num_display_modes(void) return SDL_GetNumDisplayModes(i); } -static ALLEGRO_DISPLAY_MODE *sdl_get_display_mode(int index, ALLEGRO_DISPLAY_MODE *mode) +static A5O_DISPLAY_MODE *sdl_get_display_mode(int index, A5O_DISPLAY_MODE *mode) { SDL_DisplayMode sdl_mode; int i = al_get_new_display_adapter(); @@ -399,13 +399,13 @@ static bool sdl_inhibit_screensaver(bool inhibit) } /* Internal function to get a reference to this driver. */ -ALLEGRO_SYSTEM_INTERFACE *_al_sdl_system_driver(void) +A5O_SYSTEM_INTERFACE *_al_sdl_system_driver(void) { if (vt) return vt; vt = al_calloc(1, sizeof *vt); - vt->id = ALLEGRO_SYSTEM_ID_SDL; + vt->id = A5O_SYSTEM_ID_SDL; vt->initialize = sdl_initialize; vt->get_display_driver = sdl_get_display_driver; vt->get_keyboard_driver = sdl_get_keyboard_driver; @@ -442,7 +442,7 @@ ALLEGRO_SYSTEM_INTERFACE *_al_sdl_system_driver(void) void _al_register_system_interfaces(void) { - ALLEGRO_SYSTEM_INTERFACE **add; + A5O_SYSTEM_INTERFACE **add; add = _al_vector_alloc_back(&_al_system_interfaces); *add = _al_sdl_system_driver(); } diff --git a/src/sdl/sdl_thread.c b/src/sdl/sdl_thread.c index f34f3b0211..6519c07f08 100644 --- a/src/sdl/sdl_thread.c +++ b/src/sdl/sdl_thread.c @@ -17,7 +17,7 @@ #include "allegro5/internal/aintern_thread.h" #include "allegro5/platform/allegro_internal_sdl.h" -ALLEGRO_DEBUG_CHANNEL("thread") +A5O_DEBUG_CHANNEL("thread") static int thread_trampoline(void* data) { @@ -49,7 +49,7 @@ void _al_thread_create_with_stacksize(_AL_THREAD *thread, void (*proc)(_AL_THREA thread->thread = SDL_CreateThreadWithStackSize(thread_trampoline, "allegro", stacksize, thread); #else (void)stacksize; - ALLEGRO_WARN("Creating a thread with a custom thread size is not supported " + A5O_WARN("Creating a thread with a custom thread size is not supported " "on this version of SDL, it is too old.\n"); thread->thread = SDL_CreateThread(thread_trampoline, "allegro", thread); #endif @@ -103,9 +103,9 @@ void _al_mutex_destroy(_AL_MUTEX *mutex) /* most of the condition variable implementation is actually inline */ int _al_cond_timedwait(_AL_COND *cond, _AL_MUTEX *mutex, - const ALLEGRO_TIMEOUT *timeout) + const A5O_TIMEOUT *timeout) { - ALLEGRO_TIMEOUT_SDL *timeout_sdl = (void *)timeout; + A5O_TIMEOUT_SDL *timeout_sdl = (void *)timeout; int r = SDL_CondWaitTimeout(cond->cond, mutex->mutex, timeout_sdl->ms); return (r == SDL_MUTEX_TIMEDOUT) ? -1 : 0; diff --git a/src/sdl/sdl_time.c b/src/sdl/sdl_time.c index 8cc5a2e312..9c3647158f 100644 --- a/src/sdl/sdl_time.c +++ b/src/sdl/sdl_time.c @@ -18,7 +18,7 @@ #include "allegro5/platform/allegro_internal_sdl.h" #include "allegro5/debug.h" -ALLEGRO_DEBUG_CHANNEL("SDL") +A5O_DEBUG_CHANNEL("SDL") double _al_sdl_get_time(void) { @@ -34,9 +34,9 @@ void _al_sdl_rest(double seconds) -void _al_sdl_init_timeout(ALLEGRO_TIMEOUT *timeout, double seconds) +void _al_sdl_init_timeout(A5O_TIMEOUT *timeout, double seconds) { - ALLEGRO_TIMEOUT_SDL *timeout_sdl = (void *)timeout; + A5O_TIMEOUT_SDL *timeout_sdl = (void *)timeout; timeout_sdl->ms = seconds * 1000; } diff --git a/src/sdl/sdl_touch.c b/src/sdl/sdl_touch.c index 355444e574..2a114a4b89 100644 --- a/src/sdl/sdl_touch.c +++ b/src/sdl/sdl_touch.c @@ -16,41 +16,41 @@ #include "allegro5/internal/aintern_system.h" #include "allegro5/platform/allegro_internal_sdl.h" -ALLEGRO_DEBUG_CHANNEL("SDL") +A5O_DEBUG_CHANNEL("SDL") -typedef struct ALLEGRO_TOUCH_INPUT_SDL +typedef struct A5O_TOUCH_INPUT_SDL { - ALLEGRO_TOUCH_INPUT touch_input; - ALLEGRO_TOUCH_INPUT_STATE state; - ALLEGRO_DISPLAY *display; + A5O_TOUCH_INPUT touch_input; + A5O_TOUCH_INPUT_STATE state; + A5O_DISPLAY *display; int touches; -} ALLEGRO_TOUCH_INPUT_SDL; +} A5O_TOUCH_INPUT_SDL; -static ALLEGRO_TOUCH_INPUT_DRIVER *vt; -static ALLEGRO_TOUCH_INPUT_SDL *touch_input; -static ALLEGRO_MOUSE_STATE mouse_state; +static A5O_TOUCH_INPUT_DRIVER *vt; +static A5O_TOUCH_INPUT_SDL *touch_input; +static A5O_MOUSE_STATE mouse_state; static void generate_touch_input_event(unsigned int type, double timestamp, int id, float x, float y, float dx, float dy, bool primary, - ALLEGRO_DISPLAY *disp) + A5O_DISPLAY *disp) { - ALLEGRO_EVENT event; + A5O_EVENT event; bool want_touch_event = _al_event_source_needs_to_generate_event(&touch_input->touch_input.es); bool want_mouse_emulation_event; - if (touch_input->touch_input.mouse_emulation_mode == ALLEGRO_MOUSE_EMULATION_5_0_x) { + if (touch_input->touch_input.mouse_emulation_mode == A5O_MOUSE_EMULATION_5_0_x) { want_mouse_emulation_event = _al_event_source_needs_to_generate_event(&touch_input->touch_input.mouse_emulation_es) && al_is_mouse_installed(); } else { want_mouse_emulation_event = _al_event_source_needs_to_generate_event(&touch_input->touch_input.mouse_emulation_es) && primary && al_is_mouse_installed(); } - if (touch_input->touch_input.mouse_emulation_mode == ALLEGRO_MOUSE_EMULATION_NONE) + if (touch_input->touch_input.mouse_emulation_mode == A5O_MOUSE_EMULATION_NONE) want_mouse_emulation_event = false; - else if (touch_input->touch_input.mouse_emulation_mode == ALLEGRO_MOUSE_EMULATION_INCLUSIVE) + else if (touch_input->touch_input.mouse_emulation_mode == A5O_MOUSE_EMULATION_INCLUSIVE) want_touch_event = al_is_mouse_installed() ? (want_touch_event && !primary) : want_touch_event; - else if (touch_input->touch_input.mouse_emulation_mode == ALLEGRO_MOUSE_EMULATION_EXCLUSIVE) + else if (touch_input->touch_input.mouse_emulation_mode == A5O_MOUSE_EMULATION_EXCLUSIVE) want_touch_event = al_is_mouse_installed() ? false : want_touch_event; @@ -59,7 +59,7 @@ static void generate_touch_input_event(unsigned int type, double timestamp, if (want_touch_event) { event.touch.type = type; - event.touch.display = (ALLEGRO_DISPLAY*)disp; + event.touch.display = (A5O_DISPLAY*)disp; event.touch.timestamp = timestamp; event.touch.id = id; event.touch.x = x; @@ -73,12 +73,12 @@ static void generate_touch_input_event(unsigned int type, double timestamp, _al_event_source_unlock(&touch_input->touch_input.es); } - if (touch_input->touch_input.mouse_emulation_mode != ALLEGRO_MOUSE_EMULATION_NONE) { + if (touch_input->touch_input.mouse_emulation_mode != A5O_MOUSE_EMULATION_NONE) { mouse_state.x = (int)x; mouse_state.y = (int)y; - if (type == ALLEGRO_EVENT_TOUCH_BEGIN) + if (type == A5O_EVENT_TOUCH_BEGIN) mouse_state.buttons++; - else if (type == ALLEGRO_EVENT_TOUCH_END) + else if (type == A5O_EVENT_TOUCH_END) mouse_state.buttons--; mouse_state.pressure = mouse_state.buttons ? 1.0 : 0.0; /* TODO */ @@ -87,22 +87,22 @@ static void generate_touch_input_event(unsigned int type, double timestamp, if (want_mouse_emulation_event) { switch (type) { - case ALLEGRO_EVENT_TOUCH_BEGIN: type = ALLEGRO_EVENT_MOUSE_BUTTON_DOWN; break; - case ALLEGRO_EVENT_TOUCH_CANCEL: - case ALLEGRO_EVENT_TOUCH_END: type = ALLEGRO_EVENT_MOUSE_BUTTON_UP; break; - case ALLEGRO_EVENT_TOUCH_MOVE: type = ALLEGRO_EVENT_MOUSE_AXES; break; + case A5O_EVENT_TOUCH_BEGIN: type = A5O_EVENT_MOUSE_BUTTON_DOWN; break; + case A5O_EVENT_TOUCH_CANCEL: + case A5O_EVENT_TOUCH_END: type = A5O_EVENT_MOUSE_BUTTON_UP; break; + case A5O_EVENT_TOUCH_MOVE: type = A5O_EVENT_MOUSE_AXES; break; } event.mouse.type = type; event.mouse.timestamp = timestamp; - event.mouse.display = (ALLEGRO_DISPLAY*)disp; + event.mouse.display = (A5O_DISPLAY*)disp; event.mouse.x = (int)x; event.mouse.y = (int)y; event.mouse.dx = (int)dx; event.mouse.dy = (int)dy; event.mouse.dz = 0; event.mouse.dw = 0; - if (touch_input->touch_input.mouse_emulation_mode != ALLEGRO_MOUSE_EMULATION_5_0_x) { + if (touch_input->touch_input.mouse_emulation_mode != A5O_MOUSE_EMULATION_5_0_x) { event.mouse.button = 1; } else { @@ -110,7 +110,7 @@ static void generate_touch_input_event(unsigned int type, double timestamp, } event.mouse.pressure = mouse_state.pressure; - if (touch_input->touch_input.mouse_emulation_mode != ALLEGRO_MOUSE_EMULATION_5_0_x) { + if (touch_input->touch_input.mouse_emulation_mode != A5O_MOUSE_EMULATION_5_0_x) { al_set_mouse_xy(event.mouse.display, event.mouse.x, event.mouse.y); } @@ -124,7 +124,7 @@ static int find_free_touch_state_index(void) { int i; - for (i = 0; i < ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT; i++) + for (i = 0; i < A5O_TOUCH_INPUT_MAX_TOUCH_COUNT; i++) if (touch_input->state.touches[i].id < 0) return i; @@ -135,7 +135,7 @@ static int find_touch_state_index_with_id(int id) { int i; - for (i = 0; i < ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT; i++) + for (i = 0; i < A5O_TOUCH_INPUT_MAX_TOUCH_COUNT; i++) if (touch_input->state.touches[i].id == id) return i; @@ -147,11 +147,11 @@ void _al_sdl_touch_input_event(SDL_Event *e) if (!touch_input) return; - ALLEGRO_EVENT_TYPE type; + A5O_EVENT_TYPE type; - ALLEGRO_DISPLAY *d = NULL; + A5O_DISPLAY *d = NULL; /* Use the first display as event source if we have any displays. */ - ALLEGRO_SYSTEM *s = al_get_system_driver(); + A5O_SYSTEM *s = al_get_system_driver(); if (_al_vector_size(&s->displays) > 0) { void **v = (void **)_al_vector_ref(&s->displays, 0); d = *v; @@ -180,16 +180,16 @@ void _al_sdl_touch_input_event(SDL_Event *e) touch_input->state.touches[touch_idx].dy = e->tfinger.dy * al_get_display_height(d); if (e->type == SDL_FINGERDOWN) { - type = ALLEGRO_EVENT_TOUCH_BEGIN; + type = A5O_EVENT_TOUCH_BEGIN; touch_input->state.touches[touch_idx].id = e->tfinger.fingerId; touch_input->state.touches[touch_idx].primary = (touch_input->touches == 0); touch_input->touches++; } else if (e->type == SDL_FINGERMOTION) { - type = ALLEGRO_EVENT_TOUCH_MOVE; + type = A5O_EVENT_TOUCH_MOVE; } else if (e->type == SDL_FINGERUP) { - type = ALLEGRO_EVENT_TOUCH_END; + type = A5O_EVENT_TOUCH_END; touch_input->touches--; touch_input->state.touches[touch_idx].id = -1; } else { @@ -211,10 +211,10 @@ static bool sdl_init_touch_input(void) _al_event_source_init(&touch_input->touch_input.es); _al_event_source_init(&touch_input->touch_input.mouse_emulation_es); - touch_input->touch_input.mouse_emulation_mode = ALLEGRO_MOUSE_EMULATION_TRANSPARENT; + touch_input->touch_input.mouse_emulation_mode = A5O_MOUSE_EMULATION_TRANSPARENT; int i; - for (i = 0; i < ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT; i++) { + for (i = 0; i < A5O_TOUCH_INPUT_MAX_TOUCH_COUNT; i++) { touch_input->state.touches[i].id = -1; } @@ -225,22 +225,22 @@ static void sdl_exit_touch_input(void) { } -static ALLEGRO_TOUCH_INPUT *sdl_get_touch_input(void) +static A5O_TOUCH_INPUT *sdl_get_touch_input(void) { return &touch_input->touch_input; } -static void sdl_get_touch_input_state(ALLEGRO_TOUCH_INPUT_STATE *ret_state) +static void sdl_get_touch_input_state(A5O_TOUCH_INPUT_STATE *ret_state) { _al_event_source_lock(&touch_input->touch_input.es); *ret_state = touch_input->state; _al_event_source_unlock(&touch_input->touch_input.es); } -static void touch_input_handle_cancel(int index, double timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY *disp) +static void touch_input_handle_cancel(int index, double timestamp, float x, float y, bool primary, A5O_DISPLAY *disp) { - ALLEGRO_TOUCH_STATE* state = touch_input->state.touches + index; + A5O_TOUCH_STATE* state = touch_input->state.touches + index; (void)primary; if (NULL == state) @@ -253,7 +253,7 @@ static void touch_input_handle_cancel(int index, double timestamp, float x, floa state->y = y; _al_event_source_unlock(&touch_input->touch_input.es); - generate_touch_input_event(ALLEGRO_EVENT_TOUCH_CANCEL, timestamp, + generate_touch_input_event(A5O_EVENT_TOUCH_CANCEL, timestamp, state->id, state->x, state->y, state->dx, state->dy, state->primary, disp); _al_event_source_lock(&touch_input->touch_input.es); @@ -267,9 +267,9 @@ static void sdl_set_mouse_emulation_mode(int mode) int i; - for (i = 0; i < ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) { + for (i = 0; i < A5O_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) { - ALLEGRO_TOUCH_STATE* touch = touch_input->state.touches + i; + A5O_TOUCH_STATE* touch = touch_input->state.touches + i; if (touch->id > 0) { touch_input_handle_cancel(i, al_get_time(), @@ -281,7 +281,7 @@ static void sdl_set_mouse_emulation_mode(int mode) } } -ALLEGRO_TOUCH_INPUT_DRIVER *_al_sdl_touch_input_driver(void) +A5O_TOUCH_INPUT_DRIVER *_al_sdl_touch_input_driver(void) { if (vt) return vt; diff --git a/src/shader.c b/src/shader.c index a0a51b7acb..e7771d859b 100644 --- a/src/shader.c +++ b/src/shader.c @@ -20,33 +20,33 @@ #include "allegro5/internal/aintern_shader.h" #include "allegro5/internal/aintern_system.h" -#ifdef ALLEGRO_CFG_SHADER_GLSL +#ifdef A5O_CFG_SHADER_GLSL #include "allegro5/allegro_opengl.h" #endif -ALLEGRO_DEBUG_CHANNEL("shader") +A5O_DEBUG_CHANNEL("shader") #include "shader_source.inc" -static ALLEGRO_SHADER_PLATFORM resolve_platform(ALLEGRO_DISPLAY *display, - ALLEGRO_SHADER_PLATFORM platform) +static A5O_SHADER_PLATFORM resolve_platform(A5O_DISPLAY *display, + A5O_SHADER_PLATFORM platform) { - if (platform == ALLEGRO_SHADER_AUTO) { + if (platform == A5O_SHADER_AUTO) { ASSERT(display); - if (display->flags & ALLEGRO_OPENGL) { - platform = ALLEGRO_SHADER_GLSL; + if (display->flags & A5O_OPENGL) { + platform = A5O_SHADER_GLSL; } else { - platform = ALLEGRO_SHADER_HLSL; + platform = A5O_SHADER_HLSL; } } - if (platform == ALLEGRO_SHADER_AUTO_MINIMAL) { + if (platform == A5O_SHADER_AUTO_MINIMAL) { ASSERT(display); - if (display->flags & ALLEGRO_OPENGL) { - platform = ALLEGRO_SHADER_GLSL_MINIMAL; + if (display->flags & A5O_OPENGL) { + platform = A5O_SHADER_GLSL_MINIMAL; } else { - platform = ALLEGRO_SHADER_HLSL_MINIMAL; + platform = A5O_SHADER_HLSL_MINIMAL; } } @@ -55,30 +55,30 @@ static ALLEGRO_SHADER_PLATFORM resolve_platform(ALLEGRO_DISPLAY *display, /* Function: al_create_shader */ -ALLEGRO_SHADER *al_create_shader(ALLEGRO_SHADER_PLATFORM platform) +A5O_SHADER *al_create_shader(A5O_SHADER_PLATFORM platform) { - ALLEGRO_SHADER *shader = NULL; + A5O_SHADER *shader = NULL; platform = resolve_platform(al_get_current_display(), platform); switch (platform) { -#ifdef ALLEGRO_CFG_SHADER_GLSL - case ALLEGRO_SHADER_GLSL: - case ALLEGRO_SHADER_GLSL_MINIMAL: +#ifdef A5O_CFG_SHADER_GLSL + case A5O_SHADER_GLSL: + case A5O_SHADER_GLSL_MINIMAL: shader = _al_create_shader_glsl(platform); break; #endif -#ifdef ALLEGRO_CFG_SHADER_HLSL - case ALLEGRO_SHADER_HLSL: - case ALLEGRO_SHADER_HLSL_MINIMAL: +#ifdef A5O_CFG_SHADER_HLSL + case A5O_SHADER_HLSL: + case A5O_SHADER_HLSL_MINIMAL: shader = _al_create_shader_hlsl(platform, 2); break; - case ALLEGRO_SHADER_HLSL_SM_3_0: + case A5O_SHADER_HLSL_SM_3_0: shader = _al_create_shader_hlsl(platform, 3); break; #endif - case ALLEGRO_SHADER_AUTO: - case ALLEGRO_SHADER_AUTO_MINIMAL: + case A5O_SHADER_AUTO: + case A5O_SHADER_AUTO_MINIMAL: ASSERT(0); break; default: @@ -92,14 +92,14 @@ ALLEGRO_SHADER *al_create_shader(ALLEGRO_SHADER_PLATFORM platform) (void (*)(void *))al_destroy_shader); } else { - ALLEGRO_WARN("Failed to create shader\n"); + A5O_WARN("Failed to create shader\n"); } return shader; } /* Function: al_attach_shader_source */ -bool al_attach_shader_source(ALLEGRO_SHADER *shader, ALLEGRO_SHADER_TYPE type, +bool al_attach_shader_source(A5O_SHADER *shader, A5O_SHADER_TYPE type, const char *source) { ASSERT(shader); @@ -108,16 +108,16 @@ bool al_attach_shader_source(ALLEGRO_SHADER *shader, ALLEGRO_SHADER_TYPE type, /* Function: al_attach_shader_source_file */ -bool al_attach_shader_source_file(ALLEGRO_SHADER *shader, - ALLEGRO_SHADER_TYPE type, const char *filename) +bool al_attach_shader_source_file(A5O_SHADER *shader, + A5O_SHADER_TYPE type, const char *filename) { - ALLEGRO_FILE *fp; - ALLEGRO_USTR *str; + A5O_FILE *fp; + A5O_USTR *str; bool ret; fp = al_fopen(filename, "r"); if (!fp) { - ALLEGRO_WARN("Failed to open %s\n", filename); + A5O_WARN("Failed to open %s\n", filename); al_ustr_free(shader->log); shader->log = al_ustr_newf("Failed to open %s", filename); return false; @@ -126,7 +126,7 @@ bool al_attach_shader_source_file(ALLEGRO_SHADER *shader, for (;;) { char buf[512]; size_t n; - ALLEGRO_USTR_INFO info; + A5O_USTR_INFO info; n = al_fread(fp, buf, sizeof(buf)); if (n <= 0) @@ -141,7 +141,7 @@ bool al_attach_shader_source_file(ALLEGRO_SHADER *shader, /* Function: al_build_shader */ -bool al_build_shader(ALLEGRO_SHADER *shader) +bool al_build_shader(A5O_SHADER *shader) { ASSERT(shader); return shader->vt->build_shader(shader); @@ -149,7 +149,7 @@ bool al_build_shader(ALLEGRO_SHADER *shader) /* Function: al_get_shader_log */ -const char *al_get_shader_log(ALLEGRO_SHADER *shader) +const char *al_get_shader_log(A5O_SHADER *shader) { ASSERT(shader); @@ -158,7 +158,7 @@ const char *al_get_shader_log(ALLEGRO_SHADER *shader) /* Function: al_get_shader_platform */ -ALLEGRO_SHADER_PLATFORM al_get_shader_platform(ALLEGRO_SHADER *shader) +A5O_SHADER_PLATFORM al_get_shader_platform(A5O_SHADER *shader) { ASSERT(shader); return shader->platform; @@ -166,17 +166,17 @@ ALLEGRO_SHADER_PLATFORM al_get_shader_platform(ALLEGRO_SHADER *shader) /* Function: al_use_shader */ -bool al_use_shader(ALLEGRO_SHADER *shader) +bool al_use_shader(A5O_SHADER *shader) { - ALLEGRO_BITMAP *bmp = al_get_target_bitmap(); - ALLEGRO_DISPLAY *disp; + A5O_BITMAP *bmp = al_get_target_bitmap(); + A5O_DISPLAY *disp; if (!bmp) { - ALLEGRO_WARN("No current target bitmap.\n"); + A5O_WARN("No current target bitmap.\n"); return false; } - if (al_get_bitmap_flags(bmp) & ALLEGRO_MEMORY_BITMAP) { - ALLEGRO_WARN("Target bitmap is memory bitmap.\n"); + if (al_get_bitmap_flags(bmp) & A5O_MEMORY_BITMAP) { + A5O_WARN("Target bitmap is memory bitmap.\n"); return false; } disp = _al_get_bitmap_display(bmp); @@ -185,12 +185,12 @@ bool al_use_shader(ALLEGRO_SHADER *shader) if (shader) { if (shader->vt->use_shader(shader, disp, true)) { _al_set_bitmap_shader_field(bmp, shader); - ALLEGRO_DEBUG("use_shader succeeded\n"); + A5O_DEBUG("use_shader succeeded\n"); return true; } else { _al_set_bitmap_shader_field(bmp, NULL); - ALLEGRO_ERROR("use_shader failed\n"); + A5O_ERROR("use_shader failed\n"); if (disp->default_shader) { disp->default_shader->vt->use_shader( disp->default_shader, disp, true); @@ -213,9 +213,9 @@ bool al_use_shader(ALLEGRO_SHADER *shader) /* Function: al_get_current_shader */ -ALLEGRO_SHADER *al_get_current_shader() +A5O_SHADER *al_get_current_shader() { - ALLEGRO_BITMAP* bmp = al_get_target_bitmap(); + A5O_BITMAP* bmp = al_get_target_bitmap(); if (bmp != NULL) { return bmp->shader; @@ -227,9 +227,9 @@ ALLEGRO_SHADER *al_get_current_shader() /* Function: al_destroy_shader */ -void al_destroy_shader(ALLEGRO_SHADER *shader) +void al_destroy_shader(A5O_SHADER *shader) { - ALLEGRO_BITMAP *bmp; + A5O_BITMAP *bmp; unsigned i; if (!shader) @@ -240,7 +240,7 @@ void al_destroy_shader(ALLEGRO_SHADER *shader) */ bmp = al_get_target_bitmap(); if (bmp && _al_vector_contains(&shader->bitmaps, &bmp)) { - ALLEGRO_DEBUG("implicitly unusing shader on target bitmap\n"); + A5O_DEBUG("implicitly unusing shader on target bitmap\n"); al_use_shader(NULL); } @@ -255,8 +255,8 @@ void al_destroy_shader(ALLEGRO_SHADER *shader) /* Clear references to this shader from all bitmaps. */ for (i = 0; i < _al_vector_size(&shader->bitmaps); i++) { - ALLEGRO_BITMAP **slot = _al_vector_ref(&shader->bitmaps, i); - ALLEGRO_BITMAP *bitmap = *slot; + A5O_BITMAP **slot = _al_vector_ref(&shader->bitmaps, i); + A5O_BITMAP *bitmap = *slot; ASSERT(bitmap->shader == shader); bitmap->shader = NULL; } @@ -268,10 +268,10 @@ void al_destroy_shader(ALLEGRO_SHADER *shader) /* Function: al_set_shader_sampler */ bool al_set_shader_sampler(const char *name, - ALLEGRO_BITMAP *bitmap, int unit) + A5O_BITMAP *bitmap, int unit) { - ALLEGRO_BITMAP *bmp; - ALLEGRO_SHADER *shader; + A5O_BITMAP *bmp; + A5O_SHADER *shader; if ((bmp = al_get_target_bitmap()) != NULL) { if ((shader = bmp->shader) != NULL) { @@ -289,10 +289,10 @@ bool al_set_shader_sampler(const char *name, /* Function: al_set_shader_matrix */ bool al_set_shader_matrix(const char *name, - const ALLEGRO_TRANSFORM *matrix) + const A5O_TRANSFORM *matrix) { - ALLEGRO_BITMAP *bmp; - ALLEGRO_SHADER *shader; + A5O_BITMAP *bmp; + A5O_SHADER *shader; if ((bmp = al_get_target_bitmap()) != NULL) { if ((shader = bmp->shader) != NULL) { @@ -311,8 +311,8 @@ bool al_set_shader_matrix(const char *name, */ bool al_set_shader_int(const char *name, int i) { - ALLEGRO_BITMAP *bmp; - ALLEGRO_SHADER *shader; + A5O_BITMAP *bmp; + A5O_SHADER *shader; if ((bmp = al_get_target_bitmap()) != NULL) { if ((shader = bmp->shader) != NULL) { @@ -331,8 +331,8 @@ bool al_set_shader_int(const char *name, int i) */ bool al_set_shader_float(const char *name, float f) { - ALLEGRO_BITMAP *bmp; - ALLEGRO_SHADER *shader; + A5O_BITMAP *bmp; + A5O_SHADER *shader; if ((bmp = al_get_target_bitmap()) != NULL) { if ((shader = bmp->shader) != NULL) { @@ -352,8 +352,8 @@ bool al_set_shader_float(const char *name, float f) bool al_set_shader_int_vector(const char *name, int num_components, const int *i, int num_elems) { - ALLEGRO_BITMAP *bmp; - ALLEGRO_SHADER *shader; + A5O_BITMAP *bmp; + A5O_SHADER *shader; if ((bmp = al_get_target_bitmap()) != NULL) { if ((shader = bmp->shader) != NULL) { @@ -373,8 +373,8 @@ bool al_set_shader_int_vector(const char *name, bool al_set_shader_float_vector(const char *name, int num_components, const float *f, int num_elems) { - ALLEGRO_BITMAP *bmp; - ALLEGRO_SHADER *shader; + A5O_BITMAP *bmp; + A5O_SHADER *shader; if ((bmp = al_get_target_bitmap()) != NULL) { if ((shader = bmp->shader) != NULL) { @@ -393,8 +393,8 @@ bool al_set_shader_float_vector(const char *name, */ bool al_set_shader_bool(const char *name, bool b) { - ALLEGRO_BITMAP *bmp; - ALLEGRO_SHADER *shader; + A5O_BITMAP *bmp; + A5O_SHADER *shader; if ((bmp = al_get_target_bitmap()) != NULL) { if ((shader = bmp->shader) != NULL) { @@ -411,51 +411,51 @@ bool al_set_shader_bool(const char *name, bool b) /* Function: al_get_default_shader_source */ -char const *al_get_default_shader_source(ALLEGRO_SHADER_PLATFORM platform, - ALLEGRO_SHADER_TYPE type) +char const *al_get_default_shader_source(A5O_SHADER_PLATFORM platform, + A5O_SHADER_TYPE type) { (void)type; switch (resolve_platform(al_get_current_display(), platform)) { - case ALLEGRO_SHADER_GLSL: -#ifdef ALLEGRO_CFG_SHADER_GLSL + case A5O_SHADER_GLSL: +#ifdef A5O_CFG_SHADER_GLSL switch (type) { - case ALLEGRO_VERTEX_SHADER: + case A5O_VERTEX_SHADER: return default_glsl_vertex_source; - case ALLEGRO_PIXEL_SHADER: + case A5O_PIXEL_SHADER: return default_glsl_pixel_source; } #endif break; - case ALLEGRO_SHADER_GLSL_MINIMAL: -#ifdef ALLEGRO_CFG_SHADER_GLSL + case A5O_SHADER_GLSL_MINIMAL: +#ifdef A5O_CFG_SHADER_GLSL switch (type) { - case ALLEGRO_VERTEX_SHADER: + case A5O_VERTEX_SHADER: return default_glsl_vertex_source; - case ALLEGRO_PIXEL_SHADER: + case A5O_PIXEL_SHADER: return default_glsl_minimal_pixel_source; } #endif break; - case ALLEGRO_SHADER_HLSL: - case ALLEGRO_SHADER_HLSL_MINIMAL: - case ALLEGRO_SHADER_HLSL_SM_3_0: -#ifdef ALLEGRO_CFG_SHADER_HLSL + case A5O_SHADER_HLSL: + case A5O_SHADER_HLSL_MINIMAL: + case A5O_SHADER_HLSL_SM_3_0: +#ifdef A5O_CFG_SHADER_HLSL switch (type) { - case ALLEGRO_VERTEX_SHADER: + case A5O_VERTEX_SHADER: return default_hlsl_vertex_source; - case ALLEGRO_PIXEL_SHADER: + case A5O_PIXEL_SHADER: return default_hlsl_pixel_source; } #endif break; - case ALLEGRO_SHADER_AUTO: - case ALLEGRO_SHADER_AUTO_MINIMAL: + case A5O_SHADER_AUTO: + case A5O_SHADER_AUTO_MINIMAL: ASSERT(0); } return NULL; } -void _al_set_bitmap_shader_field(ALLEGRO_BITMAP *bmp, ALLEGRO_SHADER *shader) +void _al_set_bitmap_shader_field(A5O_BITMAP *bmp, A5O_SHADER *shader) { ASSERT(bmp); @@ -470,9 +470,9 @@ void _al_set_bitmap_shader_field(ALLEGRO_BITMAP *bmp, ALLEGRO_SHADER *shader) } } -void _al_register_shader_bitmap(ALLEGRO_SHADER *shader, ALLEGRO_BITMAP *bmp) +void _al_register_shader_bitmap(A5O_SHADER *shader, A5O_BITMAP *bmp) { - ALLEGRO_BITMAP **slot; + A5O_BITMAP **slot; ASSERT(shader); ASSERT(bmp); @@ -480,7 +480,7 @@ void _al_register_shader_bitmap(ALLEGRO_SHADER *shader, ALLEGRO_BITMAP *bmp) *slot = bmp; } -void _al_unregister_shader_bitmap(ALLEGRO_SHADER *shader, ALLEGRO_BITMAP *bmp) +void _al_unregister_shader_bitmap(A5O_SHADER *shader, A5O_BITMAP *bmp) { bool deleted; ASSERT(shader); @@ -490,12 +490,12 @@ void _al_unregister_shader_bitmap(ALLEGRO_SHADER *shader, ALLEGRO_BITMAP *bmp) ASSERT(deleted); } -ALLEGRO_SHADER *_al_create_default_shader(ALLEGRO_DISPLAY *display) +A5O_SHADER *_al_create_default_shader(A5O_DISPLAY *display) { - ALLEGRO_SHADER *shader; - ALLEGRO_SHADER_PLATFORM platform = resolve_platform( + A5O_SHADER *shader; + A5O_SHADER_PLATFORM platform = resolve_platform( display, - display->extra_settings.settings[ALLEGRO_DEFAULT_SHADER_PLATFORM] + display->extra_settings.settings[A5O_DEFAULT_SHADER_PLATFORM] ); _al_push_destructor_owner(); @@ -503,23 +503,23 @@ ALLEGRO_SHADER *_al_create_default_shader(ALLEGRO_DISPLAY *display) _al_pop_destructor_owner(); if (!shader) { - ALLEGRO_ERROR("Error creating default shader.\n"); + A5O_ERROR("Error creating default shader.\n"); return false; } - if (!al_attach_shader_source(shader, ALLEGRO_VERTEX_SHADER, - al_get_default_shader_source(platform, ALLEGRO_VERTEX_SHADER))) { - ALLEGRO_ERROR("al_attach_shader_source for vertex shader failed: %s\n", + if (!al_attach_shader_source(shader, A5O_VERTEX_SHADER, + al_get_default_shader_source(platform, A5O_VERTEX_SHADER))) { + A5O_ERROR("al_attach_shader_source for vertex shader failed: %s\n", al_get_shader_log(shader)); goto fail; } - if (!al_attach_shader_source(shader, ALLEGRO_PIXEL_SHADER, - al_get_default_shader_source(platform, ALLEGRO_PIXEL_SHADER))) { - ALLEGRO_ERROR("al_attach_shader_source for pixel shader failed: %s\n", + if (!al_attach_shader_source(shader, A5O_PIXEL_SHADER, + al_get_default_shader_source(platform, A5O_PIXEL_SHADER))) { + A5O_ERROR("al_attach_shader_source for pixel shader failed: %s\n", al_get_shader_log(shader)); goto fail; } if (!al_build_shader(shader)) { - ALLEGRO_ERROR("al_build_shader failed: %s\n", al_get_shader_log(shader)); + A5O_ERROR("al_build_shader failed: %s\n", al_get_shader_log(shader)); goto fail; } return shader; diff --git a/src/shader_source.inc b/src/shader_source.inc index f2dbd98f0a..c0e9e8999a 100644 --- a/src/shader_source.inc +++ b/src/shader_source.inc @@ -14,38 +14,38 @@ */ -#ifdef ALLEGRO_CFG_SHADER_GLSL +#ifdef A5O_CFG_SHADER_GLSL static const char *default_glsl_vertex_source = - "attribute vec4 " ALLEGRO_SHADER_VAR_POS ";\n" - "attribute vec4 " ALLEGRO_SHADER_VAR_COLOR ";\n" - "attribute vec2 " ALLEGRO_SHADER_VAR_TEXCOORD ";\n" - "uniform mat4 " ALLEGRO_SHADER_VAR_PROJVIEW_MATRIX ";\n" - "uniform bool " ALLEGRO_SHADER_VAR_USE_TEX_MATRIX ";\n" - "uniform mat4 " ALLEGRO_SHADER_VAR_TEX_MATRIX ";\n" + "attribute vec4 " A5O_SHADER_VAR_POS ";\n" + "attribute vec4 " A5O_SHADER_VAR_COLOR ";\n" + "attribute vec2 " A5O_SHADER_VAR_TEXCOORD ";\n" + "uniform mat4 " A5O_SHADER_VAR_PROJVIEW_MATRIX ";\n" + "uniform bool " A5O_SHADER_VAR_USE_TEX_MATRIX ";\n" + "uniform mat4 " A5O_SHADER_VAR_TEX_MATRIX ";\n" "varying vec4 varying_color;\n" "varying vec2 varying_texcoord;\n" "void main()\n" "{\n" - " varying_color = " ALLEGRO_SHADER_VAR_COLOR ";\n" - " if (" ALLEGRO_SHADER_VAR_USE_TEX_MATRIX ") {\n" - " vec4 uv = " ALLEGRO_SHADER_VAR_TEX_MATRIX " * vec4(" ALLEGRO_SHADER_VAR_TEXCOORD ", 0, 1);\n" + " varying_color = " A5O_SHADER_VAR_COLOR ";\n" + " if (" A5O_SHADER_VAR_USE_TEX_MATRIX ") {\n" + " vec4 uv = " A5O_SHADER_VAR_TEX_MATRIX " * vec4(" A5O_SHADER_VAR_TEXCOORD ", 0, 1);\n" " varying_texcoord = vec2(uv.x, uv.y);\n" " }\n" " else\n" - " varying_texcoord = " ALLEGRO_SHADER_VAR_TEXCOORD";\n" - " gl_Position = " ALLEGRO_SHADER_VAR_PROJVIEW_MATRIX " * " ALLEGRO_SHADER_VAR_POS ";\n" + " varying_texcoord = " A5O_SHADER_VAR_TEXCOORD";\n" + " gl_Position = " A5O_SHADER_VAR_PROJVIEW_MATRIX " * " A5O_SHADER_VAR_POS ";\n" "}\n"; static const char *default_glsl_pixel_source = "#ifdef GL_ES\n" "precision lowp float;\n" "#endif\n" - "uniform sampler2D " ALLEGRO_SHADER_VAR_TEX ";\n" - "uniform bool " ALLEGRO_SHADER_VAR_USE_TEX ";\n" - "uniform bool " ALLEGRO_SHADER_VAR_ALPHA_TEST ";\n" - "uniform int " ALLEGRO_SHADER_VAR_ALPHA_FUNCTION ";\n" - "uniform float " ALLEGRO_SHADER_VAR_ALPHA_TEST_VALUE ";\n" + "uniform sampler2D " A5O_SHADER_VAR_TEX ";\n" + "uniform bool " A5O_SHADER_VAR_USE_TEX ";\n" + "uniform bool " A5O_SHADER_VAR_ALPHA_TEST ";\n" + "uniform int " A5O_SHADER_VAR_ALPHA_FUNCTION ";\n" + "uniform float " A5O_SHADER_VAR_ALPHA_TEST_VALUE ";\n" "varying vec4 varying_color;\n" "varying vec2 varying_texcoord;\n" "\n" @@ -54,12 +54,12 @@ static const char *default_glsl_pixel_source = "void main()\n" "{\n" " vec4 c;\n" - " if (" ALLEGRO_SHADER_VAR_USE_TEX ")\n" - " c = varying_color * texture2D(" ALLEGRO_SHADER_VAR_TEX ", varying_texcoord);\n" + " if (" A5O_SHADER_VAR_USE_TEX ")\n" + " c = varying_color * texture2D(" A5O_SHADER_VAR_TEX ", varying_texcoord);\n" " else\n" " c = varying_color;\n" - " if (!" ALLEGRO_SHADER_VAR_ALPHA_TEST " || alpha_test_func(c.a, " ALLEGRO_SHADER_VAR_ALPHA_FUNCTION ", " - ALLEGRO_SHADER_VAR_ALPHA_TEST_VALUE "))\n" + " if (!" A5O_SHADER_VAR_ALPHA_TEST " || alpha_test_func(c.a, " A5O_SHADER_VAR_ALPHA_FUNCTION ", " + A5O_SHADER_VAR_ALPHA_TEST_VALUE "))\n" " gl_FragColor = c;\n" " else\n" " discard;\n" @@ -67,15 +67,15 @@ static const char *default_glsl_pixel_source = "\n" "bool alpha_test_func(float x, int op, float compare)\n" "{\n" - // Note: These must be aligned with the ALLEGRO_RENDER_FUNCTION enum values. - " if (op == 0) return false;\n" // ALLEGRO_RENDER_NEVER - " else if (op == 1) return true;\n" // ALLEGRO_RENDER_ALWAYS - " else if (op == 2) return x < compare;\n" // ALLEGRO_RENDER_LESS - " else if (op == 3) return x == compare;\n" // ALLEGRO_RENDER_EQUAL - " else if (op == 4) return x <= compare;\n" // ALLEGRO_RENDER_LESS_EQUAL - " else if (op == 5) return x > compare;\n" // ALLEGRO_RENDER_GREATER - " else if (op == 6) return x != compare;\n" // ALLEGRO_RENDER_NOT_EQUAL - " else if (op == 7) return x >= compare;\n" // ALLEGRO_RENDER_GREATER_EQUAL + // Note: These must be aligned with the A5O_RENDER_FUNCTION enum values. + " if (op == 0) return false;\n" // A5O_RENDER_NEVER + " else if (op == 1) return true;\n" // A5O_RENDER_ALWAYS + " else if (op == 2) return x < compare;\n" // A5O_RENDER_LESS + " else if (op == 3) return x == compare;\n" // A5O_RENDER_EQUAL + " else if (op == 4) return x <= compare;\n" // A5O_RENDER_LESS_EQUAL + " else if (op == 5) return x > compare;\n" // A5O_RENDER_GREATER + " else if (op == 6) return x != compare;\n" // A5O_RENDER_NOT_EQUAL + " else if (op == 7) return x >= compare;\n" // A5O_RENDER_GREATER_EQUAL " return false;\n" "}\n"; @@ -83,25 +83,25 @@ static const char *default_glsl_minimal_pixel_source = "#ifdef GL_ES\n" "precision lowp float;\n" "#endif\n" - "uniform sampler2D " ALLEGRO_SHADER_VAR_TEX ";\n" - "uniform bool " ALLEGRO_SHADER_VAR_USE_TEX ";\n" + "uniform sampler2D " A5O_SHADER_VAR_TEX ";\n" + "uniform bool " A5O_SHADER_VAR_USE_TEX ";\n" "varying vec4 varying_color;\n" "varying vec2 varying_texcoord;\n" "\n" "void main()\n" "{\n" " vec4 c;\n" - " if (" ALLEGRO_SHADER_VAR_USE_TEX ")\n" - " c = varying_color * texture2D(" ALLEGRO_SHADER_VAR_TEX ", varying_texcoord);\n" + " if (" A5O_SHADER_VAR_USE_TEX ")\n" + " c = varying_color * texture2D(" A5O_SHADER_VAR_TEX ", varying_texcoord);\n" " else\n" " c = varying_color;\n" " gl_FragColor = c;\n" "}\n"; -#endif /* ALLEGRO_CFG_SHADER_GLSL */ +#endif /* A5O_CFG_SHADER_GLSL */ -#ifdef ALLEGRO_CFG_SHADER_HLSL +#ifdef A5O_CFG_SHADER_HLSL static const char *default_hlsl_vertex_source = "struct VS_INPUT\n" @@ -117,35 +117,35 @@ static const char *default_hlsl_vertex_source = " float2 TexCoord : TEXCOORD0;\n" "};\n" "\n" - "float4x4 " ALLEGRO_SHADER_VAR_PROJVIEW_MATRIX ";\n" - "bool " ALLEGRO_SHADER_VAR_USE_TEX_MATRIX ";\n" - "float4x4 " ALLEGRO_SHADER_VAR_TEX_MATRIX ";\n" + "float4x4 " A5O_SHADER_VAR_PROJVIEW_MATRIX ";\n" + "bool " A5O_SHADER_VAR_USE_TEX_MATRIX ";\n" + "float4x4 " A5O_SHADER_VAR_TEX_MATRIX ";\n" "\n" "VS_OUTPUT vs_main(VS_INPUT Input)\n" "{\n" " VS_OUTPUT Output;\n" " Output.Color = Input.Color;\n" - " if (" ALLEGRO_SHADER_VAR_USE_TEX_MATRIX ") {\n" + " if (" A5O_SHADER_VAR_USE_TEX_MATRIX ") {\n" " Output.TexCoord = mul(float4(Input.TexCoord, 1.0f, 0.0f), " - ALLEGRO_SHADER_VAR_TEX_MATRIX ").xy;\n" + A5O_SHADER_VAR_TEX_MATRIX ").xy;\n" " }\n" " else {\n" " Output.TexCoord = Input.TexCoord;\n" " }\n" - " Output.Position = mul(Input.Position, " ALLEGRO_SHADER_VAR_PROJVIEW_MATRIX ");\n" + " Output.Position = mul(Input.Position, " A5O_SHADER_VAR_PROJVIEW_MATRIX ");\n" " return Output;\n" "}\n"; static const char *default_hlsl_pixel_source = - "bool " ALLEGRO_SHADER_VAR_USE_TEX ";\n" - "texture " ALLEGRO_SHADER_VAR_TEX ";\n" + "bool " A5O_SHADER_VAR_USE_TEX ";\n" + "texture " A5O_SHADER_VAR_TEX ";\n" "sampler2D s = sampler_state {\n" - " texture = <" ALLEGRO_SHADER_VAR_TEX ">;\n" + " texture = <" A5O_SHADER_VAR_TEX ">;\n" "};\n" "\n" "float4 ps_main(VS_OUTPUT Input) : COLOR0\n" "{\n" - " if (" ALLEGRO_SHADER_VAR_USE_TEX ") {\n" + " if (" A5O_SHADER_VAR_USE_TEX ") {\n" " return Input.Color * tex2D(s, Input.TexCoord);\n" " }\n" " else {\n" @@ -153,7 +153,7 @@ static const char *default_hlsl_pixel_source = " }\n" "}\n"; -#endif /* ALLEGRO_CFG_SHADER_HLSL */ +#endif /* A5O_CFG_SHADER_HLSL */ /* vim: set ft=c sts=3 sw=3 et: */ diff --git a/src/system.c b/src/system.c index bbf81d2b08..2b1feb72bc 100644 --- a/src/system.c +++ b/src/system.c @@ -20,11 +20,11 @@ #include "allegro5/allegro.h" #include "allegro5/internal/aintern.h" -#ifdef ALLEGRO_CFG_SHADER_GLSL +#ifdef A5O_CFG_SHADER_GLSL #include "allegro5/allegro_opengl.h" #include "allegro5/internal/aintern_opengl.h" #endif -#include ALLEGRO_INTERNAL_HEADER +#include A5O_INTERNAL_HEADER #include "allegro5/internal/aintern_bitmap.h" #include "allegro5/internal/aintern_debug.h" #include "allegro5/internal/aintern_dtor.h" @@ -36,13 +36,13 @@ #include "allegro5/internal/aintern_tls.h" #include "allegro5/internal/aintern_vector.h" -ALLEGRO_DEBUG_CHANNEL("system") +A5O_DEBUG_CHANNEL("system") -static ALLEGRO_SYSTEM *active_sysdrv = NULL; -static ALLEGRO_CONFIG *sys_config = NULL; +static A5O_SYSTEM *active_sysdrv = NULL; +static A5O_CONFIG *sys_config = NULL; _AL_VECTOR _al_system_interfaces; -static _AL_VECTOR _user_system_interfaces = _AL_VECTOR_INITIALIZER(ALLEGRO_SYSTEM_INTERFACE *); +static _AL_VECTOR _user_system_interfaces = _AL_VECTOR_INITIALIZER(A5O_SYSTEM_INTERFACE *); _AL_DTOR_LIST *_al_dtor_list = NULL; @@ -53,11 +53,11 @@ static char _al_org_name[256] = ""; -static ALLEGRO_SYSTEM *find_system(_AL_VECTOR *vector) +static A5O_SYSTEM *find_system(_AL_VECTOR *vector) { - ALLEGRO_SYSTEM_INTERFACE **sptr; - ALLEGRO_SYSTEM_INTERFACE *sys_interface; - ALLEGRO_SYSTEM *system; + A5O_SYSTEM_INTERFACE **sptr; + A5O_SYSTEM_INTERFACE *sys_interface; + A5O_SYSTEM *system; unsigned int i; for (i = 0; i < vector->_size; i++) { @@ -84,7 +84,7 @@ static void shutdown_system_driver(void) while (!_al_vector_is_empty(&_al_system_interfaces)) _al_vector_delete_at(&_al_system_interfaces, _al_vector_size(&_al_system_interfaces)-1); _al_vector_free(&_al_system_interfaces); - _al_vector_init(&_al_system_interfaces, sizeof(ALLEGRO_SYSTEM_INTERFACE *)); + _al_vector_init(&_al_system_interfaces, sizeof(A5O_SYSTEM_INTERFACE *)); } al_destroy_config(sys_config); sys_config = NULL; @@ -96,21 +96,21 @@ static void shutdown_system_driver(void) * initialised. Before that, we need to call the underlying functions * directly. */ -static ALLEGRO_PATH *early_get_exename_path(void) +static A5O_PATH *early_get_exename_path(void) { -#if defined(ALLEGRO_WINDOWS) - return _al_win_get_path(ALLEGRO_EXENAME_PATH); -#elif defined(ALLEGRO_MACOSX) - return _al_osx_get_path(ALLEGRO_EXENAME_PATH); -#elif defined(ALLEGRO_IPHONE) - return _al_iphone_get_path(ALLEGRO_EXENAME_PATH); -#elif defined(ALLEGRO_UNIX) - return _al_unix_get_path(ALLEGRO_EXENAME_PATH); -#elif defined(ALLEGRO_ANDROID) - return _al_android_get_path(ALLEGRO_EXENAME_PATH); -#elif defined(ALLEGRO_SDL) +#if defined(A5O_WINDOWS) + return _al_win_get_path(A5O_EXENAME_PATH); +#elif defined(A5O_MACOSX) + return _al_osx_get_path(A5O_EXENAME_PATH); +#elif defined(A5O_IPHONE) + return _al_iphone_get_path(A5O_EXENAME_PATH); +#elif defined(A5O_UNIX) + return _al_unix_get_path(A5O_EXENAME_PATH); +#elif defined(A5O_ANDROID) + return _al_android_get_path(A5O_EXENAME_PATH); +#elif defined(A5O_SDL) char* p = SDL_GetBasePath(); - ALLEGRO_PATH *path = al_create_path_for_directory(p); + A5O_PATH *path = al_create_path_for_directory(p); SDL_free(p); return path; #else @@ -124,20 +124,20 @@ static void read_allegro_cfg(void) { /* We assume that the stdio file interface is in effect. */ - ALLEGRO_PATH *path; - ALLEGRO_CONFIG *temp; + A5O_PATH *path; + A5O_CONFIG *temp; if (!sys_config) sys_config = al_create_config(); -#if defined(ALLEGRO_UNIX) && !defined(ALLEGRO_IPHONE) +#if defined(A5O_UNIX) && !defined(A5O_IPHONE) temp = al_load_config_file("/etc/allegro5rc"); if (temp) { al_merge_config_into(sys_config, temp); al_destroy_config(temp); } - path = _al_unix_get_path(ALLEGRO_USER_HOME_PATH); + path = _al_unix_get_path(A5O_USER_HOME_PATH); if (path) { al_set_path_filename(path, "allegro5rc"); temp = al_load_config_file(al_path_cstr(path, '/')); @@ -158,7 +158,7 @@ static void read_allegro_cfg(void) path = early_get_exename_path(); if (path) { al_set_path_filename(path, "allegro5.cfg"); - temp = al_load_config_file(al_path_cstr(path, ALLEGRO_NATIVE_PATH_SEP)); + temp = al_load_config_file(al_path_cstr(path, A5O_NATIVE_PATH_SEP)); if (temp) { al_merge_config_into(sys_config, temp); al_destroy_config(temp); @@ -184,7 +184,7 @@ static void read_allegro_cfg(void) */ static bool compatible_versions(int a, int b) { - int a_unstable = a & _ALLEGRO_UNSTABLE_BIT_SET; + int a_unstable = a & _A5O_UNSTABLE_BIT_SET; int a_major = (a & 0x7f000000) >> 24; int a_sub = (a & 0x00ff0000) >> 16; @@ -215,8 +215,8 @@ static bool compatible_versions(int a, int b) */ bool al_install_system(int version, int (*atexit_ptr)(void (*)(void))) { - ALLEGRO_SYSTEM bootstrap; - ALLEGRO_SYSTEM *real_system; + A5O_SYSTEM bootstrap; + A5O_SYSTEM *real_system; int library_version = al_get_allegro_version(); if (active_sysdrv) { @@ -233,14 +233,14 @@ bool al_install_system(int version, int (*atexit_ptr)(void (*)(void))) _al_tls_init_once(); _al_reinitialize_tls_values(); - _al_vector_init(&_al_system_interfaces, sizeof(ALLEGRO_SYSTEM_INTERFACE *)); + _al_vector_init(&_al_system_interfaces, sizeof(A5O_SYSTEM_INTERFACE *)); /* Set up a bootstrap system so the calls expecting it don't freak out */ memset(&bootstrap, 0, sizeof(bootstrap)); active_sysdrv = &bootstrap; read_allegro_cfg(); -#ifdef ALLEGRO_BCC32 +#ifdef A5O_BCC32 /* This supresses exceptions on floating point divide by zero */ _control87(MCW_EM, MCW_EM); #endif @@ -268,7 +268,7 @@ bool al_install_system(int version, int (*atexit_ptr)(void (*)(void))) al_get_system_config(), "graphics", "min_bitmap_size"); active_sysdrv->min_bitmap_size = min_bitmap_size ? atoi(min_bitmap_size) : 16; - ALLEGRO_INFO("Allegro version: %s\n", ALLEGRO_VERSION_STR); + A5O_INFO("Allegro version: %s\n", A5O_VERSION_STR); if (strcmp(al_get_app_name(), "") == 0) { al_set_app_name(NULL); @@ -286,7 +286,7 @@ bool al_install_system(int version, int (*atexit_ptr)(void (*)(void))) _al_init_timers(); -#ifdef ALLEGRO_CFG_SHADER_GLSL +#ifdef A5O_CFG_SHADER_GLSL _al_glsl_init_shaders(); #endif @@ -294,7 +294,7 @@ bool al_install_system(int version, int (*atexit_ptr)(void (*)(void))) active_sysdrv->vt->heartbeat_init(); if (atexit_ptr && atexit_virgin) { -#ifndef ALLEGRO_ANDROID +#ifndef A5O_ANDROID atexit_ptr(al_uninstall_system); #endif atexit_virgin = false; @@ -325,7 +325,7 @@ void al_uninstall_system(void) _al_shutdown_destructors(_al_dtor_list); _al_dtor_list = NULL; -#ifdef ALLEGRO_CFG_SHADER_GLSL +#ifdef A5O_CFG_SHADER_GLSL _al_glsl_shutdown_shaders(); #endif @@ -350,16 +350,16 @@ bool al_is_system_installed(void) /* Hidden function: al_get_system_driver * This was exported and documented in 5.0rc1 but probably shouldn't have been - * as ALLEGRO_SYSTEM is not documented. + * as A5O_SYSTEM is not documented. */ -ALLEGRO_SYSTEM *al_get_system_driver(void) +A5O_SYSTEM *al_get_system_driver(void) { return active_sysdrv; } /* Function: al_get_system_id */ -ALLEGRO_SYSTEM_ID al_get_system_id(void) +A5O_SYSTEM_ID al_get_system_id(void) { ASSERT(active_sysdrv); return active_sysdrv->vt->id; @@ -367,7 +367,7 @@ ALLEGRO_SYSTEM_ID al_get_system_id(void) /* Function: al_get_system_config */ -ALLEGRO_CONFIG *al_get_system_config(void) +A5O_CONFIG *al_get_system_config(void) { if (!sys_config) sys_config = al_create_config(); @@ -377,17 +377,17 @@ ALLEGRO_CONFIG *al_get_system_config(void) /* Function: al_get_standard_path */ -ALLEGRO_PATH *al_get_standard_path(int id) +A5O_PATH *al_get_standard_path(int id) { ASSERT(active_sysdrv); ASSERT(active_sysdrv->vt); ASSERT(active_sysdrv->vt->get_path); - if (id == ALLEGRO_EXENAME_PATH && active_sysdrv->user_exe_path) + if (id == A5O_EXENAME_PATH && active_sysdrv->user_exe_path) return al_clone_path(active_sysdrv->user_exe_path); - if (id == ALLEGRO_RESOURCES_PATH && active_sysdrv->user_exe_path) { - ALLEGRO_PATH *exe_dir = al_clone_path(active_sysdrv->user_exe_path); + if (id == A5O_RESOURCES_PATH && active_sysdrv->user_exe_path) { + A5O_PATH *exe_dir = al_clone_path(active_sysdrv->user_exe_path); al_set_path_filename(exe_dir, NULL); return exe_dir; } @@ -430,8 +430,8 @@ void al_set_app_name(const char *app_name) _al_sane_strncpy(_al_app_name, app_name, sizeof(_al_app_name)); } else { - ALLEGRO_PATH *path; - path = al_get_standard_path(ALLEGRO_EXENAME_PATH); + A5O_PATH *path; + path = al_get_standard_path(A5O_EXENAME_PATH); _al_sane_strncpy(_al_app_name, al_get_path_filename(path), sizeof(_al_app_name)); al_destroy_path(path); } @@ -523,7 +523,7 @@ void al_rest(double seconds) /* Function: al_init_timeout */ -void al_init_timeout(ALLEGRO_TIMEOUT *timeout, double seconds) +void al_init_timeout(A5O_TIMEOUT *timeout, double seconds) { ASSERT(active_sysdrv); diff --git a/src/threads.c b/src/threads.c index 3a77061355..24eb39e283 100644 --- a/src/threads.c +++ b/src/threads.c @@ -34,7 +34,7 @@ typedef enum THREAD_STATE { } THREAD_STATE; -struct ALLEGRO_THREAD { +struct A5O_THREAD { _AL_THREAD thread; _AL_MUTEX mutex; _AL_COND cond; @@ -45,20 +45,20 @@ struct ALLEGRO_THREAD { }; -struct ALLEGRO_MUTEX { +struct A5O_MUTEX { _AL_MUTEX mutex; }; -struct ALLEGRO_COND { +struct A5O_COND { _AL_COND cond; }; static void thread_func_trampoline(_AL_THREAD *inner, void *_outer) { - ALLEGRO_THREAD *outer = (ALLEGRO_THREAD *) _outer; - ALLEGRO_SYSTEM *system = al_get_system_driver(); + A5O_THREAD *outer = (A5O_THREAD *) _outer; + A5O_SYSTEM *system = al_get_system_driver(); (void)inner; if (system && system->vt && system->vt->thread_init) { @@ -77,7 +77,7 @@ static void thread_func_trampoline(_AL_THREAD *inner, void *_outer) if (outer->thread_state == THREAD_STATE_STARTING) { outer->thread_state = THREAD_STATE_STARTED; outer->retval = - ((void *(*)(ALLEGRO_THREAD *, void *))outer->proc)(outer, outer->arg); + ((void *(*)(A5O_THREAD *, void *))outer->proc)(outer, outer->arg); } if (system && system->vt && system->vt->thread_exit) { @@ -88,7 +88,7 @@ static void thread_func_trampoline(_AL_THREAD *inner, void *_outer) static void detached_thread_func_trampoline(_AL_THREAD *inner, void *_outer) { - ALLEGRO_THREAD *outer = (ALLEGRO_THREAD *) _outer; + A5O_THREAD *outer = (A5O_THREAD *) _outer; (void)inner; ((void *(*)(void *))outer->proc)(outer->arg); @@ -96,9 +96,9 @@ static void detached_thread_func_trampoline(_AL_THREAD *inner, void *_outer) } -static ALLEGRO_THREAD *create_thread(void) +static A5O_THREAD *create_thread(void) { - ALLEGRO_THREAD *outer; + A5O_THREAD *outer; outer = al_malloc(sizeof(*outer)); if (!outer) { @@ -112,10 +112,10 @@ static ALLEGRO_THREAD *create_thread(void) /* Function: al_create_thread */ -ALLEGRO_THREAD *al_create_thread( - void *(*proc)(ALLEGRO_THREAD *thread, void *arg), void *arg) +A5O_THREAD *al_create_thread( + void *(*proc)(A5O_THREAD *thread, void *arg), void *arg) { - ALLEGRO_THREAD *outer = create_thread(); + A5O_THREAD *outer = create_thread(); outer->thread_state = THREAD_STATE_CREATED; _al_mutex_init(&outer->mutex); _al_cond_init(&outer->cond); @@ -128,10 +128,10 @@ ALLEGRO_THREAD *al_create_thread( /* Function: al_create_thread_with_stacksize */ -ALLEGRO_THREAD *al_create_thread_with_stacksize( - void *(*proc)(ALLEGRO_THREAD *thread, void *arg), void *arg, size_t stacksize) +A5O_THREAD *al_create_thread_with_stacksize( + void *(*proc)(A5O_THREAD *thread, void *arg), void *arg, size_t stacksize) { - ALLEGRO_THREAD *outer = create_thread(); + A5O_THREAD *outer = create_thread(); outer->thread_state = THREAD_STATE_CREATED; _al_mutex_init(&outer->mutex); _al_cond_init(&outer->cond); @@ -146,7 +146,7 @@ ALLEGRO_THREAD *al_create_thread_with_stacksize( */ void al_run_detached_thread(void *(*proc)(void *arg), void *arg) { - ALLEGRO_THREAD *outer = create_thread(); + A5O_THREAD *outer = create_thread(); outer->thread_state = THREAD_STATE_DETACHED; outer->arg = arg; outer->proc = proc; @@ -157,7 +157,7 @@ void al_run_detached_thread(void *(*proc)(void *arg), void *arg) /* Function: al_start_thread */ -void al_start_thread(ALLEGRO_THREAD *thread) +void al_start_thread(A5O_THREAD *thread) { ASSERT(thread); @@ -191,7 +191,7 @@ void al_start_thread(ALLEGRO_THREAD *thread) /* Function: al_join_thread */ -void al_join_thread(ALLEGRO_THREAD *thread, void **ret_value) +void al_join_thread(A5O_THREAD *thread, void **ret_value) { ASSERT(thread); @@ -241,7 +241,7 @@ void al_join_thread(ALLEGRO_THREAD *thread, void **ret_value) /* Function: al_set_thread_should_stop */ -void al_set_thread_should_stop(ALLEGRO_THREAD *thread) +void al_set_thread_should_stop(A5O_THREAD *thread) { ASSERT(thread); _al_thread_set_should_stop(&thread->thread); @@ -250,7 +250,7 @@ void al_set_thread_should_stop(ALLEGRO_THREAD *thread) /* Function: al_get_thread_should_stop */ -bool al_get_thread_should_stop(ALLEGRO_THREAD *thread) +bool al_get_thread_should_stop(A5O_THREAD *thread) { ASSERT(thread); return _al_get_thread_should_stop(&thread->thread); @@ -259,7 +259,7 @@ bool al_get_thread_should_stop(ALLEGRO_THREAD *thread) /* Function: al_destroy_thread */ -void al_destroy_thread(ALLEGRO_THREAD *thread) +void al_destroy_thread(A5O_THREAD *thread) { if (!thread) { return; @@ -293,9 +293,9 @@ void al_destroy_thread(ALLEGRO_THREAD *thread) /* Function: al_create_mutex */ -ALLEGRO_MUTEX *al_create_mutex(void) +A5O_MUTEX *al_create_mutex(void) { - ALLEGRO_MUTEX *mutex = al_malloc(sizeof(*mutex)); + A5O_MUTEX *mutex = al_malloc(sizeof(*mutex)); if (mutex) { _AL_MARK_MUTEX_UNINITED(mutex->mutex); _al_mutex_init(&mutex->mutex); @@ -306,9 +306,9 @@ ALLEGRO_MUTEX *al_create_mutex(void) /* Function: al_create_mutex_recursive */ -ALLEGRO_MUTEX *al_create_mutex_recursive(void) +A5O_MUTEX *al_create_mutex_recursive(void) { - ALLEGRO_MUTEX *mutex = al_malloc(sizeof(*mutex)); + A5O_MUTEX *mutex = al_malloc(sizeof(*mutex)); if (mutex) { _AL_MARK_MUTEX_UNINITED(mutex->mutex); _al_mutex_init_recursive(&mutex->mutex); @@ -319,7 +319,7 @@ ALLEGRO_MUTEX *al_create_mutex_recursive(void) /* Function: al_lock_mutex */ -void al_lock_mutex(ALLEGRO_MUTEX *mutex) +void al_lock_mutex(A5O_MUTEX *mutex) { ASSERT(mutex); _al_mutex_lock(&mutex->mutex); @@ -329,7 +329,7 @@ void al_lock_mutex(ALLEGRO_MUTEX *mutex) /* Function: al_unlock_mutex */ -void al_unlock_mutex(ALLEGRO_MUTEX *mutex) +void al_unlock_mutex(A5O_MUTEX *mutex) { ASSERT(mutex); _al_mutex_unlock(&mutex->mutex); @@ -338,7 +338,7 @@ void al_unlock_mutex(ALLEGRO_MUTEX *mutex) /* Function: al_destroy_mutex */ -void al_destroy_mutex(ALLEGRO_MUTEX *mutex) +void al_destroy_mutex(A5O_MUTEX *mutex) { if (mutex) { _al_mutex_destroy(&mutex->mutex); @@ -349,9 +349,9 @@ void al_destroy_mutex(ALLEGRO_MUTEX *mutex) /* Function: al_create_cond */ -ALLEGRO_COND *al_create_cond(void) +A5O_COND *al_create_cond(void) { - ALLEGRO_COND *cond = al_malloc(sizeof(*cond)); + A5O_COND *cond = al_malloc(sizeof(*cond)); if (cond) { _al_cond_init(&cond->cond); } @@ -361,7 +361,7 @@ ALLEGRO_COND *al_create_cond(void) /* Function: al_destroy_cond */ -void al_destroy_cond(ALLEGRO_COND *cond) +void al_destroy_cond(A5O_COND *cond) { if (cond) { _al_cond_destroy(&cond->cond); @@ -372,7 +372,7 @@ void al_destroy_cond(ALLEGRO_COND *cond) /* Function: al_wait_cond */ -void al_wait_cond(ALLEGRO_COND *cond, ALLEGRO_MUTEX *mutex) +void al_wait_cond(A5O_COND *cond, A5O_MUTEX *mutex) { ASSERT(cond); ASSERT(mutex); @@ -383,8 +383,8 @@ void al_wait_cond(ALLEGRO_COND *cond, ALLEGRO_MUTEX *mutex) /* Function: al_wait_cond_until */ -int al_wait_cond_until(ALLEGRO_COND *cond, ALLEGRO_MUTEX *mutex, - const ALLEGRO_TIMEOUT *timeout) +int al_wait_cond_until(A5O_COND *cond, A5O_MUTEX *mutex, + const A5O_TIMEOUT *timeout) { ASSERT(cond); ASSERT(mutex); @@ -396,7 +396,7 @@ int al_wait_cond_until(ALLEGRO_COND *cond, ALLEGRO_MUTEX *mutex, /* Function: al_broadcast_cond */ -void al_broadcast_cond(ALLEGRO_COND *cond) +void al_broadcast_cond(A5O_COND *cond) { ASSERT(cond); @@ -406,7 +406,7 @@ void al_broadcast_cond(ALLEGRO_COND *cond) /* Function: al_signal_cond */ -void al_signal_cond(ALLEGRO_COND *cond) +void al_signal_cond(A5O_COND *cond) { ASSERT(cond); diff --git a/src/timernu.c b/src/timernu.c index ccb610ad3c..fa7753c12c 100644 --- a/src/timernu.c +++ b/src/timernu.c @@ -26,20 +26,20 @@ #include "allegro5/internal/aintern_system.h" #include "allegro5/internal/aintern_timer.h" -#ifndef ALLEGRO_MSVC -#ifndef ALLEGRO_BCC32 +#ifndef A5O_MSVC +#ifndef A5O_BCC32 #include #endif #endif /* forward declarations */ -static void timer_handle_tick(ALLEGRO_TIMER *timer); +static void timer_handle_tick(A5O_TIMER *timer); -struct ALLEGRO_TIMER +struct A5O_TIMER { - ALLEGRO_EVENT_SOURCE es; + A5O_EVENT_SOURCE es; bool started; double speed_secs; int64_t count; @@ -53,10 +53,10 @@ struct ALLEGRO_TIMER * The timer thread that runs in the background to drive the timers. */ -static ALLEGRO_MUTEX *timers_mutex; -static _AL_VECTOR active_timers = _AL_VECTOR_INITIALIZER(ALLEGRO_TIMER *); +static A5O_MUTEX *timers_mutex; +static _AL_VECTOR active_timers = _AL_VECTOR_INITIALIZER(A5O_TIMER *); static _AL_THREAD * volatile timer_thread = NULL; -static ALLEGRO_COND *timer_cond = NULL; +static A5O_COND *timer_cond = NULL; static bool destroy_thread = false; // Allegro's al_get_time measures "the time since Allegro started", and so does @@ -71,7 +71,7 @@ static bool destroy_thread = false; // See https://github.com/liballeg/allegro5/issues/1510 // Note: perhaps this could move into a new public API: al_get_uptime -#if defined(ALLEGRO_MACOSX) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 +#if defined(A5O_MACOSX) && MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 #define USE_UPTIME struct timespec _al_initial_uptime; #endif @@ -165,11 +165,11 @@ double _al_timer_thread_handle_tick(double interval) * This is to handle clock changes on platforms not using a monotonic, * suspense-free clock. */ - interval = _ALLEGRO_CLAMP(0, interval, 10.0); + interval = _A5O_CLAMP(0, interval, 10.0); for (i = 0; i < _al_vector_size(&active_timers); i++) { - ALLEGRO_TIMER **slot = _al_vector_ref(&active_timers, i); - ALLEGRO_TIMER *timer = *slot; + A5O_TIMER **slot = _al_vector_ref(&active_timers, i); + A5O_TIMER *timer = *slot; timer->counter -= interval; @@ -217,7 +217,7 @@ static void shutdown_timers(void) // logic common to al_start_timer and al_resume_timer // al_start_timer : passes reset_counter = true to start from the beginning // al_resume_timer: passes reset_counter = false to preserve the previous time -static void enable_timer(ALLEGRO_TIMER *timer, bool reset_counter) +static void enable_timer(A5O_TIMER *timer, bool reset_counter) { ASSERT(timer); { @@ -226,7 +226,7 @@ static void enable_timer(ALLEGRO_TIMER *timer, bool reset_counter) al_lock_mutex(timers_mutex); { - ALLEGRO_TIMER **slot; + A5O_TIMER **slot; timer->started = true; @@ -272,11 +272,11 @@ int _al_get_active_timers_count(void) /* Function: al_create_timer */ -ALLEGRO_TIMER *al_create_timer(double speed_secs) +A5O_TIMER *al_create_timer(double speed_secs) { ASSERT(speed_secs > 0); { - ALLEGRO_TIMER *timer = al_malloc(sizeof *timer); + A5O_TIMER *timer = al_malloc(sizeof *timer); ASSERT(timer); @@ -299,7 +299,7 @@ ALLEGRO_TIMER *al_create_timer(double speed_secs) /* Function: al_destroy_timer */ -void al_destroy_timer(ALLEGRO_TIMER *timer) +void al_destroy_timer(A5O_TIMER *timer) { if (timer) { al_stop_timer(timer); @@ -315,7 +315,7 @@ void al_destroy_timer(ALLEGRO_TIMER *timer) /* Function: al_start_timer */ -void al_start_timer(ALLEGRO_TIMER *timer) +void al_start_timer(A5O_TIMER *timer) { enable_timer(timer, true); // true to reset the counter } @@ -324,7 +324,7 @@ void al_start_timer(ALLEGRO_TIMER *timer) /* Function: al_resume_timer */ -void al_resume_timer(ALLEGRO_TIMER *timer) +void al_resume_timer(A5O_TIMER *timer) { enable_timer(timer, false); // false to preserve the counter } @@ -333,7 +333,7 @@ void al_resume_timer(ALLEGRO_TIMER *timer) /* Function: al_stop_timer */ -void al_stop_timer(ALLEGRO_TIMER *timer) +void al_stop_timer(A5O_TIMER *timer) { ASSERT(timer); { @@ -353,7 +353,7 @@ void al_stop_timer(ALLEGRO_TIMER *timer) /* Function: al_get_timer_started */ -bool al_get_timer_started(const ALLEGRO_TIMER *timer) +bool al_get_timer_started(const A5O_TIMER *timer) { ASSERT(timer); @@ -364,7 +364,7 @@ bool al_get_timer_started(const ALLEGRO_TIMER *timer) /* Function: al_get_timer_speed */ -double al_get_timer_speed(const ALLEGRO_TIMER *timer) +double al_get_timer_speed(const A5O_TIMER *timer) { ASSERT(timer); @@ -375,7 +375,7 @@ double al_get_timer_speed(const ALLEGRO_TIMER *timer) /* Function: al_set_timer_speed */ -void al_set_timer_speed(ALLEGRO_TIMER *timer, double new_speed_secs) +void al_set_timer_speed(A5O_TIMER *timer, double new_speed_secs) { ASSERT(timer); ASSERT(new_speed_secs > 0); @@ -396,7 +396,7 @@ void al_set_timer_speed(ALLEGRO_TIMER *timer, double new_speed_secs) /* Function: al_get_timer_count */ -int64_t al_get_timer_count(const ALLEGRO_TIMER *timer) +int64_t al_get_timer_count(const A5O_TIMER *timer) { ASSERT(timer); @@ -407,7 +407,7 @@ int64_t al_get_timer_count(const ALLEGRO_TIMER *timer) /* Function: al_set_timer_count */ -void al_set_timer_count(ALLEGRO_TIMER *timer, int64_t new_count) +void al_set_timer_count(A5O_TIMER *timer, int64_t new_count) { ASSERT(timer); @@ -422,7 +422,7 @@ void al_set_timer_count(ALLEGRO_TIMER *timer, int64_t new_count) /* Function: al_add_timer_count */ -void al_add_timer_count(ALLEGRO_TIMER *timer, int64_t diff) +void al_add_timer_count(A5O_TIMER *timer, int64_t diff) { ASSERT(timer); @@ -437,7 +437,7 @@ void al_add_timer_count(ALLEGRO_TIMER *timer, int64_t diff) /* timer_handle_tick: [timer thread] * Handle a single tick. */ -static void timer_handle_tick(ALLEGRO_TIMER *timer) +static void timer_handle_tick(A5O_TIMER *timer) { /* Lock out event source helper functions (e.g. the release hook * could be invoked simultaneously with this function). @@ -449,8 +449,8 @@ static void timer_handle_tick(ALLEGRO_TIMER *timer) /* Generate an event, maybe. */ if (_al_event_source_needs_to_generate_event(&timer->es)) { - ALLEGRO_EVENT event; - event.timer.type = ALLEGRO_EVENT_TIMER; + A5O_EVENT event; + event.timer.type = A5O_EVENT_TIMER; event.timer.timestamp = al_get_time(); event.timer.count = timer->count; event.timer.error = -timer->counter; @@ -464,7 +464,7 @@ static void timer_handle_tick(ALLEGRO_TIMER *timer) /* Function: al_get_timer_event_source */ -ALLEGRO_EVENT_SOURCE *al_get_timer_event_source(ALLEGRO_TIMER *timer) +A5O_EVENT_SOURCE *al_get_timer_event_source(A5O_TIMER *timer) { return &timer->es; } diff --git a/src/tls.c b/src/tls.c index 79ab39d971..64ed382f4e 100644 --- a/src/tls.c +++ b/src/tls.c @@ -45,21 +45,21 @@ #include "allegro5/internal/aintern_shader.h" #include "allegro5/internal/aintern_tls.h" -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID #include "allegro5/internal/aintern_android.h" #endif -#if defined(ALLEGRO_MINGW32) && !defined(ALLEGRO_CFG_DLL_TLS) +#if defined(A5O_MINGW32) && !defined(A5O_CFG_DLL_TLS) /* * MinGW < 4.2.1 doesn't have builtin thread local storage, so we * must use the Windows API. */ #if __GNUC__ < 4 - #define ALLEGRO_CFG_DLL_TLS + #define A5O_CFG_DLL_TLS #elif __GNUC__ == 4 && __GNUC_MINOR__ < 2 - #define ALLEGRO_CFG_DLL_TLS + #define A5O_CFG_DLL_TLS #elif __GNUC__ == 4 && __GNUC_MINOR__ == 2 && __GNUC_PATCHLEVEL__ < 1 - #define ALLEGRO_CFG_DLL_TLS + #define A5O_CFG_DLL_TLS #endif #endif @@ -74,16 +74,16 @@ typedef struct thread_local_state { int new_window_y; int new_bitmap_depth; int new_bitmap_samples; - ALLEGRO_EXTRA_DISPLAY_SETTINGS new_display_settings; + A5O_EXTRA_DISPLAY_SETTINGS new_display_settings; /* Current display */ - ALLEGRO_DISPLAY *current_display; + A5O_DISPLAY *current_display; /* Target bitmap */ - ALLEGRO_BITMAP *target_bitmap; + A5O_BITMAP *target_bitmap; /* Blender */ - ALLEGRO_BLENDER current_blender; + A5O_BLENDER current_blender; /* Bitmap parameters */ int new_bitmap_format; @@ -92,8 +92,8 @@ typedef struct thread_local_state { int new_bitmap_wrap_v; /* Files */ - const ALLEGRO_FILE_INTERFACE *new_file_interface; - const ALLEGRO_FS_INTERFACE *fs_interface; + const A5O_FILE_INTERFACE *new_file_interface; + const A5O_FS_INTERFACE *fs_interface; /* Error code */ int allegro_errno; @@ -101,9 +101,9 @@ typedef struct thread_local_state { /* Title to use for a new window/display. * This is a static buffer for API reasons. */ - char new_window_title[ALLEGRO_NEW_WINDOW_TITLE_MAX_SIZE + 1]; + char new_window_title[A5O_NEW_WINDOW_TITLE_MAX_SIZE + 1]; -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID JNIEnv *jnienv; #endif @@ -114,23 +114,23 @@ typedef struct thread_local_state { typedef struct INTERNAL_STATE { thread_local_state tls; - ALLEGRO_BLENDER stored_blender; - ALLEGRO_TRANSFORM stored_transform; - ALLEGRO_TRANSFORM stored_projection_transform; + A5O_BLENDER stored_blender; + A5O_TRANSFORM stored_transform; + A5O_TRANSFORM stored_projection_transform; int flags; } INTERNAL_STATE; -ALLEGRO_STATIC_ASSERT(tls, sizeof(ALLEGRO_STATE) > sizeof(INTERNAL_STATE)); +A5O_STATIC_ASSERT(tls, sizeof(A5O_STATE) > sizeof(INTERNAL_STATE)); -static void initialize_blender(ALLEGRO_BLENDER *b) +static void initialize_blender(A5O_BLENDER *b) { - b->blend_op = ALLEGRO_ADD; - b->blend_source = ALLEGRO_ONE, - b->blend_dest = ALLEGRO_INVERSE_ALPHA; - b->blend_alpha_op = ALLEGRO_ADD; - b->blend_alpha_source = ALLEGRO_ONE; - b->blend_alpha_dest = ALLEGRO_INVERSE_ALPHA; + b->blend_op = A5O_ADD; + b->blend_source = A5O_ONE, + b->blend_dest = A5O_INVERSE_ALPHA; + b->blend_alpha_op = A5O_ADD; + b->blend_alpha_source = A5O_ONE; + b->blend_alpha_dest = A5O_INVERSE_ALPHA; b->blend_color = al_map_rgba_f(1.0f, 1.0f, 1.0f, 1.0f); } @@ -139,18 +139,18 @@ static void initialize_tls_values(thread_local_state *tls) { memset(tls, 0, sizeof *tls); - tls->new_display_adapter = ALLEGRO_DEFAULT_DISPLAY_ADAPTER; + tls->new_display_adapter = A5O_DEFAULT_DISPLAY_ADAPTER; tls->new_window_x = INT_MAX; tls->new_window_y = INT_MAX; initialize_blender(&tls->current_blender); - tls->new_bitmap_flags = ALLEGRO_CONVERT_BITMAP; - tls->new_bitmap_format = ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA; - tls->new_bitmap_wrap_u = ALLEGRO_BITMAP_WRAP_DEFAULT; - tls->new_bitmap_wrap_v = ALLEGRO_BITMAP_WRAP_DEFAULT; + tls->new_bitmap_flags = A5O_CONVERT_BITMAP; + tls->new_bitmap_format = A5O_PIXEL_FORMAT_ANY_WITH_ALPHA; + tls->new_bitmap_wrap_u = A5O_BITMAP_WRAP_DEFAULT; + tls->new_bitmap_wrap_v = A5O_BITMAP_WRAP_DEFAULT; tls->new_file_interface = &_al_file_interface_stdio; tls->fs_interface = &_al_fs_interface_stdio; - memset(tls->new_window_title, 0, ALLEGRO_NEW_WINDOW_TITLE_MAX_SIZE + 1); + memset(tls->new_window_title, 0, A5O_NEW_WINDOW_TITLE_MAX_SIZE + 1); _al_fill_display_settings(&tls->new_display_settings); } @@ -158,13 +158,13 @@ static void initialize_tls_values(thread_local_state *tls) // FIXME: The TLS implementation below only works for dynamic linking // right now - instead of using DllMain we should simply initialize // on first request. -#ifdef ALLEGRO_STATICLINK - #undef ALLEGRO_CFG_DLL_TLS +#ifdef A5O_STATICLINK + #undef A5O_CFG_DLL_TLS #endif -#if defined(ALLEGRO_CFG_DLL_TLS) +#if defined(A5O_CFG_DLL_TLS) #include "tls_dll.inc" -#elif defined(ALLEGRO_MACOSX) || defined(ALLEGRO_IPHONE) || defined(ALLEGRO_ANDROID) || defined(ALLEGRO_RASPBERRYPI) +#elif defined(A5O_MACOSX) || defined(A5O_IPHONE) || defined(A5O_ANDROID) || defined(A5O_RASPBERRYPI) #include "tls_pthread.inc" #else #include "tls_native.inc" @@ -182,17 +182,17 @@ void _al_reinitialize_tls_values(void) -void _al_set_new_display_settings(ALLEGRO_EXTRA_DISPLAY_SETTINGS *settings) +void _al_set_new_display_settings(A5O_EXTRA_DISPLAY_SETTINGS *settings) { thread_local_state *tls; if ((tls = tls_get()) == NULL) return; - memmove(&tls->new_display_settings, settings, sizeof(ALLEGRO_EXTRA_DISPLAY_SETTINGS)); + memmove(&tls->new_display_settings, settings, sizeof(A5O_EXTRA_DISPLAY_SETTINGS)); } -ALLEGRO_EXTRA_DISPLAY_SETTINGS *_al_get_new_display_settings(void) +A5O_EXTRA_DISPLAY_SETTINGS *_al_get_new_display_settings(void) { thread_local_state *tls; @@ -297,7 +297,7 @@ void al_set_new_display_adapter(int adapter) return; if (adapter < 0) { - tls->new_display_adapter = ALLEGRO_DEFAULT_DISPLAY_ADAPTER; + tls->new_display_adapter = A5O_DEFAULT_DISPLAY_ADAPTER; } tls->new_display_adapter = adapter; } @@ -311,7 +311,7 @@ int al_get_new_display_adapter(void) thread_local_state *tls; if ((tls = tls_get()) == NULL) - return ALLEGRO_DEFAULT_DISPLAY_ADAPTER; + return A5O_DEFAULT_DISPLAY_ADAPTER; return tls->new_display_adapter; } @@ -354,7 +354,7 @@ void al_get_new_window_position(int *x, int *y) /* Make the given display current, without changing the target bitmap. * This is used internally to change the current display transiently. */ -bool _al_set_current_display_only(ALLEGRO_DISPLAY *display) +bool _al_set_current_display_only(A5O_DISPLAY *display) { thread_local_state *tls; @@ -383,7 +383,7 @@ bool _al_set_current_display_only(ALLEGRO_DISPLAY *display) /* Function: al_get_current_display */ -ALLEGRO_DISPLAY *al_get_current_display(void) +A5O_DISPLAY *al_get_current_display(void) { thread_local_state *tls; @@ -396,13 +396,13 @@ ALLEGRO_DISPLAY *al_get_current_display(void) /* Function: al_set_target_bitmap */ -void al_set_target_bitmap(ALLEGRO_BITMAP *bitmap) +void al_set_target_bitmap(A5O_BITMAP *bitmap) { thread_local_state *tls; - ALLEGRO_DISPLAY *old_display; - ALLEGRO_DISPLAY *new_display; - ALLEGRO_SHADER *old_shader; - ALLEGRO_SHADER *new_shader; + A5O_DISPLAY *old_display; + A5O_DISPLAY *new_display; + A5O_SHADER *old_shader; + A5O_SHADER *new_shader; bool same_shader; int bitmap_flags = bitmap ? al_get_bitmap_flags(bitmap) : 0; @@ -432,7 +432,7 @@ void al_set_target_bitmap(ALLEGRO_BITMAP *bitmap) new_display = NULL; new_shader = NULL; } - else if (bitmap_flags & ALLEGRO_MEMORY_BITMAP) { + else if (bitmap_flags & A5O_MEMORY_BITMAP) { /* Setting a memory bitmap doesn't change the rendering context. */ new_display = old_display; new_shader = NULL; @@ -470,7 +470,7 @@ void al_set_target_bitmap(ALLEGRO_BITMAP *bitmap) tls->target_bitmap = bitmap; if (bitmap && - !(bitmap_flags & ALLEGRO_MEMORY_BITMAP) && + !(bitmap_flags & A5O_MEMORY_BITMAP) && new_display && new_display->vt && new_display->vt->set_target_bitmap) @@ -493,7 +493,7 @@ void al_set_target_bitmap(ALLEGRO_BITMAP *bitmap) /* Function: al_set_target_backbuffer */ -void al_set_target_backbuffer(ALLEGRO_DISPLAY *display) +void al_set_target_backbuffer(A5O_DISPLAY *display) { al_set_target_bitmap(al_get_backbuffer(display)); } @@ -502,7 +502,7 @@ void al_set_target_backbuffer(ALLEGRO_DISPLAY *display) /* Function: al_get_target_bitmap */ -ALLEGRO_BITMAP *al_get_target_bitmap(void) +A5O_BITMAP *al_get_target_bitmap(void) { thread_local_state *tls; @@ -524,7 +524,7 @@ void al_set_blender(int op, int src, int dst) /* Function: al_set_blend_color */ -void al_set_blend_color(ALLEGRO_COLOR color) +void al_set_blend_color(A5O_COLOR color) { thread_local_state *tls; @@ -541,14 +541,14 @@ void al_set_separate_blender(int op, int src, int dst, int alpha_op, int alpha_src, int alpha_dst) { thread_local_state *tls; - ALLEGRO_BLENDER *b; + A5O_BLENDER *b; - ASSERT(op >= 0 && op < ALLEGRO_NUM_BLEND_OPERATIONS); - ASSERT(src >= 0 && src < ALLEGRO_NUM_BLEND_MODES); - ASSERT(dst >= 0 && src < ALLEGRO_NUM_BLEND_MODES); - ASSERT(alpha_op >= 0 && alpha_op < ALLEGRO_NUM_BLEND_OPERATIONS); - ASSERT(alpha_src >= 0 && alpha_src < ALLEGRO_NUM_BLEND_MODES); - ASSERT(alpha_dst >= 0 && alpha_dst < ALLEGRO_NUM_BLEND_MODES); + ASSERT(op >= 0 && op < A5O_NUM_BLEND_OPERATIONS); + ASSERT(src >= 0 && src < A5O_NUM_BLEND_MODES); + ASSERT(dst >= 0 && src < A5O_NUM_BLEND_MODES); + ASSERT(alpha_op >= 0 && alpha_op < A5O_NUM_BLEND_OPERATIONS); + ASSERT(alpha_src >= 0 && alpha_src < A5O_NUM_BLEND_MODES); + ASSERT(alpha_dst >= 0 && alpha_dst < A5O_NUM_BLEND_MODES); if ((tls = tls_get()) == NULL) return; @@ -576,7 +576,7 @@ void al_get_blender(int *op, int *src, int *dst) /* Function: al_get_blend_color */ -ALLEGRO_COLOR al_get_blend_color(void) +A5O_COLOR al_get_blend_color(void) { thread_local_state *tls; @@ -593,7 +593,7 @@ void al_get_separate_blender(int *op, int *src, int *dst, int *alpha_op, int *alpha_src, int *alpha_dst) { thread_local_state *tls; - ALLEGRO_BLENDER *b; + A5O_BLENDER *b; if ((tls = tls_get()) == NULL) return; @@ -689,7 +689,7 @@ int al_get_new_bitmap_flags(void) /* Function: al_store_state */ -void al_store_state(ALLEGRO_STATE *state, int flags) +void al_store_state(A5O_STATE *state, int flags) { thread_local_state *tls; INTERNAL_STATE *stored; @@ -702,7 +702,7 @@ void al_store_state(ALLEGRO_STATE *state, int flags) #define _STORE(x) (stored->tls.x = tls->x) - if (flags & ALLEGRO_STATE_NEW_DISPLAY_PARAMETERS) { + if (flags & A5O_STATE_NEW_DISPLAY_PARAMETERS) { _STORE(new_display_flags); _STORE(new_display_refresh_rate); _STORE(new_display_adapter); @@ -713,40 +713,40 @@ void al_store_state(ALLEGRO_STATE *state, int flags) sizeof(stored->tls.new_window_title)); } - if (flags & ALLEGRO_STATE_NEW_BITMAP_PARAMETERS) { + if (flags & A5O_STATE_NEW_BITMAP_PARAMETERS) { _STORE(new_bitmap_format); _STORE(new_bitmap_flags); _STORE(new_bitmap_wrap_u); _STORE(new_bitmap_wrap_v); } - if (flags & ALLEGRO_STATE_DISPLAY) { + if (flags & A5O_STATE_DISPLAY) { _STORE(current_display); } - if (flags & ALLEGRO_STATE_TARGET_BITMAP) { + if (flags & A5O_STATE_TARGET_BITMAP) { _STORE(target_bitmap); } - if (flags & ALLEGRO_STATE_BLENDER) { + if (flags & A5O_STATE_BLENDER) { stored->stored_blender = tls->current_blender; } - if (flags & ALLEGRO_STATE_NEW_FILE_INTERFACE) { + if (flags & A5O_STATE_NEW_FILE_INTERFACE) { _STORE(new_file_interface); _STORE(fs_interface); } - if (flags & ALLEGRO_STATE_TRANSFORM) { - ALLEGRO_BITMAP *target = al_get_target_bitmap(); + if (flags & A5O_STATE_TRANSFORM) { + A5O_BITMAP *target = al_get_target_bitmap(); if (!target) al_identity_transform(&stored->stored_transform); else stored->stored_transform = target->transform; } - if (flags & ALLEGRO_STATE_PROJECTION_TRANSFORM) { - ALLEGRO_BITMAP *target = al_get_target_bitmap(); + if (flags & A5O_STATE_PROJECTION_TRANSFORM) { + A5O_BITMAP *target = al_get_target_bitmap(); if (target) { stored->stored_projection_transform = target->proj_transform; } @@ -759,7 +759,7 @@ void al_store_state(ALLEGRO_STATE *state, int flags) /* Function: al_restore_state */ -void al_restore_state(ALLEGRO_STATE const *state) +void al_restore_state(A5O_STATE const *state) { thread_local_state *tls; INTERNAL_STATE *stored; @@ -773,7 +773,7 @@ void al_restore_state(ALLEGRO_STATE const *state) #define _RESTORE(x) (tls->x = stored->tls.x) - if (flags & ALLEGRO_STATE_NEW_DISPLAY_PARAMETERS) { + if (flags & A5O_STATE_NEW_DISPLAY_PARAMETERS) { _RESTORE(new_display_flags); _RESTORE(new_display_refresh_rate); _RESTORE(new_display_adapter); @@ -784,44 +784,44 @@ void al_restore_state(ALLEGRO_STATE const *state) sizeof(tls->new_window_title)); } - if (flags & ALLEGRO_STATE_NEW_BITMAP_PARAMETERS) { + if (flags & A5O_STATE_NEW_BITMAP_PARAMETERS) { _RESTORE(new_bitmap_format); _RESTORE(new_bitmap_flags); _RESTORE(new_bitmap_wrap_u); _RESTORE(new_bitmap_wrap_v); } - if (flags & ALLEGRO_STATE_DISPLAY) { + if (flags & A5O_STATE_DISPLAY) { if (tls->current_display != stored->tls.current_display) { _al_set_current_display_only(stored->tls.current_display); ASSERT(tls->current_display == stored->tls.current_display); } } - if (flags & ALLEGRO_STATE_TARGET_BITMAP) { + if (flags & A5O_STATE_TARGET_BITMAP) { if (tls->target_bitmap != stored->tls.target_bitmap) { al_set_target_bitmap(stored->tls.target_bitmap); ASSERT(tls->target_bitmap == stored->tls.target_bitmap); } } - if (flags & ALLEGRO_STATE_BLENDER) { + if (flags & A5O_STATE_BLENDER) { tls->current_blender = stored->stored_blender; } - if (flags & ALLEGRO_STATE_NEW_FILE_INTERFACE) { + if (flags & A5O_STATE_NEW_FILE_INTERFACE) { _RESTORE(new_file_interface); _RESTORE(fs_interface); } - if (flags & ALLEGRO_STATE_TRANSFORM) { - ALLEGRO_BITMAP *bitmap = al_get_target_bitmap(); + if (flags & A5O_STATE_TRANSFORM) { + A5O_BITMAP *bitmap = al_get_target_bitmap(); if (bitmap) al_use_transform(&stored->stored_transform); } - if (flags & ALLEGRO_STATE_PROJECTION_TRANSFORM) { - ALLEGRO_BITMAP *bitmap = al_get_target_bitmap(); + if (flags & A5O_STATE_PROJECTION_TRANSFORM) { + A5O_BITMAP *bitmap = al_get_target_bitmap(); if (bitmap) al_use_projection_transform(&stored->stored_projection_transform); } @@ -837,7 +837,7 @@ void al_restore_state(ALLEGRO_STATE const *state) * tries to load a configuration file before the system has been * initialised. Should probably rethink the logic here... */ -const ALLEGRO_FILE_INTERFACE *al_get_new_file_interface(void) +const A5O_FILE_INTERFACE *al_get_new_file_interface(void) { thread_local_state *tls; @@ -858,7 +858,7 @@ const ALLEGRO_FILE_INTERFACE *al_get_new_file_interface(void) /* Function: al_set_new_file_interface */ -void al_set_new_file_interface(const ALLEGRO_FILE_INTERFACE *file_interface) +void al_set_new_file_interface(const A5O_FILE_INTERFACE *file_interface) { thread_local_state *tls; @@ -871,7 +871,7 @@ void al_set_new_file_interface(const ALLEGRO_FILE_INTERFACE *file_interface) /* Function: al_get_fs_interface */ -const ALLEGRO_FS_INTERFACE *al_get_fs_interface(void) +const A5O_FS_INTERFACE *al_get_fs_interface(void) { thread_local_state *tls; @@ -888,7 +888,7 @@ const ALLEGRO_FS_INTERFACE *al_get_fs_interface(void) /* Function: al_set_fs_interface */ -void al_set_fs_interface(const ALLEGRO_FS_INTERFACE *fs_interface) +void al_set_fs_interface(const A5O_FS_INTERFACE *fs_interface) { thread_local_state *tls; @@ -955,7 +955,7 @@ SETTER(new_bitmap_samples, samples) /* Function: al_get_bitmap_wrap */ -void al_get_new_bitmap_wrap(ALLEGRO_BITMAP_WRAP *u, ALLEGRO_BITMAP_WRAP *v) +void al_get_new_bitmap_wrap(A5O_BITMAP_WRAP *u, A5O_BITMAP_WRAP *v) { ASSERT(u); ASSERT(v); @@ -970,7 +970,7 @@ void al_get_new_bitmap_wrap(ALLEGRO_BITMAP_WRAP *u, ALLEGRO_BITMAP_WRAP *v) /* Function: al_set_new_bitmap_wrap */ -void al_set_new_bitmap_wrap(ALLEGRO_BITMAP_WRAP u, ALLEGRO_BITMAP_WRAP v) +void al_set_new_bitmap_wrap(A5O_BITMAP_WRAP u, A5O_BITMAP_WRAP v) { thread_local_state *tls; if ((tls = tls_get()) == NULL) @@ -979,7 +979,7 @@ void al_set_new_bitmap_wrap(ALLEGRO_BITMAP_WRAP u, ALLEGRO_BITMAP_WRAP v) tls->new_bitmap_wrap_v = v; } -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID JNIEnv *_al_android_get_jnienv(void) GETTER(jnienv, 0) diff --git a/src/tls_native.inc b/src/tls_native.inc index f1159bdc1e..4b122f65d0 100644 --- a/src/tls_native.inc +++ b/src/tls_native.inc @@ -13,7 +13,7 @@ * See LICENSE.txt for copyright information. */ -#if defined(ALLEGRO_MSVC) || defined(ALLEGRO_BCC32) +#if defined(A5O_MSVC) || defined(A5O_BCC32) #define THREAD_LOCAL_QUALIFIER __declspec(thread) #else #define THREAD_LOCAL_QUALIFIER __thread diff --git a/src/touch_input.c b/src/touch_input.c index 9eb332f980..67b9c14b92 100644 --- a/src/touch_input.c +++ b/src/touch_input.c @@ -16,7 +16,7 @@ */ -#define ALLEGRO_NO_COMPATIBILITY +#define A5O_NO_COMPATIBILITY #include "allegro5/allegro.h" #include "allegro5/internal/aintern.h" @@ -27,7 +27,7 @@ /* the active driver */ -static ALLEGRO_TOUCH_INPUT_DRIVER *touch_input_driver = NULL; +static A5O_TOUCH_INPUT_DRIVER *touch_input_driver = NULL; /* Function: al_is_touch_input_installed @@ -75,9 +75,9 @@ void al_uninstall_touch_input(void) } -static ALLEGRO_TOUCH_INPUT *get_touch_input(void) +static A5O_TOUCH_INPUT *get_touch_input(void) { - ALLEGRO_TOUCH_INPUT *touch_input; + A5O_TOUCH_INPUT *touch_input; ASSERT(touch_input_driver); @@ -90,7 +90,7 @@ static ALLEGRO_TOUCH_INPUT *get_touch_input(void) /* Function: al_get_touch_input_state */ -void al_get_touch_input_state(ALLEGRO_TOUCH_INPUT_STATE *ret_state) +void al_get_touch_input_state(A5O_TOUCH_INPUT_STATE *ret_state) { ASSERT(touch_input_driver); ASSERT(ret_state); @@ -127,9 +127,9 @@ int al_get_mouse_emulation_mode(void) /* Function: al_get_touch_input_event_source */ -ALLEGRO_EVENT_SOURCE *al_get_touch_input_event_source(void) +A5O_EVENT_SOURCE *al_get_touch_input_event_source(void) { - ALLEGRO_TOUCH_INPUT *touch_input = get_touch_input(); + A5O_TOUCH_INPUT *touch_input = get_touch_input(); return (touch_input) ? &touch_input->es : NULL; } @@ -137,9 +137,9 @@ ALLEGRO_EVENT_SOURCE *al_get_touch_input_event_source(void) /* Function: al_get_touch_input_mouse_emulation_event_source */ -ALLEGRO_EVENT_SOURCE *al_get_touch_input_mouse_emulation_event_source(void) +A5O_EVENT_SOURCE *al_get_touch_input_mouse_emulation_event_source(void) { - ALLEGRO_TOUCH_INPUT *touch_input = get_touch_input(); + A5O_TOUCH_INPUT *touch_input = get_touch_input(); return (touch_input) ? &touch_input->mouse_emulation_es : NULL; } diff --git a/src/transformations.c b/src/transformations.c index 4002b8e456..6a35b08d8a 100644 --- a/src/transformations.c +++ b/src/transformations.c @@ -23,24 +23,24 @@ #include "allegro5/internal/aintern_transform.h" #include -/* ALLEGRO_DEBUG_CHANNEL("transformations") */ +/* A5O_DEBUG_CHANNEL("transformations") */ /* Function: al_copy_transform */ -void al_copy_transform(ALLEGRO_TRANSFORM *dest, const ALLEGRO_TRANSFORM *src) +void al_copy_transform(A5O_TRANSFORM *dest, const A5O_TRANSFORM *src) { ASSERT(src); ASSERT(dest); - memcpy(dest, src, sizeof(ALLEGRO_TRANSFORM)); + memcpy(dest, src, sizeof(A5O_TRANSFORM)); } /* Function: al_use_transform */ -void al_use_transform(const ALLEGRO_TRANSFORM *trans) +void al_use_transform(const A5O_TRANSFORM *trans) { - ALLEGRO_BITMAP *target = al_get_target_bitmap(); - ALLEGRO_DISPLAY *display; + A5O_BITMAP *target = al_get_target_bitmap(); + A5O_DISPLAY *display; if (!target) return; @@ -71,16 +71,16 @@ void al_use_transform(const ALLEGRO_TRANSFORM *trans) /* Function: al_use_projection_transform */ -void al_use_projection_transform(const ALLEGRO_TRANSFORM *trans) +void al_use_projection_transform(const A5O_TRANSFORM *trans) { - ALLEGRO_BITMAP *target = al_get_target_bitmap(); - ALLEGRO_DISPLAY *display; + A5O_BITMAP *target = al_get_target_bitmap(); + A5O_DISPLAY *display; if (!target) return; /* Memory bitmaps don't support custom projection transforms */ - if (al_get_bitmap_flags(target) & ALLEGRO_MEMORY_BITMAP) + if (al_get_bitmap_flags(target) & A5O_MEMORY_BITMAP) return; /* Changes to a back buffer should affect the front buffer, and vice versa. @@ -101,9 +101,9 @@ void al_use_projection_transform(const ALLEGRO_TRANSFORM *trans) /* Function: al_get_current_transform */ -const ALLEGRO_TRANSFORM *al_get_current_transform(void) +const A5O_TRANSFORM *al_get_current_transform(void) { - ALLEGRO_BITMAP *target = al_get_target_bitmap(); + A5O_BITMAP *target = al_get_target_bitmap(); if (!target) return NULL; @@ -113,9 +113,9 @@ const ALLEGRO_TRANSFORM *al_get_current_transform(void) /* Function: al_get_current_projection_transform */ -const ALLEGRO_TRANSFORM *al_get_current_projection_transform(void) +const A5O_TRANSFORM *al_get_current_projection_transform(void) { - ALLEGRO_BITMAP *target = al_get_target_bitmap(); + A5O_BITMAP *target = al_get_target_bitmap(); if (!target) return NULL; @@ -125,9 +125,9 @@ const ALLEGRO_TRANSFORM *al_get_current_projection_transform(void) /* Function: al_get_current_inverse_transform */ -const ALLEGRO_TRANSFORM *al_get_current_inverse_transform(void) +const A5O_TRANSFORM *al_get_current_inverse_transform(void) { - ALLEGRO_BITMAP *target = al_get_target_bitmap(); + A5O_BITMAP *target = al_get_target_bitmap(); if (!target) return NULL; @@ -143,7 +143,7 @@ const ALLEGRO_TRANSFORM *al_get_current_inverse_transform(void) /* Function: al_identity_transform */ -void al_identity_transform(ALLEGRO_TRANSFORM *trans) +void al_identity_transform(A5O_TRANSFORM *trans) { ASSERT(trans); @@ -170,7 +170,7 @@ void al_identity_transform(ALLEGRO_TRANSFORM *trans) /* Function: al_build_transform */ -void al_build_transform(ALLEGRO_TRANSFORM *trans, float x, float y, +void al_build_transform(A5O_TRANSFORM *trans, float x, float y, float sx, float sy, float theta) { float c, s; @@ -202,7 +202,7 @@ void al_build_transform(ALLEGRO_TRANSFORM *trans, float x, float y, /* Function: al_build_camera_transform */ -void al_build_camera_transform(ALLEGRO_TRANSFORM *trans, +void al_build_camera_transform(A5O_TRANSFORM *trans, float position_x, float position_y, float position_z, float look_x, float look_y, float look_z, float up_x, float up_y, float up_z) @@ -270,7 +270,7 @@ void al_build_camera_transform(ALLEGRO_TRANSFORM *trans, /* Function: al_invert_transform */ -void al_invert_transform(ALLEGRO_TRANSFORM *trans) +void al_invert_transform(A5O_TRANSFORM *trans) { float det, t; ASSERT(trans); @@ -291,12 +291,12 @@ void al_invert_transform(ALLEGRO_TRANSFORM *trans) /* Function: al_transpose_transform */ -void al_transpose_transform(ALLEGRO_TRANSFORM *trans) +void al_transpose_transform(A5O_TRANSFORM *trans) { int i, j; ASSERT(trans); - ALLEGRO_TRANSFORM t = *trans; + A5O_TRANSFORM t = *trans; for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { trans->m[i][j] = t.m[j][i]; @@ -306,7 +306,7 @@ void al_transpose_transform(ALLEGRO_TRANSFORM *trans) /* Function: al_check_inverse */ -int al_check_inverse(const ALLEGRO_TRANSFORM *trans, float tol) +int al_check_inverse(const A5O_TRANSFORM *trans, float tol) { float det, norm, c0, c1, c3; ASSERT(trans); @@ -318,14 +318,14 @@ int al_check_inverse(const ALLEGRO_TRANSFORM *trans, float tol) c0 = fabsf(trans->m[0][0]) + fabsf(trans->m[0][1]); c1 = fabsf(trans->m[1][0]) + fabsf(trans->m[1][1]); c3 = fabsf(trans->m[3][0]) + fabsf(trans->m[3][1]) + 1; - norm = _ALLEGRO_MAX(_ALLEGRO_MAX(1, c0), _ALLEGRO_MAX(c1, c3)); + norm = _A5O_MAX(_A5O_MAX(1, c0), _A5O_MAX(c1, c3)); return det > tol * norm; } /* Function: al_translate_transform */ -void al_translate_transform(ALLEGRO_TRANSFORM *trans, float x, float y) +void al_translate_transform(A5O_TRANSFORM *trans, float x, float y) { ASSERT(trans); @@ -336,7 +336,7 @@ void al_translate_transform(ALLEGRO_TRANSFORM *trans, float x, float y) /* Function: al_translate_transform_3d */ -void al_translate_transform_3d(ALLEGRO_TRANSFORM *trans, float x, float y, +void al_translate_transform_3d(A5O_TRANSFORM *trans, float x, float y, float z) { ASSERT(trans); @@ -349,7 +349,7 @@ void al_translate_transform_3d(ALLEGRO_TRANSFORM *trans, float x, float y, /* Function: al_rotate_transform */ -void al_rotate_transform(ALLEGRO_TRANSFORM *trans, float theta) +void al_rotate_transform(A5O_TRANSFORM *trans, float theta) { float c, s; float t; @@ -373,7 +373,7 @@ void al_rotate_transform(ALLEGRO_TRANSFORM *trans, float theta) /* Function: al_scale_transform */ -void al_scale_transform(ALLEGRO_TRANSFORM *trans, float sx, float sy) +void al_scale_transform(A5O_TRANSFORM *trans, float sx, float sy) { ASSERT(trans); @@ -390,7 +390,7 @@ void al_scale_transform(ALLEGRO_TRANSFORM *trans, float sx, float sy) /* Function: al_scale_transform_3d */ -void al_scale_transform_3d(ALLEGRO_TRANSFORM *trans, float sx, float sy, +void al_scale_transform_3d(A5O_TRANSFORM *trans, float sx, float sy, float sz) { ASSERT(trans); @@ -414,7 +414,7 @@ void al_scale_transform_3d(ALLEGRO_TRANSFORM *trans, float sx, float sy, /* Function: al_transform_coordinates */ -void al_transform_coordinates(const ALLEGRO_TRANSFORM *trans, float *x, float *y) +void al_transform_coordinates(const A5O_TRANSFORM *trans, float *x, float *y) { float t; ASSERT(trans); @@ -429,7 +429,7 @@ void al_transform_coordinates(const ALLEGRO_TRANSFORM *trans, float *x, float *y /* Function: al_transform_coordinates_3d */ -void al_transform_coordinates_3d(const ALLEGRO_TRANSFORM *trans, +void al_transform_coordinates_3d(const A5O_TRANSFORM *trans, float *x, float *y, float *z) { float rx, ry, rz; @@ -453,7 +453,7 @@ void al_transform_coordinates_3d(const ALLEGRO_TRANSFORM *trans, /* Function: al_transform_coordinates_4d */ -void al_transform_coordinates_4d(const ALLEGRO_TRANSFORM *trans, +void al_transform_coordinates_4d(const A5O_TRANSFORM *trans, float *x, float *y, float *z, float *w) { float rx, ry, rz, rw; @@ -480,7 +480,7 @@ void al_transform_coordinates_4d(const ALLEGRO_TRANSFORM *trans, /* Function: al_transform_coordinates_3d_projective */ -void al_transform_coordinates_3d_projective(const ALLEGRO_TRANSFORM *trans, +void al_transform_coordinates_3d_projective(const A5O_TRANSFORM *trans, float *x, float *y, float *z) { float w = 1; @@ -492,7 +492,7 @@ void al_transform_coordinates_3d_projective(const ALLEGRO_TRANSFORM *trans, /* Function: al_compose_transform */ -void al_compose_transform(ALLEGRO_TRANSFORM *trans, const ALLEGRO_TRANSFORM *other) +void al_compose_transform(A5O_TRANSFORM *trans, const A5O_TRANSFORM *other) { #define E(x, y) \ (other->m[0][y] * trans->m[x][0] + \ @@ -500,7 +500,7 @@ void al_compose_transform(ALLEGRO_TRANSFORM *trans, const ALLEGRO_TRANSFORM *oth other->m[2][y] * trans->m[x][2] + \ other->m[3][y] * trans->m[x][3]) \ - const ALLEGRO_TRANSFORM tmp = {{ + const A5O_TRANSFORM tmp = {{ { E(0, 0), E(0, 1), E(0, 2), E(0, 3) }, { E(1, 0), E(1, 1), E(1, 2), E(1, 3) }, { E(2, 0), E(2, 1), E(2, 2), E(2, 3) }, @@ -512,7 +512,7 @@ void al_compose_transform(ALLEGRO_TRANSFORM *trans, const ALLEGRO_TRANSFORM *oth #undef E } -bool _al_transform_is_translation(const ALLEGRO_TRANSFORM* trans, +bool _al_transform_is_translation(const A5O_TRANSFORM* trans, float *dx, float *dy) { if (trans->m[0][0] == 1 && @@ -538,14 +538,14 @@ bool _al_transform_is_translation(const ALLEGRO_TRANSFORM* trans, /* Function: al_orthographic_transform */ -void al_orthographic_transform(ALLEGRO_TRANSFORM *trans, +void al_orthographic_transform(A5O_TRANSFORM *trans, float left, float top, float n, float right, float bottom, float f) { float delta_x = right - left; float delta_y = top - bottom; float delta_z = f - n; - ALLEGRO_TRANSFORM tmp; + A5O_TRANSFORM tmp; al_identity_transform(&tmp); @@ -563,13 +563,13 @@ void al_orthographic_transform(ALLEGRO_TRANSFORM *trans, /* Function: al_rotate_transform_3d */ -void al_rotate_transform_3d(ALLEGRO_TRANSFORM *trans, +void al_rotate_transform_3d(A5O_TRANSFORM *trans, float x, float y, float z, float angle) { double s = sin(angle); double c = cos(angle); double cc = 1 - c; - ALLEGRO_TRANSFORM tmp; + A5O_TRANSFORM tmp; al_identity_transform(&tmp); @@ -599,14 +599,14 @@ void al_rotate_transform_3d(ALLEGRO_TRANSFORM *trans, /* Function: al_perspective_transform */ -void al_perspective_transform(ALLEGRO_TRANSFORM *trans, +void al_perspective_transform(A5O_TRANSFORM *trans, float left, float top, float n, float right, float bottom, float f) { float delta_x = right - left; float delta_y = top - bottom; float delta_z = f - n; - ALLEGRO_TRANSFORM tmp; + A5O_TRANSFORM tmp; al_identity_transform(&tmp); @@ -624,7 +624,7 @@ void al_perspective_transform(ALLEGRO_TRANSFORM *trans, /* Function: al_horizontal_shear_transform */ -void al_horizontal_shear_transform(ALLEGRO_TRANSFORM* trans, float theta) +void al_horizontal_shear_transform(A5O_TRANSFORM* trans, float theta) { float s; ASSERT(trans); @@ -638,7 +638,7 @@ void al_horizontal_shear_transform(ALLEGRO_TRANSFORM* trans, float theta) /* Function: al_vertical_shear_transform */ -void al_vertical_shear_transform(ALLEGRO_TRANSFORM* trans, float theta) +void al_vertical_shear_transform(A5O_TRANSFORM* trans, float theta) { float s; ASSERT(trans); diff --git a/src/tri_soft.c b/src/tri_soft.c index 7496ddbc6d..56045c0b6d 100644 --- a/src/tri_soft.c +++ b/src/tri_soft.c @@ -25,22 +25,22 @@ #include "allegro5/internal/aintern_tri_soft.h" #include -ALLEGRO_DEBUG_CHANNEL("tri_soft") +A5O_DEBUG_CHANNEL("tri_soft") -#define MIN _ALLEGRO_MIN -#define MAX _ALLEGRO_MAX +#define MIN _A5O_MIN +#define MAX _A5O_MAX typedef void (*shader_draw)(uintptr_t, int, int, int); -typedef void (*shader_init)(uintptr_t, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*); +typedef void (*shader_init)(uintptr_t, A5O_VERTEX*, A5O_VERTEX*, A5O_VERTEX*); typedef void (*shader_first)(uintptr_t, int, int, int, int); typedef void (*shader_step)(uintptr_t, int); typedef struct { - ALLEGRO_BITMAP *target; - ALLEGRO_COLOR cur_color; + A5O_BITMAP *target; + A5O_COLOR cur_color; } state_solid_any_2d; -static void shader_solid_any_init(uintptr_t state, ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, ALLEGRO_VERTEX* v3) +static void shader_solid_any_init(uintptr_t state, A5O_VERTEX* v1, A5O_VERTEX* v2, A5O_VERTEX* v3) { state_solid_any_2d* s = (state_solid_any_2d*)state; s->target = al_get_target_bitmap(); @@ -70,15 +70,15 @@ static void shader_solid_any_step(uintptr_t state, int minor) typedef struct { state_solid_any_2d solid; - ALLEGRO_COLOR color_dx; - ALLEGRO_COLOR color_dy; - ALLEGRO_COLOR color_const; + A5O_COLOR color_dx; + A5O_COLOR color_dy; + A5O_COLOR color_const; /* These are catched for the left edge walking */ - ALLEGRO_COLOR minor_color; - ALLEGRO_COLOR major_color; + A5O_COLOR minor_color; + A5O_COLOR major_color; /* We use these to increase the precision of interpolation @@ -116,13 +116,13 @@ typedef struct { \ const float det_u = minor3 - minor1 + minor2; -static void shader_grad_any_init(uintptr_t state, ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, ALLEGRO_VERTEX* v3) +static void shader_grad_any_init(uintptr_t state, A5O_VERTEX* v1, A5O_VERTEX* v2, A5O_VERTEX* v3) { INIT_PREAMBLE - ALLEGRO_COLOR v1c = v1->color; - ALLEGRO_COLOR v2c = v2->color; - ALLEGRO_COLOR v3c = v3->color; + A5O_COLOR v1c = v1->color; + A5O_COLOR v2c = v2->color; + A5O_COLOR v3c = v3->color; PLANE_DETS(r, v1c.r, v2c.r, v3c.r) PLANE_DETS(g, v1c.g, v2c.g, v3c.g) @@ -206,8 +206,8 @@ static void shader_grad_any_step(uintptr_t state, int minor) A.a = B.a * A.a; typedef struct { - ALLEGRO_BITMAP *target; - ALLEGRO_COLOR cur_color; + A5O_BITMAP *target; + A5O_COLOR cur_color; float du_dx, du_dy, u_const; float dv_dx, dv_dy, v_const; @@ -221,12 +221,12 @@ typedef struct { float off_x; float off_y; - ALLEGRO_BITMAP* texture; - ALLEGRO_BITMAP_WRAP default_wrap; + A5O_BITMAP* texture; + A5O_BITMAP_WRAP default_wrap; int w, h; } state_texture_solid_any_2d; -static void shader_texture_solid_any_init(uintptr_t state, ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, ALLEGRO_VERTEX* v3) +static void shader_texture_solid_any_init(uintptr_t state, A5O_VERTEX* v1, A5O_VERTEX* v2, A5O_VERTEX* v3) { INIT_PREAMBLE @@ -293,24 +293,24 @@ static void shader_texture_solid_any_step(uintptr_t state, int minor) typedef struct { state_texture_solid_any_2d solid; - ALLEGRO_COLOR color_dx; - ALLEGRO_COLOR color_dy; - ALLEGRO_COLOR color_const; + A5O_COLOR color_dx; + A5O_COLOR color_dy; + A5O_COLOR color_const; /* These are catched for the left edge walking */ - ALLEGRO_COLOR minor_color; - ALLEGRO_COLOR major_color; + A5O_COLOR minor_color; + A5O_COLOR major_color; } state_texture_grad_any_2d; -static void shader_texture_grad_any_init(uintptr_t state, ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, ALLEGRO_VERTEX* v3) +static void shader_texture_grad_any_init(uintptr_t state, A5O_VERTEX* v1, A5O_VERTEX* v2, A5O_VERTEX* v3) { INIT_PREAMBLE - ALLEGRO_COLOR v1c = v1->color; - ALLEGRO_COLOR v2c = v2->color; - ALLEGRO_COLOR v3c = v3->color; + A5O_COLOR v1c = v1->color; + A5O_COLOR v2c = v2->color; + A5O_COLOR v3c = v3->color; PLANE_DETS(r, v1c.r, v2c.r, v3c.r) PLANE_DETS(g, v1c.g, v2c.g, v3c.g) @@ -411,7 +411,7 @@ static void shader_texture_grad_any_step(uintptr_t state, int minor) static void triangle_stepper(uintptr_t state, shader_init init, shader_first first, shader_step step, shader_draw draw, - ALLEGRO_VERTEX* vtx1, ALLEGRO_VERTEX* vtx2, ALLEGRO_VERTEX* vtx3) + A5O_VERTEX* vtx1, A5O_VERTEX* vtx2, A5O_VERTEX* vtx3) { float Coords[6] = {vtx1->x - 0.5f, vtx1->y + 0.5f, vtx2->x - 0.5f, vtx2->y + 0.5f, vtx3->x - 0.5f, vtx3->y + 0.5f}; float *V1 = Coords, *V2 = &Coords[2], *V3 = &Coords[4], *s; @@ -688,12 +688,12 @@ static void triangle_stepper(uintptr_t state, This one will check to see what exactly we need to draw... I.e. this will call all of the actual renderers and set the appropriate callbacks */ -void _al_triangle_2d(ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, ALLEGRO_VERTEX* v3) +void _al_triangle_2d(A5O_BITMAP* texture, A5O_VERTEX* v1, A5O_VERTEX* v2, A5O_VERTEX* v3) { int shade = 1; int grad = 1; int op, src_mode, dst_mode, op_alpha, src_alpha, dst_alpha; - ALLEGRO_COLOR v1c, v2c, v3c; + A5O_COLOR v1c, v2c, v3c; v1c = v1->color; v2c = v2->color; @@ -713,7 +713,7 @@ void _al_triangle_2d(ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX } if (texture) { - ALLEGRO_BITMAP_WRAP wrap_u, wrap_v; + A5O_BITMAP_WRAP wrap_u, wrap_v; _al_get_bitmap_wrap(texture, &wrap_u, &wrap_v); /* @@ -721,8 +721,8 @@ void _al_triangle_2d(ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX reason the scanline drawers were always designed to repeat even for regular bitmaps. This does not match what we do with OpenGL/Direct3D. */ - bool repeat = (wrap_u == ALLEGRO_BITMAP_WRAP_DEFAULT || wrap_u == ALLEGRO_BITMAP_WRAP_REPEAT) && - (wrap_v == ALLEGRO_BITMAP_WRAP_DEFAULT || wrap_v == ALLEGRO_BITMAP_WRAP_REPEAT); + bool repeat = (wrap_u == A5O_BITMAP_WRAP_DEFAULT || wrap_u == A5O_BITMAP_WRAP_REPEAT) && + (wrap_v == A5O_BITMAP_WRAP_DEFAULT || wrap_v == A5O_BITMAP_WRAP_REPEAT); if (grad) { state_texture_grad_any_2d state; state.solid.texture = texture; @@ -781,7 +781,7 @@ void _al_triangle_2d(ALLEGRO_BITMAP* texture, ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX } } -static int bitmap_region_is_locked(ALLEGRO_BITMAP* bmp, int x1, int y1, int w, int h) +static int bitmap_region_is_locked(A5O_BITMAP* bmp, int x1, int y1, int w, int h) { ASSERT(bmp); @@ -793,21 +793,21 @@ static int bitmap_region_is_locked(ALLEGRO_BITMAP* bmp, int x1, int y1, int w, i } void _al_draw_soft_triangle( - ALLEGRO_VERTEX* v1, ALLEGRO_VERTEX* v2, ALLEGRO_VERTEX* v3, uintptr_t state, - void (*init)(uintptr_t, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*, ALLEGRO_VERTEX*), + A5O_VERTEX* v1, A5O_VERTEX* v2, A5O_VERTEX* v3, uintptr_t state, + void (*init)(uintptr_t, A5O_VERTEX*, A5O_VERTEX*, A5O_VERTEX*), void (*first)(uintptr_t, int, int, int, int), void (*step)(uintptr_t, int), void (*draw)(uintptr_t, int, int, int)) { /* - ALLEGRO_VERTEX copy_v1, copy_v2; <- may be needed for clipping later on + A5O_VERTEX copy_v1, copy_v2; <- may be needed for clipping later on */ - ALLEGRO_VERTEX* vtx1 = v1; - ALLEGRO_VERTEX* vtx2 = v2; - ALLEGRO_VERTEX* vtx3 = v3; - ALLEGRO_BITMAP *target = al_get_target_bitmap(); + A5O_VERTEX* vtx1 = v1; + A5O_VERTEX* vtx2 = v2; + A5O_VERTEX* vtx3 = v3; + A5O_BITMAP *target = al_get_target_bitmap(); int need_unlock = 0; - ALLEGRO_LOCKED_REGION *lr; + A5O_LOCKED_REGION *lr; int min_x, max_x, min_y, max_y; int clip_min_x, clip_min_y, clip_max_x, clip_max_y; @@ -853,7 +853,7 @@ void _al_draw_soft_triangle( _al_pixel_format_is_video_only(target->locked_region.format)) return; } else { - if (!(lr = al_lock_bitmap_region(target, min_x, min_y, max_x - min_x, max_y - min_y, ALLEGRO_PIXEL_FORMAT_ANY, 0))) + if (!(lr = al_lock_bitmap_region(target, min_x, min_y, max_x - min_x, max_y - min_y, A5O_PIXEL_FORMAT_ANY, 0))) return; need_unlock = 1; } diff --git a/src/unix/udrvlist.c b/src/unix/udrvlist.c index 75d03cbe12..fd973fc8f3 100644 --- a/src/unix/udrvlist.c +++ b/src/unix/udrvlist.c @@ -20,8 +20,8 @@ #include "allegro5/internal/aintern_bitmap.h" #include "allegro5/internal/aintern_system.h" -#if defined ALLEGRO_WITH_XWINDOWS -#ifndef ALLEGRO_RASPBERRYPI +#if defined A5O_WITH_XWINDOWS +#ifndef A5O_RASPBERRYPI #include "allegro5/platform/aintxglx.h" #else #include "allegro5/internal/aintern_raspberrypi.h" @@ -35,11 +35,11 @@ */ void _al_register_system_interfaces(void) { - ALLEGRO_SYSTEM_INTERFACE **add; -#if defined ALLEGRO_WITH_XWINDOWS && !defined ALLEGRO_RASPBERRYPI + A5O_SYSTEM_INTERFACE **add; +#if defined A5O_WITH_XWINDOWS && !defined A5O_RASPBERRYPI add = _al_vector_alloc_back(&_al_system_interfaces); *add = _al_system_xglx_driver(); -#elif defined ALLEGRO_RASPBERRYPI +#elif defined A5O_RASPBERRYPI add = _al_vector_alloc_back(&_al_system_interfaces); *add = _al_system_raspberrypi_driver(); #endif diff --git a/src/unix/uhapdrv.c b/src/unix/uhapdrv.c index eae23e6562..8aef8f49f2 100644 --- a/src/unix/uhapdrv.c +++ b/src/unix/uhapdrv.c @@ -24,7 +24,7 @@ _AL_BEGIN_HAPTIC_DRIVER_LIST -#if defined ALLEGRO_HAVE_LINUX_INPUT_H && (defined ALLEGRO_WITH_XWINDOWS || defined ALLEGRO_RASPBERRYPI) - { _ALLEGRO_HAPDRV_LINUX, &_al_hapdrv_linux, true }, +#if defined A5O_HAVE_LINUX_INPUT_H && (defined A5O_WITH_XWINDOWS || defined A5O_RASPBERRYPI) + { _A5O_HAPDRV_LINUX, &_al_hapdrv_linux, true }, #endif _AL_END_HAPTIC_DRIVER_LIST diff --git a/src/unix/ujoydrv.c b/src/unix/ujoydrv.c index adab45ac62..b9658f77d2 100644 --- a/src/unix/ujoydrv.c +++ b/src/unix/ujoydrv.c @@ -24,7 +24,7 @@ _AL_BEGIN_JOYSTICK_DRIVER_LIST -#if defined ALLEGRO_HAVE_LINUX_INPUT_H && (defined ALLEGRO_WITH_XWINDOWS || defined ALLEGRO_RASPBERRYPI) - { _ALLEGRO_JOYDRV_LINUX, &_al_joydrv_linux, true }, +#if defined A5O_HAVE_LINUX_INPUT_H && (defined A5O_WITH_XWINDOWS || defined A5O_RASPBERRYPI) + { _A5O_JOYDRV_LINUX, &_al_joydrv_linux, true }, #endif _AL_END_JOYSTICK_DRIVER_LIST diff --git a/src/unix/upath.c b/src/unix/upath.c index df408eafe2..10a78293ac 100644 --- a/src/unix/upath.c +++ b/src/unix/upath.c @@ -29,28 +29,28 @@ #include "allegro5/fshook.h" #include "allegro5/path.h" -#ifdef ALLEGRO_HAVE_SYS_UTSNAME_H +#ifdef A5O_HAVE_SYS_UTSNAME_H #include #endif -#ifdef ALLEGRO_HAVE_SV_PROCFS_H +#ifdef A5O_HAVE_SV_PROCFS_H #include #include #include #endif -ALLEGRO_DEBUG_CHANNEL("upath") +A5O_DEBUG_CHANNEL("upath") #ifndef PATH_MAX #define PATH_MAX 4096 #endif -#ifndef ALLEGRO_MACOSX +#ifndef A5O_MACOSX /* _find_executable_file: * Helper function: searches path and current directory for executable. * Returns 1 on succes, 0 on failure. */ -static ALLEGRO_PATH *_find_executable_file(const char *filename) +static A5O_PATH *_find_executable_file(const char *filename) { char *env; @@ -67,7 +67,7 @@ static ALLEGRO_PATH *_find_executable_file(const char *filename) /* Prepend current directory */ cwd = al_get_current_directory(); if (cwd) { - ALLEGRO_PATH *path = al_create_path_for_directory(cwd); + A5O_PATH *path = al_create_path_for_directory(cwd); al_free(cwd); al_set_path_filename(path, filename); @@ -85,17 +85,17 @@ static ALLEGRO_PATH *_find_executable_file(const char *filename) */ else if ((env = getenv("PATH"))) { struct stat finfo; - ALLEGRO_USTR *us = al_ustr_new(env); + A5O_USTR *us = al_ustr_new(env); int start_pos = 0; while (start_pos >= 0) { int next_start_pos = al_ustr_find_chr(us, start_pos + 1, ':'); int end_pos = next_start_pos; if (next_start_pos < 0) end_pos = al_ustr_size(us); - ALLEGRO_USTR_INFO info; - const ALLEGRO_USTR *sub = al_ref_ustr(&info, us, start_pos, end_pos); + A5O_USTR_INFO info; + const A5O_USTR *sub = al_ref_ustr(&info, us, start_pos, end_pos); - ALLEGRO_PATH *path = al_create_path_for_directory(al_cstr(sub)); + A5O_PATH *path = al_create_path_for_directory(al_cstr(sub)); al_set_path_filename(path, filename); if (stat(al_path_cstr(path, '/'), &finfo) == 0 && @@ -117,11 +117,11 @@ static ALLEGRO_PATH *_find_executable_file(const char *filename) /* Return full path to the current executable, use proc fs if * available. */ -static ALLEGRO_PATH *get_executable_name(void) +static A5O_PATH *get_executable_name(void) { - ALLEGRO_PATH *path; + A5O_PATH *path; - #ifdef ALLEGRO_HAVE_GETEXECNAME + #ifdef A5O_HAVE_GETEXECNAME { const char *s = getexecname(); if (s) { @@ -155,7 +155,7 @@ static ALLEGRO_PATH *get_executable_name(void) } /* Use System V procfs calls if available */ -#ifdef ALLEGRO_HAVE_SV_PROCFS_H +#ifdef A5O_HAVE_SV_PROCFS_H struct prpsinfo psinfo; int fd; sprintf(linkname, "/proc/%d/exe", (int)pid); @@ -165,7 +165,7 @@ static ALLEGRO_PATH *get_executable_name(void) close(fd); /* Use argv[0] directly if we can */ -#ifdef ALLEGRO_HAVE_PROCFS_ARGCV +#ifdef A5O_HAVE_PROCFS_ARGCV if (psinfo.pr_argv && psinfo.pr_argc) { path = _find_executable_file(psinfo.pr_argv[0]); if (path) @@ -206,7 +206,7 @@ static ALLEGRO_PATH *get_executable_name(void) /* The first line of output is a header */ ret = fgets(linkname, sizeof(linkname), pipe); if (!ret) - ALLEGRO_ERROR("Failed to read the name of the executable file.\n"); + A5O_ERROR("Failed to read the name of the executable file.\n"); /* The information we want is in the last column; find it */ int len = strlen(linkname); @@ -216,7 +216,7 @@ static ALLEGRO_PATH *get_executable_name(void) /* The second line contains the info we want */ ret = fgets(linkname, sizeof(linkname), pipe); if (!ret) - ALLEGRO_ERROR("Failed to read the name of the executable file.\n"); + A5O_ERROR("Failed to read the name of the executable file.\n"); pclose(pipe); /* Treat special cases: filename between [] and - for login shell */ @@ -243,7 +243,7 @@ static ALLEGRO_PATH *get_executable_name(void) return al_create_path(""); } -static ALLEGRO_PATH *follow_symlinks(ALLEGRO_PATH *path) +static A5O_PATH *follow_symlinks(A5O_PATH *path) { for (;;) { const char *path_str = al_path_cstr(path, '/'); @@ -261,7 +261,7 @@ static ALLEGRO_PATH *follow_symlinks(ALLEGRO_PATH *path) /* Make absolute path. */ { const char *cwd = al_get_current_directory(); - ALLEGRO_PATH *cwd_path = al_create_path_for_directory(cwd); + A5O_PATH *cwd_path = al_create_path_for_directory(cwd); if (al_rebase_path(cwd_path, path)) al_make_path_canonical(path); al_destroy_path(cwd_path); @@ -277,11 +277,11 @@ static ALLEGRO_PATH *follow_symlinks(ALLEGRO_PATH *path) /* get_xdg_path - locate an XDG user dir */ -static ALLEGRO_PATH *_get_xdg_path(const char *location) +static A5O_PATH *_get_xdg_path(const char *location) { - ALLEGRO_PATH *location_path = NULL; - ALLEGRO_PATH *xdg_config_path = NULL; - ALLEGRO_FILE *xdg_config_file = NULL; + A5O_PATH *location_path = NULL; + A5O_PATH *xdg_config_path = NULL; + A5O_FILE *xdg_config_file = NULL; const char *xdg_config_home = getenv("XDG_CONFIG_HOME"); int fd; @@ -291,7 +291,7 @@ static ALLEGRO_PATH *_get_xdg_path(const char *location) } else { /* the default XDG location is ~/.config */ - xdg_config_path = al_get_standard_path(ALLEGRO_USER_HOME_PATH); + xdg_config_path = al_get_standard_path(A5O_USER_HOME_PATH); if (!xdg_config_path) return NULL; al_append_path_component(xdg_config_path, ".config"); } @@ -338,7 +338,7 @@ static ALLEGRO_PATH *_get_xdg_path(const char *location) if (!strncmp(p, "$HOME", 5)) { /* $HOME is the only environment variable that the path is allowed to use, and it must be first, by specification. */ - location_path = al_get_standard_path(ALLEGRO_USER_HOME_PATH); + location_path = al_get_standard_path(A5O_USER_HOME_PATH); p += 5; } else { @@ -376,7 +376,7 @@ static ALLEGRO_PATH *_get_xdg_path(const char *location) return location_path; } -static ALLEGRO_PATH *_unix_find_home(void) +static A5O_PATH *_unix_find_home(void) { char *home_env = getenv("HOME"); @@ -405,10 +405,10 @@ static ALLEGRO_PATH *_unix_find_home(void) } } -ALLEGRO_PATH *_al_unix_get_path(int id) +A5O_PATH *_al_unix_get_path(int id) { switch (id) { - case ALLEGRO_TEMP_PATH: { + case A5O_TEMP_PATH: { /* Check: TMP, TMPDIR, TEMP or TEMPDIR */ char *envs[] = { "TMP", "TMPDIR", "TEMP", "TEMPDIR", NULL}; uint32_t i = 0; @@ -422,8 +422,8 @@ ALLEGRO_PATH *_al_unix_get_path(int id) /* next try: /tmp /var/tmp /usr/tmp */ char *paths[] = { "/tmp/", "/var/tmp/", "/usr/tmp/", NULL }; for (i=0; paths[i] != NULL; ++i) { - ALLEGRO_FS_ENTRY *fse = al_create_fs_entry(paths[i]); - bool found = (al_get_fs_entry_mode(fse) & ALLEGRO_FILEMODE_ISDIR) != 0; + A5O_FS_ENTRY *fse = al_create_fs_entry(paths[i]); + bool found = (al_get_fs_entry_mode(fse) & A5O_FILEMODE_ISDIR) != 0; al_destroy_fs_entry(fse); if (found) { return al_create_path_for_directory(paths[i]); @@ -434,17 +434,17 @@ ALLEGRO_PATH *_al_unix_get_path(int id) return NULL; } break; - case ALLEGRO_RESOURCES_PATH: { - ALLEGRO_PATH *exe = get_executable_name(); + case A5O_RESOURCES_PATH: { + A5O_PATH *exe = get_executable_name(); exe = follow_symlinks(exe); al_set_path_filename(exe, NULL); return exe; } break; - case ALLEGRO_USER_DATA_PATH: - case ALLEGRO_USER_SETTINGS_PATH: { - ALLEGRO_PATH *local_path = NULL; + case A5O_USER_DATA_PATH: + case A5O_USER_SETTINGS_PATH: { + A5O_PATH *local_path = NULL; const char *org_name = al_get_org_name(); const char *app_name = al_get_app_name(); @@ -453,7 +453,7 @@ ALLEGRO_PATH *_al_unix_get_path(int id) return NULL; /* find the appropriate path from the xdg environment variables, if possible */ - if (id == ALLEGRO_USER_DATA_PATH) { + if (id == A5O_USER_DATA_PATH) { const char *xdg_data_home = getenv("XDG_DATA_HOME"); local_path = al_create_path_for_directory(xdg_data_home ? xdg_data_home : ".local/share"); } @@ -467,7 +467,7 @@ ALLEGRO_PATH *_al_unix_get_path(int id) /* if the path is relative, prepend the user's home directory */ if (al_path_cstr(local_path, '/')[0] != '/') { - ALLEGRO_PATH *home_path = _unix_find_home(); + A5O_PATH *home_path = _unix_find_home(); if (!home_path) return NULL; @@ -485,15 +485,15 @@ ALLEGRO_PATH *_al_unix_get_path(int id) return local_path; } break; - case ALLEGRO_USER_HOME_PATH: + case A5O_USER_HOME_PATH: return _unix_find_home(); - case ALLEGRO_USER_DOCUMENTS_PATH: { - ALLEGRO_PATH *local_path = _get_xdg_path("DOCUMENTS"); + case A5O_USER_DOCUMENTS_PATH: { + A5O_PATH *local_path = _get_xdg_path("DOCUMENTS"); return local_path ? local_path : _unix_find_home(); } break; - case ALLEGRO_EXENAME_PATH: + case A5O_EXENAME_PATH: return get_executable_name(); break; diff --git a/src/unix/utime.c b/src/unix/utime.c index 70de4d36ad..b3f8150439 100644 --- a/src/unix/utime.c +++ b/src/unix/utime.c @@ -24,8 +24,8 @@ #include "allegro5/platform/aintunix.h" #include "allegro5/platform/aintuthr.h" -ALLEGRO_STATIC_ASSERT(utime, - sizeof(ALLEGRO_TIMEOUT_UNIX) <= sizeof(ALLEGRO_TIMEOUT)); +A5O_STATIC_ASSERT(utime, + sizeof(A5O_TIMEOUT_UNIX) <= sizeof(A5O_TIMEOUT)); /* Marks the time Allegro was initialised, for al_get_time(). */ @@ -34,7 +34,7 @@ struct timespec _al_unix_initial_time; /* clock_gettime() doesn't exist in MacOSX versions < 10.12. Use * gettimeofday() if building for MacOSX and targeting version < 10.12. */ -#if defined(ALLEGRO_MACOSX) && MAC_OS_X_VERSION_MIN_REQUIRED < 101200 +#if defined(A5O_MACOSX) && MAC_OS_X_VERSION_MIN_REQUIRED < 101200 #include int _internal_clock_gettime(clockid_t clock_id, struct timespec* t) { @@ -54,7 +54,7 @@ int _internal_clock_gettime(clockid_t clock_id, struct timespec* t) // Prefer clock that never decreases and includes time suspended. // Can probably use CLOCK_MONOTONIC_RAW for non-mac too, but remains to be // verified. -#if defined(ALLEGRO_MACOSX) +#if defined(A5O_MACOSX) #define CLOCK_ID CLOCK_MONOTONIC_RAW #else #define CLOCK_ID CLOCK_REALTIME @@ -99,9 +99,9 @@ void _al_unix_rest(double seconds) -void _al_unix_init_timeout(ALLEGRO_TIMEOUT *timeout, double seconds) +void _al_unix_init_timeout(A5O_TIMEOUT *timeout, double seconds) { - ALLEGRO_TIMEOUT_UNIX *ut = (ALLEGRO_TIMEOUT_UNIX *) timeout; + A5O_TIMEOUT_UNIX *ut = (A5O_TIMEOUT_UNIX *) timeout; struct timespec now; double integral; double frac; diff --git a/src/unix/uxthread.c b/src/unix/uxthread.c index 067fcd3423..d7df08dc8f 100644 --- a/src/unix/uxthread.c +++ b/src/unix/uxthread.c @@ -26,7 +26,7 @@ #include "allegro5/internal/aintern_thread.h" #include "allegro5/platform/aintunix.h" -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID #include "allegro5/internal/aintern_android.h" #endif @@ -38,11 +38,11 @@ static void *thread_proc_trampoline(void *data) { _AL_THREAD *thread = data; /* Android is special and needs to attach/detach threads with Java */ -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID _al_android_thread_created(); #endif (*thread->proc)(thread, thread->arg); -#ifdef ALLEGRO_ANDROID +#ifdef A5O_ANDROID _al_android_thread_ended(); #endif return NULL; @@ -181,9 +181,9 @@ void _al_mutex_destroy(_AL_MUTEX *mutex) /* most of the condition variable implementation is actually inline */ int _al_cond_timedwait(_AL_COND *cond, _AL_MUTEX *mutex, - const ALLEGRO_TIMEOUT *timeout) + const A5O_TIMEOUT *timeout) { - ALLEGRO_TIMEOUT_UNIX *unix_timeout = (ALLEGRO_TIMEOUT_UNIX *) timeout; + A5O_TIMEOUT_UNIX *unix_timeout = (A5O_TIMEOUT_UNIX *) timeout; int retcode; retcode = pthread_cond_timedwait(&cond->cond, &mutex->mutex, diff --git a/src/utf8.c b/src/utf8.c index 5007c555e7..33cd6b58ff 100644 --- a/src/utf8.c +++ b/src/utf8.c @@ -22,14 +22,14 @@ #include "allegro5/internal/bstrlib.h" #include "allegro5/internal/aintern.h" -ALLEGRO_STATIC_ASSERT(utf8, - sizeof(ALLEGRO_USTR_INFO) >= sizeof(struct _al_tagbstring)); +A5O_STATIC_ASSERT(utf8, + sizeof(A5O_USTR_INFO) >= sizeof(struct _al_tagbstring)); -#ifdef ALLEGRO_MSVC +#ifdef A5O_MSVC #pragma warning (disable: 4066) #endif -#ifndef ALLEGRO_HAVE_VA_COPY +#ifndef A5O_HAVE_VA_COPY /* If va_copy() is not defined we assume that a simple assignment suffices. * From a few web searches, this appears to be true for MSVC 7. */ @@ -42,7 +42,7 @@ ALLEGRO_STATIC_ASSERT(utf8, #define IS_TRAIL_BYTE(c) (((unsigned)(c) & 0xC0) == 0x80) -static bool all_ascii(const ALLEGRO_USTR *us) +static bool all_ascii(const A5O_USTR *us) { const unsigned char *data = (const unsigned char *) _al_bdata(us); int size = _al_blength(us); @@ -59,7 +59,7 @@ static bool all_ascii(const ALLEGRO_USTR *us) /* Function: al_ustr_new */ -ALLEGRO_USTR *al_ustr_new(const char *s) +A5O_USTR *al_ustr_new(const char *s) { return _al_bfromcstr(s); } @@ -67,7 +67,7 @@ ALLEGRO_USTR *al_ustr_new(const char *s) /* Function: al_ustr_new_from_buffer */ -ALLEGRO_USTR *al_ustr_new_from_buffer(const char *s, size_t size) +A5O_USTR *al_ustr_new_from_buffer(const char *s, size_t size) { return _al_blk2bstr(s, size); } @@ -75,9 +75,9 @@ ALLEGRO_USTR *al_ustr_new_from_buffer(const char *s, size_t size) /* Function: al_ustr_newf */ -ALLEGRO_USTR *al_ustr_newf(const char *fmt, ...) +A5O_USTR *al_ustr_newf(const char *fmt, ...) { - ALLEGRO_USTR *us; + A5O_USTR *us; va_list ap; us = al_ustr_new(""); @@ -90,7 +90,7 @@ ALLEGRO_USTR *al_ustr_newf(const char *fmt, ...) /* Function: al_ustr_free */ -void al_ustr_free(ALLEGRO_USTR *us) +void al_ustr_free(A5O_USTR *us) { _al_bdestroy(us); } @@ -98,7 +98,7 @@ void al_ustr_free(ALLEGRO_USTR *us) /* Function: al_cstr */ -const char *al_cstr(const ALLEGRO_USTR *us) +const char *al_cstr(const A5O_USTR *us) { /* May or may not be NUL terminated. */ return _al_bdata(us); @@ -107,7 +107,7 @@ const char *al_cstr(const ALLEGRO_USTR *us) /* Function: al_ustr_to_buffer */ -void al_ustr_to_buffer(const ALLEGRO_USTR *us, char *buffer, int size) +void al_ustr_to_buffer(const A5O_USTR *us, char *buffer, int size) { int need; @@ -123,7 +123,7 @@ void al_ustr_to_buffer(const ALLEGRO_USTR *us, char *buffer, int size) /* Function: al_cstr_dup */ -char *al_cstr_dup(const ALLEGRO_USTR *us) +char *al_cstr_dup(const A5O_USTR *us) { return _al_bstr2cstr(us, '\0'); } @@ -131,7 +131,7 @@ char *al_cstr_dup(const ALLEGRO_USTR *us) /* Function: al_ustr_dup */ -ALLEGRO_USTR *al_ustr_dup(const ALLEGRO_USTR *us) +A5O_USTR *al_ustr_dup(const A5O_USTR *us) { return _al_bstrcpy(us); } @@ -139,7 +139,7 @@ ALLEGRO_USTR *al_ustr_dup(const ALLEGRO_USTR *us) /* Function: al_ustr_dup_substr */ -ALLEGRO_USTR *al_ustr_dup_substr(const ALLEGRO_USTR *us, int start_pos, +A5O_USTR *al_ustr_dup_substr(const A5O_USTR *us, int start_pos, int end_pos) { return _al_bmidstr(us, start_pos, end_pos - start_pos); @@ -148,7 +148,7 @@ ALLEGRO_USTR *al_ustr_dup_substr(const ALLEGRO_USTR *us, int start_pos, /* Function: al_ustr_empty_string */ -const ALLEGRO_USTR *al_ustr_empty_string(void) +const A5O_USTR *al_ustr_empty_string(void) { static struct _al_tagbstring empty = _al_bsStatic(""); return ∅ @@ -157,7 +157,7 @@ const ALLEGRO_USTR *al_ustr_empty_string(void) /* Function: al_ref_cstr */ -const ALLEGRO_USTR *al_ref_cstr(ALLEGRO_USTR_INFO *info, const char *s) +const A5O_USTR *al_ref_cstr(A5O_USTR_INFO *info, const char *s) { struct _al_tagbstring *tb = (struct _al_tagbstring *) info; ASSERT(info); @@ -170,7 +170,7 @@ const ALLEGRO_USTR *al_ref_cstr(ALLEGRO_USTR_INFO *info, const char *s) /* Function: al_ref_buffer */ -const ALLEGRO_USTR *al_ref_buffer(ALLEGRO_USTR_INFO *info, const char *s, size_t size) +const A5O_USTR *al_ref_buffer(A5O_USTR_INFO *info, const char *s, size_t size) { struct _al_tagbstring *tb = (struct _al_tagbstring *) info; ASSERT(s); @@ -182,7 +182,7 @@ const ALLEGRO_USTR *al_ref_buffer(ALLEGRO_USTR_INFO *info, const char *s, size_t /* Function: al_ref_ustr */ -const ALLEGRO_USTR *al_ref_ustr(ALLEGRO_USTR_INFO *info, const ALLEGRO_USTR *us, +const A5O_USTR *al_ref_ustr(A5O_USTR_INFO *info, const A5O_USTR *us, int start_pos, int end_pos) { struct _al_tagbstring *tb = (struct _al_tagbstring *) info; @@ -194,14 +194,14 @@ const ALLEGRO_USTR *al_ref_ustr(ALLEGRO_USTR_INFO *info, const ALLEGRO_USTR *us, /* Function: al_ref_info */ -const ALLEGRO_USTR *al_ref_info(const ALLEGRO_USTR_INFO *info) +const A5O_USTR *al_ref_info(const A5O_USTR_INFO *info) { return info; } /* Function: al_ustr_size */ -size_t al_ustr_size(const ALLEGRO_USTR *us) +size_t al_ustr_size(const A5O_USTR *us) { return _al_blength(us); } @@ -209,7 +209,7 @@ size_t al_ustr_size(const ALLEGRO_USTR *us) /* Function: al_ustr_length */ -size_t al_ustr_length(const ALLEGRO_USTR *us) +size_t al_ustr_length(const A5O_USTR *us) { int pos = 0; int c = 0; @@ -223,7 +223,7 @@ size_t al_ustr_length(const ALLEGRO_USTR *us) /* Function: al_ustr_offset */ -int al_ustr_offset(const ALLEGRO_USTR *us, int index) +int al_ustr_offset(const A5O_USTR *us, int index) { int pos = 0; @@ -241,7 +241,7 @@ int al_ustr_offset(const ALLEGRO_USTR *us, int index) /* Function: al_ustr_next */ -bool al_ustr_next(const ALLEGRO_USTR *us, int *pos) +bool al_ustr_next(const A5O_USTR *us, int *pos) { const unsigned char *data = (const unsigned char *) _al_bdata(us); int size = _al_blength(us); @@ -263,7 +263,7 @@ bool al_ustr_next(const ALLEGRO_USTR *us, int *pos) /* Function: al_ustr_prev */ -bool al_ustr_prev(const ALLEGRO_USTR *us, int *pos) +bool al_ustr_prev(const A5O_USTR *us, int *pos) { const unsigned char *data = (const unsigned char *) _al_bdata(us); int c; @@ -287,7 +287,7 @@ bool al_ustr_prev(const ALLEGRO_USTR *us, int *pos) /* Function: al_ustr_get */ -int32_t al_ustr_get(const ALLEGRO_USTR *ub, int pos) +int32_t al_ustr_get(const A5O_USTR *ub, int pos) { int32_t c; int remain; @@ -372,7 +372,7 @@ int32_t al_ustr_get(const ALLEGRO_USTR *ub, int pos) /* Function: al_ustr_get_next */ -int32_t al_ustr_get_next(const ALLEGRO_USTR *us, int *pos) +int32_t al_ustr_get_next(const A5O_USTR *us, int *pos) { int32_t c = al_ustr_get(us, *pos); @@ -394,7 +394,7 @@ int32_t al_ustr_get_next(const ALLEGRO_USTR *us, int *pos) /* Function: al_ustr_prev_get */ -int32_t al_ustr_prev_get(const ALLEGRO_USTR *us, int *pos) +int32_t al_ustr_prev_get(const A5O_USTR *us, int *pos) { if (al_ustr_prev(us, pos)) { return al_ustr_get(us, *pos); @@ -407,7 +407,7 @@ int32_t al_ustr_prev_get(const ALLEGRO_USTR *us, int *pos) /* Function: al_ustr_insert */ -bool al_ustr_insert(ALLEGRO_USTR *us1, int pos, const ALLEGRO_USTR *us2) +bool al_ustr_insert(A5O_USTR *us1, int pos, const A5O_USTR *us2) { return _al_binsert(us1, pos, us2, '\0') == _AL_BSTR_OK; } @@ -415,9 +415,9 @@ bool al_ustr_insert(ALLEGRO_USTR *us1, int pos, const ALLEGRO_USTR *us2) /* Function: al_ustr_insert_cstr */ -bool al_ustr_insert_cstr(ALLEGRO_USTR *us, int pos, const char *s) +bool al_ustr_insert_cstr(A5O_USTR *us, int pos, const char *s) { - ALLEGRO_USTR_INFO info; + A5O_USTR_INFO info; return al_ustr_insert(us, pos, al_ref_cstr(&info, s)); } @@ -425,7 +425,7 @@ bool al_ustr_insert_cstr(ALLEGRO_USTR *us, int pos, const char *s) /* Function: al_ustr_insert_chr */ -size_t al_ustr_insert_chr(ALLEGRO_USTR *us, int pos, int32_t c) +size_t al_ustr_insert_chr(A5O_USTR *us, int pos, int32_t c) { uint32_t uc = c; size_t sz; @@ -449,7 +449,7 @@ size_t al_ustr_insert_chr(ALLEGRO_USTR *us, int pos, int32_t c) /* Function: al_ustr_append */ -bool al_ustr_append(ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2) +bool al_ustr_append(A5O_USTR *us1, const A5O_USTR *us2) { return _al_bconcat(us1, us2) == _AL_BSTR_OK; } @@ -457,7 +457,7 @@ bool al_ustr_append(ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2) /* Function: al_ustr_append_cstr */ -bool al_ustr_append_cstr(ALLEGRO_USTR *us, const char *s) +bool al_ustr_append_cstr(A5O_USTR *us, const char *s) { return _al_bcatcstr(us, s) == _AL_BSTR_OK; } @@ -465,7 +465,7 @@ bool al_ustr_append_cstr(ALLEGRO_USTR *us, const char *s) /* Function: al_ustr_append_chr */ -size_t al_ustr_append_chr(ALLEGRO_USTR *us, int32_t c) +size_t al_ustr_append_chr(A5O_USTR *us, int32_t c) { uint32_t uc = c; @@ -479,7 +479,7 @@ size_t al_ustr_append_chr(ALLEGRO_USTR *us, int32_t c) /* Function: al_ustr_appendf */ -bool al_ustr_appendf(ALLEGRO_USTR *us, const char *fmt, ...) +bool al_ustr_appendf(A5O_USTR *us, const char *fmt, ...) { va_list ap; bool rc; @@ -493,7 +493,7 @@ bool al_ustr_appendf(ALLEGRO_USTR *us, const char *fmt, ...) /* Function: al_ustr_vappendf */ -bool al_ustr_vappendf(ALLEGRO_USTR *us, const char *fmt, va_list ap) +bool al_ustr_vappendf(A5O_USTR *us, const char *fmt, va_list ap) { va_list arglist; int sz; @@ -529,7 +529,7 @@ bool al_ustr_vappendf(ALLEGRO_USTR *us, const char *fmt, va_list ap) /* Function: al_ustr_remove_chr */ -bool al_ustr_remove_chr(ALLEGRO_USTR *us, int pos) +bool al_ustr_remove_chr(A5O_USTR *us, int pos) { int32_t c; size_t w; @@ -545,7 +545,7 @@ bool al_ustr_remove_chr(ALLEGRO_USTR *us, int pos) /* Function: al_ustr_remove_range */ -bool al_ustr_remove_range(ALLEGRO_USTR *us, int start_pos, int end_pos) +bool al_ustr_remove_range(A5O_USTR *us, int start_pos, int end_pos) { return _al_bdelete(us, start_pos, end_pos - start_pos) == _AL_BSTR_OK; } @@ -553,7 +553,7 @@ bool al_ustr_remove_range(ALLEGRO_USTR *us, int start_pos, int end_pos) /* Function: al_ustr_truncate */ -bool al_ustr_truncate(ALLEGRO_USTR *us, int start_pos) +bool al_ustr_truncate(A5O_USTR *us, int start_pos) { return _al_btrunc(us, start_pos) == _AL_BSTR_OK; } @@ -561,7 +561,7 @@ bool al_ustr_truncate(ALLEGRO_USTR *us, int start_pos) /* Function: al_ustr_ltrim_ws */ -bool al_ustr_ltrim_ws(ALLEGRO_USTR *us) +bool al_ustr_ltrim_ws(A5O_USTR *us) { return _al_bltrimws(us) == _AL_BSTR_OK; } @@ -569,7 +569,7 @@ bool al_ustr_ltrim_ws(ALLEGRO_USTR *us) /* Function: al_ustr_rtrim_ws */ -bool al_ustr_rtrim_ws(ALLEGRO_USTR *us) +bool al_ustr_rtrim_ws(A5O_USTR *us) { return _al_brtrimws(us) == _AL_BSTR_OK; } @@ -577,7 +577,7 @@ bool al_ustr_rtrim_ws(ALLEGRO_USTR *us) /* Function: al_ustr_trim_ws */ -bool al_ustr_trim_ws(ALLEGRO_USTR *us) +bool al_ustr_trim_ws(A5O_USTR *us) { return _al_btrimws(us) == _AL_BSTR_OK; } @@ -585,7 +585,7 @@ bool al_ustr_trim_ws(ALLEGRO_USTR *us) /* Function: al_ustr_assign */ -bool al_ustr_assign(ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2) +bool al_ustr_assign(A5O_USTR *us1, const A5O_USTR *us2) { return _al_bassign(us1, us2) == _AL_BSTR_OK; } @@ -593,7 +593,7 @@ bool al_ustr_assign(ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2) /* Function: al_ustr_assign_substr */ -bool al_ustr_assign_substr(ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2, +bool al_ustr_assign_substr(A5O_USTR *us1, const A5O_USTR *us2, int start_pos, int end_pos) { int rc = _al_bassignmidstr(us1, us2, start_pos, end_pos - start_pos); @@ -603,7 +603,7 @@ bool al_ustr_assign_substr(ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2, /* Function: al_ustr_assign_cstr */ -bool al_ustr_assign_cstr(ALLEGRO_USTR *us1, const char *s) +bool al_ustr_assign_cstr(A5O_USTR *us1, const char *s) { return _al_bassigncstr(us1, s) == _AL_BSTR_OK; } @@ -611,7 +611,7 @@ bool al_ustr_assign_cstr(ALLEGRO_USTR *us1, const char *s) /* Function: al_ustr_set_chr */ -size_t al_ustr_set_chr(ALLEGRO_USTR *us, int start_pos, int32_t c) +size_t al_ustr_set_chr(A5O_USTR *us, int start_pos, int32_t c) { int32_t oldc; size_t oldw; @@ -651,8 +651,8 @@ size_t al_ustr_set_chr(ALLEGRO_USTR *us, int start_pos, int32_t c) /* Function: al_ustr_replace_range */ -bool al_ustr_replace_range(ALLEGRO_USTR *us1, int start_pos1, int end_pos1, - const ALLEGRO_USTR *us2) +bool al_ustr_replace_range(A5O_USTR *us1, int start_pos1, int end_pos1, + const A5O_USTR *us2) { return _al_breplace(us1, start_pos1, end_pos1 - start_pos1, us2, '\0') == _AL_BSTR_OK; @@ -661,7 +661,7 @@ bool al_ustr_replace_range(ALLEGRO_USTR *us1, int start_pos1, int end_pos1, /* Function: al_ustr_find_chr */ -int al_ustr_find_chr(const ALLEGRO_USTR *us, int start_pos, int32_t c) +int al_ustr_find_chr(const A5O_USTR *us, int start_pos, int32_t c) { char encc[4]; size_t sizec; @@ -692,7 +692,7 @@ int al_ustr_find_chr(const ALLEGRO_USTR *us, int start_pos, int32_t c) /* Function: al_ustr_rfind_chr */ -int al_ustr_rfind_chr(const ALLEGRO_USTR *us, int end_pos, int32_t c) +int al_ustr_rfind_chr(const A5O_USTR *us, int end_pos, int32_t c) { char encc[4]; size_t sizec; @@ -723,8 +723,8 @@ int al_ustr_rfind_chr(const ALLEGRO_USTR *us, int end_pos, int32_t c) /* Function: al_ustr_find_set */ -int al_ustr_find_set(const ALLEGRO_USTR *us, int start_pos, - const ALLEGRO_USTR *accept) +int al_ustr_find_set(const A5O_USTR *us, int start_pos, + const A5O_USTR *accept) { int rc; int32_t c, d; @@ -761,11 +761,11 @@ int al_ustr_find_set(const ALLEGRO_USTR *us, int start_pos, /* Function: al_ustr_find_set_cstr */ -int al_ustr_find_set_cstr(const ALLEGRO_USTR *us, int start_pos, +int al_ustr_find_set_cstr(const A5O_USTR *us, int start_pos, const char *accept) { - ALLEGRO_USTR_INFO info; - const ALLEGRO_USTR *accept_us = al_ref_cstr(&info, accept); + A5O_USTR_INFO info; + const A5O_USTR *accept_us = al_ref_cstr(&info, accept); return al_ustr_find_set(us, start_pos, accept_us); } @@ -773,8 +773,8 @@ int al_ustr_find_set_cstr(const ALLEGRO_USTR *us, int start_pos, /* Function: al_ustr_find_cset */ -int al_ustr_find_cset(const ALLEGRO_USTR *us, int start_pos, - const ALLEGRO_USTR *reject) +int al_ustr_find_cset(const A5O_USTR *us, int start_pos, + const A5O_USTR *reject) { int rc; int32_t c, d; @@ -815,11 +815,11 @@ int al_ustr_find_cset(const ALLEGRO_USTR *us, int start_pos, /* Function: al_ustr_find_cset_cstr */ -int al_ustr_find_cset_cstr(const ALLEGRO_USTR *us, int start_pos, +int al_ustr_find_cset_cstr(const A5O_USTR *us, int start_pos, const char *reject) { - ALLEGRO_USTR_INFO info; - const ALLEGRO_USTR *reject_us = al_ref_cstr(&info, reject); + A5O_USTR_INFO info; + const A5O_USTR *reject_us = al_ref_cstr(&info, reject); return al_ustr_find_cset(us, start_pos, reject_us); } @@ -827,8 +827,8 @@ int al_ustr_find_cset_cstr(const ALLEGRO_USTR *us, int start_pos, /* Function: al_ustr_find_str */ -int al_ustr_find_str(const ALLEGRO_USTR *haystack, int start_pos, - const ALLEGRO_USTR *needle) +int al_ustr_find_str(const A5O_USTR *haystack, int start_pos, + const A5O_USTR *needle) { int rc = _al_binstr(haystack, start_pos, needle); return (rc == _AL_BSTR_ERR) ? -1 : rc; @@ -837,11 +837,11 @@ int al_ustr_find_str(const ALLEGRO_USTR *haystack, int start_pos, /* Function: al_ustr_find_cstr */ -int al_ustr_find_cstr(const ALLEGRO_USTR *haystack, int start_pos, +int al_ustr_find_cstr(const A5O_USTR *haystack, int start_pos, const char *needle) { - ALLEGRO_USTR_INFO info; - const ALLEGRO_USTR *needle_us = al_ref_cstr(&info, needle); + A5O_USTR_INFO info; + const A5O_USTR *needle_us = al_ref_cstr(&info, needle); return al_ustr_find_str(haystack, start_pos, needle_us); } @@ -849,8 +849,8 @@ int al_ustr_find_cstr(const ALLEGRO_USTR *haystack, int start_pos, /* Function: al_ustr_rfind_str */ -int al_ustr_rfind_str(const ALLEGRO_USTR *haystack, int end_pos, - const ALLEGRO_USTR *needle) +int al_ustr_rfind_str(const A5O_USTR *haystack, int end_pos, + const A5O_USTR *needle) { int rc = _al_binstrr(haystack, end_pos - _al_blength(needle), needle); return (rc == _AL_BSTR_ERR) ? -1 : rc; @@ -859,11 +859,11 @@ int al_ustr_rfind_str(const ALLEGRO_USTR *haystack, int end_pos, /* Function: al_ustr_rfind_cstr */ -int al_ustr_rfind_cstr(const ALLEGRO_USTR *haystack, int end_pos, +int al_ustr_rfind_cstr(const A5O_USTR *haystack, int end_pos, const char *needle) { - ALLEGRO_USTR_INFO info; - const ALLEGRO_USTR *needle_us = al_ref_cstr(&info, needle); + A5O_USTR_INFO info; + const A5O_USTR *needle_us = al_ref_cstr(&info, needle); return al_ustr_rfind_str(haystack, end_pos, needle_us); } @@ -871,8 +871,8 @@ int al_ustr_rfind_cstr(const ALLEGRO_USTR *haystack, int end_pos, /* Function: al_ustr_find_replace */ -bool al_ustr_find_replace(ALLEGRO_USTR *us, int start_pos, - const ALLEGRO_USTR *find, const ALLEGRO_USTR *replace) +bool al_ustr_find_replace(A5O_USTR *us, int start_pos, + const A5O_USTR *find, const A5O_USTR *replace) { return _al_bfindreplace(us, find, replace, start_pos) == _AL_BSTR_OK; } @@ -880,13 +880,13 @@ bool al_ustr_find_replace(ALLEGRO_USTR *us, int start_pos, /* Function: al_ustr_find_replace_cstr */ -bool al_ustr_find_replace_cstr(ALLEGRO_USTR *us, int start_pos, +bool al_ustr_find_replace_cstr(A5O_USTR *us, int start_pos, const char *find, const char *replace) { - ALLEGRO_USTR_INFO find_info; - ALLEGRO_USTR_INFO repl_info; - const ALLEGRO_USTR *find_us = al_ref_cstr(&find_info, find); - const ALLEGRO_USTR *repl_us = al_ref_cstr(&repl_info, replace); + A5O_USTR_INFO find_info; + A5O_USTR_INFO repl_info; + const A5O_USTR *find_us = al_ref_cstr(&find_info, find); + const A5O_USTR *repl_us = al_ref_cstr(&repl_info, replace); return al_ustr_find_replace(us, start_pos, find_us, repl_us); } @@ -894,7 +894,7 @@ bool al_ustr_find_replace_cstr(ALLEGRO_USTR *us, int start_pos, /* Function: al_ustr_equal */ -bool al_ustr_equal(const ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2) +bool al_ustr_equal(const A5O_USTR *us1, const A5O_USTR *us2) { return _al_biseq(us1, us2) == 1; } @@ -902,7 +902,7 @@ bool al_ustr_equal(const ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2) /* Function: al_ustr_compare */ -int al_ustr_compare(const ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2) +int al_ustr_compare(const A5O_USTR *us1, const A5O_USTR *us2) { int pos1 = 0; int pos2 = 0; @@ -924,7 +924,7 @@ int al_ustr_compare(const ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2) /* Function: al_ustr_ncompare */ -int al_ustr_ncompare(const ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2, int n) +int al_ustr_ncompare(const A5O_USTR *us1, const A5O_USTR *us2, int n) { int pos1 = 0; int pos2 = 0; @@ -949,7 +949,7 @@ int al_ustr_ncompare(const ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2, int n) /* Function: al_ustr_has_prefix */ -bool al_ustr_has_prefix(const ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2) +bool al_ustr_has_prefix(const A5O_USTR *us1, const A5O_USTR *us2) { return 0 == _al_bstrncmp(us1, us2, _al_blength(us2)); } @@ -957,10 +957,10 @@ bool al_ustr_has_prefix(const ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2) /* Function: al_ustr_has_prefix_cstr */ -bool al_ustr_has_prefix_cstr(const ALLEGRO_USTR *us1, const char *s2) +bool al_ustr_has_prefix_cstr(const A5O_USTR *us1, const char *s2) { - ALLEGRO_USTR_INFO info; - const ALLEGRO_USTR *us2 = al_ref_cstr(&info, s2); + A5O_USTR_INFO info; + const A5O_USTR *us2 = al_ref_cstr(&info, s2); return al_ustr_has_prefix(us1, us2); } @@ -968,7 +968,7 @@ bool al_ustr_has_prefix_cstr(const ALLEGRO_USTR *us1, const char *s2) /* Function: al_ustr_has_suffix */ -bool al_ustr_has_suffix(const ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2) +bool al_ustr_has_suffix(const A5O_USTR *us1, const A5O_USTR *us2) { struct _al_tagbstring tb1; int pos; @@ -981,10 +981,10 @@ bool al_ustr_has_suffix(const ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2) /* Function: al_ustr_has_suffix_cstr */ -bool al_ustr_has_suffix_cstr(const ALLEGRO_USTR *us1, const char *s2) +bool al_ustr_has_suffix_cstr(const A5O_USTR *us1, const char *s2) { - ALLEGRO_USTR_INFO info; - const ALLEGRO_USTR *us2 = al_ref_cstr(&info, s2); + A5O_USTR_INFO info; + const A5O_USTR *us2 = al_ref_cstr(&info, s2); return al_ustr_has_suffix(us1, us2); } @@ -1109,10 +1109,10 @@ static size_t _al_utf16_get(uint16_t const *s, int n, int *c) /* Function: al_ustr_new_from_utf16 */ -ALLEGRO_USTR *al_ustr_new_from_utf16(uint16_t const *s) +A5O_USTR *al_ustr_new_from_utf16(uint16_t const *s) { unsigned int i = 0; - ALLEGRO_USTR *ustr = al_ustr_new(""); + A5O_USTR *ustr = al_ustr_new(""); while (1) { int c; /* We expect the passed string to be 0 terminated, so there are @@ -1131,7 +1131,7 @@ ALLEGRO_USTR *al_ustr_new_from_utf16(uint16_t const *s) /* Function: al_ustr_size_utf16 */ -size_t al_ustr_size_utf16(const ALLEGRO_USTR *us) +size_t al_ustr_size_utf16(const A5O_USTR *us) { int pos = 0; size_t sz = 0; @@ -1151,7 +1151,7 @@ size_t al_ustr_size_utf16(const ALLEGRO_USTR *us) /* Function: al_ustr_encode_utf16 */ -size_t al_ustr_encode_utf16(const ALLEGRO_USTR *us, uint16_t *s, +size_t al_ustr_encode_utf16(const A5O_USTR *us, uint16_t *s, size_t n) { int pos = 0; diff --git a/src/win/d3d.h b/src/win/d3d.h index 348e14c381..2b17c6aa00 100644 --- a/src/win/d3d.h +++ b/src/win/d3d.h @@ -29,49 +29,49 @@ extern "C" { // Fixed pipeline vertex #define D3DFVF_FIXED_VERTEX (D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1) // Programmable pipeline vertex -#define D3DFVF_ALLEGRO_VERTEX (D3DFVF_XYZ | D3DFVF_TEX2 | D3DFVF_TEXCOORDSIZE2(0) | D3DFVF_TEXCOORDSIZE4(1)) +#define D3DFVF_A5O_VERTEX (D3DFVF_XYZ | D3DFVF_TEX2 | D3DFVF_TEXCOORDSIZE2(0) | D3DFVF_TEXCOORDSIZE4(1)) -// Vertex structure when using fixed pipeline (otherwise it's ALLEGRO_VERTEX) +// Vertex structure when using fixed pipeline (otherwise it's A5O_VERTEX) struct D3D_FIXED_VERTEX { float x, y, z; D3DCOLOR color; float u, v; }; -typedef struct ALLEGRO_SYSTEM_D3D ALLEGRO_SYSTEM_D3D; +typedef struct A5O_SYSTEM_D3D A5O_SYSTEM_D3D; extern LPDIRECT3D9 _al_d3d; -ALLEGRO_BITMAP_INTERFACE *_al_bitmap_d3d_driver(void); +A5O_BITMAP_INTERFACE *_al_bitmap_d3d_driver(void); int _al_pixel_format_to_d3d(int format); int _al_d3d_format_to_allegro(int d3d_fmt); bool _al_d3d_render_to_texture_supported(void); -void _al_d3d_set_bitmap_clip(ALLEGRO_BITMAP *bitmap); +void _al_d3d_set_bitmap_clip(A5O_BITMAP *bitmap); -void _al_d3d_release_default_pool_textures(ALLEGRO_DISPLAY *display); -void _al_d3d_refresh_texture_memory(ALLEGRO_DISPLAY *display); -bool _al_d3d_recreate_bitmap_textures(ALLEGRO_DISPLAY_D3D *disp); -void _al_d3d_set_bitmap_clip(ALLEGRO_BITMAP *bitmap); -bool _al_d3d_supports_separate_alpha_blend(ALLEGRO_DISPLAY *display); +void _al_d3d_release_default_pool_textures(A5O_DISPLAY *display); +void _al_d3d_refresh_texture_memory(A5O_DISPLAY *display); +bool _al_d3d_recreate_bitmap_textures(A5O_DISPLAY_D3D *disp); +void _al_d3d_set_bitmap_clip(A5O_BITMAP *bitmap); +bool _al_d3d_supports_separate_alpha_blend(A5O_DISPLAY *display); void _al_d3d_bmp_destroy(void); void _al_d3d_generate_display_format_list(void); int _al_d3d_num_display_formats(void); void _al_d3d_get_nth_format(int i, int *allegro, D3DFORMAT *d3d); -void _al_d3d_score_display_settings(ALLEGRO_EXTRA_DISPLAY_SETTINGS *ref); +void _al_d3d_score_display_settings(A5O_EXTRA_DISPLAY_SETTINGS *ref); void _al_d3d_destroy_display_format_list(void); -ALLEGRO_EXTRA_DISPLAY_SETTINGS *_al_d3d_get_display_settings(int i); +A5O_EXTRA_DISPLAY_SETTINGS *_al_d3d_get_display_settings(int i); void _al_d3d_resort_display_settings(void); -#ifdef ALLEGRO_CFG_SHADER_HLSL -void _al_d3d_on_lost_shaders(ALLEGRO_DISPLAY *display); -void _al_d3d_on_reset_shaders(ALLEGRO_DISPLAY *display); +#ifdef A5O_CFG_SHADER_HLSL +void _al_d3d_on_lost_shaders(A5O_DISPLAY *display); +void _al_d3d_on_reset_shaders(A5O_DISPLAY *display); void _al_d3d_init_shaders(void); void _al_d3d_shutdown_shaders(void); #endif -extern ALLEGRO_MUTEX *_al_d3d_lost_device_mutex; +extern A5O_MUTEX *_al_d3d_lost_device_mutex; /* Helper to get smallest fitting power of two. */ AL_INLINE_STATIC(int, pot, (int x), diff --git a/src/win/d3d_bmp.cpp b/src/win/d3d_bmp.cpp index f23ffd03f0..76be20b340 100644 --- a/src/win/d3d_bmp.cpp +++ b/src/win/d3d_bmp.cpp @@ -26,34 +26,34 @@ #include "allegro5/internal/aintern_memblit.h" #include "allegro5/internal/aintern_pixels.h" #include "allegro5/internal/aintern_system.h" -#include "allegro5/internal/aintern_tri_soft.h" // For ALLEGRO_VERTEX +#include "allegro5/internal/aintern_tri_soft.h" // For A5O_VERTEX #include "allegro5/platform/aintwin.h" #include "d3d.h" -ALLEGRO_DEBUG_CHANNEL("d3d") +A5O_DEBUG_CHANNEL("d3d") -static ALLEGRO_BITMAP_INTERFACE *vt; +static A5O_BITMAP_INTERFACE *vt; // C++ needs to cast void pointers -#define get_extra(b) ((ALLEGRO_BITMAP_EXTRA_D3D *)\ +#define get_extra(b) ((A5O_BITMAP_EXTRA_D3D *)\ (b->parent ? b->parent->extra : b->extra)) static bool convert_compressed(LPDIRECT3DTEXTURE9 dest, LPDIRECT3DTEXTURE9 src, int x, int y, int width, int height) { -#ifdef ALLEGRO_CFG_D3DX9 +#ifdef A5O_CFG_D3DX9 bool ok = true; LPDIRECT3DSURFACE9 dest_texture_surface = NULL; LPDIRECT3DSURFACE9 src_texture_surface = NULL; if (dest->GetSurfaceLevel(0, &dest_texture_surface) != D3D_OK) { - ALLEGRO_ERROR("convert_compressed: GetSurfaceLevel failed on dest.\n"); + A5O_ERROR("convert_compressed: GetSurfaceLevel failed on dest.\n"); ok = false; } if (ok && src->GetSurfaceLevel(0, &src_texture_surface) != D3D_OK) { - ALLEGRO_ERROR("convert_compressed: GetSurfaceLevel failed on src.\n"); + A5O_ERROR("convert_compressed: GetSurfaceLevel failed on src.\n"); ok = false; } @@ -72,20 +72,20 @@ static bool convert_compressed(LPDIRECT3DTEXTURE9 dest, LPDIRECT3DTEXTURE9 src, &rect, D3DX_FILTER_NONE, 0) != D3D_OK) { - ALLEGRO_ERROR("convert_compressed: D3DXLoadSurfaceFromSurface failed.\n"); + A5O_ERROR("convert_compressed: D3DXLoadSurfaceFromSurface failed.\n"); ok = false; } int i; if (src_texture_surface) { if ((i = src_texture_surface->Release()) != 0) { - ALLEGRO_DEBUG("convert_compressed (src) ref count == %d\n", i); + A5O_DEBUG("convert_compressed (src) ref count == %d\n", i); } } if (dest_texture_surface) { if ((i = dest_texture_surface->Release()) != 0) { // This can be non-zero - ALLEGRO_DEBUG("convert_compressed (dest) ref count == %d\n", i); + A5O_DEBUG("convert_compressed (dest) ref count == %d\n", i); } } return ok; @@ -102,16 +102,16 @@ static bool convert_compressed(LPDIRECT3DTEXTURE9 dest, LPDIRECT3DTEXTURE9 src, /* Function: al_get_d3d_texture_size */ -bool al_get_d3d_texture_size(ALLEGRO_BITMAP *bitmap, int *width, int *height) +bool al_get_d3d_texture_size(A5O_BITMAP *bitmap, int *width, int *height) { int bitmap_flags = al_get_bitmap_flags(bitmap); ASSERT(bitmap); ASSERT(width); ASSERT(height); - if (!(bitmap_flags & _ALLEGRO_INTERNAL_OPENGL) && - !(bitmap_flags & ALLEGRO_MEMORY_BITMAP)) { - ALLEGRO_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); + if (!(bitmap_flags & _A5O_INTERNAL_OPENGL) && + !(bitmap_flags & A5O_MEMORY_BITMAP)) { + A5O_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); *width = d3d_bmp->texture_w; *height = d3d_bmp->texture_h; return true; @@ -138,7 +138,7 @@ static INLINE void transform_vertex(float* x, float* y, float* z) * Draw a textured quad */ static void d3d_draw_textured_quad( - ALLEGRO_DISPLAY_D3D *disp, ALLEGRO_BITMAP *bmp, ALLEGRO_COLOR tint, + A5O_DISPLAY_D3D *disp, A5O_BITMAP *bmp, A5O_COLOR tint, float sx, float sy, float sw, float sh, int flags) { float right; @@ -149,11 +149,11 @@ static void d3d_draw_textured_quad( float tv_end; int texture_w; int texture_h; - ALLEGRO_BITMAP_EXTRA_D3D *extra = get_extra(bmp); + A5O_BITMAP_EXTRA_D3D *extra = get_extra(bmp); const float z = 0.0f; - ALLEGRO_DISPLAY* aldisp = (ALLEGRO_DISPLAY*)disp; + A5O_DISPLAY* aldisp = (A5O_DISPLAY*)disp; if (aldisp->num_cache_vertices != 0 && (uintptr_t)bmp != aldisp->cache_texture) { aldisp->vt->flush_vertex_cache(aldisp); @@ -170,18 +170,18 @@ static void d3d_draw_textured_quad( tu_end = sw / texture_w + tu_start; tv_end = sh / texture_h + tv_start; - if (flags & ALLEGRO_FLIP_HORIZONTAL) { + if (flags & A5O_FLIP_HORIZONTAL) { float temp = tu_start; tu_start = tu_end; tu_end = temp; } - if (flags & ALLEGRO_FLIP_VERTICAL) { + if (flags & A5O_FLIP_VERTICAL) { float temp = tv_start; tv_start = tv_end; tv_end = temp; } -#define ALLEGRO_COLOR_TO_D3D(c) D3DCOLOR_COLORVALUE(c.r, c.g, c.b, c.a) +#define A5O_COLOR_TO_D3D(c) D3DCOLOR_COLORVALUE(c.r, c.g, c.b, c.a) #define SET(f) \ vertices[0].x = 0; \ @@ -222,15 +222,15 @@ static void d3d_draw_textured_quad( vertices[3] = vertices[0]; \ vertices[4] = vertices[2]; - bool pp = (aldisp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) != 0; + bool pp = (aldisp->flags & A5O_PROGRAMMABLE_PIPELINE) != 0; if (pp) { - ALLEGRO_VERTEX *vertices = (ALLEGRO_VERTEX *)aldisp->vt->prepare_vertex_cache(aldisp, 6); - SET(ALLEGRO_COLOR) + A5O_VERTEX *vertices = (A5O_VERTEX *)aldisp->vt->prepare_vertex_cache(aldisp, 6); + SET(A5O_COLOR) } else { D3D_FIXED_VERTEX *vertices = (D3D_FIXED_VERTEX *)aldisp->vt->prepare_vertex_cache(aldisp, 6); - SET(ALLEGRO_COLOR_TO_D3D) + SET(A5O_COLOR_TO_D3D) } if (!aldisp->cache_enabled) @@ -238,10 +238,10 @@ static void d3d_draw_textured_quad( } /* Copy texture memory to bitmap->memory */ -static void d3d_sync_bitmap_memory(ALLEGRO_BITMAP *bitmap) +static void d3d_sync_bitmap_memory(A5O_BITMAP *bitmap) { D3DLOCKED_RECT locked_rect; - ALLEGRO_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); + A5O_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); LPDIRECT3DTEXTURE9 texture; int bitmap_format = al_get_bitmap_format(bitmap); @@ -264,17 +264,17 @@ static void d3d_sync_bitmap_memory(ALLEGRO_BITMAP *bitmap) texture->UnlockRect(0); } else { - ALLEGRO_ERROR("d3d_sync_bitmap_memory: Couldn't lock texture.\n"); + A5O_ERROR("d3d_sync_bitmap_memory: Couldn't lock texture.\n"); } } /* Copy bitmap->memory to texture memory */ -static void d3d_sync_bitmap_texture(ALLEGRO_BITMAP *bitmap, +static void d3d_sync_bitmap_texture(A5O_BITMAP *bitmap, int x, int y, int width, int height) { D3DLOCKED_RECT locked_rect; RECT rect; - ALLEGRO_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); + A5O_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); LPDIRECT3DTEXTURE9 texture; int bitmap_format = al_get_bitmap_format(bitmap); @@ -302,11 +302,11 @@ static void d3d_sync_bitmap_texture(ALLEGRO_BITMAP *bitmap, texture->UnlockRect(0); } else { - ALLEGRO_ERROR("d3d_sync_bitmap_texture: Couldn't lock texture to upload.\n"); + A5O_ERROR("d3d_sync_bitmap_texture: Couldn't lock texture to upload.\n"); } } -static void d3d_do_upload(ALLEGRO_BITMAP *bmp, int x, int y, int width, +static void d3d_do_upload(A5O_BITMAP *bmp, int x, int y, int width, int height, bool sync_from_memory) { if (sync_from_memory) { @@ -315,11 +315,11 @@ static void d3d_do_upload(ALLEGRO_BITMAP *bmp, int x, int y, int width, if (_al_d3d_render_to_texture_supported() && !_al_pixel_format_is_compressed(al_get_bitmap_format(bmp))) { - ALLEGRO_BITMAP_EXTRA_D3D *d3d_bitmap = get_extra(bmp); + A5O_BITMAP_EXTRA_D3D *d3d_bitmap = get_extra(bmp); if (d3d_bitmap->display->device->UpdateTexture( (IDirect3DBaseTexture9 *)d3d_bitmap->system_texture, (IDirect3DBaseTexture9 *)d3d_bitmap->video_texture) != D3D_OK) { - ALLEGRO_ERROR("d3d_do_upload: Couldn't update texture.\n"); + A5O_ERROR("d3d_do_upload: Couldn't update texture.\n"); return; } } @@ -329,18 +329,18 @@ static void d3d_do_upload(ALLEGRO_BITMAP *bmp, int x, int y, int width, * Release all default pool textures. This must be done before * resetting the device. */ -void _al_d3d_release_default_pool_textures(ALLEGRO_DISPLAY *disp) +void _al_d3d_release_default_pool_textures(A5O_DISPLAY *disp) { unsigned int i; for (i = 0; i < disp->bitmaps._size; i++) { - ALLEGRO_BITMAP **bptr = (ALLEGRO_BITMAP **)_al_vector_ref(&disp->bitmaps, i); - ALLEGRO_BITMAP *albmp = *bptr; + A5O_BITMAP **bptr = (A5O_BITMAP **)_al_vector_ref(&disp->bitmaps, i); + A5O_BITMAP *albmp = *bptr; - if ((al_get_bitmap_flags(albmp) & ALLEGRO_MEMORY_BITMAP) || (albmp->parent)) + if ((al_get_bitmap_flags(albmp) & A5O_MEMORY_BITMAP) || (albmp->parent)) continue; - ALLEGRO_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(albmp); + A5O_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(albmp); if (!d3d_bmp->is_backbuffer && d3d_bmp->render_target) { d3d_bmp->render_target->Release(); d3d_bmp->render_target = NULL; @@ -352,7 +352,7 @@ void _al_d3d_release_default_pool_textures(ALLEGRO_DISPLAY *disp) } } -static bool d3d_create_textures(ALLEGRO_DISPLAY_D3D *disp, int w, int h, +static bool d3d_create_textures(A5O_DISPLAY_D3D *disp, int w, int h, int flags, LPDIRECT3DTEXTURE9 *video_texture, LPDIRECT3DTEXTURE9 *system_texture, int video_format, int system_format) @@ -362,7 +362,7 @@ static bool d3d_create_textures(ALLEGRO_DISPLAY_D3D *disp, int w, int h, int err; bool compressed = _al_pixel_format_is_compressed(video_format); - if (flags & ALLEGRO_MIPMAP) { + if (flags & A5O_MIPMAP) { /* "0" for all possible levels, required for auto mipmap generation. */ levels = 0; autogenmipmap = D3DUSAGE_AUTOGENMIPMAP; @@ -386,7 +386,7 @@ static bool d3d_create_textures(ALLEGRO_DISPLAY_D3D *disp, int w, int h, (D3DFORMAT)_al_pixel_format_to_d3d(video_format), pool, video_texture, NULL); if (err != D3D_OK && err != D3DOK_NOAUTOGEN) { - ALLEGRO_ERROR("d3d_create_textures: Unable to create video texture.\n"); + A5O_ERROR("d3d_create_textures: Unable to create video texture.\n"); return false; } } @@ -396,7 +396,7 @@ static bool d3d_create_textures(ALLEGRO_DISPLAY_D3D *disp, int w, int h, 0, (D3DFORMAT)_al_pixel_format_to_d3d(system_format), D3DPOOL_SYSTEMMEM, system_texture, NULL); if (err != D3D_OK) { - ALLEGRO_ERROR("d3d_create_textures: Unable to create system texture.\n"); + A5O_ERROR("d3d_create_textures: Unable to create system texture.\n"); if (video_texture && (*video_texture)) { (*video_texture)->Release(); *video_texture = NULL; @@ -413,7 +413,7 @@ static bool d3d_create_textures(ALLEGRO_DISPLAY_D3D *disp, int w, int h, 0, (D3DFORMAT)_al_pixel_format_to_d3d(video_format), D3DPOOL_MANAGED, video_texture, NULL); if (err != D3D_OK) { - ALLEGRO_ERROR("d3d_create_textures: Unable to create video texture (no render-to-texture).\n"); + A5O_ERROR("d3d_create_textures: Unable to create video texture (no render-to-texture).\n"); return false; } } @@ -422,12 +422,12 @@ static bool d3d_create_textures(ALLEGRO_DISPLAY_D3D *disp, int w, int h, } } -static ALLEGRO_BITMAP +static A5O_BITMAP *d3d_create_bitmap_from_surface(LPDIRECT3DSURFACE9 surface, int format, int flags) { - ALLEGRO_BITMAP *bitmap; - ALLEGRO_BITMAP_EXTRA_D3D *extra; + A5O_BITMAP *bitmap; + A5O_BITMAP_EXTRA_D3D *extra; D3DSURFACE_DESC desc; D3DLOCKED_RECT surf_locked_rect; D3DLOCKED_RECT sys_locked_rect; @@ -435,12 +435,12 @@ static ALLEGRO_BITMAP ASSERT(!_al_pixel_format_is_compressed(format)); if (surface->GetDesc(&desc) != D3D_OK) { - ALLEGRO_ERROR("d3d_create_bitmap_from_surface: GetDesc failed.\n"); + A5O_ERROR("d3d_create_bitmap_from_surface: GetDesc failed.\n"); return NULL; } if (surface->LockRect(&surf_locked_rect, 0, D3DLOCK_READONLY) != D3D_OK) { - ALLEGRO_ERROR("d3d_create_bitmap_from_surface: LockRect failed.\n"); + A5O_ERROR("d3d_create_bitmap_from_surface: LockRect failed.\n"); return NULL; } @@ -456,7 +456,7 @@ static ALLEGRO_BITMAP if (extra->system_texture->LockRect(0, &sys_locked_rect, 0, 0) != D3D_OK) { surface->UnlockRect(); al_destroy_bitmap(bitmap); - ALLEGRO_ERROR("d3d_create_bitmap_from_surface: Lock system texture failed.\n"); + A5O_ERROR("d3d_create_bitmap_from_surface: Lock system texture failed.\n"); return NULL; } @@ -475,35 +475,35 @@ static ALLEGRO_BITMAP if (extra->display->device->UpdateTexture( (IDirect3DBaseTexture9 *)extra->system_texture, (IDirect3DBaseTexture9 *)extra->video_texture) != D3D_OK) { - ALLEGRO_ERROR("d3d_create_bitmap_from_surface: Couldn't update texture.\n"); + A5O_ERROR("d3d_create_bitmap_from_surface: Couldn't update texture.\n"); } return bitmap; } /* Copies video texture to system texture and bitmap->memory */ -static bool _al_d3d_sync_bitmap(ALLEGRO_BITMAP *dest) +static bool _al_d3d_sync_bitmap(A5O_BITMAP *dest) { - ALLEGRO_BITMAP_EXTRA_D3D *d3d_dest; + A5O_BITMAP_EXTRA_D3D *d3d_dest; LPDIRECT3DSURFACE9 system_texture_surface; LPDIRECT3DSURFACE9 video_texture_surface; bool ok; UINT i; if (!_al_d3d_render_to_texture_supported()) { - ALLEGRO_ERROR("Render-to-texture not supported.\n"); + A5O_ERROR("Render-to-texture not supported.\n"); return false; } if (dest->locked) { - ALLEGRO_ERROR("Already locked.\n"); + A5O_ERROR("Already locked.\n"); return false; } d3d_dest = get_extra(dest); if (d3d_dest->system_texture == NULL || d3d_dest->video_texture == NULL) { - ALLEGRO_ERROR("A texture is null.\n"); + A5O_ERROR("A texture is null.\n"); return false; } @@ -517,32 +517,32 @@ static bool _al_d3d_sync_bitmap(ALLEGRO_BITMAP *dest) if (d3d_dest->system_texture->GetSurfaceLevel( 0, &system_texture_surface) != D3D_OK) { - ALLEGRO_ERROR("_al_d3d_sync_bitmap: GetSurfaceLevel failed while updating system texture.\n"); + A5O_ERROR("_al_d3d_sync_bitmap: GetSurfaceLevel failed while updating system texture.\n"); ok = false; } if (ok && d3d_dest->video_texture->GetSurfaceLevel( 0, &video_texture_surface) != D3D_OK) { - ALLEGRO_ERROR("_al_d3d_sync_bitmap: GetSurfaceLevel failed while updating system texture.\n"); + A5O_ERROR("_al_d3d_sync_bitmap: GetSurfaceLevel failed while updating system texture.\n"); ok = false; } if (ok && d3d_dest->display->device->GetRenderTargetData( video_texture_surface, system_texture_surface) != D3D_OK) { - ALLEGRO_ERROR("_al_d3d_sync_bitmap: GetRenderTargetData failed.\n"); + A5O_ERROR("_al_d3d_sync_bitmap: GetRenderTargetData failed.\n"); ok = false; } if (system_texture_surface) { if ((i = system_texture_surface->Release()) != 0) { - ALLEGRO_DEBUG("_al_d3d_sync_bitmap (system) ref count == %d\n", i); + A5O_DEBUG("_al_d3d_sync_bitmap (system) ref count == %d\n", i); } } if (video_texture_surface) { if ((i = video_texture_surface->Release()) != 0) { // This can be non-zero - ALLEGRO_DEBUG("_al_d3d_sync_bitmap (video) ref count == %d\n", i); + A5O_DEBUG("_al_d3d_sync_bitmap (video) ref count == %d\n", i); } } @@ -554,10 +554,10 @@ static bool _al_d3d_sync_bitmap(ALLEGRO_BITMAP *dest) } // Copy texture to system memory -static void d3d_backup_dirty_bitmap(ALLEGRO_BITMAP *bitmap) +static void d3d_backup_dirty_bitmap(A5O_BITMAP *bitmap) { - ALLEGRO_DISPLAY *display = bitmap->_display; - ALLEGRO_DISPLAY_D3D *d3d_display = (ALLEGRO_DISPLAY_D3D *)display; + A5O_DISPLAY *display = bitmap->_display; + A5O_DISPLAY_D3D *d3d_display = (A5O_DISPLAY_D3D *)display; if (d3d_display->device_lost) return; @@ -567,11 +567,11 @@ static void d3d_backup_dirty_bitmap(ALLEGRO_BITMAP *bitmap) al_lock_mutex(_al_d3d_lost_device_mutex); - ALLEGRO_BITMAP_EXTRA_D3D *extra = get_extra(bitmap); + A5O_BITMAP_EXTRA_D3D *extra = get_extra(bitmap); int bitmap_flags = al_get_bitmap_flags(bitmap); if (!( - (bitmap_flags & ALLEGRO_MEMORY_BITMAP) || - (bitmap_flags & ALLEGRO_NO_PRESERVE_TEXTURE) || + (bitmap_flags & A5O_MEMORY_BITMAP) || + (bitmap_flags & A5O_NO_PRESERVE_TEXTURE) || !bitmap->dirty || extra->is_backbuffer || bitmap->parent @@ -591,15 +591,15 @@ static void d3d_backup_dirty_bitmap(ALLEGRO_BITMAP *bitmap) /* * Called after the resize is done. */ -bool _al_d3d_recreate_bitmap_textures(ALLEGRO_DISPLAY_D3D *disp) +bool _al_d3d_recreate_bitmap_textures(A5O_DISPLAY_D3D *disp) { unsigned int i; - ALLEGRO_DISPLAY *display = (ALLEGRO_DISPLAY *)disp; + A5O_DISPLAY *display = (A5O_DISPLAY *)disp; for (i = 0; i < display->bitmaps._size; i++) { - ALLEGRO_BITMAP **bptr = (ALLEGRO_BITMAP **)_al_vector_ref(&display->bitmaps, i); - ALLEGRO_BITMAP *bmp = *bptr; - ALLEGRO_BITMAP_EXTRA_D3D *extra = get_extra(bmp); + A5O_BITMAP **bptr = (A5O_BITMAP **)_al_vector_ref(&display->bitmaps, i); + A5O_BITMAP *bmp = *bptr; + A5O_BITMAP_EXTRA_D3D *extra = get_extra(bmp); if ((void *)_al_get_bitmap_display(bmp) == (void *)disp) { int block_width = @@ -627,27 +627,27 @@ bool _al_d3d_recreate_bitmap_textures(ALLEGRO_DISPLAY_D3D *disp) * Refresh the texture memory. This must be done after a device is * lost or after it is reset. */ -void _al_d3d_refresh_texture_memory(ALLEGRO_DISPLAY *display) +void _al_d3d_refresh_texture_memory(A5O_DISPLAY *display) { unsigned int i; /* Refresh video hardware textures */ for (i = 0; i < display->bitmaps._size; i++) { - ALLEGRO_BITMAP **bptr = (ALLEGRO_BITMAP **)_al_vector_ref(&display->bitmaps, i); - ALLEGRO_BITMAP *bmp = *bptr; - ALLEGRO_BITMAP_EXTRA_D3D *extra = get_extra(bmp); - ALLEGRO_DISPLAY_D3D *bmps_display = - (ALLEGRO_DISPLAY_D3D *)_al_get_bitmap_display(bmp); + A5O_BITMAP **bptr = (A5O_BITMAP **)_al_vector_ref(&display->bitmaps, i); + A5O_BITMAP *bmp = *bptr; + A5O_BITMAP_EXTRA_D3D *extra = get_extra(bmp); + A5O_DISPLAY_D3D *bmps_display = + (A5O_DISPLAY_D3D *)_al_get_bitmap_display(bmp); int bitmap_flags = al_get_bitmap_flags(bmp); - if ((bitmap_flags & ALLEGRO_MEMORY_BITMAP) || bmp->parent) { + if ((bitmap_flags & A5O_MEMORY_BITMAP) || bmp->parent) { continue; } d3d_create_textures(bmps_display, extra->texture_w, extra->texture_h, bitmap_flags, &extra->video_texture, /*&bmp->system_texture*/0, al_get_bitmap_format(bmp), 0); - if (!(bitmap_flags & ALLEGRO_NO_PRESERVE_TEXTURE)) { + if (!(bitmap_flags & A5O_NO_PRESERVE_TEXTURE)) { int block_width = al_get_pixel_block_width(al_get_bitmap_format(bmp)); int block_height = al_get_pixel_block_height(al_get_bitmap_format(bmp)); d3d_sync_bitmap_texture(bmp, @@ -664,10 +664,10 @@ void _al_d3d_refresh_texture_memory(ALLEGRO_DISPLAY *display) } } -static bool d3d_upload_bitmap(ALLEGRO_BITMAP *bitmap) +static bool d3d_upload_bitmap(A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); - ALLEGRO_SYSTEM *system = al_get_system_driver(); + A5O_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); + A5O_SYSTEM *system = al_get_system_driver(); int bitmap_format = al_get_bitmap_format(bitmap); int system_format = d3d_bmp->system_format; int block_width = al_get_pixel_block_width(bitmap_format); @@ -689,7 +689,7 @@ static bool d3d_upload_bitmap(ALLEGRO_BITMAP *bitmap) } else if (non_pow2) { // Must be square - int max = _ALLEGRO_MAX(w, h); + int max = _A5O_MAX(w, h); d3d_bmp->texture_w = max; d3d_bmp->texture_h = max; } @@ -727,13 +727,13 @@ static bool d3d_upload_bitmap(ALLEGRO_BITMAP *bitmap) } static void d3d_draw_bitmap_region( - ALLEGRO_BITMAP *src, - ALLEGRO_COLOR tint, + A5O_BITMAP *src, + A5O_COLOR tint, float sx, float sy, float sw, float sh, int flags) { - ALLEGRO_BITMAP *dest = al_get_target_bitmap(); - ALLEGRO_BITMAP_EXTRA_D3D *d3d_dest = get_extra(dest); - ALLEGRO_BITMAP_EXTRA_D3D *d3d_src = get_extra(src); + A5O_BITMAP *dest = al_get_target_bitmap(); + A5O_BITMAP_EXTRA_D3D *d3d_dest = get_extra(dest); + A5O_BITMAP_EXTRA_D3D *d3d_src = get_extra(src); ASSERT(src->parent == NULL); @@ -759,7 +759,7 @@ static void d3d_draw_bitmap_region( IDirect3DSurface9 *surface; D3DSURFACE_DESC desc; if (d3d_src->display->render_target->GetDesc(&desc) != D3D_OK) { - ALLEGRO_ERROR("d3d_draw_bitmap_region: GetDesc failed.\n"); + A5O_ERROR("d3d_draw_bitmap_region: GetDesc failed.\n"); return; } if (desc.MultiSampleType == D3DMULTISAMPLE_NONE) { @@ -777,7 +777,7 @@ static void d3d_draw_bitmap_region( &surface, NULL ) != D3D_OK) { - ALLEGRO_ERROR( + A5O_ERROR( "d3d_draw_bitmap_region: CreateRenderTarget failed.\n"); return; } @@ -792,12 +792,12 @@ static void d3d_draw_bitmap_region( &r, D3DTEXF_NONE ) != D3D_OK) { - ALLEGRO_ERROR("d3d_draw_bitmap_region: StretchRect failed.\n"); + A5O_ERROR("d3d_draw_bitmap_region: StretchRect failed.\n"); surface->Release(); return; } } - ALLEGRO_BITMAP *tmp_bmp = d3d_create_bitmap_from_surface( + A5O_BITMAP *tmp_bmp = d3d_create_bitmap_from_surface( surface, al_get_bitmap_format(src), al_get_bitmap_flags(src) @@ -820,11 +820,11 @@ static void d3d_draw_bitmap_region( sx, sy, sw, sh, flags); } -static ALLEGRO_LOCKED_REGION *d3d_lock_region(ALLEGRO_BITMAP *bitmap, +static A5O_LOCKED_REGION *d3d_lock_region(A5O_BITMAP *bitmap, int x, int y, int w, int h, int format, int flags) { - ALLEGRO_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); + A5O_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); int bitmap_format = al_get_bitmap_format(bitmap); int system_format = d3d_bmp->system_format; @@ -832,7 +832,7 @@ static ALLEGRO_LOCKED_REGION *d3d_lock_region(ALLEGRO_BITMAP *bitmap, return NULL; RECT rect; - DWORD Flags = flags & ALLEGRO_LOCK_READONLY ? D3DLOCK_READONLY : 0; + DWORD Flags = flags & A5O_LOCK_READONLY ? D3DLOCK_READONLY : 0; int f = _al_get_real_pixel_format(al_get_current_display(), format); if (f < 0) { return NULL; @@ -844,21 +844,21 @@ static ALLEGRO_LOCKED_REGION *d3d_lock_region(ALLEGRO_BITMAP *bitmap, rect.bottom = y + h; if (d3d_bmp->is_backbuffer) { - ALLEGRO_DISPLAY_D3D *d3d_disp = - (ALLEGRO_DISPLAY_D3D *)_al_get_bitmap_display(bitmap); + A5O_DISPLAY_D3D *d3d_disp = + (A5O_DISPLAY_D3D *)_al_get_bitmap_display(bitmap); if (d3d_disp->render_target->LockRect(&d3d_bmp->locked_rect, &rect, Flags) != D3D_OK) { - ALLEGRO_ERROR("LockRect failed in d3d_lock_region.\n"); + A5O_ERROR("LockRect failed in d3d_lock_region.\n"); return NULL; } } else { LPDIRECT3DTEXTURE9 texture; if (_al_pixel_format_is_compressed(bitmap_format)) { - if (!(flags & ALLEGRO_LOCK_WRITEONLY)) { + if (!(flags & A5O_LOCK_WRITEONLY)) { if(!convert_compressed( d3d_bmp->system_texture, d3d_bmp->video_texture, x, y, w, h)) { - ALLEGRO_ERROR("Could not decompress.\n"); + A5O_ERROR("Could not decompress.\n"); return NULL; } } @@ -869,7 +869,7 @@ static ALLEGRO_LOCKED_REGION *d3d_lock_region(ALLEGRO_BITMAP *bitmap, * Sync bitmap->memory with texture */ bitmap->locked = false; - if (!(flags & ALLEGRO_LOCK_WRITEONLY) && !_al_d3d_sync_bitmap(bitmap)) { + if (!(flags & A5O_LOCK_WRITEONLY) && !_al_d3d_sync_bitmap(bitmap)) { return NULL; } bitmap->locked = true; @@ -879,12 +879,12 @@ static ALLEGRO_LOCKED_REGION *d3d_lock_region(ALLEGRO_BITMAP *bitmap, texture = d3d_bmp->video_texture; } if (texture->LockRect(0, &d3d_bmp->locked_rect, &rect, Flags) != D3D_OK) { - ALLEGRO_ERROR("LockRect failed in d3d_lock_region.\n"); + A5O_ERROR("LockRect failed in d3d_lock_region.\n"); return NULL; } } - if (format == ALLEGRO_PIXEL_FORMAT_ANY || system_format == format || system_format == f) { + if (format == A5O_PIXEL_FORMAT_ANY || system_format == format || system_format == f) { bitmap->locked_region.data = d3d_bmp->locked_rect.pBits; bitmap->locked_region.format = system_format; bitmap->locked_region.pitch = d3d_bmp->locked_rect.Pitch; @@ -895,7 +895,7 @@ static ALLEGRO_LOCKED_REGION *d3d_lock_region(ALLEGRO_BITMAP *bitmap, bitmap->locked_region.data = al_malloc(bitmap->locked_region.pitch*h); bitmap->locked_region.format = f; bitmap->locked_region.pixel_size = al_get_pixel_size(f); - if (!(bitmap->lock_flags & ALLEGRO_LOCK_WRITEONLY)) { + if (!(bitmap->lock_flags & A5O_LOCK_WRITEONLY)) { _al_convert_bitmap_data( d3d_bmp->locked_rect.pBits, system_format, d3d_bmp->locked_rect.Pitch, bitmap->locked_region.data, f, bitmap->locked_region.pitch, @@ -906,13 +906,13 @@ static ALLEGRO_LOCKED_REGION *d3d_lock_region(ALLEGRO_BITMAP *bitmap, return &bitmap->locked_region; } -static void d3d_unlock_region(ALLEGRO_BITMAP *bitmap) +static void d3d_unlock_region(A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); + A5O_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); int system_format = d3d_bmp->system_format; if (bitmap->locked_region.format != 0 && bitmap->locked_region.format != system_format) { - if (!(bitmap->lock_flags & ALLEGRO_LOCK_READONLY)) { + if (!(bitmap->lock_flags & A5O_LOCK_READONLY)) { _al_convert_bitmap_data( bitmap->locked_region.data, bitmap->locked_region.format, bitmap->locked_region.pitch, d3d_bmp->locked_rect.pBits, system_format, d3d_bmp->locked_rect.Pitch, @@ -922,8 +922,8 @@ static void d3d_unlock_region(ALLEGRO_BITMAP *bitmap) } if (d3d_bmp->is_backbuffer) { - ALLEGRO_DISPLAY_D3D *d3d_disp = - (ALLEGRO_DISPLAY_D3D *)_al_get_bitmap_display(bitmap); + A5O_DISPLAY_D3D *d3d_disp = + (A5O_DISPLAY_D3D *)_al_get_bitmap_display(bitmap); d3d_disp->render_target->UnlockRect(); } else { @@ -935,7 +935,7 @@ static void d3d_unlock_region(ALLEGRO_BITMAP *bitmap) else texture = d3d_bmp->video_texture; texture->UnlockRect(0); - if (bitmap->lock_flags & ALLEGRO_LOCK_READONLY) + if (bitmap->lock_flags & A5O_LOCK_READONLY) return; if (compressed) { @@ -949,7 +949,7 @@ static void d3d_unlock_region(ALLEGRO_BITMAP *bitmap) _al_get_least_multiple(bitmap->lock_y + bitmap->lock_h, block_height) - yc; if(!convert_compressed( d3d_bmp->video_texture, d3d_bmp->system_texture, xc, yc, wc, hc)) { - ALLEGRO_ERROR("Could not compress.\n"); + A5O_ERROR("Could not compress.\n"); } } else { @@ -960,17 +960,17 @@ static void d3d_unlock_region(ALLEGRO_BITMAP *bitmap) } -static void d3d_update_clipping_rectangle(ALLEGRO_BITMAP *bitmap) +static void d3d_update_clipping_rectangle(A5O_BITMAP *bitmap) { _al_d3d_set_bitmap_clip(bitmap); } -static ALLEGRO_LOCKED_REGION *d3d_lock_compressed_region( - ALLEGRO_BITMAP *bitmap, int x, int y, int w, int h, +static A5O_LOCKED_REGION *d3d_lock_compressed_region( + A5O_BITMAP *bitmap, int x, int y, int w, int h, int flags) { - ALLEGRO_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); + A5O_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); int bitmap_format = al_get_bitmap_format(bitmap); if (d3d_bmp->display->device_lost) @@ -979,7 +979,7 @@ static ALLEGRO_LOCKED_REGION *d3d_lock_compressed_region( ASSERT(_al_pixel_format_is_compressed(bitmap_format)); RECT rect; - DWORD Flags = flags & ALLEGRO_LOCK_READONLY ? D3DLOCK_READONLY : 0; + DWORD Flags = flags & A5O_LOCK_READONLY ? D3DLOCK_READONLY : 0; rect.left = x; rect.right = x + w; @@ -987,7 +987,7 @@ static ALLEGRO_LOCKED_REGION *d3d_lock_compressed_region( rect.bottom = y + h; if (d3d_bmp->video_texture->LockRect(0, &d3d_bmp->locked_rect, &rect, Flags) != D3D_OK) { - ALLEGRO_ERROR("LockRect failed in d3d_lock_region.\n"); + A5O_ERROR("LockRect failed in d3d_lock_region.\n"); return NULL; } @@ -1000,9 +1000,9 @@ static ALLEGRO_LOCKED_REGION *d3d_lock_compressed_region( } -static void d3d_unlock_compressed_region(ALLEGRO_BITMAP *bitmap) +static void d3d_unlock_compressed_region(A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); + A5O_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); ASSERT(_al_pixel_format_is_compressed(al_get_bitmap_format(bitmap))); d3d_bmp->video_texture->UnlockRect(0); @@ -1010,12 +1010,12 @@ static void d3d_unlock_compressed_region(ALLEGRO_BITMAP *bitmap) /* Obtain a reference to this driver. */ -ALLEGRO_BITMAP_INTERFACE *_al_bitmap_d3d_driver(void) +A5O_BITMAP_INTERFACE *_al_bitmap_d3d_driver(void) { if (vt) return vt; - vt = (ALLEGRO_BITMAP_INTERFACE *)al_malloc(sizeof *vt); + vt = (A5O_BITMAP_INTERFACE *)al_malloc(sizeof *vt); memset(vt, 0, sizeof *vt); vt->draw_bitmap_region = d3d_draw_bitmap_region; diff --git a/src/win/d3d_d3dx9.cpp b/src/win/d3d_d3dx9.cpp index 76c7cd1549..cf36a88c83 100644 --- a/src/win/d3d_d3dx9.cpp +++ b/src/win/d3d_d3dx9.cpp @@ -19,14 +19,14 @@ #include "allegro5/internal/aintern_bitmap.h" #include "allegro5/internal/aintern_direct3d.h" -#ifdef ALLEGRO_CFG_D3DX9 +#ifdef A5O_CFG_D3DX9 #include #include #include "d3d.h" -ALLEGRO_DEBUG_CHANNEL("d3dx9") +A5O_DEBUG_CHANNEL("d3dx9") // DXSDK redistributable install d3dx9_xx.dll from version // 24 to 43. It's unlikely that any new version will come, @@ -40,8 +40,8 @@ ALLEGRO_DEBUG_CHANNEL("d3dx9") #define D3DX9_MAX_VERSION 43 static HMODULE _imp_d3dx9_module = 0; -_ALLEGRO_D3DXCREATEEFFECTPROC _al_imp_D3DXCreateEffect = NULL; -_ALLEGRO_D3DXLSFLSPROC _al_imp_D3DXLoadSurfaceFromSurface = NULL; +_A5O_D3DXCREATEEFFECTPROC _al_imp_D3DXCreateEffect = NULL; +_A5O_D3DXLSFLSPROC _al_imp_D3DXLoadSurfaceFromSurface = NULL; extern "C" void _al_unload_d3dx9_module() @@ -59,7 +59,7 @@ static bool _imp_load_d3dx9_module_version(int version) // appears. See force_d3dx9_version entry in config file. /* if (version < 24 || version > 43) { - ALLEGRO_ERROR("Error: Requested version (%d) of D3DX9 library is invalid.\n", version); + A5O_ERROR("Error: Requested version (%d) of D3DX9 library is invalid.\n", version); return false; } */ @@ -70,7 +70,7 @@ static bool _imp_load_d3dx9_module_version(int version) if (NULL == _imp_d3dx9_module) return false; - _al_imp_D3DXCreateEffect = (_ALLEGRO_D3DXCREATEEFFECTPROC)GetProcAddress(_imp_d3dx9_module, "D3DXCreateEffect"); + _al_imp_D3DXCreateEffect = (_A5O_D3DXCREATEEFFECTPROC)GetProcAddress(_imp_d3dx9_module, "D3DXCreateEffect"); if (NULL == _al_imp_D3DXCreateEffect) { FreeLibrary(_imp_d3dx9_module); _imp_d3dx9_module = NULL; @@ -78,14 +78,14 @@ static bool _imp_load_d3dx9_module_version(int version) } _al_imp_D3DXLoadSurfaceFromSurface = - (_ALLEGRO_D3DXLSFLSPROC)GetProcAddress(_imp_d3dx9_module, "D3DXLoadSurfaceFromSurface"); + (_A5O_D3DXLSFLSPROC)GetProcAddress(_imp_d3dx9_module, "D3DXLoadSurfaceFromSurface"); if (NULL == _al_imp_D3DXLoadSurfaceFromSurface) { FreeLibrary(_imp_d3dx9_module); _imp_d3dx9_module = NULL; return false; } - ALLEGRO_INFO("Module \"%s\" loaded.\n", module_name); + A5O_INFO("Module \"%s\" loaded.\n", module_name); return true; } @@ -106,7 +106,7 @@ bool _al_load_d3dx9_module() errno = 0; version = strtol(value, NULL, 10); if (errno) { - ALLEGRO_ERROR("Failed to override D3DX9 version. \"%s\" is not valid integer number.\n", value); + A5O_ERROR("Failed to override D3DX9 version. \"%s\" is not valid integer number.\n", value); return false; } else @@ -118,7 +118,7 @@ bool _al_load_d3dx9_module() if (_imp_load_d3dx9_module_version((int)version)) return true; - ALLEGRO_ERROR("Failed to load D3DX9 library. Library is not installed.\n"); + A5O_ERROR("Failed to load D3DX9 library. Library is not installed.\n"); return false; } diff --git a/src/win/d3d_disp.cpp b/src/win/d3d_disp.cpp index 67103555b3..c491b33c7e 100644 --- a/src/win/d3d_disp.cpp +++ b/src/win/d3d_disp.cpp @@ -30,7 +30,7 @@ #include "allegro5/internal/aintern_pixels.h" #include "allegro5/internal/aintern_system.h" #include "allegro5/internal/aintern_thread.h" -#include "allegro5/internal/aintern_tri_soft.h" // For ALLEGRO_VERTEX +#include "allegro5/internal/aintern_tri_soft.h" // For A5O_VERTEX #include "allegro5/internal/aintern_vector.h" #include "allegro5/internal/aintern_wclipboard.h" #include "allegro5/platform/aintwin.h" @@ -52,19 +52,19 @@ static BOOL is_windows_vista_or_greater() { return VerifyVersionInfo(&info, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, mask) != FALSE; } -static void d3d_set_target_bitmap(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap); -static void d3d_update_transformation(ALLEGRO_DISPLAY* disp, ALLEGRO_BITMAP *target); +static void d3d_set_target_bitmap(A5O_DISPLAY *display, A5O_BITMAP *bitmap); +static void d3d_update_transformation(A5O_DISPLAY* disp, A5O_BITMAP *target); static bool d3d_init_display(); // C++ needs to cast void pointers -#define get_extra(b) ((ALLEGRO_BITMAP_EXTRA_D3D *)\ +#define get_extra(b) ((A5O_BITMAP_EXTRA_D3D *)\ (b->parent ? b->parent->extra : b->extra)) static const char* _al_d3d_module_name = "d3d9.dll"; -ALLEGRO_DEBUG_CHANNEL("d3d") +A5O_DEBUG_CHANNEL("d3d") -static ALLEGRO_DISPLAY_INTERFACE *vt = 0; +static A5O_DISPLAY_INTERFACE *vt = 0; static HMODULE _al_d3d_module = 0; @@ -72,7 +72,7 @@ typedef LPDIRECT3D9 (WINAPI *DIRECT3DCREATE9PROC)(UINT); static DIRECT3DCREATE9PROC _al_d3d_create = (DIRECT3DCREATE9PROC)NULL; -#ifdef ALLEGRO_CFG_D3D9EX +#ifdef A5O_CFG_D3D9EX typedef HRESULT (WINAPI *DIRECT3DCREATE9EXPROC)(UINT, LPDIRECT3D9EX*); static DIRECT3DCREATE9EXPROC _al_d3d_create_ex = (DIRECT3DCREATE9EXPROC)NULL; @@ -92,8 +92,8 @@ static bool is_vista = false; static int num_faux_fullscreen_windows = 0; static bool already_fullscreen = false; /* real fullscreen */ -static ALLEGRO_MUTEX *present_mutex; -ALLEGRO_MUTEX *_al_d3d_lost_device_mutex; +static A5O_MUTEX *present_mutex; +A5O_MUTEX *_al_d3d_lost_device_mutex; #define FOURCC(c0, c1, c2, c3) ((int)(c0) | ((int)(c1) << 8) | ((int)(c2) << 16) | ((int)(c3) << 24)) @@ -102,7 +102,7 @@ ALLEGRO_MUTEX *_al_d3d_lost_device_mutex; * they're thread local. We get them in the calling thread first. */ struct D3D_DISPLAY_PARAMETERS { - ALLEGRO_DISPLAY_D3D *display; + A5O_DISPLAY_D3D *display; volatile bool init_failed; HANDLE AckEvent; int window_x, window_y; @@ -112,39 +112,39 @@ struct D3D_DISPLAY_PARAMETERS { static int allegro_formats[] = { - ALLEGRO_PIXEL_FORMAT_ANY, - ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA, - ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA, - ALLEGRO_PIXEL_FORMAT_ANY_15_NO_ALPHA, - ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA, - ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA, - ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA, - ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA, - ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA, - ALLEGRO_PIXEL_FORMAT_XRGB_8888, - ALLEGRO_PIXEL_FORMAT_ARGB_8888, - //ALLEGRO_PIXEL_FORMAT_ARGB_4444, this format seems not to be allowed - ALLEGRO_PIXEL_FORMAT_RGB_565, - //ALLEGRO_PIXEL_FORMAT_ARGB_1555, this format seems not to be allowed - ALLEGRO_PIXEL_FORMAT_ABGR_F32, - ALLEGRO_PIXEL_FORMAT_SINGLE_CHANNEL_8, - ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1, - ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3, - ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5, + A5O_PIXEL_FORMAT_ANY, + A5O_PIXEL_FORMAT_ANY_WITH_ALPHA, + A5O_PIXEL_FORMAT_ANY_NO_ALPHA, + A5O_PIXEL_FORMAT_ANY_15_NO_ALPHA, + A5O_PIXEL_FORMAT_ANY_16_WITH_ALPHA, + A5O_PIXEL_FORMAT_ANY_16_NO_ALPHA, + A5O_PIXEL_FORMAT_ANY_24_NO_ALPHA, + A5O_PIXEL_FORMAT_ANY_32_WITH_ALPHA, + A5O_PIXEL_FORMAT_ANY_32_NO_ALPHA, + A5O_PIXEL_FORMAT_XRGB_8888, + A5O_PIXEL_FORMAT_ARGB_8888, + //A5O_PIXEL_FORMAT_ARGB_4444, this format seems not to be allowed + A5O_PIXEL_FORMAT_RGB_565, + //A5O_PIXEL_FORMAT_ARGB_1555, this format seems not to be allowed + A5O_PIXEL_FORMAT_ABGR_F32, + A5O_PIXEL_FORMAT_SINGLE_CHANNEL_8, + A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1, + A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3, + A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5, -1 }; /* Mapping of Allegro formats to D3D formats */ static int d3d_formats[] = { - ALLEGRO_PIXEL_FORMAT_ANY, - ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA, - ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA, - ALLEGRO_PIXEL_FORMAT_ANY_15_NO_ALPHA, - ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA, - ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA, - ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA, - ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA, - ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA, + A5O_PIXEL_FORMAT_ANY, + A5O_PIXEL_FORMAT_ANY_WITH_ALPHA, + A5O_PIXEL_FORMAT_ANY_NO_ALPHA, + A5O_PIXEL_FORMAT_ANY_15_NO_ALPHA, + A5O_PIXEL_FORMAT_ANY_16_WITH_ALPHA, + A5O_PIXEL_FORMAT_ANY_16_NO_ALPHA, + A5O_PIXEL_FORMAT_ANY_24_NO_ALPHA, + A5O_PIXEL_FORMAT_ANY_32_WITH_ALPHA, + A5O_PIXEL_FORMAT_ANY_32_NO_ALPHA, D3DFMT_X8R8G8B8, D3DFMT_A8R8G8B8, //D3DFMT_A4R4G4B4, @@ -158,8 +158,8 @@ static int d3d_formats[] = { -1 }; -static void (*d3d_release_callback)(ALLEGRO_DISPLAY *display) = NULL; -static void (*d3d_restore_callback)(ALLEGRO_DISPLAY *display) = NULL; +static void (*d3d_release_callback)(A5O_DISPLAY *display) = NULL; +static void (*d3d_restore_callback)(A5O_DISPLAY *display) = NULL; #define ERR(e) case e: return #e; static char const *_al_d3d_error_string(HRESULT e) @@ -176,7 +176,7 @@ static char const *_al_d3d_error_string(HRESULT e) } #undef ERR -static D3DFORMAT d3d_get_depth_stencil_format(ALLEGRO_EXTRA_DISPLAY_SETTINGS *settings) +static D3DFORMAT d3d_get_depth_stencil_format(A5O_EXTRA_DISPLAY_SETTINGS *settings) { struct DEPTH_STENCIL_DESC { int d; @@ -197,19 +197,19 @@ static D3DFORMAT d3d_get_depth_stencil_format(ALLEGRO_EXTRA_DISPLAY_SETTINGS *se for (int i = 0; formats[i].d >= 0; i++) { - if (settings->settings[ALLEGRO_DEPTH_SIZE] == formats[i].d && - settings->settings[ALLEGRO_STENCIL_SIZE] == formats[i].s) + if (settings->settings[A5O_DEPTH_SIZE] == formats[i].d && + settings->settings[A5O_STENCIL_SIZE] == formats[i].s) return formats[i].format; } return (D3DFORMAT)0; } -static void d3d_call_callbacks(_AL_VECTOR *v, ALLEGRO_DISPLAY *display) +static void d3d_call_callbacks(_AL_VECTOR *v, A5O_DISPLAY *display) { int i; for (i = 0; i < (int)v->_size; i++) { - void (**callback)(ALLEGRO_DISPLAY *) = (void (**)(ALLEGRO_DISPLAY *))_al_vector_ref(v, i); + void (**callback)(A5O_DISPLAY *) = (void (**)(A5O_DISPLAY *))_al_vector_ref(v, i); (*callback)(display); } } @@ -217,7 +217,7 @@ static void d3d_call_callbacks(_AL_VECTOR *v, ALLEGRO_DISPLAY *display) /* Function: al_set_d3d_device_release_callback */ void al_set_d3d_device_release_callback( - void (*callback)(ALLEGRO_DISPLAY *display)) + void (*callback)(A5O_DISPLAY *display)) { d3d_release_callback = callback; } @@ -225,14 +225,14 @@ void al_set_d3d_device_release_callback( /* Function: al_set_d3d_device_restore_callback */ void al_set_d3d_device_restore_callback( - void (*callback)(ALLEGRO_DISPLAY *display)) + void (*callback)(A5O_DISPLAY *display)) { d3d_restore_callback = callback; } -bool _al_d3d_supports_separate_alpha_blend(ALLEGRO_DISPLAY *display) +bool _al_d3d_supports_separate_alpha_blend(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_D3D *d3d_disp = (ALLEGRO_DISPLAY_D3D *)display; + A5O_DISPLAY_D3D *d3d_disp = (A5O_DISPLAY_D3D *)display; return d3d_disp->supports_separate_alpha_blend; } @@ -275,7 +275,7 @@ static int d3d_get_max_texture_size(int adapter) } } - return _ALLEGRO_MIN(caps.MaxTextureWidth, caps.MaxTextureHeight); + return _A5O_MIN(caps.MaxTextureWidth, caps.MaxTextureHeight); } /* Function: al_have_d3d_non_square_texture_support @@ -346,7 +346,7 @@ void _al_d3d_get_nth_format(int i, int *allegro, D3DFORMAT *d3d) *d3d = (D3DFORMAT)d3d_formats[i]; } -static void d3d_reset_state(ALLEGRO_DISPLAY_D3D *disp) +static void d3d_reset_state(A5O_DISPLAY_D3D *disp) { if (disp->device_lost) return; @@ -367,7 +367,7 @@ static void d3d_reset_state(ALLEGRO_DISPLAY_D3D *disp) disp->device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); disp->device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); - _al_d3d_update_render_state((ALLEGRO_DISPLAY *)disp); + _al_d3d_update_render_state((A5O_DISPLAY *)disp); } static bool d3d_display_mode_matches(D3DDISPLAYMODE *dm, int w, int h, int format, int refresh_rate) @@ -414,18 +414,18 @@ static int d3d_get_default_refresh_rate(UINT adapter) } -static bool d3d_create_fullscreen_device(ALLEGRO_DISPLAY_D3D *d, +static bool d3d_create_fullscreen_device(A5O_DISPLAY_D3D *d, int format, int refresh_rate, int flags) { int ret; bool reset_all = false; - ALLEGRO_DISPLAY_WIN *win_display = &d->win_display; - ALLEGRO_DISPLAY *al_display = &win_display->display; + A5O_DISPLAY_WIN *win_display = &d->win_display; + A5O_DISPLAY *al_display = &win_display->display; (void)flags; if (!d3d_check_mode(al_display->w, al_display->h, format, refresh_rate, win_display->adapter)) { - ALLEGRO_ERROR("d3d_create_fullscreen_device: Mode not supported.\n"); + A5O_ERROR("d3d_create_fullscreen_device: Mode not supported.\n"); return 0; } @@ -477,7 +477,7 @@ static bool d3d_create_fullscreen_device(ALLEGRO_DISPLAY_D3D *d, reset_all = true; } -#ifdef ALLEGRO_CFG_D3D9EX +#ifdef A5O_CFG_D3D9EX if (is_vista) { D3DDISPLAYMODEEX mode; IDirect3D9Ex *d3d = (IDirect3D9Ex *)_al_d3d; @@ -506,19 +506,19 @@ static bool d3d_create_fullscreen_device(ALLEGRO_DISPLAY_D3D *d, &d3d_pp, &mode, (IDirect3DDevice9Ex **)(&d->device))) != D3D_OK) { switch (ret) { case D3DERR_INVALIDCALL: - ALLEGRO_ERROR("D3DERR_INVALIDCALL in create_device.\n"); + A5O_ERROR("D3DERR_INVALIDCALL in create_device.\n"); break; case D3DERR_NOTAVAILABLE: - ALLEGRO_ERROR("D3DERR_NOTAVAILABLE in create_device.\n"); + A5O_ERROR("D3DERR_NOTAVAILABLE in create_device.\n"); break; case D3DERR_OUTOFVIDEOMEMORY: - ALLEGRO_ERROR("D3DERR_OUTOFVIDEOMEMORY in create_device.\n"); + A5O_ERROR("D3DERR_OUTOFVIDEOMEMORY in create_device.\n"); break; case D3DERR_DEVICELOST: - ALLEGRO_ERROR("D3DERR_DEVICELOST in create_device.\n"); + A5O_ERROR("D3DERR_DEVICELOST in create_device.\n"); break; default: - ALLEGRO_ERROR("Direct3D Device creation failed.\n"); + A5O_ERROR("Direct3D Device creation failed.\n"); break; } return 0; @@ -547,19 +547,19 @@ static bool d3d_create_fullscreen_device(ALLEGRO_DISPLAY_D3D *d, &d3d_pp, &d->device)) != D3D_OK) { switch (ret) { case D3DERR_INVALIDCALL: - ALLEGRO_ERROR("D3DERR_INVALIDCALL in create_device.\n"); + A5O_ERROR("D3DERR_INVALIDCALL in create_device.\n"); break; case D3DERR_NOTAVAILABLE: - ALLEGRO_ERROR("D3DERR_NOTAVAILABLE in create_device.\n"); + A5O_ERROR("D3DERR_NOTAVAILABLE in create_device.\n"); break; case D3DERR_OUTOFVIDEOMEMORY: - ALLEGRO_ERROR("D3DERR_OUTOFVIDEOMEMORY in create_device.\n"); + A5O_ERROR("D3DERR_OUTOFVIDEOMEMORY in create_device.\n"); break; case D3DERR_DEVICELOST: - ALLEGRO_ERROR("D3DERR_DEVICELOST in create_device.\n"); + A5O_ERROR("D3DERR_DEVICELOST in create_device.\n"); break; default: - ALLEGRO_ERROR("Direct3D Device creation failed.\n"); + A5O_ERROR("Direct3D Device creation failed.\n"); break; } return 0; @@ -571,19 +571,19 @@ static bool d3d_create_fullscreen_device(ALLEGRO_DISPLAY_D3D *d, d->device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &d->render_target); - ALLEGRO_INFO("Fullscreen Direct3D device created.\n"); + A5O_INFO("Fullscreen Direct3D device created.\n"); d->device->BeginScene(); - ALLEGRO_SYSTEM *system = (ALLEGRO_SYSTEM *)al_get_system_driver(); + A5O_SYSTEM *system = (A5O_SYSTEM *)al_get_system_driver(); if (reset_all) { int i; for (i = 0; i < (int)system->displays._size; i++) { - ALLEGRO_DISPLAY_D3D **dptr = (ALLEGRO_DISPLAY_D3D **)_al_vector_ref(&system->displays, i); - ALLEGRO_DISPLAY_D3D *disp = *dptr; + A5O_DISPLAY_D3D **dptr = (A5O_DISPLAY_D3D **)_al_vector_ref(&system->displays, i); + A5O_DISPLAY_D3D *disp = *dptr; if (disp != d) { - if (disp != d && (disp->win_display.display.flags & ALLEGRO_FULLSCREEN)) { + if (disp != d && (disp->win_display.display.flags & A5O_FULLSCREEN)) { disp->do_reset = true; while (!disp->reset_done) { al_rest(0.001); @@ -597,10 +597,10 @@ static bool d3d_create_fullscreen_device(ALLEGRO_DISPLAY_D3D *d, return 1; } -static void d3d_destroy_device(ALLEGRO_DISPLAY_D3D *disp) +static void d3d_destroy_device(A5O_DISPLAY_D3D *disp) { while (disp->device->Release() != 0) { - ALLEGRO_WARN("d3d_destroy_device: ref count not 0\n"); + A5O_WARN("d3d_destroy_device: ref count not 0\n"); } disp->device = NULL; } @@ -619,24 +619,24 @@ static bool d3d_init_display() _al_d3d_module = _al_win_safe_load_library(_al_d3d_module_name); if (_al_d3d_module == NULL) { - ALLEGRO_ERROR("Failed to open '%s' library\n", _al_d3d_module_name); + A5O_ERROR("Failed to open '%s' library\n", _al_d3d_module_name); return false; } is_vista = is_windows_vista_or_greater(); -#ifdef ALLEGRO_CFG_D3D9EX +#ifdef A5O_CFG_D3D9EX if (is_vista) { _al_d3d_create_ex = (DIRECT3DCREATE9EXPROC)GetProcAddress(_al_d3d_module, "Direct3DCreate9Ex"); if (_al_d3d_create_ex != NULL) { if (_al_d3d_create_ex(D3D_SDK_VERSION, (LPDIRECT3D9EX *)&_al_d3d) != D3D_OK) { - ALLEGRO_ERROR("Direct3DCreate9Ex failed\n"); + A5O_ERROR("Direct3DCreate9Ex failed\n"); FreeLibrary(_al_d3d_module); return false; } } else { - ALLEGRO_INFO("Direct3DCreate9Ex not in %s\n", _al_d3d_module_name); + A5O_INFO("Direct3DCreate9Ex not in %s\n", _al_d3d_module_name); is_vista = false; } } @@ -647,13 +647,13 @@ static bool d3d_init_display() _al_d3d_create = (DIRECT3DCREATE9PROC)GetProcAddress(_al_d3d_module, "Direct3DCreate9"); if (_al_d3d_create != NULL) { if ((_al_d3d = _al_d3d_create(D3D9b_SDK_VERSION)) == NULL) { - ALLEGRO_ERROR("Direct3DCreate9 failed.\n"); + A5O_ERROR("Direct3DCreate9 failed.\n"); FreeLibrary(_al_d3d_module); return false; } } else { - ALLEGRO_ERROR("Direct3DCreate9 not in %s\n", _al_d3d_module_name); + A5O_ERROR("Direct3DCreate9 not in %s\n", _al_d3d_module_name); FreeLibrary(_al_d3d_module); return false; } @@ -676,12 +676,12 @@ static bool d3d_init_display() render_to_texture_supported = true; - ALLEGRO_INFO("Render-to-texture: %d\n", render_to_texture_supported); + A5O_INFO("Render-to-texture: %d\n", render_to_texture_supported); present_mutex = al_create_mutex(); _al_d3d_lost_device_mutex = al_create_mutex(); -#ifdef ALLEGRO_CFG_SHADER_HLSL +#ifdef A5O_CFG_SHADER_HLSL _al_d3d_init_shaders(); #endif @@ -689,20 +689,20 @@ static bool d3d_init_display() } -static ALLEGRO_DISPLAY_D3D *d3d_create_display_internals(ALLEGRO_DISPLAY_D3D *d3d_display, bool free_on_error); -static void d3d_destroy_display_internals(ALLEGRO_DISPLAY_D3D *display); +static A5O_DISPLAY_D3D *d3d_create_display_internals(A5O_DISPLAY_D3D *d3d_display, bool free_on_error); +static void d3d_destroy_display_internals(A5O_DISPLAY_D3D *display); -static void d3d_make_faux_fullscreen_stage_one(ALLEGRO_DISPLAY_D3D *d3d_display) +static void d3d_make_faux_fullscreen_stage_one(A5O_DISPLAY_D3D *d3d_display) { - ALLEGRO_SYSTEM *system = al_get_system_driver(); + A5O_SYSTEM *system = al_get_system_driver(); if (already_fullscreen || num_faux_fullscreen_windows) { int i; for (i = 0; i < (int)system->displays._size; i++) { - ALLEGRO_DISPLAY_D3D **dptr = (ALLEGRO_DISPLAY_D3D **)_al_vector_ref(&system->displays, i); - ALLEGRO_DISPLAY_D3D *disp = *dptr; - if (disp != d3d_display) {// && (disp->win_display.display.flags & ALLEGRO_FULLSCREEN)) { + A5O_DISPLAY_D3D **dptr = (A5O_DISPLAY_D3D **)_al_vector_ref(&system->displays, i); + A5O_DISPLAY_D3D *disp = *dptr; + if (disp != d3d_display) {// && (disp->win_display.display.flags & A5O_FULLSCREEN)) { d3d_destroy_display_internals(disp); disp->win_display.end_thread = false; disp->win_display.thread_ended = false; @@ -712,22 +712,22 @@ static void d3d_make_faux_fullscreen_stage_one(ALLEGRO_DISPLAY_D3D *d3d_display) } -static void d3d_make_faux_fullscreen_stage_two(ALLEGRO_DISPLAY_D3D *d3d_display) +static void d3d_make_faux_fullscreen_stage_two(A5O_DISPLAY_D3D *d3d_display) { - ALLEGRO_SYSTEM *system = al_get_system_driver(); + A5O_SYSTEM *system = al_get_system_driver(); if (already_fullscreen || num_faux_fullscreen_windows) { int i; already_fullscreen = false; for (i = 0; i < (int)system->displays._size; i++) { - ALLEGRO_DISPLAY_D3D **dptr = (ALLEGRO_DISPLAY_D3D **)_al_vector_ref(&system->displays, i); - ALLEGRO_DISPLAY_D3D *disp = *dptr; - if (disp != d3d_display) {// && (disp->win_display.display.flags & ALLEGRO_FULLSCREEN)) { - if (disp->win_display.display.flags & ALLEGRO_FULLSCREEN) + A5O_DISPLAY_D3D **dptr = (A5O_DISPLAY_D3D **)_al_vector_ref(&system->displays, i); + A5O_DISPLAY_D3D *disp = *dptr; + if (disp != d3d_display) {// && (disp->win_display.display.flags & A5O_FULLSCREEN)) { + if (disp->win_display.display.flags & A5O_FULLSCREEN) disp->faux_fullscreen = true; disp = d3d_create_display_internals(disp, true); if (!disp) { - ALLEGRO_ERROR("d3d_create_display_internals failed.\n"); + A5O_ERROR("d3d_create_display_internals failed.\n"); /* XXX we don't try to recover from this yet */ abort(); } @@ -738,12 +738,12 @@ static void d3d_make_faux_fullscreen_stage_two(ALLEGRO_DISPLAY_D3D *d3d_display) } } -static bool d3d_create_device(ALLEGRO_DISPLAY_D3D *d, +static bool d3d_create_device(A5O_DISPLAY_D3D *d, int format, int refresh_rate, int flags, bool convert_to_faux) { HRESULT hr; - ALLEGRO_DISPLAY_WIN *win_display = &d->win_display; - ALLEGRO_DISPLAY *al_display = &win_display->display; + A5O_DISPLAY_WIN *win_display = &d->win_display; + A5O_DISPLAY *al_display = &win_display->display; int adapter = win_display->adapter; (void)refresh_rate; @@ -755,7 +755,7 @@ static bool d3d_create_device(ALLEGRO_DISPLAY_D3D *d, * displays, basically screen-filling windows set out in front of * everything else. */ -#ifdef ALLEGRO_CFG_D3D9EX +#ifdef A5O_CFG_D3D9EX if (convert_to_faux) d3d_make_faux_fullscreen_stage_one(d); #else @@ -780,10 +780,10 @@ static bool d3d_create_device(ALLEGRO_DISPLAY_D3D *d, if (d->depth_stencil_format) { d3d_pp.EnableAutoDepthStencil = true; d3d_pp.AutoDepthStencilFormat = d->depth_stencil_format; - ALLEGRO_INFO("Chose depth stencil format %d\n", d->depth_stencil_format); + A5O_INFO("Chose depth stencil format %d\n", d->depth_stencil_format); } else { - ALLEGRO_INFO("Using no depth stencil buffer\n"); + A5O_INFO("Using no depth stencil buffer\n"); } if (d->samples) { @@ -812,23 +812,23 @@ static bool d3d_create_device(ALLEGRO_DISPLAY_D3D *d, D3DDEVTYPE_HAL, win_display->window, D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_FPU_PRESERVE|D3DCREATE_MULTITHREADED, &d3d_pp, (LPDIRECT3DDEVICE9 *)&d->device)) != D3D_OK) { - ALLEGRO_DEBUG("trying D3DCREATE_SOFTWARE_VERTEXPROCESSING\n"); + A5O_DEBUG("trying D3DCREATE_SOFTWARE_VERTEXPROCESSING\n"); if ((hr = _al_d3d->CreateDevice(adapter, D3DDEVTYPE_HAL, win_display->window, D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_FPU_PRESERVE|D3DCREATE_MULTITHREADED, &d3d_pp, (LPDIRECT3DDEVICE9 *)&d->device)) != D3D_OK) { - ALLEGRO_DEBUG("trying D3DDEVTYPE_REF\n"); + A5O_DEBUG("trying D3DDEVTYPE_REF\n"); if ((hr = _al_d3d->CreateDevice(adapter, D3DDEVTYPE_REF, win_display->window, D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_FPU_PRESERVE|D3DCREATE_MULTITHREADED, &d3d_pp, (LPDIRECT3DDEVICE9 *)&d->device)) != D3D_OK) { - ALLEGRO_DEBUG("trying D3DDEVTYPE_REF|D3DCREATE_SOFTWARE_VERTEXPROCESSING\n"); + A5O_DEBUG("trying D3DDEVTYPE_REF|D3DCREATE_SOFTWARE_VERTEXPROCESSING\n"); if ((hr = _al_d3d->CreateDevice(adapter, D3DDEVTYPE_REF, win_display->window, D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_FPU_PRESERVE|D3DCREATE_MULTITHREADED, &d3d_pp, (LPDIRECT3DDEVICE9 *)&d->device)) != D3D_OK) { - ALLEGRO_ERROR("CreateDevice failed: %s\n", _al_d3d_error_string(hr)); + A5O_ERROR("CreateDevice failed: %s\n", _al_d3d_error_string(hr)); return 0; } } @@ -837,23 +837,23 @@ static bool d3d_create_device(ALLEGRO_DISPLAY_D3D *d, if (d->device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &d->render_target) != D3D_OK) { //if (d->device->GetRenderTarget(0, &d->render_target) != D3D_OK) { - ALLEGRO_ERROR("d3d_create_device: GetBackBuffer failed.\n"); + A5O_ERROR("d3d_create_device: GetBackBuffer failed.\n"); return 0; } if (d->device->BeginScene() != D3D_OK) { - ALLEGRO_ERROR("BeginScene failed in create_device\n"); + A5O_ERROR("BeginScene failed in create_device\n"); } else { - ALLEGRO_DEBUG("BeginScene succeeded in create_device\n"); + A5O_DEBUG("BeginScene succeeded in create_device\n"); } -#ifdef ALLEGRO_CFG_D3D9EX +#ifdef A5O_CFG_D3D9EX if (convert_to_faux) d3d_make_faux_fullscreen_stage_two(d); #endif - ALLEGRO_DEBUG("Success\n"); + A5O_DEBUG("Success\n"); return 1; } @@ -861,37 +861,37 @@ static bool d3d_create_device(ALLEGRO_DISPLAY_D3D *d, /* When a display is destroyed, its bitmaps get converted * to memory bitmaps */ -static void d3d_release_bitmaps(ALLEGRO_DISPLAY *display) +static void d3d_release_bitmaps(A5O_DISPLAY *display) { while (display->bitmaps._size > 0) { - ALLEGRO_BITMAP **bptr = (ALLEGRO_BITMAP **)_al_vector_ref_back(&display->bitmaps); - ALLEGRO_BITMAP *b = *bptr; + A5O_BITMAP **bptr = (A5O_BITMAP **)_al_vector_ref_back(&display->bitmaps); + A5O_BITMAP *b = *bptr; _al_convert_to_memory_bitmap(b); } } -static void d3d_destroy_display_internals(ALLEGRO_DISPLAY_D3D *d3d_display) +static void d3d_destroy_display_internals(A5O_DISPLAY_D3D *d3d_display) { - ALLEGRO_DISPLAY *al_display = (ALLEGRO_DISPLAY *)d3d_display; - ALLEGRO_DISPLAY_WIN *win_display = &d3d_display->win_display; + A5O_DISPLAY *al_display = (A5O_DISPLAY *)d3d_display; + A5O_DISPLAY_WIN *win_display = &d3d_display->win_display; if (d3d_display->device) { -#ifdef ALLEGRO_CFG_SHADER_HLSL +#ifdef A5O_CFG_SHADER_HLSL _al_remove_display_invalidated_callback(al_display, _al_d3d_on_lost_shaders); _al_remove_display_validated_callback(al_display, _al_d3d_on_reset_shaders); #endif d3d_call_callbacks(&al_display->display_invalidated_callbacks, al_display); -#ifdef ALLEGRO_CFG_SHADER_HLSL +#ifdef A5O_CFG_SHADER_HLSL _al_add_display_invalidated_callback(al_display, _al_d3d_on_lost_shaders); _al_add_display_validated_callback(al_display, _al_d3d_on_reset_shaders); #endif d3d_display->device->EndScene(); } - d3d_release_bitmaps((ALLEGRO_DISPLAY *)d3d_display); + d3d_release_bitmaps((A5O_DISPLAY *)d3d_display); - ALLEGRO_DEBUG("waiting for display %p's thread to end\n", d3d_display); + A5O_DEBUG("waiting for display %p's thread to end\n", d3d_display); if (win_display->window) { SendMessage(win_display->window, _al_win_msg_suicide, 0, 0); while (!win_display->thread_ended) @@ -901,13 +901,13 @@ static void d3d_destroy_display_internals(ALLEGRO_DISPLAY_D3D *d3d_display) ASSERT(al_display->vt); } -static void d3d_destroy_display(ALLEGRO_DISPLAY *display) +static void d3d_destroy_display(A5O_DISPLAY *display) { - ALLEGRO_SYSTEM_WIN *system = (ALLEGRO_SYSTEM_WIN *)al_get_system_driver(); - ALLEGRO_DISPLAY_D3D *d3d_display = (ALLEGRO_DISPLAY_D3D *)display; - ALLEGRO_DISPLAY *old_disp = al_get_current_display(); + A5O_SYSTEM_WIN *system = (A5O_SYSTEM_WIN *)al_get_system_driver(); + A5O_DISPLAY_D3D *d3d_display = (A5O_DISPLAY_D3D *)display; + A5O_DISPLAY *old_disp = al_get_current_display(); - ALLEGRO_INFO("destroying display %p (current %p)\n", display, old_disp); + A5O_INFO("destroying display %p (current %p)\n", display, old_disp); if (old_disp != display) _al_set_current_display_only(display); @@ -935,7 +935,7 @@ static void d3d_destroy_display(ALLEGRO_DISPLAY *display) } _al_vector_free(&display->bitmaps); - _al_vector_free(&((ALLEGRO_DISPLAY_WIN*) display)->msg_callbacks); + _al_vector_free(&((A5O_DISPLAY_WIN*) display)->msg_callbacks); if (old_disp != display) _al_set_current_display_only(old_disp); @@ -944,9 +944,9 @@ static void d3d_destroy_display(ALLEGRO_DISPLAY *display) al_free(display); } -void _al_d3d_prepare_for_reset(ALLEGRO_DISPLAY_D3D *disp) +void _al_d3d_prepare_for_reset(A5O_DISPLAY_D3D *disp) { - ALLEGRO_DISPLAY *al_display = (ALLEGRO_DISPLAY *)disp; + A5O_DISPLAY *al_display = (A5O_DISPLAY *)disp; if (d3d_release_callback) { (*d3d_release_callback)(al_display); @@ -954,24 +954,24 @@ void _al_d3d_prepare_for_reset(ALLEGRO_DISPLAY_D3D *disp) d3d_call_callbacks(&al_display->display_invalidated_callbacks, al_display); - _al_d3d_release_default_pool_textures((ALLEGRO_DISPLAY *)disp); + _al_d3d_release_default_pool_textures((A5O_DISPLAY *)disp); while (disp->render_target && disp->render_target->Release() != 0) { - ALLEGRO_WARN("_al_d3d_prepare_for_reset: (bb) ref count not 0\n"); + A5O_WARN("_al_d3d_prepare_for_reset: (bb) ref count not 0\n"); } disp->render_target = NULL; get_extra(al_get_backbuffer(al_display))->render_target = NULL; } -static bool _al_d3d_reset_device(ALLEGRO_DISPLAY_D3D *d3d_display) +static bool _al_d3d_reset_device(A5O_DISPLAY_D3D *d3d_display) { - ALLEGRO_DISPLAY_WIN *win_display = &d3d_display->win_display; - ALLEGRO_DISPLAY *al_display = &win_display->display; + A5O_DISPLAY_WIN *win_display = &d3d_display->win_display; + A5O_DISPLAY *al_display = &win_display->display; al_lock_mutex(_al_d3d_lost_device_mutex); _al_d3d_prepare_for_reset(d3d_display); - if (al_display->flags & ALLEGRO_FULLSCREEN) { + if (al_display->flags & A5O_FULLSCREEN) { HRESULT hr; ZeroMemory(&d3d_pp, sizeof(d3d_pp)); @@ -1013,7 +1013,7 @@ static bool _al_d3d_reset_device(ALLEGRO_DISPLAY_D3D *d3d_display) else { d3d_pp.FullScreen_RefreshRateInHz = d3d_get_default_refresh_rate(win_display->adapter); } -#ifdef ALLEGRO_CFG_D3D9EX +#ifdef A5O_CFG_D3D9EX if (is_vista) { D3DDISPLAYMODEEX mode; IDirect3DDevice9Ex *dev = (IDirect3DDevice9Ex *)d3d_display->device; @@ -1033,20 +1033,20 @@ static bool _al_d3d_reset_device(ALLEGRO_DISPLAY_D3D *d3d_display) if (hr != D3D_OK) { switch (hr) { case D3DERR_INVALIDCALL: - ALLEGRO_ERROR("D3DERR_INVALIDCALL in reset.\n"); + A5O_ERROR("D3DERR_INVALIDCALL in reset.\n"); break; case D3DERR_NOTAVAILABLE: - ALLEGRO_ERROR("D3DERR_NOTAVAILABLE in reset.\n"); + A5O_ERROR("D3DERR_NOTAVAILABLE in reset.\n"); break; case D3DERR_OUTOFVIDEOMEMORY: - ALLEGRO_ERROR("D3DERR_OUTOFVIDEOMEMORY in reset.\n"); + A5O_ERROR("D3DERR_OUTOFVIDEOMEMORY in reset.\n"); break; case D3DERR_DEVICELOST: - ALLEGRO_ERROR("D3DERR_DEVICELOST in reset.\n"); + A5O_ERROR("D3DERR_DEVICELOST in reset.\n"); d3d_display->device_lost = true; break; default: - ALLEGRO_ERROR("Direct3D Device reset failed (unknown reason).\n"); + A5O_ERROR("Direct3D Device reset failed (unknown reason).\n"); break; } al_unlock_mutex(_al_d3d_lost_device_mutex); @@ -1094,20 +1094,20 @@ static bool _al_d3d_reset_device(ALLEGRO_DISPLAY_D3D *d3d_display) if (hr != D3D_OK) { switch (hr) { case D3DERR_INVALIDCALL: - ALLEGRO_ERROR("D3DERR_INVALIDCALL in reset.\n"); + A5O_ERROR("D3DERR_INVALIDCALL in reset.\n"); break; case D3DERR_NOTAVAILABLE: - ALLEGRO_ERROR("D3DERR_NOTAVAILABLE in reset.\n"); + A5O_ERROR("D3DERR_NOTAVAILABLE in reset.\n"); break; case D3DERR_OUTOFVIDEOMEMORY: - ALLEGRO_ERROR("D3DERR_OUTOFVIDEOMEMORY in reset.\n"); + A5O_ERROR("D3DERR_OUTOFVIDEOMEMORY in reset.\n"); break; case D3DERR_DEVICELOST: - ALLEGRO_ERROR("D3DERR_DEVICELOST in reset.\n"); + A5O_ERROR("D3DERR_DEVICELOST in reset.\n"); d3d_display->device_lost = true; break; default: - ALLEGRO_ERROR("Direct3D Device reset failed (unknown reason).\n"); + A5O_ERROR("Direct3D Device reset failed (unknown reason).\n"); break; } al_unlock_mutex(_al_d3d_lost_device_mutex); @@ -1125,7 +1125,7 @@ static bool _al_d3d_reset_device(ALLEGRO_DISPLAY_D3D *d3d_display) /* Restore the target bitmap. */ if (d3d_display->target_bitmap) { - ALLEGRO_DISPLAY *display = (ALLEGRO_DISPLAY*)d3d_display; + A5O_DISPLAY *display = (A5O_DISPLAY*)d3d_display; d3d_set_target_bitmap(display, d3d_display->target_bitmap); d3d_update_transformation(display, d3d_display->target_bitmap); } @@ -1139,13 +1139,13 @@ static int d3d_choose_display_format(int fake) { /* Pick an appropriate format if the user is vague */ switch (fake) { - case ALLEGRO_PIXEL_FORMAT_ANY: - case ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA: - case ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA: - fake = ALLEGRO_PIXEL_FORMAT_XRGB_8888; + case A5O_PIXEL_FORMAT_ANY: + case A5O_PIXEL_FORMAT_ANY_NO_ALPHA: + case A5O_PIXEL_FORMAT_ANY_32_NO_ALPHA: + fake = A5O_PIXEL_FORMAT_XRGB_8888; break; - case ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA: - fake = ALLEGRO_PIXEL_FORMAT_RGB_565; + case A5O_PIXEL_FORMAT_ANY_16_NO_ALPHA: + fake = A5O_PIXEL_FORMAT_RGB_565; break; default: break; @@ -1176,14 +1176,14 @@ static BOOL IsTextureFormatOk(D3DFORMAT TextureFormat, D3DFORMAT AdapterFormat) } /* Same as above, but using Allegro's formats */ -static bool is_texture_format_ok(ALLEGRO_DISPLAY *display, int texture_format) +static bool is_texture_format_ok(A5O_DISPLAY *display, int texture_format) { - ALLEGRO_DISPLAY_D3D *d3d_display = (ALLEGRO_DISPLAY_D3D*)display; + A5O_DISPLAY_D3D *d3d_display = (A5O_DISPLAY_D3D*)display; return IsTextureFormatOk((D3DFORMAT)_al_pixel_format_to_d3d(texture_format), (D3DFORMAT)_al_pixel_format_to_d3d(d3d_display->format)); } -static int real_choose_bitmap_format(ALLEGRO_DISPLAY_D3D *d3d_display, +static int real_choose_bitmap_format(A5O_DISPLAY_D3D *d3d_display, int bits, bool alpha) { int i; @@ -1194,61 +1194,61 @@ static int real_choose_bitmap_format(ALLEGRO_DISPLAY_D3D *d3d_display, D3DFORMAT adapter_format; int adapter_format_allegro; if (!_al_pixel_format_is_real(aformat)) { - ALLEGRO_DEBUG("Fake format\n"); + A5O_DEBUG("Fake format\n"); continue; } if (bits && al_get_pixel_format_bits(aformat) != bits) { - ALLEGRO_DEBUG("#Bits don't match\n"); + A5O_DEBUG("#Bits don't match\n"); continue; } if (alpha && !_al_pixel_format_has_alpha(aformat)) { - ALLEGRO_DEBUG("Alpha doesn't match\n"); + A5O_DEBUG("Alpha doesn't match\n"); continue; } dformat = (D3DFORMAT)d3d_formats[i]; adapter_format_allegro = d3d_display->format; if (!_al_pixel_format_is_real(adapter_format_allegro)) adapter_format_allegro = d3d_choose_display_format(adapter_format_allegro); - ALLEGRO_DEBUG("Adapter format is %d\n", adapter_format_allegro); + A5O_DEBUG("Adapter format is %d\n", adapter_format_allegro); adapter_format = (D3DFORMAT)_al_pixel_format_to_d3d(adapter_format_allegro); if (IsTextureFormatOk(dformat, adapter_format)) { - ALLEGRO_DEBUG("Found a format\n"); + A5O_DEBUG("Found a format\n"); return aformat; } - ALLEGRO_DEBUG("Texture format not OK\n"); + A5O_DEBUG("Texture format not OK\n"); } - ALLEGRO_WARN("Failed to find format\n"); + A5O_WARN("Failed to find format\n"); return -1; } -static int d3d_choose_bitmap_format(ALLEGRO_DISPLAY_D3D *d3d_display, int fake) +static int d3d_choose_bitmap_format(A5O_DISPLAY_D3D *d3d_display, int fake) { switch (fake) { - case ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA: + case A5O_PIXEL_FORMAT_ANY_NO_ALPHA: fake = real_choose_bitmap_format(d3d_display, 0, false); break; - case ALLEGRO_PIXEL_FORMAT_ANY: - case ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA: + case A5O_PIXEL_FORMAT_ANY: + case A5O_PIXEL_FORMAT_ANY_WITH_ALPHA: fake = real_choose_bitmap_format(d3d_display, 0, true); break; - case ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA: + case A5O_PIXEL_FORMAT_ANY_32_NO_ALPHA: fake = real_choose_bitmap_format(d3d_display, 32, false); break; - case ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA: + case A5O_PIXEL_FORMAT_ANY_32_WITH_ALPHA: fake = real_choose_bitmap_format(d3d_display, 32, true); break; - case ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA: + case A5O_PIXEL_FORMAT_ANY_24_NO_ALPHA: fake = real_choose_bitmap_format(d3d_display, 24, false); break; - case ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA: + case A5O_PIXEL_FORMAT_ANY_16_NO_ALPHA: fake = real_choose_bitmap_format(d3d_display, 16, false); break; - case ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA: + case A5O_PIXEL_FORMAT_ANY_16_WITH_ALPHA: fake = real_choose_bitmap_format(d3d_display, 16, true); break; - case ALLEGRO_PIXEL_FORMAT_ANY_15_NO_ALPHA: + case A5O_PIXEL_FORMAT_ANY_15_NO_ALPHA: fake = real_choose_bitmap_format(d3d_display, 15, false); break; default: @@ -1259,9 +1259,9 @@ static int d3d_choose_bitmap_format(ALLEGRO_DISPLAY_D3D *d3d_display, int fake) } struct CREATE_WINDOW_INFO { - ALLEGRO_DISPLAY *display; + A5O_DISPLAY *display; DISPLAY_DEVICE dd; - ALLEGRO_MONITOR_INFO mi; + A5O_MONITOR_INFO mi; int w; int h; int refresh_rate; @@ -1272,7 +1272,7 @@ struct CREATE_WINDOW_INFO { static void d3d_create_window_proc(CREATE_WINDOW_INFO *info) { - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *)info->display; + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *)info->display; win_display->window = _al_win_create_window( info->display, @@ -1285,7 +1285,7 @@ static void d3d_create_window_proc(CREATE_WINDOW_INFO *info) static void *d3d_create_faux_fullscreen_window_proc(void *arg) { CREATE_WINDOW_INFO *info = (CREATE_WINDOW_INFO *)arg; - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *)info->display; + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *)info->display; win_display->window = _al_win_create_faux_fullscreen_window( @@ -1307,9 +1307,9 @@ static void *d3d_create_faux_fullscreen_window_proc(void *arg) */ static void *d3d_display_thread_proc(void *arg) { - ALLEGRO_DISPLAY_D3D *d3d_display; - ALLEGRO_DISPLAY_WIN *win_display; - ALLEGRO_DISPLAY *al_display; + A5O_DISPLAY_D3D *d3d_display; + A5O_DISPLAY_WIN *win_display; + A5O_DISPLAY *al_display; D3D_DISPLAY_PARAMETERS *params = (D3D_DISPLAY_PARAMETERS *)arg; int new_format; bool convert_to_faux; @@ -1323,7 +1323,7 @@ static void *d3d_display_thread_proc(void *arg) win_display = &d3d_display->win_display; al_display = &win_display->display; - if (al_display->flags & ALLEGRO_FULLSCREEN) { + if (al_display->flags & A5O_FULLSCREEN) { convert_to_faux = true; } else { @@ -1347,10 +1347,10 @@ static void *d3d_display_thread_proc(void *arg) return NULL; } new_format = f; - _al_set_color_components(new_format, &al_display->extra_settings, ALLEGRO_REQUIRE); + _al_set_color_components(new_format, &al_display->extra_settings, A5O_REQUIRE); } - ALLEGRO_INFO("Chose a display format: %d\n", new_format); + A5O_INFO("Chose a display format: %d\n", new_format); d3d_display->format = new_format; if (d3d_display->faux_fullscreen) { @@ -1379,7 +1379,7 @@ static void *d3d_display_thread_proc(void *arg) } if (!found) { - ALLEGRO_ERROR("d3d_display_thread_proc: Error setting faux fullscreen mode.\n"); + A5O_ERROR("d3d_display_thread_proc: Error setting faux fullscreen mode.\n"); num_faux_fullscreen_windows--; d3d_destroy_display(al_display); params->init_failed = true; @@ -1394,7 +1394,7 @@ static void *d3d_display_thread_proc(void *arg) } d3d_display->device_name = (TCHAR *)al_malloc(sizeof(TCHAR)*32); strcpy((char*)d3d_display->device_name, (char*)info->dd.DeviceName); - ALLEGRO_DEBUG("going to call _al_win_create_faux_fullscreen_window\n"); + A5O_DEBUG("going to call _al_win_create_faux_fullscreen_window\n"); info->display = al_display; info->w = al_display->w; @@ -1405,21 +1405,21 @@ static void *d3d_display_thread_proc(void *arg) d3d_create_faux_fullscreen_window_proc(info); if (!win_display->window) { - ALLEGRO_DEBUG("Failed to create window (faux)fullscreen.\n"); + A5O_DEBUG("Failed to create window (faux)fullscreen.\n"); d3d_destroy_display(al_display); params->init_failed = true; SetEvent(params->AckEvent); return NULL; } - ALLEGRO_DEBUG("Called _al_win_create_faux_fullscreen_window.\n"); + A5O_DEBUG("Called _al_win_create_faux_fullscreen_window.\n"); d3d_make_faux_fullscreen_stage_two(d3d_display); convert_to_faux = false; } else { - ALLEGRO_INFO("Normal window.\n"); + A5O_INFO("Normal window.\n"); info->display = al_display; info->w = al_display->w; @@ -1430,14 +1430,14 @@ static void *d3d_display_thread_proc(void *arg) } if (!win_display->window) { - ALLEGRO_DEBUG("Failed to create regular window.\n"); + A5O_DEBUG("Failed to create regular window.\n"); d3d_destroy_display(al_display); params->init_failed = true; SetEvent(params->AckEvent); return NULL; } - if (!(al_display->flags & ALLEGRO_FULLSCREEN) || d3d_display->faux_fullscreen) { + if (!(al_display->flags & A5O_FULLSCREEN) || d3d_display->faux_fullscreen) { if (!d3d_create_device(d3d_display, _al_deduce_color_format(&al_display->extra_settings), al_display->refresh_rate, al_display->flags, convert_to_faux)) { d3d_destroy_display(al_display); @@ -1447,7 +1447,7 @@ static void *d3d_display_thread_proc(void *arg) } } else { - ALLEGRO_DEBUG("Creating real fullscreen device\n"); + A5O_DEBUG("Creating real fullscreen device\n"); if (!d3d_create_fullscreen_device(d3d_display, _al_deduce_color_format(&al_display->extra_settings), al_display->refresh_rate, al_display->flags)) { d3d_destroy_display(al_display); @@ -1455,7 +1455,7 @@ static void *d3d_display_thread_proc(void *arg) SetEvent(params->AckEvent); return NULL; } - ALLEGRO_INFO("Real fullscreen device created\n"); + A5O_INFO("Real fullscreen device created\n"); } al_display->backbuffer_format = _al_deduce_color_format(&al_display->extra_settings); @@ -1492,17 +1492,17 @@ static void *d3d_display_thread_proc(void *arg) else if (hr == D3DERR_DEVICELOST) { /* device remains lost */ if (!lost_event_generated) { - ALLEGRO_DEBUG("D3DERR_DEVICELOST: d3d_display=%p\n", d3d_display); + A5O_DEBUG("D3DERR_DEVICELOST: d3d_display=%p\n", d3d_display); lost_event_generated = true; if (d3d_display->suppress_lost_events) { - ALLEGRO_DEBUG("DISPLAY_LOST event suppressed\n"); + A5O_DEBUG("DISPLAY_LOST event suppressed\n"); } else { _al_event_source_lock(&al_display->es); if (_al_event_source_needs_to_generate_event(&al_display->es)) { - ALLEGRO_EVENT event; + A5O_EVENT event; memset(&event, 0, sizeof(event)); - event.display.type = ALLEGRO_EVENT_DISPLAY_LOST; + event.display.type = A5O_EVENT_DISPLAY_LOST; event.display.timestamp = al_get_time(); _al_event_source_emit_event(&al_display->es, &event); } @@ -1517,9 +1517,9 @@ static void *d3d_display_thread_proc(void *arg) d3d_reset_state(d3d_display); _al_event_source_lock(&al_display->es); if (_al_event_source_needs_to_generate_event(&al_display->es)) { - ALLEGRO_EVENT event; + A5O_EVENT event; memset(&event, 0, sizeof(event)); - event.display.type = ALLEGRO_EVENT_DISPLAY_FOUND; + event.display.type = A5O_EVENT_DISPLAY_FOUND; event.display.timestamp = al_get_time(); _al_event_source_emit_event(&al_display->es, &event); } @@ -1554,24 +1554,24 @@ static void *d3d_display_thread_proc(void *arg) al_free(info); - ALLEGRO_INFO("d3d display thread exits\n"); + A5O_INFO("d3d display thread exits\n"); return NULL; } -static ALLEGRO_DISPLAY_D3D *d3d_create_display_helper(int w, int h) +static A5O_DISPLAY_D3D *d3d_create_display_helper(int w, int h) { - ALLEGRO_SYSTEM_WIN *system = (ALLEGRO_SYSTEM_WIN *)al_get_system_driver(); - ALLEGRO_DISPLAY_D3D *d3d_display = (ALLEGRO_DISPLAY_D3D *)al_malloc(sizeof(ALLEGRO_DISPLAY_D3D)); - ALLEGRO_DISPLAY_WIN *win_display = &d3d_display->win_display; - ALLEGRO_DISPLAY *al_display = &win_display->display; + A5O_SYSTEM_WIN *system = (A5O_SYSTEM_WIN *)al_get_system_driver(); + A5O_DISPLAY_D3D *d3d_display = (A5O_DISPLAY_D3D *)al_malloc(sizeof(A5O_DISPLAY_D3D)); + A5O_DISPLAY_WIN *win_display = &d3d_display->win_display; + A5O_DISPLAY *al_display = &win_display->display; memset(d3d_display, 0, sizeof *d3d_display); win_display->adapter = _al_win_determine_adapter(); - /* w/h may be reset below if ALLEGRO_FULLSCREEN_WINDOW is set */ + /* w/h may be reset below if A5O_FULLSCREEN_WINDOW is set */ al_display->w = w; al_display->h = h; al_display->refresh_rate = al_get_new_display_refresh_rate(); @@ -1579,11 +1579,11 @@ static ALLEGRO_DISPLAY_D3D *d3d_create_display_helper(int w, int h) al_display->vt = vt; ASSERT(al_display->vt); -#ifdef ALLEGRO_CFG_D3D9EX +#ifdef A5O_CFG_D3D9EX if (!is_vista) #endif { - if (al_display->flags & ALLEGRO_FULLSCREEN) { + if (al_display->flags & A5O_FULLSCREEN) { if (already_fullscreen || system->system.displays._size != 0) { d3d_display->faux_fullscreen = true; } @@ -1593,15 +1593,15 @@ static ALLEGRO_DISPLAY_D3D *d3d_create_display_helper(int w, int h) } } } -#ifdef ALLEGRO_CFG_D3D9EX +#ifdef A5O_CFG_D3D9EX else { d3d_display->faux_fullscreen = false; } #endif - if (!(al_display->flags & ALLEGRO_FULLSCREEN)) { - if (al_display->flags & ALLEGRO_FULLSCREEN_WINDOW) { - ALLEGRO_MONITOR_INFO mi; + if (!(al_display->flags & A5O_FULLSCREEN)) { + if (al_display->flags & A5O_FULLSCREEN_WINDOW) { + A5O_MONITOR_INFO mi; al_get_monitor_info(win_display->adapter, &mi); al_display->w = mi.x2 - mi.x1; al_display->h = mi.y2 - mi.y1; @@ -1620,13 +1620,13 @@ static ALLEGRO_DISPLAY_D3D *d3d_create_display_helper(int w, int h) /* This function may return the original d3d_display argument, * or a new one, or NULL on error. */ -static ALLEGRO_DISPLAY_D3D *d3d_create_display_internals( - ALLEGRO_DISPLAY_D3D *d3d_display, bool free_on_error) +static A5O_DISPLAY_D3D *d3d_create_display_internals( + A5O_DISPLAY_D3D *d3d_display, bool free_on_error) { D3D_DISPLAY_PARAMETERS params; - ALLEGRO_DISPLAY_WIN *win_display = &d3d_display->win_display; - ALLEGRO_DISPLAY *al_display = &win_display->display; - ALLEGRO_EXTRA_DISPLAY_SETTINGS *ref = _al_get_new_display_settings(); + A5O_DISPLAY_WIN *win_display = &d3d_display->win_display; + A5O_DISPLAY *al_display = &win_display->display; + A5O_EXTRA_DISPLAY_SETTINGS *ref = _al_get_new_display_settings(); int num_modes; int i; int window_x, window_y; @@ -1650,10 +1650,10 @@ static ALLEGRO_DISPLAY_D3D *d3d_create_display_internals( _al_d3d_score_display_settings(ref); /* Checking each mode is slow, so do a resolution check first */ - if (al_display->flags & ALLEGRO_FULLSCREEN) { + if (al_display->flags & A5O_FULLSCREEN) { num_modes = al_get_num_display_modes(); while (num_modes >= 0) { - ALLEGRO_DISPLAY_MODE mode; + A5O_DISPLAY_MODE mode; al_get_display_mode(num_modes, &mode); if (mode.width == al_display->w && mode.height == al_display->h) { break; @@ -1672,17 +1672,17 @@ static ALLEGRO_DISPLAY_D3D *d3d_create_display_internals( } } - ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds = NULL; + A5O_EXTRA_DISPLAY_SETTINGS *eds = NULL; for (i = 0; (eds = _al_d3d_get_display_settings(i)); i++) { - ALLEGRO_DEBUG("Trying format %d.\n", eds->index); + A5O_DEBUG("Trying format %d.\n", eds->index); d3d_display->depth_stencil_format = d3d_get_depth_stencil_format(eds); - if (eds->settings[ALLEGRO_SAMPLES] > 0) - d3d_display->samples = eds->settings[ALLEGRO_SAMPLES] - 1; + if (eds->settings[A5O_SAMPLES] > 0) + d3d_display->samples = eds->settings[A5O_SAMPLES] - 1; else d3d_display->samples = 0; - d3d_display->single_buffer = eds->settings[ALLEGRO_SINGLE_BUFFER] ? true : false; - d3d_display->vsync = eds->settings[ALLEGRO_VSYNC] == 1; + d3d_display->single_buffer = eds->settings[A5O_SINGLE_BUFFER] ? true : false; + d3d_display->vsync = eds->settings[A5O_VSYNC] == 1; memcpy(&al_display->extra_settings, eds, sizeof al_display->extra_settings); @@ -1700,7 +1700,7 @@ static ALLEGRO_DISPLAY_D3D *d3d_create_display_internals( #else WaitForSingleObject(params.AckEvent, 10*1000); #endif - ALLEGRO_DEBUG("Resumed after wait.\n"); + A5O_DEBUG("Resumed after wait.\n"); CloseHandle(params.AckEvent); @@ -1708,7 +1708,7 @@ static ALLEGRO_DISPLAY_D3D *d3d_create_display_internals( break; } - ALLEGRO_INFO("Format %d failed.\n", i); + A5O_INFO("Format %d failed.\n", i); // Display has been destroyed in d3d_display_thread_proc, create empty template again d3d_display = d3d_create_display_helper(pre_destroy_w, pre_destroy_h); @@ -1716,9 +1716,9 @@ static ALLEGRO_DISPLAY_D3D *d3d_create_display_internals( al_display = &win_display->display; params.display = d3d_display; - ALLEGRO_DEBUG("d3d_display = %p\n", d3d_display); - ALLEGRO_DEBUG("win_display = %p\n", win_display); - ALLEGRO_DEBUG("al_display = %p\n", al_display); + A5O_DEBUG("d3d_display = %p\n", d3d_display); + A5O_DEBUG("win_display = %p\n", win_display); + A5O_DEBUG("al_display = %p\n", al_display); ASSERT(al_display->vt); } @@ -1726,14 +1726,14 @@ static ALLEGRO_DISPLAY_D3D *d3d_create_display_internals( _al_d3d_resort_display_settings(); if (!eds) { - ALLEGRO_WARN("All %d formats failed.\n", i); + A5O_WARN("All %d formats failed.\n", i); if (free_on_error) { al_free(d3d_display); } return NULL; } - ALLEGRO_INFO("Format %d succeeded.\n", eds->index); + A5O_INFO("Format %d succeeded.\n", eds->index); d3d_reset_state(d3d_display); @@ -1743,7 +1743,7 @@ static ALLEGRO_DISPLAY_D3D *d3d_create_display_internals( d3d_display->backbuffer_bmp._format = _al_deduce_color_format(&al_display->extra_settings); d3d_display->backbuffer_bmp._memory_format = d3d_display->backbuffer_bmp._format; d3d_display->backbuffer_bmp_extra.system_format = d3d_display->backbuffer_bmp._format; - d3d_display->backbuffer_bmp._flags = ALLEGRO_VIDEO_BITMAP; + d3d_display->backbuffer_bmp._flags = A5O_VIDEO_BITMAP; d3d_display->backbuffer_bmp.w = al_display->w; d3d_display->backbuffer_bmp.h = al_display->h; d3d_display->backbuffer_bmp_extra.texture_w = al_display->w; @@ -1752,7 +1752,7 @@ static ALLEGRO_DISPLAY_D3D *d3d_create_display_internals( d3d_display->backbuffer_bmp.ct = 0; d3d_display->backbuffer_bmp.cr_excl = al_display->w; d3d_display->backbuffer_bmp.cb_excl = al_display->h; - d3d_display->backbuffer_bmp.vt = (ALLEGRO_BITMAP_INTERFACE *)_al_bitmap_d3d_driver(); + d3d_display->backbuffer_bmp.vt = (A5O_BITMAP_INTERFACE *)_al_bitmap_d3d_driver(); d3d_display->backbuffer_bmp_extra.display = d3d_display; d3d_display->target_bitmap = NULL; al_identity_transform(&d3d_display->backbuffer_bmp.transform); @@ -1764,37 +1764,37 @@ static ALLEGRO_DISPLAY_D3D *d3d_create_display_internals( d3d_display->device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); d3d_display->device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); - ALLEGRO_DEBUG("Returning d3d_display: %p\n", d3d_display); + A5O_DEBUG("Returning d3d_display: %p\n", d3d_display); return d3d_display; } -static ALLEGRO_DISPLAY *d3d_create_display_locked(int w, int h) +static A5O_DISPLAY *d3d_create_display_locked(int w, int h) { - ALLEGRO_SYSTEM_WIN *system = (ALLEGRO_SYSTEM_WIN *)al_get_system_driver(); - ALLEGRO_DISPLAY_D3D *d3d_display = d3d_create_display_helper(w, h); - ALLEGRO_DISPLAY_WIN *win_display = &d3d_display->win_display; - ALLEGRO_DISPLAY *al_display = &win_display->display; - ALLEGRO_DISPLAY_D3D **add; + A5O_SYSTEM_WIN *system = (A5O_SYSTEM_WIN *)al_get_system_driver(); + A5O_DISPLAY_D3D *d3d_display = d3d_create_display_helper(w, h); + A5O_DISPLAY_WIN *win_display = &d3d_display->win_display; + A5O_DISPLAY *al_display = &win_display->display; + A5O_DISPLAY_D3D **add; D3DCAPS9 caps; - ALLEGRO_INFO("faux_fullscreen=%d\n", d3d_display->faux_fullscreen); - ALLEGRO_DEBUG("al_display=%p\n", al_display); - ALLEGRO_DEBUG("al_display->vt=%p\n", al_display->vt); + A5O_INFO("faux_fullscreen=%d\n", d3d_display->faux_fullscreen); + A5O_DEBUG("al_display=%p\n", al_display); + A5O_DEBUG("al_display->vt=%p\n", al_display->vt); ASSERT(al_display->vt); d3d_display = d3d_create_display_internals(d3d_display, true); if (!d3d_display) { - ALLEGRO_ERROR("d3d_create_display failed.\n"); + A5O_ERROR("d3d_create_display failed.\n"); return NULL; } win_display = &d3d_display->win_display; al_display = &win_display->display; - ALLEGRO_DEBUG("al_display=%p\n", al_display); - ALLEGRO_DEBUG("al_display->vt=%p\n", al_display->vt); + A5O_DEBUG("al_display=%p\n", al_display); + A5O_DEBUG("al_display->vt=%p\n", al_display->vt); ASSERT(al_display->vt); /* Add ourself to the list of displays. */ - add = (ALLEGRO_DISPLAY_D3D **)_al_vector_alloc_back(&system->system.displays); + add = (A5O_DISPLAY_D3D **)_al_vector_alloc_back(&system->system.displays); *add = d3d_display; /* Each display is an event source. */ @@ -1803,14 +1803,14 @@ static ALLEGRO_DISPLAY *d3d_create_display_locked(int w, int h) #if 0 /* Setup the mouse */ - if (al_display->flags & ALLEGRO_FULLSCREEN && al_is_mouse_installed()) { + if (al_display->flags & A5O_FULLSCREEN && al_is_mouse_installed()) { RAWINPUTDEVICE rid[1]; rid[0].usUsagePage = 0x01; rid[0].usUsage = 0x02; rid[0].dwFlags = RIDEV_NOLEGACY; rid[0].hwndTarget = 0; if (RegisterRawInputDevices(rid, 1, sizeof(rid[0])) == FALSE) { - ALLEGRO_WARN("Failed to init mouse.\n"); + A5O_WARN("Failed to init mouse.\n"); } } #endif @@ -1837,15 +1837,15 @@ static ALLEGRO_DISPLAY *d3d_create_display_locked(int w, int h) return al_display; } -static ALLEGRO_DISPLAY *d3d_create_display(int w, int h) +static A5O_DISPLAY *d3d_create_display(int w, int h) { - ALLEGRO_DISPLAY *display; - ALLEGRO_DISPLAY_WIN *win_display; + A5O_DISPLAY *display; + A5O_DISPLAY_WIN *win_display; int *s; al_lock_mutex(present_mutex); display = d3d_create_display_locked(w, h); - win_display = (ALLEGRO_DISPLAY_WIN *)display; + win_display = (A5O_DISPLAY_WIN *)display; al_unlock_mutex(present_mutex); if (!display) @@ -1854,12 +1854,12 @@ static ALLEGRO_DISPLAY *d3d_create_display(int w, int h) ASSERT(display->vt); s = display->extra_settings.settings; - s[ALLEGRO_MAX_BITMAP_SIZE] = d3d_get_max_texture_size(win_display->adapter); - s[ALLEGRO_SUPPORT_SEPARATE_ALPHA] = _al_d3d_supports_separate_alpha_blend(display); - s[ALLEGRO_SUPPORT_NPOT_BITMAP] = al_have_d3d_non_pow2_texture_support(); - s[ALLEGRO_CAN_DRAW_INTO_BITMAP] = render_to_texture_supported; + s[A5O_MAX_BITMAP_SIZE] = d3d_get_max_texture_size(win_display->adapter); + s[A5O_SUPPORT_SEPARATE_ALPHA] = _al_d3d_supports_separate_alpha_blend(display); + s[A5O_SUPPORT_NPOT_BITMAP] = al_have_d3d_non_pow2_texture_support(); + s[A5O_CAN_DRAW_INTO_BITMAP] = render_to_texture_supported; -#ifdef ALLEGRO_CFG_D3DX9 +#ifdef A5O_CFG_D3DX9 _al_load_d3dx9_module(); #endif @@ -1868,9 +1868,9 @@ static ALLEGRO_DISPLAY *d3d_create_display(int w, int h) return display; } -static bool d3d_set_current_display(ALLEGRO_DISPLAY *d) +static bool d3d_set_current_display(A5O_DISPLAY *d) { - ALLEGRO_DISPLAY_D3D *d3d_display = (ALLEGRO_DISPLAY_D3D *)d; + A5O_DISPLAY_D3D *d3d_display = (A5O_DISPLAY_D3D *)d; if (d3d_display->do_reset) return false; @@ -1883,7 +1883,7 @@ static bool d3d_set_current_display(ALLEGRO_DISPLAY *d) static int d3d_al_blender_to_d3d(int al_mode) { - const int d3d_modes[ALLEGRO_NUM_BLEND_MODES] = { + const int d3d_modes[A5O_NUM_BLEND_MODES] = { D3DBLEND_ZERO, D3DBLEND_ONE, D3DBLEND_SRCALPHA, @@ -1899,13 +1899,13 @@ static int d3d_al_blender_to_d3d(int al_mode) return d3d_modes[al_mode]; } -void _al_d3d_set_blender(ALLEGRO_DISPLAY_D3D *d3d_display) +void _al_d3d_set_blender(A5O_DISPLAY_D3D *d3d_display) { bool blender_changed; int op, src, dst, alpha_op, alpha_src, alpha_dst; - ALLEGRO_COLOR color; + A5O_COLOR color; unsigned char r, g, b, a; - DWORD allegro_to_d3d_blendop[ALLEGRO_NUM_BLEND_OPERATIONS] = { + DWORD allegro_to_d3d_blendop[A5O_NUM_BLEND_OPERATIONS] = { D3DBLENDOP_ADD, D3DBLENDOP_SUBTRACT, D3DBLENDOP_REVSUBTRACT @@ -1938,28 +1938,28 @@ void _al_d3d_set_blender(ALLEGRO_DISPLAY_D3D *d3d_display) if (d3d_display->blender_state_src != src) { if (d3d_display->device->SetRenderState(D3DRS_SRCBLEND, d3d_al_blender_to_d3d(src)) != D3D_OK) - ALLEGRO_ERROR("Failed to set source blender\n"); + A5O_ERROR("Failed to set source blender\n"); d3d_display->blender_state_src = src; blender_changed = true; } if (d3d_display->blender_state_dst != dst) { if (d3d_display->device->SetRenderState(D3DRS_DESTBLEND, d3d_al_blender_to_d3d(dst)) != D3D_OK) - ALLEGRO_ERROR("Failed to set dest blender\n"); + A5O_ERROR("Failed to set dest blender\n"); d3d_display->blender_state_dst = dst; blender_changed = true; } if (d3d_display->blender_state_alpha_src != alpha_src) { if (d3d_display->device->SetRenderState(D3DRS_SRCBLENDALPHA, d3d_al_blender_to_d3d(alpha_src)) != D3D_OK) - ALLEGRO_ERROR("Failed to set source alpha blender\n"); + A5O_ERROR("Failed to set source alpha blender\n"); d3d_display->blender_state_alpha_src = alpha_src; blender_changed = true; } if (d3d_display->blender_state_alpha_dst != alpha_dst) { if (d3d_display->device->SetRenderState(D3DRS_DESTBLENDALPHA, d3d_al_blender_to_d3d(alpha_dst)) != D3D_OK) - ALLEGRO_ERROR("Failed to set dest alpha blender\n"); + A5O_ERROR("Failed to set dest alpha blender\n"); d3d_display->blender_state_alpha_dst = alpha_dst; blender_changed = true; } @@ -1969,7 +1969,7 @@ void _al_d3d_set_blender(ALLEGRO_DISPLAY_D3D *d3d_display) d3d_display->device->SetRenderState(D3DRS_BLENDFACTOR, D3DCOLOR_RGBA(r, g, b, a)); if (enable_separate_blender) { if (d3d_display->device->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, true) != D3D_OK) - ALLEGRO_ERROR("D3DRS_SEPARATEALPHABLENDENABLE failed\n"); + A5O_ERROR("D3DRS_SEPARATEALPHABLENDENABLE failed\n"); } /* thedmd: Why is this function called anyway? */ @@ -1977,10 +1977,10 @@ void _al_d3d_set_blender(ALLEGRO_DISPLAY_D3D *d3d_display) } } -static void d3d_clear(ALLEGRO_DISPLAY *al_display, ALLEGRO_COLOR *color) +static void d3d_clear(A5O_DISPLAY *al_display, A5O_COLOR *color) { - ALLEGRO_BITMAP *target = al_get_target_bitmap(); - ALLEGRO_DISPLAY_D3D* d3d_display = (ALLEGRO_DISPLAY_D3D*)al_display; + A5O_BITMAP *target = al_get_target_bitmap(); + A5O_DISPLAY_D3D* d3d_display = (A5O_DISPLAY_D3D*)al_display; if (target->parent) target = target->parent; @@ -1989,14 +1989,14 @@ static void d3d_clear(ALLEGRO_DISPLAY *al_display, ALLEGRO_COLOR *color) if (d3d_display->device->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB((int)(color->a*255), (int)(color->r*255), (int)(color->g*255), (int)(color->b*255)), 0, 0) != D3D_OK) { - ALLEGRO_ERROR("Clear failed\n"); + A5O_ERROR("Clear failed\n"); } } -static void d3d_clear_depth_buffer(ALLEGRO_DISPLAY *al_display, float z) +static void d3d_clear_depth_buffer(A5O_DISPLAY *al_display, float z) { - ALLEGRO_BITMAP *target = al_get_target_bitmap(); - ALLEGRO_DISPLAY_D3D* d3d_display = (ALLEGRO_DISPLAY_D3D*)al_display; + A5O_BITMAP *target = al_get_target_bitmap(); + A5O_DISPLAY_D3D* d3d_display = (A5O_DISPLAY_D3D*)al_display; if (target->parent) target = target->parent; @@ -2004,36 +2004,36 @@ static void d3d_clear_depth_buffer(ALLEGRO_DISPLAY *al_display, float z) return; if (d3d_display->device->Clear(0, NULL, D3DCLEAR_ZBUFFER, 0, z, 0) != D3D_OK) { - ALLEGRO_ERROR("Clear zbuffer failed\n"); + A5O_ERROR("Clear zbuffer failed\n"); } } // FIXME: does this need a programmable pipeline path? -static void d3d_draw_pixel(ALLEGRO_DISPLAY *disp, float x, float y, ALLEGRO_COLOR *color) +static void d3d_draw_pixel(A5O_DISPLAY *disp, float x, float y, A5O_COLOR *color) { - ALLEGRO_DISPLAY_D3D *d3d_disp = (ALLEGRO_DISPLAY_D3D *)disp; + A5O_DISPLAY_D3D *d3d_disp = (A5O_DISPLAY_D3D *)disp; _al_d3d_set_blender(d3d_disp); -#ifdef ALLEGRO_CFG_SHADER_HLSL - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_SHADER_HLSL + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { UINT required_passes; - ALLEGRO_VERTEX vertices[1]; + A5O_VERTEX vertices[1]; vertices[0].x = x; vertices[0].y = y; vertices[0].z = 0; vertices[0].color = *color; - d3d_disp->device->SetFVF(D3DFVF_ALLEGRO_VERTEX); - d3d_disp->effect->SetBool(ALLEGRO_SHADER_VAR_USE_TEX, false); + d3d_disp->device->SetFVF(D3DFVF_A5O_VERTEX); + d3d_disp->effect->SetBool(A5O_SHADER_VAR_USE_TEX, false); d3d_disp->effect->Begin(&required_passes, 0); for (unsigned int i = 0; i < required_passes; i++) { d3d_disp->effect->BeginPass(i); if (d3d_disp->device->DrawPrimitiveUP(D3DPT_POINTLIST, 1, - vertices, sizeof(ALLEGRO_VERTEX)) != D3D_OK) { - ALLEGRO_ERROR("d3d_draw_pixel: DrawPrimitive failed.\n"); + vertices, sizeof(A5O_VERTEX)) != D3D_OK) { + A5O_ERROR("d3d_draw_pixel: DrawPrimitive failed.\n"); return; } d3d_disp->effect->EndPass(); @@ -2053,16 +2053,16 @@ static void d3d_draw_pixel(ALLEGRO_DISPLAY *disp, float x, float y, ALLEGRO_COLO d3d_disp->device->SetTexture(0, NULL); if (d3d_disp->device->DrawPrimitiveUP(D3DPT_POINTLIST, 1, vertices, sizeof(D3D_FIXED_VERTEX)) != D3D_OK) { - ALLEGRO_ERROR("d3d_draw_pixel: DrawPrimitive failed.\n"); + A5O_ERROR("d3d_draw_pixel: DrawPrimitive failed.\n"); return; } } } -static void d3d_flip_display(ALLEGRO_DISPLAY *al_display) +static void d3d_flip_display(A5O_DISPLAY *al_display) { - ALLEGRO_DISPLAY_D3D* d3d_display = (ALLEGRO_DISPLAY_D3D*)al_display; - ALLEGRO_DISPLAY_WIN *win_display = &d3d_display->win_display; + A5O_DISPLAY_D3D* d3d_display = (A5O_DISPLAY_D3D*)al_display; + A5O_DISPLAY_WIN *win_display = &d3d_display->win_display; HRESULT hr; if (d3d_display->device_lost) @@ -2087,12 +2087,12 @@ static void d3d_flip_display(ALLEGRO_DISPLAY *al_display) } } -static void d3d_update_display_region(ALLEGRO_DISPLAY *al_display, +static void d3d_update_display_region(A5O_DISPLAY *al_display, int x, int y, int width, int height) { - ALLEGRO_DISPLAY_D3D* d3d_display = (ALLEGRO_DISPLAY_D3D*)al_display; - ALLEGRO_DISPLAY_WIN *win_display = &d3d_display->win_display; + A5O_DISPLAY_D3D* d3d_display = (A5O_DISPLAY_D3D*)al_display; + A5O_DISPLAY_WIN *win_display = &d3d_display->win_display; HRESULT hr; RGNDATA *rgndata; @@ -2136,10 +2136,10 @@ static void d3d_update_display_region(ALLEGRO_DISPLAY *al_display, /* * Sets a clipping rectangle */ -void _al_d3d_set_bitmap_clip(ALLEGRO_BITMAP *bitmap) +void _al_d3d_set_bitmap_clip(A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); - ALLEGRO_DISPLAY_D3D *disp = d3d_bmp->display; + A5O_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); + A5O_DISPLAY_D3D *disp = d3d_bmp->display; RECT rect; if (!disp) @@ -2172,13 +2172,13 @@ void _al_d3d_set_bitmap_clip(ALLEGRO_BITMAP *bitmap) } } -static bool d3d_acknowledge_resize(ALLEGRO_DISPLAY *d) +static bool d3d_acknowledge_resize(A5O_DISPLAY *d) { WINDOWINFO wi; - ALLEGRO_DISPLAY_D3D *disp = (ALLEGRO_DISPLAY_D3D *)d; - ALLEGRO_DISPLAY_WIN *win_display = &disp->win_display; + A5O_DISPLAY_D3D *disp = (A5O_DISPLAY_D3D *)d; + A5O_DISPLAY_WIN *win_display = &disp->win_display; int w, h; - ALLEGRO_STATE state; + A5O_STATE state; wi.cbSize = sizeof(WINDOWINFO); GetWindowInfo(win_display->window, &wi); @@ -2207,7 +2207,7 @@ static bool d3d_acknowledge_resize(ALLEGRO_DISPLAY *d) /* XXX: This is not very efficient, it'd probably be better to call * the necessary functions directly. */ - al_store_state(&state, ALLEGRO_STATE_DISPLAY | ALLEGRO_STATE_TARGET_BITMAP); + al_store_state(&state, A5O_STATE_DISPLAY | A5O_STATE_TARGET_BITMAP); al_set_target_bitmap(al_get_backbuffer(d)); al_set_clipping_rectangle(0, 0, d->w, d->h); al_restore_state(&state); @@ -2215,30 +2215,30 @@ static bool d3d_acknowledge_resize(ALLEGRO_DISPLAY *d) return disp->reset_success; } -static bool d3d_resize_helper(ALLEGRO_DISPLAY *d, int width, int height) +static bool d3d_resize_helper(A5O_DISPLAY *d, int width, int height) { - ALLEGRO_DISPLAY_D3D *disp = (ALLEGRO_DISPLAY_D3D *)d; - ALLEGRO_DISPLAY_WIN *win_display = &disp->win_display; - ALLEGRO_DISPLAY_D3D *new_disp; + A5O_DISPLAY_D3D *disp = (A5O_DISPLAY_D3D *)d; + A5O_DISPLAY_WIN *win_display = &disp->win_display; + A5O_DISPLAY_D3D *new_disp; int full_w, full_h; - ALLEGRO_MONITOR_INFO mi; + A5O_MONITOR_INFO mi; int adapter = win_display->adapter; - ALLEGRO_STATE backup; + A5O_STATE backup; al_get_monitor_info(adapter, &mi); full_w = mi.x2 - mi.x1; full_h = mi.y2 - mi.y1; - if ((d->flags & ALLEGRO_FULLSCREEN_WINDOW) && + if ((d->flags & A5O_FULLSCREEN_WINDOW) && (full_w != width || full_h != height)) { win_display->toggle_w = width; win_display->toggle_h = height; return true; } - if (d->flags & ALLEGRO_FULLSCREEN) { - /* Don't generate ALLEGRO_EVENT_DISPLAY_LOST events when destroying a + if (d->flags & A5O_FULLSCREEN) { + /* Don't generate A5O_EVENT_DISPLAY_LOST events when destroying a * display for resizing. */ disp->suppress_lost_events = true; @@ -2251,7 +2251,7 @@ static bool d3d_resize_helper(ALLEGRO_DISPLAY *d, int width, int height) win_display->end_thread = false; win_display->thread_ended = false; /* What's this? */ - ALLEGRO_SYSTEM *system = al_get_system_driver(); + A5O_SYSTEM *system = al_get_system_driver(); if (system->displays._size <= 1) { ffw_set = false; } @@ -2260,7 +2260,7 @@ static bool d3d_resize_helper(ALLEGRO_DISPLAY *d, int width, int height) */ new_disp = d3d_create_display_internals(disp, false); if (!new_disp) { - ALLEGRO_ERROR("d3d_create_display_internals failed.\n"); + A5O_ERROR("d3d_create_display_internals failed.\n"); ASSERT(d->vt); return false; } @@ -2296,7 +2296,7 @@ static bool d3d_resize_helper(ALLEGRO_DISPLAY *d, int width, int height) win_size.bottom-win_size.top, SWP_NOMOVE|SWP_NOZORDER); - if (!(d->flags & ALLEGRO_FULLSCREEN_WINDOW)) { + if (!(d->flags & A5O_FULLSCREEN_WINDOW)) { win_display->toggle_w = width; win_display->toggle_h = height; } @@ -2305,7 +2305,7 @@ static bool d3d_resize_helper(ALLEGRO_DISPLAY *d, int width, int height) * The clipping rectangle and bitmap size must be * changed to match the new size. */ - al_store_state(&backup, ALLEGRO_STATE_TARGET_BITMAP); + al_store_state(&backup, A5O_STATE_TARGET_BITMAP); al_set_target_bitmap(&disp->backbuffer_bmp); disp->backbuffer_bmp.w = width; disp->backbuffer_bmp.h = height; @@ -2318,9 +2318,9 @@ static bool d3d_resize_helper(ALLEGRO_DISPLAY *d, int width, int height) return true; } -static bool d3d_resize_display(ALLEGRO_DISPLAY *d, int width, int height) +static bool d3d_resize_display(A5O_DISPLAY *d, int width, int height) { - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *)d; + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *)d; int orig_w = d->w; int orig_h = d->h; bool ret; @@ -2330,10 +2330,10 @@ static bool d3d_resize_display(ALLEGRO_DISPLAY *d, int width, int height) win_display->ignore_resize = true; if (!d3d_resize_helper(d, width, height)) { - ALLEGRO_WARN("trying to restore original size: %d, %d\n", + A5O_WARN("trying to restore original size: %d, %d\n", orig_w, orig_h); if (!d3d_resize_helper(d, orig_w, orig_h)) { - ALLEGRO_ERROR("failed to restore original size: %d, %d\n", + A5O_ERROR("failed to restore original size: %d, %d\n", orig_w, orig_h); } ret = false; @@ -2347,28 +2347,28 @@ static bool d3d_resize_display(ALLEGRO_DISPLAY *d, int width, int height) return ret; } -static ALLEGRO_BITMAP *d3d_create_bitmap(ALLEGRO_DISPLAY *d, +static A5O_BITMAP *d3d_create_bitmap(A5O_DISPLAY *d, int w, int h, int format, int flags) { - ALLEGRO_BITMAP *bitmap; - ALLEGRO_BITMAP_EXTRA_D3D *extra; + A5O_BITMAP *bitmap; + A5O_BITMAP_EXTRA_D3D *extra; if (!_al_pixel_format_is_real(format)) { - format = d3d_choose_bitmap_format((ALLEGRO_DISPLAY_D3D *)d, format); + format = d3d_choose_bitmap_format((A5O_DISPLAY_D3D *)d, format); if (format < 0) { return NULL; } } if (_al_pixel_format_to_d3d(format) < 0) { - ALLEGRO_ERROR("Requested bitmap format not supported (%s).\n", - _al_pixel_format_name((ALLEGRO_PIXEL_FORMAT)format)); + A5O_ERROR("Requested bitmap format not supported (%s).\n", + _al_pixel_format_name((A5O_PIXEL_FORMAT)format)); return NULL; } if (!is_texture_format_ok(d, format)) { - ALLEGRO_ERROR("Requested bitmap format not supported (%s).\n", - _al_pixel_format_name((ALLEGRO_PIXEL_FORMAT)format)); + A5O_ERROR("Requested bitmap format not supported (%s).\n", + _al_pixel_format_name((A5O_PIXEL_FORMAT)format)); return NULL; } @@ -2383,9 +2383,9 @@ static ALLEGRO_BITMAP *d3d_create_bitmap(ALLEGRO_DISPLAY *d, int block_height = al_get_pixel_block_height(format); int block_size = al_get_pixel_block_size(format); - ALLEGRO_INFO("Chose bitmap format %d\n", format); + A5O_INFO("Chose bitmap format %d\n", format); - bitmap = (ALLEGRO_BITMAP *)al_malloc(sizeof *bitmap); + bitmap = (A5O_BITMAP *)al_malloc(sizeof *bitmap); ASSERT(bitmap); memset(bitmap, 0, sizeof(*bitmap)); @@ -2399,57 +2399,57 @@ static ALLEGRO_BITMAP *d3d_create_bitmap(ALLEGRO_DISPLAY *d, bitmap->memory = (unsigned char *)al_malloc( bitmap->pitch * _al_get_least_multiple(h, block_height) / block_height); - extra = (ALLEGRO_BITMAP_EXTRA_D3D *)al_calloc(1, sizeof *extra); + extra = (A5O_BITMAP_EXTRA_D3D *)al_calloc(1, sizeof *extra); bitmap->extra = extra; extra->video_texture = 0; extra->system_texture = 0; extra->initialized = false; extra->is_backbuffer = false; extra->render_target = NULL; - extra->system_format = compressed ? ALLEGRO_PIXEL_FORMAT_ARGB_8888 : format; + extra->system_format = compressed ? A5O_PIXEL_FORMAT_ARGB_8888 : format; - extra->display = (ALLEGRO_DISPLAY_D3D *)d; + extra->display = (A5O_DISPLAY_D3D *)d; return bitmap; } -void _al_d3d_destroy_bitmap(ALLEGRO_BITMAP *bitmap) +void _al_d3d_destroy_bitmap(A5O_BITMAP *bitmap) { ASSERT(!al_is_sub_bitmap(bitmap)); - ALLEGRO_DISPLAY_D3D *d3d_display = (ALLEGRO_DISPLAY_D3D*)_al_get_bitmap_display(bitmap); + A5O_DISPLAY_D3D *d3d_display = (A5O_DISPLAY_D3D*)_al_get_bitmap_display(bitmap); if (bitmap == d3d_display->target_bitmap) { d3d_display->target_bitmap = NULL; } - ALLEGRO_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); + A5O_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(bitmap); if (d3d_bmp->video_texture) { if (d3d_bmp->video_texture->Release() != 0) { - ALLEGRO_WARN("d3d_destroy_bitmap: Release video texture failed.\n"); + A5O_WARN("d3d_destroy_bitmap: Release video texture failed.\n"); } } if (d3d_bmp->system_texture) { if (d3d_bmp->system_texture->Release() != 0) { - ALLEGRO_WARN("d3d_destroy_bitmap: Release system texture failed.\n"); + A5O_WARN("d3d_destroy_bitmap: Release system texture failed.\n"); } } if (d3d_bmp->render_target) { if (d3d_bmp->render_target->Release() != 0) { - ALLEGRO_WARN("d3d_destroy_bitmap: Release render target failed.\n"); + A5O_WARN("d3d_destroy_bitmap: Release render target failed.\n"); } } al_free(bitmap->extra); } -static void d3d_set_target_bitmap(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap) +static void d3d_set_target_bitmap(A5O_DISPLAY *display, A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP *target; - ALLEGRO_BITMAP_EXTRA_D3D *d3d_target; - ALLEGRO_BITMAP_EXTRA_D3D *old_target = NULL; - ALLEGRO_DISPLAY_D3D *d3d_display = (ALLEGRO_DISPLAY_D3D *)display; + A5O_BITMAP *target; + A5O_BITMAP_EXTRA_D3D *d3d_target; + A5O_BITMAP_EXTRA_D3D *old_target = NULL; + A5O_DISPLAY_D3D *d3d_display = (A5O_DISPLAY_D3D *)display; if (d3d_display->device_lost) return; @@ -2467,12 +2467,12 @@ static void d3d_set_target_bitmap(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitm /* Release the previous target bitmap if it was not the backbuffer */ if (old_target && !old_target->is_backbuffer) { - ALLEGRO_BITMAP *parent; + A5O_BITMAP *parent; if (d3d_display->target_bitmap->parent) parent = d3d_display->target_bitmap->parent; else parent = d3d_display->target_bitmap; - ALLEGRO_BITMAP_EXTRA_D3D *e = get_extra(parent); + A5O_BITMAP_EXTRA_D3D *e = get_extra(parent); if (e && e->render_target) { e->render_target->Release(); e->render_target = NULL; @@ -2484,7 +2484,7 @@ static void d3d_set_target_bitmap(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitm if (d3d_target->is_backbuffer) { d3d_display = d3d_target->display; if (d3d_display->device->SetRenderTarget(0, d3d_display->render_target) != D3D_OK) { - ALLEGRO_ERROR("d3d_set_target_bitmap: Unable to set render target to texture surface.\n"); + A5O_ERROR("d3d_set_target_bitmap: Unable to set render target to texture surface.\n"); return; } d3d_target->render_target = d3d_display->render_target; @@ -2495,22 +2495,22 @@ static void d3d_set_target_bitmap(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitm * Instead, everything will be handled by the memory routines. */ } else { - d3d_display = (ALLEGRO_DISPLAY_D3D *)display; + d3d_display = (A5O_DISPLAY_D3D *)display; if (_al_d3d_render_to_texture_supported()) { d3d_display->target_bitmap = bitmap; if (!d3d_target->video_texture) { /* This can happen if the user tries to set the target bitmap as * the device is lost, before the DISPLAY_LOST event is received. */ - ALLEGRO_WARN("d3d_set_target_bitmap: No video texture.\n"); + A5O_WARN("d3d_set_target_bitmap: No video texture.\n"); return; } if (d3d_target->video_texture->GetSurfaceLevel(0, &d3d_target->render_target) != D3D_OK) { - ALLEGRO_ERROR("d3d_set_target_bitmap: Unable to get texture surface level.\n"); + A5O_ERROR("d3d_set_target_bitmap: Unable to get texture surface level.\n"); return; } if (d3d_display->device->SetRenderTarget(0, d3d_target->render_target) != D3D_OK) { - ALLEGRO_ERROR("d3d_set_target_bitmap: Unable to set render target to texture surface.\n"); + A5O_ERROR("d3d_set_target_bitmap: Unable to set render target to texture surface.\n"); d3d_target->render_target->Release(); return; } @@ -2525,35 +2525,35 @@ static void d3d_set_target_bitmap(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitm _al_d3d_set_bitmap_clip(bitmap); } -static ALLEGRO_BITMAP *d3d_get_backbuffer(ALLEGRO_DISPLAY *display) +static A5O_BITMAP *d3d_get_backbuffer(A5O_DISPLAY *display) { - return (ALLEGRO_BITMAP *)&(((ALLEGRO_DISPLAY_D3D *)display)->backbuffer_bmp); + return (A5O_BITMAP *)&(((A5O_DISPLAY_D3D *)display)->backbuffer_bmp); } -static bool d3d_is_compatible_bitmap(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap) +static bool d3d_is_compatible_bitmap(A5O_DISPLAY *display, A5O_BITMAP *bitmap) { return display == _al_get_bitmap_display(bitmap); } -static void d3d_switch_out(ALLEGRO_DISPLAY *display) +static void d3d_switch_out(A5O_DISPLAY *display) { (void)display; } -static void d3d_switch_in(ALLEGRO_DISPLAY *display) +static void d3d_switch_in(A5O_DISPLAY *display) { (void)display; } -static bool d3d_wait_for_vsync(ALLEGRO_DISPLAY *display) +static bool d3d_wait_for_vsync(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_D3D *d3d_display; + A5O_DISPLAY_D3D *d3d_display; D3DRASTER_STATUS status; if (!d3d_can_wait_for_vsync) return false; - d3d_display = (ALLEGRO_DISPLAY_D3D *)display; + d3d_display = (A5O_DISPLAY_D3D *)display; do { d3d_display->device->GetRasterStatus(0, &status); @@ -2567,31 +2567,31 @@ static bool d3d_wait_for_vsync(ALLEGRO_DISPLAY *display) /* Function: al_get_d3d_device */ -LPDIRECT3DDEVICE9 al_get_d3d_device(ALLEGRO_DISPLAY *display) +LPDIRECT3DDEVICE9 al_get_d3d_device(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_D3D *d3d_display = (ALLEGRO_DISPLAY_D3D *)display; + A5O_DISPLAY_D3D *d3d_display = (A5O_DISPLAY_D3D *)display; return d3d_display->device; } /* Function: al_get_d3d_system_texture */ -LPDIRECT3DTEXTURE9 al_get_d3d_system_texture(ALLEGRO_BITMAP *bitmap) +LPDIRECT3DTEXTURE9 al_get_d3d_system_texture(A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP_EXTRA_D3D *e = get_extra(bitmap); + A5O_BITMAP_EXTRA_D3D *e = get_extra(bitmap); return e->system_texture; } /* Function: al_get_d3d_video_texture */ -LPDIRECT3DTEXTURE9 al_get_d3d_video_texture(ALLEGRO_BITMAP *bitmap) +LPDIRECT3DTEXTURE9 al_get_d3d_video_texture(A5O_BITMAP *bitmap) { - ALLEGRO_BITMAP_EXTRA_D3D *e = get_extra(bitmap); + A5O_BITMAP_EXTRA_D3D *e = get_extra(bitmap); return e->video_texture; } /* Function: al_get_d3d_texture_position */ -void al_get_d3d_texture_position(ALLEGRO_BITMAP *bitmap, int *u, int *v) +void al_get_d3d_texture_position(A5O_BITMAP *bitmap, int *u, int *v) { ASSERT(bitmap); ASSERT(u); @@ -2603,27 +2603,27 @@ void al_get_d3d_texture_position(ALLEGRO_BITMAP *bitmap, int *u, int *v) /* Function: al_is_d3d_device_lost */ -bool al_is_d3d_device_lost(ALLEGRO_DISPLAY *display) +bool al_is_d3d_device_lost(A5O_DISPLAY *display) { - return ((ALLEGRO_DISPLAY_D3D *)display)->device_lost; + return ((A5O_DISPLAY_D3D *)display)->device_lost; } -static void d3d_set_window_position(ALLEGRO_DISPLAY *display, int x, int y) +static void d3d_set_window_position(A5O_DISPLAY *display, int x, int y) { - _al_win_set_window_position(((ALLEGRO_DISPLAY_WIN *)display)->window, x, y); + _al_win_set_window_position(((A5O_DISPLAY_WIN *)display)->window, x, y); } -static void d3d_get_window_position(ALLEGRO_DISPLAY *display, int *x, int *y) +static void d3d_get_window_position(A5O_DISPLAY *display, int *x, int *y) { - if (display->flags & ALLEGRO_FULLSCREEN) { - ALLEGRO_MONITOR_INFO info; - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *)display; + if (display->flags & A5O_FULLSCREEN) { + A5O_MONITOR_INFO info; + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *)display; al_get_monitor_info(win_display->adapter, &info); *x = info.x1; *y = info.y1; } else { - _al_win_get_window_position(((ALLEGRO_DISPLAY_WIN *)display)->window, x, y); + _al_win_get_window_position(((A5O_DISPLAY_WIN *)display)->window, x, y); } } @@ -2642,14 +2642,14 @@ void _al_d3d_shutdown_display(void) _al_d3d_bmp_destroy(); -#ifdef ALLEGRO_CFG_SHADER_HLSL +#ifdef A5O_CFG_SHADER_HLSL _al_d3d_shutdown_shaders(); #endif FreeLibrary(_al_d3d_module); _al_d3d_module = NULL; -#ifdef ALLEGRO_CFG_D3DX9 +#ifdef A5O_CFG_D3DX9 _al_unload_d3dx9_module(); #endif @@ -2657,13 +2657,13 @@ void _al_d3d_shutdown_display(void) vt = NULL; } -static void* d3d_prepare_vertex_cache(ALLEGRO_DISPLAY* disp, +static void* d3d_prepare_vertex_cache(A5O_DISPLAY* disp, int num_new_vertices) { int size; - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { - size = sizeof(ALLEGRO_VERTEX); + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { + size = sizeof(A5O_VERTEX); } else { size = sizeof(D3D_FIXED_VERTEX); @@ -2684,55 +2684,55 @@ static void* d3d_prepare_vertex_cache(ALLEGRO_DISPLAY* disp, (disp->num_cache_vertices - num_new_vertices) * size; } -static D3DTEXTUREADDRESS d3d_bitmap_wrap(ALLEGRO_BITMAP_WRAP wrap) +static D3DTEXTUREADDRESS d3d_bitmap_wrap(A5O_BITMAP_WRAP wrap) { switch (wrap) { default: - case ALLEGRO_BITMAP_WRAP_DEFAULT: + case A5O_BITMAP_WRAP_DEFAULT: return D3DTADDRESS_CLAMP; - case ALLEGRO_BITMAP_WRAP_REPEAT: + case A5O_BITMAP_WRAP_REPEAT: return D3DTADDRESS_WRAP; - case ALLEGRO_BITMAP_WRAP_CLAMP: + case A5O_BITMAP_WRAP_CLAMP: return D3DTADDRESS_CLAMP; - case ALLEGRO_BITMAP_WRAP_MIRROR: + case A5O_BITMAP_WRAP_MIRROR: return D3DTADDRESS_MIRROR; } } void _al_set_d3d_sampler_state(IDirect3DDevice9* device, int sampler, - ALLEGRO_BITMAP* bitmap, bool prim_default) + A5O_BITMAP* bitmap, bool prim_default) { int bitmap_flags = al_get_bitmap_flags(bitmap); - ALLEGRO_BITMAP_WRAP wrap_u, wrap_v; + A5O_BITMAP_WRAP wrap_u, wrap_v; _al_get_bitmap_wrap(bitmap, &wrap_u, &wrap_v); - if (prim_default && wrap_u == ALLEGRO_BITMAP_WRAP_DEFAULT) { + if (prim_default && wrap_u == A5O_BITMAP_WRAP_DEFAULT) { device->SetSamplerState(sampler, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP); } else { device->SetSamplerState(sampler, D3DSAMP_ADDRESSU, d3d_bitmap_wrap(wrap_u)); } - if (prim_default && wrap_v == ALLEGRO_BITMAP_WRAP_DEFAULT) { + if (prim_default && wrap_v == A5O_BITMAP_WRAP_DEFAULT) { device->SetSamplerState(sampler, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP); } else { device->SetSamplerState(sampler, D3DSAMP_ADDRESSV, d3d_bitmap_wrap(wrap_v)); } - if (bitmap_flags & ALLEGRO_MIN_LINEAR) { + if (bitmap_flags & A5O_MIN_LINEAR) { device->SetSamplerState(sampler, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); } else { device->SetSamplerState(sampler, D3DSAMP_MINFILTER, D3DTEXF_POINT); } - if (bitmap_flags & ALLEGRO_MAG_LINEAR) { + if (bitmap_flags & A5O_MAG_LINEAR) { device->SetSamplerState(sampler, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); } else { device->SetSamplerState(sampler, D3DSAMP_MAGFILTER, D3DTEXF_POINT); } - if (bitmap_flags & ALLEGRO_MIPMAP) { + if (bitmap_flags & A5O_MIPMAP) { device->SetSamplerState(sampler, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR); } else { @@ -2740,51 +2740,51 @@ void _al_set_d3d_sampler_state(IDirect3DDevice9* device, int sampler, } } -static void d3d_flush_vertex_cache(ALLEGRO_DISPLAY* disp) +static void d3d_flush_vertex_cache(A5O_DISPLAY* disp) { if (!disp->vertex_cache) return; if (disp->num_cache_vertices == 0) return; - ALLEGRO_DISPLAY_D3D* d3d_disp = (ALLEGRO_DISPLAY_D3D*)disp; - ALLEGRO_BITMAP* cache_bmp = (ALLEGRO_BITMAP*)disp->cache_texture; - ALLEGRO_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(cache_bmp); + A5O_DISPLAY_D3D* d3d_disp = (A5O_DISPLAY_D3D*)disp; + A5O_BITMAP* cache_bmp = (A5O_BITMAP*)disp->cache_texture; + A5O_BITMAP_EXTRA_D3D *d3d_bmp = get_extra(cache_bmp); if (d3d_disp->device_lost) return; _al_set_d3d_sampler_state(d3d_disp->device, 0, cache_bmp, false); - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { - d3d_disp->device->SetFVF(D3DFVF_ALLEGRO_VERTEX); + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { + d3d_disp->device->SetFVF(D3DFVF_A5O_VERTEX); } -#ifdef ALLEGRO_CFG_SHADER_HLSL +#ifdef A5O_CFG_SHADER_HLSL UINT required_passes; - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { - d3d_disp->effect->SetBool(ALLEGRO_SHADER_VAR_USE_TEX, true); - d3d_disp->effect->SetTexture(ALLEGRO_SHADER_VAR_TEX, d3d_bmp->video_texture); + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { + d3d_disp->effect->SetBool(A5O_SHADER_VAR_USE_TEX, true); + d3d_disp->effect->SetTexture(A5O_SHADER_VAR_TEX, d3d_bmp->video_texture); d3d_disp->effect->Begin(&required_passes, 0); ASSERT(required_passes > 0); } #endif if (d3d_disp->device->SetTexture(0, d3d_bmp->video_texture) != D3D_OK) { - ALLEGRO_ERROR("d3d_flush_vertex_cache: SetTexture failed.\n"); + A5O_ERROR("d3d_flush_vertex_cache: SetTexture failed.\n"); return; } int size; -#ifdef ALLEGRO_CFG_SHADER_HLSL - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { - size = sizeof(ALLEGRO_VERTEX); +#ifdef A5O_CFG_SHADER_HLSL + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { + size = sizeof(A5O_VERTEX); for (unsigned int i = 0; i < required_passes; i++) { d3d_disp->effect->BeginPass(i); if (d3d_disp->device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, disp->num_cache_vertices / 3, (void *)disp->vertex_cache, size) != D3D_OK) { - ALLEGRO_ERROR("d3d_flush_vertex_cache: DrawPrimitive failed.\n"); + A5O_ERROR("d3d_flush_vertex_cache: DrawPrimitive failed.\n"); return; } d3d_disp->effect->EndPass(); @@ -2797,27 +2797,27 @@ static void d3d_flush_vertex_cache(ALLEGRO_DISPLAY* disp) size = sizeof(D3D_FIXED_VERTEX); if (d3d_disp->device->DrawPrimitiveUP(D3DPT_TRIANGLELIST, disp->num_cache_vertices / 3, (void *)disp->vertex_cache, size) != D3D_OK) { - ALLEGRO_ERROR("d3d_flush_vertex_cache: DrawPrimitive failed.\n"); + A5O_ERROR("d3d_flush_vertex_cache: DrawPrimitive failed.\n"); return; } } disp->num_cache_vertices = 0; -#ifdef ALLEGRO_CFG_SHADER_HLSL - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_SHADER_HLSL + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { d3d_disp->effect->End(); - d3d_disp->effect->SetBool(ALLEGRO_SHADER_VAR_USE_TEX, false); - d3d_disp->effect->SetTexture(ALLEGRO_SHADER_VAR_TEX, NULL); + d3d_disp->effect->SetBool(A5O_SHADER_VAR_USE_TEX, false); + d3d_disp->effect->SetTexture(A5O_SHADER_VAR_TEX, NULL); } #endif d3d_disp->device->SetTexture(0, NULL); } -static void d3d_update_transformation(ALLEGRO_DISPLAY* disp, ALLEGRO_BITMAP *target) +static void d3d_update_transformation(A5O_DISPLAY* disp, A5O_BITMAP *target) { - ALLEGRO_DISPLAY_D3D* d3d_disp = (ALLEGRO_DISPLAY_D3D*)disp; - ALLEGRO_TRANSFORM proj; + A5O_DISPLAY_D3D* d3d_disp = (A5O_DISPLAY_D3D*)disp; + A5O_TRANSFORM proj; al_copy_transform(&proj, &target->proj_transform); /* Direct3D uses different clipping in projection space than OpenGL. @@ -2832,7 +2832,7 @@ static void d3d_update_transformation(ALLEGRO_DISPLAY* disp, ALLEGRO_BITMAP *tar * The effect can be seen for example ex_projection - it is broken * without this. */ - ALLEGRO_TRANSFORM fix_d3d; + A5O_TRANSFORM fix_d3d; al_identity_transform(&fix_d3d); al_scale_transform_3d(&fix_d3d, 1, 1, 0.5); al_translate_transform_3d(&fix_d3d, 0.0, 0.0, 0.5); @@ -2847,10 +2847,10 @@ static void d3d_update_transformation(ALLEGRO_DISPLAY* disp, ALLEGRO_BITMAP *tar al_compose_transform(&proj, &fix_d3d); - if (disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE) { -#ifdef ALLEGRO_CFG_SHADER_HLSL + if (disp->flags & A5O_PROGRAMMABLE_PIPELINE) { +#ifdef A5O_CFG_SHADER_HLSL LPD3DXEFFECT effect = d3d_disp->effect; - ALLEGRO_TRANSFORM projview; + A5O_TRANSFORM projview; al_copy_transform(&projview, &target->transform); al_compose_transform(&projview, &proj); al_copy_transform(&disp->projview_transform, &projview); @@ -2881,7 +2881,7 @@ static void d3d_update_transformation(ALLEGRO_DISPLAY* disp, ALLEGRO_BITMAP *tar } /* Initialize and obtain a reference to this driver. */ -ALLEGRO_DISPLAY_INTERFACE *_al_display_d3d_driver(void) +A5O_DISPLAY_INTERFACE *_al_display_d3d_driver(void) { if (vt) return vt; @@ -2889,7 +2889,7 @@ ALLEGRO_DISPLAY_INTERFACE *_al_display_d3d_driver(void) if (!d3d_init_display()) return NULL; - vt = (ALLEGRO_DISPLAY_INTERFACE *)al_malloc(sizeof *vt); + vt = (A5O_DISPLAY_INTERFACE *)al_malloc(sizeof *vt); memset(vt, 0, sizeof *vt); vt->create_display = d3d_create_display; @@ -2990,8 +2990,8 @@ int _al_d3d_get_num_display_modes(int format, int refresh_rate, int flags) return matches; } -ALLEGRO_DISPLAY_MODE *_al_d3d_get_display_mode(int index, int format, - int refresh_rate, int flags, ALLEGRO_DISPLAY_MODE *mode) +A5O_DISPLAY_MODE *_al_d3d_get_display_mode(int index, int format, + int refresh_rate, int flags, A5O_DISPLAY_MODE *mode) { UINT num_modes; UINT i, j; diff --git a/src/win/d3d_display_formats.cpp b/src/win/d3d_display_formats.cpp index 1c3429743c..b9b8e96e55 100644 --- a/src/win/d3d_display_formats.cpp +++ b/src/win/d3d_display_formats.cpp @@ -1,6 +1,6 @@ #include "d3d.h" -ALLEGRO_DEBUG_CHANNEL("d3d") +A5O_DEBUG_CHANNEL("d3d") struct DEPTH_STENCIL_DESC { int d; @@ -46,11 +46,11 @@ void _al_d3d_destroy_display_format_list(void) void _al_d3d_generate_display_format_list(void) { - static bool fullscreen = !(al_get_new_display_flags() & ALLEGRO_FULLSCREEN); /* stop warning */ + static bool fullscreen = !(al_get_new_display_flags() & A5O_FULLSCREEN); /* stop warning */ static int adapter = ~al_get_new_display_adapter(); /* stop warning */ int i; - if (!_al_vector_is_empty(&eds_list) && (fullscreen == (bool)(al_get_new_display_flags() & ALLEGRO_FULLSCREEN)) + if (!_al_vector_is_empty(&eds_list) && (fullscreen == (bool)(al_get_new_display_flags() & A5O_FULLSCREEN)) && (adapter == al_get_new_display_adapter())) { return; } @@ -58,12 +58,12 @@ void _al_d3d_generate_display_format_list(void) _al_d3d_destroy_display_format_list(); } - fullscreen = (al_get_new_display_flags() & ALLEGRO_FULLSCREEN) != 0; + fullscreen = (al_get_new_display_flags() & A5O_FULLSCREEN) != 0; adapter = al_get_new_display_adapter(); if (adapter < 0) adapter = 0; - _al_vector_init(&eds_list, sizeof(ALLEGRO_EXTRA_DISPLAY_SETTINGS *)); + _al_vector_init(&eds_list, sizeof(A5O_EXTRA_DISPLAY_SETTINGS *)); /* Loop through each bit combination of: * bit 0: 16/32 bit @@ -74,8 +74,8 @@ void _al_d3d_generate_display_format_list(void) int format_num = !!(i & 1); int single_buffer = !!(i & 2); int vsync = !!(i & 4); - int allegro_format = ALLEGRO_PIXEL_FORMAT_XRGB_8888; - if (format_num == 1) allegro_format = ALLEGRO_PIXEL_FORMAT_RGB_565; + int allegro_format = A5O_PIXEL_FORMAT_XRGB_8888; + if (format_num == 1) allegro_format = A5O_PIXEL_FORMAT_RGB_565; D3DFORMAT d3d_format = (D3DFORMAT)_al_pixel_format_to_d3d(allegro_format); /* Count available multisample quality levels. */ @@ -93,62 +93,62 @@ void _al_d3d_generate_display_format_list(void) depth_stencil_formats[j].format, d3d_format)) { DEPTH_STENCIL_DESC *ds = depth_stencil_formats + j; for (int k = 0; k < (int)quality_levels + 1; k++) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds, **peds; - peds = (ALLEGRO_EXTRA_DISPLAY_SETTINGS **)_al_vector_alloc_back(&eds_list); - eds = *peds = (ALLEGRO_EXTRA_DISPLAY_SETTINGS *)al_malloc(sizeof *eds); - memset(eds->settings, 0, sizeof(int) * ALLEGRO_DISPLAY_OPTIONS_COUNT); + A5O_EXTRA_DISPLAY_SETTINGS *eds, **peds; + peds = (A5O_EXTRA_DISPLAY_SETTINGS **)_al_vector_alloc_back(&eds_list); + eds = *peds = (A5O_EXTRA_DISPLAY_SETTINGS *)al_malloc(sizeof *eds); + memset(eds->settings, 0, sizeof(int) * A5O_DISPLAY_OPTIONS_COUNT); - eds->settings[ALLEGRO_COMPATIBLE_DISPLAY] = 1; + eds->settings[A5O_COMPATIBLE_DISPLAY] = 1; if (format_num == 0) { - eds->settings[ALLEGRO_RED_SIZE] = 8; - eds->settings[ALLEGRO_GREEN_SIZE] = 8; - eds->settings[ALLEGRO_BLUE_SIZE] = 8; - eds->settings[ALLEGRO_RED_SHIFT] = 16; - eds->settings[ALLEGRO_GREEN_SHIFT] = 8; - eds->settings[ALLEGRO_BLUE_SHIFT] = 0; - eds->settings[ALLEGRO_COLOR_SIZE] = 32; + eds->settings[A5O_RED_SIZE] = 8; + eds->settings[A5O_GREEN_SIZE] = 8; + eds->settings[A5O_BLUE_SIZE] = 8; + eds->settings[A5O_RED_SHIFT] = 16; + eds->settings[A5O_GREEN_SHIFT] = 8; + eds->settings[A5O_BLUE_SHIFT] = 0; + eds->settings[A5O_COLOR_SIZE] = 32; } else if (format_num == 1) { - eds->settings[ALLEGRO_RED_SIZE] = 5; - eds->settings[ALLEGRO_GREEN_SIZE] = 6; - eds->settings[ALLEGRO_BLUE_SIZE] = 5; - eds->settings[ALLEGRO_RED_SHIFT] = 11; - eds->settings[ALLEGRO_GREEN_SHIFT] = 5; - eds->settings[ALLEGRO_BLUE_SHIFT] = 0; - eds->settings[ALLEGRO_COLOR_SIZE] = 16; + eds->settings[A5O_RED_SIZE] = 5; + eds->settings[A5O_GREEN_SIZE] = 6; + eds->settings[A5O_BLUE_SIZE] = 5; + eds->settings[A5O_RED_SHIFT] = 11; + eds->settings[A5O_GREEN_SHIFT] = 5; + eds->settings[A5O_BLUE_SHIFT] = 0; + eds->settings[A5O_COLOR_SIZE] = 16; } if (single_buffer) { - eds->settings[ALLEGRO_SINGLE_BUFFER] = 1; - eds->settings[ALLEGRO_UPDATE_DISPLAY_REGION] = 1; + eds->settings[A5O_SINGLE_BUFFER] = 1; + eds->settings[A5O_UPDATE_DISPLAY_REGION] = 1; } if (vsync) { - eds->settings[ALLEGRO_VSYNC] = 1; + eds->settings[A5O_VSYNC] = 1; } - eds->settings[ALLEGRO_DEPTH_SIZE] = ds->d; - eds->settings[ALLEGRO_STENCIL_SIZE] = ds->s; + eds->settings[A5O_DEPTH_SIZE] = ds->d; + eds->settings[A5O_STENCIL_SIZE] = ds->s; if (k > 1) { - eds->settings[ALLEGRO_SAMPLE_BUFFERS] = 1; + eds->settings[A5O_SAMPLE_BUFFERS] = 1; // TODO: Is it ok to use the quality level here? - eds->settings[ALLEGRO_SAMPLES] = k; + eds->settings[A5O_SAMPLES] = k; } } } } } - ALLEGRO_INFO("found %d format combinations\n", (int)_al_vector_size(&eds_list)); + A5O_INFO("found %d format combinations\n", (int)_al_vector_size(&eds_list)); } -void _al_d3d_score_display_settings(ALLEGRO_EXTRA_DISPLAY_SETTINGS *ref) +void _al_d3d_score_display_settings(A5O_EXTRA_DISPLAY_SETTINGS *ref) { for (int i = 0; i < (int)_al_vector_size(&eds_list); i++) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds, **peds; - peds = (ALLEGRO_EXTRA_DISPLAY_SETTINGS **)_al_vector_ref(&eds_list, i); + A5O_EXTRA_DISPLAY_SETTINGS *eds, **peds; + peds = (A5O_EXTRA_DISPLAY_SETTINGS **)_al_vector_ref(&eds_list, i); eds = *peds; eds->score = _al_score_display_settings(eds, ref); eds->index = i; @@ -160,8 +160,8 @@ void _al_d3d_score_display_settings(ALLEGRO_EXTRA_DISPLAY_SETTINGS *ref) /* Helper function for sorting pixel formats by index */ static int d3d_display_list_resorter(const void *p0, const void *p1) { - const ALLEGRO_EXTRA_DISPLAY_SETTINGS *f0 = *((ALLEGRO_EXTRA_DISPLAY_SETTINGS **)p0); - const ALLEGRO_EXTRA_DISPLAY_SETTINGS *f1 = *((ALLEGRO_EXTRA_DISPLAY_SETTINGS **)p1); + const A5O_EXTRA_DISPLAY_SETTINGS *f0 = *((A5O_EXTRA_DISPLAY_SETTINGS **)p0); + const A5O_EXTRA_DISPLAY_SETTINGS *f1 = *((A5O_EXTRA_DISPLAY_SETTINGS **)p1); if (!f0) return 1; @@ -183,9 +183,9 @@ void _al_d3d_resort_display_settings(void) qsort(eds_list._items, eds_list._size, eds_list._itemsize, d3d_display_list_resorter); } -ALLEGRO_EXTRA_DISPLAY_SETTINGS *_al_d3d_get_display_settings(int i) +A5O_EXTRA_DISPLAY_SETTINGS *_al_d3d_get_display_settings(int i) { if (i < (int)_al_vector_size(&eds_list)) - return *(ALLEGRO_EXTRA_DISPLAY_SETTINGS **)_al_vector_ref(&eds_list, i); + return *(A5O_EXTRA_DISPLAY_SETTINGS **)_al_vector_ref(&eds_list, i); return NULL; } diff --git a/src/win/d3d_render_state.cpp b/src/win/d3d_render_state.cpp index f2c6f3c374..bbb01bd5af 100644 --- a/src/win/d3d_render_state.cpp +++ b/src/win/d3d_render_state.cpp @@ -2,7 +2,7 @@ #include "allegro5/internal/aintern_display.h" #include "d3d.h" -/* Note: synched to ALLEGRO_RENDER_FUNCTION values as array indices */ +/* Note: synched to A5O_RENDER_FUNCTION values as array indices */ static int _d3d_funcs[] = { D3DCMP_NEVER, D3DCMP_ALWAYS, @@ -14,10 +14,10 @@ static int _d3d_funcs[] = { D3DCMP_GREATEREQUAL }; -void _al_d3d_update_render_state(ALLEGRO_DISPLAY *display) +void _al_d3d_update_render_state(A5O_DISPLAY *display) { - _ALLEGRO_RENDER_STATE *r = &display->render_state; - ALLEGRO_DISPLAY_D3D *disp = (ALLEGRO_DISPLAY_D3D *)display; + _A5O_RENDER_STATE *r = &display->render_state; + A5O_DISPLAY_D3D *disp = (A5O_DISPLAY_D3D *)display; if (!disp->device) return; @@ -35,12 +35,12 @@ void _al_d3d_update_render_state(ALLEGRO_DISPLAY *display) disp->device->SetRenderState(D3DRS_ZFUNC, _d3d_funcs[r->depth_function]); disp->device->SetRenderState(D3DRS_ZWRITEENABLE, - (r->write_mask & ALLEGRO_MASK_DEPTH) ? TRUE : FALSE); + (r->write_mask & A5O_MASK_DEPTH) ? TRUE : FALSE); disp->device->SetRenderState(D3DRS_COLORWRITEENABLE, - ((r->write_mask & ALLEGRO_MASK_RED) ? D3DCOLORWRITEENABLE_RED : 0) | - ((r->write_mask & ALLEGRO_MASK_GREEN) ? D3DCOLORWRITEENABLE_GREEN : 0) | - ((r->write_mask & ALLEGRO_MASK_BLUE) ? D3DCOLORWRITEENABLE_BLUE : 0) | - ((r->write_mask & ALLEGRO_MASK_ALPHA) ? D3DCOLORWRITEENABLE_ALPHA : 0)); + ((r->write_mask & A5O_MASK_RED) ? D3DCOLORWRITEENABLE_RED : 0) | + ((r->write_mask & A5O_MASK_GREEN) ? D3DCOLORWRITEENABLE_GREEN : 0) | + ((r->write_mask & A5O_MASK_BLUE) ? D3DCOLORWRITEENABLE_BLUE : 0) | + ((r->write_mask & A5O_MASK_ALPHA) ? D3DCOLORWRITEENABLE_ALPHA : 0)); } diff --git a/src/win/d3d_shader.cpp b/src/win/d3d_shader.cpp index 37388a95ab..6b389d5f99 100644 --- a/src/win/d3d_shader.cpp +++ b/src/win/d3d_shader.cpp @@ -21,20 +21,20 @@ #include "allegro5/internal/aintern_direct3d.h" #include "allegro5/internal/aintern_shader.h" -#ifdef ALLEGRO_CFG_SHADER_HLSL +#ifdef A5O_CFG_SHADER_HLSL #include #include #include "d3d.h" -ALLEGRO_DEBUG_CHANNEL("shader") +A5O_DEBUG_CHANNEL("shader") static _AL_VECTOR shaders; -struct ALLEGRO_SHADER_HLSL_S +struct A5O_SHADER_HLSL_S { - ALLEGRO_SHADER shader; + A5O_SHADER shader; LPD3DXEFFECT hlsl_shader; int shader_model; }; @@ -102,31 +102,31 @@ static const char *technique_source_both_v3 = "}\n"; -static bool hlsl_attach_shader_source(ALLEGRO_SHADER *shader, - ALLEGRO_SHADER_TYPE type, const char *source); -static bool hlsl_build_shader(ALLEGRO_SHADER *shader); -static bool hlsl_use_shader(ALLEGRO_SHADER *shader, ALLEGRO_DISPLAY *display, +static bool hlsl_attach_shader_source(A5O_SHADER *shader, + A5O_SHADER_TYPE type, const char *source); +static bool hlsl_build_shader(A5O_SHADER *shader); +static bool hlsl_use_shader(A5O_SHADER *shader, A5O_DISPLAY *display, bool set_projview_matrix_from_display); -static void hlsl_unuse_shader(ALLEGRO_SHADER *shader, ALLEGRO_DISPLAY *display); -static void hlsl_destroy_shader(ALLEGRO_SHADER *shader); -static void hlsl_on_lost_device(ALLEGRO_SHADER *shader); -static void hlsl_on_reset_device(ALLEGRO_SHADER *shader); -static bool hlsl_set_shader_sampler(ALLEGRO_SHADER *shader, - const char *name, ALLEGRO_BITMAP *bitmap, int unit); -static bool hlsl_set_shader_matrix(ALLEGRO_SHADER *shader, - const char *name, const ALLEGRO_TRANSFORM *matrix); -static bool hlsl_set_shader_int(ALLEGRO_SHADER *shader, +static void hlsl_unuse_shader(A5O_SHADER *shader, A5O_DISPLAY *display); +static void hlsl_destroy_shader(A5O_SHADER *shader); +static void hlsl_on_lost_device(A5O_SHADER *shader); +static void hlsl_on_reset_device(A5O_SHADER *shader); +static bool hlsl_set_shader_sampler(A5O_SHADER *shader, + const char *name, A5O_BITMAP *bitmap, int unit); +static bool hlsl_set_shader_matrix(A5O_SHADER *shader, + const char *name, const A5O_TRANSFORM *matrix); +static bool hlsl_set_shader_int(A5O_SHADER *shader, const char *name, int i); -static bool hlsl_set_shader_float(ALLEGRO_SHADER *shader, +static bool hlsl_set_shader_float(A5O_SHADER *shader, const char *name, float f); -static bool hlsl_set_shader_int_vector(ALLEGRO_SHADER *shader, +static bool hlsl_set_shader_int_vector(A5O_SHADER *shader, const char *name, int num_components, const int *i, int num_elems); -static bool hlsl_set_shader_float_vector(ALLEGRO_SHADER *shader, +static bool hlsl_set_shader_float_vector(A5O_SHADER *shader, const char *name, int num_components, const float *f, int num_elems); -static bool hlsl_set_shader_bool(ALLEGRO_SHADER *shader, +static bool hlsl_set_shader_bool(A5O_SHADER *shader, const char *name, bool b); -static struct ALLEGRO_SHADER_INTERFACE shader_hlsl_vt = +static struct A5O_SHADER_INTERFACE shader_hlsl_vt = { hlsl_attach_shader_source, hlsl_build_shader, @@ -144,72 +144,72 @@ static struct ALLEGRO_SHADER_INTERFACE shader_hlsl_vt = hlsl_set_shader_bool }; -void _al_d3d_on_lost_shaders(ALLEGRO_DISPLAY *display) +void _al_d3d_on_lost_shaders(A5O_DISPLAY *display) { unsigned i; (void)display; for (i = 0; i < _al_vector_size(&shaders); i++) { - ALLEGRO_SHADER **shader = (ALLEGRO_SHADER **)_al_vector_ref(&shaders, i); + A5O_SHADER **shader = (A5O_SHADER **)_al_vector_ref(&shaders, i); (*shader)->vt->on_lost_device(*shader); } } -void _al_d3d_on_reset_shaders(ALLEGRO_DISPLAY *display) +void _al_d3d_on_reset_shaders(A5O_DISPLAY *display) { unsigned i; (void)display; for (i = 0; i < _al_vector_size(&shaders); i++) { - ALLEGRO_SHADER **shader = (ALLEGRO_SHADER **)_al_vector_ref(&shaders, i); + A5O_SHADER **shader = (A5O_SHADER **)_al_vector_ref(&shaders, i); (*shader)->vt->on_reset_device(*shader); } } -ALLEGRO_SHADER *_al_create_shader_hlsl(ALLEGRO_SHADER_PLATFORM platform, int shader_model) +A5O_SHADER *_al_create_shader_hlsl(A5O_SHADER_PLATFORM platform, int shader_model) { - ALLEGRO_SHADER_HLSL_S *shader; + A5O_SHADER_HLSL_S *shader; if (NULL == _al_imp_D3DXCreateEffect) { - ALLEGRO_ERROR("D3DXCreateEffect unavailable\n"); + A5O_ERROR("D3DXCreateEffect unavailable\n"); return NULL; } - shader = (ALLEGRO_SHADER_HLSL_S *)al_calloc(1, sizeof(ALLEGRO_SHADER_HLSL_S)); + shader = (A5O_SHADER_HLSL_S *)al_calloc(1, sizeof(A5O_SHADER_HLSL_S)); if (!shader) return NULL; shader->shader.platform = platform; shader->shader.vt = &shader_hlsl_vt; shader->shader_model = shader_model; - _al_vector_init(&shader->shader.bitmaps, sizeof(ALLEGRO_BITMAP *)); + _al_vector_init(&shader->shader.bitmaps, sizeof(A5O_BITMAP *)); // For simplicity, these fields are never NULL in this backend. shader->shader.pixel_copy = al_ustr_new(""); shader->shader.vertex_copy = al_ustr_new(""); - ALLEGRO_SHADER **back = (ALLEGRO_SHADER **)_al_vector_alloc_back(&shaders); - *back = (ALLEGRO_SHADER *)shader; + A5O_SHADER **back = (A5O_SHADER **)_al_vector_alloc_back(&shaders); + *back = (A5O_SHADER *)shader; _al_add_display_invalidated_callback(al_get_current_display(), _al_d3d_on_lost_shaders); _al_add_display_validated_callback(al_get_current_display(), _al_d3d_on_reset_shaders); - return (ALLEGRO_SHADER *)shader; + return (A5O_SHADER *)shader; } -static bool hlsl_attach_shader_source(ALLEGRO_SHADER *shader, - ALLEGRO_SHADER_TYPE type, const char *source) +static bool hlsl_attach_shader_source(A5O_SHADER *shader, + A5O_SHADER_TYPE type, const char *source) { bool add_technique; - ALLEGRO_USTR *full_source; + A5O_USTR *full_source; LPD3DXBUFFER errors; const char *vertex_source, *pixel_source, *technique_source; - ALLEGRO_SHADER_HLSL_S *hlsl_shader = (ALLEGRO_SHADER_HLSL_S *)shader; - ALLEGRO_DISPLAY *display = al_get_current_display(); + A5O_SHADER_HLSL_S *hlsl_shader = (A5O_SHADER_HLSL_S *)shader; + A5O_DISPLAY *display = al_get_current_display(); ASSERT(display); - ASSERT(display->flags & ALLEGRO_DIRECT3D); + ASSERT(display->flags & A5O_DIRECT3D); if (source == NULL) { - if (type == ALLEGRO_VERTEX_SHADER) { + if (type == A5O_VERTEX_SHADER) { if (shader->vertex_copy) { al_ustr_truncate(shader->vertex_copy, 0); hlsl_shader->hlsl_shader->Release(); @@ -227,7 +227,7 @@ static bool hlsl_attach_shader_source(ALLEGRO_SHADER *shader, } } else { - if (type == ALLEGRO_VERTEX_SHADER) { + if (type == A5O_VERTEX_SHADER) { vertex_source = source; al_ustr_truncate(shader->vertex_copy, 0); al_ustr_append_cstr(shader->vertex_copy, vertex_source); @@ -314,7 +314,7 @@ static bool hlsl_attach_shader_source(ALLEGRO_SHADER *shader, } else { shader->log = al_ustr_new(msg); } - ALLEGRO_ERROR("Error: %s\n", msg); + A5O_ERROR("Error: %s\n", msg); return false; } @@ -326,23 +326,23 @@ static bool hlsl_attach_shader_source(ALLEGRO_SHADER *shader, return true; } -static bool hlsl_build_shader(ALLEGRO_SHADER *shader) +static bool hlsl_build_shader(A5O_SHADER *shader) { (void)shader; return true; } -static bool hlsl_use_shader(ALLEGRO_SHADER *shader, ALLEGRO_DISPLAY *display, +static bool hlsl_use_shader(A5O_SHADER *shader, A5O_DISPLAY *display, bool set_projview_matrix_from_display) { - ALLEGRO_SHADER_HLSL_S *hlsl_shader = (ALLEGRO_SHADER_HLSL_S *)shader; + A5O_SHADER_HLSL_S *hlsl_shader = (A5O_SHADER_HLSL_S *)shader; LPD3DXEFFECT effect = hlsl_shader->hlsl_shader; - ALLEGRO_DISPLAY_D3D *d3d_disp; + A5O_DISPLAY_D3D *d3d_disp; - if (!(display->flags & ALLEGRO_DIRECT3D)) { + if (!(display->flags & A5O_DIRECT3D)) { return false; } - d3d_disp = (ALLEGRO_DISPLAY_D3D *)display; + d3d_disp = (A5O_DISPLAY_D3D *)display; if (set_projview_matrix_from_display) { if (!_al_hlsl_set_projview_matrix(effect, &display->projview_transform)) { @@ -355,9 +355,9 @@ static bool hlsl_use_shader(ALLEGRO_SHADER *shader, ALLEGRO_DISPLAY *display, return true; } -static void hlsl_unuse_shader(ALLEGRO_SHADER *shader, ALLEGRO_DISPLAY *display) +static void hlsl_unuse_shader(A5O_SHADER *shader, A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_D3D *d3d_disp = (ALLEGRO_DISPLAY_D3D *)display; + A5O_DISPLAY_D3D *d3d_disp = (A5O_DISPLAY_D3D *)display; (void)shader; //effect->EndPass(); @@ -365,9 +365,9 @@ static void hlsl_unuse_shader(ALLEGRO_SHADER *shader, ALLEGRO_DISPLAY *display) d3d_disp->effect = NULL; } -static void hlsl_destroy_shader(ALLEGRO_SHADER *shader) +static void hlsl_destroy_shader(A5O_SHADER *shader) { - ALLEGRO_SHADER_HLSL_S *hlsl_shader = (ALLEGRO_SHADER_HLSL_S *)shader; + A5O_SHADER_HLSL_S *hlsl_shader = (A5O_SHADER_HLSL_S *)shader; if (hlsl_shader->hlsl_shader) hlsl_shader->hlsl_shader->Release(); @@ -377,40 +377,40 @@ static void hlsl_destroy_shader(ALLEGRO_SHADER *shader) al_free(shader); } -static void hlsl_on_lost_device(ALLEGRO_SHADER *shader) +static void hlsl_on_lost_device(A5O_SHADER *shader) { - ALLEGRO_SHADER_HLSL_S *hlsl_shader = (ALLEGRO_SHADER_HLSL_S *)shader; + A5O_SHADER_HLSL_S *hlsl_shader = (A5O_SHADER_HLSL_S *)shader; hlsl_shader->hlsl_shader->OnLostDevice(); } -static void hlsl_on_reset_device(ALLEGRO_SHADER *shader) +static void hlsl_on_reset_device(A5O_SHADER *shader) { - ALLEGRO_SHADER_HLSL_S *hlsl_shader = (ALLEGRO_SHADER_HLSL_S *)shader; + A5O_SHADER_HLSL_S *hlsl_shader = (A5O_SHADER_HLSL_S *)shader; hlsl_shader->hlsl_shader->OnResetDevice(); } -static bool hlsl_set_shader_sampler(ALLEGRO_SHADER *shader, - const char *name, ALLEGRO_BITMAP *bitmap, int unit) +static bool hlsl_set_shader_sampler(A5O_SHADER *shader, + const char *name, A5O_BITMAP *bitmap, int unit) { - ALLEGRO_SHADER_HLSL_S *hlsl_shader = (ALLEGRO_SHADER_HLSL_S *)shader; + A5O_SHADER_HLSL_S *hlsl_shader = (A5O_SHADER_HLSL_S *)shader; HRESULT result; - if (al_get_bitmap_flags(bitmap) & ALLEGRO_MEMORY_BITMAP) + if (al_get_bitmap_flags(bitmap) & A5O_MEMORY_BITMAP) return false; LPDIRECT3DTEXTURE9 vid_texture = al_get_d3d_video_texture(bitmap); result = hlsl_shader->hlsl_shader->SetTexture(name, vid_texture); - ALLEGRO_DISPLAY_D3D *d3d_disp = (ALLEGRO_DISPLAY_D3D *)_al_get_bitmap_display(bitmap); + A5O_DISPLAY_D3D *d3d_disp = (A5O_DISPLAY_D3D *)_al_get_bitmap_display(bitmap); d3d_disp->device->SetTexture(unit, vid_texture); _al_set_d3d_sampler_state(d3d_disp->device, unit, bitmap, false); return result == D3D_OK; } -static bool hlsl_set_shader_matrix(ALLEGRO_SHADER *shader, - const char *name, const ALLEGRO_TRANSFORM *matrix) +static bool hlsl_set_shader_matrix(A5O_SHADER *shader, + const char *name, const A5O_TRANSFORM *matrix) { - ALLEGRO_SHADER_HLSL_S *hlsl_shader = (ALLEGRO_SHADER_HLSL_S *)shader; + A5O_SHADER_HLSL_S *hlsl_shader = (A5O_SHADER_HLSL_S *)shader; HRESULT result; D3DXMATRIX m; @@ -422,10 +422,10 @@ static bool hlsl_set_shader_matrix(ALLEGRO_SHADER *shader, return result == D3D_OK; } -static bool hlsl_set_shader_int(ALLEGRO_SHADER *shader, +static bool hlsl_set_shader_int(A5O_SHADER *shader, const char *name, int i) { - ALLEGRO_SHADER_HLSL_S *hlsl_shader = (ALLEGRO_SHADER_HLSL_S *)shader; + A5O_SHADER_HLSL_S *hlsl_shader = (A5O_SHADER_HLSL_S *)shader; HRESULT result; result = hlsl_shader->hlsl_shader->SetInt(name, i); @@ -433,10 +433,10 @@ static bool hlsl_set_shader_int(ALLEGRO_SHADER *shader, return result == D3D_OK; } -static bool hlsl_set_shader_float(ALLEGRO_SHADER *shader, +static bool hlsl_set_shader_float(A5O_SHADER *shader, const char *name, float f) { - ALLEGRO_SHADER_HLSL_S *hlsl_shader = (ALLEGRO_SHADER_HLSL_S *)shader; + A5O_SHADER_HLSL_S *hlsl_shader = (A5O_SHADER_HLSL_S *)shader; HRESULT result; result = hlsl_shader->hlsl_shader->SetFloat(name, f); @@ -444,10 +444,10 @@ static bool hlsl_set_shader_float(ALLEGRO_SHADER *shader, return result == D3D_OK; } -static bool hlsl_set_shader_int_vector(ALLEGRO_SHADER *shader, +static bool hlsl_set_shader_int_vector(A5O_SHADER *shader, const char *name, int num_components, const int *i, int num_elems) { - ALLEGRO_SHADER_HLSL_S *hlsl_shader = (ALLEGRO_SHADER_HLSL_S *)shader; + A5O_SHADER_HLSL_S *hlsl_shader = (A5O_SHADER_HLSL_S *)shader; HRESULT result; result = hlsl_shader->hlsl_shader->SetIntArray(name, i, @@ -456,10 +456,10 @@ static bool hlsl_set_shader_int_vector(ALLEGRO_SHADER *shader, return result == D3D_OK; } -static bool hlsl_set_shader_float_vector(ALLEGRO_SHADER *shader, +static bool hlsl_set_shader_float_vector(A5O_SHADER *shader, const char *name, int num_components, const float *f, int num_elems) { - ALLEGRO_SHADER_HLSL_S *hlsl_shader = (ALLEGRO_SHADER_HLSL_S *)shader; + A5O_SHADER_HLSL_S *hlsl_shader = (A5O_SHADER_HLSL_S *)shader; HRESULT result; result = hlsl_shader->hlsl_shader->SetFloatArray(name, f, @@ -468,10 +468,10 @@ static bool hlsl_set_shader_float_vector(ALLEGRO_SHADER *shader, return result == D3D_OK; } -static bool hlsl_set_shader_bool(ALLEGRO_SHADER *shader, +static bool hlsl_set_shader_bool(A5O_SHADER *shader, const char *name, bool b) { - ALLEGRO_SHADER_HLSL_S *hlsl_shader = (ALLEGRO_SHADER_HLSL_S *)shader; + A5O_SHADER_HLSL_S *hlsl_shader = (A5O_SHADER_HLSL_S *)shader; HRESULT result; result = hlsl_shader->hlsl_shader->SetBool(name, b); @@ -480,16 +480,16 @@ static bool hlsl_set_shader_bool(ALLEGRO_SHADER *shader, } bool _al_hlsl_set_projview_matrix( - LPD3DXEFFECT effect, const ALLEGRO_TRANSFORM *t) + LPD3DXEFFECT effect, const A5O_TRANSFORM *t) { - HRESULT result = effect->SetMatrix(ALLEGRO_SHADER_VAR_PROJVIEW_MATRIX, + HRESULT result = effect->SetMatrix(A5O_SHADER_VAR_PROJVIEW_MATRIX, (LPD3DXMATRIX)t->m); return result == D3D_OK; } void _al_d3d_init_shaders(void) { - _al_vector_init(&shaders, sizeof(ALLEGRO_SHADER *)); + _al_vector_init(&shaders, sizeof(A5O_SHADER *)); } void _al_d3d_shutdown_shaders(void) diff --git a/src/win/wclipboard.c b/src/win/wclipboard.c index 08cc57bd7c..a7ed8803f7 100644 --- a/src/win/wclipboard.c +++ b/src/win/wclipboard.c @@ -35,7 +35,7 @@ #include "allegro5/platform/aintwin.h" -ALLEGRO_DEBUG_CHANNEL("clipboard") +A5O_DEBUG_CHANNEL("clipboard") #ifdef UNICODE #define TEXT_FORMAT CF_UNICODETEXT @@ -45,16 +45,16 @@ ALLEGRO_DEBUG_CHANNEL("clipboard") /* Get any application owned window handle for clipboard association */ -static HWND get_window_handle(ALLEGRO_DISPLAY *display) +static HWND get_window_handle(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *)display; + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *)display; if (!win_display) return NULL; return win_display->window; } -static bool win_set_clipboard_text(ALLEGRO_DISPLAY *display, const char *text) +static bool win_set_clipboard_text(A5O_DISPLAY *display, const char *text) { HWND handle = get_window_handle(display); HANDLE hMem = NULL; @@ -64,7 +64,7 @@ static bool win_set_clipboard_text(ALLEGRO_DISPLAY *display, const char *text) LPTSTR dst; if (!OpenClipboard(handle)) { - ALLEGRO_DEBUG("Could not open clipboard for handle %p", handle); + A5O_DEBUG("Could not open clipboard for handle %p", handle); return false; } @@ -77,7 +77,7 @@ static bool win_set_clipboard_text(ALLEGRO_DISPLAY *display, const char *text) if (!hMem) { al_free(tstr); - ALLEGRO_DEBUG("GlobalAlloc failed to allocate memory for the clipboard data"); + A5O_DEBUG("GlobalAlloc failed to allocate memory for the clipboard data"); return false; } @@ -90,7 +90,7 @@ static bool win_set_clipboard_text(ALLEGRO_DISPLAY *display, const char *text) EmptyClipboard(); if (!SetClipboardData(TEXT_FORMAT, hMem)) { al_free(tstr); - ALLEGRO_DEBUG("Couldn't set clipboard data"); + A5O_DEBUG("Couldn't set clipboard data"); return false; } al_free(tstr); @@ -98,7 +98,7 @@ static bool win_set_clipboard_text(ALLEGRO_DISPLAY *display, const char *text) return true; } -static char *win_get_clipboard_text(ALLEGRO_DISPLAY *display) +static char *win_get_clipboard_text(A5O_DISPLAY *display) { char *text; @@ -114,14 +114,14 @@ static char *win_get_clipboard_text(ALLEGRO_DISPLAY *display) text = _twin_tchar_to_utf8(tstr); GlobalUnlock(hMem); } else { - ALLEGRO_DEBUG("Couldn't get clipboard data"); + A5O_DEBUG("Couldn't get clipboard data"); } CloseClipboard(); } return text; } -static bool win_has_clipboard_text(ALLEGRO_DISPLAY *display) +static bool win_has_clipboard_text(A5O_DISPLAY *display) { if (!IsClipboardFormatAvailable(TEXT_FORMAT)) return false; @@ -133,7 +133,7 @@ static bool win_has_clipboard_text(ALLEGRO_DISPLAY *display) } -void _al_win_add_clipboard_functions(ALLEGRO_DISPLAY_INTERFACE *vt) +void _al_win_add_clipboard_functions(A5O_DISPLAY_INTERFACE *vt) { vt->set_clipboard_text = win_set_clipboard_text; vt->get_clipboard_text = win_get_clipboard_text; diff --git a/src/win/wgl.h b/src/win/wgl.h index c8363e560f..65577e100c 100644 --- a/src/win/wgl.h +++ b/src/win/wgl.h @@ -4,13 +4,13 @@ #include -typedef struct ALLEGRO_DISPLAY_WGL +typedef struct A5O_DISPLAY_WGL { - ALLEGRO_DISPLAY_WIN win_display; /* This must be the first member. */ + A5O_DISPLAY_WIN win_display; /* This must be the first member. */ /* Driver specifics */ HDC dc; HGLRC glrc; -} ALLEGRO_DISPLAY_WGL; +} A5O_DISPLAY_WGL; int _al_win_determine_adapter(void); diff --git a/src/win/wgl_disp.c b/src/win/wgl_disp.c index 94316d0675..21a27e4c15 100644 --- a/src/win/wgl_disp.c +++ b/src/win/wgl_disp.c @@ -40,14 +40,14 @@ #include -ALLEGRO_DEBUG_CHANNEL("display") +A5O_DEBUG_CHANNEL("display") -static ALLEGRO_DISPLAY_INTERFACE vt; +static A5O_DISPLAY_INTERFACE vt; /* Forward declarations: */ static void display_thread_proc(void *arg); -static void destroy_display_internals(ALLEGRO_DISPLAY_WGL *wgl_disp); -static bool wgl_acknowledge_resize(ALLEGRO_DISPLAY *d); +static void destroy_display_internals(A5O_DISPLAY_WGL *wgl_disp); +static bool wgl_acknowledge_resize(A5O_DISPLAY *d); /* Prevents switching to desktop resolution when destroying the display. Used on full screen resize. */ @@ -58,7 +58,7 @@ static bool _wgl_do_not_change_display_mode = false; * they're thread local. We get them in the calling thread first. */ typedef struct WGL_DISPLAY_PARAMETERS { - ALLEGRO_DISPLAY_WGL *display; + A5O_DISPLAY_WGL *display; volatile bool init_failed; HANDLE AckEvent; int window_x, window_y; @@ -66,7 +66,7 @@ typedef struct WGL_DISPLAY_PARAMETERS { const char* window_title; } WGL_DISPLAY_PARAMETERS; -static bool is_wgl_extension_supported(_ALLEGRO_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB, const char *extension, HDC dc) +static bool is_wgl_extension_supported(_A5O_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB, const char *extension, HDC dc) { bool ret = false; const GLubyte* extensions; @@ -106,27 +106,27 @@ static HGLRC init_temp_context(HWND wnd) pf = ChoosePixelFormat(dc, &pfd); if (!pf) { - ALLEGRO_ERROR("Unable to chose a temporary pixel format. %s\n", + A5O_ERROR("Unable to chose a temporary pixel format. %s\n", _al_win_last_error()); return NULL; } memset(&pfd, 0, sizeof(pfd)); if (!SetPixelFormat(dc, pf, &pfd)) { - ALLEGRO_ERROR("Unable to set a temporary pixel format. %s\n", + A5O_ERROR("Unable to set a temporary pixel format. %s\n", _al_win_last_error()); return NULL; } glrc = wglCreateContext(dc); if (!glrc) { - ALLEGRO_ERROR("Unable to create a render context. %s\n", + A5O_ERROR("Unable to create a render context. %s\n", _al_win_last_error()); return NULL; } if (!wglMakeCurrent(dc, glrc)) { - ALLEGRO_ERROR("Unable to set the render context as current. %s\n", + A5O_ERROR("Unable to set the render context as current. %s\n", _al_win_last_error()); wglDeleteContext(glrc); return NULL; @@ -136,8 +136,8 @@ static HGLRC init_temp_context(HWND wnd) } -static _ALLEGRO_wglGetPixelFormatAttribivARB_t _wglGetPixelFormatAttribivARB = NULL; -static _ALLEGRO_wglGetPixelFormatAttribivEXT_t _wglGetPixelFormatAttribivEXT = NULL; +static _A5O_wglGetPixelFormatAttribivARB_t _wglGetPixelFormatAttribivARB = NULL; +static _A5O_wglGetPixelFormatAttribivEXT_t _wglGetPixelFormatAttribivEXT = NULL; static bool init_pixel_format_extensions(void) { @@ -145,12 +145,12 @@ static bool init_pixel_format_extensions(void) * mechanism here, because it hasn't been initialized yet! */ _wglGetPixelFormatAttribivARB = - (_ALLEGRO_wglGetPixelFormatAttribivARB_t)wglGetProcAddress("wglGetPixelFormatAttribivARB"); + (_A5O_wglGetPixelFormatAttribivARB_t)wglGetProcAddress("wglGetPixelFormatAttribivARB"); _wglGetPixelFormatAttribivEXT = - (_ALLEGRO_wglGetPixelFormatAttribivEXT_t)wglGetProcAddress("wglGetPixelFormatAttribivEXT"); + (_A5O_wglGetPixelFormatAttribivEXT_t)wglGetProcAddress("wglGetPixelFormatAttribivEXT"); if (!_wglGetPixelFormatAttribivARB && !_wglGetPixelFormatAttribivEXT) { - ALLEGRO_ERROR("WGL_ARB/EXT_pf not supported.\n"); + A5O_ERROR("WGL_ARB/EXT_pf not supported.\n"); return false; } @@ -158,15 +158,15 @@ static bool init_pixel_format_extensions(void) } -static _ALLEGRO_wglCreateContextAttribsARB_t _wglCreateContextAttribsARB = NULL; +static _A5O_wglCreateContextAttribsARB_t _wglCreateContextAttribsARB = NULL; static bool init_context_creation_extensions(void) { _wglCreateContextAttribsARB = - (_ALLEGRO_wglCreateContextAttribsARB_t)wglGetProcAddress("wglCreateContextAttribsARB"); + (_A5O_wglCreateContextAttribsARB_t)wglGetProcAddress("wglCreateContextAttribsARB"); if (!_wglCreateContextAttribsARB) { - ALLEGRO_ERROR("wglCreateContextAttribs not supported!\n"); + A5O_ERROR("wglCreateContextAttribs not supported!\n"); return false; } @@ -181,7 +181,7 @@ static int get_pixel_formats_count_old(HDC dc) ret = DescribePixelFormat(dc, 1, sizeof(pfd), &pfd); if (!ret) { - ALLEGRO_ERROR("DescribePixelFormat failed! %s\n", + A5O_ERROR("DescribePixelFormat failed! %s\n", _al_win_last_error()); } @@ -197,7 +197,7 @@ static int get_pixel_formats_count_ext(HDC dc) attrib[0] = WGL_NUMBER_PIXEL_FORMATS_ARB; if ((_wglGetPixelFormatAttribivARB(dc, 0, 0, 1, attrib, value) == GL_FALSE) && (_wglGetPixelFormatAttribivEXT(dc, 0, 0, 1, attrib, value) == GL_FALSE)) { - ALLEGRO_ERROR("WGL_ARB/EXT_pixel_format use failed! %s\n", + A5O_ERROR("WGL_ARB/EXT_pixel_format use failed! %s\n", _al_win_last_error()); } @@ -205,213 +205,213 @@ static int get_pixel_formats_count_ext(HDC dc) } -static void display_pixel_format(ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds) +static void display_pixel_format(A5O_EXTRA_DISPLAY_SETTINGS *eds) { - ALLEGRO_INFO("Accelerated: %s\n", eds->settings[ALLEGRO_RENDER_METHOD] ? "yes" : "no"); - ALLEGRO_INFO("Single-buffer: %s\n", eds->settings[ALLEGRO_SINGLE_BUFFER] ? "yes" : "no"); - if (eds->settings[ALLEGRO_SWAP_METHOD] > 0) - ALLEGRO_INFO("Swap method: %s\n", eds->settings[ALLEGRO_SWAP_METHOD] == 2 ? "flip" : "copy"); + A5O_INFO("Accelerated: %s\n", eds->settings[A5O_RENDER_METHOD] ? "yes" : "no"); + A5O_INFO("Single-buffer: %s\n", eds->settings[A5O_SINGLE_BUFFER] ? "yes" : "no"); + if (eds->settings[A5O_SWAP_METHOD] > 0) + A5O_INFO("Swap method: %s\n", eds->settings[A5O_SWAP_METHOD] == 2 ? "flip" : "copy"); else - ALLEGRO_INFO("Swap method: undefined\n"); - ALLEGRO_INFO("Color format: r%i g%i b%i a%i, %i bit\n", - eds->settings[ALLEGRO_RED_SIZE], - eds->settings[ALLEGRO_GREEN_SIZE], - eds->settings[ALLEGRO_BLUE_SIZE], - eds->settings[ALLEGRO_ALPHA_SIZE], - eds->settings[ALLEGRO_COLOR_SIZE]); - ALLEGRO_INFO("Depth buffer: %i bits\n", eds->settings[ALLEGRO_DEPTH_SIZE]); - ALLEGRO_INFO("Sample buffers: %s\n", eds->settings[ALLEGRO_SAMPLE_BUFFERS] ? "yes" : "no"); - ALLEGRO_INFO("Samples: %i\n", eds->settings[ALLEGRO_SAMPLES]); + A5O_INFO("Swap method: undefined\n"); + A5O_INFO("Color format: r%i g%i b%i a%i, %i bit\n", + eds->settings[A5O_RED_SIZE], + eds->settings[A5O_GREEN_SIZE], + eds->settings[A5O_BLUE_SIZE], + eds->settings[A5O_ALPHA_SIZE], + eds->settings[A5O_COLOR_SIZE]); + A5O_INFO("Depth buffer: %i bits\n", eds->settings[A5O_DEPTH_SIZE]); + A5O_INFO("Sample buffers: %s\n", eds->settings[A5O_SAMPLE_BUFFERS] ? "yes" : "no"); + A5O_INFO("Samples: %i\n", eds->settings[A5O_SAMPLES]); } static int decode_pixel_format_old(PIXELFORMATDESCRIPTOR *pfd, - ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds) + A5O_EXTRA_DISPLAY_SETTINGS *eds) { - ALLEGRO_INFO("Decoding:\n"); + A5O_INFO("Decoding:\n"); /* Not interested if it doesn't support OpenGL and RGBA */ if (!(pfd->dwFlags & PFD_SUPPORT_OPENGL)) { - ALLEGRO_INFO("OpenGL Unsupported\n"); + A5O_INFO("OpenGL Unsupported\n"); return false; } if (pfd->iPixelType != PFD_TYPE_RGBA) { - ALLEGRO_INFO("Not RGBA mode\n"); + A5O_INFO("Not RGBA mode\n"); return false; } /* hardware acceleration */ if (((pfd->dwFlags & PFD_GENERIC_ACCELERATED) && (pfd->dwFlags & PFD_GENERIC_FORMAT)) || (!(pfd->dwFlags & PFD_GENERIC_ACCELERATED) && !(pfd->dwFlags & PFD_GENERIC_FORMAT))) - eds->settings[ALLEGRO_RENDER_METHOD] = 1; + eds->settings[A5O_RENDER_METHOD] = 1; else - eds->settings[ALLEGRO_RENDER_METHOD] = 0; + eds->settings[A5O_RENDER_METHOD] = 0; /* Depths of colour buffers */ - eds->settings[ALLEGRO_RED_SIZE] = pfd->cRedBits; - eds->settings[ALLEGRO_GREEN_SIZE] = pfd->cGreenBits; - eds->settings[ALLEGRO_BLUE_SIZE] = pfd->cBlueBits; - eds->settings[ALLEGRO_ALPHA_SIZE] = pfd->cAlphaBits; + eds->settings[A5O_RED_SIZE] = pfd->cRedBits; + eds->settings[A5O_GREEN_SIZE] = pfd->cGreenBits; + eds->settings[A5O_BLUE_SIZE] = pfd->cBlueBits; + eds->settings[A5O_ALPHA_SIZE] = pfd->cAlphaBits; /* Depths of accumulation buffer */ - eds->settings[ALLEGRO_ACC_RED_SIZE] = pfd->cAccumRedBits; - eds->settings[ALLEGRO_ACC_GREEN_SIZE] = pfd->cAccumGreenBits; - eds->settings[ALLEGRO_ACC_BLUE_SIZE] = pfd->cAccumBlueBits; - eds->settings[ALLEGRO_ACC_ALPHA_SIZE] = pfd->cAccumAlphaBits; + eds->settings[A5O_ACC_RED_SIZE] = pfd->cAccumRedBits; + eds->settings[A5O_ACC_GREEN_SIZE] = pfd->cAccumGreenBits; + eds->settings[A5O_ACC_BLUE_SIZE] = pfd->cAccumBlueBits; + eds->settings[A5O_ACC_ALPHA_SIZE] = pfd->cAccumAlphaBits; /* Miscellaneous settings */ - eds->settings[ALLEGRO_SINGLE_BUFFER] = !(pfd->dwFlags & PFD_DOUBLEBUFFER); - eds->settings[ALLEGRO_DEPTH_SIZE] = pfd->cDepthBits; - eds->settings[ALLEGRO_STENCIL_SIZE] = pfd->cStencilBits; - eds->settings[ALLEGRO_COLOR_SIZE] = pfd->cColorBits; - eds->settings[ALLEGRO_STEREO] = pfd->dwFlags & PFD_STEREO; - eds->settings[ALLEGRO_AUX_BUFFERS] = pfd->cAuxBuffers; + eds->settings[A5O_SINGLE_BUFFER] = !(pfd->dwFlags & PFD_DOUBLEBUFFER); + eds->settings[A5O_DEPTH_SIZE] = pfd->cDepthBits; + eds->settings[A5O_STENCIL_SIZE] = pfd->cStencilBits; + eds->settings[A5O_COLOR_SIZE] = pfd->cColorBits; + eds->settings[A5O_STEREO] = pfd->dwFlags & PFD_STEREO; + eds->settings[A5O_AUX_BUFFERS] = pfd->cAuxBuffers; /* These are the component shifts. */ - eds->settings[ALLEGRO_RED_SHIFT] = pfd->cRedShift; - eds->settings[ALLEGRO_GREEN_SHIFT] = pfd->cGreenShift; - eds->settings[ALLEGRO_BLUE_SHIFT] = pfd->cBlueShift; - eds->settings[ALLEGRO_ALPHA_SHIFT] = pfd->cAlphaShift; + eds->settings[A5O_RED_SHIFT] = pfd->cRedShift; + eds->settings[A5O_GREEN_SHIFT] = pfd->cGreenShift; + eds->settings[A5O_BLUE_SHIFT] = pfd->cBlueShift; + eds->settings[A5O_ALPHA_SHIFT] = pfd->cAlphaShift; /* Multisampling isn't supported under Windows if we don't also use * WGL_ARB_pixel_format or WGL_EXT_pixel_format. */ - eds->settings[ALLEGRO_SAMPLE_BUFFERS] = 0; - eds->settings[ALLEGRO_SAMPLES] = 0; + eds->settings[A5O_SAMPLE_BUFFERS] = 0; + eds->settings[A5O_SAMPLES] = 0; /* Swap method can't be detected without WGL_ARB_pixel_format or * WGL_EXT_pixel_format */ - eds->settings[ALLEGRO_SWAP_METHOD] = 0; + eds->settings[A5O_SWAP_METHOD] = 0; /* Float depth/color isn't supported under Windows if we don't also use * AGL_ARB_pixel_format or WGL_EXT_pixel_format. */ - eds->settings[ALLEGRO_FLOAT_COLOR] = 0; - eds->settings[ALLEGRO_FLOAT_DEPTH] = 0; + eds->settings[A5O_FLOAT_COLOR] = 0; + eds->settings[A5O_FLOAT_DEPTH] = 0; // FIXME - eds->settings[ALLEGRO_COMPATIBLE_DISPLAY] = 1; + eds->settings[A5O_COMPATIBLE_DISPLAY] = 1; return true; } -static bool decode_pixel_format_attrib(ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds, int num_attribs, +static bool decode_pixel_format_attrib(A5O_EXTRA_DISPLAY_SETTINGS *eds, int num_attribs, const int *attrib, const int *value) { int i; - ALLEGRO_INFO("Decoding:\n"); + A5O_INFO("Decoding:\n"); - eds->settings[ALLEGRO_SAMPLES] = 0; - eds->settings[ALLEGRO_SAMPLE_BUFFERS] = 0; - eds->settings[ALLEGRO_FLOAT_DEPTH] = 0; - eds->settings[ALLEGRO_FLOAT_COLOR] = 0; - eds->settings[ALLEGRO_COMPATIBLE_DISPLAY] = 1; + eds->settings[A5O_SAMPLES] = 0; + eds->settings[A5O_SAMPLE_BUFFERS] = 0; + eds->settings[A5O_FLOAT_DEPTH] = 0; + eds->settings[A5O_FLOAT_COLOR] = 0; + eds->settings[A5O_COMPATIBLE_DISPLAY] = 1; for (i = 0; i < num_attribs; i++) { /* Not interested if it doesn't support OpenGL or window drawing or RGBA. */ if (attrib[i] == WGL_SUPPORT_OPENGL_ARB && value[i] == 0) { - ALLEGRO_INFO("OpenGL Unsupported\n"); + A5O_INFO("OpenGL Unsupported\n"); return false; } else if (attrib[i] == WGL_DRAW_TO_WINDOW_ARB && value[i] == 0) { - ALLEGRO_INFO("Can't draw to window\n"); + A5O_INFO("Can't draw to window\n"); return false; } else if (attrib[i] == WGL_PIXEL_TYPE_ARB && (value[i] != WGL_TYPE_RGBA_ARB && value[i] != WGL_TYPE_RGBA_FLOAT_ARB)) { - ALLEGRO_INFO("Not RGBA mode\n"); + A5O_INFO("Not RGBA mode\n"); return false; } /* hardware acceleration */ else if (attrib[i] == WGL_ACCELERATION_ARB) { - eds->settings[ALLEGRO_RENDER_METHOD] = (value[i] == WGL_NO_ACCELERATION_ARB) ? 0 : 1; + eds->settings[A5O_RENDER_METHOD] = (value[i] == WGL_NO_ACCELERATION_ARB) ? 0 : 1; } /* Depths of colour buffers */ else if (attrib[i] == WGL_RED_BITS_ARB) { - eds->settings[ALLEGRO_RED_SIZE] = value[i]; + eds->settings[A5O_RED_SIZE] = value[i]; } else if (attrib[i] == WGL_GREEN_BITS_ARB) { - eds->settings[ALLEGRO_GREEN_SIZE] = value[i]; + eds->settings[A5O_GREEN_SIZE] = value[i]; } else if (attrib[i] == WGL_BLUE_BITS_ARB) { - eds->settings[ALLEGRO_BLUE_SIZE] = value[i]; + eds->settings[A5O_BLUE_SIZE] = value[i]; } else if (attrib[i] == WGL_ALPHA_BITS_ARB) { - eds->settings[ALLEGRO_ALPHA_SIZE] = value[i]; + eds->settings[A5O_ALPHA_SIZE] = value[i]; } /* Shift of color components */ else if (attrib[i] == WGL_RED_SHIFT_ARB) { - eds->settings[ALLEGRO_RED_SHIFT] = value[i]; + eds->settings[A5O_RED_SHIFT] = value[i]; } else if (attrib[i] == WGL_GREEN_SHIFT_ARB) { - eds->settings[ALLEGRO_GREEN_SHIFT] = value[i]; + eds->settings[A5O_GREEN_SHIFT] = value[i]; } else if (attrib[i] == WGL_BLUE_SHIFT_ARB) { - eds->settings[ALLEGRO_BLUE_SHIFT] = value[i]; + eds->settings[A5O_BLUE_SHIFT] = value[i]; } else if (attrib[i] == WGL_ALPHA_SHIFT_ARB) { - eds->settings[ALLEGRO_ALPHA_SHIFT] = value[i]; + eds->settings[A5O_ALPHA_SHIFT] = value[i]; } /* Miscellaneous settings */ else if (attrib[i] == WGL_DOUBLE_BUFFER_ARB) { - eds->settings[ALLEGRO_SINGLE_BUFFER] = !(value[i]); + eds->settings[A5O_SINGLE_BUFFER] = !(value[i]); } else if (attrib[i] == WGL_SWAP_METHOD_ARB) { if (value[i] == WGL_SWAP_UNDEFINED_ARB) - eds->settings[ALLEGRO_SWAP_METHOD] = 0; + eds->settings[A5O_SWAP_METHOD] = 0; else if (value[i] == WGL_SWAP_COPY_ARB) - eds->settings[ALLEGRO_SWAP_METHOD] = 1; + eds->settings[A5O_SWAP_METHOD] = 1; else if (value[i] == WGL_SWAP_EXCHANGE_ARB) - eds->settings[ALLEGRO_SWAP_METHOD] = 2; + eds->settings[A5O_SWAP_METHOD] = 2; } else if (attrib[i] == WGL_STEREO_ARB) { - eds->settings[ALLEGRO_STEREO] = value[i]; + eds->settings[A5O_STEREO] = value[i]; } else if (attrib[i] == WGL_AUX_BUFFERS_ARB) { - eds->settings[ALLEGRO_AUX_BUFFERS] = value[i]; + eds->settings[A5O_AUX_BUFFERS] = value[i]; } else if (attrib[i] == WGL_STENCIL_BITS_ARB) { - eds->settings[ALLEGRO_STENCIL_SIZE] = value[i]; + eds->settings[A5O_STENCIL_SIZE] = value[i]; } /* Depths of accumulation buffer */ else if (attrib[i] == WGL_ACCUM_RED_BITS_ARB) { - eds->settings[ALLEGRO_ACC_RED_SIZE] = value[i]; + eds->settings[A5O_ACC_RED_SIZE] = value[i]; } else if (attrib[i] == WGL_ACCUM_GREEN_BITS_ARB) { - eds->settings[ALLEGRO_ACC_GREEN_SIZE] = value[i]; + eds->settings[A5O_ACC_GREEN_SIZE] = value[i]; } else if (attrib[i] == WGL_ACCUM_BLUE_BITS_ARB) { - eds->settings[ALLEGRO_ACC_BLUE_SIZE] = value[i]; + eds->settings[A5O_ACC_BLUE_SIZE] = value[i]; } else if (attrib[i] == WGL_ACCUM_ALPHA_BITS_ARB) { - eds->settings[ALLEGRO_ACC_ALPHA_SIZE] = value[i]; + eds->settings[A5O_ACC_ALPHA_SIZE] = value[i]; } else if (attrib[i] == WGL_DEPTH_BITS_ARB) { - eds->settings[ALLEGRO_DEPTH_SIZE] = value[i]; + eds->settings[A5O_DEPTH_SIZE] = value[i]; } else if (attrib[i] == WGL_COLOR_BITS_ARB) { - eds->settings[ALLEGRO_COLOR_SIZE] = value[i]; + eds->settings[A5O_COLOR_SIZE] = value[i]; } /* Multisampling bits */ else if (attrib[i] == WGL_SAMPLE_BUFFERS_ARB) { - eds->settings[ALLEGRO_SAMPLE_BUFFERS] = value[i]; + eds->settings[A5O_SAMPLE_BUFFERS] = value[i]; } else if (attrib[i] == WGL_SAMPLES_ARB) { - eds->settings[ALLEGRO_SAMPLES] = value[i]; + eds->settings[A5O_SAMPLES] = value[i]; } /* Float color */ if (attrib[i] == WGL_PIXEL_TYPE_ARB && value[i] == WGL_TYPE_RGBA_FLOAT_ARB) { - eds->settings[ALLEGRO_FLOAT_COLOR] = true; + eds->settings[A5O_FLOAT_COLOR] = true; } /* Float depth */ else if (attrib[i] == WGL_DEPTH_FLOAT_EXT) { - eds->settings[ALLEGRO_FLOAT_DEPTH] = value[i]; + eds->settings[A5O_FLOAT_DEPTH] = value[i]; } } @@ -419,15 +419,15 @@ static bool decode_pixel_format_attrib(ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds, int } -static ALLEGRO_EXTRA_DISPLAY_SETTINGS* read_pixel_format_old(int fmt, HDC dc) +static A5O_EXTRA_DISPLAY_SETTINGS* read_pixel_format_old(int fmt, HDC dc) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds = NULL; + A5O_EXTRA_DISPLAY_SETTINGS *eds = NULL; PIXELFORMATDESCRIPTOR pfd; int result; result = DescribePixelFormat(dc, fmt+1, sizeof(pfd), &pfd); if (!result) { - ALLEGRO_WARN("DescribePixelFormat() failed. %s\n", _al_win_last_error()); + A5O_WARN("DescribePixelFormat() failed. %s\n", _al_win_last_error()); return NULL; } @@ -441,9 +441,9 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS* read_pixel_format_old(int fmt, HDC dc) } -static ALLEGRO_EXTRA_DISPLAY_SETTINGS* read_pixel_format_ext(_ALLEGRO_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB, int fmt, HDC dc) +static A5O_EXTRA_DISPLAY_SETTINGS* read_pixel_format_ext(_A5O_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB, int fmt, HDC dc) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds = NULL; + A5O_EXTRA_DISPLAY_SETTINGS *eds = NULL; /* Note: Even though we use te ARB suffix, all those enums are compatible * with EXT_pixel_format. @@ -513,7 +513,7 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS* read_pixel_format_ext(_ALLEGRO_wglGetExte } if (!ret) { - ALLEGRO_ERROR("wglGetPixelFormatAttrib failed! %s\n", _al_win_last_error()); + A5O_ERROR("wglGetPixelFormatAttrib failed! %s\n", _al_win_last_error()); al_free(value); return NULL; } @@ -528,21 +528,21 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS* read_pixel_format_ext(_ALLEGRO_wglGetExte /* Hack: for some reason this happens for me under Wine. */ if (eds && - eds->settings[ALLEGRO_RED_SHIFT] == 0 && - eds->settings[ALLEGRO_GREEN_SHIFT] == 0 && - eds->settings[ALLEGRO_BLUE_SHIFT] == 0 && - eds->settings[ALLEGRO_ALPHA_SHIFT] == 0) { - eds->settings[ALLEGRO_RED_SHIFT] = 0; - eds->settings[ALLEGRO_GREEN_SHIFT] = 8; - eds->settings[ALLEGRO_BLUE_SHIFT] = 16; - eds->settings[ALLEGRO_ALPHA_SHIFT] = 24; + eds->settings[A5O_RED_SHIFT] == 0 && + eds->settings[A5O_GREEN_SHIFT] == 0 && + eds->settings[A5O_BLUE_SHIFT] == 0 && + eds->settings[A5O_ALPHA_SHIFT] == 0) { + eds->settings[A5O_RED_SHIFT] = 0; + eds->settings[A5O_GREEN_SHIFT] = 8; + eds->settings[A5O_BLUE_SHIFT] = 16; + eds->settings[A5O_ALPHA_SHIFT] = 24; } return eds; } -static bool change_display_mode(ALLEGRO_DISPLAY *d) +static bool change_display_mode(A5O_DISPLAY *d) { DEVMODE dm; DEVMODE fallback_dm; @@ -565,7 +565,7 @@ static bool change_display_mode(ALLEGRO_DISPLAY *d) memset(&dm, 0, sizeof(dm)); dm.dmSize = sizeof(DEVMODE); - bpp = d->extra_settings.settings[ALLEGRO_COLOR_SIZE]; + bpp = d->extra_settings.settings[A5O_COLOR_SIZE]; if (!bpp) bpp = 32; @@ -603,7 +603,7 @@ static bool change_display_mode(ALLEGRO_DISPLAY *d) || (dm.dmDisplayFrequency != (unsigned) d->refresh_rate)); if (!modeswitch && !fallback_dm_valid) { - ALLEGRO_ERROR("Mode not found.\n"); + A5O_ERROR("Mode not found.\n"); return false; } @@ -616,11 +616,11 @@ static bool change_display_mode(ALLEGRO_DISPLAY *d) d->refresh_rate = dm.dmDisplayFrequency; if (result != DISP_CHANGE_SUCCESSFUL) { - ALLEGRO_ERROR("Unable to set mode. %s\n", _al_win_last_error()); + A5O_ERROR("Unable to set mode. %s\n", _al_win_last_error()); return false; } - ALLEGRO_INFO("Mode seccessfuly set.\n"); + A5O_INFO("Mode seccessfuly set.\n"); return true; } @@ -646,9 +646,9 @@ static HGLRC init_ogl_context_ex(HDC dc, bool fc, int major, int minor) if (!testrc) goto bail; - _ALLEGRO_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB - = (_ALLEGRO_wglGetExtensionsStringARB_t)wglGetProcAddress("wglGetExtensionsStringARB"); - ALLEGRO_INFO("_wglGetExtensionsStringARB %p\n", _wglGetExtensionsStringARB); + _A5O_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB + = (_A5O_wglGetExtensionsStringARB_t)wglGetProcAddress("wglGetExtensionsStringARB"); + A5O_INFO("_wglGetExtensionsStringARB %p\n", _wglGetExtensionsStringARB); if (is_wgl_extension_supported(_wglGetExtensionsStringARB, "WGL_ARB_create_context", testdc)) { int attrib[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, major, @@ -684,15 +684,15 @@ static HGLRC init_ogl_context_ex(HDC dc, bool fc, int major, int minor) } -static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_available_pixel_formats_ext(int *count) +static A5O_EXTRA_DISPLAY_SETTINGS** get_available_pixel_formats_ext(int *count) { HWND testwnd = NULL; HDC testdc = NULL; HGLRC testrc = NULL; HGLRC old_rc = NULL; HDC old_dc = NULL; - ALLEGRO_EXTRA_DISPLAY_SETTINGS **eds_list = NULL; - ALLEGRO_EXTRA_DISPLAY_SETTINGS *ref; + A5O_EXTRA_DISPLAY_SETTINGS **eds_list = NULL; + A5O_EXTRA_DISPLAY_SETTINGS *ref; int maxindex; int i, j; @@ -714,13 +714,13 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_available_pixel_formats_ext(int *cou if (!testrc) goto bail; - _ALLEGRO_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB - = (_ALLEGRO_wglGetExtensionsStringARB_t)wglGetProcAddress("wglGetExtensionsStringARB"); - ALLEGRO_INFO("_wglGetExtensionsStringARB %p\n", _wglGetExtensionsStringARB); + _A5O_wglGetExtensionsStringARB_t _wglGetExtensionsStringARB + = (_A5O_wglGetExtensionsStringARB_t)wglGetProcAddress("wglGetExtensionsStringARB"); + A5O_INFO("_wglGetExtensionsStringARB %p\n", _wglGetExtensionsStringARB); if (!is_wgl_extension_supported(_wglGetExtensionsStringARB, "WGL_ARB_pixel_format", testdc) && !is_wgl_extension_supported(_wglGetExtensionsStringARB, "WGL_EXT_pixel_format", testdc)) { - ALLEGRO_ERROR("WGL_ARB/EXT_pf not supported.\n"); + A5O_ERROR("WGL_ARB/EXT_pf not supported.\n"); goto bail; } @@ -731,20 +731,20 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_available_pixel_formats_ext(int *cou if (maxindex < 1) goto bail; - ALLEGRO_INFO("Got %i visuals.\n", maxindex); + A5O_INFO("Got %i visuals.\n", maxindex); eds_list = al_calloc(maxindex, sizeof(*eds_list)); if (!eds_list) goto bail; for (j = i = 0; i < maxindex; i++) { - ALLEGRO_INFO("-- \n"); - ALLEGRO_INFO("Decoding visual no. %i...\n", i+1); + A5O_INFO("-- \n"); + A5O_INFO("Decoding visual no. %i...\n", i+1); eds_list[j] = read_pixel_format_ext(_wglGetExtensionsStringARB, i, testdc); if (!eds_list[j]) continue; // Fill vsync setting here and enable/disable it after display creation - eds_list[j]->settings[ALLEGRO_VSYNC] = ref->settings[ALLEGRO_VSYNC]; + eds_list[j]->settings[A5O_VSYNC] = ref->settings[A5O_VSYNC]; display_pixel_format(eds_list[j]); eds_list[j]->score = _al_score_display_settings(eds_list[j], ref); if (eds_list[j]->score == -1) { @@ -757,7 +757,7 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_available_pixel_formats_ext(int *cou j++; } - ALLEGRO_INFO("%i visuals are good enough.\n", j); + A5O_INFO("%i visuals are good enough.\n", j); *count = j; bail: @@ -780,10 +780,10 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_available_pixel_formats_ext(int *cou } -static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_available_pixel_formats_old(int *count, HDC dc) +static A5O_EXTRA_DISPLAY_SETTINGS** get_available_pixel_formats_old(int *count, HDC dc) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS **eds_list = NULL; - ALLEGRO_EXTRA_DISPLAY_SETTINGS *ref; + A5O_EXTRA_DISPLAY_SETTINGS **eds_list = NULL; + A5O_EXTRA_DISPLAY_SETTINGS *ref; int maxindex; int i, j; @@ -794,15 +794,15 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_available_pixel_formats_old(int *cou if (maxindex < 1) return NULL; - ALLEGRO_INFO("Got %i visuals.\n", maxindex); + A5O_INFO("Got %i visuals.\n", maxindex); eds_list = al_calloc(maxindex, sizeof(*eds_list)); if (!eds_list) return NULL; for (j = i = 0; i < maxindex; i++) { - ALLEGRO_INFO("-- \n"); - ALLEGRO_INFO("Decoding visual no. %i...\n", i+1); + A5O_INFO("-- \n"); + A5O_INFO("Decoding visual no. %i...\n", i+1); eds_list[j] = read_pixel_format_old(i, dc); if (!eds_list[j]) continue; @@ -820,17 +820,17 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_available_pixel_formats_old(int *cou j++; } - ALLEGRO_INFO("%i visuals are good enough.\n", j); + A5O_INFO("%i visuals are good enough.\n", j); *count = j; return eds_list; } -static bool select_pixel_format(ALLEGRO_DISPLAY_WGL *d, HDC dc) +static bool select_pixel_format(A5O_DISPLAY_WGL *d, HDC dc) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS **eds = NULL; - ALLEGRO_CONFIG *sys_cfg = al_get_system_config(); + A5O_EXTRA_DISPLAY_SETTINGS **eds = NULL; + A5O_CONFIG *sys_cfg = al_get_system_config(); int eds_count = 0; int i; bool force_old = false; @@ -840,7 +840,7 @@ static bool select_pixel_format(ALLEGRO_DISPLAY_WGL *d, HDC dc) "config_selection"); if (selection_mode && selection_mode[0] != '\0') { if (!_al_stricmp(selection_mode, "old")) { - ALLEGRO_INFO("Forcing OLD visual selection method.\n"); + A5O_INFO("Forcing OLD visual selection method.\n"); force_old = true; } else if (!_al_stricmp(selection_mode, "new")) @@ -853,7 +853,7 @@ static bool select_pixel_format(ALLEGRO_DISPLAY_WGL *d, HDC dc) eds = get_available_pixel_formats_old(&eds_count, dc); if (!eds || !eds_count) { - ALLEGRO_ERROR("Didn't find any suitable pixel format!\n"); + A5O_ERROR("Didn't find any suitable pixel format!\n"); return false; } @@ -861,25 +861,25 @@ static bool select_pixel_format(ALLEGRO_DISPLAY_WGL *d, HDC dc) for (i = 0; i < eds_count ; i++) { if (SetPixelFormat(d->dc, eds[i]->index, NULL)) { - ALLEGRO_INFO("Chose visual no. %i\n\n", eds[i]->index); + A5O_INFO("Chose visual no. %i\n\n", eds[i]->index); display_pixel_format(eds[i]); break; } else { - ALLEGRO_WARN("Unable to set pixel format! %s\n", _al_win_last_error()); - ALLEGRO_WARN("Trying next one.\n"); + A5O_WARN("Unable to set pixel format! %s\n", _al_win_last_error()); + A5O_WARN("Trying next one.\n"); } } if (i == eds_count) { - ALLEGRO_ERROR("Unable to set any pixel format! %s\n", _al_win_last_error()); + A5O_ERROR("Unable to set any pixel format! %s\n", _al_win_last_error()); for (i = 0; i < eds_count; i++) al_free(eds[i]); al_free(eds); return false; } - memcpy(&d->win_display.display.extra_settings, eds[i], sizeof(ALLEGRO_EXTRA_DISPLAY_SETTINGS)); + memcpy(&d->win_display.display.extra_settings, eds[i], sizeof(A5O_EXTRA_DISPLAY_SETTINGS)); for (i = 0; i < eds_count; i++) al_free(eds[i]); @@ -889,10 +889,10 @@ static bool select_pixel_format(ALLEGRO_DISPLAY_WGL *d, HDC dc) return true; } -static bool create_display_internals(ALLEGRO_DISPLAY_WGL *wgl_disp) +static bool create_display_internals(A5O_DISPLAY_WGL *wgl_disp) { - ALLEGRO_DISPLAY *disp = (void*)wgl_disp; - ALLEGRO_DISPLAY_WIN *win_disp = (void*)wgl_disp; + A5O_DISPLAY *disp = (void*)wgl_disp; + A5O_DISPLAY_WIN *win_disp = (void*)wgl_disp; WGL_DISPLAY_PARAMETERS ndp; int window_x, window_y; int major, minor; @@ -924,7 +924,7 @@ static bool create_display_internals(ALLEGRO_DISPLAY_WGL *wgl_disp) CloseHandle(ndp.AckEvent); if (ndp.init_failed) { - ALLEGRO_ERROR("Failed to create display.\n"); + A5O_ERROR("Failed to create display.\n"); return false; } @@ -936,14 +936,14 @@ static bool create_display_internals(ALLEGRO_DISPLAY_WGL *wgl_disp) return false; } - major = al_get_new_display_option(ALLEGRO_OPENGL_MAJOR_VERSION, 0); - minor = al_get_new_display_option(ALLEGRO_OPENGL_MINOR_VERSION, 0); + major = al_get_new_display_option(A5O_OPENGL_MAJOR_VERSION, 0); + minor = al_get_new_display_option(A5O_OPENGL_MINOR_VERSION, 0); // TODO: request GLES context in GLES builds - if ((disp->flags & ALLEGRO_OPENGL_3_0) || major != 0) { + if ((disp->flags & A5O_OPENGL_3_0) || major != 0) { if (major == 0) major = 3; - bool fc = (disp->flags & ALLEGRO_OPENGL_FORWARD_COMPATIBLE) != 0; + bool fc = (disp->flags & A5O_OPENGL_FORWARD_COMPATIBLE) != 0; wgl_disp->glrc = init_ogl_context_ex(wgl_disp->dc, fc, major, minor); } @@ -952,14 +952,14 @@ static bool create_display_internals(ALLEGRO_DISPLAY_WGL *wgl_disp) } if (!wgl_disp->glrc) { - ALLEGRO_ERROR("Unable to create a render context! %s\n", _al_win_last_error()); + A5O_ERROR("Unable to create a render context! %s\n", _al_win_last_error()); destroy_display_internals(wgl_disp); return false; } /* make the context the current one */ if (!wglMakeCurrent(wgl_disp->dc, wgl_disp->glrc)) { - ALLEGRO_ERROR("Unable to make the context current! %s\n", _al_win_last_error()); + A5O_ERROR("Unable to make the context current! %s\n", _al_win_last_error()); destroy_display_internals(wgl_disp); return false; } @@ -967,20 +967,20 @@ static bool create_display_internals(ALLEGRO_DISPLAY_WGL *wgl_disp) _al_ogl_manage_extensions(disp); _al_ogl_set_extensions(disp->ogl_extras->extension_api); - if (disp->ogl_extras->ogl_info.version < _ALLEGRO_OPENGL_VERSION_1_2) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds = _al_get_new_display_settings(); - if (eds->required & (1<ogl_extras->ogl_info.version < _A5O_OPENGL_VERSION_1_2) { + A5O_EXTRA_DISPLAY_SETTINGS *eds = _al_get_new_display_settings(); + if (eds->required & (1<extra_settings.settings[ALLEGRO_COMPATIBLE_DISPLAY] = 0; + disp->extra_settings.settings[A5O_COMPATIBLE_DISPLAY] = 0; } /* Fill in the display settings for opengl major and minor versions...*/ const int v = disp->ogl_extras->ogl_info.version; - disp->extra_settings.settings[ALLEGRO_OPENGL_MAJOR_VERSION] = (v >> 24) & 0xFF; - disp->extra_settings.settings[ALLEGRO_OPENGL_MINOR_VERSION] = (v >> 16) & 0xFF; + disp->extra_settings.settings[A5O_OPENGL_MAJOR_VERSION] = (v >> 24) & 0xFF; + disp->extra_settings.settings[A5O_OPENGL_MINOR_VERSION] = (v >> 16) & 0xFF; /* Try to enable or disable vsync as requested */ /* NOTE: my drivers claim I don't have WGL_EXT_swap_control @@ -988,10 +988,10 @@ static bool create_display_internals(ALLEGRO_DISPLAY_WGL *wgl_disp) * does get loaded, so just check for that. */ if (wglSwapIntervalEXT) { - if (disp->extra_settings.settings[ALLEGRO_VSYNC] == 1) { + if (disp->extra_settings.settings[A5O_VSYNC] == 1) { wglSwapIntervalEXT(1); } - else if (disp->extra_settings.settings[ALLEGRO_VSYNC] == 2) { + else if (disp->extra_settings.settings[A5O_VSYNC] == 2) { wglSwapIntervalEXT(0); } } @@ -1002,21 +1002,21 @@ static bool create_display_internals(ALLEGRO_DISPLAY_WGL *wgl_disp) _al_win_grab_input(win_disp); - if (disp->extra_settings.settings[ALLEGRO_COMPATIBLE_DISPLAY]) + if (disp->extra_settings.settings[A5O_COMPATIBLE_DISPLAY]) _al_ogl_setup_gl(disp); return true; } -static ALLEGRO_DISPLAY* wgl_create_display(int w, int h) +static A5O_DISPLAY* wgl_create_display(int w, int h) { - ALLEGRO_SYSTEM_WIN *system = (ALLEGRO_SYSTEM_WIN *)al_get_system_driver(); - ALLEGRO_DISPLAY_WGL **add; - ALLEGRO_DISPLAY_WGL *wgl_display = al_calloc(1, sizeof *wgl_display); - ALLEGRO_DISPLAY *ogl_display = (void*)wgl_display; - ALLEGRO_DISPLAY *display = (void*)ogl_display; - ALLEGRO_DISPLAY_WIN *win_disp = (ALLEGRO_DISPLAY_WIN *)display; + A5O_SYSTEM_WIN *system = (A5O_SYSTEM_WIN *)al_get_system_driver(); + A5O_DISPLAY_WGL **add; + A5O_DISPLAY_WGL *wgl_display = al_calloc(1, sizeof *wgl_display); + A5O_DISPLAY *ogl_display = (void*)wgl_display; + A5O_DISPLAY *display = (void*)ogl_display; + A5O_DISPLAY_WIN *win_disp = (A5O_DISPLAY_WIN *)display; win_disp->adapter = _al_win_determine_adapter(); @@ -1024,15 +1024,15 @@ static ALLEGRO_DISPLAY* wgl_create_display(int w, int h) display->h = h; display->refresh_rate = al_get_new_display_refresh_rate(); display->flags = al_get_new_display_flags(); -#ifdef ALLEGRO_CFG_OPENGLES2 - display->flags |= ALLEGRO_PROGRAMMABLE_PIPELINE; +#ifdef A5O_CFG_OPENGLES2 + display->flags |= A5O_PROGRAMMABLE_PIPELINE; #endif -#ifdef ALLEGRO_CFG_OPENGLES - display->flags |= ALLEGRO_OPENGL_ES_PROFILE; +#ifdef A5O_CFG_OPENGLES + display->flags |= A5O_OPENGL_ES_PROFILE; #endif display->vt = &vt; - display->ogl_extras = al_calloc(1, sizeof(ALLEGRO_OGL_EXTRAS)); + display->ogl_extras = al_calloc(1, sizeof(A5O_OGL_EXTRAS)); if (!create_display_internals(wgl_display)) { al_free(display->ogl_extras); @@ -1041,9 +1041,9 @@ static ALLEGRO_DISPLAY* wgl_create_display(int w, int h) } /* Print out OpenGL version info */ - ALLEGRO_INFO("OpenGL Version: %s\n", (const char*)glGetString(GL_VERSION)); - ALLEGRO_INFO("Vendor: %s\n", (const char*)glGetString(GL_VENDOR)); - ALLEGRO_INFO("Renderer: %s\n\n", (const char*)glGetString(GL_RENDERER)); + A5O_INFO("OpenGL Version: %s\n", (const char*)glGetString(GL_VERSION)); + A5O_INFO("Vendor: %s\n", (const char*)glGetString(GL_VENDOR)); + A5O_INFO("Renderer: %s\n\n", (const char*)glGetString(GL_RENDERER)); /* Add ourself to the list of displays. */ add = _al_vector_alloc_back(&system->system.displays); @@ -1052,7 +1052,7 @@ static ALLEGRO_DISPLAY* wgl_create_display(int w, int h) /* Each display is an event source. */ _al_event_source_init(&display->es); - _al_win_set_system_mouse_cursor(display, ALLEGRO_SYSTEM_MOUSE_CURSOR_ARROW); + _al_win_set_system_mouse_cursor(display, A5O_SYSTEM_MOUSE_CURSOR_ARROW); _al_win_show_mouse_cursor(display); _al_win_post_create_window(display); @@ -1061,16 +1061,16 @@ static ALLEGRO_DISPLAY* wgl_create_display(int w, int h) } -static void destroy_display_internals(ALLEGRO_DISPLAY_WGL *wgl_disp) +static void destroy_display_internals(A5O_DISPLAY_WGL *wgl_disp) { - ALLEGRO_DISPLAY *disp = (ALLEGRO_DISPLAY *)wgl_disp; - ALLEGRO_DISPLAY_WIN *win_disp = (ALLEGRO_DISPLAY_WIN *)wgl_disp; + A5O_DISPLAY *disp = (A5O_DISPLAY *)wgl_disp; + A5O_DISPLAY_WIN *win_disp = (A5O_DISPLAY_WIN *)wgl_disp; /* We need to convert all our bitmaps to display independent (memory) * bitmaps because WGL driver doesn't support sharing of resources. */ while (disp->bitmaps._size > 0) { - ALLEGRO_BITMAP **bptr = _al_vector_ref_back(&disp->bitmaps); - ALLEGRO_BITMAP *bmp = *bptr; + A5O_BITMAP **bptr = _al_vector_ref_back(&disp->bitmaps); + A5O_BITMAP *bmp = *bptr; _al_convert_to_memory_bitmap(bmp); } @@ -1094,7 +1094,7 @@ static void destroy_display_internals(ALLEGRO_DISPLAY_WGL *wgl_disp) wgl_disp->dc = NULL; } - if (disp->flags & ALLEGRO_FULLSCREEN && !_wgl_do_not_change_display_mode) { + if (disp->flags & A5O_FULLSCREEN && !_wgl_do_not_change_display_mode) { ChangeDisplaySettings(NULL, 0); } @@ -1105,11 +1105,11 @@ static void destroy_display_internals(ALLEGRO_DISPLAY_WGL *wgl_disp) } -static void wgl_destroy_display(ALLEGRO_DISPLAY *disp) +static void wgl_destroy_display(A5O_DISPLAY *disp) { - ALLEGRO_SYSTEM_WIN *system = (ALLEGRO_SYSTEM_WIN *)al_get_system_driver(); - ALLEGRO_DISPLAY_WGL *wgl_disp = (ALLEGRO_DISPLAY_WGL *)disp; - ALLEGRO_DISPLAY *old_disp = al_get_current_display(); + A5O_SYSTEM_WIN *system = (A5O_SYSTEM_WIN *)al_get_system_driver(); + A5O_DISPLAY_WGL *wgl_disp = (A5O_DISPLAY_WGL *)disp; + A5O_DISPLAY *old_disp = al_get_current_display(); if (old_disp != disp) _al_set_current_display_only(disp); @@ -1124,7 +1124,7 @@ static void wgl_destroy_display(ALLEGRO_DISPLAY *disp) _al_vector_find_and_delete(&system->system.displays, &disp); _al_vector_free(&disp->bitmaps); - _al_vector_free(&((ALLEGRO_DISPLAY_WIN*) disp)->msg_callbacks); + _al_vector_free(&((A5O_DISPLAY_WIN*) disp)->msg_callbacks); al_free(disp->ogl_extras); if (old_disp != disp) @@ -1135,9 +1135,9 @@ static void wgl_destroy_display(ALLEGRO_DISPLAY *disp) } -static bool wgl_set_current_display(ALLEGRO_DISPLAY *d) +static bool wgl_set_current_display(A5O_DISPLAY *d) { - ALLEGRO_DISPLAY_WGL *wgl_disp = (ALLEGRO_DISPLAY_WGL *)d; + A5O_DISPLAY_WGL *wgl_disp = (A5O_DISPLAY_WGL *)d; HGLRC current_glrc; current_glrc = wglGetCurrentContext(); @@ -1145,7 +1145,7 @@ static bool wgl_set_current_display(ALLEGRO_DISPLAY *d) if (!current_glrc || (current_glrc && current_glrc != wgl_disp->glrc)) { /* make the context the current one */ if (!wglMakeCurrent(wgl_disp->dc, wgl_disp->glrc)) { - ALLEGRO_ERROR("Unable to make the context current! %s\n", + A5O_ERROR("Unable to make the context current! %s\n", _al_win_last_error()); return false; } @@ -1159,12 +1159,12 @@ static bool wgl_set_current_display(ALLEGRO_DISPLAY *d) } -static void wgl_unset_current_display(ALLEGRO_DISPLAY *d) +static void wgl_unset_current_display(A5O_DISPLAY *d) { (void)d; if (!wglMakeCurrent(NULL, NULL)) { - ALLEGRO_ERROR("Unable unset the current context! %s\n", _al_win_last_error()); + A5O_ERROR("Unable unset the current context! %s\n", _al_win_last_error()); } } @@ -1175,9 +1175,9 @@ static void wgl_unset_current_display(ALLEGRO_DISPLAY *d) static void display_thread_proc(void *arg) { WGL_DISPLAY_PARAMETERS *ndp = arg; - ALLEGRO_DISPLAY *disp = (ALLEGRO_DISPLAY*)ndp->display; - ALLEGRO_DISPLAY_WGL *wgl_disp = (void*)disp; - ALLEGRO_DISPLAY_WIN *win_disp = (void*)disp; + A5O_DISPLAY *disp = (A5O_DISPLAY*)ndp->display; + A5O_DISPLAY_WGL *wgl_disp = (void*)disp; + A5O_DISPLAY_WIN *win_disp = (void*)disp; MSG msg; /* So that we can call the functions using TLS from this thread. */ @@ -1185,7 +1185,7 @@ static void display_thread_proc(void *arg) al_set_new_window_position(ndp->window_x, ndp->window_y); al_set_new_window_title(ndp->window_title); - if (disp->flags & ALLEGRO_FULLSCREEN) { + if (disp->flags & A5O_FULLSCREEN) { if (!change_display_mode(disp)) { win_disp->thread_ended = true; destroy_display_internals(wgl_disp); @@ -1193,8 +1193,8 @@ static void display_thread_proc(void *arg) return; } } - else if (disp->flags & ALLEGRO_FULLSCREEN_WINDOW) { - ALLEGRO_MONITOR_INFO mi; + else if (disp->flags & A5O_FULLSCREEN_WINDOW) { + A5O_MONITOR_INFO mi; int adapter = win_disp->adapter; al_get_monitor_info(adapter, &mi); @@ -1224,8 +1224,8 @@ static void display_thread_proc(void *arg) } /* FIXME: can't _al_win_create_window() do this? */ - if ((disp->flags & ALLEGRO_FULLSCREEN) || - (disp->flags & ALLEGRO_FULLSCREEN_WINDOW)) { + if ((disp->flags & A5O_FULLSCREEN) || + (disp->flags & A5O_FULLSCREEN_WINDOW)) { RECT rect; rect.left = 0; rect.right = disp->w; @@ -1236,7 +1236,7 @@ static void display_thread_proc(void *arg) SWP_NOZORDER | SWP_FRAMECHANGED); } - if (disp->flags & ALLEGRO_FULLSCREEN_WINDOW) { + if (disp->flags & A5O_FULLSCREEN_WINDOW) { _al_win_set_window_frameless(disp, win_disp->window, true); } @@ -1244,7 +1244,7 @@ static void display_thread_proc(void *arg) DWORD lock_time; HWND wnd = win_disp->window; - if ((disp->flags & ALLEGRO_FULLSCREEN) == 0) { + if ((disp->flags & A5O_FULLSCREEN) == 0) { ShowWindow(wnd, SW_SHOWNORMAL); SetForegroundWindow(wnd); UpdateWindow(wnd); @@ -1291,14 +1291,14 @@ static void display_thread_proc(void *arg) } #if 0 - if (disp->flags & ALLEGRO_FULLSCREEN && al_is_mouse_installed()) { + if (disp->flags & A5O_FULLSCREEN && al_is_mouse_installed()) { RAWINPUTDEVICE rid[1]; rid[0].usUsagePage = 0x01; rid[0].usUsage = 0x02; rid[0].dwFlags = RIDEV_NOLEGACY; rid[0].hwndTarget = 0; if (RegisterRawInputDevices(rid, 1, sizeof(rid[0])) == FALSE) { - ALLEGRO_ERROR( + A5O_ERROR( "Failed to init mouse. %s\n", get_error_desc(GetLastError())); } } @@ -1320,28 +1320,28 @@ static void display_thread_proc(void *arg) break; /* WM_QUIT received or error (GetMessage returned -1) */ } - ALLEGRO_INFO("wgl display thread exits\n"); + A5O_INFO("wgl display thread exits\n"); win_disp->thread_ended = true; } -static void wgl_flip_display(ALLEGRO_DISPLAY *d) +static void wgl_flip_display(A5O_DISPLAY *d) { - ALLEGRO_DISPLAY_WGL* disp = (ALLEGRO_DISPLAY_WGL*)d; + A5O_DISPLAY_WGL* disp = (A5O_DISPLAY_WGL*)d; glFlush(); - if (!d->extra_settings.settings[ALLEGRO_SINGLE_BUFFER]) + if (!d->extra_settings.settings[A5O_SINGLE_BUFFER]) SwapBuffers(disp->dc); } -static void wgl_update_display_region(ALLEGRO_DISPLAY *d, +static void wgl_update_display_region(A5O_DISPLAY *d, int x, int y, int width, int height) { - if (al_get_opengl_extension_list()->ALLEGRO_WGL_WIN_swap_hint) { + if (al_get_opengl_extension_list()->A5O_WGL_WIN_swap_hint) { /* FIXME: This is just a driver hint and there is no guarantee that the * contens of the front buffer outside the given rectangle will be preserved, * thus we should really return false here and do nothing. */ - ALLEGRO_DISPLAY_WGL* disp = (ALLEGRO_DISPLAY_WGL*)d; + A5O_DISPLAY_WGL* disp = (A5O_DISPLAY_WGL*)d; wglAddSwapHintRectWIN(x, y, width, height); glFlush(); SwapBuffers(disp->dc); @@ -1351,41 +1351,41 @@ static void wgl_update_display_region(ALLEGRO_DISPLAY *d, } -static bool wgl_resize_helper(ALLEGRO_DISPLAY *d, int width, int height) +static bool wgl_resize_helper(A5O_DISPLAY *d, int width, int height) { - ALLEGRO_DISPLAY_WGL *wgl_disp = (ALLEGRO_DISPLAY_WGL *)d; - ALLEGRO_DISPLAY_WIN *win_disp = (ALLEGRO_DISPLAY_WIN *)d; + A5O_DISPLAY_WGL *wgl_disp = (A5O_DISPLAY_WGL *)d; + A5O_DISPLAY_WIN *win_disp = (A5O_DISPLAY_WIN *)d; int full_w, full_h; - ALLEGRO_MONITOR_INFO mi; + A5O_MONITOR_INFO mi; int adapter = win_disp->adapter; al_get_monitor_info(adapter, &mi); full_w = mi.x2 - mi.x1; full_h = mi.y2 - mi.y1; - if ((d->flags & ALLEGRO_FULLSCREEN_WINDOW) && (full_w != width || full_h != height)) { + if ((d->flags & A5O_FULLSCREEN_WINDOW) && (full_w != width || full_h != height)) { win_disp->toggle_w = width; win_disp->toggle_h = height; return true; } - if (d->flags & ALLEGRO_FULLSCREEN) { - ALLEGRO_BITMAP *target_bmp; + if (d->flags & A5O_FULLSCREEN) { + A5O_BITMAP *target_bmp; _AL_VECTOR disp_bmps; bool was_backbuffer = false; size_t i; target_bmp = al_get_target_bitmap(); if (target_bmp && target_bmp->vt) { - ALLEGRO_BITMAP_EXTRA_OPENGL *extra = target_bmp->parent ? + A5O_BITMAP_EXTRA_OPENGL *extra = target_bmp->parent ? target_bmp->parent->extra : target_bmp->extra; was_backbuffer = extra->is_backbuffer; } /* Remember display bitmaps. */ - _al_vector_init(&disp_bmps, sizeof(ALLEGRO_BITMAP*)); + _al_vector_init(&disp_bmps, sizeof(A5O_BITMAP*)); for (i = 0; i < _al_vector_size(&d->bitmaps); i++) { - ALLEGRO_BITMAP **dis = _al_vector_ref(&d->bitmaps, i); - ALLEGRO_BITMAP **mem = _al_vector_alloc_back(&disp_bmps); + A5O_BITMAP **dis = _al_vector_ref(&d->bitmaps, i); + A5O_BITMAP **mem = _al_vector_alloc_back(&disp_bmps); *mem = *dis; } @@ -1405,7 +1405,7 @@ static bool wgl_resize_helper(ALLEGRO_DISPLAY *d, int width, int height) /* Reupload bitmaps. */ while (_al_vector_is_nonempty(&disp_bmps)) { - ALLEGRO_BITMAP **back = _al_vector_ref_back(&disp_bmps); + A5O_BITMAP **back = _al_vector_ref_back(&disp_bmps); _al_convert_to_display_bitmap(*back); _al_vector_delete_at(&disp_bmps, _al_vector_size(&disp_bmps) - 1); } @@ -1433,7 +1433,7 @@ static bool wgl_resize_helper(ALLEGRO_DISPLAY *d, int width, int height) d->w = width; d->h = height; - if (!(d->flags & ALLEGRO_FULLSCREEN_WINDOW)) { + if (!(d->flags & A5O_FULLSCREEN_WINDOW)) { win_disp->toggle_w = width; win_disp->toggle_h = height; } @@ -1442,9 +1442,9 @@ static bool wgl_resize_helper(ALLEGRO_DISPLAY *d, int width, int height) return true; } -static bool wgl_resize_display(ALLEGRO_DISPLAY *d, int width, int height) +static bool wgl_resize_display(A5O_DISPLAY *d, int width, int height) { - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *)d; + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *)d; int orig_w = d->w; int orig_h = d->h; bool ret; @@ -1464,12 +1464,12 @@ static bool wgl_resize_display(ALLEGRO_DISPLAY *d, int width, int height) return ret; } -static bool wgl_acknowledge_resize(ALLEGRO_DISPLAY *d) +static bool wgl_acknowledge_resize(A5O_DISPLAY *d) { WINDOWINFO wi; - ALLEGRO_DISPLAY_WIN *win_disp = (ALLEGRO_DISPLAY_WIN *)d; + A5O_DISPLAY_WIN *win_disp = (A5O_DISPLAY_WIN *)d; int w, h; - ALLEGRO_STATE state; + A5O_STATE state; wi.cbSize = sizeof(WINDOWINFO); GetWindowInfo(win_disp->window, &wi); @@ -1482,7 +1482,7 @@ static bool wgl_acknowledge_resize(ALLEGRO_DISPLAY *d) _al_ogl_setup_gl(d); _al_ogl_update_render_state(d); - al_store_state(&state, ALLEGRO_STATE_DISPLAY | ALLEGRO_STATE_TARGET_BITMAP); + al_store_state(&state, A5O_STATE_DISPLAY | A5O_STATE_TARGET_BITMAP); al_set_target_backbuffer(d); al_set_clipping_rectangle(0, 0, w, h); al_restore_state(&state); @@ -1491,7 +1491,7 @@ static bool wgl_acknowledge_resize(ALLEGRO_DISPLAY *d) } -static bool wgl_is_compatible_bitmap(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *bitmap) +static bool wgl_is_compatible_bitmap(A5O_DISPLAY *display, A5O_BITMAP *bitmap) { /* Note: WGL driver doesn't support sharing of resources between contexts, * thus all bitmaps are tied to the display which was current at the time @@ -1501,11 +1501,11 @@ static bool wgl_is_compatible_bitmap(ALLEGRO_DISPLAY *display, ALLEGRO_BITMAP *b } -static void wgl_switch_in(ALLEGRO_DISPLAY *display) +static void wgl_switch_in(A5O_DISPLAY *display) { (void)display; /* - ALLEGRO_DISPLAY_WIN *win_disp = (ALLEGRO_DISPLAY_WIN *)display; + A5O_DISPLAY_WIN *win_disp = (A5O_DISPLAY_WIN *)display; if (al_is_mouse_installed()) al_set_mouse_range(win_disp->mouse_range_x1, win_disp->mouse_range_y1, @@ -1514,26 +1514,26 @@ static void wgl_switch_in(ALLEGRO_DISPLAY *display) } -static void wgl_switch_out(ALLEGRO_DISPLAY *display) +static void wgl_switch_out(A5O_DISPLAY *display) { (void)display; } -static void wgl_set_window_position(ALLEGRO_DISPLAY *display, int x, int y) +static void wgl_set_window_position(A5O_DISPLAY *display, int x, int y) { - _al_win_set_window_position(((ALLEGRO_DISPLAY_WIN *)display)->window, x, y); + _al_win_set_window_position(((A5O_DISPLAY_WIN *)display)->window, x, y); } -static void wgl_get_window_position(ALLEGRO_DISPLAY *display, int *x, int *y) +static void wgl_get_window_position(A5O_DISPLAY *display, int *x, int *y) { - _al_win_get_window_position(((ALLEGRO_DISPLAY_WIN *)display)->window, x, y); + _al_win_get_window_position(((A5O_DISPLAY_WIN *)display)->window, x, y); } /* Obtain a reference to this driver. */ -ALLEGRO_DISPLAY_INTERFACE *_al_display_wgl_driver(void) +A5O_DISPLAY_INTERFACE *_al_display_wgl_driver(void) { if (vt.create_display) return &vt; @@ -1600,9 +1600,9 @@ int _al_wgl_get_num_display_modes(int format, int refresh_rate, int flags) } -ALLEGRO_DISPLAY_MODE *_al_wgl_get_display_mode(int index, int format, +A5O_DISPLAY_MODE *_al_wgl_get_display_mode(int index, int format, int refresh_rate, int flags, - ALLEGRO_DISPLAY_MODE *mode) + A5O_DISPLAY_MODE *mode) { DEVMODE dm; @@ -1625,19 +1625,19 @@ ALLEGRO_DISPLAY_MODE *_al_wgl_get_display_mode(int index, int format, mode->format = format; switch (dm.dmBitsPerPel) { case 32: - if (format == ALLEGRO_PIXEL_FORMAT_ANY) - mode->format = ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA; - else if (format == ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA) - mode->format = ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA; + if (format == A5O_PIXEL_FORMAT_ANY) + mode->format = A5O_PIXEL_FORMAT_ANY_32_WITH_ALPHA; + else if (format == A5O_PIXEL_FORMAT_ANY_NO_ALPHA) + mode->format = A5O_PIXEL_FORMAT_ANY_32_NO_ALPHA; break; case 24: - mode->format = ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA; + mode->format = A5O_PIXEL_FORMAT_ANY_24_NO_ALPHA; break; case 16: - if (format == ALLEGRO_PIXEL_FORMAT_ANY) - mode->format = ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA; - else if(format == ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA) - mode->format = ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA; + if (format == A5O_PIXEL_FORMAT_ANY) + mode->format = A5O_PIXEL_FORMAT_ANY_16_WITH_ALPHA; + else if(format == A5O_PIXEL_FORMAT_ANY_NO_ALPHA) + mode->format = A5O_PIXEL_FORMAT_ANY_16_NO_ALPHA; break; default: break; diff --git a/src/win/whapall.c b/src/win/whapall.c index 265f2ea21e..86ed42ace2 100644 --- a/src/win/whapall.c +++ b/src/win/whapall.c @@ -16,7 +16,7 @@ */ -#define ALLEGRO_NO_COMPATIBILITY +#define A5O_NO_COMPATIBILITY #define DIRECTINPUT_VERSION 0x0800 @@ -32,51 +32,51 @@ #include "allegro5/internal/aintern_joystick.h" #include "allegro5/internal/aintern_bitmap.h" -#ifdef ALLEGRO_CFG_XINPUT +#ifdef A5O_CFG_XINPUT /* Don't compile this lot if xinput and directinput isn't supported. */ #include "allegro5/internal/aintern_wjoyall.h" -ALLEGRO_DEBUG_CHANNEL("haptic") +A5O_DEBUG_CHANNEL("haptic") /* forward declarations */ static bool hapall_init_haptic(void); static void hapall_exit_haptic(void); -static bool hapall_is_mouse_haptic(ALLEGRO_MOUSE *dev); -static bool hapall_is_joystick_haptic(ALLEGRO_JOYSTICK *); -static bool hapall_is_keyboard_haptic(ALLEGRO_KEYBOARD *dev); -static bool hapall_is_display_haptic(ALLEGRO_DISPLAY *dev); -static bool hapall_is_touch_input_haptic(ALLEGRO_TOUCH_INPUT *dev); +static bool hapall_is_mouse_haptic(A5O_MOUSE *dev); +static bool hapall_is_joystick_haptic(A5O_JOYSTICK *); +static bool hapall_is_keyboard_haptic(A5O_KEYBOARD *dev); +static bool hapall_is_display_haptic(A5O_DISPLAY *dev); +static bool hapall_is_touch_input_haptic(A5O_TOUCH_INPUT *dev); -static ALLEGRO_HAPTIC *hapall_get_from_mouse(ALLEGRO_MOUSE *dev); -static ALLEGRO_HAPTIC *hapall_get_from_joystick(ALLEGRO_JOYSTICK *dev); -static ALLEGRO_HAPTIC *hapall_get_from_keyboard(ALLEGRO_KEYBOARD *dev); -static ALLEGRO_HAPTIC *hapall_get_from_display(ALLEGRO_DISPLAY *dev); -static ALLEGRO_HAPTIC *hapall_get_from_touch_input(ALLEGRO_TOUCH_INPUT *dev); +static A5O_HAPTIC *hapall_get_from_mouse(A5O_MOUSE *dev); +static A5O_HAPTIC *hapall_get_from_joystick(A5O_JOYSTICK *dev); +static A5O_HAPTIC *hapall_get_from_keyboard(A5O_KEYBOARD *dev); +static A5O_HAPTIC *hapall_get_from_display(A5O_DISPLAY *dev); +static A5O_HAPTIC *hapall_get_from_touch_input(A5O_TOUCH_INPUT *dev); -static bool hapall_release(ALLEGRO_HAPTIC *haptic); +static bool hapall_release(A5O_HAPTIC *haptic); -static bool hapall_get_active(ALLEGRO_HAPTIC *hap); -static int hapall_get_capabilities(ALLEGRO_HAPTIC *dev); -static double hapall_get_gain(ALLEGRO_HAPTIC *dev); -static bool hapall_set_gain(ALLEGRO_HAPTIC *dev, double); -static int hapall_get_max_effects(ALLEGRO_HAPTIC *dev); +static bool hapall_get_active(A5O_HAPTIC *hap); +static int hapall_get_capabilities(A5O_HAPTIC *dev); +static double hapall_get_gain(A5O_HAPTIC *dev); +static bool hapall_set_gain(A5O_HAPTIC *dev, double); +static int hapall_get_max_effects(A5O_HAPTIC *dev); -static bool hapall_is_effect_ok(ALLEGRO_HAPTIC *dev, ALLEGRO_HAPTIC_EFFECT *eff); -static bool hapall_upload_effect(ALLEGRO_HAPTIC *dev, - ALLEGRO_HAPTIC_EFFECT *eff, - ALLEGRO_HAPTIC_EFFECT_ID *id); -static bool hapall_play_effect(ALLEGRO_HAPTIC_EFFECT_ID *id, int loop); -static bool hapall_stop_effect(ALLEGRO_HAPTIC_EFFECT_ID *id); -static bool hapall_is_effect_playing(ALLEGRO_HAPTIC_EFFECT_ID *id); -static bool hapall_release_effect(ALLEGRO_HAPTIC_EFFECT_ID *id); +static bool hapall_is_effect_ok(A5O_HAPTIC *dev, A5O_HAPTIC_EFFECT *eff); +static bool hapall_upload_effect(A5O_HAPTIC *dev, + A5O_HAPTIC_EFFECT *eff, + A5O_HAPTIC_EFFECT_ID *id); +static bool hapall_play_effect(A5O_HAPTIC_EFFECT_ID *id, int loop); +static bool hapall_stop_effect(A5O_HAPTIC_EFFECT_ID *id); +static bool hapall_is_effect_playing(A5O_HAPTIC_EFFECT_ID *id); +static bool hapall_release_effect(A5O_HAPTIC_EFFECT_ID *id); -static double hapall_get_autocenter(ALLEGRO_HAPTIC *dev); -static bool hapall_set_autocenter(ALLEGRO_HAPTIC *dev, double); +static double hapall_get_autocenter(A5O_HAPTIC *dev); +static bool hapall_set_autocenter(A5O_HAPTIC *dev, double); -ALLEGRO_HAPTIC_DRIVER _al_hapdrv_windows_all = +A5O_HAPTIC_DRIVER _al_hapdrv_windows_all = { AL_HAPTIC_TYPE_WINDOWS_ALL, "", @@ -118,7 +118,7 @@ ALLEGRO_HAPTIC_DRIVER _al_hapdrv_windows_all = /* Mutex for thread protection. */ -static ALLEGRO_MUTEX *hapall_mutex = NULL; +static A5O_MUTEX *hapall_mutex = NULL; /* Initializes the combined haptic system. */ @@ -147,20 +147,20 @@ static void hapall_exit_haptic(void) hapall_mutex = NULL; } -static bool hapall_get_active(ALLEGRO_HAPTIC *haptic) +static bool hapall_get_active(A5O_HAPTIC *haptic) { return haptic->driver->get_active(haptic); } -static bool hapall_is_mouse_haptic(ALLEGRO_MOUSE *mouse) +static bool hapall_is_mouse_haptic(A5O_MOUSE *mouse) { (void)mouse; return false; } -static bool hapall_is_joystick_haptic(ALLEGRO_JOYSTICK *joy) +static bool hapall_is_joystick_haptic(A5O_JOYSTICK *joy) { bool dx_ok = false, xi_ok = false; ASSERT(joy->driver); @@ -175,37 +175,37 @@ static bool hapall_is_joystick_haptic(ALLEGRO_JOYSTICK *joy) } -static bool hapall_is_display_haptic(ALLEGRO_DISPLAY *dev) +static bool hapall_is_display_haptic(A5O_DISPLAY *dev) { (void)dev; return false; } -static bool hapall_is_keyboard_haptic(ALLEGRO_KEYBOARD *dev) +static bool hapall_is_keyboard_haptic(A5O_KEYBOARD *dev) { (void)dev; return false; } -static bool hapall_is_touch_input_haptic(ALLEGRO_TOUCH_INPUT *dev) +static bool hapall_is_touch_input_haptic(A5O_TOUCH_INPUT *dev) { (void)dev; return false; } -static ALLEGRO_HAPTIC *hapall_get_from_mouse(ALLEGRO_MOUSE *mouse) +static A5O_HAPTIC *hapall_get_from_mouse(A5O_MOUSE *mouse) { (void)mouse; return NULL; } -static ALLEGRO_HAPTIC *hapall_get_from_joystick(ALLEGRO_JOYSTICK *joy) +static A5O_HAPTIC *hapall_get_from_joystick(A5O_JOYSTICK *joy) { - ALLEGRO_HAPTIC *haptic = NULL; + A5O_HAPTIC *haptic = NULL; if (!al_is_joystick_haptic(joy)) return NULL; @@ -229,108 +229,108 @@ static ALLEGRO_HAPTIC *hapall_get_from_joystick(ALLEGRO_JOYSTICK *joy) } -static ALLEGRO_HAPTIC *hapall_get_from_display(ALLEGRO_DISPLAY *dev) +static A5O_HAPTIC *hapall_get_from_display(A5O_DISPLAY *dev) { (void)dev; return NULL; } -static ALLEGRO_HAPTIC *hapall_get_from_keyboard(ALLEGRO_KEYBOARD *dev) +static A5O_HAPTIC *hapall_get_from_keyboard(A5O_KEYBOARD *dev) { (void)dev; return NULL; } -static ALLEGRO_HAPTIC *hapall_get_from_touch_input(ALLEGRO_TOUCH_INPUT *dev) +static A5O_HAPTIC *hapall_get_from_touch_input(A5O_TOUCH_INPUT *dev) { (void)dev; return NULL; } -static int hapall_get_capabilities(ALLEGRO_HAPTIC *dev) +static int hapall_get_capabilities(A5O_HAPTIC *dev) { return dev->driver->get_capabilities(dev); } -static double hapall_get_gain(ALLEGRO_HAPTIC *dev) +static double hapall_get_gain(A5O_HAPTIC *dev) { return dev->driver->get_gain(dev); } -static bool hapall_set_gain(ALLEGRO_HAPTIC *dev, double gain) +static bool hapall_set_gain(A5O_HAPTIC *dev, double gain) { return dev->driver->set_gain(dev, gain); } -double hapall_get_autocenter(ALLEGRO_HAPTIC *dev) +double hapall_get_autocenter(A5O_HAPTIC *dev) { return dev->driver->get_autocenter(dev); } -static bool hapall_set_autocenter(ALLEGRO_HAPTIC *dev, double intensity) +static bool hapall_set_autocenter(A5O_HAPTIC *dev, double intensity) { return dev->driver->set_autocenter(dev, intensity); } -static int hapall_get_max_effects(ALLEGRO_HAPTIC *dev) +static int hapall_get_max_effects(A5O_HAPTIC *dev) { return dev->driver->get_max_effects(dev); } -static bool hapall_is_effect_ok(ALLEGRO_HAPTIC *dev, - ALLEGRO_HAPTIC_EFFECT *effect) +static bool hapall_is_effect_ok(A5O_HAPTIC *dev, + A5O_HAPTIC_EFFECT *effect) { return dev->driver->is_effect_ok(dev, effect); } -static bool hapall_upload_effect(ALLEGRO_HAPTIC *dev, - ALLEGRO_HAPTIC_EFFECT *effect, ALLEGRO_HAPTIC_EFFECT_ID *id) +static bool hapall_upload_effect(A5O_HAPTIC *dev, + A5O_HAPTIC_EFFECT *effect, A5O_HAPTIC_EFFECT_ID *id) { /* store the driver we'll need it later. */ id->driver = dev->driver; return dev->driver->upload_effect(dev, effect, id); } -static bool hapall_play_effect(ALLEGRO_HAPTIC_EFFECT_ID *id, int loops) +static bool hapall_play_effect(A5O_HAPTIC_EFFECT_ID *id, int loops) { - ALLEGRO_HAPTIC_DRIVER *driver = id->driver; + A5O_HAPTIC_DRIVER *driver = id->driver; /* Use the stored driver to perform the operation. */ return driver->play_effect(id, loops); } -static bool hapall_stop_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) +static bool hapall_stop_effect(A5O_HAPTIC_EFFECT_ID *id) { - ALLEGRO_HAPTIC_DRIVER *driver = id->driver; + A5O_HAPTIC_DRIVER *driver = id->driver; /* Use the stored driver to perform the operation. */ return driver->stop_effect(id); } -static bool hapall_is_effect_playing(ALLEGRO_HAPTIC_EFFECT_ID *id) +static bool hapall_is_effect_playing(A5O_HAPTIC_EFFECT_ID *id) { - ALLEGRO_HAPTIC_DRIVER *driver = id->driver; + A5O_HAPTIC_DRIVER *driver = id->driver; /* Use the stored driver to perform the operation. */ return driver->is_effect_playing(id); } -static bool hapall_release_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) +static bool hapall_release_effect(A5O_HAPTIC_EFFECT_ID *id) { - ALLEGRO_HAPTIC_DRIVER *driver = id->driver; + A5O_HAPTIC_DRIVER *driver = id->driver; /* Use the stored driver to perform the operation. */ return driver->release_effect(id); } -static bool hapall_release(ALLEGRO_HAPTIC *haptic) +static bool hapall_release(A5O_HAPTIC *haptic) { if (!haptic) return false; diff --git a/src/win/whapdrv.c b/src/win/whapdrv.c index 7d803a0c34..bb3b9c7d15 100644 --- a/src/win/whapdrv.c +++ b/src/win/whapdrv.c @@ -21,7 +21,7 @@ #include "allegro5/internal/aintern.h" #include "allegro5/internal/aintern_haptic.h" -#ifndef ALLEGRO_WINDOWS +#ifndef A5O_WINDOWS #error something is wrong with the makefile #endif diff --git a/src/win/whaptic.cpp b/src/win/whaptic.cpp index 8e82c701ef..c96777db84 100644 --- a/src/win/whaptic.cpp +++ b/src/win/whaptic.cpp @@ -17,7 +17,7 @@ -#define ALLEGRO_NO_COMPATIBILITY +#define A5O_NO_COMPATIBILITY #define DIRECTINPUT_VERSION 0x0800 @@ -32,11 +32,11 @@ #include "allegro5/internal/aintern_joystick.h" #include "allegro5/internal/aintern_bitmap.h" -#ifndef ALLEGRO_WINDOWS +#ifndef A5O_WINDOWS #error something is wrong with the makefile #endif -#ifdef ALLEGRO_MINGW32 +#ifdef A5O_MINGW32 #undef MAKEFOURCC #endif @@ -50,7 +50,7 @@ #include "allegro5/internal/aintern_wjoydxnu.h" -ALLEGRO_DEBUG_CHANNEL("whaptic") +A5O_DEBUG_CHANNEL("whaptic") /* Support at most 32 haptic devices. */ #define HAPTICS_MAX 32 @@ -68,13 +68,13 @@ typedef union DIPERIODIC periodic; DICONDITION condition; DICUSTOMFORCE custom; -} ALLEGRO_HAPTIC_PARAMETER_WINDOWS; +} A5O_HAPTIC_PARAMETER_WINDOWS; /* * Haptic effect system data. */ -struct ALLEGRO_HAPTIC_EFFECT_WINDOWS +struct A5O_HAPTIC_EFFECT_WINDOWS { int id; bool active; @@ -83,24 +83,24 @@ struct ALLEGRO_HAPTIC_EFFECT_WINDOWS LPDIRECTINPUTEFFECT ref; DWORD axes[HAPTICS_AXES_MAX]; LONG directions[HAPTICS_AXES_MAX]; - ALLEGRO_HAPTIC_PARAMETER_WINDOWS parameter; + A5O_HAPTIC_PARAMETER_WINDOWS parameter; const GUID* guid; }; -struct ALLEGRO_HAPTIC_WINDOWS +struct A5O_HAPTIC_WINDOWS { - struct ALLEGRO_HAPTIC parent; /* must be first */ + struct A5O_HAPTIC parent; /* must be first */ bool active; LPDIRECTINPUTDEVICE2 device; GUID guid; DIDEVICEINSTANCE instance; DIDEVCAPS capabilities; LPDIRECTINPUTDEVICE8 device8; - ALLEGRO_DISPLAY_WIN* display; + A5O_DISPLAY_WIN* display; int flags; - ALLEGRO_HAPTIC_EFFECT_WINDOWS effects[HAPTICS_EFFECTS_MAX]; + A5O_HAPTIC_EFFECT_WINDOWS effects[HAPTICS_EFFECTS_MAX]; DWORD axes[HAPTICS_AXES_MAX]; int naxes; }; @@ -117,40 +117,40 @@ struct ALLEGRO_HAPTIC_WINDOWS static bool whap_init_haptic(void); static void whap_exit_haptic(void); -static bool whap_is_mouse_haptic(ALLEGRO_MOUSE *dev); -static bool whap_is_joystick_haptic(ALLEGRO_JOYSTICK *); -static bool whap_is_keyboard_haptic(ALLEGRO_KEYBOARD *dev); -static bool whap_is_display_haptic(ALLEGRO_DISPLAY *dev); -static bool whap_is_touch_input_haptic(ALLEGRO_TOUCH_INPUT *dev); - -static ALLEGRO_HAPTIC *whap_get_from_mouse(ALLEGRO_MOUSE *dev); -static ALLEGRO_HAPTIC *whap_get_from_joystick(ALLEGRO_JOYSTICK *dev); -static ALLEGRO_HAPTIC *whap_get_from_keyboard(ALLEGRO_KEYBOARD *dev); -static ALLEGRO_HAPTIC *whap_get_from_display(ALLEGRO_DISPLAY *dev); -static ALLEGRO_HAPTIC *whap_get_from_touch_input(ALLEGRO_TOUCH_INPUT *dev); - -static bool whap_release(ALLEGRO_HAPTIC *haptic); - -static bool whap_get_active(ALLEGRO_HAPTIC *hap); -static int whap_get_capabilities(ALLEGRO_HAPTIC *dev); -static double whap_get_gain(ALLEGRO_HAPTIC *dev); -static bool whap_set_gain(ALLEGRO_HAPTIC *dev, double); -static int whap_get_max_effects(ALLEGRO_HAPTIC *dev); - -static bool whap_is_effect_ok(ALLEGRO_HAPTIC *dev, - ALLEGRO_HAPTIC_EFFECT *eff); -static bool whap_upload_effect(ALLEGRO_HAPTIC *dev, - ALLEGRO_HAPTIC_EFFECT *eff, - ALLEGRO_HAPTIC_EFFECT_ID *id); -static bool whap_play_effect(ALLEGRO_HAPTIC_EFFECT_ID *id, int loop); -static bool whap_stop_effect(ALLEGRO_HAPTIC_EFFECT_ID *id); -static bool whap_is_effect_playing(ALLEGRO_HAPTIC_EFFECT_ID *id); -static bool whap_release_effect(ALLEGRO_HAPTIC_EFFECT_ID *id); - -static double whap_get_autocenter(ALLEGRO_HAPTIC *dev); -static bool whap_set_autocenter(ALLEGRO_HAPTIC *dev, double); - -ALLEGRO_HAPTIC_DRIVER _al_hapdrv_directx = { +static bool whap_is_mouse_haptic(A5O_MOUSE *dev); +static bool whap_is_joystick_haptic(A5O_JOYSTICK *); +static bool whap_is_keyboard_haptic(A5O_KEYBOARD *dev); +static bool whap_is_display_haptic(A5O_DISPLAY *dev); +static bool whap_is_touch_input_haptic(A5O_TOUCH_INPUT *dev); + +static A5O_HAPTIC *whap_get_from_mouse(A5O_MOUSE *dev); +static A5O_HAPTIC *whap_get_from_joystick(A5O_JOYSTICK *dev); +static A5O_HAPTIC *whap_get_from_keyboard(A5O_KEYBOARD *dev); +static A5O_HAPTIC *whap_get_from_display(A5O_DISPLAY *dev); +static A5O_HAPTIC *whap_get_from_touch_input(A5O_TOUCH_INPUT *dev); + +static bool whap_release(A5O_HAPTIC *haptic); + +static bool whap_get_active(A5O_HAPTIC *hap); +static int whap_get_capabilities(A5O_HAPTIC *dev); +static double whap_get_gain(A5O_HAPTIC *dev); +static bool whap_set_gain(A5O_HAPTIC *dev, double); +static int whap_get_max_effects(A5O_HAPTIC *dev); + +static bool whap_is_effect_ok(A5O_HAPTIC *dev, + A5O_HAPTIC_EFFECT *eff); +static bool whap_upload_effect(A5O_HAPTIC *dev, + A5O_HAPTIC_EFFECT *eff, + A5O_HAPTIC_EFFECT_ID *id); +static bool whap_play_effect(A5O_HAPTIC_EFFECT_ID *id, int loop); +static bool whap_stop_effect(A5O_HAPTIC_EFFECT_ID *id); +static bool whap_is_effect_playing(A5O_HAPTIC_EFFECT_ID *id); +static bool whap_release_effect(A5O_HAPTIC_EFFECT_ID *id); + +static double whap_get_autocenter(A5O_HAPTIC *dev); +static bool whap_set_autocenter(A5O_HAPTIC *dev, double); + +A5O_HAPTIC_DRIVER _al_hapdrv_directx = { AL_HAPTIC_TYPE_DIRECTX, "", "", @@ -190,8 +190,8 @@ ALLEGRO_HAPTIC_DRIVER _al_hapdrv_directx = { }; -static ALLEGRO_HAPTIC_WINDOWS haptics[HAPTICS_MAX]; -static ALLEGRO_MUTEX *haptic_mutex = NULL; +static A5O_HAPTIC_WINDOWS haptics[HAPTICS_MAX]; +static A5O_MUTEX *haptic_mutex = NULL; /* Capability map between directinput effects and allegro effect types. */ struct CAP_MAP @@ -208,18 +208,18 @@ DEFINE_PRIVATE_GUID(_al_GUID_None, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); static const struct CAP_MAP cap_map[] = { - { GUID_ConstantForce, ALLEGRO_HAPTIC_CONSTANT }, - { GUID_Spring, ALLEGRO_HAPTIC_SPRING }, - { GUID_Spring, ALLEGRO_HAPTIC_FRICTION }, - { GUID_Damper, ALLEGRO_HAPTIC_DAMPER }, - { GUID_Inertia, ALLEGRO_HAPTIC_INERTIA }, - { GUID_RampForce, ALLEGRO_HAPTIC_RAMP }, - { GUID_Square, ALLEGRO_HAPTIC_SQUARE }, - { GUID_Triangle, ALLEGRO_HAPTIC_TRIANGLE }, - { GUID_Sine, ALLEGRO_HAPTIC_SINE }, - { GUID_SawtoothUp, ALLEGRO_HAPTIC_SAW_UP }, - { GUID_SawtoothDown, ALLEGRO_HAPTIC_SAW_DOWN }, - { GUID_CustomForce, ALLEGRO_HAPTIC_CUSTOM }, + { GUID_ConstantForce, A5O_HAPTIC_CONSTANT }, + { GUID_Spring, A5O_HAPTIC_SPRING }, + { GUID_Spring, A5O_HAPTIC_FRICTION }, + { GUID_Damper, A5O_HAPTIC_DAMPER }, + { GUID_Inertia, A5O_HAPTIC_INERTIA }, + { GUID_RampForce, A5O_HAPTIC_RAMP }, + { GUID_Square, A5O_HAPTIC_SQUARE }, + { GUID_Triangle, A5O_HAPTIC_TRIANGLE }, + { GUID_Sine, A5O_HAPTIC_SINE }, + { GUID_SawtoothUp, A5O_HAPTIC_SAW_UP }, + { GUID_SawtoothDown, A5O_HAPTIC_SAW_DOWN }, + { GUID_CustomForce, A5O_HAPTIC_CUSTOM }, /*{ { _al_GUID_None }, -1 } */ }; @@ -241,7 +241,7 @@ static bool whap_init_haptic(void) } -static ALLEGRO_HAPTIC_WINDOWS *whap_get_available_haptic(void) +static A5O_HAPTIC_WINDOWS *whap_get_available_haptic(void) { int i; @@ -258,10 +258,10 @@ static ALLEGRO_HAPTIC_WINDOWS *whap_get_available_haptic(void) /* Look for a free haptic effect slot for a device and return it, * or NULL if exhausted. Also initializes the effect * reference to NULL. */ -static ALLEGRO_HAPTIC_EFFECT_WINDOWS -*whap_get_available_effect(ALLEGRO_HAPTIC_WINDOWS *whap) +static A5O_HAPTIC_EFFECT_WINDOWS +*whap_get_available_effect(A5O_HAPTIC_WINDOWS *whap) { - ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff; + A5O_HAPTIC_EFFECT_WINDOWS *weff; int i; for (i = 0; i < al_get_max_haptic_effects(&whap->parent); i++) { if (!whap->effects[i].active) { @@ -277,7 +277,7 @@ static ALLEGRO_HAPTIC_EFFECT_WINDOWS /* Releases a windows haptics effect and unloads it from the device. */ -static bool whap_release_effect_windows(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff) +static bool whap_release_effect_windows(A5O_HAPTIC_EFFECT_WINDOWS *weff) { bool result = true; if (!weff) @@ -290,7 +290,7 @@ static bool whap_release_effect_windows(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff) HRESULT ret; ret = IDirectInputEffect_Unload(weff->ref); if (FAILED(ret)) { - ALLEGRO_WARN("Could not unload effect."); + A5O_WARN("Could not unload effect."); result = false; } } @@ -306,9 +306,9 @@ static bool whap_release_effect_windows(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff) /* Converts a generic haptic device to a Windows-specific one. */ -static ALLEGRO_HAPTIC_WINDOWS *whap_from_al(ALLEGRO_HAPTIC *hap) +static A5O_HAPTIC_WINDOWS *whap_from_al(A5O_HAPTIC *hap) { - return (ALLEGRO_HAPTIC_WINDOWS *)hap; + return (A5O_HAPTIC_WINDOWS *)hap; } static void whap_exit_haptic(void) @@ -319,31 +319,31 @@ static void whap_exit_haptic(void) } /* Convert the type of the periodic allegro effect to the windows effect*/ -static bool whap_periodictype2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, - ALLEGRO_HAPTIC_EFFECT *effect) +static bool whap_periodictype2win(A5O_HAPTIC_EFFECT_WINDOWS *weff, + A5O_HAPTIC_EFFECT *effect) { switch (effect->data.periodic.waveform) { - case ALLEGRO_HAPTIC_SINE: + case A5O_HAPTIC_SINE: weff->guid = &GUID_Sine; return true; - case ALLEGRO_HAPTIC_SQUARE: + case A5O_HAPTIC_SQUARE: weff->guid = &GUID_Square; return true; - case ALLEGRO_HAPTIC_TRIANGLE: + case A5O_HAPTIC_TRIANGLE: weff->guid = &GUID_Triangle; return true; - case ALLEGRO_HAPTIC_SAW_UP: + case A5O_HAPTIC_SAW_UP: weff->guid = &GUID_SawtoothUp; return true; - case ALLEGRO_HAPTIC_SAW_DOWN: + case A5O_HAPTIC_SAW_DOWN: weff->guid = &GUID_SawtoothDown; return true; - case ALLEGRO_HAPTIC_CUSTOM: + case A5O_HAPTIC_CUSTOM: weff->guid = &GUID_CustomForce; return true; default: @@ -354,31 +354,31 @@ static bool whap_periodictype2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, /* Convert the type of the allegro effect to the windows effect*/ -static bool whap_type2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, - ALLEGRO_HAPTIC_EFFECT *effect) +static bool whap_type2win(A5O_HAPTIC_EFFECT_WINDOWS *weff, + A5O_HAPTIC_EFFECT *effect) { switch (effect->type) { - case ALLEGRO_HAPTIC_RUMBLE: + case A5O_HAPTIC_RUMBLE: weff->guid = &GUID_Sine; return true; - case ALLEGRO_HAPTIC_PERIODIC: + case A5O_HAPTIC_PERIODIC: return whap_periodictype2win(weff, effect); - case ALLEGRO_HAPTIC_CONSTANT: + case A5O_HAPTIC_CONSTANT: weff->guid = &GUID_ConstantForce; return true; - case ALLEGRO_HAPTIC_SPRING: + case A5O_HAPTIC_SPRING: weff->guid = &GUID_Spring; return true; - case ALLEGRO_HAPTIC_FRICTION: + case A5O_HAPTIC_FRICTION: weff->guid = &GUID_Friction; return true; - case ALLEGRO_HAPTIC_DAMPER: + case A5O_HAPTIC_DAMPER: weff->guid = &GUID_Damper; return true; - case ALLEGRO_HAPTIC_INERTIA: + case A5O_HAPTIC_INERTIA: weff->guid = &GUID_Inertia; return true; - case ALLEGRO_HAPTIC_RAMP: + case A5O_HAPTIC_RAMP: weff->guid = &GUID_RampForce; return true; default: @@ -388,9 +388,9 @@ static bool whap_type2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, } /* Convert the direction of the allegro effect to the windows effect*/ -static bool whap_direction2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, - ALLEGRO_HAPTIC_EFFECT *effect, - ALLEGRO_HAPTIC_WINDOWS *whap) +static bool whap_direction2win(A5O_HAPTIC_EFFECT_WINDOWS *weff, + A5O_HAPTIC_EFFECT *effect, + A5O_HAPTIC_WINDOWS *whap) { unsigned int index; double calc_x, calc_y; @@ -500,8 +500,8 @@ static bool whap_phase2win(DWORD *res, double phase) /* Converts replay data to Widows-compatible data. */ -static bool whap_replay2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, - ALLEGRO_HAPTIC_EFFECT *effect) +static bool whap_replay2win(A5O_HAPTIC_EFFECT_WINDOWS *weff, + A5O_HAPTIC_EFFECT *effect) { return whap_time2win(&weff->effect.dwStartDelay, effect->replay.delay) && whap_time2win(&weff->effect.dwDuration, effect->replay.length); @@ -509,8 +509,8 @@ static bool whap_replay2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, /* Converts an Allegro haptic effect envelope to DirectInput API. */ -static bool whap_envelope2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, - ALLEGRO_HAPTIC_ENVELOPE *aenv) +static bool whap_envelope2win(A5O_HAPTIC_EFFECT_WINDOWS *weff, + A5O_HAPTIC_ENVELOPE *aenv) { /* Prepare envelope. */ DIENVELOPE *wenv = &weff->envelope; @@ -535,8 +535,8 @@ static bool whap_envelope2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, } /* Converts a constant effect to directinput API. */ -static bool whap_constant2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, - ALLEGRO_HAPTIC_EFFECT *effect) +static bool whap_constant2win(A5O_HAPTIC_EFFECT_WINDOWS *weff, + A5O_HAPTIC_EFFECT *effect) { weff->effect.cbTypeSpecificParams = sizeof(weff->parameter.constant); weff->effect.lpvTypeSpecificParams = &weff->parameter.constant; @@ -547,8 +547,8 @@ static bool whap_constant2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, /* Converts a ramp effect to directinput input API. */ -static bool whap_ramp2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, - ALLEGRO_HAPTIC_EFFECT *effect) +static bool whap_ramp2win(A5O_HAPTIC_EFFECT_WINDOWS *weff, + A5O_HAPTIC_EFFECT *effect) { weff->effect.cbTypeSpecificParams = sizeof(weff->parameter.ramp); weff->effect.lpvTypeSpecificParams = &weff->parameter.ramp; @@ -561,8 +561,8 @@ static bool whap_ramp2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, } /* Converts a condition effect to directinput input API. */ -static bool whap_condition2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, - ALLEGRO_HAPTIC_EFFECT *effect) +static bool whap_condition2win(A5O_HAPTIC_EFFECT_WINDOWS *weff, + A5O_HAPTIC_EFFECT *effect) { weff->effect.cbTypeSpecificParams = sizeof(weff->parameter.condition); weff->effect.lpvTypeSpecificParams = &weff->parameter.condition; @@ -583,8 +583,8 @@ static bool whap_condition2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, } /* Converts a custom effect to directinput input API. */ -static bool whap_custom2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, - ALLEGRO_HAPTIC_EFFECT *effect) +static bool whap_custom2win(A5O_HAPTIC_EFFECT_WINDOWS *weff, + A5O_HAPTIC_EFFECT *effect) { int index; weff->effect.cbTypeSpecificParams = sizeof(weff->parameter.custom); @@ -607,10 +607,10 @@ static bool whap_custom2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, /* Converts a periodic effect to directinput input API. */ -static bool whap_periodic2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, - ALLEGRO_HAPTIC_EFFECT *effect) +static bool whap_periodic2win(A5O_HAPTIC_EFFECT_WINDOWS *weff, + A5O_HAPTIC_EFFECT *effect) { - if (effect->data.periodic.waveform == ALLEGRO_HAPTIC_CUSTOM) { + if (effect->data.periodic.waveform == A5O_HAPTIC_CUSTOM) { return whap_custom2win(weff, effect); } @@ -630,8 +630,8 @@ static bool whap_periodic2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, /* Converts a periodic effect to directinput input API. */ -static bool whap_rumble2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, - ALLEGRO_HAPTIC_EFFECT *effect) +static bool whap_rumble2win(A5O_HAPTIC_EFFECT_WINDOWS *weff, + A5O_HAPTIC_EFFECT *effect) { weff->effect.cbTypeSpecificParams = sizeof(weff->parameter.periodic); weff->effect.lpvTypeSpecificParams = &weff->parameter.periodic; @@ -644,9 +644,9 @@ static bool whap_rumble2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, } /* Converts Allegro haptic effect to dinput API. */ -static bool whap_effect2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, - ALLEGRO_HAPTIC_EFFECT *effect, - ALLEGRO_HAPTIC_WINDOWS *whap) +static bool whap_effect2win(A5O_HAPTIC_EFFECT_WINDOWS *weff, + A5O_HAPTIC_EFFECT *effect, + A5O_HAPTIC_WINDOWS *whap) { /* Generic setup */ memset((void *)weff, 0, sizeof(*weff)); @@ -676,27 +676,27 @@ static bool whap_effect2win(ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, switch (effect->type) { - case ALLEGRO_HAPTIC_RUMBLE: + case A5O_HAPTIC_RUMBLE: return whap_rumble2win(weff, effect); - case ALLEGRO_HAPTIC_PERIODIC: + case A5O_HAPTIC_PERIODIC: return whap_periodic2win(weff, effect); - case ALLEGRO_HAPTIC_CONSTANT: + case A5O_HAPTIC_CONSTANT: return whap_constant2win(weff, effect); - case ALLEGRO_HAPTIC_RAMP: + case A5O_HAPTIC_RAMP: return whap_ramp2win(weff, effect); - case ALLEGRO_HAPTIC_SPRING: - case ALLEGRO_HAPTIC_FRICTION: - case ALLEGRO_HAPTIC_DAMPER: - case ALLEGRO_HAPTIC_INERTIA: + case A5O_HAPTIC_SPRING: + case A5O_HAPTIC_FRICTION: + case A5O_HAPTIC_DAMPER: + case A5O_HAPTIC_INERTIA: return whap_condition2win(weff, effect); default: return false; } } -static bool whap_get_active(ALLEGRO_HAPTIC *haptic) +static bool whap_get_active(A5O_HAPTIC *haptic) { - ALLEGRO_HAPTIC_WINDOWS *whap = whap_from_al(haptic); + A5O_HAPTIC_WINDOWS *whap = whap_from_al(haptic); return whap->active; } @@ -706,65 +706,65 @@ static bool whap_is_dinput_device_haptic(LPDIRECTINPUTDEVICE2 device) HRESULT ret; DIDEVCAPS dicaps; /* Get capabilities. */ - ALLEGRO_DEBUG("IDirectInputDevice_GetCapabilities on %p\n", device); + A5O_DEBUG("IDirectInputDevice_GetCapabilities on %p\n", device); dicaps.dwSize = sizeof(dicaps); ret = IDirectInputDevice_GetCapabilities(device, &dicaps); if (FAILED(ret)) { - ALLEGRO_ERROR("IDirectInputDevice_GetCapabilities failed on %p\n", + A5O_ERROR("IDirectInputDevice_GetCapabilities failed on %p\n", device); return false; } /** Is it a haptic device? */ bool ishaptic = (dicaps.dwFlags & DIDC_FORCEFEEDBACK); - ALLEGRO_DEBUG("dicaps.dwFlags: %lu, %d, %d\n", dicaps.dwFlags, + A5O_DEBUG("dicaps.dwFlags: %lu, %d, %d\n", dicaps.dwFlags, DIDC_FORCEFEEDBACK, ishaptic); return(ishaptic); } -static bool whap_is_mouse_haptic(ALLEGRO_MOUSE *mouse) +static bool whap_is_mouse_haptic(A5O_MOUSE *mouse) { (void)mouse; return false; } -static bool whap_is_joystick_haptic(ALLEGRO_JOYSTICK *joy) +static bool whap_is_joystick_haptic(A5O_JOYSTICK *joy) { - ALLEGRO_JOYSTICK_DIRECTX *joydx = (ALLEGRO_JOYSTICK_DIRECTX *)joy; + A5O_JOYSTICK_DIRECTX *joydx = (A5O_JOYSTICK_DIRECTX *)joy; (void)joydx; if (!al_is_joystick_installed()) return false; if (!al_get_joystick_active(joy)) return false; - ALLEGRO_DEBUG("Checking capabilities of joystick %s\n", joydx->name); + A5O_DEBUG("Checking capabilities of joystick %s\n", joydx->name); return whap_is_dinput_device_haptic(joydx->device); } -static bool whap_is_display_haptic(ALLEGRO_DISPLAY *dev) +static bool whap_is_display_haptic(A5O_DISPLAY *dev) { (void)dev; return false; } -static bool whap_is_keyboard_haptic(ALLEGRO_KEYBOARD *dev) +static bool whap_is_keyboard_haptic(A5O_KEYBOARD *dev) { (void)dev; return false; } -static bool whap_is_touch_input_haptic(ALLEGRO_TOUCH_INPUT *dev) +static bool whap_is_touch_input_haptic(A5O_TOUCH_INPUT *dev) { (void)dev; return false; } -static ALLEGRO_HAPTIC *whap_get_from_mouse(ALLEGRO_MOUSE *mouse) +static A5O_HAPTIC *whap_get_from_mouse(A5O_MOUSE *mouse) { (void)mouse; return NULL; @@ -825,8 +825,8 @@ static bool whap_set_dinput_device_autocenter(LPDIRECTINPUTDEVICE2 device, static BOOL CALLBACK whap_check_effect_callback(LPCDIEFFECTINFO info, LPVOID data) { - ALLEGRO_HAPTIC *haptic = (ALLEGRO_HAPTIC *)data; - ALLEGRO_HAPTIC_WINDOWS *whap = whap_from_al(haptic); + A5O_HAPTIC *haptic = (A5O_HAPTIC *)data; + A5O_HAPTIC_WINDOWS *whap = whap_from_al(haptic); const CAP_MAP *map; for (map = cap_map; map->allegro_bit != -1; map++) { @@ -843,8 +843,8 @@ whap_check_effect_callback(LPCDIEFFECTINFO info, LPVOID data) static BOOL CALLBACK whap_check_axes_callback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID data) { - ALLEGRO_HAPTIC *haptic = (ALLEGRO_HAPTIC *)data; - ALLEGRO_HAPTIC_WINDOWS *whap = whap_from_al(haptic); + A5O_HAPTIC *haptic = (A5O_HAPTIC *)data; + A5O_HAPTIC_WINDOWS *whap = whap_from_al(haptic); if ((dev->dwType & DIDFT_AXIS) && (dev->dwFlags & DIDOI_FFACTUATOR)) { whap->axes[whap->naxes] = dev->dwOfs; @@ -859,22 +859,22 @@ whap_check_axes_callback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID data) } /* Acquires an exclusive lock on the device. */ -static bool whap_acquire_lock(ALLEGRO_HAPTIC_WINDOWS *whap) +static bool whap_acquire_lock(A5O_HAPTIC_WINDOWS *whap) { HRESULT ret; /* Release previous acquire lock on device if any */ ret = IDirectInputDevice_Unacquire(whap->device); if (FAILED(ret)) { - ALLEGRO_WARN + A5O_WARN ("IDirectInputDevice_Unacquire failed for haptic device.\n"); return false; } /* Need a display to lock the cooperative level of the haptic device on */ - whap->display = (ALLEGRO_DISPLAY_WIN *)al_get_current_display(); + whap->display = (A5O_DISPLAY_WIN *)al_get_current_display(); if (!whap->display) { - ALLEGRO_WARN("No active window available to lock the haptic device on."); + A5O_WARN("No active window available to lock the haptic device on."); return false; } @@ -886,7 +886,7 @@ static bool whap_acquire_lock(ALLEGRO_HAPTIC_WINDOWS *whap) DISCL_BACKGROUND | DISCL_EXCLUSIVE); if (FAILED(ret)) { - ALLEGRO_WARN + A5O_WARN ("IDirectInputDevice_SetCooperativeLevel failed for haptic device.\n"); return false; } @@ -894,7 +894,7 @@ static bool whap_acquire_lock(ALLEGRO_HAPTIC_WINDOWS *whap) /* Get acquire lock on device */ ret = IDirectInputDevice_Acquire(whap->device); if (FAILED(ret)) { - ALLEGRO_WARN("IDirectInputDevice_Acquire failed for haptic device.\n"); + A5O_WARN("IDirectInputDevice_Acquire failed for haptic device.\n"); return false; } return true; @@ -902,10 +902,10 @@ static bool whap_acquire_lock(ALLEGRO_HAPTIC_WINDOWS *whap) /* Initializes the haptic device for use with DirectInput */ -static bool whap_initialize_dinput(ALLEGRO_HAPTIC_WINDOWS *whap) +static bool whap_initialize_dinput(A5O_HAPTIC_WINDOWS *whap) { HRESULT ret; - ALLEGRO_HAPTIC *haptic = &whap->parent; + A5O_HAPTIC *haptic = &whap->parent; /* Set number of axes to zero, and then ... */ whap->naxes = 0; /* ... get number of axes. */ @@ -913,7 +913,7 @@ static bool whap_initialize_dinput(ALLEGRO_HAPTIC_WINDOWS *whap) whap_check_axes_callback, haptic, DIDFT_AXIS); if (FAILED(ret)) { - ALLEGRO_WARN("Could not get haptic device axes \n"); + A5O_WARN("Could not get haptic device axes \n"); return false; } @@ -922,26 +922,26 @@ static bool whap_initialize_dinput(ALLEGRO_HAPTIC_WINDOWS *whap) * supported. */ if (whap->naxes >= 1) { - whap->flags |= ALLEGRO_HAPTIC_ANGLE; - whap->flags |= ALLEGRO_HAPTIC_RADIUS; + whap->flags |= A5O_HAPTIC_ANGLE; + whap->flags |= A5O_HAPTIC_RADIUS; } if (!whap_acquire_lock(whap)) { - ALLEGRO_WARN("Could not lock haptic device \n"); + A5O_WARN("Could not lock haptic device \n"); return false; } /* Reset all actuators in case some where active */ ret = IDirectInputDevice8_SendForceFeedbackCommand(whap->device, DISFFC_RESET); if (FAILED(ret)) { - ALLEGRO_WARN("Could not reset haptic device \n"); + A5O_WARN("Could not reset haptic device \n"); } /* Enable all actuators. */ ret = IDirectInputDevice8_SendForceFeedbackCommand(whap->device, DISFFC_SETACTUATORSON); if (FAILED(ret)) { - ALLEGRO_WARN("Could not enable haptic device actuators\n"); + A5O_WARN("Could not enable haptic device actuators\n"); return false; } @@ -950,30 +950,30 @@ static bool whap_initialize_dinput(ALLEGRO_HAPTIC_WINDOWS *whap) whap_check_effect_callback, haptic, DIEFT_ALL); if (FAILED(ret)) { - ALLEGRO_WARN("Could not get haptic device supported effects\n"); + A5O_WARN("Could not get haptic device supported effects\n"); return false; } /* Check if any periodic effects are supported. */ - bool periodic_ok = al_is_haptic_capable(haptic, ALLEGRO_HAPTIC_SINE); - periodic_ok |= al_is_haptic_capable(haptic, ALLEGRO_HAPTIC_SQUARE); - periodic_ok |= al_is_haptic_capable(haptic, ALLEGRO_HAPTIC_TRIANGLE); - periodic_ok |= al_is_haptic_capable(haptic, ALLEGRO_HAPTIC_SAW_DOWN); - periodic_ok |= al_is_haptic_capable(haptic, ALLEGRO_HAPTIC_SAW_UP); + bool periodic_ok = al_is_haptic_capable(haptic, A5O_HAPTIC_SINE); + periodic_ok |= al_is_haptic_capable(haptic, A5O_HAPTIC_SQUARE); + periodic_ok |= al_is_haptic_capable(haptic, A5O_HAPTIC_TRIANGLE); + periodic_ok |= al_is_haptic_capable(haptic, A5O_HAPTIC_SAW_DOWN); + periodic_ok |= al_is_haptic_capable(haptic, A5O_HAPTIC_SAW_UP); if (periodic_ok) { /* If we have any of the effects above, we can use periodic and rumble effects. */ - whap->flags |= (ALLEGRO_HAPTIC_PERIODIC | ALLEGRO_HAPTIC_RUMBLE); + whap->flags |= (A5O_HAPTIC_PERIODIC | A5O_HAPTIC_RUMBLE); } if (whap_set_dinput_device_gain(whap->device, 1.0)) { - whap->flags |= ALLEGRO_HAPTIC_GAIN; + whap->flags |= A5O_HAPTIC_GAIN; } /* Check autocenter and turn it off in one go. */ if (whap_set_dinput_device_autocenter(whap->device, 0.0)) { - whap->flags |= ALLEGRO_HAPTIC_AUTOCENTER; + whap->flags |= A5O_HAPTIC_AUTOCENTER; } return true; @@ -982,10 +982,10 @@ static bool whap_initialize_dinput(ALLEGRO_HAPTIC_WINDOWS *whap) -static ALLEGRO_HAPTIC *whap_get_from_joystick(ALLEGRO_JOYSTICK *joy) +static A5O_HAPTIC *whap_get_from_joystick(A5O_JOYSTICK *joy) { - ALLEGRO_JOYSTICK_DIRECTX *joydx = (ALLEGRO_JOYSTICK_DIRECTX *)joy; - ALLEGRO_HAPTIC_WINDOWS *whap; + A5O_JOYSTICK_DIRECTX *joydx = (A5O_JOYSTICK_DIRECTX *)joy; + A5O_HAPTIC_WINDOWS *whap; int i; @@ -1027,45 +1027,45 @@ static ALLEGRO_HAPTIC *whap_get_from_joystick(ALLEGRO_JOYSTICK *joy) } -static ALLEGRO_HAPTIC *whap_get_from_display(ALLEGRO_DISPLAY *dev) +static A5O_HAPTIC *whap_get_from_display(A5O_DISPLAY *dev) { (void)dev; return NULL; } -static ALLEGRO_HAPTIC *whap_get_from_keyboard(ALLEGRO_KEYBOARD *dev) +static A5O_HAPTIC *whap_get_from_keyboard(A5O_KEYBOARD *dev) { (void)dev; return NULL; } -static ALLEGRO_HAPTIC *whap_get_from_touch_input(ALLEGRO_TOUCH_INPUT *dev) +static A5O_HAPTIC *whap_get_from_touch_input(A5O_TOUCH_INPUT *dev) { (void)dev; return NULL; } -static int whap_get_capabilities(ALLEGRO_HAPTIC *dev) +static int whap_get_capabilities(A5O_HAPTIC *dev) { - ALLEGRO_HAPTIC_WINDOWS *whap = whap_from_al(dev); + A5O_HAPTIC_WINDOWS *whap = whap_from_al(dev); return whap->flags; } -static double whap_get_gain(ALLEGRO_HAPTIC *dev) +static double whap_get_gain(A5O_HAPTIC *dev) { - ALLEGRO_HAPTIC_WINDOWS *whap = whap_from_al(dev); + A5O_HAPTIC_WINDOWS *whap = whap_from_al(dev); /* Just return the stored gain, it's easier than querying. */ return whap->parent.gain; } -static bool whap_set_gain(ALLEGRO_HAPTIC *dev, double gain) +static bool whap_set_gain(A5O_HAPTIC *dev, double gain) { - ALLEGRO_HAPTIC_WINDOWS *whap = whap_from_al(dev); + A5O_HAPTIC_WINDOWS *whap = whap_from_al(dev); bool ok = whap_set_dinput_device_gain(whap->device, gain); if (ok) { whap->parent.gain = gain; @@ -1077,17 +1077,17 @@ static bool whap_set_gain(ALLEGRO_HAPTIC *dev, double gain) } -double whap_get_autocenter(ALLEGRO_HAPTIC *dev) +double whap_get_autocenter(A5O_HAPTIC *dev) { - ALLEGRO_HAPTIC_WINDOWS *whap = whap_from_al(dev); + A5O_HAPTIC_WINDOWS *whap = whap_from_al(dev); /* Return the stored autocenter value. It's easiest like that. */ return whap->parent.autocenter; } -static bool whap_set_autocenter(ALLEGRO_HAPTIC *dev, double intensity) +static bool whap_set_autocenter(A5O_HAPTIC *dev, double intensity) { - ALLEGRO_HAPTIC_WINDOWS *whap = whap_from_al(dev); + A5O_HAPTIC_WINDOWS *whap = whap_from_al(dev); bool ok = whap_set_dinput_device_autocenter(whap->device, intensity); if (ok) { whap->parent.autocenter = intensity; @@ -1098,9 +1098,9 @@ static bool whap_set_autocenter(ALLEGRO_HAPTIC *dev, double intensity) return ok; } -static int whap_get_max_effects(ALLEGRO_HAPTIC *dev) +static int whap_get_max_effects(A5O_HAPTIC *dev) { - ALLEGRO_HAPTIC_WINDOWS *whap = whap_from_al(dev); + A5O_HAPTIC_WINDOWS *whap = whap_from_al(dev); int n_effects; (void)n_effects, (void)whap; @@ -1108,8 +1108,8 @@ static int whap_get_max_effects(ALLEGRO_HAPTIC *dev) } -static bool whap_is_effect_ok(ALLEGRO_HAPTIC *haptic, - ALLEGRO_HAPTIC_EFFECT *effect) +static bool whap_is_effect_ok(A5O_HAPTIC *haptic, + A5O_HAPTIC_EFFECT *effect) { int caps; @@ -1185,23 +1185,23 @@ static void warn_on_error(HRESULT hr) struct dinput_error_pair *pair = dinput_errors; while (pair->text) { if (hr == pair->error) { - ALLEGRO_WARN("HRESULT error: %s\n", pair->text); + A5O_WARN("HRESULT error: %s\n", pair->text); } pair++; } - ALLEGRO_WARN("Unknown HRESULT error: %u\n", (unsigned int)hr); + A5O_WARN("Unknown HRESULT error: %u\n", (unsigned int)hr); } static bool whap_upload_effect_helper - (ALLEGRO_HAPTIC_WINDOWS *whap, - ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff, ALLEGRO_HAPTIC_EFFECT *effect) + (A5O_HAPTIC_WINDOWS *whap, + A5O_HAPTIC_EFFECT_WINDOWS *weff, A5O_HAPTIC_EFFECT *effect) { HRESULT ret; if (!whap_effect2win(weff, effect, whap)) { - ALLEGRO_WARN("Could not convert haptic effect.\n"); + A5O_WARN("Could not convert haptic effect.\n"); return false; } @@ -1215,7 +1215,7 @@ static bool whap_upload_effect_helper * The better way would be to fix this in that driver somehow. */ if (!whap_acquire_lock(whap)) { - ALLEGRO_WARN("Could not lock haptic device.\n"); + A5O_WARN("Could not lock haptic device.\n"); return false; } @@ -1225,7 +1225,7 @@ static bool whap_upload_effect_helper &weff->effect, &weff->ref, NULL); if (FAILED(ret)) { - ALLEGRO_WARN("Could not create haptic effect.\n"); + A5O_WARN("Could not create haptic effect.\n"); warn_on_error(ret); return false; } @@ -1233,7 +1233,7 @@ static bool whap_upload_effect_helper /* Upload the effect to the device. */ ret = IDirectInputEffect_Download(weff->ref); if (FAILED(ret)) { - ALLEGRO_WARN("Could not upload haptic effect.\n"); + A5O_WARN("Could not upload haptic effect.\n"); warn_on_error(ret); return false; } @@ -1241,13 +1241,13 @@ static bool whap_upload_effect_helper return true; } -static bool whap_upload_effect(ALLEGRO_HAPTIC *dev, - ALLEGRO_HAPTIC_EFFECT *effect, - ALLEGRO_HAPTIC_EFFECT_ID *id) +static bool whap_upload_effect(A5O_HAPTIC *dev, + A5O_HAPTIC_EFFECT *effect, + A5O_HAPTIC_EFFECT_ID *id) { bool ok = FALSE; - ALLEGRO_HAPTIC_WINDOWS *whap = whap_from_al(dev); - ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff = NULL; + A5O_HAPTIC_WINDOWS *whap = whap_from_al(dev); + A5O_HAPTIC_EFFECT_WINDOWS *weff = NULL; ASSERT(dev); ASSERT(id); @@ -1277,11 +1277,11 @@ static bool whap_upload_effect(ALLEGRO_HAPTIC *dev, ok = true; } else { - ALLEGRO_WARN("Could not upload effect."); + A5O_WARN("Could not upload effect."); } } else { - ALLEGRO_WARN("No free effect slot."); + A5O_WARN("No free effect slot."); } al_unlock_mutex(haptic_mutex); @@ -1289,11 +1289,11 @@ static bool whap_upload_effect(ALLEGRO_HAPTIC *dev, } -static bool whap_play_effect(ALLEGRO_HAPTIC_EFFECT_ID *id, int loops) +static bool whap_play_effect(A5O_HAPTIC_EFFECT_ID *id, int loops) { HRESULT res; - ALLEGRO_HAPTIC_WINDOWS *whap = (ALLEGRO_HAPTIC_WINDOWS *)id->_haptic; - ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff; + A5O_HAPTIC_WINDOWS *whap = (A5O_HAPTIC_WINDOWS *)id->_haptic; + A5O_HAPTIC_EFFECT_WINDOWS *weff; if ((!whap) || (id->_id < 0)) return false; weff = whap->effects + id->_id; @@ -1303,13 +1303,13 @@ static bool whap_play_effect(ALLEGRO_HAPTIC_EFFECT_ID *id, int loops) * The better way would be to fix this in that driver somehow. */ if (!whap_acquire_lock(whap)) { - ALLEGRO_WARN("Could not lock haptic device \n"); + A5O_WARN("Could not lock haptic device \n"); return false; } res = IDirectInputEffect_Start(weff->ref, loops, 0); if (FAILED(res)) { - ALLEGRO_WARN("Failed to play an effect."); + A5O_WARN("Failed to play an effect."); warn_on_error(res); return false; } @@ -1321,11 +1321,11 @@ static bool whap_play_effect(ALLEGRO_HAPTIC_EFFECT_ID *id, int loops) } -static bool whap_stop_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) +static bool whap_stop_effect(A5O_HAPTIC_EFFECT_ID *id) { HRESULT res; - ALLEGRO_HAPTIC_WINDOWS *whap = (ALLEGRO_HAPTIC_WINDOWS *)id->_haptic; - ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff; + A5O_HAPTIC_WINDOWS *whap = (A5O_HAPTIC_WINDOWS *)id->_haptic; + A5O_HAPTIC_EFFECT_WINDOWS *weff; if ((!whap) || (id->_id < 0)) return false; @@ -1334,7 +1334,7 @@ static bool whap_stop_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) res = IDirectInputEffect_Stop(weff->ref); if (FAILED(res)) { - ALLEGRO_WARN("Failed to play an effect."); + A5O_WARN("Failed to play an effect."); return false; } id->_playing = false; @@ -1344,13 +1344,13 @@ static bool whap_stop_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) } -static bool whap_is_effect_playing(ALLEGRO_HAPTIC_EFFECT_ID *id) +static bool whap_is_effect_playing(A5O_HAPTIC_EFFECT_ID *id) { ASSERT(id); HRESULT res; DWORD flags = 0; - ALLEGRO_HAPTIC_WINDOWS *whap = (ALLEGRO_HAPTIC_WINDOWS *)id->_haptic; - ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff; + A5O_HAPTIC_WINDOWS *whap = (A5O_HAPTIC_WINDOWS *)id->_haptic; + A5O_HAPTIC_EFFECT_WINDOWS *weff; if ((!whap) || (id->_id < 0) || (!id->_playing)) return false; @@ -1359,7 +1359,7 @@ static bool whap_is_effect_playing(ALLEGRO_HAPTIC_EFFECT_ID *id) res = IDirectInputEffect_GetEffectStatus(weff->ref, &flags); if (FAILED(res)) { - ALLEGRO_WARN("Failed to get the status of effect."); + A5O_WARN("Failed to get the status of effect."); /* If we get here, then use the play time in stead to * see if the effect should still be playing. * Do this because in case GeteffectStatus fails, we can't @@ -1383,10 +1383,10 @@ static bool whap_is_effect_playing(ALLEGRO_HAPTIC_EFFECT_ID *id) -static bool whap_release_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) +static bool whap_release_effect(A5O_HAPTIC_EFFECT_ID *id) { - ALLEGRO_HAPTIC_WINDOWS *whap = (ALLEGRO_HAPTIC_WINDOWS *)id->_haptic; - ALLEGRO_HAPTIC_EFFECT_WINDOWS *weff; + A5O_HAPTIC_WINDOWS *whap = (A5O_HAPTIC_WINDOWS *)id->_haptic; + A5O_HAPTIC_EFFECT_WINDOWS *weff; if ((!whap) || (id->_id < 0)) return false; @@ -1397,9 +1397,9 @@ static bool whap_release_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) } -static bool whap_release(ALLEGRO_HAPTIC *haptic) +static bool whap_release(A5O_HAPTIC *haptic) { - ALLEGRO_HAPTIC_WINDOWS *whap = whap_from_al(haptic); + A5O_HAPTIC_WINDOWS *whap = whap_from_al(haptic); int index; HRESULT res; @@ -1424,7 +1424,7 @@ static bool whap_release(ALLEGRO_HAPTIC *haptic) DISCL_FOREGROUND | DISCL_NONEXCLUSIVE); if (FAILED(res)) { - ALLEGRO_WARN + A5O_WARN ("IDirectInputDevice8_SetCooperativeLevel NONEXCLUSIVE failed for haptic device.\n"); } diff --git a/src/win/whapxi.c b/src/win/whapxi.c index 2993272166..523f6caf48 100644 --- a/src/win/whapxi.c +++ b/src/win/whapxi.c @@ -16,7 +16,7 @@ */ -#define ALLEGRO_NO_COMPATIBILITY +#define A5O_NO_COMPATIBILITY #define DIRECTINPUT_VERSION 0x0800 @@ -32,18 +32,18 @@ #include "allegro5/internal/aintern_joystick.h" #include "allegro5/internal/aintern_bitmap.h" -#ifdef ALLEGRO_CFG_XINPUT +#ifdef A5O_CFG_XINPUT /* Don't compile this lot if xinput isn't supported. */ -#ifndef ALLEGRO_WINDOWS +#ifndef A5O_WINDOWS #error something is wrong with the makefile #endif -#ifndef ALLEGRO_XINPUT_POLL_DELAY -#define ALLEGRO_XINPUT_POLL_DELAY 0.1 +#ifndef A5O_XINPUT_POLL_DELAY +#define A5O_XINPUT_POLL_DELAY 0.1 #endif -#ifdef ALLEGRO_MINGW32 +#ifdef A5O_MINGW32 #undef MAKEFOURCC #endif @@ -60,7 +60,7 @@ * for the best. * This does no harm on msys2 either, they have a sal.h header. */ -#ifdef ALLEGRO_HAVE_SAL_H +#ifdef A5O_HAVE_SAL_H #include #endif @@ -70,7 +70,7 @@ -ALLEGRO_DEBUG_CHANNEL("haptic") +A5O_DEBUG_CHANNEL("haptic") /* Support at most 4 haptic devices. */ #define HAPTICS_MAX 4 @@ -83,15 +83,15 @@ ALLEGRO_DEBUG_CHANNEL("haptic") * finite state machine. */ -typedef enum ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE +typedef enum A5O_HAPTIC_EFFECT_XINPUT_STATE { - ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_INACTIVE = 0, - ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_READY = 1, - ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_STARTING = 2, - ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_PLAYING = 3, - ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_DELAYED = 4, - ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_STOPPING = 5, -} ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE; + A5O_HAPTIC_EFFECT_XINPUT_STATE_INACTIVE = 0, + A5O_HAPTIC_EFFECT_XINPUT_STATE_READY = 1, + A5O_HAPTIC_EFFECT_XINPUT_STATE_STARTING = 2, + A5O_HAPTIC_EFFECT_XINPUT_STATE_PLAYING = 3, + A5O_HAPTIC_EFFECT_XINPUT_STATE_DELAYED = 4, + A5O_HAPTIC_EFFECT_XINPUT_STATE_STOPPING = 5, +} A5O_HAPTIC_EFFECT_XINPUT_STATE; /* Allowed state transitions: * from inactive to ready, @@ -103,9 +103,9 @@ typedef enum ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE * from ready to inactive */ -typedef struct ALLEGRO_HAPTIC_EFFECT_XINPUT +typedef struct A5O_HAPTIC_EFFECT_XINPUT { - ALLEGRO_HAPTIC_EFFECT effect; + A5O_HAPTIC_EFFECT effect; XINPUT_VIBRATION vibration; int id; double start_time; @@ -114,62 +114,62 @@ typedef struct ALLEGRO_HAPTIC_EFFECT_XINPUT int repeats; int delay_repeated; int play_repeated; - ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE state; -} ALLEGRO_HAPTIC_EFFECT_XINPUT; + A5O_HAPTIC_EFFECT_XINPUT_STATE state; +} A5O_HAPTIC_EFFECT_XINPUT; -typedef struct ALLEGRO_HAPTIC_XINPUT +typedef struct A5O_HAPTIC_XINPUT { /* Important, parent must be first. */ - ALLEGRO_HAPTIC parent; - ALLEGRO_JOYSTICK_XINPUT *xjoy; + A5O_HAPTIC parent; + A5O_JOYSTICK_XINPUT *xjoy; bool active; - ALLEGRO_HAPTIC_EFFECT_XINPUT effect; + A5O_HAPTIC_EFFECT_XINPUT effect; int flags; /* Only one effect is supported since the XInput API allows only one pair of vibration speeds to be set to the device. */ -} ALLEGRO_HAPTIC_XINPUT; +} A5O_HAPTIC_XINPUT; /* forward declarations */ static bool hapxi_init_haptic(void); static void hapxi_exit_haptic(void); -static bool hapxi_is_mouse_haptic(ALLEGRO_MOUSE *dev); -static bool hapxi_is_joystick_haptic(ALLEGRO_JOYSTICK *); -static bool hapxi_is_keyboard_haptic(ALLEGRO_KEYBOARD *dev); -static bool hapxi_is_display_haptic(ALLEGRO_DISPLAY *dev); -static bool hapxi_is_touch_input_haptic(ALLEGRO_TOUCH_INPUT *dev); +static bool hapxi_is_mouse_haptic(A5O_MOUSE *dev); +static bool hapxi_is_joystick_haptic(A5O_JOYSTICK *); +static bool hapxi_is_keyboard_haptic(A5O_KEYBOARD *dev); +static bool hapxi_is_display_haptic(A5O_DISPLAY *dev); +static bool hapxi_is_touch_input_haptic(A5O_TOUCH_INPUT *dev); -static ALLEGRO_HAPTIC *hapxi_get_from_mouse(ALLEGRO_MOUSE *dev); -static ALLEGRO_HAPTIC *hapxi_get_from_joystick(ALLEGRO_JOYSTICK *dev); -static ALLEGRO_HAPTIC *hapxi_get_from_keyboard(ALLEGRO_KEYBOARD *dev); -static ALLEGRO_HAPTIC *hapxi_get_from_display(ALLEGRO_DISPLAY *dev); -static ALLEGRO_HAPTIC *hapxi_get_from_touch_input(ALLEGRO_TOUCH_INPUT *dev); +static A5O_HAPTIC *hapxi_get_from_mouse(A5O_MOUSE *dev); +static A5O_HAPTIC *hapxi_get_from_joystick(A5O_JOYSTICK *dev); +static A5O_HAPTIC *hapxi_get_from_keyboard(A5O_KEYBOARD *dev); +static A5O_HAPTIC *hapxi_get_from_display(A5O_DISPLAY *dev); +static A5O_HAPTIC *hapxi_get_from_touch_input(A5O_TOUCH_INPUT *dev); -static bool hapxi_release(ALLEGRO_HAPTIC *haptic); +static bool hapxi_release(A5O_HAPTIC *haptic); -static bool hapxi_get_active(ALLEGRO_HAPTIC *hap); -static int hapxi_get_capabilities(ALLEGRO_HAPTIC *dev); -static double hapxi_get_gain(ALLEGRO_HAPTIC *dev); -static bool hapxi_set_gain(ALLEGRO_HAPTIC *dev, double); -static int hapxi_get_max_effects(ALLEGRO_HAPTIC *dev); +static bool hapxi_get_active(A5O_HAPTIC *hap); +static int hapxi_get_capabilities(A5O_HAPTIC *dev); +static double hapxi_get_gain(A5O_HAPTIC *dev); +static bool hapxi_set_gain(A5O_HAPTIC *dev, double); +static int hapxi_get_max_effects(A5O_HAPTIC *dev); -static bool hapxi_is_effect_ok(ALLEGRO_HAPTIC *dev, ALLEGRO_HAPTIC_EFFECT *eff); -static bool hapxi_upload_effect(ALLEGRO_HAPTIC *dev, - ALLEGRO_HAPTIC_EFFECT *eff, - ALLEGRO_HAPTIC_EFFECT_ID *id); -static bool hapxi_play_effect(ALLEGRO_HAPTIC_EFFECT_ID *id, int loop); -static bool hapxi_stop_effect(ALLEGRO_HAPTIC_EFFECT_ID *id); -static bool hapxi_is_effect_playing(ALLEGRO_HAPTIC_EFFECT_ID *id); -static bool hapxi_release_effect(ALLEGRO_HAPTIC_EFFECT_ID *id); +static bool hapxi_is_effect_ok(A5O_HAPTIC *dev, A5O_HAPTIC_EFFECT *eff); +static bool hapxi_upload_effect(A5O_HAPTIC *dev, + A5O_HAPTIC_EFFECT *eff, + A5O_HAPTIC_EFFECT_ID *id); +static bool hapxi_play_effect(A5O_HAPTIC_EFFECT_ID *id, int loop); +static bool hapxi_stop_effect(A5O_HAPTIC_EFFECT_ID *id); +static bool hapxi_is_effect_playing(A5O_HAPTIC_EFFECT_ID *id); +static bool hapxi_release_effect(A5O_HAPTIC_EFFECT_ID *id); -static double hapxi_get_autocenter(ALLEGRO_HAPTIC *dev); -static bool hapxi_set_autocenter(ALLEGRO_HAPTIC *dev, double); +static double hapxi_get_autocenter(A5O_HAPTIC *dev); +static bool hapxi_set_autocenter(A5O_HAPTIC *dev, double); -static void *hapxi_poll_thread(ALLEGRO_THREAD *thread, void *arg); +static void *hapxi_poll_thread(A5O_THREAD *thread, void *arg); -ALLEGRO_HAPTIC_DRIVER _al_hapdrv_xinput = +A5O_HAPTIC_DRIVER _al_hapdrv_xinput = { AL_HAPTIC_TYPE_XINPUT, "", @@ -210,73 +210,73 @@ ALLEGRO_HAPTIC_DRIVER _al_hapdrv_xinput = }; -static ALLEGRO_HAPTIC_XINPUT haptics[HAPTICS_MAX]; +static A5O_HAPTIC_XINPUT haptics[HAPTICS_MAX]; /* For the background thread */ -static ALLEGRO_THREAD *hapxi_thread = NULL; -static ALLEGRO_MUTEX *hapxi_mutex = NULL; +static A5O_THREAD *hapxi_thread = NULL; +static A5O_MUTEX *hapxi_mutex = NULL; /* Use a condition variable to put the thread to sleep and prevent too frequent polling. */ -static ALLEGRO_COND *hapxi_cond = NULL; +static A5O_COND *hapxi_cond = NULL; typedef DWORD(WINAPI *XInputSetStatePROC)(DWORD, XINPUT_VIBRATION*); extern XInputSetStatePROC _al_imp_XInputSetState; /* Forces vibration to stop immediately. */ -static bool hapxi_force_stop(ALLEGRO_HAPTIC_XINPUT *hapxi, - ALLEGRO_HAPTIC_EFFECT_XINPUT *effxi) +static bool hapxi_force_stop(A5O_HAPTIC_XINPUT *hapxi, + A5O_HAPTIC_EFFECT_XINPUT *effxi) { XINPUT_VIBRATION no_vibration = { 0, 0 }; - ALLEGRO_DEBUG("XInput haptic effect stopped.\n"); + A5O_DEBUG("XInput haptic effect stopped.\n"); _al_imp_XInputSetState(hapxi->xjoy->index, &no_vibration); - effxi->state = ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_READY; + effxi->state = A5O_HAPTIC_EFFECT_XINPUT_STATE_READY; return true; } /* starts vibration immediately. If successfully also sets playing */ -static bool hapxi_force_play(ALLEGRO_HAPTIC_XINPUT *hapxi, - ALLEGRO_HAPTIC_EFFECT_XINPUT *effxi) +static bool hapxi_force_play(A5O_HAPTIC_XINPUT *hapxi, + A5O_HAPTIC_EFFECT_XINPUT *effxi) { DWORD res; res = _al_imp_XInputSetState(hapxi->xjoy->index, &effxi->vibration); - ALLEGRO_DEBUG("Starting to play back haptic effect: %d.\n", (int)(res)); + A5O_DEBUG("Starting to play back haptic effect: %d.\n", (int)(res)); if (res == ERROR_SUCCESS) { - effxi->state = ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_PLAYING; + effxi->state = A5O_HAPTIC_EFFECT_XINPUT_STATE_PLAYING; return true; } else { - effxi->state = ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_READY; + effxi->state = A5O_HAPTIC_EFFECT_XINPUT_STATE_READY; return false; } } -static bool hapxi_poll_haptic_effect_ready(ALLEGRO_HAPTIC_XINPUT *hapxi, - ALLEGRO_HAPTIC_EFFECT_XINPUT *effxi) +static bool hapxi_poll_haptic_effect_ready(A5O_HAPTIC_XINPUT *hapxi, + A5O_HAPTIC_EFFECT_XINPUT *effxi) { (void)hapxi; (void)effxi; /* when ready do nothing */ return true; } -static bool hapxi_poll_haptic_effect_starting(ALLEGRO_HAPTIC_XINPUT *hapxi, - ALLEGRO_HAPTIC_EFFECT_XINPUT *effxi) +static bool hapxi_poll_haptic_effect_starting(A5O_HAPTIC_XINPUT *hapxi, + A5O_HAPTIC_EFFECT_XINPUT *effxi) { /* when starting switch to delayed mode or play mode */ double now = al_get_time(); if ((now - effxi->start_time) < effxi->effect.replay.delay) { effxi->loop_start = al_get_time(); - effxi->state = ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_DELAYED; + effxi->state = A5O_HAPTIC_EFFECT_XINPUT_STATE_DELAYED; } else { hapxi_force_play(hapxi, effxi); } - ALLEGRO_DEBUG("Polling XInput haptic effect. Really Starting: %d!\n", effxi->state); + A5O_DEBUG("Polling XInput haptic effect. Really Starting: %d!\n", effxi->state); return true; } -static bool hapxi_poll_haptic_effect_playing(ALLEGRO_HAPTIC_XINPUT *hapxi, - ALLEGRO_HAPTIC_EFFECT_XINPUT *effxi) +static bool hapxi_poll_haptic_effect_playing(A5O_HAPTIC_XINPUT *hapxi, + A5O_HAPTIC_EFFECT_XINPUT *effxi) { double now = al_get_time(); double stop = effxi->loop_start + effxi->effect.replay.delay + @@ -288,19 +288,19 @@ static bool hapxi_poll_haptic_effect_playing(ALLEGRO_HAPTIC_XINPUT *hapxi, if (effxi->play_repeated < effxi->repeats) { /* need to play another loop. Stop playing now. */ hapxi_force_stop(hapxi, effxi); - effxi->state = ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_DELAYED; + effxi->state = A5O_HAPTIC_EFFECT_XINPUT_STATE_DELAYED; effxi->loop_start = al_get_time(); } else { - effxi->state = ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_STOPPING; + effxi->state = A5O_HAPTIC_EFFECT_XINPUT_STATE_STOPPING; } return true; } return false; } -static bool hapxi_poll_haptic_effect_delayed(ALLEGRO_HAPTIC_XINPUT *hapxi, - ALLEGRO_HAPTIC_EFFECT_XINPUT *effxi) +static bool hapxi_poll_haptic_effect_delayed(A5O_HAPTIC_XINPUT *hapxi, + A5O_HAPTIC_EFFECT_XINPUT *effxi) { double now = al_get_time(); if (now > (effxi->loop_start + effxi->effect.replay.delay)) { @@ -309,8 +309,8 @@ static bool hapxi_poll_haptic_effect_delayed(ALLEGRO_HAPTIC_XINPUT *hapxi, return false; } -static bool hapxi_poll_haptic_effect_stopping(ALLEGRO_HAPTIC_XINPUT *hapxi, - ALLEGRO_HAPTIC_EFFECT_XINPUT *effxi) +static bool hapxi_poll_haptic_effect_stopping(A5O_HAPTIC_XINPUT *hapxi, + A5O_HAPTIC_EFFECT_XINPUT *effxi) { /* when stopping, force stop and go to ready state (hapxi_force_stop does this)*/ return hapxi_force_stop(hapxi, effxi); @@ -318,31 +318,31 @@ static bool hapxi_poll_haptic_effect_stopping(ALLEGRO_HAPTIC_XINPUT *hapxi, /* Polls the xinput API for a single haptic device and effect. */ -static bool hapxi_poll_haptic_effect(ALLEGRO_HAPTIC_XINPUT *hapxi, - ALLEGRO_HAPTIC_EFFECT_XINPUT *effxi) +static bool hapxi_poll_haptic_effect(A5O_HAPTIC_XINPUT *hapxi, + A5O_HAPTIC_EFFECT_XINPUT *effxi) { /* Check the state of the effect. */ switch (effxi->state) { - case ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_INACTIVE: + case A5O_HAPTIC_EFFECT_XINPUT_STATE_INACTIVE: return false; - case ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_READY: + case A5O_HAPTIC_EFFECT_XINPUT_STATE_READY: return hapxi_poll_haptic_effect_ready(hapxi, effxi); - case ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_STARTING: + case A5O_HAPTIC_EFFECT_XINPUT_STATE_STARTING: return hapxi_poll_haptic_effect_starting(hapxi, effxi); - case ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_PLAYING: + case A5O_HAPTIC_EFFECT_XINPUT_STATE_PLAYING: return hapxi_poll_haptic_effect_playing(hapxi, effxi); - case ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_DELAYED: + case A5O_HAPTIC_EFFECT_XINPUT_STATE_DELAYED: return hapxi_poll_haptic_effect_delayed(hapxi, effxi); - case ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_STOPPING: + case A5O_HAPTIC_EFFECT_XINPUT_STATE_STOPPING: return hapxi_poll_haptic_effect_stopping(hapxi, effxi); default: - ALLEGRO_DEBUG("XInput haptic effect state not valid :%d.\n", effxi->state); + A5O_DEBUG("XInput haptic effect state not valid :%d.\n", effxi->state); return false; } } /* Polls the xinput API for a single haptic device. */ -static void hapxi_poll_haptic(ALLEGRO_HAPTIC_XINPUT *hapxi) +static void hapxi_poll_haptic(A5O_HAPTIC_XINPUT *hapxi) { hapxi_poll_haptic_effect(hapxi, &hapxi->effect); } @@ -363,13 +363,13 @@ static void hapxi_poll_haptics(void) /* Function for the haptics polling thread. */ -static void *hapxi_poll_thread(ALLEGRO_THREAD *thread, void *arg) +static void *hapxi_poll_thread(A5O_THREAD *thread, void *arg) { - ALLEGRO_TIMEOUT timeout; + A5O_TIMEOUT timeout; al_lock_mutex(hapxi_mutex); while (!al_get_thread_should_stop(thread)) { /* Poll once every 10 milliseconds. XXX: Should this be configurable? */ - al_init_timeout(&timeout, ALLEGRO_XINPUT_POLL_DELAY); + al_init_timeout(&timeout, A5O_XINPUT_POLL_DELAY); /* Wait for the condition to allow the polling thread to be awoken when needed. */ al_wait_cond_until(hapxi_cond, hapxi_mutex, &timeout); @@ -418,9 +418,9 @@ static bool hapxi_init_haptic(void) /* Converts a generic haptic device to a Windows-specific one. */ -static ALLEGRO_HAPTIC_XINPUT *hapxi_from_al(ALLEGRO_HAPTIC *hap) +static A5O_HAPTIC_XINPUT *hapxi_from_al(A5O_HAPTIC *hap) { - return (ALLEGRO_HAPTIC_XINPUT *)hap; + return (A5O_HAPTIC_XINPUT *)hap; } static void hapxi_exit_haptic(void) @@ -453,13 +453,13 @@ static bool hapxi_magnitude2win(WORD *word, double value) /* Converts Allegro haptic effect to xinput API. */ static bool hapxi_effect2win( - ALLEGRO_HAPTIC_EFFECT_XINPUT *effxi, - ALLEGRO_HAPTIC_EFFECT *effect, - ALLEGRO_HAPTIC_XINPUT *hapxi) + A5O_HAPTIC_EFFECT_XINPUT *effxi, + A5O_HAPTIC_EFFECT *effect, + A5O_HAPTIC_XINPUT *hapxi) { (void)hapxi; /* Generic setup */ - if (effect->type != ALLEGRO_HAPTIC_RUMBLE) + if (effect->type != A5O_HAPTIC_RUMBLE) return false; /* Right motor is "weaker" than left one, That is, right produces a less @@ -471,24 +471,24 @@ static bool hapxi_effect2win( effect->data.rumble.strong_magnitude); } -static bool hapxi_get_active(ALLEGRO_HAPTIC *haptic) +static bool hapxi_get_active(A5O_HAPTIC *haptic) { - ALLEGRO_HAPTIC_XINPUT *hapxi = hapxi_from_al(haptic); + A5O_HAPTIC_XINPUT *hapxi = hapxi_from_al(haptic); return hapxi->active; } -static bool hapxi_is_mouse_haptic(ALLEGRO_MOUSE *mouse) +static bool hapxi_is_mouse_haptic(A5O_MOUSE *mouse) { (void)mouse; return false; } -static bool hapxi_is_joystick_haptic(ALLEGRO_JOYSTICK *joy) +static bool hapxi_is_joystick_haptic(A5O_JOYSTICK *joy) { - ALLEGRO_JOYSTICK_XINPUT *joyxi = (ALLEGRO_JOYSTICK_XINPUT *)joy; + A5O_JOYSTICK_XINPUT *joyxi = (A5O_JOYSTICK_XINPUT *)joy; if (!al_is_joystick_installed()) return false; if (!al_get_joystick_active(joy)) @@ -499,47 +499,47 @@ static bool hapxi_is_joystick_haptic(ALLEGRO_JOYSTICK *joy) and force feedback must be assumed to be always available. */ #ifndef XINPUT_CAPS_FFB_SUPPORTED (void)joyxi; - ALLEGRO_DEBUG("Compiled against older XInput library, assuming force feedback support is available.\n"); + A5O_DEBUG("Compiled against older XInput library, assuming force feedback support is available.\n"); return true; #else - ALLEGRO_DEBUG("joyxi->capabilities.Flags: %d <-> %d\n", joyxi->capabilities.Flags, XINPUT_CAPS_FFB_SUPPORTED); + A5O_DEBUG("joyxi->capabilities.Flags: %d <-> %d\n", joyxi->capabilities.Flags, XINPUT_CAPS_FFB_SUPPORTED); return(joyxi->capabilities.Flags & XINPUT_CAPS_FFB_SUPPORTED); #endif } -static bool hapxi_is_display_haptic(ALLEGRO_DISPLAY *dev) +static bool hapxi_is_display_haptic(A5O_DISPLAY *dev) { (void)dev; return false; } -static bool hapxi_is_keyboard_haptic(ALLEGRO_KEYBOARD *dev) +static bool hapxi_is_keyboard_haptic(A5O_KEYBOARD *dev) { (void)dev; return false; } -static bool hapxi_is_touch_input_haptic(ALLEGRO_TOUCH_INPUT *dev) +static bool hapxi_is_touch_input_haptic(A5O_TOUCH_INPUT *dev) { (void)dev; return false; } -static ALLEGRO_HAPTIC *hapxi_get_from_mouse(ALLEGRO_MOUSE *mouse) +static A5O_HAPTIC *hapxi_get_from_mouse(A5O_MOUSE *mouse) { (void)mouse; return NULL; } -static ALLEGRO_HAPTIC *hapxi_get_from_joystick(ALLEGRO_JOYSTICK *joy) +static A5O_HAPTIC *hapxi_get_from_joystick(A5O_JOYSTICK *joy) { - ALLEGRO_JOYSTICK_XINPUT *joyxi = (ALLEGRO_JOYSTICK_XINPUT *)joy; - ALLEGRO_HAPTIC_XINPUT *hapxi; + A5O_JOYSTICK_XINPUT *joyxi = (A5O_JOYSTICK_XINPUT *)joy; + A5O_HAPTIC_XINPUT *hapxi; if (!al_is_joystick_haptic(joy)) return NULL; @@ -551,11 +551,11 @@ static ALLEGRO_HAPTIC *hapxi_get_from_joystick(ALLEGRO_JOYSTICK *joy) hapxi->parent.device = joyxi; hapxi->parent.from = _AL_HAPTIC_FROM_JOYSTICK; hapxi->active = true; - hapxi->effect.state = ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_INACTIVE; + hapxi->effect.state = A5O_HAPTIC_EFFECT_XINPUT_STATE_INACTIVE; /* not in use */ hapxi->parent.gain = 1.0; hapxi->parent.autocenter = 0.0; - hapxi->flags = ALLEGRO_HAPTIC_RUMBLE; + hapxi->flags = A5O_HAPTIC_RUMBLE; hapxi->xjoy = joyxi; al_unlock_mutex(hapxi_mutex); @@ -563,35 +563,35 @@ static ALLEGRO_HAPTIC *hapxi_get_from_joystick(ALLEGRO_JOYSTICK *joy) } -static ALLEGRO_HAPTIC *hapxi_get_from_display(ALLEGRO_DISPLAY *dev) +static A5O_HAPTIC *hapxi_get_from_display(A5O_DISPLAY *dev) { (void)dev; return NULL; } -static ALLEGRO_HAPTIC *hapxi_get_from_keyboard(ALLEGRO_KEYBOARD *dev) +static A5O_HAPTIC *hapxi_get_from_keyboard(A5O_KEYBOARD *dev) { (void)dev; return NULL; } -static ALLEGRO_HAPTIC *hapxi_get_from_touch_input(ALLEGRO_TOUCH_INPUT *dev) +static A5O_HAPTIC *hapxi_get_from_touch_input(A5O_TOUCH_INPUT *dev) { (void)dev; return NULL; } -static int hapxi_get_capabilities(ALLEGRO_HAPTIC *dev) +static int hapxi_get_capabilities(A5O_HAPTIC *dev) { - ALLEGRO_HAPTIC_XINPUT *hapxi = hapxi_from_al(dev); + A5O_HAPTIC_XINPUT *hapxi = hapxi_from_al(dev); return hapxi->flags; } -static double hapxi_get_gain(ALLEGRO_HAPTIC *dev) +static double hapxi_get_gain(A5O_HAPTIC *dev) { (void)dev; /* Just return the 1.0, gain isn't supported */ @@ -599,7 +599,7 @@ static double hapxi_get_gain(ALLEGRO_HAPTIC *dev) } -static bool hapxi_set_gain(ALLEGRO_HAPTIC *dev, double gain) +static bool hapxi_set_gain(A5O_HAPTIC *dev, double gain) { (void)dev; (void)gain; /* Gain not supported*/ @@ -607,7 +607,7 @@ static bool hapxi_set_gain(ALLEGRO_HAPTIC *dev, double gain) } -double hapxi_get_autocenter(ALLEGRO_HAPTIC *dev) +double hapxi_get_autocenter(A5O_HAPTIC *dev) { (void)dev; /* Autocenter not supported so return 0.0. */ @@ -615,14 +615,14 @@ double hapxi_get_autocenter(ALLEGRO_HAPTIC *dev) } -static bool hapxi_set_autocenter(ALLEGRO_HAPTIC *dev, double intensity) +static bool hapxi_set_autocenter(A5O_HAPTIC *dev, double intensity) { (void)dev; (void)intensity; /* Autocenter not supported*/ return false; } -static int hapxi_get_max_effects(ALLEGRO_HAPTIC *dev) +static int hapxi_get_max_effects(A5O_HAPTIC *dev) { (void)dev; /* Support only one effect */ @@ -630,8 +630,8 @@ static int hapxi_get_max_effects(ALLEGRO_HAPTIC *dev) } -static bool hapxi_is_effect_ok(ALLEGRO_HAPTIC *haptic, - ALLEGRO_HAPTIC_EFFECT *effect) +static bool hapxi_is_effect_ok(A5O_HAPTIC *haptic, + A5O_HAPTIC_EFFECT *effect) { int caps; @@ -645,10 +645,10 @@ static bool hapxi_is_effect_ok(ALLEGRO_HAPTIC *haptic, /* Gets an available haptic effect slot from the device or NULL if not * available. */ -static ALLEGRO_HAPTIC_EFFECT_XINPUT * -hapxi_get_available_effect(ALLEGRO_HAPTIC_XINPUT *hapxi) +static A5O_HAPTIC_EFFECT_XINPUT * +hapxi_get_available_effect(A5O_HAPTIC_XINPUT *hapxi) { - if (hapxi->effect.state == ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_INACTIVE) { + if (hapxi->effect.state == A5O_HAPTIC_EFFECT_XINPUT_STATE_INACTIVE) { /* Set up ID here. */ hapxi->effect.id = 0; return &hapxi->effect; @@ -656,17 +656,17 @@ hapxi_get_available_effect(ALLEGRO_HAPTIC_XINPUT *hapxi) return NULL; } -static bool hapxi_release_effect_windows(ALLEGRO_HAPTIC_EFFECT_XINPUT *effxi) +static bool hapxi_release_effect_windows(A5O_HAPTIC_EFFECT_XINPUT *effxi) { - effxi->state = ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_INACTIVE; + effxi->state = A5O_HAPTIC_EFFECT_XINPUT_STATE_INACTIVE; return true; } -static bool hapxi_upload_effect(ALLEGRO_HAPTIC *dev, - ALLEGRO_HAPTIC_EFFECT *effect, ALLEGRO_HAPTIC_EFFECT_ID *id) +static bool hapxi_upload_effect(A5O_HAPTIC *dev, + A5O_HAPTIC_EFFECT *effect, A5O_HAPTIC_EFFECT_ID *id) { - ALLEGRO_HAPTIC_XINPUT *hapxi = hapxi_from_al(dev); - ALLEGRO_HAPTIC_EFFECT_XINPUT *effxi = NULL; + A5O_HAPTIC_XINPUT *hapxi = hapxi_from_al(dev); + A5O_HAPTIC_EFFECT_XINPUT *effxi = NULL; ASSERT(dev); ASSERT(id); @@ -690,18 +690,18 @@ static bool hapxi_upload_effect(ALLEGRO_HAPTIC *dev, effxi = hapxi_get_available_effect(hapxi); /* No more space for an effect. */ if (!effxi) { - ALLEGRO_WARN("No free effect slot."); + A5O_WARN("No free effect slot."); al_unlock_mutex(hapxi_mutex); return false; } if (!hapxi_effect2win(effxi, effect, hapxi)) { - ALLEGRO_WARN("Cannot convert haptic effect to XINPUT effect.\n"); + A5O_WARN("Cannot convert haptic effect to XINPUT effect.\n"); al_unlock_mutex(hapxi_mutex); return false; } - effxi->state = ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_READY; + effxi->state = A5O_HAPTIC_EFFECT_XINPUT_STATE_READY; effxi->effect = (*effect); /* set ID handle to signify success */ id->_haptic = dev; @@ -714,30 +714,30 @@ static bool hapxi_upload_effect(ALLEGRO_HAPTIC *dev, } -static ALLEGRO_HAPTIC_XINPUT * -hapxi_device_for_id(ALLEGRO_HAPTIC_EFFECT_ID *id) +static A5O_HAPTIC_XINPUT * +hapxi_device_for_id(A5O_HAPTIC_EFFECT_ID *id) { - return (ALLEGRO_HAPTIC_XINPUT *)id->_haptic; + return (A5O_HAPTIC_XINPUT *)id->_haptic; } -static ALLEGRO_HAPTIC_EFFECT_XINPUT * -hapxi_effect_for_id(ALLEGRO_HAPTIC_EFFECT_ID *id) +static A5O_HAPTIC_EFFECT_XINPUT * +hapxi_effect_for_id(A5O_HAPTIC_EFFECT_ID *id) { - return (ALLEGRO_HAPTIC_EFFECT_XINPUT *)id->_pointer; + return (A5O_HAPTIC_EFFECT_XINPUT *)id->_pointer; } -static bool hapxi_play_effect(ALLEGRO_HAPTIC_EFFECT_ID *id, int loops) +static bool hapxi_play_effect(A5O_HAPTIC_EFFECT_ID *id, int loops) { - ALLEGRO_HAPTIC_XINPUT *hapxi = hapxi_device_for_id(id); - ALLEGRO_HAPTIC_EFFECT_XINPUT *effxi = hapxi_effect_for_id(id); + A5O_HAPTIC_XINPUT *hapxi = hapxi_device_for_id(id); + A5O_HAPTIC_EFFECT_XINPUT *effxi = hapxi_effect_for_id(id); if ((!hapxi) || (id->_id < 0) || (!effxi) || (loops < 1)) return false; al_lock_mutex(hapxi_mutex); /* Simply set some flags. The polling thread will see this and start playing. after the effect's delay has passed. */ - effxi->state = ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_STARTING; + effxi->state = A5O_HAPTIC_EFFECT_XINPUT_STATE_STARTING; effxi->start_time = al_get_time(); effxi->stop_time = effxi->start_time + al_get_haptic_effect_duration(&effxi->effect) * loops; effxi->repeats = loops; @@ -754,18 +754,18 @@ static bool hapxi_play_effect(ALLEGRO_HAPTIC_EFFECT_ID *id, int loops) } -static bool hapxi_stop_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) +static bool hapxi_stop_effect(A5O_HAPTIC_EFFECT_ID *id) { - ALLEGRO_HAPTIC_XINPUT *hapxi = hapxi_device_for_id(id); - ALLEGRO_HAPTIC_EFFECT_XINPUT *effxi = hapxi_effect_for_id(id); + A5O_HAPTIC_XINPUT *hapxi = hapxi_device_for_id(id); + A5O_HAPTIC_EFFECT_XINPUT *effxi = hapxi_effect_for_id(id); if ((!hapxi) || (id->_id < 0)) return false; /* Simply set some flags. The polling thread will see this and stop playing.*/ - effxi = (ALLEGRO_HAPTIC_EFFECT_XINPUT *)id->_pointer; - if (effxi->state <= ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_READY) return false; + effxi = (A5O_HAPTIC_EFFECT_XINPUT *)id->_pointer; + if (effxi->state <= A5O_HAPTIC_EFFECT_XINPUT_STATE_READY) return false; al_lock_mutex(hapxi_mutex); - effxi->state = ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_STOPPING; + effxi->state = A5O_HAPTIC_EFFECT_XINPUT_STATE_STOPPING; id->_playing = false; al_unlock_mutex(hapxi_mutex); al_signal_cond(hapxi_cond); @@ -773,10 +773,10 @@ static bool hapxi_stop_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) } -static bool hapxi_is_effect_playing(ALLEGRO_HAPTIC_EFFECT_ID *id) +static bool hapxi_is_effect_playing(A5O_HAPTIC_EFFECT_ID *id) { - ALLEGRO_HAPTIC_XINPUT *hapxi; - ALLEGRO_HAPTIC_EFFECT_XINPUT *effxi; + A5O_HAPTIC_XINPUT *hapxi; + A5O_HAPTIC_EFFECT_XINPUT *effxi; bool result; ASSERT(id); @@ -786,9 +786,9 @@ static bool hapxi_is_effect_playing(ALLEGRO_HAPTIC_EFFECT_ID *id) if ((!hapxi) || (id->_id < 0) || (!id->_playing)) return false; al_lock_mutex(hapxi_mutex); - ALLEGRO_DEBUG("Playing effect state: %d %p %lf %lf\n", effxi->state, effxi, al_get_time(), id->_end_time); + A5O_DEBUG("Playing effect state: %d %p %lf %lf\n", effxi->state, effxi, al_get_time(), id->_end_time); - result = (effxi->state > ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_READY); + result = (effxi->state > A5O_HAPTIC_EFFECT_XINPUT_STATE_READY); al_unlock_mutex(hapxi_mutex); al_signal_cond(hapxi_cond); @@ -796,10 +796,10 @@ static bool hapxi_is_effect_playing(ALLEGRO_HAPTIC_EFFECT_ID *id) } -static bool hapxi_release_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) +static bool hapxi_release_effect(A5O_HAPTIC_EFFECT_ID *id) { - ALLEGRO_HAPTIC_XINPUT *hapxi = hapxi_device_for_id(id); - ALLEGRO_HAPTIC_EFFECT_XINPUT *effxi = hapxi_effect_for_id(id); + A5O_HAPTIC_XINPUT *hapxi = hapxi_device_for_id(id); + A5O_HAPTIC_EFFECT_XINPUT *effxi = hapxi_effect_for_id(id); bool result; if ((!hapxi) || (!effxi)) return false; @@ -807,16 +807,16 @@ static bool hapxi_release_effect(ALLEGRO_HAPTIC_EFFECT_ID *id) al_lock_mutex(hapxi_mutex); /* Forcefully stop since a normal stop may not be instant. */ hapxi_force_stop(hapxi, effxi); - effxi->state = ALLEGRO_HAPTIC_EFFECT_XINPUT_STATE_INACTIVE; + effxi->state = A5O_HAPTIC_EFFECT_XINPUT_STATE_INACTIVE; result = hapxi_release_effect_windows(effxi); al_unlock_mutex(hapxi_mutex); return result; } -static bool hapxi_release(ALLEGRO_HAPTIC *haptic) +static bool hapxi_release(A5O_HAPTIC *haptic) { - ALLEGRO_HAPTIC_XINPUT *hapxi = hapxi_from_al(haptic); + A5O_HAPTIC_XINPUT *hapxi = hapxi_from_al(haptic); ASSERT(haptic); if (!hapxi->active) diff --git a/src/win/wjoyall.c b/src/win/wjoyall.c index 8475d99f0b..e7513996ef 100644 --- a/src/win/wjoyall.c +++ b/src/win/wjoyall.c @@ -40,7 +40,7 @@ */ -#define ALLEGRO_NO_COMPATIBILITY +#define A5O_NO_COMPATIBILITY /* For waitable timers */ #define _WIN32_WINNT 0x0501 @@ -53,21 +53,21 @@ #include "allegro5/internal/aintern_bitmap.h" -#ifdef ALLEGRO_CFG_XINPUT +#ifdef A5O_CFG_XINPUT /* Don't compile this lot if xinput isn't supported. */ -#ifndef ALLEGRO_WINDOWS +#ifndef A5O_WINDOWS #error something is wrong with the makefile #endif -#ifdef ALLEGRO_MINGW32 +#ifdef A5O_MINGW32 #undef MAKEFOURCC #endif #include -ALLEGRO_DEBUG_CHANNEL("wjoyall") +A5O_DEBUG_CHANNEL("wjoyall") #include "allegro5/joystick.h" #include "allegro5/internal/aintern_joystick.h" @@ -78,15 +78,15 @@ static bool joyall_init_joystick(void); static void joyall_exit_joystick(void); static bool joyall_reconfigure_joysticks(void); static int joyall_get_num_joysticks(void); -static ALLEGRO_JOYSTICK *joyall_get_joystick(int num); -static void joyall_release_joystick(ALLEGRO_JOYSTICK *joy); -static void joyall_get_joystick_state(ALLEGRO_JOYSTICK *joy, ALLEGRO_JOYSTICK_STATE *ret_state); -static const char *joyall_get_name(ALLEGRO_JOYSTICK *joy); -static bool joyall_get_active(ALLEGRO_JOYSTICK *joy); +static A5O_JOYSTICK *joyall_get_joystick(int num); +static void joyall_release_joystick(A5O_JOYSTICK *joy); +static void joyall_get_joystick_state(A5O_JOYSTICK *joy, A5O_JOYSTICK_STATE *ret_state); +static const char *joyall_get_name(A5O_JOYSTICK *joy); +static bool joyall_get_active(A5O_JOYSTICK *joy); /* the driver vtable */ -ALLEGRO_JOYSTICK_DRIVER _al_joydrv_windows_all = +A5O_JOYSTICK_DRIVER _al_joydrv_windows_all = { AL_JOY_TYPE_WINDOWS_ALL, "", @@ -104,7 +104,7 @@ ALLEGRO_JOYSTICK_DRIVER _al_joydrv_windows_all = }; /* Mutex to protect state access. XXX is this needed? */ -static ALLEGRO_MUTEX *joyall_mutex = NULL; +static A5O_MUTEX *joyall_mutex = NULL; static bool ok_xi = false; static bool ok_di = false; @@ -121,12 +121,12 @@ static void joyall_setup_joysticks(void) num_xinput = _al_joydrv_xinput.num_joysticks(); for (index = 0; index < num_xinput; index++) { - ALLEGRO_JOYSTICK *joystick = _al_joydrv_xinput.get_joystick(index); + A5O_JOYSTICK *joystick = _al_joydrv_xinput.get_joystick(index); joystick->driver = &_al_joydrv_xinput; } for (index = 0; index < num_dinput; index++) { - ALLEGRO_JOYSTICK *joystick = _al_joydrv_directx.get_joystick(index); + A5O_JOYSTICK *joystick = _al_joydrv_directx.get_joystick(index); joystick->driver = &_al_joydrv_directx; } } @@ -181,7 +181,7 @@ static int joyall_get_num_joysticks(void) return ret; } -static ALLEGRO_JOYSTICK *joyall_get_joystick(int num) +static A5O_JOYSTICK *joyall_get_joystick(int num) { int num_xinput = 0; int num_dinput = 0; @@ -200,7 +200,7 @@ static ALLEGRO_JOYSTICK *joyall_get_joystick(int num) return NULL; } -static void joyall_release_joystick(ALLEGRO_JOYSTICK *joy) +static void joyall_release_joystick(A5O_JOYSTICK *joy) { /* Forward to the driver's function. Here it's OK to use joy * since the get_joystick function returns a @@ -211,20 +211,20 @@ static void joyall_release_joystick(ALLEGRO_JOYSTICK *joy) } } -static void joyall_get_joystick_state(ALLEGRO_JOYSTICK *joy, ALLEGRO_JOYSTICK_STATE *ret_state) +static void joyall_get_joystick_state(A5O_JOYSTICK *joy, A5O_JOYSTICK_STATE *ret_state) { joy->driver->get_joystick_state(joy, ret_state); } -static const char *joyall_get_name(ALLEGRO_JOYSTICK *joy) +static const char *joyall_get_name(A5O_JOYSTICK *joy) { return joy->driver->get_name(joy); } -static bool joyall_get_active(ALLEGRO_JOYSTICK *joy) +static bool joyall_get_active(A5O_JOYSTICK *joy) { return joy->driver->get_active(joy); } -#endif /* #ifdef ALLEGRO_CFG_XINPUT */ +#endif /* #ifdef A5O_CFG_XINPUT */ diff --git a/src/win/wjoydrv.c b/src/win/wjoydrv.c index 8db36f3c10..e07c86b0e6 100644 --- a/src/win/wjoydrv.c +++ b/src/win/wjoydrv.c @@ -21,7 +21,7 @@ #include "allegro5/internal/aintern.h" #include "allegro5/internal/aintern_joystick.h" -#ifndef ALLEGRO_WINDOWS +#ifndef A5O_WINDOWS #error something is wrong with the makefile #endif @@ -29,7 +29,7 @@ _AL_BEGIN_JOYSTICK_DRIVER_LIST _AL_JOYSTICK_DRIVER_DIRECTX -#ifdef ALLEGRO_CFG_XINPUT +#ifdef A5O_CFG_XINPUT _AL_JOYSTICK_DRIVER_XINPUT _AL_JOYSTICK_DRIVER_WINDOWS_ALL #endif diff --git a/src/win/wjoydxnu.cpp b/src/win/wjoydxnu.cpp index edef4163b6..447602337e 100644 --- a/src/win/wjoydxnu.cpp +++ b/src/win/wjoydxnu.cpp @@ -25,7 +25,7 @@ * Driver operation: * * 1. When the driver is initialised all the joysticks on the system - * are enumerated. For each joystick, an ALLEGRO_JOYSTICK_DIRECTX structure + * are enumerated. For each joystick, an A5O_JOYSTICK_DIRECTX structure * is created. A win32 Event is also created for each joystick and DirectInput * is told to set that event whenever the joystick state changes. For some * devices this is not possible -- they must be polled. In that case, a @@ -33,26 +33,26 @@ * joysticks are set up, a dedicated background thread is started. * * 2. When al_get_joystick() is called the address of one of the - * ALLEGRO_JOYSTICK_DIRECTX structures is returned to the user. + * A5O_JOYSTICK_DIRECTX structures is returned to the user. * * 3. The background thread waits upon the win32 Events/Waitable Timer * objects. When one of them is triggered, the thread wakes up and - * reads in buffered joystick events. An internal ALLEGRO_JOYSTICK_STATE - * structure (part of ALLEGRO_JOYSTICK_DIRECTX) is updated accordingly. + * reads in buffered joystick events. An internal A5O_JOYSTICK_STATE + * structure (part of A5O_JOYSTICK_DIRECTX) is updated accordingly. * Also, any Allegro events are generated if necessary. * * 4. When the user calls al_get_joystick_state() the contents of the - * internal ALLEGRO_JOYSTICK_STATE structure are copied to a user - * ALLEGRO_JOYSTICK_STATE structure. + * internal A5O_JOYSTICK_STATE structure are copied to a user + * A5O_JOYSTICK_STATE structure. * * 5. Every second or so, all the joysticks on the system are enumerated again. * We compare the GUIDs of the enumerated joysticks with the existing - * ALLEGRO_JOYSTICK structures to tell if any new joysticks have been connected, + * A5O_JOYSTICK structures to tell if any new joysticks have been connected, * or old ones disconnected. */ -#define ALLEGRO_NO_COMPATIBILITY +#define A5O_NO_COMPATIBILITY #define DIRECTINPUT_VERSION 0x0800 @@ -67,11 +67,11 @@ #include "allegro5/internal/aintern_bitmap.h" -#ifndef ALLEGRO_WINDOWS +#ifndef A5O_WINDOWS #error something is wrong with the makefile #endif -#ifdef ALLEGRO_MINGW32 +#ifdef A5O_MINGW32 #undef MAKEFOURCC #endif @@ -82,16 +82,16 @@ /* We need XInput detection if we actually compile the XInput driver in. */ -#ifdef ALLEGRO_CFG_XINPUT +#ifdef A5O_CFG_XINPUT /* Windows XP is required. If you still use older Windows, XInput won't work anyway. */ #undef WIN32_LEAN_AND_MEAN #include #include - #define ALLEGRO_DINPUT_FILTER_XINPUT + #define A5O_DINPUT_FILTER_XINPUT #endif -ALLEGRO_DEBUG_CHANNEL("dinput") +A5O_DEBUG_CHANNEL("dinput") #include "allegro5/joystick.h" #include "allegro5/internal/aintern_joystick.h" @@ -105,26 +105,26 @@ static bool joydx_init_joystick(void); static void joydx_exit_joystick(void); static bool joydx_reconfigure_joysticks(void); static int joydx_get_num_joysticks(void); -static ALLEGRO_JOYSTICK *joydx_get_joystick(int num); -static void joydx_release_joystick(ALLEGRO_JOYSTICK *joy); -static void joydx_get_joystick_state(ALLEGRO_JOYSTICK *joy, ALLEGRO_JOYSTICK_STATE *ret_state); -static const char *joydx_get_name(ALLEGRO_JOYSTICK *joy); -static bool joydx_get_active(ALLEGRO_JOYSTICK *joy); +static A5O_JOYSTICK *joydx_get_joystick(int num); +static void joydx_release_joystick(A5O_JOYSTICK *joy); +static void joydx_get_joystick_state(A5O_JOYSTICK *joy, A5O_JOYSTICK_STATE *ret_state); +static const char *joydx_get_name(A5O_JOYSTICK *joy); +static bool joydx_get_active(A5O_JOYSTICK *joy); -static void joydx_inactivate_joy(ALLEGRO_JOYSTICK_DIRECTX *joy); +static void joydx_inactivate_joy(A5O_JOYSTICK_DIRECTX *joy); static unsigned __stdcall joydx_thread_proc(LPVOID unused); -static void update_joystick(ALLEGRO_JOYSTICK_DIRECTX *joy); -static void handle_axis_event(ALLEGRO_JOYSTICK_DIRECTX *joy, const AXIS_MAPPING *axis_mapping, DWORD value); -static void handle_pov_event(ALLEGRO_JOYSTICK_DIRECTX *joy, int stick, DWORD value); -static void handle_button_event(ALLEGRO_JOYSTICK_DIRECTX *joy, int button, bool down); -static void generate_axis_event(ALLEGRO_JOYSTICK_DIRECTX *joy, int stick, int axis, float pos); -static void generate_button_event(ALLEGRO_JOYSTICK_DIRECTX *joy, int button, ALLEGRO_EVENT_TYPE event_type); +static void update_joystick(A5O_JOYSTICK_DIRECTX *joy); +static void handle_axis_event(A5O_JOYSTICK_DIRECTX *joy, const AXIS_MAPPING *axis_mapping, DWORD value); +static void handle_pov_event(A5O_JOYSTICK_DIRECTX *joy, int stick, DWORD value); +static void handle_button_event(A5O_JOYSTICK_DIRECTX *joy, int button, bool down); +static void generate_axis_event(A5O_JOYSTICK_DIRECTX *joy, int stick, int axis, float pos); +static void generate_button_event(A5O_JOYSTICK_DIRECTX *joy, int button, A5O_EVENT_TYPE event_type); /* the driver vtable */ -ALLEGRO_JOYSTICK_DRIVER _al_joydrv_directx = +A5O_JOYSTICK_DRIVER _al_joydrv_directx = { AL_JOY_TYPE_DIRECTX, "", @@ -248,13 +248,13 @@ static DIRECTINPUT8CREATEPROC _al_dinput_create = (DIRECTINPUT8CREATEPROC)NULL; static LPDIRECTINPUT joystick_dinput = NULL; /* last display which acquired the devices */ -static ALLEGRO_DISPLAY_WIN *win_disp; +static A5O_DISPLAY_WIN *win_disp; /* number of joysticks visible to user */ static int joydx_num_joysticks; /* the joystick structures */ -static ALLEGRO_JOYSTICK_DIRECTX joydx_joystick[MAX_JOYSTICKS]; +static A5O_JOYSTICK_DIRECTX joydx_joystick[MAX_JOYSTICKS]; /* for the background thread */ static HANDLE joydx_thread = NULL; @@ -322,7 +322,7 @@ static char *guid_to_string(const GUID * guid) /* Returns a pointer to a static buffer, for debugging. */ -static char *joydx_guid_string(ALLEGRO_JOYSTICK_DIRECTX *joy) +static char *joydx_guid_string(A5O_JOYSTICK_DIRECTX *joy) { return guid_to_string((const GUID *)&joy->guid); } @@ -385,7 +385,7 @@ static void joystick_dinput_acquire(void) hr = IDirectInputDevice8_Acquire(joydx_joystick[i].device); if (FAILED(hr)) - ALLEGRO_ERROR("acquire joystick %d failed: %s\n", i, dinput_err_str(hr)); + A5O_ERROR("acquire joystick %d failed: %s\n", i, dinput_err_str(hr)); } } } @@ -415,7 +415,7 @@ void _al_win_joystick_dinput_unacquire(void *unused) if (joystick_dinput && win_disp) { for (i=0; i < MAX_JOYSTICKS; i++) { if (joydx_joystick[i].device) { - ALLEGRO_DEBUG("Unacquiring joystick device at slot %d\n", i); + A5O_DEBUG("Unacquiring joystick device at slot %d\n", i); IDirectInputDevice8_Unacquire(joydx_joystick[i].device); } } @@ -439,7 +439,7 @@ void _al_win_joystick_dinput_grab(void *param) _al_win_wnd_call_proc(win_disp->window, _al_win_joystick_dinput_unacquire, NULL); } - win_disp = (ALLEGRO_DISPLAY_WIN *)param; + win_disp = (A5O_DISPLAY_WIN *)param; /* set cooperative level */ for (i = 0; i < MAX_JOYSTICKS; i++) { @@ -451,7 +451,7 @@ void _al_win_joystick_dinput_grab(void *param) hr = IDirectInputDevice8_SetCooperativeLevel(joydx_joystick[i].device, win_disp->window, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE); if (FAILED(hr)) { - ALLEGRO_ERROR("IDirectInputDevice8_SetCooperativeLevel failed.\n"); + A5O_ERROR("IDirectInputDevice8_SetCooperativeLevel failed.\n"); return; } } @@ -460,7 +460,7 @@ void _al_win_joystick_dinput_grab(void *param) } -static ALLEGRO_JOYSTICK_DIRECTX *joydx_by_guid(const GUID guid, +static A5O_JOYSTICK_DIRECTX *joydx_by_guid(const GUID guid, const GUID product_guid) { unsigned i; @@ -479,7 +479,7 @@ static ALLEGRO_JOYSTICK_DIRECTX *joydx_by_guid(const GUID guid, } -static ALLEGRO_JOYSTICK_DIRECTX *joydx_allocate_structure(int *num) +static A5O_JOYSTICK_DIRECTX *joydx_allocate_structure(int *num) { int i; @@ -563,7 +563,7 @@ static char *add_string(char *buf, const TCHAR *src, int *pos, int bufsize, cons dest = buf + *pos; if (*pos >= bufsize - 1) { /* Out of space. */ - ALLEGRO_ASSERT(dest[0] == '\0'); + A5O_ASSERT(dest[0] == '\0'); return dest; } @@ -577,10 +577,10 @@ static char *add_string(char *buf, const TCHAR *src, int *pos, int bufsize, cons } else { dest = _al_sane_strncpy(dest, dfl, bufsize - *pos); } - ALLEGRO_ASSERT(dest != 0); + A5O_ASSERT(dest != 0); if (dest) { (*pos) += strlen(dest); - ALLEGRO_ASSERT(*pos < bufsize); + A5O_ASSERT(*pos < bufsize); } return dest; } @@ -590,7 +590,7 @@ static char *add_string(char *buf, const TCHAR *src, int *pos, int bufsize, cons * Helper to fill in the contents of the joystick structure using the * information painstakingly stored into the caps_and_names substructure. */ -static void fill_joystick_info_using_caps_and_names(ALLEGRO_JOYSTICK_DIRECTX *joy, +static void fill_joystick_info_using_caps_and_names(A5O_JOYSTICK_DIRECTX *joy, const CAPS_AND_NAMES *can) { _AL_JOYSTICK_INFO *info = &joy->parent.info; @@ -606,7 +606,7 @@ static void fill_joystick_info_using_caps_and_names(ALLEGRO_JOYSTICK_DIRECTX *jo /* the X, Y, Z axes make up the first stick */ if (can->have_x || can->have_y || can->have_z) { if (can->have_x) { - info->stick[N_STICK].flags = ALLEGRO_JOYFLAG_DIGITAL | ALLEGRO_JOYFLAG_ANALOGUE; + info->stick[N_STICK].flags = A5O_JOYFLAG_DIGITAL | A5O_JOYFLAG_ANALOGUE; info->stick[N_STICK].axis[N_AXIS].name = ADD_STRING(can->name_x, default_name_x); joy->x_mapping.stick = N_STICK; joy->x_mapping.axis = N_AXIS; @@ -614,7 +614,7 @@ static void fill_joystick_info_using_caps_and_names(ALLEGRO_JOYSTICK_DIRECTX *jo } if (can->have_y) { - info->stick[N_STICK].flags = ALLEGRO_JOYFLAG_DIGITAL | ALLEGRO_JOYFLAG_ANALOGUE; + info->stick[N_STICK].flags = A5O_JOYFLAG_DIGITAL | A5O_JOYFLAG_ANALOGUE; info->stick[N_STICK].axis[N_AXIS].name = ADD_STRING(can->name_y, default_name_y); joy->y_mapping.stick = N_STICK; joy->y_mapping.axis = N_AXIS; @@ -622,7 +622,7 @@ static void fill_joystick_info_using_caps_and_names(ALLEGRO_JOYSTICK_DIRECTX *jo } if (can->have_z) { - info->stick[N_STICK].flags = ALLEGRO_JOYFLAG_DIGITAL | ALLEGRO_JOYFLAG_ANALOGUE; + info->stick[N_STICK].flags = A5O_JOYFLAG_DIGITAL | A5O_JOYFLAG_ANALOGUE; info->stick[N_STICK].axis[N_AXIS].name = ADD_STRING(can->name_z, default_name_z); joy->z_mapping.stick = N_STICK; joy->z_mapping.axis = N_AXIS; @@ -636,7 +636,7 @@ static void fill_joystick_info_using_caps_and_names(ALLEGRO_JOYSTICK_DIRECTX *jo /* the Rx, Ry, Rz axes make up the next stick */ if (can->have_rx || can->have_ry || can->have_rz) { if (can->have_rx) { - info->stick[N_STICK].flags = ALLEGRO_JOYFLAG_DIGITAL | ALLEGRO_JOYFLAG_ANALOGUE; + info->stick[N_STICK].flags = A5O_JOYFLAG_DIGITAL | A5O_JOYFLAG_ANALOGUE; info->stick[N_STICK].axis[N_AXIS].name = ADD_STRING(can->name_rx, default_name_rx); joy->rx_mapping.stick = N_STICK; joy->rx_mapping.axis = N_AXIS; @@ -644,7 +644,7 @@ static void fill_joystick_info_using_caps_and_names(ALLEGRO_JOYSTICK_DIRECTX *jo } if (can->have_ry) { - info->stick[N_STICK].flags = ALLEGRO_JOYFLAG_DIGITAL | ALLEGRO_JOYFLAG_ANALOGUE; + info->stick[N_STICK].flags = A5O_JOYFLAG_DIGITAL | A5O_JOYFLAG_ANALOGUE; info->stick[N_STICK].axis[N_AXIS].name = ADD_STRING(can->name_ry, default_name_ry); joy->ry_mapping.stick = N_STICK; joy->ry_mapping.axis = N_AXIS; @@ -652,7 +652,7 @@ static void fill_joystick_info_using_caps_and_names(ALLEGRO_JOYSTICK_DIRECTX *jo } if (can->have_rz) { - info->stick[N_STICK].flags = ALLEGRO_JOYFLAG_DIGITAL | ALLEGRO_JOYFLAG_ANALOGUE; + info->stick[N_STICK].flags = A5O_JOYFLAG_DIGITAL | A5O_JOYFLAG_ANALOGUE; info->stick[N_STICK].axis[N_AXIS].name = ADD_STRING(can->name_rz, default_name_rz); joy->rz_mapping.stick = N_STICK; joy->rz_mapping.axis = N_AXIS; @@ -665,7 +665,7 @@ static void fill_joystick_info_using_caps_and_names(ALLEGRO_JOYSTICK_DIRECTX *jo /* sliders are assigned to one stick each */ for (i = 0; i < can->num_sliders; i++) { - info->stick[N_STICK].flags = ALLEGRO_JOYFLAG_DIGITAL | ALLEGRO_JOYFLAG_ANALOGUE; + info->stick[N_STICK].flags = A5O_JOYFLAG_DIGITAL | A5O_JOYFLAG_ANALOGUE; info->stick[N_STICK].num_axes = 1; info->stick[N_STICK].axis[0].name = ADD_STRING(NULL, "axis"); info->stick[N_STICK].name = ADD_STRING(can->name_slider[i], default_name_slider); @@ -676,7 +676,7 @@ static void fill_joystick_info_using_caps_and_names(ALLEGRO_JOYSTICK_DIRECTX *jo /* POV devices are assigned to one stick each */ for (i = 0; i < can->num_povs; i++) { - info->stick[N_STICK].flags = ALLEGRO_JOYFLAG_DIGITAL; + info->stick[N_STICK].flags = A5O_JOYFLAG_DIGITAL; info->stick[N_STICK].num_axes = 2; info->stick[N_STICK].axis[0].name = ADD_STRING(NULL, "left/right"); info->stick[N_STICK].axis[1].name = ADD_STRING(NULL, "up/down"); @@ -728,7 +728,7 @@ static void fill_joystick_info_using_caps_and_names(ALLEGRO_JOYSTICK_DIRECTX *jo } -#ifdef ALLEGRO_DINPUT_FILTER_XINPUT +#ifdef A5O_DINPUT_FILTER_XINPUT /* A better Xinput detection method inspired by from SDL. * The method proposed by Microsoft on their web site is problematic because it @@ -746,12 +746,12 @@ static bool dinput_is_device_xinput(const GUID *guid) /* Go through RAWINPUT (WinXP and later) to find HID devices. */ if ((GetRawInputDeviceList(NULL, &amount, sizeof (RAWINPUTDEVICELIST)) != 0)) { - ALLEGRO_ERROR("Could not get amount of raw input devices.\n"); + A5O_ERROR("Could not get amount of raw input devices.\n"); return false; /* drat... */ } if (amount < 1) { - ALLEGRO_ERROR("Could not get any of raw input devices.\n"); + A5O_ERROR("Could not get any of raw input devices.\n"); return false; /* drat again... */ } @@ -759,13 +759,13 @@ static bool dinput_is_device_xinput(const GUID *guid) al_malloc(sizeof(RAWINPUTDEVICELIST) * amount); if (!device_list) { - ALLEGRO_ERROR("Could allocate memory for raw input devices.\n"); + A5O_ERROR("Could allocate memory for raw input devices.\n"); return false; /* No luck. */ } if (GetRawInputDeviceList(device_list, &amount, sizeof(RAWINPUTDEVICELIST)) == ((UINT)-1)) { - ALLEGRO_ERROR("Could not retrieve %d raw input devices.\n", amount); + A5O_ERROR("Could not retrieve %d raw input devices.\n", amount); al_free((void *)device_list); return false; } @@ -781,7 +781,7 @@ static bool dinput_is_device_xinput(const GUID *guid) /* Get device info. */ if (GetRawInputDeviceInfoA(device->hDevice, RIDI_DEVICEINFO, &rdi, &rdi_size) == ((UINT)-1)) { - ALLEGRO_ERROR("Could not get raw device info for list index %d.\n", i); + A5O_ERROR("Could not get raw device info for list index %d.\n", i); continue; } /* See if vendor and product id match. */ @@ -793,19 +793,19 @@ static bool dinput_is_device_xinput(const GUID *guid) memset(device_name, 0, 128); if(GetRawInputDeviceInfoA(device->hDevice, RIDI_DEVICENAME, device_name, &name_size) == ((UINT)-1)) { - ALLEGRO_ERROR("Could not get raw device name for list index %d.\n", i); + A5O_ERROR("Could not get raw device name for list index %d.\n", i); continue; } /* See if there is IG_ in the name, if it is , it's an XInput device. */ - ALLEGRO_DEBUG("Checking for XInput : %s\n", device_name); + A5O_DEBUG("Checking for XInput : %s\n", device_name); if (strstr(device_name, "IG_") != NULL) { - ALLEGRO_DEBUG("Device %s is an XInput device.\n", device_name); + A5O_DEBUG("Device %s is an XInput device.\n", device_name); result = true; break; } } if (!found) { - ALLEGRO_ERROR("Could not find device %s in the raw device list.\n", + A5O_ERROR("Could not find device %s in the raw device list.\n", guid_to_string(guid)); result = true; /* Ignore "mystery" devices. Testing shows that on MinGW these are never @@ -872,7 +872,7 @@ static BOOL CALLBACK joystick_enum_callback(LPCDIDEVICEINSTANCE lpddi, LPVOID pv HRESULT hr; LPVOID temp; CAPS_AND_NAMES caps_and_names; - ALLEGRO_JOYSTICK_DIRECTX *joy = NULL; + A5O_JOYSTICK_DIRECTX *joy = NULL; int num; (void)pvRef; @@ -886,7 +886,7 @@ static BOOL CALLBACK joystick_enum_callback(LPCDIDEVICEINSTANCE lpddi, LPVOID pv */ joy = joydx_by_guid(lpddi->guidInstance, lpddi->guidProduct); if (joy) { - ALLEGRO_DEBUG("Device %s still exists\n", joydx_guid_string(joy)); + A5O_DEBUG("Device %s still exists\n", joydx_guid_string(joy)); joy->marked = true; return DIENUM_CONTINUE; } @@ -894,9 +894,9 @@ static BOOL CALLBACK joystick_enum_callback(LPCDIDEVICEINSTANCE lpddi, LPVOID pv /* If we are compiling the XInput driver, ignore XInput devices, those can go though the XInput driver, unless if the DirectInput driver was set explicitly in the configuration. */ - #ifdef ALLEGRO_DINPUT_FILTER_XINPUT + #ifdef A5O_DINPUT_FILTER_XINPUT if (dinput_is_device_xinput(&lpddi->guidProduct)) { - ALLEGRO_DEBUG("Filtered out XInput device %s\n", guid_to_string(&lpddi->guidInstance)); + A5O_DEBUG("Filtered out XInput device %s\n", guid_to_string(&lpddi->guidInstance)); goto Error; } #endif @@ -944,7 +944,7 @@ static BOOL CALLBACK joystick_enum_callback(LPCDIDEVICEINSTANCE lpddi, LPVOID pv /* set up the joystick structure */ joy = joydx_allocate_structure(&num); if (!joy) { - ALLEGRO_ERROR("Joystick array full\n"); + A5O_ERROR("Joystick array full\n"); goto Error; } @@ -968,7 +968,7 @@ static BOOL CALLBACK joystick_enum_callback(LPCDIDEVICEINSTANCE lpddi, LPVOID pv hr = IDirectInputDevice8_SetEventNotification(joy->device, joy->waker_event); if (FAILED(hr)) { - ALLEGRO_ERROR("SetEventNotification failed for joystick %d: %s\n", + A5O_ERROR("SetEventNotification failed for joystick %d: %s\n", num, dinput_err_str(hr)); goto Error; } @@ -986,7 +986,7 @@ static BOOL CALLBACK joystick_enum_callback(LPCDIDEVICEINSTANCE lpddi, LPVOID pv joy->waker_event = CreateWaitableTimer(NULL, false, NULL); if (joy->waker_event == NULL) { - ALLEGRO_ERROR("CreateWaitableTimer failed for polled device.\n"); + A5O_ERROR("CreateWaitableTimer failed for polled device.\n"); goto Error; } @@ -999,7 +999,7 @@ static BOOL CALLBACK joystick_enum_callback(LPCDIDEVICEINSTANCE lpddi, LPVOID pv } } - ALLEGRO_INFO("Joystick %d initialized, GUID: %s\n", + A5O_INFO("Joystick %d initialized, GUID: %s\n", num, joydx_guid_string(joy)); config_needs_merging = true; @@ -1020,7 +1020,7 @@ static BOOL CALLBACK joystick_enum_callback(LPCDIDEVICEINSTANCE lpddi, LPVOID pv } -static void joydx_inactivate_joy(ALLEGRO_JOYSTICK_DIRECTX *joy) +static void joydx_inactivate_joy(A5O_JOYSTICK_DIRECTX *joy) { if (joy->config_state == STATE_UNUSED) return; @@ -1053,8 +1053,8 @@ static void joydx_inactivate_joy(ALLEGRO_JOYSTICK_DIRECTX *joy) static void joydx_generate_configure_event(void) { - ALLEGRO_EVENT event; - event.joystick.type = ALLEGRO_EVENT_JOYSTICK_CONFIGURATION; + A5O_EVENT event; + event.joystick.type = A5O_EVENT_JOYSTICK_CONFIGURATION; event.joystick.timestamp = al_get_time(); _al_generate_joystick_event(&event); @@ -1082,10 +1082,10 @@ static bool joydx_scan(bool configure) /* Schedule unmarked structures to be inactivated. */ for (i = 0; i < MAX_JOYSTICKS; i++) { - ALLEGRO_JOYSTICK_DIRECTX *joy = &joydx_joystick[i]; + A5O_JOYSTICK_DIRECTX *joy = &joydx_joystick[i]; if (joy->config_state == STATE_ALIVE && !joy->marked) { - ALLEGRO_DEBUG("Joystick %s to be inactivated\n", joydx_guid_string(joy)); + A5O_DEBUG("Joystick %s to be inactivated\n", joydx_guid_string(joy)); joy->config_state = STATE_DYING; config_needs_merging = true; } @@ -1107,7 +1107,7 @@ static void joydx_merge(void) joydx_num_joysticks = 0; for (i = 0; i < MAX_JOYSTICKS; i++) { - ALLEGRO_JOYSTICK_DIRECTX *joy = &joydx_joystick[i]; + A5O_JOYSTICK_DIRECTX *joy = &joydx_joystick[i]; switch (joy->config_state) { case STATE_UNUSED: @@ -1116,7 +1116,7 @@ static void joydx_merge(void) case STATE_BORN: hr = IDirectInputDevice8_Acquire(joy->device); if (FAILED(hr)) { - ALLEGRO_ERROR("acquire joystick %d failed: %s\n", + A5O_ERROR("acquire joystick %d failed: %s\n", i, dinput_err_str(hr)); } joy->config_state = STATE_ALIVE; @@ -1132,7 +1132,7 @@ static void joydx_merge(void) } } - ALLEGRO_INFO("Merged, num joysticks=%d\n", joydx_num_joysticks); + A5O_INFO("Merged, num joysticks=%d\n", joydx_num_joysticks); joystick_dinput_acquire(); } @@ -1150,20 +1150,20 @@ static void joydx_merge(void) static bool joydx_init_joystick(void) { HRESULT hr; - ALLEGRO_SYSTEM *system; + A5O_SYSTEM *system; size_t i; MAKE_UNION(&joystick_dinput, LPDIRECTINPUT *); - ALLEGRO_ASSERT(!joystick_dinput); - ALLEGRO_ASSERT(!joydx_num_joysticks); - ALLEGRO_ASSERT(!joydx_thread); - ALLEGRO_ASSERT(!STOP_EVENT); + A5O_ASSERT(!joystick_dinput); + A5O_ASSERT(!joydx_num_joysticks); + A5O_ASSERT(!joydx_thread); + A5O_ASSERT(!STOP_EVENT); /* load DirectInput module */ _al_dinput_module = _al_win_safe_load_library(_al_dinput_module_name); if (_al_dinput_module == NULL) { - ALLEGRO_ERROR("Failed to open '%s' library\n", _al_dinput_module_name); + A5O_ERROR("Failed to open '%s' library\n", _al_dinput_module_name); joystick_dinput = NULL; return false; } @@ -1171,7 +1171,7 @@ static bool joydx_init_joystick(void) /* import DirectInput create proc */ _al_dinput_create = (DIRECTINPUT8CREATEPROC)GetProcAddress(_al_dinput_module, "DirectInput8Create"); if (_al_dinput_create == NULL) { - ALLEGRO_ERROR("DirectInput8Create not in %s\n", _al_dinput_module_name); + A5O_ERROR("DirectInput8Create not in %s\n", _al_dinput_module_name); FreeLibrary(_al_dinput_module); joystick_dinput = NULL; return false; @@ -1180,7 +1180,7 @@ static bool joydx_init_joystick(void) /* get the DirectInput interface */ hr = _al_dinput_create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, __al_IID_IDirectInput8, u.v, NULL); if (FAILED(hr)) { - ALLEGRO_ERROR("Failed to create DirectInput interface\n"); + A5O_ERROR("Failed to create DirectInput interface\n"); FreeLibrary(_al_dinput_module); joystick_dinput = NULL; return false; @@ -1201,8 +1201,8 @@ static bool joydx_init_joystick(void) /* If one of our windows is the foreground window make it grab the input. */ system = al_get_system_driver(); for (i = 0; i < _al_vector_size(&system->displays); i++) { - ALLEGRO_DISPLAY_WIN **pwin_disp = (ALLEGRO_DISPLAY_WIN **)_al_vector_ref(&system->displays, i); - ALLEGRO_DISPLAY_WIN *win_disp = *pwin_disp; + A5O_DISPLAY_WIN **pwin_disp = (A5O_DISPLAY_WIN **)_al_vector_ref(&system->displays, i); + A5O_DISPLAY_WIN *win_disp = *pwin_disp; if (win_disp->window == GetForegroundWindow()) { _al_win_wnd_call_proc(win_disp->window, _al_win_joystick_dinput_grab, win_disp); @@ -1223,12 +1223,12 @@ static bool joydx_init_joystick(void) static void joydx_exit_joystick(void) { int i; - ALLEGRO_SYSTEM *system; + A5O_SYSTEM *system; size_t j; - ALLEGRO_DEBUG("Entering joydx_exit_joystick\n"); + A5O_DEBUG("Entering joydx_exit_joystick\n"); - ALLEGRO_ASSERT(joydx_thread); + A5O_ASSERT(joydx_thread); /* stop the thread */ SetEvent(STOP_EVENT); @@ -1244,10 +1244,10 @@ static void joydx_exit_joystick(void) /* The toplevel display is assumed to have the input acquired. Release it. */ system = al_get_system_driver(); for (j = 0; j < _al_vector_size(&system->displays); j++) { - ALLEGRO_DISPLAY_WIN **pwin_disp = (ALLEGRO_DISPLAY_WIN **)_al_vector_ref(&system->displays, j); - ALLEGRO_DISPLAY_WIN *win_disp = *pwin_disp; + A5O_DISPLAY_WIN **pwin_disp = (A5O_DISPLAY_WIN **)_al_vector_ref(&system->displays, j); + A5O_DISPLAY_WIN *win_disp = *pwin_disp; if (win_disp->window == GetForegroundWindow()) { - ALLEGRO_DEBUG("Requesting window unacquire joystick devices\n"); + A5O_DEBUG("Requesting window unacquire joystick devices\n"); _al_win_wnd_call_proc(win_disp->window, _al_win_joystick_dinput_unacquire, win_disp); @@ -1272,7 +1272,7 @@ static void joydx_exit_joystick(void) FreeLibrary(_al_dinput_module); _al_dinput_module = NULL; - ALLEGRO_DEBUG("Leaving joydx_exit_joystick\n"); + A5O_DEBUG("Leaving joydx_exit_joystick\n"); } @@ -1309,23 +1309,23 @@ static int joydx_get_num_joysticks(void) /* joydx_get_joystick: [primary thread] * - * Returns the address of a ALLEGRO_JOYSTICK structure for the device + * Returns the address of a A5O_JOYSTICK structure for the device * number NUM. */ -static ALLEGRO_JOYSTICK *joydx_get_joystick(int num) +static A5O_JOYSTICK *joydx_get_joystick(int num) { - ALLEGRO_JOYSTICK *ret = NULL; + A5O_JOYSTICK *ret = NULL; unsigned i; - ALLEGRO_ASSERT(num >= 0); + A5O_ASSERT(num >= 0); EnterCriticalSection(&joydx_thread_cs); for (i = 0; i < MAX_JOYSTICKS; i++) { - ALLEGRO_JOYSTICK_DIRECTX *joy = &joydx_joystick[i]; + A5O_JOYSTICK_DIRECTX *joy = &joydx_joystick[i]; if (ACTIVE_STATE(joy->config_state)) { if (num == 0) { - ret = (ALLEGRO_JOYSTICK *)joy; + ret = (A5O_JOYSTICK *)joy; break; } num--; @@ -1339,7 +1339,7 @@ static ALLEGRO_JOYSTICK *joydx_get_joystick(int num) #if 0 /* is this needed? */ if (ret) { - ALLEGRO_DISPLAY *display = al_get_current_display(); + A5O_DISPLAY *display = al_get_current_display(); if (display) _al_win_joystick_dinput_grab(display); } @@ -1353,7 +1353,7 @@ static ALLEGRO_JOYSTICK *joydx_get_joystick(int num) /* joydx_release_joystick: [primary thread] * Releases a previously gotten joystick. */ -static void joydx_release_joystick(ALLEGRO_JOYSTICK *joy) +static void joydx_release_joystick(A5O_JOYSTICK *joy) { (void)joy; } @@ -1362,10 +1362,10 @@ static void joydx_release_joystick(ALLEGRO_JOYSTICK *joy) /* joydx_get_joystick_state: [primary thread] * Copy the internal joystick state to a user-provided structure. */ -static void joydx_get_joystick_state(ALLEGRO_JOYSTICK *joy_, ALLEGRO_JOYSTICK_STATE *ret_state) +static void joydx_get_joystick_state(A5O_JOYSTICK *joy_, A5O_JOYSTICK_STATE *ret_state) { - ALLEGRO_JOYSTICK_DIRECTX *joy = (ALLEGRO_JOYSTICK_DIRECTX *)joy_; - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_JOYSTICK_DIRECTX *joy = (A5O_JOYSTICK_DIRECTX *)joy_; + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); _al_event_source_lock(es); { @@ -1375,16 +1375,16 @@ static void joydx_get_joystick_state(ALLEGRO_JOYSTICK *joy_, ALLEGRO_JOYSTICK_ST } -static const char *joydx_get_name(ALLEGRO_JOYSTICK *joy_) +static const char *joydx_get_name(A5O_JOYSTICK *joy_) { - ALLEGRO_JOYSTICK_DIRECTX *joy = (ALLEGRO_JOYSTICK_DIRECTX *)joy_; + A5O_JOYSTICK_DIRECTX *joy = (A5O_JOYSTICK_DIRECTX *)joy_; return joy->name; } -static bool joydx_get_active(ALLEGRO_JOYSTICK *joy) +static bool joydx_get_active(A5O_JOYSTICK *joy) { - ALLEGRO_JOYSTICK_DIRECTX *joydx = (ALLEGRO_JOYSTICK_DIRECTX *)joy; + A5O_JOYSTICK_DIRECTX *joydx = (A5O_JOYSTICK_DIRECTX *)joy; return ACTIVE_STATE(joydx->config_state); } @@ -1434,7 +1434,7 @@ static unsigned __stdcall joydx_thread_proc(LPVOID unused) } if (i == MAX_JOYSTICKS) { - ALLEGRO_WARN("unable to match event to joystick\n"); + A5O_WARN("unable to match event to joystick\n"); } } } @@ -1451,15 +1451,15 @@ static unsigned __stdcall joydx_thread_proc(LPVOID unused) /* update_joystick: [joystick thread] * Reads in data for a single DirectInput joystick device, updates - * the internal ALLEGRO_JOYSTICK_STATE structure, and generates any Allegro + * the internal A5O_JOYSTICK_STATE structure, and generates any Allegro * events required. */ -static void update_joystick(ALLEGRO_JOYSTICK_DIRECTX *joy) +static void update_joystick(A5O_JOYSTICK_DIRECTX *joy) { DIDEVICEOBJECTDATA buffer[DEVICE_BUFFER_SIZE]; DWORD num_items = DEVICE_BUFFER_SIZE; HRESULT hr; - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); /* some devices require polling */ IDirectInputDevice8_Poll(joy->device); @@ -1469,10 +1469,10 @@ static void update_joystick(ALLEGRO_JOYSTICK_DIRECTX *joy) if (hr != DI_OK && hr != DI_BUFFEROVERFLOW) { if ((hr == DIERR_NOTACQUIRED) || (hr == DIERR_INPUTLOST)) { - ALLEGRO_WARN("joystick device not acquired or lost\n"); + A5O_WARN("joystick device not acquired or lost\n"); } else { - ALLEGRO_ERROR("unexpected error while polling the joystick\n"); + A5O_ERROR("unexpected error while polling the joystick\n"); } return; } @@ -1535,7 +1535,7 @@ static void update_joystick(ALLEGRO_JOYSTICK_DIRECTX *joy) * Helper function to handle a state change in a non-POV axis. * The joystick must be locked BEFORE entering this function. */ -static void handle_axis_event(ALLEGRO_JOYSTICK_DIRECTX *joy, const AXIS_MAPPING *axis_mapping, DWORD value) +static void handle_axis_event(A5O_JOYSTICK_DIRECTX *joy, const AXIS_MAPPING *axis_mapping, DWORD value) { const int stick = axis_mapping->stick; const int axis = axis_mapping->axis; @@ -1558,7 +1558,7 @@ static void handle_axis_event(ALLEGRO_JOYSTICK_DIRECTX *joy, const AXIS_MAPPING * Helper function to handle a state change in a POV device. * The joystick must be locked BEFORE entering this function. */ -static void handle_pov_event(ALLEGRO_JOYSTICK_DIRECTX *joy, int stick, DWORD _value) +static void handle_pov_event(A5O_JOYSTICK_DIRECTX *joy, int stick, DWORD _value) { int value = _value; float old_p0, old_p1; @@ -1604,18 +1604,18 @@ static void handle_pov_event(ALLEGRO_JOYSTICK_DIRECTX *joy, int stick, DWORD _va * Helper function to handle a state change in a button. * The joystick must be locked BEFORE entering this function. */ -static void handle_button_event(ALLEGRO_JOYSTICK_DIRECTX *joy, int button, bool down) +static void handle_button_event(A5O_JOYSTICK_DIRECTX *joy, int button, bool down) { if (button < 0 && button >= joy->parent.info.num_buttons) return; if (down) { joy->joystate.button[button] = 32767; - generate_button_event(joy, button, ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN); + generate_button_event(joy, button, A5O_EVENT_JOYSTICK_BUTTON_DOWN); } else { joy->joystate.button[button] = 0; - generate_button_event(joy, button, ALLEGRO_EVENT_JOYSTICK_BUTTON_UP); + generate_button_event(joy, button, A5O_EVENT_JOYSTICK_BUTTON_UP); } } @@ -1625,17 +1625,17 @@ static void handle_button_event(ALLEGRO_JOYSTICK_DIRECTX *joy, int button, bool * Helper to generate an event after an axis is moved. * The joystick must be locked BEFORE entering this function. */ -static void generate_axis_event(ALLEGRO_JOYSTICK_DIRECTX *joy, int stick, int axis, float pos) +static void generate_axis_event(A5O_JOYSTICK_DIRECTX *joy, int stick, int axis, float pos) { - ALLEGRO_EVENT event; - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_EVENT event; + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); if (!_al_event_source_needs_to_generate_event(es)) return; - event.joystick.type = ALLEGRO_EVENT_JOYSTICK_AXIS; + event.joystick.type = A5O_EVENT_JOYSTICK_AXIS; event.joystick.timestamp = al_get_time(); - event.joystick.id = (ALLEGRO_JOYSTICK *)joy; + event.joystick.id = (A5O_JOYSTICK *)joy; event.joystick.stick = stick; event.joystick.axis = axis; event.joystick.pos = pos; @@ -1650,17 +1650,17 @@ static void generate_axis_event(ALLEGRO_JOYSTICK_DIRECTX *joy, int stick, int ax * Helper to generate an event after a button is pressed or released. * The joystick must be locked BEFORE entering this function. */ -static void generate_button_event(ALLEGRO_JOYSTICK_DIRECTX *joy, int button, ALLEGRO_EVENT_TYPE event_type) +static void generate_button_event(A5O_JOYSTICK_DIRECTX *joy, int button, A5O_EVENT_TYPE event_type) { - ALLEGRO_EVENT event; - ALLEGRO_EVENT_SOURCE *es = al_get_joystick_event_source(); + A5O_EVENT event; + A5O_EVENT_SOURCE *es = al_get_joystick_event_source(); if (!_al_event_source_needs_to_generate_event(es)) return; event.joystick.type = event_type; event.joystick.timestamp = al_get_time(); - event.joystick.id = (ALLEGRO_JOYSTICK *)joy; + event.joystick.id = (A5O_JOYSTICK *)joy; event.joystick.stick = 0; event.joystick.axis = 0; event.joystick.pos = 0.0; diff --git a/src/win/wjoyxi.c b/src/win/wjoyxi.c index 15333843dc..8e87183f75 100644 --- a/src/win/wjoyxi.c +++ b/src/win/wjoyxi.c @@ -17,7 +17,7 @@ */ -#define ALLEGRO_NO_COMPATIBILITY +#define A5O_NO_COMPATIBILITY /* For waitable timers */ #define _WIN32_WINNT 0x0501 @@ -30,24 +30,24 @@ #include "allegro5/internal/aintern_bitmap.h" -#ifdef ALLEGRO_CFG_XINPUT +#ifdef A5O_CFG_XINPUT /* Don't compile this lot if xinput isn't supported. */ -#ifndef ALLEGRO_WINDOWS +#ifndef A5O_WINDOWS #error something is wrong with the makefile #endif -#ifdef ALLEGRO_MINGW32 +#ifdef A5O_MINGW32 #undef MAKEFOURCC #endif /* Poll connected joysticks frequently and non-connected ones infrequently. */ -#ifndef ALLEGRO_XINPUT_POLL_DELAY -#define ALLEGRO_XINPUT_POLL_DELAY 0.01 +#ifndef A5O_XINPUT_POLL_DELAY +#define A5O_XINPUT_POLL_DELAY 0.01 #endif -#ifndef ALLEGRO_XINPUT_DISCONNECTED_POLL_DELAY -#define ALLEGRO_XINPUT_DISCONNECTED_POLL_DELAY 1.50 +#ifndef A5O_XINPUT_DISCONNECTED_POLL_DELAY +#define A5O_XINPUT_DISCONNECTED_POLL_DELAY 1.50 #endif @@ -63,13 +63,13 @@ * for the best. * This does no harm on msys2 either, they have a sal.h header. */ -#ifdef ALLEGRO_HAVE_SAL_H +#ifdef A5O_HAVE_SAL_H #include #endif #include -ALLEGRO_DEBUG_CHANNEL("xinput") +A5O_DEBUG_CHANNEL("xinput") #include "allegro5/joystick.h" #include "allegro5/internal/aintern_joystick.h" @@ -81,15 +81,15 @@ static bool joyxi_init_joystick(void); static void joyxi_exit_joystick(void); static bool joyxi_reconfigure_joysticks(void); static int joyxi_get_num_joysticks(void); -static ALLEGRO_JOYSTICK *joyxi_get_joystick(int num); -static void joyxi_release_joystick(ALLEGRO_JOYSTICK *joy); -static void joyxi_get_joystick_state(ALLEGRO_JOYSTICK *joy, ALLEGRO_JOYSTICK_STATE *ret_state); -static const char *joyxi_get_name(ALLEGRO_JOYSTICK *joy); -static bool joyxi_get_active(ALLEGRO_JOYSTICK *joy); +static A5O_JOYSTICK *joyxi_get_joystick(int num); +static void joyxi_release_joystick(A5O_JOYSTICK *joy); +static void joyxi_get_joystick_state(A5O_JOYSTICK *joy, A5O_JOYSTICK_STATE *ret_state); +static const char *joyxi_get_name(A5O_JOYSTICK *joy); +static bool joyxi_get_active(A5O_JOYSTICK *joy); /* the driver vtable */ -ALLEGRO_JOYSTICK_DRIVER _al_joydrv_xinput = +A5O_JOYSTICK_DRIVER _al_joydrv_xinput = { AL_JOY_TYPE_XINPUT, "", @@ -109,7 +109,7 @@ ALLEGRO_JOYSTICK_DRIVER _al_joydrv_xinput = #define XINPUT_MIN_VERSION 3 #define XINPUT_MAX_VERSION 4 -#ifndef ALLEGRO_CFG_HAVE_XINPUT_CAPABILITIES_EX +#ifndef A5O_CFG_HAVE_XINPUT_CAPABILITIES_EX typedef struct _XINPUT_CAPABILITIES_EX { XINPUT_CAPABILITIES Capabilities; @@ -136,16 +136,16 @@ static XInputGetCapabilitiesExPROC _imp_XInputGetCapabilitiesEx = NULL; XInputSetStatePROC _al_imp_XInputSetState = NULL; /* the joystick structures */ -static ALLEGRO_JOYSTICK_XINPUT joyxi_joysticks[MAX_JOYSTICKS]; +static A5O_JOYSTICK_XINPUT joyxi_joysticks[MAX_JOYSTICKS]; /* For the background threads. */ -static ALLEGRO_THREAD *joyxi_thread = NULL; -static ALLEGRO_THREAD *joyxi_disconnected_thread = NULL; -static ALLEGRO_MUTEX *joyxi_mutex = NULL; +static A5O_THREAD *joyxi_thread = NULL; +static A5O_THREAD *joyxi_disconnected_thread = NULL; +static A5O_MUTEX *joyxi_mutex = NULL; /* Use condition variables to put the thread to sleep and prevent too frequent polling*/ -static ALLEGRO_COND *joyxi_cond = NULL; -static ALLEGRO_COND *joyxi_disconnected_cond = NULL; +static A5O_COND *joyxi_cond = NULL; +static A5O_COND *joyxi_disconnected_cond = NULL; /* Names for things in because XInput doesn't provide them. */ @@ -227,7 +227,7 @@ static bool _imp_load_xinput_module_version(int version) _imp_XInputGetCapabilitiesEx = (XInputGetCapabilitiesExPROC)GetProcAddress(_imp_xinput_module, (char*)108); _al_imp_XInputSetState = (XInputSetStatePROC)GetProcAddress(_imp_xinput_module, "XInputSetState"); - ALLEGRO_INFO("Module \"%s\" loaded.\n", module_name); + A5O_INFO("Module \"%s\" loaded.\n", module_name); return true; } @@ -247,7 +247,7 @@ static bool load_xinput_module(void) errno = 0; version = strtol(value, NULL, 10); if (errno) { - ALLEGRO_ERROR("Failed to override XInput version. \"%s\" is not valid integer number.", value); + A5O_ERROR("Failed to override XInput version. \"%s\" is not valid integer number.", value); return false; } else @@ -259,7 +259,7 @@ static bool load_xinput_module(void) if (_imp_load_xinput_module_version((int)version)) return true; - ALLEGRO_ERROR("Failed to load XInput library. Library is not installed."); + A5O_ERROR("Failed to load XInput library. Library is not installed."); return false; } @@ -271,8 +271,8 @@ static bool load_xinput_module(void) static void joyxi_generate_reconfigure_event(void) { - ALLEGRO_EVENT_SOURCE *source; - ALLEGRO_EVENT event; + A5O_EVENT_SOURCE *source; + A5O_EVENT event; /* There is a potential race condition with all of the generate functions * in this source file where al_get_joystick_event_source is returning NULL @@ -288,7 +288,7 @@ static void joyxi_generate_reconfigure_event(void) if (!_al_event_source_needs_to_generate_event(source)) return; - event.type = ALLEGRO_EVENT_JOYSTICK_CONFIGURATION; + event.type = A5O_EVENT_JOYSTICK_CONFIGURATION; event.any.timestamp = al_get_time(); event.any.source = source; _al_event_source_emit_event(source, &event); @@ -297,10 +297,10 @@ static void joyxi_generate_reconfigure_event(void) /* Helper to generate an event after an axis is moved. * The joystick must be locked BEFORE entering this function. */ -static void joyxi_generate_axis_event(ALLEGRO_JOYSTICK_XINPUT *joy, int stick, int axis, float pos) +static void joyxi_generate_axis_event(A5O_JOYSTICK_XINPUT *joy, int stick, int axis, float pos) { - ALLEGRO_EVENT event; - ALLEGRO_EVENT_SOURCE *es; + A5O_EVENT event; + A5O_EVENT_SOURCE *es; if (!al_is_joystick_installed()) return; @@ -310,14 +310,14 @@ static void joyxi_generate_axis_event(ALLEGRO_JOYSTICK_XINPUT *joy, int stick, i if (!_al_event_source_needs_to_generate_event(es)) return; - event.joystick.type = ALLEGRO_EVENT_JOYSTICK_AXIS; + event.joystick.type = A5O_EVENT_JOYSTICK_AXIS; event.joystick.timestamp = al_get_time(); - event.joystick.id = (ALLEGRO_JOYSTICK *)&joy->parent; + event.joystick.id = (A5O_JOYSTICK *)&joy->parent; event.joystick.stick = stick; event.joystick.axis = axis; event.joystick.pos = pos; event.joystick.button = 0; - ALLEGRO_DEBUG("Generating an axis event on stick %d axis %d value %f:\n", stick, axis, pos); + A5O_DEBUG("Generating an axis event on stick %d axis %d value %f:\n", stick, axis, pos); _al_event_source_emit_event(es, &event); } @@ -326,10 +326,10 @@ static void joyxi_generate_axis_event(ALLEGRO_JOYSTICK_XINPUT *joy, int stick, i /* Helper to generate an event after a button is pressed or released. * The joystick must be locked BEFORE entering this function. */ -static void joyxi_generate_button_event(ALLEGRO_JOYSTICK_XINPUT *joy, int button, ALLEGRO_EVENT_TYPE event_type) +static void joyxi_generate_button_event(A5O_JOYSTICK_XINPUT *joy, int button, A5O_EVENT_TYPE event_type) { - ALLEGRO_EVENT event; - ALLEGRO_EVENT_SOURCE *es; + A5O_EVENT event; + A5O_EVENT_SOURCE *es; if (!al_is_joystick_installed()) return; @@ -341,12 +341,12 @@ static void joyxi_generate_button_event(ALLEGRO_JOYSTICK_XINPUT *joy, int button event.joystick.type = event_type; event.joystick.timestamp = al_get_time(); - event.joystick.id = (ALLEGRO_JOYSTICK *)joy; + event.joystick.id = (A5O_JOYSTICK *)joy; event.joystick.stick = 0; event.joystick.axis = 0; event.joystick.pos = 0.0; event.joystick.button = button; - ALLEGRO_DEBUG("Generating an button event on button %d type %d:\n", button, event_type); + A5O_DEBUG("Generating an button event on button %d type %d:\n", button, event_type); _al_event_source_emit_event(es, &event); } @@ -366,7 +366,7 @@ static float joyxi_convert_trigger(BYTE value) } /* Converts an XInput state to an Allegro joystick state. */ -static void joyxi_convert_state(ALLEGRO_JOYSTICK_STATE *alstate, XINPUT_STATE *xistate) +static void joyxi_convert_state(A5O_JOYSTICK_STATE *alstate, XINPUT_STATE *xistate) { int index; /* Wipe the allegro state clean. */ @@ -396,8 +396,8 @@ static void joyxi_convert_state(ALLEGRO_JOYSTICK_STATE *alstate, XINPUT_STATE *x /* Emits joystick events for the difference between the new and old joystick state. */ static void joyxi_emit_events( - ALLEGRO_JOYSTICK_XINPUT *xjoy, - ALLEGRO_JOYSTICK_STATE *newstate, ALLEGRO_JOYSTICK_STATE *oldstate) + A5O_JOYSTICK_XINPUT *xjoy, + A5O_JOYSTICK_STATE *newstate, A5O_JOYSTICK_STATE *oldstate) { int index, subdex; /* Send events for buttons. */ @@ -406,8 +406,8 @@ static void joyxi_emit_events( int oldbutton = oldstate->button[index]; if (newbutton != oldbutton) { int type = (oldbutton > newbutton ? - ALLEGRO_EVENT_JOYSTICK_BUTTON_UP : - ALLEGRO_EVENT_JOYSTICK_BUTTON_DOWN); + A5O_EVENT_JOYSTICK_BUTTON_UP : + A5O_EVENT_JOYSTICK_BUTTON_DOWN); joyxi_generate_button_event(xjoy, index, type); } } @@ -425,10 +425,10 @@ static void joyxi_emit_events( /* Polling function for a joystick that is currently active. */ -static void joyxi_poll_connected_joystick(ALLEGRO_JOYSTICK_XINPUT *xjoy) +static void joyxi_poll_connected_joystick(A5O_JOYSTICK_XINPUT *xjoy) { XINPUT_STATE xistate; - ALLEGRO_JOYSTICK_STATE alstate; + A5O_JOYSTICK_STATE alstate; DWORD res = _imp_XInputGetState(xjoy->index, &xistate); if (res != ERROR_SUCCESS) { /* Assume joystick was disconnected, need to reconfigure. */ @@ -441,7 +441,7 @@ static void joyxi_poll_connected_joystick(ALLEGRO_JOYSTICK_XINPUT *xjoy) if (xistate.dwPacketNumber == xjoy->state.dwPacketNumber) return; - ALLEGRO_DEBUG("XInput joystick state change detected.\n"); + A5O_DEBUG("XInput joystick state change detected.\n"); /* If we get here translate the state and send the needed events. */ joyxi_convert_state(&alstate, &xistate); @@ -455,7 +455,7 @@ static void joyxi_poll_connected_joystick(ALLEGRO_JOYSTICK_XINPUT *xjoy) /* Polling function for a joystick that is currently not active. Care is taken to do this infrequently so performance doesn't suffer too much. */ -static void joyxi_poll_disconnected_joystick(ALLEGRO_JOYSTICK_XINPUT *xjoy) +static void joyxi_poll_disconnected_joystick(A5O_JOYSTICK_XINPUT *xjoy) { XINPUT_CAPABILITIES xicapas; DWORD res; @@ -494,13 +494,13 @@ static void joyxi_poll_disconnected_joysticks(void) } /** Thread function that polls the active xinput joysticks. */ -static void *joyxi_poll_thread(ALLEGRO_THREAD *thread, void *arg) +static void *joyxi_poll_thread(A5O_THREAD *thread, void *arg) { - ALLEGRO_TIMEOUT timeout; + A5O_TIMEOUT timeout; al_lock_mutex(joyxi_mutex); /* Poll once every so much time, 10ms by default. */ while (!al_get_thread_should_stop(thread)) { - al_init_timeout(&timeout, ALLEGRO_XINPUT_POLL_DELAY); + al_init_timeout(&timeout, A5O_XINPUT_POLL_DELAY); /* Wait for the condition for the polling time in stead of using al_rest to allows the polling thread to be awoken when needed. */ al_wait_cond_until(joyxi_cond, joyxi_mutex, &timeout); @@ -514,13 +514,13 @@ static void *joyxi_poll_thread(ALLEGRO_THREAD *thread, void *arg) } /** Thread function that polls the disconnected joysticks. */ -static void *joyxi_poll_disconnected_thread(ALLEGRO_THREAD *thread, void *arg) +static void *joyxi_poll_disconnected_thread(A5O_THREAD *thread, void *arg) { - ALLEGRO_TIMEOUT timeout; + A5O_TIMEOUT timeout; al_lock_mutex(joyxi_mutex); /* Poll once every so much time, 10ms by default. */ while (!al_get_thread_should_stop(thread)) { - al_init_timeout(&timeout, ALLEGRO_XINPUT_DISCONNECTED_POLL_DELAY); + al_init_timeout(&timeout, A5O_XINPUT_DISCONNECTED_POLL_DELAY); /* Wait for the condition for the polling time in stead of using al_rest to allows the polling thread to be awoken when needed. */ al_wait_cond_until(joyxi_disconnected_cond, joyxi_mutex, &timeout); @@ -536,7 +536,7 @@ static void *joyxi_poll_disconnected_thread(ALLEGRO_THREAD *thread, void *arg) /* Initializes the info part of the joystick. */ -static void joyxi_init_joystick_info(ALLEGRO_JOYSTICK_XINPUT *xjoy) +static void joyxi_init_joystick_info(A5O_JOYSTICK_XINPUT *xjoy) { int index, subdex; _AL_JOYSTICK_INFO *info = &xjoy->parent.info; @@ -552,7 +552,7 @@ static void joyxi_init_joystick_info(ALLEGRO_JOYSTICK_XINPUT *xjoy) for (index = 0; index < MAX_STICKS; index++) { info->stick[index].name = joyxi_stick_names[index]; info->stick[index].num_axes = joyxi_axis_per_stick[index]; - info->stick[index].flags = ALLEGRO_JOYFLAG_ANALOGUE; + info->stick[index].flags = A5O_JOYFLAG_ANALOGUE; for (subdex = 0; subdex < joyxi_axis_per_stick[index]; subdex++) { info->stick[index].axis[subdex].name = joyxi_axis_names[index][subdex]; } @@ -681,7 +681,7 @@ static int joyxi_get_num_joysticks(void) return result; } -static ALLEGRO_JOYSTICK *joyxi_get_joystick(int num) +static A5O_JOYSTICK *joyxi_get_joystick(int num) { int al_number = 0, index; /* Use a linear scan, so the first active joystick ends up as the first @@ -698,15 +698,15 @@ static ALLEGRO_JOYSTICK *joyxi_get_joystick(int num) } -static void joyxi_release_joystick(ALLEGRO_JOYSTICK *joy) +static void joyxi_release_joystick(A5O_JOYSTICK *joy) { /* No need to do anything. */ (void)joy; } -static void joyxi_get_joystick_state(ALLEGRO_JOYSTICK *joy, ALLEGRO_JOYSTICK_STATE *ret_state) +static void joyxi_get_joystick_state(A5O_JOYSTICK *joy, A5O_JOYSTICK_STATE *ret_state) { - ALLEGRO_JOYSTICK_XINPUT *xjoy = (ALLEGRO_JOYSTICK_XINPUT *)joy; + A5O_JOYSTICK_XINPUT *xjoy = (A5O_JOYSTICK_XINPUT *)joy; ASSERT(xjoy); ASSERT(ret_state); /* Copy the data with the mutex @@ -781,9 +781,9 @@ static const char *joyxi_lookup_device_name(WORD vid, WORD pid) } -static const char *joyxi_get_name(ALLEGRO_JOYSTICK *joy) +static const char *joyxi_get_name(A5O_JOYSTICK *joy) { - ALLEGRO_JOYSTICK_XINPUT *xjoy = (ALLEGRO_JOYSTICK_XINPUT *)joy; + A5O_JOYSTICK_XINPUT *xjoy = (A5O_JOYSTICK_XINPUT *)joy; ASSERT(xjoy); if (xjoy->name[0] == '\0') { @@ -807,12 +807,12 @@ static const char *joyxi_get_name(ALLEGRO_JOYSTICK *joy) } -static bool joyxi_get_active(ALLEGRO_JOYSTICK *joy) +static bool joyxi_get_active(A5O_JOYSTICK *joy) { - ALLEGRO_JOYSTICK_XINPUT *xjoy = (ALLEGRO_JOYSTICK_XINPUT *)joy; + A5O_JOYSTICK_XINPUT *xjoy = (A5O_JOYSTICK_XINPUT *)joy; ASSERT(xjoy); return xjoy->active; } -#endif /* #ifdef ALLEGRO_CFG_XINPUT */ +#endif /* #ifdef A5O_CFG_XINPUT */ diff --git a/src/win/wkeyboard.c b/src/win/wkeyboard.c index b1bff956bc..1f5df87dea 100644 --- a/src/win/wkeyboard.c +++ b/src/win/wkeyboard.c @@ -29,94 +29,94 @@ #endif static bool installed = false; -static ALLEGRO_KEYBOARD the_keyboard; -static ALLEGRO_KEYBOARD_STATE the_state; +static A5O_KEYBOARD the_keyboard; +static A5O_KEYBOARD_STATE the_state; static int modifiers = 0; -/* lookup table for converting virtualkey VK_* codes into Allegro ALLEGRO_KEY_* codes */ +/* lookup table for converting virtualkey VK_* codes into Allegro A5O_KEY_* codes */ /* For handling of extended keys, extkey_to_keycode() takes priority over this. */ /* Last unknown key sequence: 39*/ static const unsigned char hw_to_mycode[256] = { - /* 0x00 */ 0, ALLEGRO_KEY_UNKNOWN+0, ALLEGRO_KEY_UNKNOWN+1, ALLEGRO_KEY_UNKNOWN+2, - /* 0x04 */ ALLEGRO_KEY_UNKNOWN+3, ALLEGRO_KEY_UNKNOWN+4, ALLEGRO_KEY_UNKNOWN+5, 0, - /* 0x08 */ ALLEGRO_KEY_BACKSPACE, ALLEGRO_KEY_TAB, 0, 0, - /* 0x0C */ ALLEGRO_KEY_PAD_5, ALLEGRO_KEY_ENTER, 0, 0, - /* 0x10 */ 0/*L or R shift*/, ALLEGRO_KEY_LCTRL, ALLEGRO_KEY_ALT, ALLEGRO_KEY_PAUSE, - /* 0x14 */ ALLEGRO_KEY_CAPSLOCK, ALLEGRO_KEY_KANA, 0, ALLEGRO_KEY_UNKNOWN+6, - /* 0x18 */ ALLEGRO_KEY_UNKNOWN+7, ALLEGRO_KEY_KANJI, 0, ALLEGRO_KEY_ESCAPE, - /* 0x1C */ ALLEGRO_KEY_CONVERT, ALLEGRO_KEY_NOCONVERT, ALLEGRO_KEY_UNKNOWN+8, ALLEGRO_KEY_UNKNOWN+9, - /* 0x20 */ ALLEGRO_KEY_SPACE, ALLEGRO_KEY_PAD_9, ALLEGRO_KEY_PAD_3, ALLEGRO_KEY_PAD_1, - /* 0x24 */ ALLEGRO_KEY_PAD_7, ALLEGRO_KEY_PAD_4, ALLEGRO_KEY_PAD_8, ALLEGRO_KEY_PAD_6, - /* 0x28 */ ALLEGRO_KEY_PAD_2, ALLEGRO_KEY_UNKNOWN+10, ALLEGRO_KEY_UNKNOWN+11, ALLEGRO_KEY_UNKNOWN+12, - /* 0x2C */ ALLEGRO_KEY_PRINTSCREEN, ALLEGRO_KEY_PAD_0, ALLEGRO_KEY_PAD_DELETE, ALLEGRO_KEY_UNKNOWN+13, - /* 0x30 */ ALLEGRO_KEY_0, ALLEGRO_KEY_1, ALLEGRO_KEY_2, ALLEGRO_KEY_3, - /* 0x34 */ ALLEGRO_KEY_4, ALLEGRO_KEY_5, ALLEGRO_KEY_6, ALLEGRO_KEY_7, - /* 0x38 */ ALLEGRO_KEY_8, ALLEGRO_KEY_9, 0, 0, + /* 0x00 */ 0, A5O_KEY_UNKNOWN+0, A5O_KEY_UNKNOWN+1, A5O_KEY_UNKNOWN+2, + /* 0x04 */ A5O_KEY_UNKNOWN+3, A5O_KEY_UNKNOWN+4, A5O_KEY_UNKNOWN+5, 0, + /* 0x08 */ A5O_KEY_BACKSPACE, A5O_KEY_TAB, 0, 0, + /* 0x0C */ A5O_KEY_PAD_5, A5O_KEY_ENTER, 0, 0, + /* 0x10 */ 0/*L or R shift*/, A5O_KEY_LCTRL, A5O_KEY_ALT, A5O_KEY_PAUSE, + /* 0x14 */ A5O_KEY_CAPSLOCK, A5O_KEY_KANA, 0, A5O_KEY_UNKNOWN+6, + /* 0x18 */ A5O_KEY_UNKNOWN+7, A5O_KEY_KANJI, 0, A5O_KEY_ESCAPE, + /* 0x1C */ A5O_KEY_CONVERT, A5O_KEY_NOCONVERT, A5O_KEY_UNKNOWN+8, A5O_KEY_UNKNOWN+9, + /* 0x20 */ A5O_KEY_SPACE, A5O_KEY_PAD_9, A5O_KEY_PAD_3, A5O_KEY_PAD_1, + /* 0x24 */ A5O_KEY_PAD_7, A5O_KEY_PAD_4, A5O_KEY_PAD_8, A5O_KEY_PAD_6, + /* 0x28 */ A5O_KEY_PAD_2, A5O_KEY_UNKNOWN+10, A5O_KEY_UNKNOWN+11, A5O_KEY_UNKNOWN+12, + /* 0x2C */ A5O_KEY_PRINTSCREEN, A5O_KEY_PAD_0, A5O_KEY_PAD_DELETE, A5O_KEY_UNKNOWN+13, + /* 0x30 */ A5O_KEY_0, A5O_KEY_1, A5O_KEY_2, A5O_KEY_3, + /* 0x34 */ A5O_KEY_4, A5O_KEY_5, A5O_KEY_6, A5O_KEY_7, + /* 0x38 */ A5O_KEY_8, A5O_KEY_9, 0, 0, /* 0x3C */ 0, 0, 0, 0, - /* 0x40 */ 0, ALLEGRO_KEY_A, ALLEGRO_KEY_B, ALLEGRO_KEY_C, - /* 0x44 */ ALLEGRO_KEY_D, ALLEGRO_KEY_E, ALLEGRO_KEY_F, ALLEGRO_KEY_G, - /* 0x48 */ ALLEGRO_KEY_H, ALLEGRO_KEY_I, ALLEGRO_KEY_J, ALLEGRO_KEY_K, - /* 0x4C */ ALLEGRO_KEY_L, ALLEGRO_KEY_M, ALLEGRO_KEY_N, ALLEGRO_KEY_O, - /* 0x50 */ ALLEGRO_KEY_P, ALLEGRO_KEY_Q, ALLEGRO_KEY_R, ALLEGRO_KEY_S, - /* 0x54 */ ALLEGRO_KEY_T, ALLEGRO_KEY_U, ALLEGRO_KEY_V, ALLEGRO_KEY_W, - /* 0x58 */ ALLEGRO_KEY_X, ALLEGRO_KEY_Y, ALLEGRO_KEY_Z, ALLEGRO_KEY_LWIN, - /* 0x5C */ ALLEGRO_KEY_RWIN, ALLEGRO_KEY_MENU, 0, 0, - /* 0x60 */ ALLEGRO_KEY_PAD_0, ALLEGRO_KEY_PAD_1, ALLEGRO_KEY_PAD_2, ALLEGRO_KEY_PAD_3, - /* 0x64 */ ALLEGRO_KEY_PAD_4, ALLEGRO_KEY_PAD_5, ALLEGRO_KEY_PAD_6, ALLEGRO_KEY_PAD_7, - /* 0x68 */ ALLEGRO_KEY_PAD_8, ALLEGRO_KEY_PAD_9, ALLEGRO_KEY_PAD_ASTERISK, ALLEGRO_KEY_PAD_PLUS, - /* 0x6C */ ALLEGRO_KEY_UNKNOWN+15, ALLEGRO_KEY_PAD_MINUS, ALLEGRO_KEY_PAD_DELETE, ALLEGRO_KEY_PAD_SLASH, - /* 0x70 */ ALLEGRO_KEY_F1, ALLEGRO_KEY_F2, ALLEGRO_KEY_F3, ALLEGRO_KEY_F4, - /* 0x74 */ ALLEGRO_KEY_F5, ALLEGRO_KEY_F6, ALLEGRO_KEY_F7, ALLEGRO_KEY_F8, - /* 0x78 */ ALLEGRO_KEY_F9, ALLEGRO_KEY_F10, ALLEGRO_KEY_F11, ALLEGRO_KEY_F12, - /* 0x7C */ ALLEGRO_KEY_UNKNOWN+17, ALLEGRO_KEY_UNKNOWN+18, ALLEGRO_KEY_UNKNOWN+19, ALLEGRO_KEY_UNKNOWN+20, - /* 0x80 */ ALLEGRO_KEY_UNKNOWN+21, ALLEGRO_KEY_UNKNOWN+22, ALLEGRO_KEY_UNKNOWN+23, ALLEGRO_KEY_UNKNOWN+24, - /* 0x84 */ ALLEGRO_KEY_UNKNOWN+25, ALLEGRO_KEY_UNKNOWN+26, ALLEGRO_KEY_UNKNOWN+27, ALLEGRO_KEY_UNKNOWN+28, + /* 0x40 */ 0, A5O_KEY_A, A5O_KEY_B, A5O_KEY_C, + /* 0x44 */ A5O_KEY_D, A5O_KEY_E, A5O_KEY_F, A5O_KEY_G, + /* 0x48 */ A5O_KEY_H, A5O_KEY_I, A5O_KEY_J, A5O_KEY_K, + /* 0x4C */ A5O_KEY_L, A5O_KEY_M, A5O_KEY_N, A5O_KEY_O, + /* 0x50 */ A5O_KEY_P, A5O_KEY_Q, A5O_KEY_R, A5O_KEY_S, + /* 0x54 */ A5O_KEY_T, A5O_KEY_U, A5O_KEY_V, A5O_KEY_W, + /* 0x58 */ A5O_KEY_X, A5O_KEY_Y, A5O_KEY_Z, A5O_KEY_LWIN, + /* 0x5C */ A5O_KEY_RWIN, A5O_KEY_MENU, 0, 0, + /* 0x60 */ A5O_KEY_PAD_0, A5O_KEY_PAD_1, A5O_KEY_PAD_2, A5O_KEY_PAD_3, + /* 0x64 */ A5O_KEY_PAD_4, A5O_KEY_PAD_5, A5O_KEY_PAD_6, A5O_KEY_PAD_7, + /* 0x68 */ A5O_KEY_PAD_8, A5O_KEY_PAD_9, A5O_KEY_PAD_ASTERISK, A5O_KEY_PAD_PLUS, + /* 0x6C */ A5O_KEY_UNKNOWN+15, A5O_KEY_PAD_MINUS, A5O_KEY_PAD_DELETE, A5O_KEY_PAD_SLASH, + /* 0x70 */ A5O_KEY_F1, A5O_KEY_F2, A5O_KEY_F3, A5O_KEY_F4, + /* 0x74 */ A5O_KEY_F5, A5O_KEY_F6, A5O_KEY_F7, A5O_KEY_F8, + /* 0x78 */ A5O_KEY_F9, A5O_KEY_F10, A5O_KEY_F11, A5O_KEY_F12, + /* 0x7C */ A5O_KEY_UNKNOWN+17, A5O_KEY_UNKNOWN+18, A5O_KEY_UNKNOWN+19, A5O_KEY_UNKNOWN+20, + /* 0x80 */ A5O_KEY_UNKNOWN+21, A5O_KEY_UNKNOWN+22, A5O_KEY_UNKNOWN+23, A5O_KEY_UNKNOWN+24, + /* 0x84 */ A5O_KEY_UNKNOWN+25, A5O_KEY_UNKNOWN+26, A5O_KEY_UNKNOWN+27, A5O_KEY_UNKNOWN+28, /* 0x88 */ 0, 0, 0, 0, /* 0x8C */ 0, 0, 0, 0, - /* 0x90 */ ALLEGRO_KEY_NUMLOCK, ALLEGRO_KEY_SCROLLLOCK, 0, 0, + /* 0x90 */ A5O_KEY_NUMLOCK, A5O_KEY_SCROLLLOCK, 0, 0, /* 0x94 */ 0, 0, 0, 0, /* 0x98 */ 0, 0, 0, 0, /* 0x9C */ 0, 0, 0, 0, - /* 0xA0 */ ALLEGRO_KEY_LSHIFT, ALLEGRO_KEY_RSHIFT, ALLEGRO_KEY_LCTRL, ALLEGRO_KEY_RCTRL, - /* 0xA4 */ ALLEGRO_KEY_ALT, ALLEGRO_KEY_ALTGR, 0, 0, + /* 0xA0 */ A5O_KEY_LSHIFT, A5O_KEY_RSHIFT, A5O_KEY_LCTRL, A5O_KEY_RCTRL, + /* 0xA4 */ A5O_KEY_ALT, A5O_KEY_ALTGR, 0, 0, /* 0xA8 */ 0, 0, 0, 0, /* 0xAC */ 0, 0, 0, 0, /* 0xB0 */ 0, 0, 0, 0, /* 0xB4 */ 0, 0, 0, 0, - /* 0xB8 */ 0, 0, ALLEGRO_KEY_SEMICOLON, ALLEGRO_KEY_EQUALS, - /* 0xBC */ ALLEGRO_KEY_COMMA, ALLEGRO_KEY_MINUS, ALLEGRO_KEY_FULLSTOP, ALLEGRO_KEY_SLASH, - /* 0xC0 */ ALLEGRO_KEY_TILDE, 0, 0, 0, + /* 0xB8 */ 0, 0, A5O_KEY_SEMICOLON, A5O_KEY_EQUALS, + /* 0xBC */ A5O_KEY_COMMA, A5O_KEY_MINUS, A5O_KEY_FULLSTOP, A5O_KEY_SLASH, + /* 0xC0 */ A5O_KEY_TILDE, 0, 0, 0, /* 0xC4 */ 0, 0, 0, 0, /* 0xC8 */ 0, 0, 0, 0, /* 0xCC */ 0, 0, 0, 0, /* 0xD0 */ 0, 0, 0, 0, /* 0xD4 */ 0, 0, 0, 0, - /* 0xD8 */ 0, 0, 0, ALLEGRO_KEY_OPENBRACE, - /* 0xDC */ ALLEGRO_KEY_BACKSLASH, ALLEGRO_KEY_CLOSEBRACE, ALLEGRO_KEY_QUOTE, 0, - /* 0xE0 */ 0, 0, ALLEGRO_KEY_BACKSLASH2, 0, - /* 0xE4 */ 0, ALLEGRO_KEY_UNKNOWN+29, 0, 0, + /* 0xD8 */ 0, 0, 0, A5O_KEY_OPENBRACE, + /* 0xDC */ A5O_KEY_BACKSLASH, A5O_KEY_CLOSEBRACE, A5O_KEY_QUOTE, 0, + /* 0xE0 */ 0, 0, A5O_KEY_BACKSLASH2, 0, + /* 0xE4 */ 0, A5O_KEY_UNKNOWN+29, 0, 0, /* 0xE8 */ 0, 0, 0, 0, /* 0xEC */ 0, 0, 0, 0, /* 0xF0 */ 0, 0, 0, 0, - /* 0xF4 */ 0, 0, ALLEGRO_KEY_UNKNOWN+30, ALLEGRO_KEY_UNKNOWN+31, - /* 0xF8 */ ALLEGRO_KEY_UNKNOWN+32, ALLEGRO_KEY_UNKNOWN+33, ALLEGRO_KEY_UNKNOWN+34, ALLEGRO_KEY_UNKNOWN+35, - /* 0xFC */ ALLEGRO_KEY_UNKNOWN+36, ALLEGRO_KEY_UNKNOWN+37, ALLEGRO_KEY_UNKNOWN+38, 0 + /* 0xF4 */ 0, 0, A5O_KEY_UNKNOWN+30, A5O_KEY_UNKNOWN+31, + /* 0xF8 */ A5O_KEY_UNKNOWN+32, A5O_KEY_UNKNOWN+33, A5O_KEY_UNKNOWN+34, A5O_KEY_UNKNOWN+35, + /* 0xFC */ A5O_KEY_UNKNOWN+36, A5O_KEY_UNKNOWN+37, A5O_KEY_UNKNOWN+38, 0 }; /* forward declarations */ static bool init_keyboard(void); static void exit_keyboard(void); -static void get_keyboard_state(ALLEGRO_KEYBOARD_STATE *ret_state); +static void get_keyboard_state(A5O_KEYBOARD_STATE *ret_state); static void clear_keyboard_state(void); -static ALLEGRO_KEYBOARD *get_keyboard(void); +static A5O_KEYBOARD *get_keyboard(void); /* the driver vtable */ #define KEYBOARD_WINAPI AL_ID('W','A','P','I') -static ALLEGRO_KEYBOARD_DRIVER keyboard_winapi = +static A5O_KEYBOARD_DRIVER keyboard_winapi = { KEYBOARD_WINAPI, 0, @@ -187,9 +187,9 @@ void _al_win_fix_modifiers(void) /* get_keyboard: - * Returns the address of a ALLEGRO_KEYBOARD structure representing the keyboard. + * Returns the address of a A5O_KEYBOARD structure representing the keyboard. */ -static ALLEGRO_KEYBOARD *get_keyboard(void) +static A5O_KEYBOARD *get_keyboard(void) { return &the_keyboard; } @@ -199,15 +199,15 @@ static ALLEGRO_KEYBOARD *get_keyboard(void) /* get_keyboard_state: * Copy the current keyboard state into RET_STATE. */ -static void get_keyboard_state(ALLEGRO_KEYBOARD_STATE *ret_state) +static void get_keyboard_state(A5O_KEYBOARD_STATE *ret_state) { unsigned int i; - ALLEGRO_DISPLAY *disp = NULL; - ALLEGRO_SYSTEM *sys; + A5O_DISPLAY *disp = NULL; + A5O_SYSTEM *sys; sys = al_get_system_driver(); for (i = 0; i < sys->displays._size; i++) { - ALLEGRO_DISPLAY_WIN **d = (void*)_al_vector_ref(&sys->displays, i); + A5O_DISPLAY_WIN **d = (void*)_al_vector_ref(&sys->displays, i); if ((*d)->window == GetForegroundWindow()) { disp = (void*)*d; break; @@ -237,26 +237,26 @@ static int extkey_to_keycode(int vcode) { switch (vcode) { /* These are ordered by VK value, lowest first. */ - case VK_CANCEL: return ALLEGRO_KEY_PAUSE; - case VK_RETURN: return ALLEGRO_KEY_PAD_ENTER; - case VK_CONTROL: return ALLEGRO_KEY_RCTRL; - case VK_MENU: return ALLEGRO_KEY_ALTGR; - case VK_PRIOR: return ALLEGRO_KEY_PGUP; - case VK_NEXT: return ALLEGRO_KEY_PGDN; - case VK_END: return ALLEGRO_KEY_END; - case VK_HOME: return ALLEGRO_KEY_HOME; - case VK_LEFT: return ALLEGRO_KEY_LEFT; - case VK_UP: return ALLEGRO_KEY_UP; - case VK_RIGHT: return ALLEGRO_KEY_RIGHT; - case VK_DOWN: return ALLEGRO_KEY_DOWN; - case VK_SNAPSHOT: return ALLEGRO_KEY_PRINTSCREEN; - case VK_INSERT: return ALLEGRO_KEY_INSERT; - case VK_DELETE: return ALLEGRO_KEY_DELETE; - case VK_LWIN: return ALLEGRO_KEY_LWIN; - case VK_RWIN: return ALLEGRO_KEY_RWIN; - case VK_APPS: return ALLEGRO_KEY_MENU; - case VK_DIVIDE: return ALLEGRO_KEY_PAD_SLASH; - case VK_NUMLOCK: return ALLEGRO_KEY_NUMLOCK; + case VK_CANCEL: return A5O_KEY_PAUSE; + case VK_RETURN: return A5O_KEY_PAD_ENTER; + case VK_CONTROL: return A5O_KEY_RCTRL; + case VK_MENU: return A5O_KEY_ALTGR; + case VK_PRIOR: return A5O_KEY_PGUP; + case VK_NEXT: return A5O_KEY_PGDN; + case VK_END: return A5O_KEY_END; + case VK_HOME: return A5O_KEY_HOME; + case VK_LEFT: return A5O_KEY_LEFT; + case VK_UP: return A5O_KEY_UP; + case VK_RIGHT: return A5O_KEY_RIGHT; + case VK_DOWN: return A5O_KEY_DOWN; + case VK_SNAPSHOT: return A5O_KEY_PRINTSCREEN; + case VK_INSERT: return A5O_KEY_INSERT; + case VK_DELETE: return A5O_KEY_DELETE; + case VK_LWIN: return A5O_KEY_LWIN; + case VK_RWIN: return A5O_KEY_RWIN; + case VK_APPS: return A5O_KEY_MENU; + case VK_DIVIDE: return A5O_KEY_PAD_SLASH; + case VK_NUMLOCK: return A5O_KEY_NUMLOCK; default: return 0; } } @@ -273,24 +273,24 @@ static void update_modifiers(int code, bool pressed) } switch (code) { - case ALLEGRO_KEY_LSHIFT: - ON_OFF2(ALLEGRO_KEYMOD_SHIFT); - case ALLEGRO_KEY_RSHIFT: - ON_OFF2(ALLEGRO_KEYMOD_SHIFT); - case ALLEGRO_KEY_RCTRL: - ON_OFF2(ALLEGRO_KEYMOD_CTRL); - case ALLEGRO_KEY_LCTRL: - ON_OFF2(ALLEGRO_KEYMOD_CTRL); - case ALLEGRO_KEY_ALT: - ON_OFF2(ALLEGRO_KEYMOD_ALT); - case ALLEGRO_KEY_ALTGR: - ON_OFF2(ALLEGRO_KEYMOD_ALTGR); - case ALLEGRO_KEY_LWIN: - ON_OFF2(ALLEGRO_KEYMOD_LWIN); - case ALLEGRO_KEY_RWIN: - ON_OFF2(ALLEGRO_KEYMOD_RWIN); - case ALLEGRO_KEY_MENU: - ON_OFF2(ALLEGRO_KEYMOD_MENU); + case A5O_KEY_LSHIFT: + ON_OFF2(A5O_KEYMOD_SHIFT); + case A5O_KEY_RSHIFT: + ON_OFF2(A5O_KEYMOD_SHIFT); + case A5O_KEY_RCTRL: + ON_OFF2(A5O_KEYMOD_CTRL); + case A5O_KEY_LCTRL: + ON_OFF2(A5O_KEYMOD_CTRL); + case A5O_KEY_ALT: + ON_OFF2(A5O_KEYMOD_ALT); + case A5O_KEY_ALTGR: + ON_OFF2(A5O_KEYMOD_ALTGR); + case A5O_KEY_LWIN: + ON_OFF2(A5O_KEYMOD_LWIN); + case A5O_KEY_RWIN: + ON_OFF2(A5O_KEYMOD_RWIN); + case A5O_KEY_MENU: + ON_OFF2(A5O_KEYMOD_MENU); } #undef ON_OFF2 @@ -314,9 +314,9 @@ static void update_toggle_modifiers(void) * is updated a bit too late in some cases. Maybe it would work if WM_CHARs were * used, since they arrive after the WM_KEYDOWNs that trigger them. */ - ON_OFF(ALLEGRO_KEYMOD_NUMLOCK, GetKeyState(VK_NUMLOCK) & 1); - ON_OFF(ALLEGRO_KEYMOD_CAPSLOCK, GetKeyState(VK_CAPITAL) & 1); - ON_OFF(ALLEGRO_KEYMOD_SCROLLLOCK, GetKeyState(VK_SCROLL) & 1); + ON_OFF(A5O_KEYMOD_NUMLOCK, GetKeyState(VK_NUMLOCK) & 1); + ON_OFF(A5O_KEYMOD_CAPSLOCK, GetKeyState(VK_CAPITAL) & 1); + ON_OFF(A5O_KEYMOD_SCROLLLOCK, GetKeyState(VK_SCROLL) & 1); #undef ON_OFF } @@ -327,10 +327,10 @@ static void update_toggle_modifiers(void) * Does stuff when a key is pressed. */ void _al_win_kbd_handle_key_press(int scode, int vcode, bool extended, - bool repeated, ALLEGRO_DISPLAY_WIN *win_disp) + bool repeated, A5O_DISPLAY_WIN *win_disp) { - ALLEGRO_DISPLAY *display = (ALLEGRO_DISPLAY *)win_disp; - ALLEGRO_EVENT event; + A5O_DISPLAY *display = (A5O_DISPLAY *)win_disp; + A5O_EVENT event; int my_code; bool actual_repeat; int char_count; @@ -362,7 +362,7 @@ void _al_win_kbd_handle_key_press(int scode, int vcode, bool extended, if (!_al_event_source_needs_to_generate_event(&the_keyboard.es)) return; - event.keyboard.type = ALLEGRO_EVENT_KEY_DOWN; + event.keyboard.type = A5O_EVENT_KEY_DOWN; event.keyboard.timestamp = al_get_time(); event.keyboard.display = display; event.keyboard.keycode = my_code; @@ -378,7 +378,7 @@ void _al_win_kbd_handle_key_press(int scode, int vcode, bool extended, } /* Send char events, but not for modifier keys or dead keys. */ - if (my_code < ALLEGRO_KEY_MODIFIERS) { + if (my_code < A5O_KEY_MODIFIERS) { char_count = ToUnicode(vcode, scode, GetKeyboardState(ks) ? ks : NULL, buf, 8, 0); /* Send ASCII code 127 for both Del keys. */ if (char_count == 0 && vcode == VK_DELETE) { @@ -387,7 +387,7 @@ void _al_win_kbd_handle_key_press(int scode, int vcode, bool extended, } if (char_count != -1) { /* -1 means it was a dead key. */ event_count = char_count ? char_count : 1; - event.keyboard.type = ALLEGRO_EVENT_KEY_CHAR; + event.keyboard.type = A5O_EVENT_KEY_CHAR; update_toggle_modifiers(); event.keyboard.modifiers = modifiers; event.keyboard.repeat = actual_repeat; @@ -401,7 +401,7 @@ void _al_win_kbd_handle_key_press(int scode, int vcode, bool extended, /* Toggle mouse grab key. */ if (my_code && !repeated) { - ALLEGRO_SYSTEM_WIN *system = (void *)al_get_system_driver(); + A5O_SYSTEM_WIN *system = (void *)al_get_system_driver(); if (system->toggle_mouse_grab_keycode && my_code == system->toggle_mouse_grab_keycode && (modifiers & system->toggle_mouse_grab_modifiers) == system->toggle_mouse_grab_modifiers) { @@ -420,9 +420,9 @@ void _al_win_kbd_handle_key_press(int scode, int vcode, bool extended, /* _al_win_kbd_handle_key_release: * Does stuff when a key is released. */ -void _al_win_kbd_handle_key_release(int scode, int vcode, bool extended, ALLEGRO_DISPLAY_WIN *win_disp) +void _al_win_kbd_handle_key_release(int scode, int vcode, bool extended, A5O_DISPLAY_WIN *win_disp) { - ALLEGRO_EVENT event; + A5O_EVENT event; int my_code; if (!installed) @@ -444,15 +444,15 @@ void _al_win_kbd_handle_key_release(int scode, int vcode, bool extended, ALLEGRO /* Windows only sends a WM_KEYUP message for the Shift keys when both have been released. If one of the Shift keys is still reported as down, we need to release it as well. */ - if (my_code == ALLEGRO_KEY_LSHIFT && _AL_KEYBOARD_STATE_KEY_DOWN(the_state, ALLEGRO_KEY_RSHIFT)) + if (my_code == A5O_KEY_LSHIFT && _AL_KEYBOARD_STATE_KEY_DOWN(the_state, A5O_KEY_RSHIFT)) _al_win_kbd_handle_key_release(scode, VK_RSHIFT, extended, win_disp); - else if (my_code == ALLEGRO_KEY_RSHIFT && _AL_KEYBOARD_STATE_KEY_DOWN(the_state, ALLEGRO_KEY_LSHIFT)) + else if (my_code == A5O_KEY_RSHIFT && _AL_KEYBOARD_STATE_KEY_DOWN(the_state, A5O_KEY_LSHIFT)) _al_win_kbd_handle_key_release(scode, VK_LSHIFT, extended, win_disp); if (!_al_event_source_needs_to_generate_event(&the_keyboard.es)) return; - event.keyboard.type = ALLEGRO_EVENT_KEY_UP; + event.keyboard.type = A5O_EVENT_KEY_UP; event.keyboard.timestamp = al_get_time(); event.keyboard.display = (void*)win_disp; event.keyboard.keycode = my_code; diff --git a/src/win/wmcursor.c b/src/win/wmcursor.c index 79900d6442..c86f9bdf37 100644 --- a/src/win/wmcursor.c +++ b/src/win/wmcursor.c @@ -26,14 +26,14 @@ #include "allegro5/platform/aintwin.h" -static void local_stretch_blit_to_hdc(ALLEGRO_BITMAP *bitmap, HDC dc, +static void local_stretch_blit_to_hdc(A5O_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); -static void local_draw_to_hdc(HDC dc, ALLEGRO_BITMAP *bitmap, int x, int y); +static void local_draw_to_hdc(HDC dc, A5O_BITMAP *bitmap, int x, int y); HICON _al_win_create_icon(HWND wnd, - ALLEGRO_BITMAP *sprite, int xfocus, int yfocus, bool is_cursor, bool resize) + A5O_BITMAP *sprite, int xfocus, int yfocus, bool is_cursor, bool resize) { int x, y; int sys_sm_cx, sys_sm_cy; @@ -47,7 +47,7 @@ HICON _al_win_create_icon(HWND wnd, HBITMAP hOldXorMaskBitmap; HICON icon; bool was_locked; - ALLEGRO_BITMAP *tmp = sprite; + A5O_BITMAP *tmp = sprite; if (resize) { if (is_cursor) { @@ -63,7 +63,7 @@ HICON _al_win_create_icon(HWND wnd, if ((tmp->w > sys_sm_cx) || (tmp->h > sys_sm_cy)) { float ratio = tmp->w / (float)tmp->h; int w, h; - ALLEGRO_STATE state; + A5O_STATE state; if (ratio > 1) { w = sys_sm_cx; h = sys_sm_cy / ratio; @@ -72,10 +72,10 @@ HICON _al_win_create_icon(HWND wnd, w = sys_sm_cx * ratio; h = sys_sm_cy; } - al_store_state(&state, ALLEGRO_STATE_TARGET_BITMAP | - ALLEGRO_STATE_BLENDER); + al_store_state(&state, A5O_STATE_TARGET_BITMAP | + A5O_STATE_BLENDER); tmp = _al_create_bitmap_params(al_get_current_display(), w, h, - al_get_bitmap_format(tmp), ALLEGRO_MEMORY_BITMAP, 0, 0); + al_get_bitmap_format(tmp), A5O_MEMORY_BITMAP, 0, 0); al_set_target_bitmap(tmp); al_clear_to_color(al_map_rgba_f(0, 0, 0, 0)); al_draw_scaled_bitmap( @@ -114,7 +114,7 @@ HICON _al_win_create_icon(HWND wnd, /* Lock sprite to speed up repeated get pixel calls. */ was_locked = al_is_bitmap_locked(tmp); if (!was_locked) { - al_lock_bitmap(tmp, ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_READONLY); + al_lock_bitmap(tmp, A5O_PIXEL_FORMAT_ANY, A5O_LOCK_READONLY); } local_draw_to_hdc(h_xor_dc, tmp, 0, 0); @@ -122,7 +122,7 @@ HICON _al_win_create_icon(HWND wnd, /* Make cursor background transparent */ for (y = 0; y < tmp->h; y++) { for (x = 0; x < tmp->w; x++) { - ALLEGRO_COLOR c; + A5O_COLOR c; unsigned char r, g, b, a; c = al_get_pixel(tmp, x, y); @@ -167,12 +167,12 @@ HICON _al_win_create_icon(HWND wnd, } -ALLEGRO_MOUSE_CURSOR *_al_win_create_mouse_cursor(ALLEGRO_BITMAP *sprite, +A5O_MOUSE_CURSOR *_al_win_create_mouse_cursor(A5O_BITMAP *sprite, int xfocus, int yfocus) { HWND wnd; HCURSOR hcursor; - ALLEGRO_MOUSE_CURSOR_WIN *win_cursor; + A5O_MOUSE_CURSOR_WIN *win_cursor; /* A null HWND retrieves the DC for the entire screen. */ wnd = NULL; @@ -189,15 +189,15 @@ ALLEGRO_MOUSE_CURSOR *_al_win_create_mouse_cursor(ALLEGRO_BITMAP *sprite, } win_cursor->hcursor = hcursor; - return (ALLEGRO_MOUSE_CURSOR *)win_cursor; + return (A5O_MOUSE_CURSOR *)win_cursor; } -void _al_win_destroy_mouse_cursor(ALLEGRO_MOUSE_CURSOR *cursor) +void _al_win_destroy_mouse_cursor(A5O_MOUSE_CURSOR *cursor) { - ALLEGRO_MOUSE_CURSOR_WIN *win_cursor = (ALLEGRO_MOUSE_CURSOR_WIN *) cursor; - ALLEGRO_SYSTEM *sys = al_get_system_driver(); + A5O_MOUSE_CURSOR_WIN *win_cursor = (A5O_MOUSE_CURSOR_WIN *) cursor; + A5O_SYSTEM *sys = al_get_system_driver(); unsigned i; ASSERT(win_cursor); @@ -205,12 +205,12 @@ void _al_win_destroy_mouse_cursor(ALLEGRO_MOUSE_CURSOR *cursor) /* XXX not at all thread safe */ for (i = 0; i < _al_vector_size(&sys->displays); i++) { - ALLEGRO_DISPLAY_WIN **slot = _al_vector_ref(&sys->displays, i); - ALLEGRO_DISPLAY_WIN *win_display = *slot; + A5O_DISPLAY_WIN **slot = _al_vector_ref(&sys->displays, i); + A5O_DISPLAY_WIN *win_display = *slot; if (win_cursor->hcursor == win_display->mouse_selected_hcursor) { - _al_win_set_system_mouse_cursor((ALLEGRO_DISPLAY *)win_display, - ALLEGRO_SYSTEM_MOUSE_CURSOR_ARROW); + _al_win_set_system_mouse_cursor((A5O_DISPLAY *)win_display, + A5O_SYSTEM_MOUSE_CURSOR_ARROW); } } @@ -220,11 +220,11 @@ void _al_win_destroy_mouse_cursor(ALLEGRO_MOUSE_CURSOR *cursor) -bool _al_win_set_mouse_cursor(ALLEGRO_DISPLAY *display, - ALLEGRO_MOUSE_CURSOR *cursor) +bool _al_win_set_mouse_cursor(A5O_DISPLAY *display, + A5O_MOUSE_CURSOR *cursor) { - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *) display; - ALLEGRO_MOUSE_CURSOR_WIN *win_cursor = (ALLEGRO_MOUSE_CURSOR_WIN *) cursor; + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *) display; + A5O_MOUSE_CURSOR_WIN *win_cursor = (A5O_MOUSE_CURSOR_WIN *) cursor; ASSERT(win_cursor); ASSERT(win_cursor->hcursor); @@ -248,28 +248,28 @@ bool _al_win_set_mouse_cursor(ALLEGRO_DISPLAY *display, } -bool _al_win_show_mouse_cursor(ALLEGRO_DISPLAY *display) +bool _al_win_show_mouse_cursor(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *) display; - ALLEGRO_MOUSE_CURSOR_WIN tmp_cursor; - ALLEGRO_MOUSE_CURSOR_WIN *tmp_cursor_ptr = &tmp_cursor; + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *) display; + A5O_MOUSE_CURSOR_WIN tmp_cursor; + A5O_MOUSE_CURSOR_WIN *tmp_cursor_ptr = &tmp_cursor; /* XXX do we need this? */ if (!win_display->mouse_selected_hcursor) { - _al_win_set_system_mouse_cursor(display, ALLEGRO_SYSTEM_MOUSE_CURSOR_ARROW); + _al_win_set_system_mouse_cursor(display, A5O_SYSTEM_MOUSE_CURSOR_ARROW); } tmp_cursor.hcursor = win_display->mouse_selected_hcursor; win_display->mouse_cursor_shown = true; win_display->hide_mouse_on_move = false; - _al_win_set_mouse_cursor(display, (ALLEGRO_MOUSE_CURSOR *)tmp_cursor_ptr); + _al_win_set_mouse_cursor(display, (A5O_MOUSE_CURSOR *)tmp_cursor_ptr); return true; } -bool _al_win_hide_mouse_cursor(ALLEGRO_DISPLAY *display) +bool _al_win_hide_mouse_cursor(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *) display; + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *) display; win_display->mouse_cursor_shown = false; PostMessage(win_display->window, WM_SETCURSOR, 0, 0); @@ -277,41 +277,41 @@ bool _al_win_hide_mouse_cursor(ALLEGRO_DISPLAY *display) } -static HCURSOR system_cursor_to_hcursor(ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id) +static HCURSOR system_cursor_to_hcursor(A5O_SYSTEM_MOUSE_CURSOR cursor_id) { switch (cursor_id) { - case ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT: - case ALLEGRO_SYSTEM_MOUSE_CURSOR_ARROW: + case A5O_SYSTEM_MOUSE_CURSOR_DEFAULT: + case A5O_SYSTEM_MOUSE_CURSOR_ARROW: return LoadCursor(NULL, IDC_ARROW); - case ALLEGRO_SYSTEM_MOUSE_CURSOR_BUSY: + case A5O_SYSTEM_MOUSE_CURSOR_BUSY: return LoadCursor(NULL, IDC_WAIT); - case ALLEGRO_SYSTEM_MOUSE_CURSOR_QUESTION: + case A5O_SYSTEM_MOUSE_CURSOR_QUESTION: return LoadCursor(NULL, IDC_HELP); - case ALLEGRO_SYSTEM_MOUSE_CURSOR_EDIT: + case A5O_SYSTEM_MOUSE_CURSOR_EDIT: return LoadCursor(NULL, IDC_IBEAM); - case ALLEGRO_SYSTEM_MOUSE_CURSOR_MOVE: + case A5O_SYSTEM_MOUSE_CURSOR_MOVE: return LoadCursor(NULL, IDC_SIZEALL); - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_N: - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_S: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_N: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_S: return LoadCursor(NULL, IDC_SIZENS); - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_E: - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_W: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_E: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_W: return LoadCursor(NULL, IDC_SIZEWE); - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NE: - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_SW: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_NE: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_SW: return LoadCursor(NULL, IDC_SIZENESW); - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NW: - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_SE: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_NW: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_SE: return LoadCursor(NULL, IDC_SIZENWSE); - case ALLEGRO_SYSTEM_MOUSE_CURSOR_PROGRESS: + case A5O_SYSTEM_MOUSE_CURSOR_PROGRESS: return LoadCursor(NULL, IDC_APPSTARTING); - case ALLEGRO_SYSTEM_MOUSE_CURSOR_PRECISION: + case A5O_SYSTEM_MOUSE_CURSOR_PRECISION: return LoadCursor(NULL, IDC_CROSS); - case ALLEGRO_SYSTEM_MOUSE_CURSOR_LINK: + case A5O_SYSTEM_MOUSE_CURSOR_LINK: return LoadCursor(NULL, IDC_HAND); - case ALLEGRO_SYSTEM_MOUSE_CURSOR_ALT_SELECT: + case A5O_SYSTEM_MOUSE_CURSOR_ALT_SELECT: return LoadCursor(NULL, IDC_UPARROW); - case ALLEGRO_SYSTEM_MOUSE_CURSOR_UNAVAILABLE: + case A5O_SYSTEM_MOUSE_CURSOR_UNAVAILABLE: return LoadCursor(NULL, IDC_NO); default: return NULL; @@ -319,10 +319,10 @@ static HCURSOR system_cursor_to_hcursor(ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id) } -bool _al_win_set_system_mouse_cursor(ALLEGRO_DISPLAY *display, - ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id) +bool _al_win_set_system_mouse_cursor(A5O_DISPLAY *display, + A5O_SYSTEM_MOUSE_CURSOR cursor_id) { - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *) display; + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *) display; HCURSOR wc; wc = system_cursor_to_hcursor(cursor_id); @@ -337,10 +337,10 @@ bool _al_win_set_system_mouse_cursor(ALLEGRO_DISPLAY *display, MySetCursor(wc); PostMessage(wgl_display->window, WM_MOUSEMOVE, 0, 0); */ - ALLEGRO_MOUSE_CURSOR_WIN tmp_cursor; - ALLEGRO_MOUSE_CURSOR_WIN *tmp_cursor_ptr = &tmp_cursor; + A5O_MOUSE_CURSOR_WIN tmp_cursor; + A5O_MOUSE_CURSOR_WIN *tmp_cursor_ptr = &tmp_cursor; tmp_cursor.hcursor = wc; - _al_win_set_mouse_cursor(display, (ALLEGRO_MOUSE_CURSOR *)tmp_cursor_ptr); + _al_win_set_mouse_cursor(display, (A5O_MOUSE_CURSOR *)tmp_cursor_ptr); } return true; } @@ -351,12 +351,12 @@ bool _al_win_set_system_mouse_cursor(ALLEGRO_DISPLAY *display, /* get_bitmap_info: - * Returns a BITMAPINFO structure suited to an ALLEGRO_BITMAP. + * Returns a BITMAPINFO structure suited to an A5O_BITMAP. * You have to free the memory allocated by this function. * * This version always returns a 32-bit BITMAPINFO. */ -static BITMAPINFO *get_bitmap_info(ALLEGRO_BITMAP *bitmap) +static BITMAPINFO *get_bitmap_info(A5O_BITMAP *bitmap) { BITMAPINFO *bi; int i; @@ -391,7 +391,7 @@ static BITMAPINFO *get_bitmap_info(ALLEGRO_BITMAP *bitmap) * * This version always creates a 32-bit DIB. */ -static BYTE *get_dib_from_bitmap_32(ALLEGRO_BITMAP *bitmap) +static BYTE *get_dib_from_bitmap_32(A5O_BITMAP *bitmap) { int w, h; int x, y; @@ -411,7 +411,7 @@ static BYTE *get_dib_from_bitmap_32(ALLEGRO_BITMAP *bitmap) dst = pixels + y * pitch; for (x = 0; x < w; x++) { - ALLEGRO_COLOR col; + A5O_COLOR col; unsigned char r, g, b, a; col = al_get_pixel(bitmap, x, y); @@ -436,7 +436,7 @@ static BYTE *get_dib_from_bitmap_32(ALLEGRO_BITMAP *bitmap) * Draws an entire Allegro BITMAP to a Windows DC. Has a syntax similar to * draw_sprite(). */ -static void local_draw_to_hdc(HDC dc, ALLEGRO_BITMAP *bitmap, int x, int y) +static void local_draw_to_hdc(HDC dc, A5O_BITMAP *bitmap, int x, int y) { int w = al_get_bitmap_width(bitmap); int h = al_get_bitmap_height(bitmap); @@ -449,7 +449,7 @@ static void local_draw_to_hdc(HDC dc, ALLEGRO_BITMAP *bitmap, int x, int y) * Blits an Allegro BITMAP to a Windows DC. Has a syntax similar to * stretch_blit(). */ -static void local_stretch_blit_to_hdc(ALLEGRO_BITMAP *bitmap, HDC dc, +static void local_stretch_blit_to_hdc(A5O_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) { diff --git a/src/win/wmouse.c b/src/win/wmouse.c index dad084c21c..262dd1cf3d 100644 --- a/src/win/wmouse.c +++ b/src/win/wmouse.c @@ -39,8 +39,8 @@ #include "allegro5/platform/aintwin.h" #include "allegro5/internal/aintern_display.h" -static ALLEGRO_MOUSE_STATE mouse_state; -static ALLEGRO_MOUSE the_mouse; +static A5O_MOUSE_STATE mouse_state; +static A5O_MOUSE the_mouse; static bool installed = false; // The raw versions of z/w in the mouse_state. They are related to them by a scaling constant. @@ -50,7 +50,7 @@ static int raw_mouse_w = 0; static bool init_mouse(void) { - ALLEGRO_DISPLAY *display; + A5O_DISPLAY *display; if (installed) return false; @@ -66,7 +66,7 @@ static bool init_mouse(void) _al_event_source_init(&the_mouse.es); #if 0 - if (al_get_new_display_flags() & ALLEGRO_FULLSCREEN) { + if (al_get_new_display_flags() & A5O_FULLSCREEN) { RAWINPUTDEVICE rid[1]; rid[0].usUsagePage = 0x01; rid[0].usUsage = 0x02; @@ -99,9 +99,9 @@ static void generate_mouse_event(unsigned int type, int x, int y, int z, int w, float pressure, int dx, int dy, int dz, int dw, unsigned int button, - ALLEGRO_DISPLAY *source) + A5O_DISPLAY *source) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (!_al_event_source_needs_to_generate_event(&the_mouse.es)) return; @@ -125,7 +125,7 @@ static void generate_mouse_event(unsigned int type, } -static ALLEGRO_MOUSE* get_mouse(void) +static A5O_MOUSE* get_mouse(void) { return &the_mouse; } @@ -149,11 +149,11 @@ static unsigned int get_num_axes(void) } -static bool set_mouse_xy(ALLEGRO_DISPLAY *disp, int x, int y) +static bool set_mouse_xy(A5O_DISPLAY *disp, int x, int y) { int dx, dy; POINT pt; - ALLEGRO_DISPLAY_WIN *win_disp = (void*)disp; + A5O_DISPLAY_WIN *win_disp = (void*)disp; if (!installed) return false; @@ -166,7 +166,7 @@ static bool set_mouse_xy(ALLEGRO_DISPLAY *disp, int x, int y) mouse_state.y = y; generate_mouse_event( - ALLEGRO_EVENT_MOUSE_WARPED, + A5O_EVENT_MOUSE_WARPED, mouse_state.x, mouse_state.y, mouse_state.z, mouse_state.w, mouse_state.pressure, dx, dy, 0, 0, 0, (void*)win_disp); @@ -195,7 +195,7 @@ static bool set_mouse_axis(int which, int val) mouse_state.z = val; generate_mouse_event( - ALLEGRO_EVENT_MOUSE_AXES, + A5O_EVENT_MOUSE_AXES, mouse_state.x, mouse_state.y, mouse_state.z, mouse_state.w, mouse_state.pressure, 0, 0, dz, 0, 0, mouse_state.display); @@ -214,7 +214,7 @@ static bool set_mouse_axis(int which, int val) mouse_state.w = val; generate_mouse_event( - ALLEGRO_EVENT_MOUSE_AXES, + A5O_EVENT_MOUSE_AXES, mouse_state.x, mouse_state.y, mouse_state.z, mouse_state.w, mouse_state.pressure, 0, 0, 0, dw, 0, mouse_state.display); @@ -227,7 +227,7 @@ static bool set_mouse_axis(int which, int val) } -static void get_mouse_state(ALLEGRO_MOUSE_STATE *ret_state) +static void get_mouse_state(A5O_MOUSE_STATE *ret_state) { _al_event_source_lock(&the_mouse.es); *ret_state = mouse_state; @@ -238,7 +238,7 @@ static void get_mouse_state(ALLEGRO_MOUSE_STATE *ret_state) /* the driver vtable */ #define MOUSE_WINAPI AL_ID('W','A','P','I') -static ALLEGRO_MOUSE_DRIVER mousedrv_winapi = +static A5O_MOUSE_DRIVER mousedrv_winapi = { MOUSE_WINAPI, "", @@ -262,7 +262,7 @@ _AL_DRIVER_INFO _al_mouse_driver_list[] = }; -void _al_win_mouse_handle_leave(ALLEGRO_DISPLAY_WIN *win_disp) +void _al_win_mouse_handle_leave(A5O_DISPLAY_WIN *win_disp) { /* The state should be updated even if the mouse is not installed so that * it will be correct if the mouse is installed later. @@ -273,14 +273,14 @@ void _al_win_mouse_handle_leave(ALLEGRO_DISPLAY_WIN *win_disp) if (!installed) return; - generate_mouse_event(ALLEGRO_EVENT_MOUSE_LEAVE_DISPLAY, + generate_mouse_event(A5O_EVENT_MOUSE_LEAVE_DISPLAY, mouse_state.x, mouse_state.y, mouse_state.z, mouse_state.w, mouse_state.pressure, 0, 0, 0, 0, 0, (void*)win_disp); } -void _al_win_mouse_handle_enter(ALLEGRO_DISPLAY_WIN *win_disp) +void _al_win_mouse_handle_enter(A5O_DISPLAY_WIN *win_disp) { /* The state should be updated even if the mouse is not installed so that * it will be correct if the mouse is installed later. @@ -290,14 +290,14 @@ void _al_win_mouse_handle_enter(ALLEGRO_DISPLAY_WIN *win_disp) if (!installed) return; - generate_mouse_event(ALLEGRO_EVENT_MOUSE_ENTER_DISPLAY, + generate_mouse_event(A5O_EVENT_MOUSE_ENTER_DISPLAY, mouse_state.x, mouse_state.y, mouse_state.z, mouse_state.w, mouse_state.pressure, 0, 0, 0, 0, 0, (void*)win_disp); } -void _al_win_mouse_handle_move(int x, int y, bool abs, ALLEGRO_DISPLAY_WIN *win_disp) +void _al_win_mouse_handle_move(int x, int y, bool abs, A5O_DISPLAY_WIN *win_disp) { int dx, dy; int oldx, oldy; @@ -322,7 +322,7 @@ void _al_win_mouse_handle_move(int x, int y, bool abs, ALLEGRO_DISPLAY_WIN *win_ } if (oldx != mouse_state.x || oldy != mouse_state.y) { - generate_mouse_event(ALLEGRO_EVENT_MOUSE_AXES, + generate_mouse_event(A5O_EVENT_MOUSE_AXES, mouse_state.x, mouse_state.y, mouse_state.z, mouse_state.w, mouse_state.pressure, dx, dy, 0, 0, 0, (void*)win_disp); @@ -330,7 +330,7 @@ void _al_win_mouse_handle_move(int x, int y, bool abs, ALLEGRO_DISPLAY_WIN *win_ } -void _al_win_mouse_handle_wheel(int raw_dz, bool abs, ALLEGRO_DISPLAY_WIN *win_disp) +void _al_win_mouse_handle_wheel(int raw_dz, bool abs, A5O_DISPLAY_WIN *win_disp) { int d; int new_z; @@ -349,14 +349,14 @@ void _al_win_mouse_handle_wheel(int raw_dz, bool abs, ALLEGRO_DISPLAY_WIN *win_d d = new_z - mouse_state.z; mouse_state.z = new_z; - generate_mouse_event(ALLEGRO_EVENT_MOUSE_AXES, + generate_mouse_event(A5O_EVENT_MOUSE_AXES, mouse_state.x, mouse_state.y, mouse_state.z, mouse_state.w, mouse_state.pressure, 0, 0, d, 0, 0, (void*)win_disp); } -void _al_win_mouse_handle_hwheel(int raw_dw, bool abs, ALLEGRO_DISPLAY_WIN *win_disp) +void _al_win_mouse_handle_hwheel(int raw_dw, bool abs, A5O_DISPLAY_WIN *win_disp) { int d; int new_w; @@ -375,7 +375,7 @@ void _al_win_mouse_handle_hwheel(int raw_dw, bool abs, ALLEGRO_DISPLAY_WIN *win_ d = new_w - mouse_state.w; mouse_state.w = new_w; - generate_mouse_event(ALLEGRO_EVENT_MOUSE_AXES, + generate_mouse_event(A5O_EVENT_MOUSE_AXES, mouse_state.x, mouse_state.y, mouse_state.z, mouse_state.w, mouse_state.pressure, 0, 0, 0, d, 0, (void*)win_disp); @@ -384,10 +384,10 @@ void _al_win_mouse_handle_hwheel(int raw_dw, bool abs, ALLEGRO_DISPLAY_WIN *win_ void _al_win_mouse_handle_button(int button, bool down, int x, int y, bool abs, - ALLEGRO_DISPLAY_WIN *win_disp) + A5O_DISPLAY_WIN *win_disp) { - int type = down ? ALLEGRO_EVENT_MOUSE_BUTTON_DOWN - : ALLEGRO_EVENT_MOUSE_BUTTON_UP; + int type = down ? A5O_EVENT_MOUSE_BUTTON_DOWN + : A5O_EVENT_MOUSE_BUTTON_UP; if (!installed) return; diff --git a/src/win/wsystem.c b/src/win/wsystem.c index 76bc8986aa..930b7f6e79 100644 --- a/src/win/wsystem.c +++ b/src/win/wsystem.c @@ -28,14 +28,14 @@ #include "allegro5/platform/aintwin.h" #include "allegro5/internal/aintern_wunicode.h" -#if defined ALLEGRO_CFG_OPENGL +#if defined A5O_CFG_OPENGL #include "allegro5/allegro_opengl.h" #endif #include #include -ALLEGRO_DEBUG_CHANNEL("system") +A5O_DEBUG_CHANNEL("system") /* FIXME: should we check for psapi _WIN32_IE and shlobj? @@ -52,13 +52,13 @@ ALLEGRO_DEBUG_CHANNEL("system") bool _al_win_disable_screensaver = false; -static ALLEGRO_SYSTEM_INTERFACE *vt = 0; +static A5O_SYSTEM_INTERFACE *vt = 0; static bool using_higher_res_timer; -static ALLEGRO_SYSTEM_WIN *_al_win_system; +static A5O_SYSTEM_WIN *_al_win_system; /* This is mostly here for _al_display_d3d_driver, which is stateful. */ -static ALLEGRO_MUTEX* win_mutex; +static A5O_MUTEX* win_mutex; /* _WinMain: * Entry point for Windows GUI programs, hooked by a macro in alwin.h, @@ -185,7 +185,7 @@ static void set_dpi_awareness(void) /* Create a new system object. */ -static ALLEGRO_SYSTEM *win_initialize(int flags) +static A5O_SYSTEM *win_initialize(int flags) { (void)flags; @@ -201,7 +201,7 @@ static ALLEGRO_SYSTEM *win_initialize(int flags) _al_win_init_window(); - _al_vector_init(&_al_win_system->system.displays, sizeof (ALLEGRO_SYSTEM_WIN *)); + _al_vector_init(&_al_win_system->system.displays, sizeof (A5O_SYSTEM_WIN *)); _al_win_system->system.vt = vt; @@ -213,20 +213,20 @@ static ALLEGRO_SYSTEM *win_initialize(int flags) static void win_shutdown(void) { - ALLEGRO_SYSTEM *s; + A5O_SYSTEM *s; ASSERT(vt); /* Close all open displays. */ s = al_get_system_driver(); while (_al_vector_size(&s->displays) > 0) { - ALLEGRO_DISPLAY **dptr = _al_vector_ref(&s->displays, 0); - ALLEGRO_DISPLAY *d = *dptr; + A5O_DISPLAY **dptr = _al_vector_ref(&s->displays, 0); + A5O_DISPLAY *d = *dptr; al_destroy_display(d); } _al_vector_free(&s->displays); -#ifdef ALLEGRO_CFG_D3D +#ifdef A5O_CFG_D3D _al_d3d_shutdown_display(); #endif @@ -248,12 +248,12 @@ static void win_shutdown(void) } -static ALLEGRO_DISPLAY_INTERFACE *win_get_display_driver(void) +static A5O_DISPLAY_INTERFACE *win_get_display_driver(void) { const int flags = al_get_new_display_flags(); - ALLEGRO_SYSTEM *sys = al_get_system_driver(); - ALLEGRO_CONFIG *sys_cfg = al_get_system_config(); - ALLEGRO_SYSTEM_WIN *syswin = (ALLEGRO_SYSTEM_WIN *)sys; + A5O_SYSTEM *sys = al_get_system_driver(); + A5O_CONFIG *sys_cfg = al_get_system_config(); + A5O_SYSTEM_WIN *syswin = (A5O_SYSTEM_WIN *)sys; const char *s; /* Look up the toggle_mouse_grab_key binding. This isn't such a great place @@ -267,27 +267,27 @@ static ALLEGRO_DISPLAY_INTERFACE *win_get_display_driver(void) syswin->toggle_mouse_grab_keycode = _al_parse_key_binding(binding, &syswin->toggle_mouse_grab_modifiers); if (syswin->toggle_mouse_grab_keycode) { - ALLEGRO_DEBUG("Toggle mouse grab key: '%s'\n", binding); + A5O_DEBUG("Toggle mouse grab key: '%s'\n", binding); } else { - ALLEGRO_WARN("Cannot parse key binding '%s'\n", binding); + A5O_WARN("Cannot parse key binding '%s'\n", binding); } } } /* Programmatic selection. */ -#ifdef ALLEGRO_CFG_D3D - if (flags & ALLEGRO_DIRECT3D_INTERNAL) { +#ifdef A5O_CFG_D3D + if (flags & A5O_DIRECT3D_INTERNAL) { al_lock_mutex(win_mutex); - ALLEGRO_DISPLAY_INTERFACE* iface = _al_display_d3d_driver(); + A5O_DISPLAY_INTERFACE* iface = _al_display_d3d_driver(); al_unlock_mutex(win_mutex); if (iface == NULL) - ALLEGRO_WARN("Direct3D graphics driver not available.\n"); + A5O_WARN("Direct3D graphics driver not available.\n"); return iface; } #endif -#ifdef ALLEGRO_CFG_OPENGL - if (flags & ALLEGRO_OPENGL) { +#ifdef A5O_CFG_OPENGL + if (flags & A5O_OPENGL) { return _al_display_wgl_driver(); } #endif @@ -298,54 +298,54 @@ static ALLEGRO_DISPLAY_INTERFACE *win_get_display_driver(void) */ s = al_get_config_value(sys_cfg, "graphics", "driver"); if (s) { - ALLEGRO_DEBUG("Configuration value graphics.driver = %s\n", s); + A5O_DEBUG("Configuration value graphics.driver = %s\n", s); if (0 == _al_stricmp(s, "DIRECT3D") || 0 == _al_stricmp(s, "D3D")) { -#ifdef ALLEGRO_CFG_D3D +#ifdef A5O_CFG_D3D al_lock_mutex(win_mutex); - ALLEGRO_DISPLAY_INTERFACE* iface = _al_display_d3d_driver(); + A5O_DISPLAY_INTERFACE* iface = _al_display_d3d_driver(); al_unlock_mutex(win_mutex); if (iface != NULL) { - al_set_new_display_flags(flags | ALLEGRO_DIRECT3D_INTERNAL); + al_set_new_display_flags(flags | A5O_DIRECT3D_INTERNAL); return iface; } #endif } else if (0 == _al_stricmp(s, "OPENGL")) { -#ifdef ALLEGRO_CFG_OPENGL - al_set_new_display_flags(flags | ALLEGRO_OPENGL); +#ifdef A5O_CFG_OPENGL + al_set_new_display_flags(flags | A5O_OPENGL); return _al_display_wgl_driver(); #endif } else if (0 != _al_stricmp(s, "DEFAULT")) { - ALLEGRO_WARN("Graphics driver selection unrecognised: %s\n", s); + A5O_WARN("Graphics driver selection unrecognised: %s\n", s); } } /* Automatic graphics driver selection. */ /* XXX is implicitly setting new_display_flags the desired behaviour? */ -#ifdef ALLEGRO_CFG_D3D +#ifdef A5O_CFG_D3D { al_lock_mutex(win_mutex); - ALLEGRO_DISPLAY_INTERFACE* iface = _al_display_d3d_driver(); + A5O_DISPLAY_INTERFACE* iface = _al_display_d3d_driver(); al_unlock_mutex(win_mutex); if (iface != NULL) { - al_set_new_display_flags(flags | ALLEGRO_DIRECT3D_INTERNAL); + al_set_new_display_flags(flags | A5O_DIRECT3D_INTERNAL); return iface; } } #endif -#ifdef ALLEGRO_CFG_OPENGL +#ifdef A5O_CFG_OPENGL { - al_set_new_display_flags(flags | ALLEGRO_OPENGL); + al_set_new_display_flags(flags | A5O_OPENGL); return _al_display_wgl_driver(); } #endif - ALLEGRO_WARN("No graphics driver available.\n"); + A5O_WARN("No graphics driver available.\n"); return NULL; } /* FIXME: use the list */ -static ALLEGRO_KEYBOARD_DRIVER *win_get_keyboard_driver(void) +static A5O_KEYBOARD_DRIVER *win_get_keyboard_driver(void) { return _al_keyboard_driver_list[0].driver; } @@ -357,11 +357,11 @@ static ALLEGRO_KEYBOARD_DRIVER *win_get_keyboard_driver(void) static bool win_configured_joystick_driver_is(const char * name) { const char * driver; - ALLEGRO_CONFIG * sysconf = al_get_system_config(); + A5O_CONFIG * sysconf = al_get_system_config(); if (!sysconf) return false; driver = al_get_config_value(sysconf, "joystick", "driver"); if (!driver) return false; - ALLEGRO_DEBUG("Configuration value joystick.driver = %s\n", driver); + A5O_DEBUG("Configuration value joystick.driver = %s\n", driver); return (0 == _al_stricmp(driver, name)); } @@ -385,54 +385,54 @@ static bool win_use_directinput(void) /* By default the combined xinput/directinput driver is used unless directinput * or xinput exclusive is set.*/ -static ALLEGRO_JOYSTICK_DRIVER *win_get_joystick_driver(void) +static A5O_JOYSTICK_DRIVER *win_get_joystick_driver(void) { if (win_use_directinput()) { - ALLEGRO_DEBUG("Selected DirectInput joystick driver.\n"); + A5O_DEBUG("Selected DirectInput joystick driver.\n"); return &_al_joydrv_directx; } if (win_use_xinput()) { -#ifdef ALLEGRO_CFG_XINPUT - ALLEGRO_DEBUG("Selected XInput joystick driver.\n"); +#ifdef A5O_CFG_XINPUT + A5O_DEBUG("Selected XInput joystick driver.\n"); return &_al_joydrv_xinput; #else - ALLEGRO_WARN("XInput joystick driver not supported.\n"); + A5O_WARN("XInput joystick driver not supported.\n"); #endif } -#ifdef ALLEGRO_CFG_XINPUT - ALLEGRO_DEBUG("Selected combined XInput/DirectInput joystick driver.\n"); +#ifdef A5O_CFG_XINPUT + A5O_DEBUG("Selected combined XInput/DirectInput joystick driver.\n"); return &_al_joydrv_windows_all; #else - ALLEGRO_WARN("Combined XInput/DirectInput joystick driver not supported. Usign DirectInput in stead.\n"); + A5O_WARN("Combined XInput/DirectInput joystick driver not supported. Usign DirectInput in stead.\n"); return &_al_joydrv_directx; #endif } /* By default the combined haptic driver is used unless directinput or * xinput exclusive is set in the configuration.*/ -static ALLEGRO_HAPTIC_DRIVER *win_get_haptic_driver(void) +static A5O_HAPTIC_DRIVER *win_get_haptic_driver(void) { if (win_use_directinput()) { - ALLEGRO_DEBUG("Selected DirectInput haptic driver.\n"); + A5O_DEBUG("Selected DirectInput haptic driver.\n"); return &_al_hapdrv_directx; } if (win_use_xinput()) { -#ifdef ALLEGRO_CFG_XINPUT - ALLEGRO_DEBUG("Selected XInput haptic driver.\n"); +#ifdef A5O_CFG_XINPUT + A5O_DEBUG("Selected XInput haptic driver.\n"); return &_al_hapdrv_xinput; #else - ALLEGRO_WARN("XInput haptic driver not supported.\n"); + A5O_WARN("XInput haptic driver not supported.\n"); #endif } -#ifdef ALLEGRO_CFG_XINPUT - ALLEGRO_DEBUG("Selected combined XInput/DirectInput haptic driver.\n"); +#ifdef A5O_CFG_XINPUT + A5O_DEBUG("Selected combined XInput/DirectInput haptic driver.\n"); return &_al_hapdrv_windows_all; #else - ALLEGRO_WARN("Combined XInput/DirectInput haptic driver not supported. Using DirectInput in stead.\n"); + A5O_WARN("Combined XInput/DirectInput haptic driver not supported. Using DirectInput in stead.\n"); return &_al_hapdrv_directx; #endif } @@ -444,31 +444,31 @@ static int win_get_num_display_modes(void) int refresh_rate = al_get_new_display_refresh_rate(); int flags = al_get_new_display_flags(); -#if defined ALLEGRO_CFG_OPENGL - if (flags & ALLEGRO_OPENGL) { +#if defined A5O_CFG_OPENGL + if (flags & A5O_OPENGL) { return _al_wgl_get_num_display_modes(format, refresh_rate, flags); } #endif -#if defined ALLEGRO_CFG_D3D +#if defined A5O_CFG_D3D return _al_d3d_get_num_display_modes(format, refresh_rate, flags); #endif return 0; } -static ALLEGRO_DISPLAY_MODE *win_get_display_mode(int index, - ALLEGRO_DISPLAY_MODE *mode) +static A5O_DISPLAY_MODE *win_get_display_mode(int index, + A5O_DISPLAY_MODE *mode) { int format = _al_deduce_color_format(_al_get_new_display_settings()); int refresh_rate = al_get_new_display_refresh_rate(); int flags = al_get_new_display_flags(); -#if defined ALLEGRO_CFG_OPENGL - if (flags & ALLEGRO_OPENGL) { +#if defined A5O_CFG_OPENGL + if (flags & A5O_OPENGL) { return _al_wgl_get_display_mode(index, format, refresh_rate, flags, mode); } #endif -#if defined ALLEGRO_CFG_D3D +#if defined A5O_CFG_D3D return _al_d3d_get_display_mode(index, format, refresh_rate, flags, mode); #endif @@ -531,7 +531,7 @@ static int win_get_monitor_refresh_rate(int adapter) return dm.dmDisplayFrequency; } -static bool win_get_monitor_info(int adapter, ALLEGRO_MONITOR_INFO *info) +static bool win_get_monitor_info(int adapter, A5O_MONITOR_INFO *info) { DISPLAY_DEVICE dd; DEVMODE dm; @@ -574,7 +574,7 @@ static BOOL CALLBACK monitor_enum_proc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT return true; } -static HMONITOR win_get_monitor(ALLEGRO_MONITOR_INFO *info) +static HMONITOR win_get_monitor(A5O_MONITOR_INFO *info) { HMONITOR h_monitor; RECT rect; @@ -591,7 +591,7 @@ static HMONITOR win_get_monitor(ALLEGRO_MONITOR_INFO *info) static int win_get_monitor_dpi(int adapter) { - ALLEGRO_MONITOR_INFO info; + A5O_MONITOR_INFO info; HMODULE shcore_dll = _al_win_safe_load_library("shcore.dll"); UINT dpi_hori; UINT dpi_vert; @@ -634,10 +634,10 @@ static bool win_get_cursor_position(int *ret_x, int *ret_y) return true; } -static bool win_grab_mouse(ALLEGRO_DISPLAY *display) +static bool win_grab_mouse(A5O_DISPLAY *display) { - ALLEGRO_SYSTEM_WIN *system = (void *)al_get_system_driver(); - ALLEGRO_DISPLAY_WIN *win_disp = (void *)display; + A5O_SYSTEM_WIN *system = (void *)al_get_system_driver(); + A5O_DISPLAY_WIN *win_disp = (void *)display; RECT rect; GetWindowRect(win_disp->window, &rect); @@ -651,19 +651,19 @@ static bool win_grab_mouse(ALLEGRO_DISPLAY *display) static bool win_ungrab_mouse(void) { - ALLEGRO_SYSTEM_WIN *system = (void *)al_get_system_driver(); + A5O_SYSTEM_WIN *system = (void *)al_get_system_driver(); ClipCursor(NULL); system->mouse_grab_display = NULL; return true; } -static ALLEGRO_MOUSE_DRIVER *win_get_mouse_driver(void) +static A5O_MOUSE_DRIVER *win_get_mouse_driver(void) { return _al_mouse_driver_list[0].driver; } -static ALLEGRO_TOUCH_INPUT_DRIVER *win_get_touch_input_driver(void) +static A5O_TOUCH_INPUT_DRIVER *win_get_touch_input_driver(void) { return _al_touch_input_driver_list[0].driver; } @@ -671,17 +671,17 @@ static ALLEGRO_TOUCH_INPUT_DRIVER *win_get_touch_input_driver(void) /* _al_win_get_path: * Returns full path to various system and user diretories */ -ALLEGRO_PATH *_al_win_get_path(int id) +A5O_PATH *_al_win_get_path(int id) { char path[MAX_PATH]; wchar_t pathw[MAX_PATH]; - ALLEGRO_USTR *pathu; + A5O_USTR *pathu; uint32_t csidl = 0; HRESULT ret = 0; - ALLEGRO_PATH *cisdl_path = NULL; + A5O_PATH *cisdl_path = NULL; switch (id) { - case ALLEGRO_TEMP_PATH: { + case A5O_TEMP_PATH: { /* Check: TMP, TMPDIR, TEMP or TEMPDIR */ DWORD ret = GetTempPathW(MAX_PATH, pathw); @@ -696,7 +696,7 @@ ALLEGRO_PATH *_al_win_get_path(int id) } break; - case ALLEGRO_RESOURCES_PATH: { /* where the program is in */ + case A5O_RESOURCES_PATH: { /* where the program is in */ HANDLE process = GetCurrentProcess(); char *ptr; @@ -716,20 +716,20 @@ ALLEGRO_PATH *_al_win_get_path(int id) return al_create_path_for_directory(path); } break; - case ALLEGRO_USER_DATA_PATH: /* CSIDL_APPDATA */ - case ALLEGRO_USER_SETTINGS_PATH: + case A5O_USER_DATA_PATH: /* CSIDL_APPDATA */ + case A5O_USER_SETTINGS_PATH: csidl = CSIDL_APPDATA; break; - case ALLEGRO_USER_HOME_PATH: /* CSIDL_PROFILE */ + case A5O_USER_HOME_PATH: /* CSIDL_PROFILE */ csidl = CSIDL_PROFILE; break; - case ALLEGRO_USER_DOCUMENTS_PATH: /* CSIDL_PERSONAL */ + case A5O_USER_DOCUMENTS_PATH: /* CSIDL_PERSONAL */ csidl = CSIDL_PERSONAL; break; - case ALLEGRO_EXENAME_PATH: { /* full path to the exe including its name */ + case A5O_EXENAME_PATH: { /* full path to the exe including its name */ HANDLE process = GetCurrentProcess(); GetModuleFileNameExW(process, NULL, pathw, MAX_PATH); @@ -794,17 +794,17 @@ static HMODULE load_library_at_path(const TCHAR *path_str) * on Vista. */ char* upath_str = _twin_tchar_to_utf8(path_str); - ALLEGRO_DEBUG("Calling LoadLibrary %s\n", upath_str); + A5O_DEBUG("Calling LoadLibrary %s\n", upath_str); lib = LoadLibrary(path_str); if (lib) { - ALLEGRO_INFO("Loaded %s\n", upath_str); + A5O_INFO("Loaded %s\n", upath_str); } else { DWORD error = GetLastError(); HRESULT hr = HRESULT_FROM_WIN32(error); /* XXX do something with it */ (void)hr; - ALLEGRO_WARN("Failed to load %s (error: %ld)\n", upath_str, error); + A5O_WARN("Failed to load %s (error: %ld)\n", upath_str, error); } al_free(upath_str); return lib; @@ -819,9 +819,9 @@ static bool is_build_config_name(const char *s) || 0 == strcmp(s, "Profile")); } -static ALLEGRO_PATH *maybe_parent_dir(const ALLEGRO_PATH *path) +static A5O_PATH *maybe_parent_dir(const A5O_PATH *path) { - ALLEGRO_PATH *path2; + A5O_PATH *path2; if (!path) return NULL; @@ -833,7 +833,7 @@ static ALLEGRO_PATH *maybe_parent_dir(const ALLEGRO_PATH *path) if (path2) { al_drop_path_tail(path2); al_set_path_filename(path2, NULL); - ALLEGRO_DEBUG("Also searching %s\n", al_path_cstr(path2, '\\')); + A5O_DEBUG("Also searching %s\n", al_path_cstr(path2, '\\')); } return path2; @@ -846,8 +846,8 @@ static ALLEGRO_PATH *maybe_parent_dir(const ALLEGRO_PATH *path) */ HMODULE _al_win_safe_load_library(const char *filename) { - ALLEGRO_PATH *path1 = NULL; - ALLEGRO_PATH *path2 = NULL; + A5O_PATH *path1 = NULL; + A5O_PATH *path2 = NULL; TCHAR buf[MAX_PATH]; const TCHAR *other_dirs[3]; HMODULE lib = NULL; @@ -859,7 +859,7 @@ HMODULE _al_win_safe_load_library(const char *filename) * library from the current directory. This leads to less surprises when * running example programs. */ -#if defined(ALLEGRO_MSVC) +#if defined(A5O_MSVC) msvc_only = true; #endif @@ -869,7 +869,7 @@ HMODULE _al_win_safe_load_library(const char *filename) */ if (al_is_system_installed()) { - path1 = al_get_standard_path(ALLEGRO_RESOURCES_PATH); + path1 = al_get_standard_path(A5O_RESOURCES_PATH); } else if (GetModuleFileName(NULL, buf, sizeof(buf)) < sizeof(buf)) { char* tmp = _twin_tchar_to_utf8(buf); @@ -888,12 +888,12 @@ HMODULE _al_win_safe_load_library(const char *filename) al_free(tfilename); if (PathFindOnPath(buf, other_dirs)) { char* tmp = _twin_tchar_to_utf8(buf); - ALLEGRO_DEBUG("PathFindOnPath found: %s\n", tmp); + A5O_DEBUG("PathFindOnPath found: %s\n", tmp); al_free(tmp); lib = load_library_at_path(buf); } else { - ALLEGRO_WARN("PathFindOnPath failed to find %s\n", filename); + A5O_WARN("PathFindOnPath failed to find %s\n", filename); } al_free((void*) other_dirs[0]); al_free((void*) other_dirs[1]); @@ -920,13 +920,13 @@ static void win_close_library(void *library) FreeLibrary(library); } -static ALLEGRO_SYSTEM_INTERFACE *_al_system_win_driver(void) +static A5O_SYSTEM_INTERFACE *_al_system_win_driver(void) { if (vt) return vt; vt = al_calloc(1, sizeof *vt); - vt->id = ALLEGRO_SYSTEM_ID_WINDOWS; + vt->id = A5O_SYSTEM_ID_WINDOWS; vt->initialize = win_initialize; vt->get_display_driver = win_get_display_driver; vt->get_keyboard_driver = win_get_keyboard_driver; @@ -960,7 +960,7 @@ static ALLEGRO_SYSTEM_INTERFACE *_al_system_win_driver(void) void _al_register_system_interfaces() { - ALLEGRO_SYSTEM_INTERFACE **add; + A5O_SYSTEM_INTERFACE **add; add = _al_vector_alloc_back(&_al_system_interfaces); *add = _al_system_win_driver(); diff --git a/src/win/wthread.c b/src/win/wthread.c index 4e2972e1fa..b1f20085fb 100644 --- a/src/win/wthread.c +++ b/src/win/wthread.c @@ -24,11 +24,11 @@ #include -#ifndef ALLEGRO_WINDOWS +#ifndef A5O_WINDOWS #error something is wrong with the makefile #endif -ALLEGRO_DEBUG_CHANNEL("system") +A5O_DEBUG_CHANNEL("system") /* COINIT_MULTITHREADED is not defined in objbase.h for MSVC */ @@ -58,13 +58,13 @@ void _al_win_thread_init(void) ole32, "CoInitializeEx"); } else { - ALLEGRO_WARN("OLE32.DLL can't be loaded.\n"); + A5O_WARN("OLE32.DLL can't be loaded.\n"); } if (_CoInitializeEx == NULL) { - ALLEGRO_WARN("Microsoft Distributed COM is not installed on this system. If you have problems "); - ALLEGRO_WARN("with this application, please install the DCOM update. You can find it on the "); - ALLEGRO_WARN("Microsoft homepage\n"); + A5O_WARN("Microsoft Distributed COM is not installed on this system. If you have problems "); + A5O_WARN("with this application, please install the DCOM update. You can find it on the "); + A5O_WARN("Microsoft homepage\n"); } } diff --git a/src/win/wtime.c b/src/win/wtime.c index 9d3f7463e2..2335b994ad 100644 --- a/src/win/wtime.c +++ b/src/win/wtime.c @@ -22,8 +22,8 @@ #include -ALLEGRO_STATIC_ASSERT(wtime, - sizeof(ALLEGRO_TIMEOUT_WIN) <= sizeof(ALLEGRO_TIMEOUT)); +A5O_STATIC_ASSERT(wtime, + sizeof(A5O_TIMEOUT_WIN) <= sizeof(A5O_TIMEOUT)); #define LARGE_INTEGER_TO_INT64(li) (((int64_t)li.HighPart << 32) | \ @@ -128,9 +128,9 @@ void _al_win_rest(double seconds) -void _al_win_init_timeout(ALLEGRO_TIMEOUT *timeout, double seconds) +void _al_win_init_timeout(A5O_TIMEOUT *timeout, double seconds) { - ALLEGRO_TIMEOUT_WIN *wt = (ALLEGRO_TIMEOUT_WIN *) timeout; + A5O_TIMEOUT_WIN *wt = (A5O_TIMEOUT_WIN *) timeout; ASSERT(wt); ASSERT(seconds <= INT_MAX/1000.0); diff --git a/src/win/wtouch_input.c b/src/win/wtouch_input.c index 21b6fa002b..47e81827c5 100644 --- a/src/win/wtouch_input.c +++ b/src/win/wtouch_input.c @@ -24,10 +24,10 @@ #include "allegro5/platform/aintwin.h" #include "allegro5/internal/aintern_display.h" -ALLEGRO_DEBUG_CHANNEL("touch") +A5O_DEBUG_CHANNEL("touch") -static ALLEGRO_TOUCH_INPUT_STATE touch_input_state; -static ALLEGRO_TOUCH_INPUT touch_input; +static A5O_TOUCH_INPUT_STATE touch_input_state; +static A5O_TOUCH_INPUT touch_input; static bool installed = false; static size_t initiali_time_stamp = ~0; @@ -81,13 +81,13 @@ bool _al_win_init_touch_input_api(void) /* Mark as 'do not try this again'. */ touch_input_api_reference_counter = -1; - ALLEGRO_WARN("failed loading the touch input API\n"); + A5O_WARN("failed loading the touch input API\n"); return false; } /* Set initial reference count. */ touch_input_api_reference_counter = 1; - ALLEGRO_INFO("touch input API installed successfully\n"); + A5O_INFO("touch input API installed successfully\n"); return true; } @@ -116,18 +116,18 @@ void _al_win_exit_touch_input_api(void) /* Actual driver implementation. */ -static void generate_touch_input_event(int type, double timestamp, int id, float x, float y, float dx, float dy, bool primary, ALLEGRO_DISPLAY_WIN *win_disp) +static void generate_touch_input_event(int type, double timestamp, int id, float x, float y, float dx, float dy, bool primary, A5O_DISPLAY_WIN *win_disp) { - ALLEGRO_EVENT event; + A5O_EVENT event; bool want_touch_event = _al_event_source_needs_to_generate_event(&touch_input.es); bool want_mouse_emulation_event = _al_event_source_needs_to_generate_event(&touch_input.mouse_emulation_es) && primary && al_is_mouse_installed(); - if (touch_input.mouse_emulation_mode == ALLEGRO_MOUSE_EMULATION_NONE) + if (touch_input.mouse_emulation_mode == A5O_MOUSE_EMULATION_NONE) want_mouse_emulation_event = false; - else if (touch_input.mouse_emulation_mode == ALLEGRO_MOUSE_EMULATION_INCLUSIVE) + else if (touch_input.mouse_emulation_mode == A5O_MOUSE_EMULATION_INCLUSIVE) want_touch_event = want_mouse_emulation_event ? (want_touch_event && !primary) : want_touch_event; - else if (touch_input.mouse_emulation_mode == ALLEGRO_MOUSE_EMULATION_EXCLUSIVE) + else if (touch_input.mouse_emulation_mode == A5O_MOUSE_EMULATION_EXCLUSIVE) want_touch_event = want_mouse_emulation_event ? false : want_touch_event; if (!want_touch_event && !want_mouse_emulation_event) @@ -136,7 +136,7 @@ static void generate_touch_input_event(int type, double timestamp, int id, float if (want_touch_event) { event.touch.type = type; - event.touch.display = (ALLEGRO_DISPLAY*)win_disp; + event.touch.display = (A5O_DISPLAY*)win_disp; event.touch.timestamp = timestamp; event.touch.id = id; event.touch.x = x; @@ -152,20 +152,20 @@ static void generate_touch_input_event(int type, double timestamp, int id, float if (want_mouse_emulation_event) { - ALLEGRO_MOUSE_STATE state; + A5O_MOUSE_STATE state; switch (type) { - case ALLEGRO_EVENT_TOUCH_BEGIN: type = ALLEGRO_EVENT_MOUSE_BUTTON_DOWN; break; - case ALLEGRO_EVENT_TOUCH_CANCEL: - case ALLEGRO_EVENT_TOUCH_END: type = ALLEGRO_EVENT_MOUSE_BUTTON_UP; break; - case ALLEGRO_EVENT_TOUCH_MOVE: type = ALLEGRO_EVENT_MOUSE_AXES; break; + case A5O_EVENT_TOUCH_BEGIN: type = A5O_EVENT_MOUSE_BUTTON_DOWN; break; + case A5O_EVENT_TOUCH_CANCEL: + case A5O_EVENT_TOUCH_END: type = A5O_EVENT_MOUSE_BUTTON_UP; break; + case A5O_EVENT_TOUCH_MOVE: type = A5O_EVENT_MOUSE_AXES; break; } al_get_mouse_state(&state); event.mouse.type = type; event.mouse.timestamp = timestamp; - event.mouse.display = (ALLEGRO_DISPLAY*)win_disp; + event.mouse.display = (A5O_DISPLAY*)win_disp; event.mouse.x = (int)x; event.mouse.y = (int)y; event.mouse.z = state.z; @@ -188,7 +188,7 @@ static void generate_touch_input_event(int type, double timestamp, int id, float static bool init_touch_input(void) { unsigned i; - ALLEGRO_SYSTEM* system; + A5O_SYSTEM* system; if (installed) return false; @@ -201,18 +201,18 @@ static bool init_touch_input(void) _al_event_source_init(&touch_input.es); _al_event_source_init(&touch_input.mouse_emulation_es); - touch_input.mouse_emulation_mode = ALLEGRO_MOUSE_EMULATION_TRANSPARENT; + touch_input.mouse_emulation_mode = A5O_MOUSE_EMULATION_TRANSPARENT; installed = true; system = al_get_system_driver(); for (i = 0; i < _al_vector_size(&system->displays); ++i) { bool r; - ALLEGRO_DISPLAY_WIN *win_display = *((ALLEGRO_DISPLAY_WIN**)_al_vector_ref(&system->displays, i)); + A5O_DISPLAY_WIN *win_display = *((A5O_DISPLAY_WIN**)_al_vector_ref(&system->displays, i)); r = _al_win_register_touch_window(win_display->window, 0); - ALLEGRO_INFO("registering touch window %p: %d\n", win_display, r); + A5O_INFO("registering touch window %p: %d\n", win_display, r); if (!r) { - ALLEGRO_ERROR("RegisterTouchWindow failed: %s\n", _al_win_last_error()); + A5O_ERROR("RegisterTouchWindow failed: %s\n", _al_win_last_error()); return false; } } @@ -237,13 +237,13 @@ static void exit_touch_input(void) } -static ALLEGRO_TOUCH_INPUT* get_touch_input(void) +static A5O_TOUCH_INPUT* get_touch_input(void) { return &touch_input; } -static void get_touch_input_state(ALLEGRO_TOUCH_INPUT_STATE *ret_state) +static void get_touch_input_state(A5O_TOUCH_INPUT_STATE *ret_state) { _al_event_source_lock(&touch_input.es); *ret_state = touch_input_state; @@ -257,13 +257,13 @@ static void set_mouse_emulation_mode(int mode) int i; - for (i = 0; i < ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) { + for (i = 0; i < A5O_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) { - ALLEGRO_TOUCH_STATE* touch = touch_input_state.touches + i; + A5O_TOUCH_STATE* touch = touch_input_state.touches + i; if (touch->id > 0) { _al_win_touch_input_handle_cancel(touch->id, initiali_time_stamp, - touch->x, touch->y, touch->primary, (ALLEGRO_DISPLAY_WIN*)touch->display); + touch->x, touch->y, touch->primary, (A5O_DISPLAY_WIN*)touch->display); } } @@ -272,11 +272,11 @@ static void set_mouse_emulation_mode(int mode) } -static ALLEGRO_TOUCH_STATE* find_free_touch_state(void) +static A5O_TOUCH_STATE* find_free_touch_state(void) { int i; - for (i = 0; i < ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) + for (i = 0; i < A5O_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) if (touch_input_state.touches[i].id <= 0) return touch_input_state.touches + i; @@ -284,11 +284,11 @@ static ALLEGRO_TOUCH_STATE* find_free_touch_state(void) } -static ALLEGRO_TOUCH_STATE* find_touch_state_with_id(int id) +static A5O_TOUCH_STATE* find_touch_state_with_id(int id) { int i; - for (i = 0; i < ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) + for (i = 0; i < A5O_TOUCH_INPUT_MAX_TOUCH_COUNT; ++i) if (touch_input_state.touches[i].id == id) return touch_input_state.touches + i; @@ -309,9 +309,9 @@ void _al_win_touch_input_set_time_stamp(size_t timestamp) } -void _al_win_touch_input_handle_begin(int id, size_t timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY_WIN *win_disp) +void _al_win_touch_input_handle_begin(int id, size_t timestamp, float x, float y, bool primary, A5O_DISPLAY_WIN *win_disp) { - ALLEGRO_TOUCH_STATE* state = find_free_touch_state(); + A5O_TOUCH_STATE* state = find_free_touch_state(); if (NULL == state) return; @@ -324,14 +324,14 @@ void _al_win_touch_input_handle_begin(int id, size_t timestamp, float x, float y state->primary = primary; _al_event_source_unlock(&touch_input.es); - generate_touch_input_event(ALLEGRO_EVENT_TOUCH_BEGIN, get_time_stamp(timestamp), + generate_touch_input_event(A5O_EVENT_TOUCH_BEGIN, get_time_stamp(timestamp), state->id, state->x, state->y, state->dx, state->dy, state->primary, win_disp); } -void _al_win_touch_input_handle_end(int id, size_t timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY_WIN *win_disp) +void _al_win_touch_input_handle_end(int id, size_t timestamp, float x, float y, bool primary, A5O_DISPLAY_WIN *win_disp) { - ALLEGRO_TOUCH_STATE* state; + A5O_TOUCH_STATE* state; (void)primary; state = find_touch_state_with_id(id); @@ -345,18 +345,18 @@ void _al_win_touch_input_handle_end(int id, size_t timestamp, float x, float y, state->y = y; _al_event_source_unlock(&touch_input.es); - generate_touch_input_event(ALLEGRO_EVENT_TOUCH_END, get_time_stamp(timestamp), + generate_touch_input_event(A5O_EVENT_TOUCH_END, get_time_stamp(timestamp), state->id, state->x, state->y, state->dx, state->dy, state->primary, win_disp); _al_event_source_lock(&touch_input.es); - memset(state, 0, sizeof(ALLEGRO_TOUCH_STATE)); + memset(state, 0, sizeof(A5O_TOUCH_STATE)); _al_event_source_unlock(&touch_input.es); } -void _al_win_touch_input_handle_move(int id, size_t timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY_WIN *win_disp) +void _al_win_touch_input_handle_move(int id, size_t timestamp, float x, float y, bool primary, A5O_DISPLAY_WIN *win_disp) { - ALLEGRO_TOUCH_STATE* state; + A5O_TOUCH_STATE* state; (void)primary; state = find_touch_state_with_id(id); @@ -370,14 +370,14 @@ void _al_win_touch_input_handle_move(int id, size_t timestamp, float x, float y, state->y = y; _al_event_source_unlock(&touch_input.es); - generate_touch_input_event(ALLEGRO_EVENT_TOUCH_MOVE, get_time_stamp(timestamp), + generate_touch_input_event(A5O_EVENT_TOUCH_MOVE, get_time_stamp(timestamp), state->id, state->x, state->y, state->dx, state->dy, state->primary, win_disp); } -void _al_win_touch_input_handle_cancel(int id, size_t timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY_WIN *win_disp) +void _al_win_touch_input_handle_cancel(int id, size_t timestamp, float x, float y, bool primary, A5O_DISPLAY_WIN *win_disp) { - ALLEGRO_TOUCH_STATE* state; + A5O_TOUCH_STATE* state; (void)primary; state = find_touch_state_with_id(id); @@ -391,11 +391,11 @@ void _al_win_touch_input_handle_cancel(int id, size_t timestamp, float x, float state->y = y; _al_event_source_unlock(&touch_input.es); - generate_touch_input_event(ALLEGRO_EVENT_TOUCH_CANCEL, get_time_stamp(timestamp), + generate_touch_input_event(A5O_EVENT_TOUCH_CANCEL, get_time_stamp(timestamp), state->id, state->x, state->y, state->dx, state->dy, state->primary, win_disp); _al_event_source_lock(&touch_input.es); - memset(state, 0, sizeof(ALLEGRO_TOUCH_STATE)); + memset(state, 0, sizeof(A5O_TOUCH_STATE)); _al_event_source_unlock(&touch_input.es); } @@ -403,7 +403,7 @@ void _al_win_touch_input_handle_cancel(int id, size_t timestamp, float x, float /* the driver vtable */ #define TOUCH_INPUT_WINAPI AL_ID('W','T','I','D') -static ALLEGRO_TOUCH_INPUT_DRIVER touch_input_driver = +static A5O_TOUCH_INPUT_DRIVER touch_input_driver = { TOUCH_INPUT_WINAPI, init_touch_input, diff --git a/src/win/wunicode.c b/src/win/wunicode.c index c5df072958..bce30ab861 100644 --- a/src/win/wunicode.c +++ b/src/win/wunicode.c @@ -18,12 +18,12 @@ #include -ALLEGRO_DEBUG_CHANNEL("wunicode") +A5O_DEBUG_CHANNEL("wunicode") /* _al_win_ustr_to_utf16: - * Convert ALLEGRO_USTR to newly-allocated UTF-16 buffer + * Convert A5O_USTR to newly-allocated UTF-16 buffer */ -wchar_t *_al_win_ustr_to_utf16(const ALLEGRO_USTR *u) +wchar_t *_al_win_ustr_to_utf16(const A5O_USTR *u) { int wslen; wchar_t *ws; @@ -37,19 +37,19 @@ wchar_t *_al_win_ustr_to_utf16(const ALLEGRO_USTR *u) } wslen = MultiByteToWideChar(CP_UTF8, 0, us, uslen, NULL, 0); if (wslen == 0) { - ALLEGRO_ERROR("MultiByteToWideChar failed\n"); + A5O_ERROR("MultiByteToWideChar failed\n"); return NULL; } /* For the NUL at the end. */ wslen += 1; ws = al_malloc(sizeof(wchar_t) * wslen); if (!ws) { - ALLEGRO_ERROR("Out of memory\n"); + A5O_ERROR("Out of memory\n"); return NULL; } if (0 == MultiByteToWideChar(CP_UTF8, 0, us, uslen, ws, wslen)) { al_free(ws); - ALLEGRO_ERROR("MultiByteToWideChar failed\n"); + A5O_ERROR("MultiByteToWideChar failed\n"); return NULL; } ws[wslen - 1] = 0; @@ -59,7 +59,7 @@ wchar_t *_al_win_ustr_to_utf16(const ALLEGRO_USTR *u) /* _al_win_utf8_to_ansi: * Convert UTF-8 to newly-allocated ansi buffer */ -char* _al_win_ustr_to_ansi(const ALLEGRO_USTR *u) { +char* _al_win_ustr_to_ansi(const A5O_USTR *u) { int wslen; wchar_t *ws; int slen; @@ -74,22 +74,22 @@ char* _al_win_ustr_to_ansi(const ALLEGRO_USTR *u) { } wslen = MultiByteToWideChar(CP_UTF8, 0, us, uslen, NULL, 0); if (wslen == 0) { - ALLEGRO_ERROR("MultiByteToWideChar failed\n"); + A5O_ERROR("MultiByteToWideChar failed\n"); return NULL; } ws = al_malloc(sizeof(wchar_t) * wslen); if (!ws) { - ALLEGRO_ERROR("Out of memory\n"); + A5O_ERROR("Out of memory\n"); return NULL; } if (0 == MultiByteToWideChar(CP_UTF8, 0, us, uslen, ws, wslen)) { al_free(ws); - ALLEGRO_ERROR("MultiByteToWideChar failed\n"); + A5O_ERROR("MultiByteToWideChar failed\n"); return NULL; } slen = WideCharToMultiByte(CP_ACP, 0, ws, wslen, NULL, 0, NULL, NULL); if (slen == 0) { - ALLEGRO_ERROR("WideCharToMultiByte failed\n"); + A5O_ERROR("WideCharToMultiByte failed\n"); al_free(ws); return NULL; } @@ -97,14 +97,14 @@ char* _al_win_ustr_to_ansi(const ALLEGRO_USTR *u) { slen += 1; s = al_malloc(sizeof(char) * slen); if (!s) { - ALLEGRO_ERROR("Out of memory\n"); + A5O_ERROR("Out of memory\n"); al_free(ws); return NULL; } if (0 == WideCharToMultiByte(CP_ACP, 0, ws, wslen, s, slen, NULL, NULL)) { al_free(ws); al_free(s); - ALLEGRO_ERROR("WideCharToMultiByte failed\n"); + A5O_ERROR("WideCharToMultiByte failed\n"); return NULL; } s[slen - 1] = 0; @@ -125,17 +125,17 @@ wchar_t *_al_win_utf8_to_utf16(const char *us) } wslen = MultiByteToWideChar(CP_UTF8, 0, us, -1, NULL, 0); if (wslen == 0) { - ALLEGRO_ERROR("MultiByteToWideChar failed\n"); + A5O_ERROR("MultiByteToWideChar failed\n"); return NULL; } ws = al_malloc(sizeof(wchar_t) * wslen); if (!ws) { - ALLEGRO_ERROR("Out of memory\n"); + A5O_ERROR("Out of memory\n"); return NULL; } if (0 == MultiByteToWideChar(CP_UTF8, 0, us, -1, ws, wslen)) { al_free(ws); - ALLEGRO_ERROR("MultiByteToWideChar failed\n"); + A5O_ERROR("MultiByteToWideChar failed\n"); return NULL; } return ws; @@ -154,17 +154,17 @@ char *_al_win_utf16_to_utf8(const wchar_t *ws) } uslen = WideCharToMultiByte(CP_UTF8, 0, ws, -1, NULL, 0, NULL, NULL); if (uslen == 0) { - ALLEGRO_ERROR("WideCharToMultiByte failed\n"); + A5O_ERROR("WideCharToMultiByte failed\n"); return NULL; } us = al_malloc(sizeof(char) * uslen); if (!us) { - ALLEGRO_ERROR("Out of memory\n"); + A5O_ERROR("Out of memory\n"); return NULL; } if (0 == WideCharToMultiByte(CP_UTF8, 0, ws, -1, us, uslen, NULL, NULL)) { al_free(us); - ALLEGRO_ERROR("WideCharToMultiByte failed\n"); + A5O_ERROR("WideCharToMultiByte failed\n"); return NULL; } return us; @@ -183,35 +183,35 @@ char* _al_win_utf8_to_ansi(const char *us) { } wslen = MultiByteToWideChar(CP_UTF8, 0, us, -1, NULL, 0); if (wslen == 0) { - ALLEGRO_ERROR("MultiByteToWideChar failed\n"); + A5O_ERROR("MultiByteToWideChar failed\n"); return NULL; } ws = al_malloc(sizeof(wchar_t) * wslen); if (!ws) { - ALLEGRO_ERROR("Out of memory\n"); + A5O_ERROR("Out of memory\n"); return NULL; } if (0 == MultiByteToWideChar(CP_UTF8, 0, us, -1, ws, wslen)) { al_free(ws); - ALLEGRO_ERROR("MultiByteToWideChar failed\n"); + A5O_ERROR("MultiByteToWideChar failed\n"); return NULL; } slen = WideCharToMultiByte(CP_ACP, 0, ws, -1, NULL, 0, NULL, NULL); if (slen == 0) { - ALLEGRO_ERROR("WideCharToMultiByte failed\n"); + A5O_ERROR("WideCharToMultiByte failed\n"); al_free(ws); return NULL; } s = al_malloc(sizeof(char) * slen); if (!s) { - ALLEGRO_ERROR("Out of memory\n"); + A5O_ERROR("Out of memory\n"); al_free(ws); return NULL; } if (0 == WideCharToMultiByte(CP_ACP, 0, ws, -1, s, slen, NULL, NULL)) { al_free(ws); al_free(s); - ALLEGRO_ERROR("WideCharToMultiByte failed\n"); + A5O_ERROR("WideCharToMultiByte failed\n"); return NULL; } al_free(ws); @@ -232,35 +232,35 @@ char* _al_win_ansi_to_utf8(const char *s) { } wslen = MultiByteToWideChar(CP_ACP, 0, s, -1, NULL, 0); if (wslen == 0) { - ALLEGRO_ERROR("MultiByteToWideChar failed\n"); + A5O_ERROR("MultiByteToWideChar failed\n"); return NULL; } ws = al_malloc(sizeof(wchar_t) * wslen); if (!ws) { - ALLEGRO_ERROR("Out of memory\n"); + A5O_ERROR("Out of memory\n"); return NULL; } if (0 == MultiByteToWideChar(CP_ACP, 0, s, -1, ws, wslen)) { al_free(ws); - ALLEGRO_ERROR("MultiByteToWideChar failed\n"); + A5O_ERROR("MultiByteToWideChar failed\n"); return NULL; } uslen = WideCharToMultiByte(CP_UTF8, 0, ws, -1, NULL, 0, NULL, NULL); if (uslen == 0) { - ALLEGRO_ERROR("WideCharToMultiByte failed\n"); + A5O_ERROR("WideCharToMultiByte failed\n"); al_free(ws); return NULL; } us = al_malloc(sizeof(char) * uslen); if (!s) { - ALLEGRO_ERROR("Out of memory\n"); + A5O_ERROR("Out of memory\n"); al_free(ws); return NULL; } if (0 == WideCharToMultiByte(CP_UTF8, 0, ws, -1, us, uslen, NULL, NULL)) { al_free(ws); al_free(us); - ALLEGRO_ERROR("WideCharToMultiByte failed\n"); + A5O_ERROR("WideCharToMultiByte failed\n"); return NULL; } al_free(ws); @@ -280,7 +280,7 @@ char *_al_win_copy_utf16_to_utf8(char* us, const wchar_t *ws, size_t uslen) { int rc = WideCharToMultiByte(CP_UTF8, 0, ws, -1, us, uslen, NULL, NULL); if (rc == 0) { - ALLEGRO_ERROR("WideCharToMultiByte failed\n"); + A5O_ERROR("WideCharToMultiByte failed\n"); return NULL; } return us; @@ -290,19 +290,19 @@ char *_al_win_copy_utf8_to_ansi(char* s, const char *us, size_t slen) { int wslen = MultiByteToWideChar(CP_UTF8, 0, us, -1, NULL, 0); if (wslen == 0) { - ALLEGRO_ERROR("MultiByteToWideChar failed\n"); + A5O_ERROR("MultiByteToWideChar failed\n"); return NULL; } wchar_t* ws = al_malloc(wslen * sizeof(wchar_t)); if (!ws) { - ALLEGRO_ERROR("Out of memory\n"); + A5O_ERROR("Out of memory\n"); return NULL; } MultiByteToWideChar(CP_UTF8, 0, us, -1, ws, wslen); int rc = WideCharToMultiByte(CP_ACP, 0, ws, wslen, s, slen, NULL, NULL); al_free(ws); if (rc == 0) { - ALLEGRO_ERROR("WideCharToMultiByte failed\n"); + A5O_ERROR("WideCharToMultiByte failed\n"); return NULL; } return s; @@ -312,19 +312,19 @@ char *_al_win_copy_ansi_to_utf8(char* us, const char *s, size_t uslen) { int wslen = MultiByteToWideChar(CP_ACP, 0, s, -1, NULL, 0); if (wslen == 0) { - ALLEGRO_ERROR("MultiByteToWideChar failed\n"); + A5O_ERROR("MultiByteToWideChar failed\n"); return NULL; } wchar_t* ws = al_malloc(wslen * sizeof(wchar_t)); if (!ws) { - ALLEGRO_ERROR("Out of memory\n"); + A5O_ERROR("Out of memory\n"); return NULL; } MultiByteToWideChar(CP_ACP, 0, s, -1, ws, wslen); int rc = WideCharToMultiByte(CP_UTF8, 0, ws, wslen, us, uslen, NULL, NULL); al_free(ws); if (rc == 0) { - ALLEGRO_ERROR("WideCharToMultiByte failed\n"); + A5O_ERROR("WideCharToMultiByte failed\n"); return NULL; } return us; diff --git a/src/win/wwindow.c b/src/win/wwindow.c index f114c08e75..9adc914641 100644 --- a/src/win/wwindow.c +++ b/src/win/wwindow.c @@ -45,12 +45,12 @@ #include "allegro5/platform/aintwin.h" -ALLEGRO_DEBUG_CHANNEL("wwindow") +A5O_DEBUG_CHANNEL("wwindow") static WNDCLASS window_class; static _AL_VECTOR resizing_displays; -static ALLEGRO_MUTEX *resize_event_thread_mutex; +static A5O_MUTEX *resize_event_thread_mutex; static bool end_resize_event_thread; static bool resize_event_thread_ended; @@ -67,15 +67,15 @@ UINT _al_win_msg_suicide = 0; static void display_flags_to_window_styles(int flags, DWORD *style, DWORD *ex_style) { - if (flags & ALLEGRO_FULLSCREEN) { + if (flags & A5O_FULLSCREEN) { *style = WS_POPUP; *ex_style = WS_EX_APPWINDOW; } - else if (flags & ALLEGRO_MAXIMIZED) { + else if (flags & A5O_MAXIMIZED) { *style = WS_OVERLAPPEDWINDOW; *ex_style = WS_EX_APPWINDOW; } - else if (flags & ALLEGRO_RESIZABLE) { + else if (flags & A5O_RESIZABLE) { *style = WS_OVERLAPPEDWINDOW; *ex_style = WS_EX_APPWINDOW | WS_EX_OVERLAPPEDWINDOW; } @@ -109,24 +109,24 @@ HWND _al_win_create_hidden_window() } static void _al_win_get_window_center( - ALLEGRO_DISPLAY_WIN *win_display, int width, int height, int *out_x, int *out_y) + A5O_DISPLAY_WIN *win_display, int width, int height, int *out_x, int *out_y) { int a = win_display->adapter; bool *is_fullscreen; - ALLEGRO_MONITOR_INFO info; + A5O_MONITOR_INFO info; RECT win_size; - ALLEGRO_SYSTEM *sys = al_get_system_driver(); + A5O_SYSTEM *sys = al_get_system_driver(); unsigned int num; unsigned int i; unsigned int fullscreen_found = 0; num = al_get_num_video_adapters(); is_fullscreen = al_calloc(num, sizeof(bool)); for (i = 0; i < sys->displays._size; i++) { - ALLEGRO_DISPLAY **dptr = _al_vector_ref(&sys->displays, i); - ALLEGRO_DISPLAY *d = *dptr; - if (d->flags & ALLEGRO_FULLSCREEN) { - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *)d; + A5O_DISPLAY **dptr = _al_vector_ref(&sys->displays, i); + A5O_DISPLAY *d = *dptr; + if (d->flags & A5O_FULLSCREEN) { + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *)d; is_fullscreen[win_display->adapter] = true; fullscreen_found++; } @@ -150,7 +150,7 @@ static void _al_win_get_window_center( *out_y = win_size.top; } -HWND _al_win_create_window(ALLEGRO_DISPLAY *display, int width, int height, int flags) +HWND _al_win_create_window(A5O_DISPLAY *display, int width, int height, int flags) { HWND my_window; DWORD style; @@ -158,7 +158,7 @@ HWND _al_win_create_window(ALLEGRO_DISPLAY *display, int width, int height, int DEV_BROADCAST_DEVICEINTERFACE notification_filter; int pos_x, pos_y; bool center = false; - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *)display; + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *)display; WINDOWINFO wi; int lsize, rsize, tsize, bsize; // left, right, top, bottom border sizes TCHAR* window_title; @@ -168,7 +168,7 @@ HWND _al_win_create_window(ALLEGRO_DISPLAY *display, int width, int height, int display_flags_to_window_styles(flags, &style, &ex_style); al_get_new_window_position(&pos_x, &pos_y); - if ((flags & ALLEGRO_FULLSCREEN) || (flags & ALLEGRO_FULLSCREEN_WINDOW)) { + if ((flags & A5O_FULLSCREEN) || (flags & A5O_FULLSCREEN_WINDOW)) { pos_x = pos_y = 0; } else if (pos_x == INT_MAX) { @@ -211,7 +211,7 @@ HWND _al_win_create_window(ALLEGRO_DISPLAY *display, int width, int height, int SWP_NOZORDER | SWP_NOSIZE); - if (flags & ALLEGRO_FRAMELESS) { + if (flags & A5O_FRAMELESS) { SetWindowLong(my_window, GWL_STYLE, WS_VISIBLE); SetWindowLong(my_window, GWL_EXSTYLE, WS_EX_APPWINDOW); SetWindowPos(my_window, 0, pos_x, pos_y, width, height, SWP_NOZORDER | SWP_FRAMECHANGED); @@ -221,7 +221,7 @@ HWND _al_win_create_window(ALLEGRO_DISPLAY *display, int width, int height, int clear_window(my_window, width, height); - if (!(flags & ALLEGRO_RESIZABLE) && !(flags & ALLEGRO_FULLSCREEN)) { + if (!(flags & A5O_RESIZABLE) && !(flags & A5O_FULLSCREEN)) { /* Make the window non-resizable */ HMENU menu; menu = GetSystemMenu(my_window, false); @@ -230,13 +230,13 @@ HWND _al_win_create_window(ALLEGRO_DISPLAY *display, int width, int height, int DrawMenuBar(my_window); } - _al_vector_init(&win_display->msg_callbacks, sizeof(ALLEGRO_DISPLAY_WIN_CALLBACK)); + _al_vector_init(&win_display->msg_callbacks, sizeof(A5O_DISPLAY_WIN_CALLBACK)); return my_window; } -HWND _al_win_create_faux_fullscreen_window(LPCTSTR devname, ALLEGRO_DISPLAY *display, +HWND _al_win_create_faux_fullscreen_window(LPCTSTR devname, A5O_DISPLAY *display, int x1, int y1, int width, int height, int refresh_rate, int flags) { HWND my_window; @@ -246,10 +246,10 @@ HWND _al_win_create_faux_fullscreen_window(LPCTSTR devname, ALLEGRO_DISPLAY *dis LONG temp; TCHAR* window_title; - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *)display; + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *)display; (void)flags; - _al_vector_init(&win_display->msg_callbacks, sizeof(ALLEGRO_DISPLAY_WIN_CALLBACK)); + _al_vector_init(&win_display->msg_callbacks, sizeof(A5O_DISPLAY_WIN_CALLBACK)); style = WS_VISIBLE; ex_style = WS_EX_TOPMOST; @@ -273,7 +273,7 @@ HWND _al_win_create_faux_fullscreen_window(LPCTSTR devname, ALLEGRO_DISPLAY *dis memset(&mode, 0, sizeof(DEVMODE)); mode.dmSize = sizeof(DEVMODE); mode.dmDriverExtra = 0; - mode.dmBitsPerPel = al_get_new_display_option(ALLEGRO_COLOR_SIZE, NULL); + mode.dmBitsPerPel = al_get_new_display_option(A5O_COLOR_SIZE, NULL); mode.dmPelsWidth = width; mode.dmPelsHeight = height; mode.dmDisplayFlags = 0; @@ -296,7 +296,7 @@ HWND _al_win_create_faux_fullscreen_window(LPCTSTR devname, ALLEGRO_DISPLAY *dis * generated the this display's window. The display's window must the the * foreground window. */ -void _al_win_grab_input(ALLEGRO_DISPLAY_WIN *win_disp) +void _al_win_grab_input(A5O_DISPLAY_WIN *win_disp) { _al_win_wnd_schedule_proc(win_disp->window, _al_win_joystick_dinput_grab, @@ -308,10 +308,10 @@ void _al_win_grab_input(ALLEGRO_DISPLAY_WIN *win_disp) * changed size after receiving the resize event. Here we merely add the * event to the queue. */ -static void win_generate_resize_event(ALLEGRO_DISPLAY_WIN *win_display) +static void win_generate_resize_event(A5O_DISPLAY_WIN *win_display) { - ALLEGRO_DISPLAY *display = (ALLEGRO_DISPLAY *)win_display; - ALLEGRO_EVENT_SOURCE *es = &display->es; + A5O_DISPLAY *display = (A5O_DISPLAY *)win_display; + A5O_EVENT_SOURCE *es = &display->es; WINDOWINFO wi; int x, y, w, h; @@ -337,8 +337,8 @@ static void win_generate_resize_event(ALLEGRO_DISPLAY_WIN *win_display) if (display->use_constraints || display->w != w || display->h != h) { _al_event_source_lock(es); if (_al_event_source_needs_to_generate_event(es)) { - ALLEGRO_EVENT event; - event.display.type = ALLEGRO_EVENT_DISPLAY_RESIZE; + A5O_EVENT event; + event.display.type = A5O_EVENT_DISPLAY_RESIZE; event.display.timestamp = al_get_time(); event.display.x = x; event.display.y = y; @@ -349,8 +349,8 @@ static void win_generate_resize_event(ALLEGRO_DISPLAY_WIN *win_display) /* Generate an expose event. */ /* This seems a bit redundant after a resize. */ - if (win_display->display.flags & ALLEGRO_GENERATE_EXPOSE_EVENTS) { - event.display.type = ALLEGRO_EVENT_DISPLAY_EXPOSE; + if (win_display->display.flags & A5O_GENERATE_EXPOSE_EVENTS) { + event.display.type = A5O_EVENT_DISPLAY_EXPOSE; _al_event_source_emit_event(es, &event); } } @@ -362,7 +362,7 @@ static void handle_mouse_capture(bool down, HWND hWnd) { int i; bool any_button_down = false; - ALLEGRO_MOUSE_STATE state; + A5O_MOUSE_STATE state; if (!al_is_mouse_installed()) return; @@ -380,7 +380,7 @@ static void handle_mouse_capture(bool down, HWND hWnd) } } -static void break_window_message_pump(ALLEGRO_DISPLAY_WIN *win_display, HWND hWnd) +static void break_window_message_pump(A5O_DISPLAY_WIN *win_display, HWND hWnd) { /* Get the ID of the thread which created the HWND and is processing its messages */ DWORD wnd_thread_id = GetWindowThreadProcessId(hWnd, NULL); @@ -404,7 +404,7 @@ static bool accept_mouse_event(void) return !((GetMessageExtraInfo() & _AL_MOUSEEVENTF_FROMTOUCH) == _AL_MOUSEEVENTF_FROMTOUCH); } -/* We want to rate-limit the ALLEGRO_EVENT_DISPLAY_RESIZE events while +/* We want to rate-limit the A5O_EVENT_DISPLAY_RESIZE events while * live-resizing via mouse. To this end, we detect start/end of this * via WM_ENTERSIZEMOVE/WM_EXITSIZEMOVE and then enable this code to * periodically send those events. @@ -420,7 +420,7 @@ static void resize_event_thread_proc(void *arg) } for (int j = 0; j < (int)_al_vector_size(&resizing_displays); j++) { - ALLEGRO_DISPLAY_WIN **win_display = (ALLEGRO_DISPLAY_WIN **)_al_vector_ref(&resizing_displays, j); + A5O_DISPLAY_WIN **win_display = (A5O_DISPLAY_WIN **)_al_vector_ref(&resizing_displays, j); win_generate_resize_event(*win_display); } @@ -433,12 +433,12 @@ static void resize_event_thread_proc(void *arg) static LRESULT CALLBACK window_callback(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - ALLEGRO_DISPLAY *d = NULL; - ALLEGRO_DISPLAY_WIN *win_display = NULL; + A5O_DISPLAY *d = NULL; + A5O_DISPLAY_WIN *win_display = NULL; //WINDOWINFO wi; unsigned int i; - ALLEGRO_EVENT_SOURCE *es = NULL; - ALLEGRO_SYSTEM *system = al_get_system_driver(); + A5O_EVENT_SOURCE *es = NULL; + A5O_SYSTEM *system = al_get_system_driver(); //wi.cbSize = sizeof(WINDOWINFO); @@ -452,7 +452,7 @@ static LRESULT CALLBACK window_callback(HWND hWnd, UINT message, } if (message == _al_win_msg_suicide && wParam) { - win_display = (ALLEGRO_DISPLAY_WIN*)wParam; + win_display = (A5O_DISPLAY_WIN*)wParam; break_window_message_pump(win_display, hWnd); if (_al_win_unregister_touch_window) _al_win_unregister_touch_window(hWnd); @@ -464,7 +464,7 @@ static LRESULT CALLBACK window_callback(HWND hWnd, UINT message, } for (i = 0; i < system->displays._size; i++) { - ALLEGRO_DISPLAY **dptr = _al_vector_ref(&system->displays, i); + A5O_DISPLAY **dptr = _al_vector_ref(&system->displays, i); d = *dptr; win_display = (void*)d; if (win_display->window == hWnd) { @@ -489,7 +489,7 @@ static LRESULT CALLBACK window_callback(HWND hWnd, UINT message, for (i = 0; i < _al_vector_size(&win_display->msg_callbacks); ++i) { LRESULT result = TRUE; - ALLEGRO_DISPLAY_WIN_CALLBACK *ptr = _al_vector_ref(&win_display->msg_callbacks, i); + A5O_DISPLAY_WIN_CALLBACK *ptr = _al_vector_ref(&win_display->msg_callbacks, i); if ((ptr->proc)(d, message, wParam, lParam, &result, ptr->userdata)) return result; } @@ -712,7 +712,7 @@ static LRESULT CALLBACK window_callback(HWND hWnd, UINT message, case WM_CAPTURECHANGED: { if (al_is_mouse_installed()) { int i; - ALLEGRO_MOUSE_STATE state; + A5O_MOUSE_STATE state; if (!lParam || (HWND)lParam == hWnd) break; al_get_mouse_state(&state); @@ -776,19 +776,19 @@ static LRESULT CALLBACK window_callback(HWND hWnd, UINT message, } /* This is used by WM_GETMINMAXINFO to set constraints. */ else if ((wParam & 0xfff0) == SC_MAXIMIZE) { - d->flags |= ALLEGRO_MAXIMIZED; + d->flags |= A5O_MAXIMIZED; display_flags_to_window_styles(d->flags, &style, &exstyle); SetWindowLong(hWnd, GWL_EXSTYLE, exstyle); } else if ((wParam & 0xfff0) == SC_RESTORE) { - d->flags &= ~ALLEGRO_MAXIMIZED; + d->flags &= ~A5O_MAXIMIZED; display_flags_to_window_styles(d->flags, &style, &exstyle); SetWindowLong(hWnd, GWL_EXSTYLE, exstyle); } break; } case WM_PAINT: { - if (win_display->display.flags & ALLEGRO_GENERATE_EXPOSE_EVENTS) { + if (win_display->display.flags & A5O_GENERATE_EXPOSE_EVENTS) { RECT r; HRGN hrgn; GetWindowRect(win_display->window, &r); @@ -809,8 +809,8 @@ static LRESULT CALLBACK window_callback(HWND hWnd, UINT message, //GetWindowInfo(win_display->window, &wi); _al_event_source_lock(es); if (_al_event_source_needs_to_generate_event(es)) { - ALLEGRO_EVENT event; - event.display.type = ALLEGRO_EVENT_DISPLAY_EXPOSE; + A5O_EVENT event; + event.display.type = A5O_EVENT_DISPLAY_EXPOSE; event.display.timestamp = al_get_time(); for (i = 0; i < n; i++) { event.display.x = rects[i].left; @@ -863,13 +863,13 @@ static LRESULT CALLBACK window_callback(HWND hWnd, UINT message, break; if (HIWORD(wParam)) - d->flags |= ALLEGRO_MINIMIZED; + d->flags |= A5O_MINIMIZED; else - d->flags &= ~ALLEGRO_MINIMIZED; + d->flags &= ~A5O_MINIMIZED; if (LOWORD(wParam) != WA_INACTIVE) { // Make fullscreen windows TOPMOST again - if (d->flags & ALLEGRO_FULLSCREEN_WINDOW) { + if (d->flags & A5O_FULLSCREEN_WINDOW) { SetWindowPos(win_display->window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } if (d->vt->switch_in) @@ -877,9 +877,9 @@ static LRESULT CALLBACK window_callback(HWND hWnd, UINT message, _al_win_fix_modifiers(); _al_event_source_lock(es); if (_al_event_source_needs_to_generate_event(es)) { - ALLEGRO_EVENT event; + A5O_EVENT event; memset(&event, 0, sizeof(event)); - event.display.type = ALLEGRO_EVENT_DISPLAY_SWITCH_IN; + event.display.type = A5O_EVENT_DISPLAY_SWITCH_IN; event.display.timestamp = al_get_time(); _al_event_source_emit_event(es, &event); } @@ -889,18 +889,18 @@ static LRESULT CALLBACK window_callback(HWND hWnd, UINT message, } else { // Remove TOPMOST flag from fullscreen windows so we can alt-tab. Also must raise the new activated window - if (d->flags & ALLEGRO_FULLSCREEN_WINDOW) { + if (d->flags & A5O_FULLSCREEN_WINDOW) { SetWindowPos(win_display->window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); SetWindowPos(GetForegroundWindow(), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); } - if (d->flags & ALLEGRO_FULLSCREEN) { + if (d->flags & A5O_FULLSCREEN) { d->vt->switch_out(d); } _al_event_source_lock(es); if (_al_event_source_needs_to_generate_event(es)) { - ALLEGRO_EVENT event; + A5O_EVENT event; memset(&event, 0, sizeof(event)); - event.display.type = ALLEGRO_EVENT_DISPLAY_SWITCH_OUT; + event.display.type = A5O_EVENT_DISPLAY_SWITCH_OUT; event.display.timestamp = al_get_time(); _al_event_source_emit_event(es, &event); } @@ -913,9 +913,9 @@ static LRESULT CALLBACK window_callback(HWND hWnd, UINT message, case WM_CLOSE: _al_event_source_lock(es); if (_al_event_source_needs_to_generate_event(es)) { - ALLEGRO_EVENT event; + A5O_EVENT event; memset(&event, 0, sizeof(event)); - event.display.type = ALLEGRO_EVENT_DISPLAY_CLOSE; + event.display.type = A5O_EVENT_DISPLAY_CLOSE; event.display.timestamp = al_get_time(); _al_event_source_emit_event(es, &event); } @@ -949,7 +949,7 @@ static LRESULT CALLBACK window_callback(HWND hWnd, UINT message, wmin.y = (d->min_h > 0) ? d->min_h + total_border_height : p_info->ptMinTrackSize.y; /* don't use max_w & max_h constraints when window maximized */ - if (d->flags & ALLEGRO_MAXIMIZED) { + if (d->flags & A5O_MAXIMIZED) { wmax.x = p_info->ptMaxTrackSize.x; wmax.y = p_info->ptMaxTrackSize.y; } @@ -967,9 +967,9 @@ static LRESULT CALLBACK window_callback(HWND hWnd, UINT message, bool generate = false; if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED || wParam == SIZE_MINIMIZED) { generate = true; - d->flags &= ~ALLEGRO_MAXIMIZED; + d->flags &= ~A5O_MAXIMIZED; if (wParam == SIZE_MAXIMIZED) { - d->flags |= ALLEGRO_MAXIMIZED; + d->flags |= A5O_MAXIMIZED; } } else if (d->use_constraints) { @@ -992,17 +992,17 @@ static LRESULT CALLBACK window_callback(HWND hWnd, UINT message, } case WM_ENTERSIZEMOVE: { al_lock_mutex(resize_event_thread_mutex); - if (d->flags & ALLEGRO_DIRECT3D_INTERNAL) { + if (d->flags & A5O_DIRECT3D_INTERNAL) { win_display->d3d_ignore_resize = true; } - ALLEGRO_DISPLAY_WIN **add = (ALLEGRO_DISPLAY_WIN **)_al_vector_alloc_back(&resizing_displays); + A5O_DISPLAY_WIN **add = (A5O_DISPLAY_WIN **)_al_vector_alloc_back(&resizing_displays); *add = win_display; al_unlock_mutex(resize_event_thread_mutex); break; } case WM_EXITSIZEMOVE: al_lock_mutex(resize_event_thread_mutex); - if (d->flags & ALLEGRO_DIRECT3D_INTERNAL) { + if (d->flags & A5O_DIRECT3D_INTERNAL) { win_display->d3d_ignore_resize = false; } _al_vector_find_and_delete(&resizing_displays, &win_display); @@ -1010,7 +1010,7 @@ static LRESULT CALLBACK window_callback(HWND hWnd, UINT message, win_generate_resize_event(win_display); break; case WM_DPICHANGED: - if ((d->flags & ALLEGRO_RESIZABLE) && !(d->flags & ALLEGRO_FULLSCREEN)) { + if ((d->flags & A5O_RESIZABLE) && !(d->flags & A5O_FULLSCREEN)) { RECT* rect = (RECT*)lParam; // XXX: This doesn't seem to actually move the window... why? SetWindowPos( @@ -1054,7 +1054,7 @@ int _al_win_init_window(void) } resize_event_thread_mutex = al_create_mutex(); - _al_vector_init(&resizing_displays, sizeof(ALLEGRO_DISPLAY_WIN *)); + _al_vector_init(&resizing_displays, sizeof(A5O_DISPLAY_WIN *)); _beginthread(resize_event_thread_proc, 0, 0); return true; @@ -1082,7 +1082,7 @@ void _al_win_shutdown_window(void) static int win_choose_icon_bitmap(const int sys_w, const int sys_h, - const int num_icons, ALLEGRO_BITMAP *bmps[]) + const int num_icons, A5O_BITMAP *bmps[]) { int best_i = 0; int best_score = INT_MAX; @@ -1115,13 +1115,13 @@ static int win_choose_icon_bitmap(const int sys_w, const int sys_h, return best_i; } -static void win_set_display_icon(ALLEGRO_DISPLAY_WIN *win_display, +static void win_set_display_icon(A5O_DISPLAY_WIN *win_display, const WPARAM icon_type, const int sys_w, const int sys_h, - const int num_icons, ALLEGRO_BITMAP *bmps[]) + const int num_icons, A5O_BITMAP *bmps[]) { HICON icon; HICON old_icon; - ALLEGRO_BITMAP *bmp; + A5O_BITMAP *bmp; int bmp_w; int bmp_h; int i; @@ -1135,19 +1135,19 @@ static void win_set_display_icon(ALLEGRO_DISPLAY_WIN *win_display, icon = _al_win_create_icon(win_display->window, bmp, 0, 0, false, false); } else { - ALLEGRO_BITMAP *tmp_bmp; - ALLEGRO_STATE backup; + A5O_BITMAP *tmp_bmp; + A5O_STATE backup; tmp_bmp = al_create_bitmap(sys_w, sys_h); if (!tmp_bmp) return; - al_store_state(&backup, ALLEGRO_STATE_BITMAP | ALLEGRO_STATE_BLENDER); - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); - al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ARGB_8888); + al_store_state(&backup, A5O_STATE_BITMAP | A5O_STATE_BLENDER); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); + al_set_new_bitmap_format(A5O_PIXEL_FORMAT_ARGB_8888); al_set_target_bitmap(tmp_bmp); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_draw_scaled_bitmap(bmp, 0, 0, bmp_w, bmp_h, 0, 0, sys_w, sys_h, 0); al_restore_state(&backup); @@ -1165,10 +1165,10 @@ static void win_set_display_icon(ALLEGRO_DISPLAY_WIN *win_display, DestroyIcon(old_icon); } -void _al_win_set_display_icons(ALLEGRO_DISPLAY *display, - int num_icons, ALLEGRO_BITMAP *bmps[]) +void _al_win_set_display_icons(A5O_DISPLAY *display, + int num_icons, A5O_BITMAP *bmps[]) { - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *)display; + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *)display; int sys_w; int sys_h; @@ -1183,9 +1183,9 @@ void _al_win_set_display_icons(ALLEGRO_DISPLAY *display, num_icons, bmps); } -void _al_win_destroy_display_icons(ALLEGRO_DISPLAY *display) +void _al_win_destroy_display_icons(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *)display; + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *)display; HICON old_icon; old_icon = (HICON)SendMessage(win_display->window, WM_SETICON, ICON_SMALL, 0); @@ -1236,14 +1236,14 @@ void _al_win_get_window_position(HWND window, int *x, int *y) } -static void update_adapter(ALLEGRO_DISPLAY *display) +static void update_adapter(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_WIN *win_display = (void*)display; + A5O_DISPLAY_WIN *win_display = (void*)display; int x, y, adapter, num_adapters; al_get_window_position(display, &x, &y); num_adapters = al_get_num_video_adapters(); for (adapter = 0; adapter < num_adapters; adapter++) { - ALLEGRO_MONITOR_INFO mi; + A5O_MONITOR_INFO mi; al_get_monitor_info(adapter, &mi); if (x >= mi.x1 && x < mi.x2 && y >= mi.y1 && y < mi.y2) { win_display->adapter = adapter; @@ -1253,7 +1253,7 @@ static void update_adapter(ALLEGRO_DISPLAY *display) } -void _al_win_set_window_frameless(ALLEGRO_DISPLAY *display, HWND hWnd, +void _al_win_set_window_frameless(A5O_DISPLAY *display, HWND hWnd, bool frameless) { int w = display->w; @@ -1285,34 +1285,34 @@ void _al_win_set_window_frameless(ALLEGRO_DISPLAY *display, HWND hWnd, } -bool _al_win_set_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff) +bool _al_win_set_display_flag(A5O_DISPLAY *display, int flag, bool onoff) { - ALLEGRO_DISPLAY_WIN *win_display = (void*)display; + A5O_DISPLAY_WIN *win_display = (void*)display; //double timeout; - ALLEGRO_MONITOR_INFO mi; + A5O_MONITOR_INFO mi; memset(&mi, 0, sizeof(mi)); switch (flag) { - case ALLEGRO_FRAMELESS: { + case A5O_FRAMELESS: { if (onoff) { - display->flags |= ALLEGRO_FRAMELESS; + display->flags |= A5O_FRAMELESS; } else { - display->flags &= ~ALLEGRO_FRAMELESS; + display->flags &= ~A5O_FRAMELESS; } _al_win_set_window_frameless(display, win_display->window, - (display->flags & ALLEGRO_FRAMELESS)); + (display->flags & A5O_FRAMELESS)); return true; } - case ALLEGRO_FULLSCREEN_WINDOW: - if ((display->flags & ALLEGRO_FULLSCREEN_WINDOW) && onoff) { - ALLEGRO_DEBUG("Already a fullscreen window\n"); + case A5O_FULLSCREEN_WINDOW: + if ((display->flags & A5O_FULLSCREEN_WINDOW) && onoff) { + A5O_DEBUG("Already a fullscreen window\n"); return true; } - if (!(display->flags & ALLEGRO_FULLSCREEN_WINDOW) && !onoff) { - ALLEGRO_DEBUG("Already a non-fullscreen window\n"); + if (!(display->flags & A5O_FULLSCREEN_WINDOW) && !onoff) { + A5O_DEBUG("Already a non-fullscreen window\n"); return true; } @@ -1323,24 +1323,24 @@ bool _al_win_set_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff) else { /* Respect display flag in windowed mode. */ _al_win_set_window_frameless(display, win_display->window, - (display->flags & ALLEGRO_FRAMELESS)); + (display->flags & A5O_FRAMELESS)); } if (onoff) { update_adapter(display); int adapter = win_display->adapter; al_get_monitor_info(adapter, &mi); - display->flags |= ALLEGRO_FULLSCREEN_WINDOW; + display->flags |= A5O_FULLSCREEN_WINDOW; display->w = mi.x2 - mi.x1; display->h = mi.y2 - mi.y1; } else { - display->flags &= ~ALLEGRO_FULLSCREEN_WINDOW; + display->flags &= ~A5O_FULLSCREEN_WINDOW; display->w = win_display->toggle_w; display->h = win_display->toggle_h; } - ASSERT(!!(display->flags & ALLEGRO_FULLSCREEN_WINDOW) == onoff); + ASSERT(!!(display->flags & A5O_FULLSCREEN_WINDOW) == onoff); // Hide the window temporarily SetWindowPos(win_display->window, 0, 0, 0, 0, 0, SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE); @@ -1379,10 +1379,10 @@ bool _al_win_set_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff) // Clear the window to black clear_window(win_display->window, display->w, display->h); - ASSERT(!!(display->flags & ALLEGRO_FULLSCREEN_WINDOW) == onoff); + ASSERT(!!(display->flags & A5O_FULLSCREEN_WINDOW) == onoff); return true; - case ALLEGRO_MAXIMIZED: - if ((!!(display->flags & ALLEGRO_MAXIMIZED)) == onoff) + case A5O_MAXIMIZED: + if ((!!(display->flags & A5O_MAXIMIZED)) == onoff) return true; if (onoff) { ShowWindow(win_display->window, SW_SHOWMAXIMIZED); @@ -1396,15 +1396,15 @@ bool _al_win_set_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff) } -void _al_win_set_window_title(ALLEGRO_DISPLAY *display, const char *title) +void _al_win_set_window_title(A5O_DISPLAY *display, const char *title) { - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *)display; + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *)display; TCHAR *ttitle = _twin_utf8_to_tchar(title); SetWindowText(win_display->window, ttitle); al_free(ttitle); } -bool _al_win_set_window_constraints(ALLEGRO_DISPLAY *display, +bool _al_win_set_window_constraints(A5O_DISPLAY *display, int min_w, int min_h, int max_w, int max_h) { display->min_w = min_w; @@ -1415,31 +1415,31 @@ bool _al_win_set_window_constraints(ALLEGRO_DISPLAY *display, return true; } -void _al_win_apply_window_constraints(ALLEGRO_DISPLAY *display, bool onoff) +void _al_win_apply_window_constraints(A5O_DISPLAY *display, bool onoff) { if (onoff) { - if (!(display->flags & ALLEGRO_MAXIMIZED)) { + if (!(display->flags & A5O_MAXIMIZED)) { al_resize_display(display, display->w, display->h); } } } -void _al_win_post_create_window(ALLEGRO_DISPLAY *display) +void _al_win_post_create_window(A5O_DISPLAY *display) { /* Ideally the d3d/wgl window creation would already create the * window maximized - but that code looks too messy to me to touch * right now. */ - if (display->flags & ALLEGRO_MAXIMIZED) { - display->flags &= ~ALLEGRO_MAXIMIZED; - al_set_display_flag(display, ALLEGRO_MAXIMIZED, true); + if (display->flags & A5O_MAXIMIZED) { + display->flags &= ~A5O_MAXIMIZED; + al_set_display_flag(display, A5O_MAXIMIZED, true); } } -bool _al_win_get_window_constraints(ALLEGRO_DISPLAY *display, +bool _al_win_get_window_constraints(A5O_DISPLAY *display, int *min_w, int *min_h, int *max_w, int *max_h) { - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *)display; + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *)display; *min_w = win_display->display.min_w; *min_h = win_display->display.min_h; *max_w = win_display->display.max_w; @@ -1468,18 +1468,18 @@ void _al_win_wnd_schedule_proc(HWND wnd, void (*proc) (void*), void* param) { ASSERT(_al_win_msg_call_proc); if (!PostMessage(wnd, _al_win_msg_call_proc, (WPARAM)proc, (LPARAM)param)) { - ALLEGRO_ERROR("_al_win_wnd_schedule_proc failed.\n"); + A5O_ERROR("_al_win_wnd_schedule_proc failed.\n"); } } /* Function: al_get_win_window_handle */ -HWND al_get_win_window_handle(ALLEGRO_DISPLAY *display) +HWND al_get_win_window_handle(A5O_DISPLAY *display) { if (!display) return NULL; - return ((ALLEGRO_DISPLAY_WIN *)display)->window; + return ((A5O_DISPLAY_WIN *)display)->window; } @@ -1489,7 +1489,7 @@ int _al_win_determine_adapter(void) if (a == -1) { int num_screens = al_get_num_video_adapters(); int cScreen = 0; - ALLEGRO_MONITOR_INFO temp_info; + A5O_MONITOR_INFO temp_info; for (cScreen = 0; cScreen < num_screens; cScreen++) { al_get_monitor_info(cScreen, &temp_info); if (temp_info.x1 == 0 && temp_info.y1 == 0) { // ..probably found primary display @@ -1501,9 +1501,9 @@ int _al_win_determine_adapter(void) return a; } -bool _al_win_get_window_borders(ALLEGRO_DISPLAY *display, int *left, int *top, int *right, int *bottom) +bool _al_win_get_window_borders(A5O_DISPLAY *display, int *left, int *top, int *right, int *bottom) { - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *)display; + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *)display; WINDOWINFO wi; wi.cbSize = sizeof(WINDOWINFO); GetWindowInfo(win_display->window, &wi); @@ -1517,12 +1517,12 @@ bool _al_win_get_window_borders(ALLEGRO_DISPLAY *display, int *left, int *top, i /* Function: al_win_add_window_callback */ -bool al_win_add_window_callback(ALLEGRO_DISPLAY *display, - bool (*callback)(ALLEGRO_DISPLAY *display, UINT message, WPARAM wparam, +bool al_win_add_window_callback(A5O_DISPLAY *display, + bool (*callback)(A5O_DISPLAY *display, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result, void *userdata), void *userdata) { - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *) display; - ALLEGRO_DISPLAY_WIN_CALLBACK *ptr; + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *) display; + A5O_DISPLAY_WIN_CALLBACK *ptr; if (!display || !callback) { return false; @@ -1530,7 +1530,7 @@ bool al_win_add_window_callback(ALLEGRO_DISPLAY *display, else { size_t i; for (i = 0; i < _al_vector_size(&win_display->msg_callbacks); ++i) { - ALLEGRO_DISPLAY_WIN_CALLBACK *ptr = _al_vector_ref(&win_display->msg_callbacks, i); + A5O_DISPLAY_WIN_CALLBACK *ptr = _al_vector_ref(&win_display->msg_callbacks, i); if (ptr->proc == callback && ptr->userdata == userdata) return false; } @@ -1546,16 +1546,16 @@ bool al_win_add_window_callback(ALLEGRO_DISPLAY *display, /* Function: al_win_remove_window_callback */ -bool al_win_remove_window_callback(ALLEGRO_DISPLAY *display, - bool (*callback)(ALLEGRO_DISPLAY *display, UINT message, WPARAM wparam, +bool al_win_remove_window_callback(A5O_DISPLAY *display, + bool (*callback)(A5O_DISPLAY *display, UINT message, WPARAM wparam, LPARAM lparam, LRESULT *result, void *userdata), void *userdata) { - ALLEGRO_DISPLAY_WIN *win_display = (ALLEGRO_DISPLAY_WIN *) display; + A5O_DISPLAY_WIN *win_display = (A5O_DISPLAY_WIN *) display; if (display && callback) { size_t i; for (i = 0; i < _al_vector_size(&win_display->msg_callbacks); ++i) { - ALLEGRO_DISPLAY_WIN_CALLBACK *ptr = _al_vector_ref(&win_display->msg_callbacks, i); + A5O_DISPLAY_WIN_CALLBACK *ptr = _al_vector_ref(&win_display->msg_callbacks, i); if (ptr->proc == callback && ptr->userdata == userdata) { _al_vector_delete_at(&win_display->msg_callbacks, i); return true; diff --git a/src/win/wxthread.c b/src/win/wxthread.c index 6c6b40d3c6..a49bc7d053 100644 --- a/src/win/wxthread.c +++ b/src/win/wxthread.c @@ -344,9 +344,9 @@ void _al_cond_wait(_AL_COND *cond, _AL_MUTEX *mtxExternal) int _al_cond_timedwait(_AL_COND *cond, _AL_MUTEX *mtxExternal, - const ALLEGRO_TIMEOUT *timeout) + const A5O_TIMEOUT *timeout) { - ALLEGRO_TIMEOUT_WIN *win_timeout = (ALLEGRO_TIMEOUT_WIN *) timeout; + A5O_TIMEOUT_WIN *win_timeout = (A5O_TIMEOUT_WIN *) timeout; DWORD now; DWORD rel_msecs; diff --git a/src/x/xclipboard.c b/src/x/xclipboard.c index 5273846f26..2d0bd91f25 100644 --- a/src/x/xclipboard.c +++ b/src/x/xclipboard.c @@ -26,25 +26,25 @@ #include "allegro5/internal/aintern_xdisplay.h" #include "allegro5/internal/aintern_xsystem.h" -#ifdef ALLEGRO_RASPBERRYPI +#ifdef A5O_RASPBERRYPI #include "allegro5/internal/aintern_raspberrypi.h" -#define ALLEGRO_SYSTEM_XGLX ALLEGRO_SYSTEM_RASPBERRYPI -#define ALLEGRO_DISPLAY_XGLX ALLEGRO_DISPLAY_RASPBERRYPI +#define A5O_SYSTEM_XGLX A5O_SYSTEM_RASPBERRYPI +#define A5O_DISPLAY_XGLX A5O_DISPLAY_RASPBERRYPI #endif -ALLEGRO_DEBUG_CHANNEL("clipboard") +A5O_DEBUG_CHANNEL("clipboard") -void _al_xwin_display_selection_notify(ALLEGRO_DISPLAY *display, XSelectionEvent *xselection) +void _al_xwin_display_selection_notify(A5O_DISPLAY *display, XSelectionEvent *xselection) { (void) display; (void) xselection; } -void _al_xwin_display_selection_request(ALLEGRO_DISPLAY *display, XSelectionRequestEvent *xselectionrequest) +void _al_xwin_display_selection_request(A5O_DISPLAY *display, XSelectionRequestEvent *xselectionrequest) { (void) display; - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); Display *xdisplay = system->x11display; @@ -57,7 +57,7 @@ void _al_xwin_display_selection_request(ALLEGRO_DISPLAY *display, XSelectionRequ req = xselectionrequest; - ALLEGRO_DEBUG("window %p: SelectionRequest (requestor = %ld, target = %ld)\n", xdisplay, + A5O_DEBUG("window %p: SelectionRequest (requestor = %ld, target = %ld)\n", xdisplay, req->requestor, req->target); memset(&sevent, 0, sizeof(sevent)); @@ -94,13 +94,13 @@ void _al_xwin_display_selection_request(ALLEGRO_DISPLAY *display, XSelectionRequ /* Waits for a selection (copy/paste or DND event) */ -static bool _al_display_xglx_await_selection_event(ALLEGRO_DISPLAY *d) +static bool _al_display_xglx_await_selection_event(A5O_DISPLAY *d) { - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)d; - ALLEGRO_TIMEOUT timeout; + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)d; + A5O_TIMEOUT timeout; - ALLEGRO_DEBUG("Awaiting selection event\n"); + A5O_DEBUG("Awaiting selection event\n"); XSync(system->x11display, False); @@ -109,7 +109,7 @@ static bool _al_display_xglx_await_selection_event(ALLEGRO_DISPLAY *d) */ al_init_timeout(&timeout, 1.0); if (_al_cond_timedwait(&glx->selectioned, &system->lock, &timeout) == -1) { - ALLEGRO_ERROR("Timeout while waiting for selection event.\n"); + A5O_ERROR("Timeout while waiting for selection event.\n"); return false; } @@ -117,11 +117,11 @@ static bool _al_display_xglx_await_selection_event(ALLEGRO_DISPLAY *d) } -static bool xdpy_set_clipboard_text(ALLEGRO_DISPLAY *display, const char *text) +static bool xdpy_set_clipboard_text(A5O_DISPLAY *display, const char *text) { - ALLEGRO_DISPLAY_XGLX *glx = (void *)display; - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (void *)display; + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); Display *xdisplay = system->x11display; Window xwindow = glx->window; @@ -130,7 +130,7 @@ static bool xdpy_set_clipboard_text(ALLEGRO_DISPLAY *display, const char *text) /* Get the window that will own the selection */ if (xwindow == None) { - ALLEGRO_DEBUG("Couldn't find a window to own the selection"); + A5O_DEBUG("Couldn't find a window to own the selection"); return false; } @@ -154,10 +154,10 @@ static bool xdpy_set_clipboard_text(ALLEGRO_DISPLAY *display, const char *text) } -static char *xdpy_get_clipboard_text(ALLEGRO_DISPLAY *display) +static char *xdpy_get_clipboard_text(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_XGLX *glx = (void *)display; - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (void *)display; + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); Display *xdisplay = system->x11display; Window xwindow = glx->window; @@ -173,7 +173,7 @@ static char *xdpy_get_clipboard_text(ALLEGRO_DISPLAY *display) Atom XA_CLIPBOARD = XInternAtom(xdisplay, "CLIPBOARD", 0); if (XA_CLIPBOARD == None) { - ALLEGRO_DEBUG("Couldn't access X clipboard"); + A5O_DEBUG("Couldn't access X clipboard"); return NULL; } @@ -186,7 +186,7 @@ static char *xdpy_get_clipboard_text(ALLEGRO_DISPLAY *display) } else { /* Request that the selection owner copy the data to our window. */ owner = xwindow; - selection = XInternAtom(xdisplay, "ALLEGRO_SELECTION", False); + selection = XInternAtom(xdisplay, "A5O_SELECTION", False); XConvertSelection(xdisplay, XA_CLIPBOARD, format, selection, owner, CurrentTime); @@ -210,7 +210,7 @@ static char *xdpy_get_clipboard_text(ALLEGRO_DISPLAY *display) return text; } -static bool xdpy_has_clipboard_text(ALLEGRO_DISPLAY *display) +static bool xdpy_has_clipboard_text(A5O_DISPLAY *display) { char *text = xdpy_get_clipboard_text(display); @@ -224,7 +224,7 @@ static bool xdpy_has_clipboard_text(ALLEGRO_DISPLAY *display) -void _al_xwin_add_clipboard_functions(ALLEGRO_DISPLAY_INTERFACE *vt) +void _al_xwin_add_clipboard_functions(A5O_DISPLAY_INTERFACE *vt) { vt->set_clipboard_text = xdpy_set_clipboard_text; vt->get_clipboard_text = xdpy_get_clipboard_text; diff --git a/src/x/xcursor.c b/src/x/xcursor.c index 0932a137ac..2b4cf32b84 100644 --- a/src/x/xcursor.c +++ b/src/x/xcursor.c @@ -6,15 +6,15 @@ #include "allegro5/internal/aintern_xdisplay.h" #include "allegro5/internal/aintern_xsystem.h" -#ifdef ALLEGRO_RASPBERRYPI +#ifdef A5O_RASPBERRYPI #include "allegro5/internal/aintern_raspberrypi.h" -#define ALLEGRO_SYSTEM_XGLX ALLEGRO_SYSTEM_RASPBERRYPI -#define ALLEGRO_DISPLAY_XGLX ALLEGRO_DISPLAY_RASPBERRYPI +#define A5O_SYSTEM_XGLX A5O_SYSTEM_RASPBERRYPI +#define A5O_DISPLAY_XGLX A5O_DISPLAY_RASPBERRYPI #endif #include -#ifdef ALLEGRO_XWINDOWS_WITH_XCURSOR +#ifdef A5O_XWINDOWS_WITH_XCURSOR #include #else /* This requirement could be lifted for compatibility with older systems at the @@ -23,15 +23,15 @@ #error This file requires Xcursor. #endif -ALLEGRO_MOUSE_CURSOR *_al_xwin_create_mouse_cursor(ALLEGRO_BITMAP *bmp, +A5O_MOUSE_CURSOR *_al_xwin_create_mouse_cursor(A5O_BITMAP *bmp, int x_focus, int y_focus) { - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); Display *xdisplay = system->x11display; int bmp_w; int bmp_h; - ALLEGRO_MOUSE_CURSOR_XWIN *xcursor; + A5O_MOUSE_CURSOR_XWIN *xcursor; XcursorImage *image; int c, ix, iy; bool was_locked; @@ -52,13 +52,13 @@ ALLEGRO_MOUSE_CURSOR *_al_xwin_create_mouse_cursor(ALLEGRO_BITMAP *bmp, was_locked = al_is_bitmap_locked(bmp); if (!was_locked) { - al_lock_bitmap(bmp, ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_READONLY); + al_lock_bitmap(bmp, A5O_PIXEL_FORMAT_ANY, A5O_LOCK_READONLY); } c = 0; for (iy = 0; iy < bmp_h; iy++) { for (ix = 0; ix < bmp_w; ix++) { - ALLEGRO_COLOR col; + A5O_COLOR col; unsigned char r, g, b, a; col = al_get_pixel(bmp, ix, iy); @@ -80,23 +80,23 @@ ALLEGRO_MOUSE_CURSOR *_al_xwin_create_mouse_cursor(ALLEGRO_BITMAP *bmp, XcursorImageDestroy(image); - return (ALLEGRO_MOUSE_CURSOR *)xcursor; + return (A5O_MOUSE_CURSOR *)xcursor; } -void _al_xwin_destroy_mouse_cursor(ALLEGRO_MOUSE_CURSOR *cursor) +void _al_xwin_destroy_mouse_cursor(A5O_MOUSE_CURSOR *cursor) { - ALLEGRO_MOUSE_CURSOR_XWIN *xcursor = (ALLEGRO_MOUSE_CURSOR_XWIN *)cursor; - ALLEGRO_SYSTEM *sys = al_get_system_driver(); - ALLEGRO_SYSTEM_XGLX *sysx = (ALLEGRO_SYSTEM_XGLX *)sys; + A5O_MOUSE_CURSOR_XWIN *xcursor = (A5O_MOUSE_CURSOR_XWIN *)cursor; + A5O_SYSTEM *sys = al_get_system_driver(); + A5O_SYSTEM_XGLX *sysx = (A5O_SYSTEM_XGLX *)sys; unsigned i; _al_mutex_lock(&sysx->lock); for (i = 0; i < _al_vector_size(&sys->displays); i++) { - ALLEGRO_DISPLAY_XGLX **slot = _al_vector_ref(&sys->displays, i); - ALLEGRO_DISPLAY_XGLX *glx = *slot; + A5O_DISPLAY_XGLX **slot = _al_vector_ref(&sys->displays, i); + A5O_DISPLAY_XGLX *glx = *slot; if (glx->current_cursor == xcursor->cursor) { if (!glx->cursor_hidden) @@ -113,12 +113,12 @@ void _al_xwin_destroy_mouse_cursor(ALLEGRO_MOUSE_CURSOR *cursor) -static bool xdpy_set_mouse_cursor(ALLEGRO_DISPLAY *display, - ALLEGRO_MOUSE_CURSOR *cursor) +static bool xdpy_set_mouse_cursor(A5O_DISPLAY *display, + A5O_MOUSE_CURSOR *cursor) { - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; - ALLEGRO_MOUSE_CURSOR_XWIN *xcursor = (ALLEGRO_MOUSE_CURSOR_XWIN *)cursor; - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; + A5O_MOUSE_CURSOR_XWIN *xcursor = (A5O_MOUSE_CURSOR_XWIN *)cursor; + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); Display *xdisplay = system->x11display; Window xwindow = glx->window; @@ -135,67 +135,67 @@ static bool xdpy_set_mouse_cursor(ALLEGRO_DISPLAY *display, -static bool xdpy_set_system_mouse_cursor(ALLEGRO_DISPLAY *display, - ALLEGRO_SYSTEM_MOUSE_CURSOR cursor_id) +static bool xdpy_set_system_mouse_cursor(A5O_DISPLAY *display, + A5O_SYSTEM_MOUSE_CURSOR cursor_id) { - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); Display *xdisplay = system->x11display; Window xwindow = glx->window; unsigned int cursor_shape; switch (cursor_id) { - case ALLEGRO_SYSTEM_MOUSE_CURSOR_DEFAULT: - case ALLEGRO_SYSTEM_MOUSE_CURSOR_ARROW: - case ALLEGRO_SYSTEM_MOUSE_CURSOR_PROGRESS: + case A5O_SYSTEM_MOUSE_CURSOR_DEFAULT: + case A5O_SYSTEM_MOUSE_CURSOR_ARROW: + case A5O_SYSTEM_MOUSE_CURSOR_PROGRESS: cursor_shape = XC_left_ptr; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_BUSY: + case A5O_SYSTEM_MOUSE_CURSOR_BUSY: cursor_shape = XC_watch; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_QUESTION: + case A5O_SYSTEM_MOUSE_CURSOR_QUESTION: cursor_shape = XC_question_arrow; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_EDIT: + case A5O_SYSTEM_MOUSE_CURSOR_EDIT: cursor_shape = XC_xterm; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_MOVE: + case A5O_SYSTEM_MOUSE_CURSOR_MOVE: cursor_shape = XC_fleur; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_N: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_N: cursor_shape = XC_top_side; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_S: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_S: cursor_shape = XC_bottom_side; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_E: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_E: cursor_shape = XC_right_side; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_W: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_W: cursor_shape = XC_left_side; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NE: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_NE: cursor_shape = XC_top_right_corner; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_SW: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_SW: cursor_shape = XC_bottom_left_corner; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_NW: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_NW: cursor_shape = XC_top_left_corner; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_RESIZE_SE: + case A5O_SYSTEM_MOUSE_CURSOR_RESIZE_SE: cursor_shape = XC_bottom_right_corner; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_PRECISION: + case A5O_SYSTEM_MOUSE_CURSOR_PRECISION: cursor_shape = XC_crosshair; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_LINK: + case A5O_SYSTEM_MOUSE_CURSOR_LINK: cursor_shape = XC_hand2; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_ALT_SELECT: + case A5O_SYSTEM_MOUSE_CURSOR_ALT_SELECT: cursor_shape = XC_hand1; break; - case ALLEGRO_SYSTEM_MOUSE_CURSOR_UNAVAILABLE: + case A5O_SYSTEM_MOUSE_CURSOR_UNAVAILABLE: cursor_shape = XC_X_cursor; break; default: @@ -219,10 +219,10 @@ static bool xdpy_set_system_mouse_cursor(ALLEGRO_DISPLAY *display, /* Show the system mouse cursor. */ -static bool xdpy_show_mouse_cursor(ALLEGRO_DISPLAY *display) +static bool xdpy_show_mouse_cursor(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_XGLX *glx = (void *)display; - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (void *)display; + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); Display *xdisplay = system->x11display; Window xwindow = glx->window; @@ -239,10 +239,10 @@ static bool xdpy_show_mouse_cursor(ALLEGRO_DISPLAY *display) /* Hide the system mouse cursor. */ -static bool xdpy_hide_mouse_cursor(ALLEGRO_DISPLAY *display) +static bool xdpy_hide_mouse_cursor(A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_XGLX *glx = (void *)display; - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (void *)display; + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); Display *xdisplay = system->x11display; Window xwindow = glx->window; @@ -285,7 +285,7 @@ static bool xdpy_hide_mouse_cursor(ALLEGRO_DISPLAY *display) -void _al_xwin_add_cursor_functions(ALLEGRO_DISPLAY_INTERFACE *vt) +void _al_xwin_add_cursor_functions(A5O_DISPLAY_INTERFACE *vt) { vt->set_mouse_cursor = xdpy_set_mouse_cursor; vt->set_system_mouse_cursor = xdpy_set_system_mouse_cursor; diff --git a/src/x/xdisplay.c b/src/x/xdisplay.c index 081218c91a..a2997bb585 100644 --- a/src/x/xdisplay.c +++ b/src/x/xdisplay.c @@ -15,41 +15,41 @@ #include "allegro5/platform/aintxglx.h" #include -#ifdef ALLEGRO_XWINDOWS_WITH_XINPUT2 +#ifdef A5O_XWINDOWS_WITH_XINPUT2 #include #endif #include "xicon.h" #include "icon.inc" -ALLEGRO_DEBUG_CHANNEL("display") +A5O_DEBUG_CHANNEL("display") -static ALLEGRO_DISPLAY_INTERFACE xdpy_vt; -static const ALLEGRO_XWIN_DISPLAY_OVERRIDABLE_INTERFACE default_overridable_vt; -static const ALLEGRO_XWIN_DISPLAY_OVERRIDABLE_INTERFACE *gtk_override_vt = NULL; +static A5O_DISPLAY_INTERFACE xdpy_vt; +static const A5O_XWIN_DISPLAY_OVERRIDABLE_INTERFACE default_overridable_vt; +static const A5O_XWIN_DISPLAY_OVERRIDABLE_INTERFACE *gtk_override_vt = NULL; -static void xdpy_destroy_display(ALLEGRO_DISPLAY *d); -static bool xdpy_acknowledge_resize(ALLEGRO_DISPLAY *d); +static void xdpy_destroy_display(A5O_DISPLAY *d); +static bool xdpy_acknowledge_resize(A5O_DISPLAY *d); /* XXX where does this belong? */ -static void _al_xglx_use_adapter(ALLEGRO_SYSTEM_XGLX *s, int adapter) +static void _al_xglx_use_adapter(A5O_SYSTEM_XGLX *s, int adapter) { - ALLEGRO_DEBUG("use adapter %i\n", adapter); + A5O_DEBUG("use adapter %i\n", adapter); s->adapter_use_count++; s->adapter_map[adapter]++; } -static void _al_xglx_unuse_adapter(ALLEGRO_SYSTEM_XGLX *s, int adapter) +static void _al_xglx_unuse_adapter(A5O_SYSTEM_XGLX *s, int adapter) { - ALLEGRO_DEBUG("unuse adapter %i\n", adapter); + A5O_DEBUG("unuse adapter %i\n", adapter); s->adapter_use_count--; s->adapter_map[adapter]--; } -static bool check_adapter_use_count(ALLEGRO_SYSTEM_XGLX *system) +static bool check_adapter_use_count(A5O_SYSTEM_XGLX *system) { /* If we're in multi-head X mode, bail out if we try to use more than one * display as there are bugs in X/glX that cause us to hang in X if we try @@ -57,9 +57,9 @@ static bool check_adapter_use_count(ALLEGRO_SYSTEM_XGLX *system) * If we're in real xinerama mode, also bail out, X makes mouse use evil. */ bool true_xinerama_active = false; -#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA +#ifdef A5O_XWINDOWS_WITH_XINERAMA bool xrandr_active = false; -#ifdef ALLEGRO_XWINDOWS_WITH_XRANDR +#ifdef A5O_XWINDOWS_WITH_XRANDR xrandr_active = system->xrandr_available; #endif true_xinerama_active = !xrandr_active && system->xinerama_available; @@ -77,7 +77,7 @@ static bool check_adapter_use_count(ALLEGRO_SYSTEM_XGLX *system) } if (adapter_use_count > 1) { - ALLEGRO_ERROR("Use of more than one adapter at once in " + A5O_ERROR("Use of more than one adapter at once in " "multi-head X or X with true Xinerama active is not possible.\n"); return false; } @@ -87,19 +87,19 @@ static bool check_adapter_use_count(ALLEGRO_SYSTEM_XGLX *system) } -static int query_glx_version(ALLEGRO_SYSTEM_XGLX *system) +static int query_glx_version(A5O_SYSTEM_XGLX *system) { int major, minor; int version; glXQueryVersion(system->x11display, &major, &minor); version = major * 100 + minor * 10; - ALLEGRO_INFO("GLX %.1f.\n", version / 100.f); + A5O_INFO("GLX %.1f.\n", version / 100.f); return version; } -static int xdpy_swap_control(ALLEGRO_DISPLAY *display, int vsync_setting) +static int xdpy_swap_control(A5O_DISPLAY *display, int vsync_setting) { /* We set the swap interval to 0 if vsync is forced off, and to 1 * if it is forced on. @@ -108,17 +108,17 @@ static int xdpy_swap_control(ALLEGRO_DISPLAY *display, int vsync_setting) * above extension specifies vsync on as default though, so in the * end with GLX we can't force vsync on, just off. */ - ALLEGRO_DEBUG("requested vsync=%d.\n", vsync_setting); + A5O_DEBUG("requested vsync=%d.\n", vsync_setting); if (vsync_setting) { - if (display->ogl_extras->extension_list->ALLEGRO_GLX_SGI_swap_control) { + if (display->ogl_extras->extension_list->A5O_GLX_SGI_swap_control) { int x = (vsync_setting == 2) ? 0 : 1; if (glXSwapIntervalSGI(x)) { - ALLEGRO_WARN("glXSwapIntervalSGI(%d) failed.\n", x); + A5O_WARN("glXSwapIntervalSGI(%d) failed.\n", x); } } else { - ALLEGRO_WARN("no vsync, GLX_SGI_swap_control missing.\n"); + A5O_WARN("no vsync, GLX_SGI_swap_control missing.\n"); /* According to the specification that means it's on, but * the driver might have disabled it. So we do not know. */ @@ -139,13 +139,13 @@ static bool should_bypass_compositor(int flags) return false; } // default to "fullscreen_only" - return (flags & ALLEGRO_FULLSCREEN) || (flags & ALLEGRO_FULLSCREEN_WINDOW); + return (flags & A5O_FULLSCREEN) || (flags & A5O_FULLSCREEN_WINDOW); } -static void set_compositor_bypass_flag(ALLEGRO_DISPLAY *display) +static void set_compositor_bypass_flag(A5O_DISPLAY *display) { - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; const long _NET_WM_BYPASS_COMPOSITOR_HINT_ON = should_bypass_compositor(display->flags); Atom _NET_WM_BYPASS_COMPOSITOR; @@ -158,10 +158,10 @@ static void set_compositor_bypass_flag(ALLEGRO_DISPLAY *display) } -static bool xdpy_create_display_window(ALLEGRO_SYSTEM_XGLX *system, - ALLEGRO_DISPLAY_XGLX *d, int w, int h, int adapter) +static bool xdpy_create_display_window(A5O_SYSTEM_XGLX *system, + A5O_DISPLAY_XGLX *d, int w, int h, int adapter) { - ALLEGRO_DISPLAY *display = (ALLEGRO_DISPLAY *)d; + A5O_DISPLAY *display = (A5O_DISPLAY *)d; /* Create a colormap. */ Colormap cmap = XCreateColormap(system->x11display, @@ -186,7 +186,7 @@ static bool xdpy_create_display_window(ALLEGRO_SYSTEM_XGLX *system, PointerMotionMask; /* We handle these events via GTK-sent XEmbed events. */ - if (!(display->flags & ALLEGRO_GTK_TOPLEVEL_INTERNAL)) { + if (!(display->flags & A5O_GTK_TOPLEVEL_INTERNAL)) { swa.event_mask |= FocusChangeMask; } @@ -195,14 +195,14 @@ static bool xdpy_create_display_window(ALLEGRO_SYSTEM_XGLX *system, * enough. However in some cases like resizing, the black background * causes horrible flicker. */ - if (!(display->flags & ALLEGRO_RESIZABLE)) { + if (!(display->flags & A5O_RESIZABLE)) { mask |= CWBackPixel; swa.background_pixel = BlackPixel(system->x11display, d->xvinfo->screen); } int x_off = INT_MAX; int y_off = INT_MAX; - if (display->flags & ALLEGRO_FULLSCREEN) { + if (display->flags & A5O_FULLSCREEN) { _al_xglx_get_display_offset(system, d->adapter, &x_off, &y_off); } else { @@ -214,7 +214,7 @@ static bool xdpy_create_display_window(ALLEGRO_SYSTEM_XGLX *system, al_get_new_window_position(&x_off, &y_off); if (x_off != INT_MAX && y_off != INT_MAX) { d->need_initial_position_adjust = true; - ALLEGRO_DEBUG("Will adjust window position later to %d/%d\n", x_off, y_off); + A5O_DEBUG("Will adjust window position later to %d/%d\n", x_off, y_off); } if (adapter >= 0) { @@ -236,10 +236,10 @@ static bool xdpy_create_display_window(ALLEGRO_SYSTEM_XGLX *system, w, h, 0, d->xvinfo->depth, InputOutput, d->xvinfo->visual, mask, &swa); - ALLEGRO_DEBUG("Window ID: %ld\n", (long)d->window); + A5O_DEBUG("Window ID: %ld\n", (long)d->window); /* Try to set full screen mode if requested, fail if we can't. */ - if (display->flags & ALLEGRO_FULLSCREEN) { + if (display->flags & A5O_FULLSCREEN) { /* According to the spec, the window manager is supposed to disable * window decorations when _NET_WM_STATE_FULLSCREEN is in effect. * However, some WMs may not be fully compliant, e.g. Fluxbox. @@ -248,12 +248,12 @@ static bool xdpy_create_display_window(ALLEGRO_SYSTEM_XGLX *system, _al_xwin_set_above(display, 1); if (!_al_xglx_fullscreen_set_mode(system, d, w, h, 0, display->refresh_rate)) { - ALLEGRO_DEBUG("xdpy: failed to set fullscreen mode.\n"); + A5O_DEBUG("xdpy: failed to set fullscreen mode.\n"); return false; } } - ALLEGRO_DEBUG("X11 window created.\n"); + A5O_DEBUG("X11 window created.\n"); /* Set the PID related to the window. */ Atom _NET_WM_PID = XInternAtom(system->x11display, "_NET_WM_PID", False); @@ -279,7 +279,7 @@ static bool xdpy_create_display_window(ALLEGRO_SYSTEM_XGLX *system, /* This seems like a good idea */ set_compositor_bypass_flag(display); -#ifdef ALLEGRO_XWINDOWS_WITH_XINPUT2 +#ifdef A5O_XWINDOWS_WITH_XINPUT2 /* listen for touchscreen events */ XIEventMask event_mask; event_mask.deviceid = XIAllMasterDevices; @@ -298,12 +298,12 @@ static bool xdpy_create_display_window(ALLEGRO_SYSTEM_XGLX *system, } -static ALLEGRO_DISPLAY_XGLX *xdpy_create_display_locked( - ALLEGRO_SYSTEM_XGLX *system, int flags, int w, int h, int adapter) +static A5O_DISPLAY_XGLX *xdpy_create_display_locked( + A5O_SYSTEM_XGLX *system, int flags, int w, int h, int adapter) { - ALLEGRO_DISPLAY_XGLX *d = al_calloc(1, sizeof *d); - ALLEGRO_DISPLAY *display = (ALLEGRO_DISPLAY *)d; - ALLEGRO_OGL_EXTRAS *ogl = al_calloc(1, sizeof *ogl); + A5O_DISPLAY_XGLX *d = al_calloc(1, sizeof *d); + A5O_DISPLAY *display = (A5O_DISPLAY *)d; + A5O_OGL_EXTRAS *ogl = al_calloc(1, sizeof *ogl); display->ogl_extras = ogl; d->glx_version = query_glx_version(system); @@ -314,24 +314,24 @@ static ALLEGRO_DISPLAY_XGLX *xdpy_create_display_locked( display->refresh_rate = al_get_new_display_refresh_rate(); display->flags = flags; // FIXME: default? Is this the right place to set this? - display->flags |= ALLEGRO_OPENGL; -#ifdef ALLEGRO_CFG_OPENGLES2 - display->flags |= ALLEGRO_PROGRAMMABLE_PIPELINE; + display->flags |= A5O_OPENGL; +#ifdef A5O_CFG_OPENGLES2 + display->flags |= A5O_PROGRAMMABLE_PIPELINE; #endif -#ifdef ALLEGRO_CFG_OPENGLES - display->flags |= ALLEGRO_OPENGL_ES_PROFILE; +#ifdef A5O_CFG_OPENGLES + display->flags |= A5O_OPENGL_ES_PROFILE; #endif /* Store our initial virtual adapter, used by fullscreen and positioning * code. */ - ALLEGRO_DEBUG("selected adapter %i\n", adapter); + A5O_DEBUG("selected adapter %i\n", adapter); if (adapter < 0) d->adapter = _al_xglx_get_default_adapter(system); else d->adapter = adapter; - ALLEGRO_DEBUG("xdpy: selected adapter %i\n", d->adapter); + A5O_DEBUG("xdpy: selected adapter %i\n", d->adapter); _al_xglx_use_adapter(system, d->adapter); if (!check_adapter_use_count(system)) { goto EarlyError; @@ -341,7 +341,7 @@ static ALLEGRO_DISPLAY_XGLX *xdpy_create_display_locked( * visual code. */ d->xscreen = _al_xglx_get_xscreen(system, d->adapter); - ALLEGRO_DEBUG("xdpy: selected xscreen %i\n", d->xscreen); + A5O_DEBUG("xdpy: selected xscreen %i\n", d->xscreen); d->wm_delete_window_atom = None; @@ -358,15 +358,15 @@ static ALLEGRO_DISPLAY_XGLX *xdpy_create_display_locked( _al_xglx_config_select_visual(d); if (!d->xvinfo) { - ALLEGRO_ERROR("FIXME: Need better visual selection.\n"); - ALLEGRO_ERROR("No matching visual found.\n"); + A5O_ERROR("FIXME: Need better visual selection.\n"); + A5O_ERROR("No matching visual found.\n"); goto EarlyError; } - ALLEGRO_INFO("Selected X11 visual %lu.\n", d->xvinfo->visualid); + A5O_INFO("Selected X11 visual %lu.\n", d->xvinfo->visualid); /* Add ourself to the list of displays. */ - ALLEGRO_DISPLAY_XGLX **add; + A5O_DISPLAY_XGLX **add; add = _al_vector_alloc_back(&system->system.displays); *add = d; @@ -383,7 +383,7 @@ static ALLEGRO_DISPLAY_XGLX *xdpy_create_display_locked( */ XSync(system->x11display, False); - if (display->flags & ALLEGRO_GTK_TOPLEVEL_INTERNAL) { + if (display->flags & A5O_GTK_TOPLEVEL_INTERNAL) { ASSERT(gtk_override_vt); if (!gtk_override_vt->create_display_hook(display, w, h)) { goto LateError; @@ -414,7 +414,7 @@ static ALLEGRO_DISPLAY_XGLX *xdpy_create_display_locked( /* In tiling WMs, we might get resize events pretty much immediately after * Window creation. This location seems to catch them reliably, tested with * dwm, awesome, xmonad and i3. */ - if ((display->flags & ALLEGRO_RESIZABLE) && d->resize_count > 0) { + if ((display->flags & A5O_RESIZABLE) && d->resize_count > 0) { xdpy_acknowledge_resize(display); } @@ -422,8 +422,8 @@ static ALLEGRO_DISPLAY_XGLX *xdpy_create_display_locked( * window when switching to fullscreen it will use the same * monitor (with the MetaCity version I'm using here right now). */ - if ((display->flags & ALLEGRO_FULLSCREEN_WINDOW)) { - ALLEGRO_INFO("Toggling fullscreen flag for %d x %d window.\n", + if ((display->flags & A5O_FULLSCREEN_WINDOW)) { + A5O_INFO("Toggling fullscreen flag for %d x %d window.\n", display->w, display->h); _al_xwin_reset_size_hints(display); _al_xwin_set_fullscreen_window(display, 2); @@ -433,11 +433,11 @@ static ALLEGRO_DISPLAY_XGLX *xdpy_create_display_locked( XGetWindowAttributes(system->x11display, d->window, &xwa); display->w = xwa.width; display->h = xwa.height; - ALLEGRO_INFO("Using ALLEGRO_FULLSCREEN_WINDOW of %d x %d\n", + A5O_INFO("Using A5O_FULLSCREEN_WINDOW of %d x %d\n", display->w, display->h); } - if (display->flags & ALLEGRO_FULLSCREEN) { + if (display->flags & A5O_FULLSCREEN) { /* kwin wants these here */ /* metacity wants these here too */ /* XXX compiz is quiky, can't seem to find a combination of hints that @@ -459,26 +459,26 @@ static ALLEGRO_DISPLAY_XGLX *xdpy_create_display_locked( } } - if (display->flags & ALLEGRO_FRAMELESS) { + if (display->flags & A5O_FRAMELESS) { /* set_display_flag works by comparing to current flag value, so we need * to start with an unset state. */ - display->flags &= ~ALLEGRO_FRAMELESS; + display->flags &= ~A5O_FRAMELESS; /* Call the vt directly to bypass system lock. */ - d->overridable_vt->set_display_flag(display, ALLEGRO_FRAMELESS, true); + d->overridable_vt->set_display_flag(display, A5O_FRAMELESS, true); } - if (display->flags & ALLEGRO_DRAG_AND_DROP) { + if (display->flags & A5O_DRAG_AND_DROP) { _al_xwin_accept_drag_and_drop(display, true); } - if (flags & ALLEGRO_MAXIMIZED) { + if (flags & A5O_MAXIMIZED) { /* set_display_flag works by comparing to current flag value, so we need * to start with an unset state. */ - display->flags &= ~ALLEGRO_MAXIMIZED; + display->flags &= ~A5O_MAXIMIZED; /* Call the vt directly to bypass system lock. */ - d->overridable_vt->set_display_flag(display, ALLEGRO_MAXIMIZED, true); + d->overridable_vt->set_display_flag(display, A5O_MAXIMIZED, true); } if (!_al_xglx_config_create_context(d)) { @@ -491,12 +491,12 @@ static ALLEGRO_DISPLAY_XGLX *xdpy_create_display_locked( if (d->fbc) { if (!glXMakeContextCurrent(system->gfxdisplay, d->glxwindow, d->glxwindow, d->context)) { - ALLEGRO_ERROR("glXMakeContextCurrent failed\n"); + A5O_ERROR("glXMakeContextCurrent failed\n"); } } else { if (!glXMakeCurrent(system->gfxdisplay, d->glxwindow, d->context)) { - ALLEGRO_ERROR("glXMakeCurrent failed\n"); + A5O_ERROR("glXMakeCurrent failed\n"); } } @@ -504,31 +504,31 @@ static ALLEGRO_DISPLAY_XGLX *xdpy_create_display_locked( _al_ogl_set_extensions(ogl->extension_api); /* Print out OpenGL version info */ - ALLEGRO_INFO("OpenGL Version: %s\n", (const char*)glGetString(GL_VERSION)); - ALLEGRO_INFO("Vendor: %s\n", (const char*)glGetString(GL_VENDOR)); - ALLEGRO_INFO("Renderer: %s\n", (const char*)glGetString(GL_RENDERER)); + A5O_INFO("OpenGL Version: %s\n", (const char*)glGetString(GL_VERSION)); + A5O_INFO("Vendor: %s\n", (const char*)glGetString(GL_VENDOR)); + A5O_INFO("Renderer: %s\n", (const char*)glGetString(GL_RENDERER)); /* Fill in opengl version */ const int v = display->ogl_extras->ogl_info.version; - display->extra_settings.settings[ALLEGRO_OPENGL_MAJOR_VERSION] = (v >> 24) & 0xFF; - display->extra_settings.settings[ALLEGRO_OPENGL_MINOR_VERSION] = (v >> 16) & 0xFF; + display->extra_settings.settings[A5O_OPENGL_MAJOR_VERSION] = (v >> 24) & 0xFF; + display->extra_settings.settings[A5O_OPENGL_MINOR_VERSION] = (v >> 16) & 0xFF; - if (display->ogl_extras->ogl_info.version < _ALLEGRO_OPENGL_VERSION_1_2) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds = _al_get_new_display_settings(); - if (eds->required & (1<ogl_extras->ogl_info.version < _A5O_OPENGL_VERSION_1_2) { + A5O_EXTRA_DISPLAY_SETTINGS *eds = _al_get_new_display_settings(); + if (eds->required & (1<extra_settings.settings[ALLEGRO_COMPATIBLE_DISPLAY] = 0; + display->extra_settings.settings[A5O_COMPATIBLE_DISPLAY] = 0; } - if (display->extra_settings.settings[ALLEGRO_COMPATIBLE_DISPLAY]) + if (display->extra_settings.settings[A5O_COMPATIBLE_DISPLAY]) _al_ogl_setup_gl(display); /* vsync */ - int vsync_setting = _al_get_new_display_settings()->settings[ALLEGRO_VSYNC]; + int vsync_setting = _al_get_new_display_settings()->settings[A5O_VSYNC]; vsync_setting = xdpy_swap_control(display, vsync_setting); - display->extra_settings.settings[ALLEGRO_VSYNC] = vsync_setting; + display->extra_settings.settings[A5O_VSYNC] = vsync_setting; d->invisible_cursor = None; /* Will be created on demand. */ d->current_cursor = None; /* Initially, we use the root cursor. */ @@ -550,31 +550,31 @@ static ALLEGRO_DISPLAY_XGLX *xdpy_create_display_locked( } -static bool xdpy_create_display_hook_default(ALLEGRO_DISPLAY *display, +static bool xdpy_create_display_hook_default(A5O_DISPLAY *display, int w, int h) { - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *d = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); + A5O_DISPLAY_XGLX *d = (A5O_DISPLAY_XGLX *)display; (void)w; (void)h; if (_al_xwin_initial_icon) { - ALLEGRO_BITMAP *bitmaps[] = {_al_xwin_initial_icon}; + A5O_BITMAP *bitmaps[] = {_al_xwin_initial_icon}; _al_xwin_set_icons(display, 1, bitmaps); } else { - ALLEGRO_STATE state; - al_store_state(&state, ALLEGRO_STATE_NEW_BITMAP_PARAMETERS); - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); - ALLEGRO_BITMAP *bitmap = al_create_bitmap(ICON_WIDTH, ICON_HEIGHT); + A5O_STATE state; + al_store_state(&state, A5O_STATE_NEW_BITMAP_PARAMETERS); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); + A5O_BITMAP *bitmap = al_create_bitmap(ICON_WIDTH, ICON_HEIGHT); al_restore_state(&state); - ALLEGRO_LOCKED_REGION *lr = al_lock_bitmap(bitmap, ALLEGRO_PIXEL_FORMAT_RGBA_8888, ALLEGRO_LOCK_WRITEONLY); + A5O_LOCKED_REGION *lr = al_lock_bitmap(bitmap, A5O_PIXEL_FORMAT_RGBA_8888, A5O_LOCK_WRITEONLY); for (int y = 0; y < ICON_HEIGHT; y++) { memcpy((char*)lr->data + lr->pitch * y, &icon_data[ICON_WIDTH * y], ICON_WIDTH * 4); } al_unlock_bitmap(bitmap); - ALLEGRO_BITMAP *bitmaps[] = {bitmap}; + A5O_BITMAP *bitmaps[] = {bitmap}; _al_xwin_set_icons(display, 1, bitmaps); al_destroy_bitmap(bitmap); } @@ -582,7 +582,7 @@ static bool xdpy_create_display_hook_default(ALLEGRO_DISPLAY *display, XLockDisplay(system->x11display); XMapWindow(system->x11display, d->window); - ALLEGRO_DEBUG("X11 window mapped.\n"); + A5O_DEBUG("X11 window mapped.\n"); d->wm_delete_window_atom = XInternAtom(system->x11display, "WM_DELETE_WINDOW", False); @@ -597,31 +597,31 @@ static bool xdpy_create_display_hook_default(ALLEGRO_DISPLAY *display, /* Create a new X11 display, which maps directly to a GLX window. */ -static ALLEGRO_DISPLAY *xdpy_create_display(int w, int h) +static A5O_DISPLAY *xdpy_create_display(int w, int h) { - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *display; + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); + A5O_DISPLAY_XGLX *display; int flags; int adapter; if (system->x11display == NULL) { - ALLEGRO_WARN("Not connected to X server.\n"); + A5O_WARN("Not connected to X server.\n"); return NULL; } if (w <= 0 || h <= 0) { - ALLEGRO_ERROR("Invalid window size %dx%d\n", w, h); + A5O_ERROR("Invalid window size %dx%d\n", w, h); return NULL; } flags = al_get_new_display_flags(); - if (flags & ALLEGRO_GTK_TOPLEVEL_INTERNAL) { + if (flags & A5O_GTK_TOPLEVEL_INTERNAL) { if (gtk_override_vt == NULL) { - ALLEGRO_ERROR("GTK requested but unavailable\n"); + A5O_ERROR("GTK requested but unavailable\n"); return NULL; } - if (flags & ALLEGRO_FULLSCREEN) { - ALLEGRO_ERROR("GTK incompatible with fullscreen\n"); + if (flags & A5O_FULLSCREEN) { + A5O_ERROR("GTK incompatible with fullscreen\n"); return NULL; } } @@ -633,49 +633,49 @@ static ALLEGRO_DISPLAY *xdpy_create_display(int w, int h) _al_mutex_unlock(&system->lock); - return (ALLEGRO_DISPLAY *)display; + return (A5O_DISPLAY *)display; } -static void convert_display_bitmaps_to_memory_bitmap(ALLEGRO_DISPLAY *d) +static void convert_display_bitmaps_to_memory_bitmap(A5O_DISPLAY *d) { - ALLEGRO_DEBUG("converting display bitmaps to memory bitmaps.\n"); + A5O_DEBUG("converting display bitmaps to memory bitmaps.\n"); while (d->bitmaps._size > 0) { - ALLEGRO_BITMAP **bptr = _al_vector_ref_back(&d->bitmaps); - ALLEGRO_BITMAP *b = *bptr; + A5O_BITMAP **bptr = _al_vector_ref_back(&d->bitmaps); + A5O_BITMAP *b = *bptr; _al_convert_to_memory_bitmap(b); } } static void transfer_display_bitmaps_to_any_other_display( - ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY *d) + A5O_SYSTEM_XGLX *s, A5O_DISPLAY *d) { size_t i; - ALLEGRO_DISPLAY *living = NULL; + A5O_DISPLAY *living = NULL; ASSERT(s->system.displays._size > 1); for (i = 0; i < s->system.displays._size; i++) { - ALLEGRO_DISPLAY **slot = _al_vector_ref(&s->system.displays, i); + A5O_DISPLAY **slot = _al_vector_ref(&s->system.displays, i); living = *slot; if (living != d) break; } - ALLEGRO_DEBUG("transferring display bitmaps to other display.\n"); + A5O_DEBUG("transferring display bitmaps to other display.\n"); for (i = 0; i < d->bitmaps._size; i++) { - ALLEGRO_BITMAP **add = _al_vector_alloc_back(&(living->bitmaps)); - ALLEGRO_BITMAP **ref = _al_vector_ref(&d->bitmaps, i); + A5O_BITMAP **add = _al_vector_alloc_back(&(living->bitmaps)); + A5O_BITMAP **ref = _al_vector_ref(&d->bitmaps, i); *add = *ref; (*add)->_display = living; } } -static void restore_mode_if_last_fullscreen_display(ALLEGRO_SYSTEM_XGLX *s, - ALLEGRO_DISPLAY_XGLX *d) +static void restore_mode_if_last_fullscreen_display(A5O_SYSTEM_XGLX *s, + A5O_DISPLAY_XGLX *d) { bool last_fullscreen = true; size_t i; @@ -684,39 +684,39 @@ static void restore_mode_if_last_fullscreen_display(ALLEGRO_SYSTEM_XGLX *s, * we must not touch the video mode. */ for (i = 0; i < s->system.displays._size; i++) { - ALLEGRO_DISPLAY_XGLX **slot = _al_vector_ref(&s->system.displays, i); - ALLEGRO_DISPLAY_XGLX *living = *slot; + A5O_DISPLAY_XGLX **slot = _al_vector_ref(&s->system.displays, i); + A5O_DISPLAY_XGLX *living = *slot; if (living == d) continue; /* Check for fullscreen displays on the same adapter. */ if (living->adapter == d->adapter - && (living->display.flags & ALLEGRO_FULLSCREEN)) { + && (living->display.flags & A5O_FULLSCREEN)) { last_fullscreen = false; } } if (last_fullscreen) { - ALLEGRO_DEBUG("restore mode.\n"); + A5O_DEBUG("restore mode.\n"); _al_xglx_restore_video_mode(s, d->adapter); } else { - ALLEGRO_DEBUG("*not* restoring mode.\n"); + A5O_DEBUG("*not* restoring mode.\n"); } } -static void xdpy_destroy_display_hook_default(ALLEGRO_DISPLAY *d, bool is_last) +static void xdpy_destroy_display_hook_default(A5O_DISPLAY *d, bool is_last) { - ALLEGRO_SYSTEM_XGLX *s = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)d; + A5O_SYSTEM_XGLX *s = (A5O_SYSTEM_XGLX *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)d; (void)is_last; if (glx->context) { glXDestroyContext(s->gfxdisplay, glx->context); glx->context = NULL; - ALLEGRO_DEBUG("destroy context.\n"); + A5O_DEBUG("destroy context.\n"); } if (glx->fbc) { @@ -733,31 +733,31 @@ static void xdpy_destroy_display_hook_default(ALLEGRO_DISPLAY *d, bool is_last) if ((glx->glxwindow) && (glx->glxwindow != glx->window)) { glXDestroyWindow(s->x11display, glx->glxwindow); glx->glxwindow = 0; - ALLEGRO_DEBUG("destroy glx window\n"); + A5O_DEBUG("destroy glx window\n"); } _al_cond_destroy(&glx->mapped); _al_cond_destroy(&glx->selectioned); - ALLEGRO_DEBUG("destroy window.\n"); + A5O_DEBUG("destroy window.\n"); XDestroyWindow(s->x11display, glx->window); _al_xglx_unuse_adapter(s, glx->adapter); - if (d->flags & ALLEGRO_FULLSCREEN) { + if (d->flags & A5O_FULLSCREEN) { restore_mode_if_last_fullscreen_display(s, glx); } } -static void xdpy_destroy_display(ALLEGRO_DISPLAY *d) +static void xdpy_destroy_display(A5O_DISPLAY *d) { - ALLEGRO_SYSTEM_XGLX *s = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)d; - ALLEGRO_OGL_EXTRAS *ogl = d->ogl_extras; + A5O_SYSTEM_XGLX *s = (A5O_SYSTEM_XGLX *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)d; + A5O_OGL_EXTRAS *ogl = d->ogl_extras; bool is_last; - ALLEGRO_DEBUG("destroying display.\n"); + A5O_DEBUG("destroying display.\n"); /* If we're the last display, convert all bitmaps to display independent * (memory) bitmaps. Otherwise, pass all bitmaps to any other living @@ -770,7 +770,7 @@ static void xdpy_destroy_display(ALLEGRO_DISPLAY *d) transfer_display_bitmaps_to_any_other_display(s, d); _al_ogl_unmanage_extensions(d); - ALLEGRO_DEBUG("unmanaged extensions.\n"); + A5O_DEBUG("unmanaged extensions.\n"); _al_mutex_lock(&s->lock); _al_vector_find_and_delete(&s->system.displays, &d); @@ -778,7 +778,7 @@ static void xdpy_destroy_display(ALLEGRO_DISPLAY *d) if (ogl->backbuffer) { _al_ogl_destroy_backbuffer(ogl->backbuffer); ogl->backbuffer = NULL; - ALLEGRO_DEBUG("destroy backbuffer.\n"); + A5O_DEBUG("destroy backbuffer.\n"); } if (glx->overridable_vt) { @@ -798,14 +798,14 @@ static void xdpy_destroy_display(ALLEGRO_DISPLAY *d) _al_mutex_unlock(&s->lock); - ALLEGRO_DEBUG("destroy display finished.\n"); + A5O_DEBUG("destroy display finished.\n"); } -static bool xdpy_make_current(ALLEGRO_DISPLAY *d) +static bool xdpy_make_current(A5O_DISPLAY *d) { - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)d; + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)d; /* Make our GLX context current for reading and writing in the current * thread. @@ -820,13 +820,13 @@ static bool xdpy_make_current(ALLEGRO_DISPLAY *d) } -static bool xdpy_set_current_display(ALLEGRO_DISPLAY *d) +static bool xdpy_set_current_display(A5O_DISPLAY *d) { bool rc; rc = xdpy_make_current(d); if (rc) { - ALLEGRO_OGL_EXTRAS *ogl = d->ogl_extras; + A5O_OGL_EXTRAS *ogl = d->ogl_extras; _al_ogl_set_extensions(ogl->extension_api); _al_ogl_update_render_state(d); } @@ -835,32 +835,32 @@ static bool xdpy_set_current_display(ALLEGRO_DISPLAY *d) } -static void xdpy_unset_current_display(ALLEGRO_DISPLAY *d) +static void xdpy_unset_current_display(A5O_DISPLAY *d) { - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); glXMakeContextCurrent(system->gfxdisplay, None, None, NULL); (void)d; } -static void xdpy_flip_display(ALLEGRO_DISPLAY *d) +static void xdpy_flip_display(A5O_DISPLAY *d) { - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)d; + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)d; int e = glGetError(); if (e) { - ALLEGRO_ERROR("OpenGL error was not 0: %s\n", _al_gl_error_string(e)); + A5O_ERROR("OpenGL error was not 0: %s\n", _al_gl_error_string(e)); } - if (d->extra_settings.settings[ALLEGRO_SINGLE_BUFFER]) + if (d->extra_settings.settings[A5O_SINGLE_BUFFER]) glFlush(); else glXSwapBuffers(system->gfxdisplay, glx->glxwindow); } -static void xdpy_update_display_region(ALLEGRO_DISPLAY *d, int x, int y, +static void xdpy_update_display_region(A5O_DISPLAY *d, int x, int y, int w, int h) { (void)x; @@ -871,10 +871,10 @@ static void xdpy_update_display_region(ALLEGRO_DISPLAY *d, int x, int y, } -static bool xdpy_acknowledge_resize(ALLEGRO_DISPLAY *d) +static bool xdpy_acknowledge_resize(A5O_DISPLAY *d) { - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)d; + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)d; XWindowAttributes xwa; unsigned int w, h; @@ -894,7 +894,7 @@ static bool xdpy_acknowledge_resize(ALLEGRO_DISPLAY *d) d->w = w; d->h = h; - ALLEGRO_DEBUG("xdpy: acknowledge_resize (%d, %d)\n", d->w, d->h); + A5O_DEBUG("xdpy: acknowledge_resize (%d, %d)\n", d->w, d->h); /* No context yet means this is a stray call happening during * initialization. @@ -916,14 +916,14 @@ static bool xdpy_acknowledge_resize(ALLEGRO_DISPLAY *d) * wait for the condition variable it gets auto-unlocked. For a * nested lock that would not be the case. */ -void _al_display_xglx_await_resize(ALLEGRO_DISPLAY *d, int old_resize_count, +void _al_display_xglx_await_resize(A5O_DISPLAY *d, int old_resize_count, bool delay_hack) { - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)d; - ALLEGRO_TIMEOUT timeout; + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)d; + A5O_TIMEOUT timeout; - ALLEGRO_DEBUG("Awaiting resize event\n"); + A5O_DEBUG("Awaiting resize event\n"); XSync(system->x11display, False); @@ -933,7 +933,7 @@ void _al_display_xglx_await_resize(ALLEGRO_DISPLAY *d, int old_resize_count, al_init_timeout(&timeout, 1.0); while (old_resize_count == glx->resize_count) { if (_al_cond_timedwait(&system->resized, &system->lock, &timeout) == -1) { - ALLEGRO_ERROR("Timeout while waiting for resize event.\n"); + A5O_ERROR("Timeout while waiting for resize event.\n"); return; } } @@ -949,10 +949,10 @@ void _al_display_xglx_await_resize(ALLEGRO_DISPLAY *d, int old_resize_count, } -static bool xdpy_resize_display_default(ALLEGRO_DISPLAY *d, int w, int h) +static bool xdpy_resize_display_default(A5O_DISPLAY *d, int w, int h) { - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)d; + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)d; XWindowAttributes xwa; int attempts; bool ret = false; @@ -968,7 +968,7 @@ static bool xdpy_resize_display_default(ALLEGRO_DISPLAY *d, int w, int h) return false; } - if (d->flags & ALLEGRO_FULLSCREEN) { + if (d->flags & A5O_FULLSCREEN) { _al_xwin_set_fullscreen_window(d, 0); if (!_al_xglx_fullscreen_set_mode(system, glx, w, h, 0, 0)) { ret = false; @@ -988,12 +988,12 @@ static bool xdpy_resize_display_default(ALLEGRO_DISPLAY *d, int w, int h) */ for (; attempts >= 0; attempts--) { const int old_resize_count = glx->resize_count; - ALLEGRO_DEBUG("calling XResizeWindow, attempts=%d\n", attempts); + A5O_DEBUG("calling XResizeWindow, attempts=%d\n", attempts); _al_xwin_reset_size_hints(d); glx->programmatic_resize = true; XResizeWindow(system->x11display, glx->window, w, h); _al_display_xglx_await_resize(d, old_resize_count, - (d->flags & ALLEGRO_FULLSCREEN)); + (d->flags & A5O_FULLSCREEN)); glx->programmatic_resize = false; _al_xwin_set_size_hints(d, INT_MAX, INT_MAX); @@ -1007,16 +1007,16 @@ static bool xdpy_resize_display_default(ALLEGRO_DISPLAY *d, int w, int h) } if (attempts == 0) { - ALLEGRO_ERROR("XResizeWindow didn't work; giving up\n"); + A5O_ERROR("XResizeWindow didn't work; giving up\n"); } skip_resize: - if (d->flags & ALLEGRO_FULLSCREEN) { + if (d->flags & A5O_FULLSCREEN) { _al_xwin_set_fullscreen_window(d, 1); _al_xwin_set_above(d, 1); _al_xglx_fullscreen_to_display(system, glx); - ALLEGRO_DEBUG("xdpy: resize fullscreen?\n"); + A5O_DEBUG("xdpy: resize fullscreen?\n"); } _al_mutex_unlock(&system->lock); @@ -1024,24 +1024,24 @@ static bool xdpy_resize_display_default(ALLEGRO_DISPLAY *d, int w, int h) } -static bool xdpy_resize_display(ALLEGRO_DISPLAY *d, int w, int h) +static bool xdpy_resize_display(A5O_DISPLAY *d, int w, int h) { - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)d; + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)d; /* A fullscreen-window can't be resized. */ - if (d->flags & ALLEGRO_FULLSCREEN_WINDOW) + if (d->flags & A5O_FULLSCREEN_WINDOW) return false; return glx->overridable_vt->resize_display(d, w, h); } -void _al_xglx_display_configure(ALLEGRO_DISPLAY *d, int x, int y, +void _al_xglx_display_configure(A5O_DISPLAY *d, int x, int y, int width, int height, bool setglxy) { - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)d; + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)d; - ALLEGRO_EVENT_SOURCE *es = &glx->display.es; + A5O_EVENT_SOURCE *es = &glx->display.es; _al_event_source_lock(es); _al_xwin_get_borders(d); @@ -1055,8 +1055,8 @@ void _al_xglx_display_configure(ALLEGRO_DISPLAY *d, int x, int y, (d->w != width || d->h != height)) { if (_al_event_source_needs_to_generate_event(es)) { - ALLEGRO_EVENT event; - event.display.type = ALLEGRO_EVENT_DISPLAY_RESIZE; + A5O_EVENT event; + event.display.type = A5O_EVENT_DISPLAY_RESIZE; event.display.timestamp = al_get_time(); event.display.x = x; event.display.y = y; @@ -1086,19 +1086,19 @@ void _al_xglx_display_configure(ALLEGRO_DISPLAY *d, int x, int y, // 3. Now d->x/d->y is in sync with the real position, but if // we wanted a specific position it is off by the border size // and so we adjust it below. - ALLEGRO_DEBUG("Adjusting initial position: %d/%d", glx->x - glx->border_left, glx->y - glx->border_top); + A5O_DEBUG("Adjusting initial position: %d/%d", glx->x - glx->border_left, glx->y - glx->border_top); al_set_window_position(d, glx->x - glx->border_left, glx->y - glx->border_top); } } - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX*)al_get_system_driver(); - ALLEGRO_MONITOR_INFO mi; + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX*)al_get_system_driver(); + A5O_MONITOR_INFO mi; int center_x = (glx->x + (glx->x + width)) / 2; int center_y = (glx->y + (glx->y + height)) / 2; _al_xglx_get_monitor_info(system, glx->adapter, &mi); - ALLEGRO_DEBUG("xconfigure event! %ix%i\n", x, y); + A5O_DEBUG("xconfigure event! %ix%i\n", x, y); /* check if we're no longer inside the stored adapter */ if ((center_x < mi.x1 && center_x > mi.x2) || @@ -1106,9 +1106,9 @@ void _al_xglx_display_configure(ALLEGRO_DISPLAY *d, int x, int y, { int new_adapter = _al_xglx_get_adapter(system, glx, true); if (new_adapter != glx->adapter) { - ALLEGRO_DEBUG("xdpy: adapter change!\n"); + A5O_DEBUG("xdpy: adapter change!\n"); _al_xglx_unuse_adapter(system, glx->adapter); - if (d->flags & ALLEGRO_FULLSCREEN) + if (d->flags & A5O_FULLSCREEN) _al_xglx_restore_video_mode(system, glx->adapter); glx->adapter = new_adapter; _al_xglx_use_adapter(system, glx->adapter); @@ -1125,7 +1125,7 @@ void _al_xglx_display_configure(ALLEGRO_DISPLAY *d, int x, int y, /* Handle an X11 configure event. [X11 thread] * Only called from the event handler with the system locked. */ -void _al_xglx_display_configure_event(ALLEGRO_DISPLAY *d, XEvent *xevent) +void _al_xglx_display_configure_event(A5O_DISPLAY *d, XEvent *xevent) { /* We receive two configure events when toggling the window frame. * We ignore the first one as it has bogus coordinates. @@ -1142,7 +1142,7 @@ void _al_xglx_display_configure_event(ALLEGRO_DISPLAY *d, XEvent *xevent) /* Handle X11 switch event. [X11 thread] */ -void _al_xwin_display_switch_handler(ALLEGRO_DISPLAY *display, +void _al_xwin_display_switch_handler(A5O_DISPLAY *display, XFocusChangeEvent *xevent) { /* Mouse click in/out tend to set NotifyNormal events. For Alt-Tab, @@ -1158,16 +1158,16 @@ void _al_xwin_display_switch_handler(ALLEGRO_DISPLAY *display, /* Handle X11 switch event. [X11 thread] */ -void _al_xwin_display_switch_handler_inner(ALLEGRO_DISPLAY *display, bool focus_in) +void _al_xwin_display_switch_handler_inner(A5O_DISPLAY *display, bool focus_in) { - ALLEGRO_EVENT_SOURCE *es = &display->es; + A5O_EVENT_SOURCE *es = &display->es; _al_event_source_lock(es); if (_al_event_source_needs_to_generate_event(es)) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (focus_in) - event.display.type = ALLEGRO_EVENT_DISPLAY_SWITCH_IN; + event.display.type = A5O_EVENT_DISPLAY_SWITCH_IN; else - event.display.type = ALLEGRO_EVENT_DISPLAY_SWITCH_OUT; + event.display.type = A5O_EVENT_DISPLAY_SWITCH_OUT; event.display.timestamp = al_get_time(); _al_event_source_emit_event(es, &event); } @@ -1176,14 +1176,14 @@ void _al_xwin_display_switch_handler_inner(ALLEGRO_DISPLAY *display, bool focus_ -void _al_xwin_display_expose(ALLEGRO_DISPLAY *display, +void _al_xwin_display_expose(A5O_DISPLAY *display, XExposeEvent *xevent) { - ALLEGRO_EVENT_SOURCE *es = &display->es; + A5O_EVENT_SOURCE *es = &display->es; _al_event_source_lock(es); if (_al_event_source_needs_to_generate_event(es)) { - ALLEGRO_EVENT event; - event.display.type = ALLEGRO_EVENT_DISPLAY_EXPOSE; + A5O_EVENT event; + event.display.type = A5O_EVENT_DISPLAY_EXPOSE; event.display.timestamp = al_get_time(); event.display.x = xevent->x; event.display.y = xevent->y; @@ -1195,8 +1195,8 @@ void _al_xwin_display_expose(ALLEGRO_DISPLAY *display, } -static bool xdpy_is_compatible_bitmap(ALLEGRO_DISPLAY *display, - ALLEGRO_BITMAP *bitmap) +static bool xdpy_is_compatible_bitmap(A5O_DISPLAY *display, + A5O_BITMAP *bitmap) { /* All GLX bitmaps are compatible. */ (void)display; @@ -1205,10 +1205,10 @@ static bool xdpy_is_compatible_bitmap(ALLEGRO_DISPLAY *display, } -static void xdpy_set_window_title_default(ALLEGRO_DISPLAY *display, const char *title) +static void xdpy_set_window_title_default(A5O_DISPLAY *display, const char *title) { - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; { Atom WM_NAME = XInternAtom(system->x11display, "WM_NAME", False); @@ -1226,7 +1226,7 @@ static void xdpy_set_window_title_default(ALLEGRO_DISPLAY *display, const char * { XClassHint *hint = XAllocClassHint(); if (hint) { - ALLEGRO_PATH *exepath = al_get_standard_path(ALLEGRO_EXENAME_PATH); + A5O_PATH *exepath = al_get_standard_path(A5O_EXENAME_PATH); // hint doesn't use a const char*, so we use strdup to create a non const string hint->res_name = strdup(al_get_path_basename(exepath)); hint->res_class = strdup(al_get_path_basename(exepath)); @@ -1240,10 +1240,10 @@ static void xdpy_set_window_title_default(ALLEGRO_DISPLAY *display, const char * } -static void xdpy_set_window_title(ALLEGRO_DISPLAY *display, const char *title) +static void xdpy_set_window_title(A5O_DISPLAY *display, const char *title) { - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; _al_mutex_lock(&system->lock); glx->overridable_vt->set_window_title(display, title); @@ -1253,11 +1253,11 @@ static void xdpy_set_window_title(ALLEGRO_DISPLAY *display, const char *title) // Note: we assume x/y to be the inner window position (that is drawing // to 0/0 in Allegro's drawing area will draw to x/y on the desktop) -static void xdpy_set_window_position_default(ALLEGRO_DISPLAY *display, +static void xdpy_set_window_position_default(A5O_DISPLAY *display, int x, int y) { - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); _al_mutex_lock(&system->lock); @@ -1282,16 +1282,16 @@ static void xdpy_set_window_position_default(ALLEGRO_DISPLAY *display, } -static void xdpy_set_window_position(ALLEGRO_DISPLAY *display, int x, int y) +static void xdpy_set_window_position(A5O_DISPLAY *display, int x, int y) { - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; glx->overridable_vt->set_window_position(display, x, y); } -static void xdpy_get_window_position(ALLEGRO_DISPLAY *display, int *x, int *y) +static void xdpy_get_window_position(A5O_DISPLAY *display, int *x, int *y) { - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; /* We could also query the X11 server, but it just would take longer, and * would not be synchronized to our events. The latter can be an advantage * or disadvantage. @@ -1301,9 +1301,9 @@ static void xdpy_get_window_position(ALLEGRO_DISPLAY *display, int *x, int *y) } -static bool xdpy_get_window_borders(ALLEGRO_DISPLAY *display, int *left, int *top, int *right, int *bottom) +static bool xdpy_get_window_borders(A5O_DISPLAY *display, int *left, int *top, int *right, int *bottom) { - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; if (!glx->borders_known) return false; if (left) *left = glx->border_left; if (right) *right = glx->border_right; @@ -1313,10 +1313,10 @@ static bool xdpy_get_window_borders(ALLEGRO_DISPLAY *display, int *left, int *to } -static bool xdpy_set_window_constraints_default(ALLEGRO_DISPLAY *display, +static bool xdpy_set_window_constraints_default(A5O_DISPLAY *display, int min_w, int min_h, int max_w, int max_h) { - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; glx->display.min_w = min_w; glx->display.min_h = min_h; @@ -1327,19 +1327,19 @@ static bool xdpy_set_window_constraints_default(ALLEGRO_DISPLAY *display, } -static bool xdpy_set_window_constraints(ALLEGRO_DISPLAY *display, +static bool xdpy_set_window_constraints(A5O_DISPLAY *display, int min_w, int min_h, int max_w, int max_h) { - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; return glx->overridable_vt->set_window_constraints(display, min_w, min_h, max_w, max_h); } -static bool xdpy_get_window_constraints(ALLEGRO_DISPLAY *display, +static bool xdpy_get_window_constraints(A5O_DISPLAY *display, int *min_w, int *min_h, int *max_w, int * max_h) { - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; *min_w = glx->display.min_w; *min_h = glx->display.min_h; @@ -1350,12 +1350,12 @@ static bool xdpy_get_window_constraints(ALLEGRO_DISPLAY *display, } -static void xdpy_apply_window_constraints(ALLEGRO_DISPLAY *display, +static void xdpy_apply_window_constraints(A5O_DISPLAY *display, bool onoff) { int posX; int posY; - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); _al_mutex_lock(&system->lock); @@ -1372,10 +1372,10 @@ static void xdpy_apply_window_constraints(ALLEGRO_DISPLAY *display, } -static void xdpy_set_fullscreen_window_default(ALLEGRO_DISPLAY *display, bool onoff) +static void xdpy_set_fullscreen_window_default(A5O_DISPLAY *display, bool onoff) { - if (onoff == !(display->flags & ALLEGRO_FULLSCREEN_WINDOW)) { - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); + if (onoff == !(display->flags & A5O_FULLSCREEN_WINDOW)) { + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); _al_mutex_lock(&system->lock); _al_xwin_reset_size_hints(display); @@ -1384,7 +1384,7 @@ static void xdpy_set_fullscreen_window_default(ALLEGRO_DISPLAY *display, bool on * property outside of Allegro so this flag may not be in sync with * reality. */ - display->flags ^= ALLEGRO_FULLSCREEN_WINDOW; + display->flags ^= A5O_FULLSCREEN_WINDOW; _al_xwin_set_size_hints(display, INT_MAX, INT_MAX); set_compositor_bypass_flag(display); @@ -1394,25 +1394,25 @@ static void xdpy_set_fullscreen_window_default(ALLEGRO_DISPLAY *display, bool on } -static bool xdpy_set_display_flag_default(ALLEGRO_DISPLAY *display, int flag, +static bool xdpy_set_display_flag_default(A5O_DISPLAY *display, int flag, bool flag_onoff) { switch (flag) { - case ALLEGRO_FRAMELESS: + case A5O_FRAMELESS: { - /* The ALLEGRO_FRAMELESS flag is backwards. */ + /* The A5O_FRAMELESS flag is backwards. */ _al_xwin_set_frame(display, !flag_onoff); return true; } - case ALLEGRO_FULLSCREEN_WINDOW: + case A5O_FULLSCREEN_WINDOW: { - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; glx->overridable_vt->set_fullscreen_window(display, flag_onoff); return true; } - case ALLEGRO_MAXIMIZED: + case A5O_MAXIMIZED: { - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); _al_mutex_lock(&system->lock); _al_xwin_maximize(display, flag_onoff); _al_mutex_unlock(&system->lock); @@ -1423,18 +1423,18 @@ static bool xdpy_set_display_flag_default(ALLEGRO_DISPLAY *display, int flag, } -static bool xdpy_set_display_flag(ALLEGRO_DISPLAY *display, int flag, bool onoff) +static bool xdpy_set_display_flag(A5O_DISPLAY *display, int flag, bool onoff) { - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; return glx->overridable_vt->set_display_flag(display, flag, onoff); } -static bool xdpy_wait_for_vsync(ALLEGRO_DISPLAY *display) +static bool xdpy_wait_for_vsync(A5O_DISPLAY *display) { (void) display; - if (al_get_opengl_extension_list()->ALLEGRO_GLX_SGI_video_sync) { + if (al_get_opengl_extension_list()->A5O_GLX_SGI_video_sync) { unsigned int count; glXGetVideoSyncSGI(&count); glXWaitVideoSyncSGI(2, (count+1) & 1, &count); @@ -1446,7 +1446,7 @@ static bool xdpy_wait_for_vsync(ALLEGRO_DISPLAY *display) /* Obtain a reference to this driver. */ -ALLEGRO_DISPLAY_INTERFACE *_al_display_xglx_driver(void) +A5O_DISPLAY_INTERFACE *_al_display_xglx_driver(void) { if (xdpy_vt.create_display) return &xdpy_vt; @@ -1483,7 +1483,7 @@ ALLEGRO_DISPLAY_INTERFACE *_al_display_xglx_driver(void) } -static const ALLEGRO_XWIN_DISPLAY_OVERRIDABLE_INTERFACE default_overridable_vt = +static const A5O_XWIN_DISPLAY_OVERRIDABLE_INTERFACE default_overridable_vt = { xdpy_create_display_hook_default, xdpy_destroy_display_hook_default, @@ -1498,18 +1498,18 @@ static const ALLEGRO_XWIN_DISPLAY_OVERRIDABLE_INTERFACE default_overridable_vt = bool _al_xwin_set_gtk_display_overridable_interface(uint32_t check_version, - const ALLEGRO_XWIN_DISPLAY_OVERRIDABLE_INTERFACE *vt) + const A5O_XWIN_DISPLAY_OVERRIDABLE_INTERFACE *vt) { /* The version of the native dialogs addon must exactly match the core * library version. */ - if (vt && check_version == ALLEGRO_VERSION_INT) { - ALLEGRO_DEBUG("GTK vtable made available\n"); + if (vt && check_version == A5O_VERSION_INT) { + A5O_DEBUG("GTK vtable made available\n"); gtk_override_vt = vt; return true; } - ALLEGRO_DEBUG("GTK vtable reset\n"); + A5O_DEBUG("GTK vtable reset\n"); gtk_override_vt = NULL; return (vt == NULL); } diff --git a/src/x/xdnd.c b/src/x/xdnd.c index f3e6f7b0e6..183ea14561 100644 --- a/src/x/xdnd.c +++ b/src/x/xdnd.c @@ -12,7 +12,7 @@ #include "allegro5/internal/aintern_xsystem.h" #include "allegro5/internal/aintern_xdnd.h" -ALLEGRO_DEBUG_CHANNEL("xdnd") +A5O_DEBUG_CHANNEL("xdnd") typedef struct { unsigned char *data; @@ -22,7 +22,7 @@ typedef struct { static int last_drop_x, last_drop_y; -void _al_display_xglx_init_dnd_atoms(ALLEGRO_SYSTEM_XGLX *s) +void _al_display_xglx_init_dnd_atoms(A5O_SYSTEM_XGLX *s) { #define GET_ATOM(name) s->dnd_info.name = XInternAtom(s->x11display, #name, False) GET_ATOM(XdndEnter); @@ -94,7 +94,7 @@ static Atom pick_target_from_atoms(Display *disp, Atom a0, Atom a1, Atom a2) return pick_target(disp, atom, count); } -static void x11_reply(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *allegro_display, +static void x11_reply(A5O_SYSTEM_XGLX *s, A5O_DISPLAY_XGLX *allegro_display, Window window, Atom message_type) { XClientMessageEvent m; @@ -134,15 +134,15 @@ static void x11_reply(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *allegro_disp XSync(s->x11display, 0); } -static void _send_event(ALLEGRO_DISPLAY_XGLX *allegro_display, char *text, +static void _send_event(A5O_DISPLAY_XGLX *allegro_display, char *text, bool is_file, int row, bool is_complete) { - ALLEGRO_EVENT_SOURCE *es = &allegro_display->display.es; + A5O_EVENT_SOURCE *es = &allegro_display->display.es; _al_event_source_lock(es); if (_al_event_source_needs_to_generate_event(es)) { - ALLEGRO_EVENT event; - event.drop.type = ALLEGRO_EVENT_DROP; + A5O_EVENT event; + event.drop.type = A5O_EVENT_DROP; event.drop.timestamp = al_get_time(); event.drop.x = last_drop_x; event.drop.y = last_drop_y; @@ -158,13 +158,13 @@ static void _send_event(ALLEGRO_DISPLAY_XGLX *allegro_display, char *text, /* Return true if the event is handled as a DND related event else * false. */ -bool _al_display_xglx_handle_drag_and_drop(ALLEGRO_SYSTEM_XGLX *s, - ALLEGRO_DISPLAY_XGLX *allegro_display, XEvent *xevent) +bool _al_display_xglx_handle_drag_and_drop(A5O_SYSTEM_XGLX *s, + A5O_DISPLAY_XGLX *allegro_display, XEvent *xevent) { - if (!(allegro_display->display.flags & ALLEGRO_DRAG_AND_DROP)) + if (!(allegro_display->display.flags & A5O_DRAG_AND_DROP)) return false; if (xevent->xclient.message_type == s->dnd_info.XdndEnter) { - ALLEGRO_DEBUG("Xdnd entered\n"); + A5O_DEBUG("Xdnd entered\n"); bool use_list = xevent->xclient.data.l[1] & 1; s->dnd_info.xdnd_source = xevent->xclient.data.l[0]; @@ -180,7 +180,7 @@ bool _al_display_xglx_handle_drag_and_drop(ALLEGRO_SYSTEM_XGLX *s, xevent->xclient.data.l[4]); } if (s->dnd_info.xdnd_req == None) { - ALLEGRO_WARN("Xdnd action unsupported\n"); + A5O_WARN("Xdnd action unsupported\n"); } return true; } @@ -205,9 +205,9 @@ bool _al_display_xglx_handle_drag_and_drop(ALLEGRO_SYSTEM_XGLX *s, if (s->dnd_info.xdnd_req == None) { x11_reply(s, allegro_display, xevent->xclient.data.l[0], s->dnd_info.XdndFinished); _send_event(allegro_display, NULL, false, 0, true); - ALLEGRO_DEBUG("Xdnd aborted\n"); + A5O_DEBUG("Xdnd aborted\n"); } else { - ALLEGRO_DEBUG("Xdnd received, converting to selection\n"); + A5O_DEBUG("Xdnd received, converting to selection\n"); int xdnd_version = xevent->xclient.data.l[1] >> 24; if(xdnd_version >= 1) { XConvertSelection(s->x11display, s->dnd_info.XdndSelection, @@ -222,7 +222,7 @@ bool _al_display_xglx_handle_drag_and_drop(ALLEGRO_SYSTEM_XGLX *s, } else if (xevent->xclient.message_type == s->dnd_info.XdndLeave) { _send_event(allegro_display, NULL, false, 0, true); - ALLEGRO_DEBUG("Xdnd cancelled\n"); + A5O_DEBUG("Xdnd cancelled\n"); } return false; } @@ -277,10 +277,10 @@ static char *_uri_to_filename(char *uri) return uri; } -bool _al_display_xglx_handle_drag_and_drop_selection(ALLEGRO_SYSTEM_XGLX *s, - ALLEGRO_DISPLAY_XGLX *allegro_display, XEvent *xevent) +bool _al_display_xglx_handle_drag_and_drop_selection(A5O_SYSTEM_XGLX *s, + A5O_DISPLAY_XGLX *allegro_display, XEvent *xevent) { - if (!(allegro_display->display.flags & ALLEGRO_DRAG_AND_DROP)) + if (!(allegro_display->display.flags & A5O_DRAG_AND_DROP)) return false; Atom target = xevent->xselection.target; @@ -288,17 +288,17 @@ bool _al_display_xglx_handle_drag_and_drop_selection(ALLEGRO_SYSTEM_XGLX *s, Property p; read_property(&p, s->x11display, allegro_display->window, s->dnd_info.PRIMARY); if (p.format == 8) { - ALLEGRO_USTR *text = al_ustr_new((char *)p.data); + A5O_USTR *text = al_ustr_new((char *)p.data); char *name = XGetAtomName(s->x11display, target); if (name) { - ALLEGRO_INFO("Xdnd data received, format '%s'\n", name); + A5O_INFO("Xdnd data received, format '%s'\n", name); int pos = 0; int row = 0; bool complete = false; while (!complete) { int pos2 = al_ustr_find_set_cstr(text, pos, "\r\n"); if (pos2 == -1) pos2 = al_ustr_size(text); - ALLEGRO_USTR *token = al_ustr_dup_substr(text, pos, pos2); + A5O_USTR *token = al_ustr_dup_substr(text, pos, pos2); if (al_ustr_get(text, pos2) == '\r') al_ustr_next(text, &pos2); if (al_ustr_get(text, pos2) == '\n') al_ustr_next(text, &pos2); if (al_ustr_get(text, pos2) == -1) complete = true; @@ -312,7 +312,7 @@ bool _al_display_xglx_handle_drag_and_drop_selection(ALLEGRO_SYSTEM_XGLX *s, _send_event(allegro_display, filename, true, row, complete); } else { - ALLEGRO_WARN("Attempt to drop unknown format '%s'\n", name); + A5O_WARN("Attempt to drop unknown format '%s'\n", name); } al_ustr_free(token); row++; @@ -327,16 +327,16 @@ bool _al_display_xglx_handle_drag_and_drop_selection(ALLEGRO_SYSTEM_XGLX *s, if (p.data) XFree(p.data); x11_reply(s, allegro_display, s->dnd_info.xdnd_source, s->dnd_info.XdndFinished); - ALLEGRO_DEBUG("Xdnd completed\n"); + A5O_DEBUG("Xdnd completed\n"); return true; } return false; } -void _al_xwin_accept_drag_and_drop(ALLEGRO_DISPLAY *display, bool accept) +void _al_xwin_accept_drag_and_drop(A5O_DISPLAY *display, bool accept) { - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; Atom XdndAware = XInternAtom(system->x11display, "XdndAware", False); diff --git a/src/x/xevents.c b/src/x/xevents.c index 4824501562..035e9bedb7 100644 --- a/src/x/xevents.c +++ b/src/x/xevents.c @@ -14,42 +14,42 @@ #include "allegro5/internal/aintern_xtouch.h" #include "allegro5/internal/aintern_xdnd.h" -#ifdef ALLEGRO_RASPBERRYPI +#ifdef A5O_RASPBERRYPI #include "allegro5/internal/aintern_raspberrypi.h" -#define ALLEGRO_SYSTEM_XGLX ALLEGRO_SYSTEM_RASPBERRYPI -#define ALLEGRO_DISPLAY_XGLX ALLEGRO_DISPLAY_RASPBERRYPI +#define A5O_SYSTEM_XGLX A5O_SYSTEM_RASPBERRYPI +#define A5O_DISPLAY_XGLX A5O_DISPLAY_RASPBERRYPI #endif -ALLEGRO_DEBUG_CHANNEL("xevents") +A5O_DEBUG_CHANNEL("xevents") /* Handle an X11 close button event. [X11 thread] * Only called from the event handler with the system locked. */ -void _al_display_xglx_closebutton(ALLEGRO_DISPLAY *d, XEvent *xevent) +void _al_display_xglx_closebutton(A5O_DISPLAY *d, XEvent *xevent) { - ALLEGRO_EVENT_SOURCE *es = &d->es; + A5O_EVENT_SOURCE *es = &d->es; (void)xevent; _al_event_source_lock(es); if (_al_event_source_needs_to_generate_event(es)) { - ALLEGRO_EVENT event; - event.display.type = ALLEGRO_EVENT_DISPLAY_CLOSE; + A5O_EVENT event; + event.display.type = A5O_EVENT_DISPLAY_CLOSE; event.display.timestamp = al_get_time(); _al_event_source_emit_event(es, &event); } _al_event_source_unlock(es); } -static void process_x11_event(ALLEGRO_SYSTEM_XGLX *s, XEvent event) +static void process_x11_event(A5O_SYSTEM_XGLX *s, XEvent event) { unsigned int i; - ALLEGRO_DISPLAY_XGLX *d = NULL; + A5O_DISPLAY_XGLX *d = NULL; /* With many windows, it's bad to loop through them all, but typically * we have one or at most two or so. */ for (i = 0; i < _al_vector_size(&s->system.displays); i++) { - ALLEGRO_DISPLAY_XGLX **dptr = _al_vector_ref(&s->system.displays, i); + A5O_DISPLAY_XGLX **dptr = _al_vector_ref(&s->system.displays, i); d = *dptr; if (d->window == event.xany.window) { break; @@ -94,7 +94,7 @@ static void process_x11_event(ALLEGRO_SYSTEM_XGLX *s, XEvent event) if (_al_display_xglx_handle_drag_and_drop(s, d, &event)) { break; } -#ifndef ALLEGRO_RASPBERRYPI +#ifndef A5O_RASPBERRYPI if (event.xclient.message_type == s->XEmbedAtom) { const long xtime = event.xclient.data.l[0]; const long major = event.xclient.data.l[1]; @@ -109,15 +109,15 @@ static void process_x11_event(ALLEGRO_SYSTEM_XGLX *s, XEvent event) switch (major) { case XEMBED_EMBEDDED_NOTIFY: d->embedder_window = data1; - ALLEGRO_INFO("XEmbed begin: embedder window = %ld\n", data1); + A5O_INFO("XEmbed begin: embedder window = %ld\n", data1); break; case XEMBED_FOCUS_IN: - ALLEGRO_DEBUG("XEmbed focus in\n"); + A5O_DEBUG("XEmbed focus in\n"); _al_xwin_display_switch_handler_inner(&d->display, true); _al_xwin_keyboard_switch_handler(&d->display, true); break; case XEMBED_FOCUS_OUT: - ALLEGRO_DEBUG("XEmbed focus out\n"); + A5O_DEBUG("XEmbed focus out\n"); _al_xwin_display_switch_handler_inner(&d->display, false); _al_xwin_keyboard_switch_handler(&d->display, false); break; @@ -145,21 +145,21 @@ static void process_x11_event(ALLEGRO_SYSTEM_XGLX *s, XEvent event) _al_cond_signal(&s->resized); break; case MapNotify: - d->display.flags &= ~ALLEGRO_MINIMIZED; + d->display.flags &= ~A5O_MINIMIZED; d->is_mapped = true; _al_cond_signal(&d->mapped); break; case UnmapNotify: - d->display.flags |= ALLEGRO_MINIMIZED; + d->display.flags |= A5O_MINIMIZED; break; case Expose: - if (d->display.flags & ALLEGRO_GENERATE_EXPOSE_EVENTS) { + if (d->display.flags & A5O_GENERATE_EXPOSE_EVENTS) { _al_xwin_display_expose(&d->display, &event.xexpose); } break; case ReparentNotify: if (event.xreparent.parent == RootWindow(s->x11display, d->xscreen)) { - ALLEGRO_INFO("XEmbed protocol finished.\n"); + A5O_INFO("XEmbed protocol finished.\n"); d->embedder_window = None; } break; @@ -186,7 +186,7 @@ static void process_x11_event(ALLEGRO_SYSTEM_XGLX *s, XEvent event) void _al_xwin_background_thread(_AL_THREAD *self, void *arg) { - ALLEGRO_SYSTEM_XGLX *s = arg; + A5O_SYSTEM_XGLX *s = arg; XEvent event; double last_reset_screensaver_time = 0.0; diff --git a/src/x/xfullscreen.c b/src/x/xfullscreen.c index 0651e46679..07284e311d 100644 --- a/src/x/xfullscreen.c +++ b/src/x/xfullscreen.c @@ -6,17 +6,17 @@ #include "allegro5/internal/aintern_xfullscreen.h" #include "allegro5/internal/aintern_xsystem.h" -ALLEGRO_DEBUG_CHANNEL("display") +A5O_DEBUG_CHANNEL("display") -/* globals - this might be better in ALLEGRO_SYSTEM_XGLX */ -_ALLEGRO_XGLX_MMON_INTERFACE _al_xglx_mmon_interface; +/* globals - this might be better in A5O_SYSTEM_XGLX */ +_A5O_XGLX_MMON_INTERFACE _al_xglx_mmon_interface; /* generic multi-head x */ -int _al_xsys_mheadx_get_default_adapter(ALLEGRO_SYSTEM_XGLX *s) +int _al_xsys_mheadx_get_default_adapter(A5O_SYSTEM_XGLX *s) { int i; - ALLEGRO_DEBUG("mhead get default adapter\n"); + A5O_DEBUG("mhead get default adapter\n"); if (ScreenCount(s->x11display) == 1) return 0; @@ -29,18 +29,18 @@ int _al_xsys_mheadx_get_default_adapter(ALLEGRO_SYSTEM_XGLX *s) Screen *focus_screen; if (!XGetInputFocus(s->x11display, &focus, &revert_to)) { - ALLEGRO_ERROR("XGetInputFocus failed!"); + A5O_ERROR("XGetInputFocus failed!"); _al_mutex_unlock(&s->lock); return 0; } if (focus == None) { - ALLEGRO_ERROR("XGetInputFocus returned None!\n"); + A5O_ERROR("XGetInputFocus returned None!\n"); _al_mutex_unlock(&s->lock); return 0; } else if (focus == PointerRoot) { - ALLEGRO_DEBUG("XGetInputFocus returned PointerRoot.\n"); + A5O_DEBUG("XGetInputFocus returned PointerRoot.\n"); /* XXX TEST THIS >:( */ Window root, child; int root_x, root_y; @@ -48,7 +48,7 @@ int _al_xsys_mheadx_get_default_adapter(ALLEGRO_SYSTEM_XGLX *s) unsigned int mask; if (XQueryPointer(s->x11display, focus, &root, &child, &root_x, &root_y, &win_x, &win_y, &mask) == False) { - ALLEGRO_ERROR("XQueryPointer failed :("); + A5O_ERROR("XQueryPointer failed :("); _al_mutex_unlock(&s->lock); return 0; } @@ -56,7 +56,7 @@ int _al_xsys_mheadx_get_default_adapter(ALLEGRO_SYSTEM_XGLX *s) focus = root; } else { - ALLEGRO_DEBUG("XGetInputFocus returned %i!\n", (int)focus); + A5O_DEBUG("XGetInputFocus returned %i!\n", (int)focus); } XGetWindowAttributes(s->x11display, focus, &attr); @@ -76,10 +76,10 @@ int _al_xsys_mheadx_get_default_adapter(ALLEGRO_SYSTEM_XGLX *s) } /* in pure multi-head mode, allegro's virtual adapters map directly to X Screens. */ -int _al_xsys_mheadx_get_xscreen(ALLEGRO_SYSTEM_XGLX *s, int adapter) +int _al_xsys_mheadx_get_xscreen(A5O_SYSTEM_XGLX *s, int adapter) { (void)s; - ALLEGRO_DEBUG("mhead get screen %i\n", adapter); + A5O_DEBUG("mhead get screen %i\n", adapter); return adapter; } @@ -88,7 +88,7 @@ Returns the parent window of "window" (i.e. the ancestor of window that is a direct child of the root, or window itself if it is a direct child). If window is the root window, returns window. */ -static Window get_toplevel_parent(ALLEGRO_SYSTEM_XGLX *s, Window window) +static Window get_toplevel_parent(A5O_SYSTEM_XGLX *s, Window window) { Window parent; Window root; @@ -100,7 +100,7 @@ static Window get_toplevel_parent(ALLEGRO_SYSTEM_XGLX *s, Window window) * for some reason 'window' isn't valid when the mouse happens * to be over the windeco when this is called.. */ if (0 == XQueryTree(s->x11display, window, &root, &parent, &children, &num_children)) { - ALLEGRO_ERROR("XQueryTree error\n"); + A5O_ERROR("XQueryTree error\n"); return None; } if (children) { /* must test for NULL */ @@ -118,7 +118,7 @@ static Window get_toplevel_parent(ALLEGRO_SYSTEM_XGLX *s, Window window) } /* used for xinerama and pure xrandr modes */ -void _al_xsys_get_active_window_center(ALLEGRO_SYSTEM_XGLX *s, int *x, int *y) +void _al_xsys_get_active_window_center(A5O_SYSTEM_XGLX *s, int *x, int *y) { Window focus; int revert_to = 0; @@ -126,13 +126,13 @@ void _al_xsys_get_active_window_center(ALLEGRO_SYSTEM_XGLX *s, int *x, int *y) _al_mutex_lock(&s->lock); if (!XGetInputFocus(s->x11display, &focus, &revert_to)) { - ALLEGRO_ERROR("XGetInputFocus failed!\n"); + A5O_ERROR("XGetInputFocus failed!\n"); _al_mutex_unlock(&s->lock); return; } if (focus == None || focus == PointerRoot) { - ALLEGRO_DEBUG("XGetInputFocus returned special window, selecting default root!\n"); + A5O_DEBUG("XGetInputFocus returned special window, selecting default root!\n"); focus = DefaultRootWindow(s->x11display); } else { @@ -144,12 +144,12 @@ void _al_xsys_get_active_window_center(ALLEGRO_SYSTEM_XGLX *s, int *x, int *y) focus = get_toplevel_parent(s, focus); } - ALLEGRO_DEBUG("XGetInputFocus returned %i\n", (int)focus); + A5O_DEBUG("XGetInputFocus returned %i\n", (int)focus); XWindowAttributes attr; if (XGetWindowAttributes(s->x11display, focus, &attr) == 0) { - ALLEGRO_ERROR("XGetWindowAttributes failed :(\n"); + A5O_ERROR("XGetWindowAttributes failed :(\n"); _al_mutex_unlock(&s->lock); return; } @@ -158,7 +158,7 @@ void _al_xsys_get_active_window_center(ALLEGRO_SYSTEM_XGLX *s, int *x, int *y) /* check the center of the window with focus * might be a bit more useful than just checking the top left */ - ALLEGRO_DEBUG("focus geom: %ix%i %ix%i\n", attr.x, attr.y, attr.width, attr.height); + A5O_DEBUG("focus geom: %ix%i %ix%i\n", attr.x, attr.y, attr.width, attr.height); *x = (attr.x + (attr.x + attr.width)) / 2; *y = (attr.y + (attr.y + attr.height)) / 2; } @@ -169,9 +169,9 @@ void _al_xsys_get_active_window_center(ALLEGRO_SYSTEM_XGLX *s, int *x, int *y) * */ -#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA +#ifdef A5O_XWINDOWS_WITH_XINERAMA -static void xinerama_init(ALLEGRO_SYSTEM_XGLX *s) +static void xinerama_init(A5O_SYSTEM_XGLX *s) { int event_base = 0; int error_base = 0; @@ -186,36 +186,36 @@ static void xinerama_init(ALLEGRO_SYSTEM_XGLX *s) if (XineramaQueryExtension(s->x11display, &event_base, &error_base)) { int minor_version = 0, major_version = 0; int status = XineramaQueryVersion(s->x11display, &major_version, &minor_version); - ALLEGRO_INFO("Xinerama version: %i.%i\n", major_version, minor_version); + A5O_INFO("Xinerama version: %i.%i\n", major_version, minor_version); if (status && !XineramaIsActive(s->x11display)) { - ALLEGRO_WARN("Xinerama is not active\n"); + A5O_WARN("Xinerama is not active\n"); } else { s->xinerama_screen_info = XineramaQueryScreens(s->x11display, &s->xinerama_screen_count); if (!s->xinerama_screen_info) { - ALLEGRO_ERROR("Xinerama failed to query screens.\n"); + A5O_ERROR("Xinerama failed to query screens.\n"); } else { s->xinerama_available = 1; - ALLEGRO_INFO("Xinerama is active\n"); + A5O_INFO("Xinerama is active\n"); } } } if (!s->xinerama_available) { - ALLEGRO_WARN("Xinerama extension is not available.\n"); + A5O_WARN("Xinerama extension is not available.\n"); } _al_mutex_unlock(&s->lock); } -static void xinerama_exit(ALLEGRO_SYSTEM_XGLX *s) +static void xinerama_exit(A5O_SYSTEM_XGLX *s) { if (!s->xinerama_available) return; - ALLEGRO_DEBUG("xfullscreen: xinerama exit.\n"); + A5O_DEBUG("xfullscreen: xinerama exit.\n"); if (s->xinerama_screen_info) XFree(s->xinerama_screen_info); @@ -224,17 +224,17 @@ static void xinerama_exit(ALLEGRO_SYSTEM_XGLX *s) s->xinerama_screen_info = NULL; } -#ifdef ALLEGRO_XWINDOWS_WITH_XF86VIDMODE +#ifdef A5O_XWINDOWS_WITH_XF86VIDMODE -static void xinerama_get_display_offset(ALLEGRO_SYSTEM_XGLX *s, int adapter, int *x, int *y) +static void xinerama_get_display_offset(A5O_SYSTEM_XGLX *s, int adapter, int *x, int *y) { - ALLEGRO_ASSERT(adapter >= 0 && adapter < s->xinerama_screen_count); + A5O_ASSERT(adapter >= 0 && adapter < s->xinerama_screen_count); *x = s->xinerama_screen_info[adapter].x_org; *y = s->xinerama_screen_info[adapter].y_org; - ALLEGRO_DEBUG("xinerama dpy off %ix%i\n", *x, *y); + A5O_DEBUG("xinerama dpy off %ix%i\n", *x, *y); } -static bool xinerama_get_monitor_info(ALLEGRO_SYSTEM_XGLX *s, int adapter, ALLEGRO_MONITOR_INFO *mi) +static bool xinerama_get_monitor_info(A5O_SYSTEM_XGLX *s, int adapter, A5O_MONITOR_INFO *mi) { if (adapter < 0 || adapter >= s->xinerama_screen_count) return false; @@ -246,7 +246,7 @@ static bool xinerama_get_monitor_info(ALLEGRO_SYSTEM_XGLX *s, int adapter, ALLEG return true; } -static ALLEGRO_DISPLAY_MODE *xinerama_get_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter, int i, ALLEGRO_DISPLAY_MODE *mode) +static A5O_DISPLAY_MODE *xinerama_get_mode(A5O_SYSTEM_XGLX *s, int adapter, int i, A5O_DISPLAY_MODE *mode) { if (adapter < 0 || adapter >= s->xinerama_screen_count) return NULL; @@ -262,39 +262,39 @@ static ALLEGRO_DISPLAY_MODE *xinerama_get_mode(ALLEGRO_SYSTEM_XGLX *s, int adapt return mode; } -static int xinerama_get_default_adapter(ALLEGRO_SYSTEM_XGLX *s) +static int xinerama_get_default_adapter(A5O_SYSTEM_XGLX *s) { int center_x = 0, center_y = 0; - ALLEGRO_DEBUG("xinerama get default adapter\n"); + A5O_DEBUG("xinerama get default adapter\n"); _al_xsys_get_active_window_center(s, ¢er_x, ¢er_y); - ALLEGRO_DEBUG("xinerama got active center: %ix%i\n", center_x, center_y); + A5O_DEBUG("xinerama got active center: %ix%i\n", center_x, center_y); int i; for (i = 0; i < s->xinerama_screen_count; i++) { if (center_x >= s->xinerama_screen_info[i].x_org && center_x <= s->xinerama_screen_info[i].x_org + s->xinerama_screen_info[i].width && center_y >= s->xinerama_screen_info[i].y_org && center_y <= s->xinerama_screen_info[i].y_org + s->xinerama_screen_info[i].height) { - ALLEGRO_DEBUG("center is inside (%i) %ix%i %ix%i\n", i, s->xinerama_screen_info[i].x_org, s->xinerama_screen_info[i].y_org, s->xinerama_screen_info[i].width, s->xinerama_screen_info[i].height); + A5O_DEBUG("center is inside (%i) %ix%i %ix%i\n", i, s->xinerama_screen_info[i].x_org, s->xinerama_screen_info[i].y_org, s->xinerama_screen_info[i].width, s->xinerama_screen_info[i].height); return i; } } - ALLEGRO_DEBUG("xinerama returning default 0\n"); + A5O_DEBUG("xinerama returning default 0\n"); return 0; } /* similar to multi-head x, but theres only one X Screen, so we return 0 always */ -static int xinerama_get_xscreen(ALLEGRO_SYSTEM_XGLX *s, int adapter) +static int xinerama_get_xscreen(A5O_SYSTEM_XGLX *s, int adapter) { (void)s; (void)adapter; return 0; } -#endif /* ALLEGRO_XWINDOWS_WITH_XF86VIDMODE */ +#endif /* A5O_XWINDOWS_WITH_XF86VIDMODE */ -#endif /* ALLEGRO_XWINDOWS_WITH_XINERAMA */ +#endif /* A5O_XWINDOWS_WITH_XINERAMA */ @@ -304,12 +304,12 @@ static int xinerama_get_xscreen(ALLEGRO_SYSTEM_XGLX *s, int adapter) * */ -#ifdef ALLEGRO_XWINDOWS_WITH_XF86VIDMODE +#ifdef A5O_XWINDOWS_WITH_XF86VIDMODE // XXX retest under multi-head! -static int xfvm_get_num_modes(ALLEGRO_SYSTEM_XGLX *s, int adapter) +static int xfvm_get_num_modes(A5O_SYSTEM_XGLX *s, int adapter) { -#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA +#ifdef A5O_XWINDOWS_WITH_XINERAMA if (s->xinerama_available && s->xinerama_screen_count != s->xfvm_screen_count) { if (adapter < 0 || adapter > s->xinerama_screen_count) return 0; @@ -329,11 +329,11 @@ static int xfvm_get_num_modes(ALLEGRO_SYSTEM_XGLX *s, int adapter) return s->xfvm_screen[adapter].mode_count; } -static ALLEGRO_DISPLAY_MODE *xfvm_get_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter, int i, ALLEGRO_DISPLAY_MODE *mode) +static A5O_DISPLAY_MODE *xfvm_get_mode(A5O_SYSTEM_XGLX *s, int adapter, int i, A5O_DISPLAY_MODE *mode) { int denom; -#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA +#ifdef A5O_XWINDOWS_WITH_XINERAMA /* TwinView gives us one large screen via xfvm, and no way to * properly change modes on individual monitors, so we want to query * xinerama for the lone mode. */ @@ -360,12 +360,12 @@ static ALLEGRO_DISPLAY_MODE *xfvm_get_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter, return mode; } -static bool xfvm_set_mode(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, int w, int h, int format, int refresh_rate) +static bool xfvm_set_mode(A5O_SYSTEM_XGLX *s, A5O_DISPLAY_XGLX *d, int w, int h, int format, int refresh_rate) { int mode_idx = -1; int adapter = _al_xglx_get_adapter(s, d, false); -#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA +#ifdef A5O_XWINDOWS_WITH_XINERAMA /* TwinView workarounds, nothing to do here, since we can't really change or restore modes */ if (s->xinerama_available && s->xinerama_screen_count != s->xfvm_screen_count) { /* at least pretend we set a mode if its the current mode */ @@ -381,20 +381,20 @@ static bool xfvm_set_mode(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, int w return false; if (!XF86VidModeSwitchToMode(s->x11display, adapter, s->xfvm_screen[adapter].modes[mode_idx])) { - ALLEGRO_ERROR("xfullscreen: XF86VidModeSwitchToMode failed\n"); + A5O_ERROR("xfullscreen: XF86VidModeSwitchToMode failed\n"); return false; } return true; } -static void xfvm_store_video_mode(ALLEGRO_SYSTEM_XGLX *s) +static void xfvm_store_video_mode(A5O_SYSTEM_XGLX *s) { int n; - ALLEGRO_DEBUG("xfullscreen: xfvm_store_video_mode\n"); + A5O_DEBUG("xfullscreen: xfvm_store_video_mode\n"); -#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA +#ifdef A5O_XWINDOWS_WITH_XINERAMA /* TwinView workarounds, nothing to do here, since we can't really change or restore modes */ if (s->xinerama_available && s->xinerama_screen_count != s->xfvm_screen_count) { return; @@ -414,19 +414,19 @@ static void xfvm_store_video_mode(ALLEGRO_SYSTEM_XGLX *s) int j; for (j = 0; j < s->xfvm_screen[i].mode_count; j++) { - ALLEGRO_DEBUG("xfvm: screen[%d] mode[%d] = (%d, %d)\n", + A5O_DEBUG("xfvm: screen[%d] mode[%d] = (%d, %d)\n", i, j, s->xfvm_screen[i].modes[j]->hdisplay, s->xfvm_screen[i].modes[j]->vdisplay); } - ALLEGRO_INFO("xfvm: screen[%d] original mode = (%d, %d)\n", + A5O_INFO("xfvm: screen[%d] original mode = (%d, %d)\n", i, s->xfvm_screen[i].original_mode->hdisplay, s->xfvm_screen[i].original_mode->vdisplay); } } -static void xfvm_restore_video_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter) +static void xfvm_restore_video_mode(A5O_SYSTEM_XGLX *s, int adapter) { Bool ok; -#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA +#ifdef A5O_XWINDOWS_WITH_XINERAMA /* TwinView workarounds, nothing to do here, since we can't really change or restore modes */ if (s->xinerama_available && s->xinerama_screen_count != s->xfvm_screen_count) { return; @@ -437,12 +437,12 @@ static void xfvm_restore_video_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter) return; ASSERT(s->xfvm_screen[adapter].original_mode); - ALLEGRO_DEBUG("xfullscreen: xfvm_restore_video_mode (%d, %d)\n", + A5O_DEBUG("xfullscreen: xfvm_restore_video_mode (%d, %d)\n", s->xfvm_screen[adapter].original_mode->hdisplay, s->xfvm_screen[adapter].original_mode->vdisplay); ok = XF86VidModeSwitchToMode(s->x11display, adapter, s->xfvm_screen[adapter].original_mode); if (!ok) { - ALLEGRO_ERROR("xfullscreen: XF86VidModeSwitchToMode failed\n"); + A5O_ERROR("xfullscreen: XF86VidModeSwitchToMode failed\n"); } if (s->mouse_grab_display) { @@ -457,11 +457,11 @@ static void xfvm_restore_video_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter) XFlush(s->gfxdisplay); } -static void xfvm_get_display_offset(ALLEGRO_SYSTEM_XGLX *s, int adapter, int *x, int *y) +static void xfvm_get_display_offset(A5O_SYSTEM_XGLX *s, int adapter, int *x, int *y) { int tmp_x = 0, tmp_y = 0; -#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA +#ifdef A5O_XWINDOWS_WITH_XINERAMA if (s->xinerama_available) { xinerama_get_display_offset(s, adapter, &tmp_x, &tmp_y); } //else @@ -480,12 +480,12 @@ static void xfvm_get_display_offset(ALLEGRO_SYSTEM_XGLX *s, int adapter, int *x, *x = tmp_x; *y = tmp_y; - ALLEGRO_DEBUG("xfvm dpy off %ix%i\n", *x, *y); + A5O_DEBUG("xfvm dpy off %ix%i\n", *x, *y); } -static int xfvm_get_num_adapters(ALLEGRO_SYSTEM_XGLX *s) +static int xfvm_get_num_adapters(A5O_SYSTEM_XGLX *s) { -#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA +#ifdef A5O_XWINDOWS_WITH_XINERAMA if (s->xinerama_available) { return s->xinerama_screen_count; } @@ -493,9 +493,9 @@ static int xfvm_get_num_adapters(ALLEGRO_SYSTEM_XGLX *s) return s->xfvm_screen_count; } -static bool xfvm_get_monitor_info(ALLEGRO_SYSTEM_XGLX *s, int adapter, ALLEGRO_MONITOR_INFO *mi) +static bool xfvm_get_monitor_info(A5O_SYSTEM_XGLX *s, int adapter, A5O_MONITOR_INFO *mi) { -#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA +#ifdef A5O_XWINDOWS_WITH_XINERAMA if (s->xinerama_available) { return xinerama_get_monitor_info(s, adapter, mi); } @@ -522,11 +522,11 @@ static bool xfvm_get_monitor_info(ALLEGRO_SYSTEM_XGLX *s, int adapter, ALLEGRO_M return true; } -static int xfvm_get_default_adapter(ALLEGRO_SYSTEM_XGLX *s) +static int xfvm_get_default_adapter(A5O_SYSTEM_XGLX *s) { - ALLEGRO_DEBUG("xfvm get default adapter\n"); + A5O_DEBUG("xfvm get default adapter\n"); -#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA +#ifdef A5O_XWINDOWS_WITH_XINERAMA if (s->xinerama_available) { return xinerama_get_default_adapter(s); } @@ -535,11 +535,11 @@ static int xfvm_get_default_adapter(ALLEGRO_SYSTEM_XGLX *s) return _al_xsys_mheadx_get_default_adapter(s); } -static int xfvm_get_xscreen(ALLEGRO_SYSTEM_XGLX *s, int adapter) +static int xfvm_get_xscreen(A5O_SYSTEM_XGLX *s, int adapter) { - ALLEGRO_DEBUG("xfvm get xscreen for adapter %i\n", adapter); + A5O_DEBUG("xfvm get xscreen for adapter %i\n", adapter); -#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA +#ifdef A5O_XWINDOWS_WITH_XINERAMA if (s->xinerama_available) { return xinerama_get_xscreen(s, adapter); } @@ -548,13 +548,13 @@ static int xfvm_get_xscreen(ALLEGRO_SYSTEM_XGLX *s, int adapter) return _al_xsys_mheadx_get_xscreen(s, adapter); } -static void xfvm_post_setup(ALLEGRO_SYSTEM_XGLX *s, - ALLEGRO_DISPLAY_XGLX *d) +static void xfvm_post_setup(A5O_SYSTEM_XGLX *s, + A5O_DISPLAY_XGLX *d) { int x = 0, y = 0; XWindowAttributes xwa; -#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA +#ifdef A5O_XWINDOWS_WITH_XINERAMA /* TwinView workarounds, nothing to do here, since we can't really change or restore modes */ if (s->xinerama_available && s->xinerama_screen_count != s->xfvm_screen_count) { return; @@ -571,13 +571,13 @@ static void xfvm_post_setup(ALLEGRO_SYSTEM_XGLX *s, x = xwa.x - x; y = xwa.y - y; - ALLEGRO_DEBUG("xfvm set view port: %ix%i\n", x, y); + A5O_DEBUG("xfvm set view port: %ix%i\n", x, y); XF86VidModeSetViewPort(s->x11display, adapter, x, y); } -static void xfvm_init(ALLEGRO_SYSTEM_XGLX *s) +static void xfvm_init(A5O_SYSTEM_XGLX *s) { int event_base = 0; int error_base = 0; @@ -592,24 +592,24 @@ static void xfvm_init(ALLEGRO_SYSTEM_XGLX *s) if (XF86VidModeQueryExtension(s->x11display, &event_base, &error_base)) { int minor_version = 0, major_version = 0; int status = XF86VidModeQueryVersion(s->x11display, &major_version, &minor_version); - ALLEGRO_INFO("XF86VidMode version: %i.%i\n", major_version, minor_version); + A5O_INFO("XF86VidMode version: %i.%i\n", major_version, minor_version); if (!status) { - ALLEGRO_WARN("XF86VidMode not available, XF86VidModeQueryVersion failed.\n"); + A5O_WARN("XF86VidMode not available, XF86VidModeQueryVersion failed.\n"); } else { // I don't actually know what versions are required here, just going to assume any is ok for now. - ALLEGRO_INFO("XF86VidMode %i.%i is active\n", major_version, minor_version); + A5O_INFO("XF86VidMode %i.%i is active\n", major_version, minor_version); s->xfvm_available = 1; } } else { - ALLEGRO_WARN("XF86VidMode extension is not available.\n"); + A5O_WARN("XF86VidMode extension is not available.\n"); } if (s->xfvm_available) { int num_screens; -#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA +#ifdef A5O_XWINDOWS_WITH_XINERAMA /* This is some fun stuff right here, if XRANDR is available, we can't use the xinerama screen count * and we really want the xrandr init in xglx_initialize to come last so it overrides xf86vm if available * and I really don't want to add more XRRQuery* or #ifdefs here. @@ -635,18 +635,18 @@ static void xfvm_init(ALLEGRO_SYSTEM_XGLX *s) num_screens = ScreenCount(s->x11display); } - ALLEGRO_DEBUG("XF86VidMode Got %d screens.\n", num_screens); + A5O_DEBUG("XF86VidMode Got %d screens.\n", num_screens); s->xfvm_screen_count = num_screens; s->xfvm_screen = al_calloc(num_screens, sizeof(*s->xfvm_screen)); if (!s->xfvm_screen) { - ALLEGRO_ERROR("XF86VidMode: failed to allocate screen array.\n"); + A5O_ERROR("XF86VidMode: failed to allocate screen array.\n"); s->xfvm_available = 0; } else { int i; for (i = 0; i < num_screens; i++) { - ALLEGRO_DEBUG("XF86VidMode GetAllModeLines on screen %d.\n", i); + A5O_DEBUG("XF86VidMode GetAllModeLines on screen %d.\n", i); if (!XF86VidModeGetAllModeLines(s->x11display, i, &(s->xfvm_screen[i].mode_count), &(s->xfvm_screen[i].modes))) { /* XXX what to do here? */ } @@ -669,10 +669,10 @@ static void xfvm_init(ALLEGRO_SYSTEM_XGLX *s) _al_mutex_unlock(&s->lock); } -static void xfvm_exit(ALLEGRO_SYSTEM_XGLX *s) +static void xfvm_exit(A5O_SYSTEM_XGLX *s) { int adapter; - ALLEGRO_DEBUG("xfullscreen: XFVM exit\n"); + A5O_DEBUG("xfullscreen: XFVM exit\n"); for (adapter = 0; adapter < s->xfvm_screen_count; adapter++) { if (s->xfvm_screen[adapter].mode_count > 0) { @@ -689,14 +689,14 @@ static void xfvm_exit(ALLEGRO_SYSTEM_XGLX *s) s->xfvm_screen[adapter].modes = NULL; s->xfvm_screen[adapter].original_mode = NULL; - ALLEGRO_DEBUG("xfullscreen: XFVM freed adapter %d.\n", adapter); + A5O_DEBUG("xfullscreen: XFVM freed adapter %d.\n", adapter); } al_free(s->xfvm_screen); s->xfvm_screen = NULL; } -#endif /* ALLEGRO_XWINDOWS_WITH_XF86VIDMODE */ +#endif /* A5O_XWINDOWS_WITH_XF86VIDMODE */ @@ -706,10 +706,10 @@ static void xfvm_exit(ALLEGRO_SYSTEM_XGLX *s) * */ -static bool init_mmon_interface(ALLEGRO_SYSTEM_XGLX *s) +static bool init_mmon_interface(A5O_SYSTEM_XGLX *s) { if (s->x11display == NULL) { - ALLEGRO_WARN("Not connected to X server.\n"); + A5O_WARN("Not connected to X server.\n"); return false; } @@ -723,15 +723,15 @@ static bool init_mmon_interface(ALLEGRO_SYSTEM_XGLX *s) * incase there are multiple screens. */ -#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA +#ifdef A5O_XWINDOWS_WITH_XINERAMA xinerama_init(s); #endif -#ifdef ALLEGRO_XWINDOWS_WITH_XF86VIDMODE +#ifdef A5O_XWINDOWS_WITH_XF86VIDMODE xfvm_init(s); #endif -#ifdef ALLEGRO_XWINDOWS_WITH_XRANDR +#ifdef A5O_XWINDOWS_WITH_XRANDR _al_xsys_xrandr_init(s); #endif @@ -743,27 +743,27 @@ static bool init_mmon_interface(ALLEGRO_SYSTEM_XGLX *s) return true; } -void _al_xsys_mmon_exit(ALLEGRO_SYSTEM_XGLX *s) +void _al_xsys_mmon_exit(A5O_SYSTEM_XGLX *s) { if (!s->mmon_interface_inited) return; -#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA +#ifdef A5O_XWINDOWS_WITH_XINERAMA xinerama_exit(s); #endif -#ifdef ALLEGRO_XWINDOWS_WITH_XF86VIDMODE +#ifdef A5O_XWINDOWS_WITH_XF86VIDMODE xfvm_exit(s); #endif -#ifdef ALLEGRO_XWINDOWS_WITH_XRANDR +#ifdef A5O_XWINDOWS_WITH_XRANDR _al_xsys_xrandr_exit(s); #endif s->mmon_interface_inited = false; } -int _al_xglx_get_num_display_modes(ALLEGRO_SYSTEM_XGLX *s, int adapter) +int _al_xglx_get_num_display_modes(A5O_SYSTEM_XGLX *s, int adapter) { if (!init_mmon_interface(s)) return 0; @@ -781,8 +781,8 @@ int _al_xglx_get_num_display_modes(ALLEGRO_SYSTEM_XGLX *s, int adapter) return _al_xglx_mmon_interface.get_num_display_modes(s, adapter); } -ALLEGRO_DISPLAY_MODE *_al_xglx_get_display_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter, int index, - ALLEGRO_DISPLAY_MODE *mode) +A5O_DISPLAY_MODE *_al_xglx_get_display_mode(A5O_SYSTEM_XGLX *s, int adapter, int index, + A5O_DISPLAY_MODE *mode) { if (!init_mmon_interface(s)) return NULL; @@ -801,7 +801,7 @@ ALLEGRO_DISPLAY_MODE *_al_xglx_get_display_mode(ALLEGRO_SYSTEM_XGLX *s, int adap return _al_xglx_mmon_interface.get_display_mode(s, adapter, index, mode); } -int _al_xglx_fullscreen_select_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter, int w, int h, int format, int refresh_rate) +int _al_xglx_fullscreen_select_mode(A5O_SYSTEM_XGLX *s, int adapter, int w, int h, int format, int refresh_rate) { int i; int n; @@ -817,7 +817,7 @@ int _al_xglx_fullscreen_select_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter, int w, return -1; /* Find all modes with correct parameters. */ - ALLEGRO_DISPLAY_MODE mode = {0, 0, 0, 0}; + A5O_DISPLAY_MODE mode = {0, 0, 0, 0}; int possible_modes[n]; int possible_count = 0; for (i = 0; i < n; i++) { @@ -838,7 +838,7 @@ int _al_xglx_fullscreen_select_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter, int w, int best_mode = possible_modes[0]; _al_xglx_get_display_mode(s, adapter, best_mode, &mode); for (i = 1; i < possible_count; i++) { - ALLEGRO_DISPLAY_MODE mode2; + A5O_DISPLAY_MODE mode2; if (!_al_xglx_get_display_mode(s, adapter, possible_modes[i], &mode2)) { continue; } @@ -848,13 +848,13 @@ int _al_xglx_fullscreen_select_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter, int w, } } - ALLEGRO_INFO("best mode [%d] = (%d, %d)\n", best_mode, mode.width, mode.height); + A5O_INFO("best mode [%d] = (%d, %d)\n", best_mode, mode.width, mode.height); return best_mode; } -bool _al_xglx_fullscreen_set_mode(ALLEGRO_SYSTEM_XGLX *s, - ALLEGRO_DISPLAY_XGLX *d, int w, int h, int format, int refresh_rate) +bool _al_xglx_fullscreen_set_mode(A5O_SYSTEM_XGLX *s, + A5O_DISPLAY_XGLX *d, int w, int h, int format, int refresh_rate) { if (!init_mmon_interface(s)) return false; @@ -865,8 +865,8 @@ bool _al_xglx_fullscreen_set_mode(ALLEGRO_SYSTEM_XGLX *s, return _al_xglx_mmon_interface.set_mode(s, d, w, h, format, refresh_rate); } -void _al_xglx_fullscreen_to_display(ALLEGRO_SYSTEM_XGLX *s, - ALLEGRO_DISPLAY_XGLX *d) +void _al_xglx_fullscreen_to_display(A5O_SYSTEM_XGLX *s, + A5O_DISPLAY_XGLX *d) { if (!init_mmon_interface(s)) return; @@ -878,7 +878,7 @@ void _al_xglx_fullscreen_to_display(ALLEGRO_SYSTEM_XGLX *s, } -void _al_xglx_store_video_mode(ALLEGRO_SYSTEM_XGLX *s) +void _al_xglx_store_video_mode(A5O_SYSTEM_XGLX *s) { if (!init_mmon_interface(s)) return; @@ -889,7 +889,7 @@ void _al_xglx_store_video_mode(ALLEGRO_SYSTEM_XGLX *s) _al_xglx_mmon_interface.store_mode(s); } -void _al_xglx_restore_video_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter) +void _al_xglx_restore_video_mode(A5O_SYSTEM_XGLX *s, int adapter) { if (!init_mmon_interface(s)) return; @@ -900,7 +900,7 @@ void _al_xglx_restore_video_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter) _al_xglx_mmon_interface.restore_mode(s, adapter); } -void _al_xglx_get_display_offset(ALLEGRO_SYSTEM_XGLX *s, int adapter, int *x, int *y) +void _al_xglx_get_display_offset(A5O_SYSTEM_XGLX *s, int adapter, int *x, int *y) { if (!init_mmon_interface(s)) return; @@ -911,7 +911,7 @@ void _al_xglx_get_display_offset(ALLEGRO_SYSTEM_XGLX *s, int adapter, int *x, in _al_xglx_mmon_interface.get_display_offset(s, adapter, x, y); } -bool _al_xglx_get_monitor_info(ALLEGRO_SYSTEM_XGLX *s, int adapter, ALLEGRO_MONITOR_INFO *info) +bool _al_xglx_get_monitor_info(A5O_SYSTEM_XGLX *s, int adapter, A5O_MONITOR_INFO *info) { if (!init_mmon_interface(s)) return false; @@ -929,7 +929,7 @@ bool _al_xglx_get_monitor_info(ALLEGRO_SYSTEM_XGLX *s, int adapter, ALLEGRO_MONI return _al_xglx_mmon_interface.get_monitor_info(s, adapter, info); } -int _al_xglx_get_num_video_adapters(ALLEGRO_SYSTEM_XGLX *s) +int _al_xglx_get_num_video_adapters(A5O_SYSTEM_XGLX *s) { if (!init_mmon_interface(s)) return 0; @@ -940,9 +940,9 @@ int _al_xglx_get_num_video_adapters(ALLEGRO_SYSTEM_XGLX *s) return _al_xglx_mmon_interface.get_num_adapters(s); } -int _al_xglx_get_default_adapter(ALLEGRO_SYSTEM_XGLX *s) +int _al_xglx_get_default_adapter(A5O_SYSTEM_XGLX *s) { - ALLEGRO_DEBUG("get default adapter\n"); + A5O_DEBUG("get default adapter\n"); if (!init_mmon_interface(s)) return 0; @@ -953,9 +953,9 @@ int _al_xglx_get_default_adapter(ALLEGRO_SYSTEM_XGLX *s) return _al_xglx_mmon_interface.get_default_adapter(s); } -int _al_xglx_get_xscreen(ALLEGRO_SYSTEM_XGLX *s, int adapter) +int _al_xglx_get_xscreen(A5O_SYSTEM_XGLX *s, int adapter) { - ALLEGRO_DEBUG("get xscreen\n"); + A5O_DEBUG("get xscreen\n"); if (!init_mmon_interface(s)) return 0; @@ -966,7 +966,7 @@ int _al_xglx_get_xscreen(ALLEGRO_SYSTEM_XGLX *s, int adapter) return _al_xglx_mmon_interface.get_xscreen(s, adapter); } -int _al_xglx_get_adapter(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, bool recalc) +int _al_xglx_get_adapter(A5O_SYSTEM_XGLX *s, A5O_DISPLAY_XGLX *d, bool recalc) { if (!init_mmon_interface(s)) return 0; @@ -980,9 +980,9 @@ int _al_xglx_get_adapter(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, bool r return _al_xglx_mmon_interface.get_adapter(s, d); } -void _al_xglx_handle_mmon_event(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, XEvent *e) +void _al_xglx_handle_mmon_event(A5O_SYSTEM_XGLX *s, A5O_DISPLAY_XGLX *d, XEvent *e) { - ALLEGRO_DEBUG("got event %i\n", e->type); + A5O_DEBUG("got event %i\n", e->type); // if we haven't setup the mmon interface, just bail if (!s->mmon_interface_inited) return; diff --git a/src/x/xglx_config.c b/src/x/xglx_config.c index 601dff9827..d69ae8c4da 100644 --- a/src/x/xglx_config.c +++ b/src/x/xglx_config.c @@ -10,25 +10,25 @@ #include "allegro5/internal/aintern_xglx_config.h" #include "allegro5/internal/aintern_xsystem.h" -ALLEGRO_DEBUG_CHANNEL("xglx_config") +A5O_DEBUG_CHANNEL("xglx_config") #ifdef DEBUGMODE -static void display_pixel_format(ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds) +static void display_pixel_format(A5O_EXTRA_DISPLAY_SETTINGS *eds) { - ALLEGRO_DEBUG("Single-buffer: %s\n", eds->settings[ALLEGRO_SINGLE_BUFFER] ? "yes" : "no"); - if (eds->settings[ALLEGRO_SWAP_METHOD] > 0) - ALLEGRO_DEBUG("Swap method: %s\n", eds->settings[ALLEGRO_SWAP_METHOD] == 2 ? "flip" : "copy"); + A5O_DEBUG("Single-buffer: %s\n", eds->settings[A5O_SINGLE_BUFFER] ? "yes" : "no"); + if (eds->settings[A5O_SWAP_METHOD] > 0) + A5O_DEBUG("Swap method: %s\n", eds->settings[A5O_SWAP_METHOD] == 2 ? "flip" : "copy"); else - ALLEGRO_DEBUG("Swap method: undefined\n"); - ALLEGRO_DEBUG("Color format: r%i g%i b%i a%i, %i bit\n", - eds->settings[ALLEGRO_RED_SIZE], - eds->settings[ALLEGRO_GREEN_SIZE], - eds->settings[ALLEGRO_BLUE_SIZE], - eds->settings[ALLEGRO_ALPHA_SIZE], - eds->settings[ALLEGRO_COLOR_SIZE]); - ALLEGRO_DEBUG("Depth buffer: %i bits\n", eds->settings[ALLEGRO_DEPTH_SIZE]); - ALLEGRO_DEBUG("Sample buffers: %s\n", eds->settings[ALLEGRO_SAMPLE_BUFFERS] ? "yes" : "no"); - ALLEGRO_DEBUG("Samples: %i\n", eds->settings[ALLEGRO_SAMPLES]); + A5O_DEBUG("Swap method: undefined\n"); + A5O_DEBUG("Color format: r%i g%i b%i a%i, %i bit\n", + eds->settings[A5O_RED_SIZE], + eds->settings[A5O_GREEN_SIZE], + eds->settings[A5O_BLUE_SIZE], + eds->settings[A5O_ALPHA_SIZE], + eds->settings[A5O_COLOR_SIZE]); + A5O_DEBUG("Depth buffer: %i bits\n", eds->settings[A5O_DEPTH_SIZE]); + A5O_DEBUG("Sample buffers: %s\n", eds->settings[A5O_SAMPLE_BUFFERS] ? "yes" : "no"); + A5O_DEBUG("Samples: %i\n", eds->settings[A5O_SAMPLES]); } #endif @@ -44,57 +44,57 @@ static int get_shift(int mask) return i; } -static void figure_out_colors(ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds, XVisualInfo *v) +static void figure_out_colors(A5O_EXTRA_DISPLAY_SETTINGS *eds, XVisualInfo *v) { - eds->settings[ALLEGRO_RED_SHIFT] = get_shift(v->red_mask); - eds->settings[ALLEGRO_GREEN_SHIFT] = get_shift(v->green_mask); - eds->settings[ALLEGRO_BLUE_SHIFT] = get_shift(v->blue_mask); - eds->settings[ALLEGRO_ALPHA_SHIFT] = 0; + eds->settings[A5O_RED_SHIFT] = get_shift(v->red_mask); + eds->settings[A5O_GREEN_SHIFT] = get_shift(v->green_mask); + eds->settings[A5O_BLUE_SHIFT] = get_shift(v->blue_mask); + eds->settings[A5O_ALPHA_SHIFT] = 0; - eds->settings[ALLEGRO_COLOR_SIZE] = 0; + eds->settings[A5O_COLOR_SIZE] = 0; - if (eds->settings[ALLEGRO_RED_SIZE] == 3 - && eds->settings[ALLEGRO_GREEN_SIZE] == 3 - && eds->settings[ALLEGRO_BLUE_SIZE] == 2) { - eds->settings[ALLEGRO_COLOR_SIZE] = 8; + if (eds->settings[A5O_RED_SIZE] == 3 + && eds->settings[A5O_GREEN_SIZE] == 3 + && eds->settings[A5O_BLUE_SIZE] == 2) { + eds->settings[A5O_COLOR_SIZE] = 8; } - if (eds->settings[ALLEGRO_RED_SIZE] == 5 - && eds->settings[ALLEGRO_BLUE_SIZE] == 5) { - if (eds->settings[ALLEGRO_GREEN_SIZE] == 5) { - eds->settings[ALLEGRO_COLOR_SIZE] = 15; + if (eds->settings[A5O_RED_SIZE] == 5 + && eds->settings[A5O_BLUE_SIZE] == 5) { + if (eds->settings[A5O_GREEN_SIZE] == 5) { + eds->settings[A5O_COLOR_SIZE] = 15; } - if (eds->settings[ALLEGRO_GREEN_SIZE] == 6) { - eds->settings[ALLEGRO_COLOR_SIZE] = 16; + if (eds->settings[A5O_GREEN_SIZE] == 6) { + eds->settings[A5O_COLOR_SIZE] = 16; } } - if (eds->settings[ALLEGRO_RED_SIZE] == 8 - && eds->settings[ALLEGRO_GREEN_SIZE] == 8 - && eds->settings[ALLEGRO_BLUE_SIZE] == 8) { - if (eds->settings[ALLEGRO_ALPHA_SIZE] == 0) { - eds->settings[ALLEGRO_COLOR_SIZE] = 24; + if (eds->settings[A5O_RED_SIZE] == 8 + && eds->settings[A5O_GREEN_SIZE] == 8 + && eds->settings[A5O_BLUE_SIZE] == 8) { + if (eds->settings[A5O_ALPHA_SIZE] == 0) { + eds->settings[A5O_COLOR_SIZE] = 24; } - if (eds->settings[ALLEGRO_ALPHA_SIZE] == 8) { - eds->settings[ALLEGRO_COLOR_SIZE] = 32; + if (eds->settings[A5O_ALPHA_SIZE] == 8) { + eds->settings[A5O_COLOR_SIZE] = 32; /* small hack that tries to guess alpha shifting */ - eds->settings[ALLEGRO_ALPHA_SHIFT] = 48 - eds->settings[ALLEGRO_RED_SHIFT] - - eds->settings[ALLEGRO_GREEN_SHIFT] - - eds->settings[ALLEGRO_BLUE_SHIFT]; + eds->settings[A5O_ALPHA_SHIFT] = 48 - eds->settings[A5O_RED_SHIFT] + - eds->settings[A5O_GREEN_SHIFT] + - eds->settings[A5O_BLUE_SHIFT]; } } } -static ALLEGRO_EXTRA_DISPLAY_SETTINGS* read_fbconfig(Display *dpy, +static A5O_EXTRA_DISPLAY_SETTINGS* read_fbconfig(Display *dpy, GLXFBConfig fbc) { int render_type, visual_type, buffer_size, sbuffers, samples; int drawable_type, renderable, swap_method, double_buffer; - ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds; + A5O_EXTRA_DISPLAY_SETTINGS *eds; XVisualInfo *v; - eds = al_calloc(1, sizeof(ALLEGRO_EXTRA_DISPLAY_SETTINGS)); - eds->settings[ALLEGRO_RENDER_METHOD] = 2; + eds = al_calloc(1, sizeof(A5O_EXTRA_DISPLAY_SETTINGS)); + eds->settings[A5O_RENDER_METHOD] = 2; if (glXGetFBConfigAttrib (dpy, fbc, GLX_RENDER_TYPE, &render_type) @@ -107,70 +107,70 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS* read_fbconfig(Display *dpy, || glXGetFBConfigAttrib (dpy, fbc, GLX_BUFFER_SIZE, &buffer_size) || glXGetFBConfigAttrib (dpy, fbc, GLX_DEPTH_SIZE, - &eds->settings[ALLEGRO_DEPTH_SIZE]) + &eds->settings[A5O_DEPTH_SIZE]) || glXGetFBConfigAttrib (dpy, fbc, GLX_STEREO, - &eds->settings[ALLEGRO_STEREO]) + &eds->settings[A5O_STEREO]) || glXGetFBConfigAttrib (dpy, fbc, GLX_RED_SIZE, - &eds->settings[ALLEGRO_RED_SIZE]) + &eds->settings[A5O_RED_SIZE]) || glXGetFBConfigAttrib (dpy, fbc, GLX_GREEN_SIZE, - &eds->settings[ALLEGRO_GREEN_SIZE]) + &eds->settings[A5O_GREEN_SIZE]) || glXGetFBConfigAttrib (dpy, fbc, GLX_BLUE_SIZE, - &eds->settings[ALLEGRO_BLUE_SIZE]) + &eds->settings[A5O_BLUE_SIZE]) || glXGetFBConfigAttrib (dpy, fbc, GLX_ALPHA_SIZE, - &eds->settings[ALLEGRO_ALPHA_SIZE]) + &eds->settings[A5O_ALPHA_SIZE]) || glXGetFBConfigAttrib (dpy, fbc, GLX_DOUBLEBUFFER, &double_buffer) || glXGetFBConfigAttrib (dpy, fbc, GLX_AUX_BUFFERS, - &eds->settings[ALLEGRO_AUX_BUFFERS]) + &eds->settings[A5O_AUX_BUFFERS]) || glXGetFBConfigAttrib (dpy, fbc, GLX_STENCIL_SIZE, - &eds->settings[ALLEGRO_STENCIL_SIZE]) + &eds->settings[A5O_STENCIL_SIZE]) || glXGetFBConfigAttrib (dpy, fbc, GLX_ACCUM_RED_SIZE, - &eds->settings[ALLEGRO_ACC_RED_SIZE]) + &eds->settings[A5O_ACC_RED_SIZE]) || glXGetFBConfigAttrib (dpy, fbc, GLX_ACCUM_GREEN_SIZE, - &eds->settings[ALLEGRO_ACC_GREEN_SIZE]) + &eds->settings[A5O_ACC_GREEN_SIZE]) || glXGetFBConfigAttrib (dpy, fbc, GLX_ACCUM_BLUE_SIZE, - &eds->settings[ALLEGRO_ACC_BLUE_SIZE]) + &eds->settings[A5O_ACC_BLUE_SIZE]) || glXGetFBConfigAttrib (dpy, fbc, GLX_ACCUM_ALPHA_SIZE, - &eds->settings[ALLEGRO_ACC_ALPHA_SIZE])) { - ALLEGRO_DEBUG("Incomplete glX mode ...\n"); + &eds->settings[A5O_ACC_ALPHA_SIZE])) { + A5O_DEBUG("Incomplete glX mode ...\n"); al_free(eds); return NULL; } - eds->settings[ALLEGRO_SINGLE_BUFFER] = !double_buffer; + eds->settings[A5O_SINGLE_BUFFER] = !double_buffer; if (!(render_type & GLX_RGBA_BIT) && !(render_type & GLX_RGBA_FLOAT_BIT_ARB)) { - ALLEGRO_DEBUG("Not RGBA mode\n"); + A5O_DEBUG("Not RGBA mode\n"); al_free(eds); return NULL; } if (!(drawable_type & GLX_WINDOW_BIT)) { - ALLEGRO_DEBUG("Cannot render to a window.\n"); + A5O_DEBUG("Cannot render to a window.\n"); al_free(eds); return NULL; } if (renderable == False) { - ALLEGRO_DEBUG("GLX windows not supported.\n"); + A5O_DEBUG("GLX windows not supported.\n"); al_free(eds); return NULL; } if (visual_type != GLX_TRUE_COLOR && visual_type != GLX_DIRECT_COLOR) { - ALLEGRO_DEBUG("visual type other than TrueColor and " + A5O_DEBUG("visual type other than TrueColor and " "DirectColor.\n"); al_free(eds); return NULL; } /* Floating-point depth is not supported as glx extension (yet). */ - eds->settings[ALLEGRO_FLOAT_DEPTH] = 0; + eds->settings[A5O_FLOAT_DEPTH] = 0; - eds->settings[ALLEGRO_FLOAT_COLOR] = (render_type & GLX_RGBA_FLOAT_BIT_ARB); + eds->settings[A5O_FLOAT_COLOR] = (render_type & GLX_RGBA_FLOAT_BIT_ARB); v = glXGetVisualFromFBConfig(dpy, fbc); if (!v) { - ALLEGRO_DEBUG("Cannot get associated visual for the FBConfig.\n"); + A5O_DEBUG("Cannot get associated visual for the FBConfig.\n"); al_free(eds); return NULL; } @@ -178,32 +178,32 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS* read_fbconfig(Display *dpy, if (glXGetConfig(dpy, v, GLX_SAMPLE_BUFFERS, &sbuffers)) { /* Multisample extension is not supported */ - eds->settings[ALLEGRO_SAMPLE_BUFFERS] = 0; + eds->settings[A5O_SAMPLE_BUFFERS] = 0; } else { - eds->settings[ALLEGRO_SAMPLE_BUFFERS] = sbuffers; + eds->settings[A5O_SAMPLE_BUFFERS] = sbuffers; } if (glXGetConfig(dpy, v, GLX_SAMPLES, &samples)) { /* Multisample extension is not supported */ - eds->settings[ALLEGRO_SAMPLES] = 0; + eds->settings[A5O_SAMPLES] = 0; } else { - eds->settings[ALLEGRO_SAMPLES] = samples; + eds->settings[A5O_SAMPLES] = samples; } if (glXGetFBConfigAttrib(dpy, fbc, GLX_SWAP_METHOD_OML, &swap_method) == GLX_BAD_ATTRIBUTE) { /* GLX_OML_swap_method extension is not supported */ - eds->settings[ALLEGRO_SWAP_METHOD] = 0; + eds->settings[A5O_SWAP_METHOD] = 0; } else { - eds->settings[ALLEGRO_SWAP_METHOD] = swap_method; + eds->settings[A5O_SWAP_METHOD] = swap_method; } /* We can only guarantee vsync is off. */ - eds->settings[ALLEGRO_VSYNC] = 2; + eds->settings[A5O_VSYNC] = 2; - eds->settings[ALLEGRO_COMPATIBLE_DISPLAY] = (_al_deduce_color_format(eds) - != ALLEGRO_PIXEL_FORMAT_ANY); + eds->settings[A5O_COMPATIBLE_DISPLAY] = (_al_deduce_color_format(eds) + != A5O_PIXEL_FORMAT_ANY); XFree(v); @@ -211,13 +211,13 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS* read_fbconfig(Display *dpy, } -static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_visuals_new(ALLEGRO_DISPLAY_XGLX *glx, int *eds_count) +static A5O_EXTRA_DISPLAY_SETTINGS** get_visuals_new(A5O_DISPLAY_XGLX *glx, int *eds_count) { int num_fbconfigs, i, j; GLXFBConfig *fbconfig; - ALLEGRO_EXTRA_DISPLAY_SETTINGS *ref; - ALLEGRO_EXTRA_DISPLAY_SETTINGS **eds = NULL; - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_EXTRA_DISPLAY_SETTINGS *ref; + A5O_EXTRA_DISPLAY_SETTINGS **eds = NULL; + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); ref = _al_get_new_display_settings(); @@ -226,17 +226,17 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_visuals_new(ALLEGRO_DISPLAY_XGLX *gl if (fbconfig) { XFree(fbconfig); } - ALLEGRO_DEBUG("glXGetFBConfigs(xscreen=%d) returned NULL.\n", glx->xscreen); + A5O_DEBUG("glXGetFBConfigs(xscreen=%d) returned NULL.\n", glx->xscreen); return NULL; } eds = al_malloc(num_fbconfigs * sizeof(*eds)); - ALLEGRO_INFO("%i formats.\n", num_fbconfigs); + A5O_INFO("%i formats.\n", num_fbconfigs); for (i = j = 0; i < num_fbconfigs; i++) { - ALLEGRO_DEBUG("-- \n"); - ALLEGRO_DEBUG("Decoding visual no. %i...\n", i); + A5O_DEBUG("-- \n"); + A5O_DEBUG("Decoding visual no. %i...\n", i); eds[j] = read_fbconfig(system->gfxdisplay, fbconfig[i]); if (!eds[j]) continue; @@ -255,7 +255,7 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_visuals_new(ALLEGRO_DISPLAY_XGLX *gl } *eds_count = j; - ALLEGRO_INFO("%i visuals are good enough.\n", j); + A5O_INFO("%i visuals are good enough.\n", j); if (j == 0) { al_free(eds); eds = NULL; @@ -267,93 +267,93 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_visuals_new(ALLEGRO_DISPLAY_XGLX *gl } -static ALLEGRO_EXTRA_DISPLAY_SETTINGS* read_xvisual(Display *dpy, +static A5O_EXTRA_DISPLAY_SETTINGS* read_xvisual(Display *dpy, XVisualInfo *v) { int rgba, buffer_size, use_gl, sbuffers, samples, double_buffer; - ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds; + A5O_EXTRA_DISPLAY_SETTINGS *eds; /* We can only support TrueColor and DirectColor visuals -- * we only support RGBA mode */ if (v->class != TrueColor && v->class != DirectColor) return NULL; - eds = al_calloc(1, sizeof(ALLEGRO_EXTRA_DISPLAY_SETTINGS)); - eds->settings[ALLEGRO_RENDER_METHOD] = 2; + eds = al_calloc(1, sizeof(A5O_EXTRA_DISPLAY_SETTINGS)); + eds->settings[A5O_RENDER_METHOD] = 2; if (glXGetConfig (dpy, v, GLX_RGBA, &rgba) || glXGetConfig (dpy, v, GLX_USE_GL, &use_gl) || glXGetConfig (dpy, v, GLX_BUFFER_SIZE, &buffer_size) - || glXGetConfig (dpy, v, GLX_RED_SIZE, &eds->settings[ALLEGRO_RED_SIZE]) - || glXGetConfig (dpy, v, GLX_GREEN_SIZE, &eds->settings[ALLEGRO_GREEN_SIZE]) - || glXGetConfig (dpy, v, GLX_BLUE_SIZE, &eds->settings[ALLEGRO_BLUE_SIZE]) - || glXGetConfig (dpy, v, GLX_ALPHA_SIZE, &eds->settings[ALLEGRO_ALPHA_SIZE]) + || glXGetConfig (dpy, v, GLX_RED_SIZE, &eds->settings[A5O_RED_SIZE]) + || glXGetConfig (dpy, v, GLX_GREEN_SIZE, &eds->settings[A5O_GREEN_SIZE]) + || glXGetConfig (dpy, v, GLX_BLUE_SIZE, &eds->settings[A5O_BLUE_SIZE]) + || glXGetConfig (dpy, v, GLX_ALPHA_SIZE, &eds->settings[A5O_ALPHA_SIZE]) || glXGetConfig (dpy, v, GLX_DOUBLEBUFFER, &double_buffer) - || glXGetConfig (dpy, v, GLX_STEREO, &eds->settings[ALLEGRO_STEREO]) - || glXGetConfig (dpy, v, GLX_AUX_BUFFERS, &eds->settings[ALLEGRO_AUX_BUFFERS]) - || glXGetConfig (dpy, v, GLX_DEPTH_SIZE, &eds->settings[ALLEGRO_DEPTH_SIZE]) - || glXGetConfig (dpy, v, GLX_STENCIL_SIZE, &eds->settings[ALLEGRO_STENCIL_SIZE]) + || glXGetConfig (dpy, v, GLX_STEREO, &eds->settings[A5O_STEREO]) + || glXGetConfig (dpy, v, GLX_AUX_BUFFERS, &eds->settings[A5O_AUX_BUFFERS]) + || glXGetConfig (dpy, v, GLX_DEPTH_SIZE, &eds->settings[A5O_DEPTH_SIZE]) + || glXGetConfig (dpy, v, GLX_STENCIL_SIZE, &eds->settings[A5O_STENCIL_SIZE]) || glXGetConfig (dpy, v, GLX_ACCUM_RED_SIZE, - &eds->settings[ALLEGRO_ACC_RED_SIZE]) + &eds->settings[A5O_ACC_RED_SIZE]) || glXGetConfig (dpy, v, GLX_ACCUM_GREEN_SIZE, - &eds->settings[ALLEGRO_ACC_GREEN_SIZE]) + &eds->settings[A5O_ACC_GREEN_SIZE]) || glXGetConfig (dpy, v, GLX_ACCUM_BLUE_SIZE, - &eds->settings[ALLEGRO_ACC_BLUE_SIZE]) + &eds->settings[A5O_ACC_BLUE_SIZE]) || glXGetConfig (dpy, v, GLX_ACCUM_ALPHA_SIZE, - &eds->settings[ALLEGRO_ACC_ALPHA_SIZE])) { - ALLEGRO_DEBUG("Incomplete glX mode ...\n"); + &eds->settings[A5O_ACC_ALPHA_SIZE])) { + A5O_DEBUG("Incomplete glX mode ...\n"); al_free(eds); return NULL; } - eds->settings[ALLEGRO_SINGLE_BUFFER] = !double_buffer; + eds->settings[A5O_SINGLE_BUFFER] = !double_buffer; if (!rgba) { - ALLEGRO_DEBUG("Not RGBA mode\n"); + A5O_DEBUG("Not RGBA mode\n"); al_free(eds); return NULL; } if (!use_gl) { - ALLEGRO_DEBUG("OpenGL Unsupported\n"); + A5O_DEBUG("OpenGL Unsupported\n"); al_free(eds); return NULL; } - eds->settings[ALLEGRO_COLOR_SIZE] = 0; + eds->settings[A5O_COLOR_SIZE] = 0; figure_out_colors(eds, v); - eds->settings[ALLEGRO_FLOAT_COLOR] = 0; - eds->settings[ALLEGRO_FLOAT_DEPTH] = 0; + eds->settings[A5O_FLOAT_COLOR] = 0; + eds->settings[A5O_FLOAT_DEPTH] = 0; if (glXGetConfig(dpy, v, GLX_SAMPLE_BUFFERS, &sbuffers) == GLX_BAD_ATTRIBUTE) { /* Multisample extension is not supported */ - eds->settings[ALLEGRO_SAMPLE_BUFFERS] = 0; + eds->settings[A5O_SAMPLE_BUFFERS] = 0; } else { - eds->settings[ALLEGRO_SAMPLE_BUFFERS] = sbuffers; + eds->settings[A5O_SAMPLE_BUFFERS] = sbuffers; } if (glXGetConfig(dpy, v, GLX_SAMPLES, &samples) == GLX_BAD_ATTRIBUTE) { /* Multisample extension is not supported */ - eds->settings[ALLEGRO_SAMPLES] = 0; + eds->settings[A5O_SAMPLES] = 0; } else { - eds->settings[ALLEGRO_SAMPLES] = samples; + eds->settings[A5O_SAMPLES] = samples; } - eds->settings[ALLEGRO_SWAP_METHOD] = 0; - eds->settings[ALLEGRO_COMPATIBLE_DISPLAY] = (_al_deduce_color_format(eds) - != ALLEGRO_PIXEL_FORMAT_ANY); + eds->settings[A5O_SWAP_METHOD] = 0; + eds->settings[A5O_COMPATIBLE_DISPLAY] = (_al_deduce_color_format(eds) + != A5O_PIXEL_FORMAT_ANY); return eds; } -static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_visuals_old(int *eds_count) +static A5O_EXTRA_DISPLAY_SETTINGS** get_visuals_old(int *eds_count) { int i, j, num_visuals; XVisualInfo *xv; - ALLEGRO_EXTRA_DISPLAY_SETTINGS *ref; - ALLEGRO_EXTRA_DISPLAY_SETTINGS **eds; - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_EXTRA_DISPLAY_SETTINGS *ref; + A5O_EXTRA_DISPLAY_SETTINGS **eds; + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); ref = _al_get_new_display_settings(); @@ -363,11 +363,11 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_visuals_old(int *eds_count) eds = al_malloc(num_visuals * sizeof(*eds)); - ALLEGRO_INFO("%i formats.\n", num_visuals); + A5O_INFO("%i formats.\n", num_visuals); for (i = j = 0; i < num_visuals; i++) { - ALLEGRO_DEBUG("-- \n"); - ALLEGRO_DEBUG("Decoding visual no. %i...\n", i); + A5O_DEBUG("-- \n"); + A5O_DEBUG("Decoding visual no. %i...\n", i); eds[j] = read_xvisual(system->gfxdisplay, xv + i); if (!eds[j]) continue; @@ -387,7 +387,7 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_visuals_old(int *eds_count) } *eds_count = j; - ALLEGRO_INFO("%i visuals are good enough.\n", j); + A5O_INFO("%i visuals are good enough.\n", j); if (j == 0) { al_free(eds); eds = NULL; @@ -399,11 +399,11 @@ static ALLEGRO_EXTRA_DISPLAY_SETTINGS** get_visuals_old(int *eds_count) } -static void select_best_visual(ALLEGRO_DISPLAY_XGLX *glx, - ALLEGRO_EXTRA_DISPLAY_SETTINGS* *eds, int eds_count, +static void select_best_visual(A5O_DISPLAY_XGLX *glx, + A5O_EXTRA_DISPLAY_SETTINGS* *eds, int eds_count, bool using_fbc) { - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); qsort(eds, eds_count, sizeof(*eds), _al_display_settings_sorter); @@ -411,12 +411,12 @@ static void select_best_visual(ALLEGRO_DISPLAY_XGLX *glx, ASSERT(eds[0] != NULL); if (!eds[0]->info) { - ALLEGRO_ERROR("No matching displays found.\n"); + A5O_ERROR("No matching displays found.\n"); glx->xvinfo = NULL; return; } - ALLEGRO_INFO("Chose visual no. %i\n", eds[0]->index); + A5O_INFO("Chose visual no. %i\n", eds[0]->index); #ifdef DEBUGMODE display_pixel_format(eds[0]); #endif @@ -431,15 +431,15 @@ static void select_best_visual(ALLEGRO_DISPLAY_XGLX *glx, memcpy(glx->xvinfo, eds[0]->info, sizeof(XVisualInfo)); } - ALLEGRO_INFO("Corresponding X11 visual id: %lu\n", glx->xvinfo->visualid); - memcpy(&glx->display.extra_settings, eds[0], sizeof(ALLEGRO_EXTRA_DISPLAY_SETTINGS)); + A5O_INFO("Corresponding X11 visual id: %lu\n", glx->xvinfo->visualid); + memcpy(&glx->display.extra_settings, eds[0], sizeof(A5O_EXTRA_DISPLAY_SETTINGS)); } -void _al_xglx_config_select_visual(ALLEGRO_DISPLAY_XGLX *glx) +void _al_xglx_config_select_visual(A5O_DISPLAY_XGLX *glx) { - ALLEGRO_EXTRA_DISPLAY_SETTINGS **eds; + A5O_EXTRA_DISPLAY_SETTINGS **eds; int eds_count, i; bool force_old = false; bool using_fbc; @@ -449,7 +449,7 @@ void _al_xglx_config_select_visual(ALLEGRO_DISPLAY_XGLX *glx) "config_selection"); if (selection_mode && selection_mode[0] != '\0') { if (!_al_stricmp(selection_mode, "old")) { - ALLEGRO_WARN("Forcing OLD visual selection method.\n"); + A5O_WARN("Forcing OLD visual selection method.\n"); force_old = true; } else if (!_al_stricmp(selection_mode, "new")) @@ -469,7 +469,7 @@ void _al_xglx_config_select_visual(ALLEGRO_DISPLAY_XGLX *glx) using_fbc = true; if (!eds) { - ALLEGRO_ERROR("Failed to get any visual info.\n"); + A5O_ERROR("Failed to get any visual info.\n"); return; } @@ -504,7 +504,7 @@ static GLXContext create_context_new(int ver, Display *dpy, GLXFBConfig fb, (GCCA_PROC)glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB"); } if (!_xglx_glXCreateContextAttribsARB) { - ALLEGRO_ERROR("GLX_ARB_create_context not supported and needed for OpenGL 3\n"); + A5O_ERROR("GLX_ARB_create_context not supported and needed for OpenGL 3\n"); return NULL; } @@ -526,35 +526,35 @@ static GLXContext create_context_new(int ver, Display *dpy, GLXFBConfig fb, return _xglx_glXCreateContextAttribsARB(dpy, fb, ctx, True, attrib); } -bool _al_xglx_config_create_context(ALLEGRO_DISPLAY_XGLX *glx) +bool _al_xglx_config_create_context(A5O_DISPLAY_XGLX *glx) { - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); - ALLEGRO_DISPLAY *disp = (void*)glx; + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_DISPLAY *disp = (void*)glx; GLXContext existing_ctx = NULL; /* Find an existing context with which to share display lists. */ if (_al_vector_size(&system->system.displays) > 1) { - ALLEGRO_DISPLAY_XGLX **existing_dpy; + A5O_DISPLAY_XGLX **existing_dpy; existing_dpy = _al_vector_ref_front(&system->system.displays); if (*existing_dpy != glx) existing_ctx = (*existing_dpy)->context; } - int major = al_get_new_display_option(ALLEGRO_OPENGL_MAJOR_VERSION, 0); - int minor = al_get_new_display_option(ALLEGRO_OPENGL_MINOR_VERSION, 0); + int major = al_get_new_display_option(A5O_OPENGL_MAJOR_VERSION, 0); + int minor = al_get_new_display_option(A5O_OPENGL_MINOR_VERSION, 0); if (glx->fbc) { - bool forward_compat = (disp->flags & ALLEGRO_OPENGL_FORWARD_COMPATIBLE) != 0; - bool core_profile = (disp->flags & ALLEGRO_OPENGL_CORE_PROFILE) != 0; + bool forward_compat = (disp->flags & A5O_OPENGL_FORWARD_COMPATIBLE) != 0; + bool core_profile = (disp->flags & A5O_OPENGL_CORE_PROFILE) != 0; /* Create a GLX context from FBC. */ - if (disp->flags & ALLEGRO_OPENGL_ES_PROFILE) { + if (disp->flags & A5O_OPENGL_ES_PROFILE) { if (major == 0) major = 2; glx->context = create_context_new(glx->glx_version, system->gfxdisplay, *glx->fbc, existing_ctx, forward_compat, true, core_profile, major, minor); } - else if ((disp->flags & ALLEGRO_OPENGL_3_0) || major != 0 || core_profile) { + else if ((disp->flags & A5O_OPENGL_3_0) || major != 0 || core_profile) { if (major == 0) major = 3; if (core_profile && major == 3 && minor < 2) // core profile requires at least 3.2 @@ -566,9 +566,9 @@ bool _al_xglx_config_create_context(ALLEGRO_DISPLAY_XGLX *glx) * context when using the programmable pipeline, for some reason. All * that's missing is probably a default shader though. */ - disp->extra_settings.settings[ALLEGRO_COMPATIBLE_DISPLAY] = 1; - if (forward_compat && !(disp->flags & ALLEGRO_PROGRAMMABLE_PIPELINE)) - disp->extra_settings.settings[ALLEGRO_COMPATIBLE_DISPLAY] = 0; + disp->extra_settings.settings[A5O_COMPATIBLE_DISPLAY] = 1; + if (forward_compat && !(disp->flags & A5O_PROGRAMMABLE_PIPELINE)) + disp->extra_settings.settings[A5O_COMPATIBLE_DISPLAY] = 0; } else { glx->context = glXCreateNewContext(system->gfxdisplay, *glx->fbc, @@ -587,12 +587,12 @@ bool _al_xglx_config_create_context(ALLEGRO_DISPLAY_XGLX *glx) } if (!glx->context || !glx->glxwindow) { - ALLEGRO_ERROR("Failed to create GLX context.\n"); + A5O_ERROR("Failed to create GLX context.\n"); return false; } disp->ogl_extras->is_shared = true; - ALLEGRO_DEBUG("Got GLX context.\n"); + A5O_DEBUG("Got GLX context.\n"); return true; } diff --git a/src/x/xicon.h b/src/x/xicon.h index c2a823d4af..3601f8d7fa 100644 --- a/src/x/xicon.h +++ b/src/x/xicon.h @@ -1,6 +1,6 @@ #ifndef XICON_H #define XICON_H -extern ALLEGRO_BITMAP *_al_xwin_initial_icon; +extern A5O_BITMAP *_al_xwin_initial_icon; #endif // XICON_H diff --git a/src/x/xkeyboard.c b/src/x/xkeyboard.c index 7b3f950f6d..531491229c 100644 --- a/src/x/xkeyboard.c +++ b/src/x/xkeyboard.c @@ -17,7 +17,7 @@ * See readme.txt for copyright information. */ -#define ALLEGRO_NO_COMPATIBILITY +#define A5O_NO_COMPATIBILITY #include #include @@ -40,48 +40,48 @@ #include "allegro5/internal/aintern_xkeyboard.h" #include "allegro5/internal/aintern_xsystem.h" -#ifdef ALLEGRO_RASPBERRYPI +#ifdef A5O_RASPBERRYPI #include "allegro5/internal/aintern_raspberrypi.h" -#define ALLEGRO_SYSTEM_XGLX ALLEGRO_SYSTEM_RASPBERRYPI +#define A5O_SYSTEM_XGLX A5O_SYSTEM_RASPBERRYPI #endif -ALLEGRO_DEBUG_CHANNEL("keyboard") +A5O_DEBUG_CHANNEL("keyboard") /*----------------------------------------------------------------------*/ static void handle_key_press(int mycode, int unichar, int filtered, - unsigned int modifiers, ALLEGRO_DISPLAY *display); -static void handle_key_release(int mycode, unsigned int modifiers, ALLEGRO_DISPLAY *display); + unsigned int modifiers, A5O_DISPLAY *display); +static void handle_key_release(int mycode, unsigned int modifiers, A5O_DISPLAY *display); static int _key_shifts; /*----------------------------------------------------------------------*/ -typedef struct ALLEGRO_KEYBOARD_XWIN +typedef struct A5O_KEYBOARD_XWIN { - ALLEGRO_KEYBOARD parent; - ALLEGRO_KEYBOARD_STATE state; + A5O_KEYBOARD parent; + A5O_KEYBOARD_STATE state; // Quit if Ctrl-Alt-Del is pressed. bool three_finger_flag; -} ALLEGRO_KEYBOARD_XWIN; +} A5O_KEYBOARD_XWIN; -typedef struct ALLEGRO_KEY_REPEAT_DATA { +typedef struct A5O_KEY_REPEAT_DATA { XKeyEvent *event; bool found; -} ALLEGRO_KEY_REPEAT_DATA; +} A5O_KEY_REPEAT_DATA; /* the one and only keyboard object */ -static ALLEGRO_KEYBOARD_XWIN the_keyboard; +static A5O_KEYBOARD_XWIN the_keyboard; static int last_press_code = -1; -#ifdef ALLEGRO_XWINDOWS_WITH_XIM +#ifdef A5O_XWINDOWS_WITH_XIM static XIM xim = NULL; static XIC xic = NULL; #endif static XModifierKeymap *xmodmap = NULL; static int xkeyboard_installed = 0; -static int used[ALLEGRO_KEY_MAX]; +static int used[A5O_KEY_MAX]; static int sym_per_key; static int min_keycode, max_keycode; static KeySym *keysyms = NULL; @@ -91,21 +91,21 @@ static int keycode_to_scancode[256]; /* This table can be ammended to provide more reasonable defaults for * mappings other than US/UK. They are used to map X11 KeySyms as found in - * X11/keysym.h to Allegro's ALLEGRO_KEY_* codes. This will only work well on US/UK - * keyboards since Allegro simply doesn't have ALLEGRO_KEY_* codes for non US/UK + * X11/keysym.h to Allegro's A5O_KEY_* codes. This will only work well on US/UK + * keyboards since Allegro simply doesn't have A5O_KEY_* codes for non US/UK * keyboards. So with other mappings, the unmapped keys will be distributed - * arbitrarily to the remaining ALLEGRO_KEY_* codes. + * arbitrarily to the remaining A5O_KEY_* codes. * * Double mappings should be avoided, else they can lead to different keys - * producing the same ALLEGRO_KEY_* code on some mappings. + * producing the same A5O_KEY_* code on some mappings. * * In cases where there is no other way to detect a key, since we have no - * ASCII applied to it, like ALLEGRO_KEY_LEFT or ALLEGRO_KEY_PAUSE, multiple mappings should + * ASCII applied to it, like A5O_KEY_LEFT or A5O_KEY_PAUSE, multiple mappings should * be ok though. This table will never be able to be 100% perfect, so just * try to make it work for as many as possible, using additional hacks in * some cases. There is also still the possibility to override keys with * the [xkeyboard] config section, so users can always re-map keys. (E.g. - * to play an Allegro game which hard-coded ALLEGRO_KEY_Y and ALLEGRO_KEY_X for left and + * to play an Allegro game which hard-coded A5O_KEY_Y and A5O_KEY_X for left and * right.) */ static struct { @@ -113,174 +113,174 @@ static struct { int allegro_key; } translation_table[] = { - {XK_a, ALLEGRO_KEY_A}, - {XK_b, ALLEGRO_KEY_B}, - {XK_c, ALLEGRO_KEY_C}, - {XK_d, ALLEGRO_KEY_D}, - {XK_e, ALLEGRO_KEY_E}, - {XK_f, ALLEGRO_KEY_F}, - {XK_g, ALLEGRO_KEY_G}, - {XK_h, ALLEGRO_KEY_H}, - {XK_i, ALLEGRO_KEY_I}, - {XK_j, ALLEGRO_KEY_J}, - {XK_k, ALLEGRO_KEY_K}, - {XK_l, ALLEGRO_KEY_L}, - {XK_m, ALLEGRO_KEY_M}, - {XK_n, ALLEGRO_KEY_N}, - {XK_o, ALLEGRO_KEY_O}, - {XK_p, ALLEGRO_KEY_P}, - {XK_q, ALLEGRO_KEY_Q}, - {XK_r, ALLEGRO_KEY_R}, - {XK_s, ALLEGRO_KEY_S}, - {XK_t, ALLEGRO_KEY_T}, - {XK_u, ALLEGRO_KEY_U}, - {XK_v, ALLEGRO_KEY_V}, - {XK_w, ALLEGRO_KEY_W}, - {XK_x, ALLEGRO_KEY_X}, - {XK_y, ALLEGRO_KEY_Y}, - {XK_z, ALLEGRO_KEY_Z}, - {XK_0, ALLEGRO_KEY_0}, - {XK_1, ALLEGRO_KEY_1}, - {XK_2, ALLEGRO_KEY_2}, - {XK_3, ALLEGRO_KEY_3}, - {XK_4, ALLEGRO_KEY_4}, - {XK_5, ALLEGRO_KEY_5}, - {XK_6, ALLEGRO_KEY_6}, - {XK_7, ALLEGRO_KEY_7}, - {XK_8, ALLEGRO_KEY_8}, - {XK_9, ALLEGRO_KEY_9}, + {XK_a, A5O_KEY_A}, + {XK_b, A5O_KEY_B}, + {XK_c, A5O_KEY_C}, + {XK_d, A5O_KEY_D}, + {XK_e, A5O_KEY_E}, + {XK_f, A5O_KEY_F}, + {XK_g, A5O_KEY_G}, + {XK_h, A5O_KEY_H}, + {XK_i, A5O_KEY_I}, + {XK_j, A5O_KEY_J}, + {XK_k, A5O_KEY_K}, + {XK_l, A5O_KEY_L}, + {XK_m, A5O_KEY_M}, + {XK_n, A5O_KEY_N}, + {XK_o, A5O_KEY_O}, + {XK_p, A5O_KEY_P}, + {XK_q, A5O_KEY_Q}, + {XK_r, A5O_KEY_R}, + {XK_s, A5O_KEY_S}, + {XK_t, A5O_KEY_T}, + {XK_u, A5O_KEY_U}, + {XK_v, A5O_KEY_V}, + {XK_w, A5O_KEY_W}, + {XK_x, A5O_KEY_X}, + {XK_y, A5O_KEY_Y}, + {XK_z, A5O_KEY_Z}, + {XK_0, A5O_KEY_0}, + {XK_1, A5O_KEY_1}, + {XK_2, A5O_KEY_2}, + {XK_3, A5O_KEY_3}, + {XK_4, A5O_KEY_4}, + {XK_5, A5O_KEY_5}, + {XK_6, A5O_KEY_6}, + {XK_7, A5O_KEY_7}, + {XK_8, A5O_KEY_8}, + {XK_9, A5O_KEY_9}, /* Double mappings for numeric keyboard. * If an X server actually uses both at the same time, Allegro will * detect them as the same. But normally, an X server just reports it as - * either of them, and therefore we always get the keys as ALLEGRO_KEY_PAD_*. + * either of them, and therefore we always get the keys as A5O_KEY_PAD_*. */ - {XK_KP_0, ALLEGRO_KEY_PAD_0}, - {XK_KP_Insert, ALLEGRO_KEY_PAD_0}, - {XK_KP_1, ALLEGRO_KEY_PAD_1}, - {XK_KP_End, ALLEGRO_KEY_PAD_1}, - {XK_KP_2, ALLEGRO_KEY_PAD_2}, - {XK_KP_Down, ALLEGRO_KEY_PAD_2}, - {XK_KP_3, ALLEGRO_KEY_PAD_3}, - {XK_KP_Page_Down, ALLEGRO_KEY_PAD_3}, - {XK_KP_4, ALLEGRO_KEY_PAD_4}, - {XK_KP_Left, ALLEGRO_KEY_PAD_4}, - {XK_KP_5, ALLEGRO_KEY_PAD_5}, - {XK_KP_Begin, ALLEGRO_KEY_PAD_5}, - {XK_KP_6, ALLEGRO_KEY_PAD_6}, - {XK_KP_Right, ALLEGRO_KEY_PAD_6}, - {XK_KP_7, ALLEGRO_KEY_PAD_7}, - {XK_KP_Home, ALLEGRO_KEY_PAD_7}, - {XK_KP_8, ALLEGRO_KEY_PAD_8}, - {XK_KP_Up, ALLEGRO_KEY_PAD_8}, - {XK_KP_9, ALLEGRO_KEY_PAD_9}, - {XK_KP_Page_Up, ALLEGRO_KEY_PAD_9}, - {XK_KP_Delete, ALLEGRO_KEY_PAD_DELETE}, - {XK_KP_Decimal, ALLEGRO_KEY_PAD_DELETE}, + {XK_KP_0, A5O_KEY_PAD_0}, + {XK_KP_Insert, A5O_KEY_PAD_0}, + {XK_KP_1, A5O_KEY_PAD_1}, + {XK_KP_End, A5O_KEY_PAD_1}, + {XK_KP_2, A5O_KEY_PAD_2}, + {XK_KP_Down, A5O_KEY_PAD_2}, + {XK_KP_3, A5O_KEY_PAD_3}, + {XK_KP_Page_Down, A5O_KEY_PAD_3}, + {XK_KP_4, A5O_KEY_PAD_4}, + {XK_KP_Left, A5O_KEY_PAD_4}, + {XK_KP_5, A5O_KEY_PAD_5}, + {XK_KP_Begin, A5O_KEY_PAD_5}, + {XK_KP_6, A5O_KEY_PAD_6}, + {XK_KP_Right, A5O_KEY_PAD_6}, + {XK_KP_7, A5O_KEY_PAD_7}, + {XK_KP_Home, A5O_KEY_PAD_7}, + {XK_KP_8, A5O_KEY_PAD_8}, + {XK_KP_Up, A5O_KEY_PAD_8}, + {XK_KP_9, A5O_KEY_PAD_9}, + {XK_KP_Page_Up, A5O_KEY_PAD_9}, + {XK_KP_Delete, A5O_KEY_PAD_DELETE}, + {XK_KP_Decimal, A5O_KEY_PAD_DELETE}, /* Double mapping! * Same as above - but normally, the X server just reports one or the * other for the Pause key, and the other is not reported for any key. */ - {XK_Pause, ALLEGRO_KEY_PAUSE}, - {XK_Break, ALLEGRO_KEY_PAUSE}, - - {XK_F1, ALLEGRO_KEY_F1}, - {XK_F2, ALLEGRO_KEY_F2}, - {XK_F3, ALLEGRO_KEY_F3}, - {XK_F4, ALLEGRO_KEY_F4}, - {XK_F5, ALLEGRO_KEY_F5}, - {XK_F6, ALLEGRO_KEY_F6}, - {XK_F7, ALLEGRO_KEY_F7}, - {XK_F8, ALLEGRO_KEY_F8}, - {XK_F9, ALLEGRO_KEY_F9}, - {XK_F10, ALLEGRO_KEY_F10}, - {XK_F11, ALLEGRO_KEY_F11}, - {XK_F12, ALLEGRO_KEY_F12}, - {XK_Escape, ALLEGRO_KEY_ESCAPE}, - {XK_grave, ALLEGRO_KEY_TILDE}, /* US left of 1 */ - {XK_minus, ALLEGRO_KEY_MINUS}, /* US right of 0 */ - {XK_equal, ALLEGRO_KEY_EQUALS}, /* US 2 right of 0 */ - {XK_BackSpace, ALLEGRO_KEY_BACKSPACE}, - {XK_Tab, ALLEGRO_KEY_TAB}, - {XK_bracketleft, ALLEGRO_KEY_OPENBRACE}, /* US right of P */ - {XK_bracketright, ALLEGRO_KEY_CLOSEBRACE}, /* US 2 right of P */ - {XK_Return, ALLEGRO_KEY_ENTER}, - {XK_semicolon, ALLEGRO_KEY_SEMICOLON}, /* US right of L */ - {XK_apostrophe, ALLEGRO_KEY_QUOTE}, /* US 2 right of L */ - {XK_backslash, ALLEGRO_KEY_BACKSLASH}, /* US 3 right of L */ - {XK_less, ALLEGRO_KEY_BACKSLASH2}, /* US left of Y */ - {XK_comma, ALLEGRO_KEY_COMMA}, /* US right of M */ - {XK_period, ALLEGRO_KEY_FULLSTOP}, /* US 2 right of M */ - {XK_slash, ALLEGRO_KEY_SLASH}, /* US 3 right of M */ - {XK_space, ALLEGRO_KEY_SPACE}, - {XK_Insert, ALLEGRO_KEY_INSERT}, - {XK_Delete, ALLEGRO_KEY_DELETE}, - {XK_Home, ALLEGRO_KEY_HOME}, - {XK_End, ALLEGRO_KEY_END}, - {XK_Page_Up, ALLEGRO_KEY_PGUP}, - {XK_Page_Down, ALLEGRO_KEY_PGDN}, - {XK_Left, ALLEGRO_KEY_LEFT}, - {XK_Right, ALLEGRO_KEY_RIGHT}, - {XK_Up, ALLEGRO_KEY_UP}, - {XK_Down, ALLEGRO_KEY_DOWN}, - {XK_KP_Divide, ALLEGRO_KEY_PAD_SLASH}, - {XK_KP_Multiply, ALLEGRO_KEY_PAD_ASTERISK}, - {XK_KP_Subtract, ALLEGRO_KEY_PAD_MINUS}, - {XK_KP_Add, ALLEGRO_KEY_PAD_PLUS}, - {XK_KP_Enter, ALLEGRO_KEY_PAD_ENTER}, - {XK_Print, ALLEGRO_KEY_PRINTSCREEN}, - - //{, ALLEGRO_KEY_ABNT_C1}, - //{, ALLEGRO_KEY_YEN}, - //{, ALLEGRO_KEY_KANA}, - //{, ALLEGRO_KEY_CONVERT}, - //{, ALLEGRO_KEY_NOCONVERT}, - //{, ALLEGRO_KEY_AT}, - //{, ALLEGRO_KEY_CIRCUMFLEX}, - //{, ALLEGRO_KEY_COLON2}, - //{, ALLEGRO_KEY_KANJI}, - {XK_KP_Equal, ALLEGRO_KEY_PAD_EQUALS}, /* MacOS X */ - //{, ALLEGRO_KEY_BACKQUOTE}, /* MacOS X */ - //{, ALLEGRO_KEY_SEMICOLON}, /* MacOS X */ - //{, ALLEGRO_KEY_COMMAND}, /* MacOS X */ - - {XK_Shift_L, ALLEGRO_KEY_LSHIFT}, - {XK_Shift_R, ALLEGRO_KEY_RSHIFT}, - {XK_Control_L, ALLEGRO_KEY_LCTRL}, - {XK_Control_R, ALLEGRO_KEY_RCTRL}, - {XK_Alt_L, ALLEGRO_KEY_ALT}, + {XK_Pause, A5O_KEY_PAUSE}, + {XK_Break, A5O_KEY_PAUSE}, + + {XK_F1, A5O_KEY_F1}, + {XK_F2, A5O_KEY_F2}, + {XK_F3, A5O_KEY_F3}, + {XK_F4, A5O_KEY_F4}, + {XK_F5, A5O_KEY_F5}, + {XK_F6, A5O_KEY_F6}, + {XK_F7, A5O_KEY_F7}, + {XK_F8, A5O_KEY_F8}, + {XK_F9, A5O_KEY_F9}, + {XK_F10, A5O_KEY_F10}, + {XK_F11, A5O_KEY_F11}, + {XK_F12, A5O_KEY_F12}, + {XK_Escape, A5O_KEY_ESCAPE}, + {XK_grave, A5O_KEY_TILDE}, /* US left of 1 */ + {XK_minus, A5O_KEY_MINUS}, /* US right of 0 */ + {XK_equal, A5O_KEY_EQUALS}, /* US 2 right of 0 */ + {XK_BackSpace, A5O_KEY_BACKSPACE}, + {XK_Tab, A5O_KEY_TAB}, + {XK_bracketleft, A5O_KEY_OPENBRACE}, /* US right of P */ + {XK_bracketright, A5O_KEY_CLOSEBRACE}, /* US 2 right of P */ + {XK_Return, A5O_KEY_ENTER}, + {XK_semicolon, A5O_KEY_SEMICOLON}, /* US right of L */ + {XK_apostrophe, A5O_KEY_QUOTE}, /* US 2 right of L */ + {XK_backslash, A5O_KEY_BACKSLASH}, /* US 3 right of L */ + {XK_less, A5O_KEY_BACKSLASH2}, /* US left of Y */ + {XK_comma, A5O_KEY_COMMA}, /* US right of M */ + {XK_period, A5O_KEY_FULLSTOP}, /* US 2 right of M */ + {XK_slash, A5O_KEY_SLASH}, /* US 3 right of M */ + {XK_space, A5O_KEY_SPACE}, + {XK_Insert, A5O_KEY_INSERT}, + {XK_Delete, A5O_KEY_DELETE}, + {XK_Home, A5O_KEY_HOME}, + {XK_End, A5O_KEY_END}, + {XK_Page_Up, A5O_KEY_PGUP}, + {XK_Page_Down, A5O_KEY_PGDN}, + {XK_Left, A5O_KEY_LEFT}, + {XK_Right, A5O_KEY_RIGHT}, + {XK_Up, A5O_KEY_UP}, + {XK_Down, A5O_KEY_DOWN}, + {XK_KP_Divide, A5O_KEY_PAD_SLASH}, + {XK_KP_Multiply, A5O_KEY_PAD_ASTERISK}, + {XK_KP_Subtract, A5O_KEY_PAD_MINUS}, + {XK_KP_Add, A5O_KEY_PAD_PLUS}, + {XK_KP_Enter, A5O_KEY_PAD_ENTER}, + {XK_Print, A5O_KEY_PRINTSCREEN}, + + //{, A5O_KEY_ABNT_C1}, + //{, A5O_KEY_YEN}, + //{, A5O_KEY_KANA}, + //{, A5O_KEY_CONVERT}, + //{, A5O_KEY_NOCONVERT}, + //{, A5O_KEY_AT}, + //{, A5O_KEY_CIRCUMFLEX}, + //{, A5O_KEY_COLON2}, + //{, A5O_KEY_KANJI}, + {XK_KP_Equal, A5O_KEY_PAD_EQUALS}, /* MacOS X */ + //{, A5O_KEY_BACKQUOTE}, /* MacOS X */ + //{, A5O_KEY_SEMICOLON}, /* MacOS X */ + //{, A5O_KEY_COMMAND}, /* MacOS X */ + + {XK_Shift_L, A5O_KEY_LSHIFT}, + {XK_Shift_R, A5O_KEY_RSHIFT}, + {XK_Control_L, A5O_KEY_LCTRL}, + {XK_Control_R, A5O_KEY_RCTRL}, + {XK_Alt_L, A5O_KEY_ALT}, /* Double mappings. This is a bit of a problem, since you can configure * X11 differently to what report for those keys. */ - {XK_Alt_R, ALLEGRO_KEY_ALTGR}, - {XK_ISO_Level3_Shift, ALLEGRO_KEY_ALTGR}, - {XK_Meta_L, ALLEGRO_KEY_LWIN}, - {XK_Super_L, ALLEGRO_KEY_LWIN}, - {XK_Meta_R, ALLEGRO_KEY_RWIN}, - {XK_Super_R, ALLEGRO_KEY_RWIN}, - - {XK_Menu, ALLEGRO_KEY_MENU}, - {XK_Scroll_Lock, ALLEGRO_KEY_SCROLLLOCK}, - {XK_Num_Lock, ALLEGRO_KEY_NUMLOCK}, - {XK_Caps_Lock, ALLEGRO_KEY_CAPSLOCK} + {XK_Alt_R, A5O_KEY_ALTGR}, + {XK_ISO_Level3_Shift, A5O_KEY_ALTGR}, + {XK_Meta_L, A5O_KEY_LWIN}, + {XK_Super_L, A5O_KEY_LWIN}, + {XK_Meta_R, A5O_KEY_RWIN}, + {XK_Super_R, A5O_KEY_RWIN}, + + {XK_Menu, A5O_KEY_MENU}, + {XK_Scroll_Lock, A5O_KEY_SCROLLLOCK}, + {XK_Num_Lock, A5O_KEY_NUMLOCK}, + {XK_Caps_Lock, A5O_KEY_CAPSLOCK} }; /* Table of: Allegro's modifier flag, associated X11 flag, toggle method. */ static int modifier_flags[8][3] = { - {ALLEGRO_KEYMOD_SHIFT, ShiftMask, 0}, - {ALLEGRO_KEYMOD_CAPSLOCK, LockMask, 1}, - {ALLEGRO_KEYMOD_CTRL, ControlMask, 0}, - {ALLEGRO_KEYMOD_ALT, Mod1Mask, 0}, - {ALLEGRO_KEYMOD_NUMLOCK, Mod2Mask, 1}, - {ALLEGRO_KEYMOD_SCROLLLOCK, Mod3Mask, 1}, - {ALLEGRO_KEYMOD_LWIN | ALLEGRO_KEYMOD_RWIN, Mod4Mask, 0}, /* Should we use only one? */ - {ALLEGRO_KEYMOD_ALTGR, Mod5Mask, 0} /* AltGr */ + {A5O_KEYMOD_SHIFT, ShiftMask, 0}, + {A5O_KEYMOD_CAPSLOCK, LockMask, 1}, + {A5O_KEYMOD_CTRL, ControlMask, 0}, + {A5O_KEYMOD_ALT, Mod1Mask, 0}, + {A5O_KEYMOD_NUMLOCK, Mod2Mask, 1}, + {A5O_KEYMOD_SCROLLLOCK, Mod3Mask, 1}, + {A5O_KEYMOD_LWIN | A5O_KEYMOD_RWIN, Mod4Mask, 0}, /* Should we use only one? */ + {A5O_KEYMOD_ALTGR, Mod5Mask, 0} /* AltGr */ }; /* Table of key names. */ -static char const *key_names[ALLEGRO_KEY_MAX]; +static char const *key_names[A5O_KEY_MAX]; @@ -336,7 +336,7 @@ static int find_unknown_key_assignment(int i) { int j; - for (j = 1; j < ALLEGRO_KEY_MAX; j++) { + for (j = 1; j < A5O_KEY_MAX; j++) { if (!used[j]) { const char *str; keycode_to_scancode[i] = j; @@ -351,9 +351,9 @@ static int find_unknown_key_assignment(int i) } } - if (j == ALLEGRO_KEY_MAX) { - ALLEGRO_ERROR("You have more keys reported by X than Allegro's " - "maximum of %i keys. Please send a bug report.\n", ALLEGRO_KEY_MAX); + if (j == A5O_KEY_MAX) { + A5O_ERROR("You have more keys reported by X than Allegro's " + "maximum of %i keys. Please send a bug report.\n", A5O_KEY_MAX); keycode_to_scancode[i] = 0; } @@ -363,7 +363,7 @@ static int find_unknown_key_assignment(int i) char *sym_str = XKeysymToString(keysyms[sym_per_key * (i - min_keycode) + j]); sprintf(str + strlen(str), " %s", sym_str ? sym_str : "NULL"); } - ALLEGRO_DEBUG("%s assigned to %i.\n", str, keycode_to_scancode[i]); + A5O_DEBUG("%s assigned to %i.\n", str, keycode_to_scancode[i]); return keycode_to_scancode[i]; } @@ -372,7 +372,7 @@ static int find_unknown_key_assignment(int i) /* XCheckIfAny predicate that checks if this event may be a key repeat event */ static Bool check_for_repeat(Display *display, XEvent *event, XPointer arg) { - ALLEGRO_KEY_REPEAT_DATA *d = (ALLEGRO_KEY_REPEAT_DATA *)arg; + A5O_KEY_REPEAT_DATA *d = (A5O_KEY_REPEAT_DATA *)arg; (void)display; @@ -389,7 +389,7 @@ static Bool check_for_repeat(Display *display, XEvent *event, XPointer arg) /* _al_xwin_keyboard_handler: * Keyboard "interrupt" handler. */ -void _al_xwin_keyboard_handler(XKeyEvent *event, ALLEGRO_DISPLAY *display) +void _al_xwin_keyboard_handler(XKeyEvent *event, A5O_DISPLAY *display) { int keycode; @@ -403,7 +403,7 @@ void _al_xwin_keyboard_handler(XKeyEvent *event, ALLEGRO_DISPLAY *display) update_shifts(event); /* Special case the pause key. */ - if (keycode == ALLEGRO_KEY_PAUSE) { + if (keycode == A5O_KEY_PAUSE) { /* Allegro ignore's releasing of the pause key. */ if (event->type == KeyRelease) return; @@ -422,7 +422,7 @@ void _al_xwin_keyboard_handler(XKeyEvent *event, ALLEGRO_DISPLAY *display) int unicode = 0; int filtered = 0; -#if defined (ALLEGRO_XWINDOWS_WITH_XIM) && defined(X_HAVE_UTF8_STRING) +#if defined (A5O_XWINDOWS_WITH_XIM) && defined(X_HAVE_UTF8_STRING) if (xic) { len = Xutf8LookupString(xic, event, buffer, sizeof buffer, NULL, NULL); } @@ -433,14 +433,14 @@ void _al_xwin_keyboard_handler(XKeyEvent *event, ALLEGRO_DISPLAY *display) len = XLookupString(event, buffer, sizeof buffer, NULL, NULL); } buffer[len] = '\0'; - ALLEGRO_USTR_INFO info; - const ALLEGRO_USTR *ustr = al_ref_cstr(&info, buffer); + A5O_USTR_INFO info; + const A5O_USTR *ustr = al_ref_cstr(&info, buffer); unicode = al_ustr_get(ustr, 0); if (unicode < 0) unicode = 0; -#ifdef ALLEGRO_XWINDOWS_WITH_XIM - ALLEGRO_DISPLAY_XGLX *glx = (void *)display; +#ifdef A5O_XWINDOWS_WITH_XIM + A5O_DISPLAY_XGLX *glx = (void *)display; filtered = XFilterEvent((XEvent *)event, glx->window); #endif if (keycode || unicode) { @@ -458,7 +458,7 @@ void _al_xwin_keyboard_handler(XKeyEvent *event, ALLEGRO_DISPLAY *display) * This is unnecessary on systems where XkbSetDetectableAutorepeat works. */ if (XPending(event->display) > 0) { - ALLEGRO_KEY_REPEAT_DATA d; + A5O_KEY_REPEAT_DATA d; XEvent dummy; d.event = event; d.found = false; @@ -476,15 +476,15 @@ void _al_xwin_keyboard_handler(XKeyEvent *event, ALLEGRO_DISPLAY *display) /* _al_xwin_keyboard_switch_handler: * Handle a focus switch event. */ -void _al_xwin_keyboard_switch_handler(ALLEGRO_DISPLAY *display, bool focus_in) +void _al_xwin_keyboard_switch_handler(A5O_DISPLAY *display, bool focus_in) { _al_event_source_lock(&the_keyboard.parent.es); if (focus_in) { the_keyboard.state.display = display; -#ifdef ALLEGRO_XWINDOWS_WITH_XIM +#ifdef A5O_XWINDOWS_WITH_XIM if (xic) { - ALLEGRO_DISPLAY_XGLX *display_glx = (void *)display; + A5O_DISPLAY_XGLX *display_glx = (void *)display; XSetICValues(xic, XNClientWindow, display_glx->window, NULL); } #endif @@ -521,7 +521,7 @@ static int find_allegro_key(KeySym sym) */ static const char *x_scancode_to_name(int scancode) { - ASSERT (scancode >= 0 && scancode < ALLEGRO_KEY_MAX); + ASSERT (scancode >= 0 && scancode < A5O_KEY_MAX); return key_names[scancode]; } @@ -529,17 +529,17 @@ static const char *x_scancode_to_name(int scancode) /* _al_xwin_get_keyboard_mapping: - * Generate a mapping from X11 keycodes to Allegro ALLEGRO_KEY_* codes. We have - * two goals: Every keypress should be mapped to a distinct Allegro ALLEGRO_KEY_* - * code. And we want the ALLEGRO_KEY_* codes to match the pressed + * Generate a mapping from X11 keycodes to Allegro A5O_KEY_* codes. We have + * two goals: Every keypress should be mapped to a distinct Allegro A5O_KEY_* + * code. And we want the A5O_KEY_* codes to match the pressed * key to some extent. To do the latter, the X11 KeySyms produced by a key * are examined. If a match is found in the table above, the mapping is * added to the mapping table. If no known KeySym is found for a key (or * the same KeySym is found for more keys) - the remaining keys are - * distributed arbitrarily to the remaining ALLEGRO_KEY_* codes. + * distributed arbitrarily to the remaining A5O_KEY_* codes. * * In a future version, this could be simplified by mapping *all* the X11 - * KeySyms to ALLEGRO_KEY_* codes. + * KeySyms to A5O_KEY_* codes. */ static bool _al_xwin_get_keyboard_mapping(void) @@ -548,7 +548,7 @@ static bool _al_xwin_get_keyboard_mapping(void) int count; int missing = 0; - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); memset(used, 0, sizeof used); memset(keycode_to_scancode, 0, sizeof keycode_to_scancode); @@ -562,7 +562,7 @@ static bool _al_xwin_get_keyboard_mapping(void) keysyms = XGetKeyboardMapping(system->x11display, min_keycode, count, &sym_per_key); - ALLEGRO_INFO("%i keys, %i symbols per key.\n", count, sym_per_key); + A5O_INFO("%i keys, %i symbols per key.\n", count, sym_per_key); if (sym_per_key <= 0) { return false; @@ -583,7 +583,7 @@ static bool _al_xwin_get_keyboard_mapping(void) snprintf(str, sizeof str, "key [%i: %s %s]", i, sym_str ? sym_str : "NULL", sym2_str ? sym2_str : "NULL"); - /* Hack for French keyboards, to correctly map ALLEGRO_KEY_0 to ALLEGRO_KEY_9. */ + /* Hack for French keyboards, to correctly map A5O_KEY_0 to A5O_KEY_9. */ if (sym2 >= XK_0 && sym2 <= XK_9) { allegro_key = find_allegro_key(sym2); } @@ -594,13 +594,13 @@ static bool _al_xwin_get_keyboard_mapping(void) if (allegro_key == 0) { missing++; - ALLEGRO_DEBUG("%s defering.\n", str); + A5O_DEBUG("%s defering.\n", str); } } else { /* No KeySym for this key - ignore it. */ keycode_to_scancode[i] = -1; - ALLEGRO_DEBUG("%s not assigned.\n", str); + A5O_DEBUG("%s not assigned.\n", str); } } @@ -613,7 +613,7 @@ static bool _al_xwin_get_keyboard_mapping(void) key_names[allegro_key] = XKeysymToString(keysyms[sym_per_key * (i - min_keycode)]); used[allegro_key] = 1; - ALLEGRO_DEBUG("%s%s assigned to %i.\n", str, + A5O_DEBUG("%s%s assigned to %i.\n", str, is_double ? " *double*" : "", allegro_key); } } @@ -643,19 +643,19 @@ static bool _al_xwin_get_keyboard_mapping(void) char *sym_str = XKeysymToString(sym); sprintf(str + strlen(str), " %s", sym_str ? sym_str : "NULL"); } - ALLEGRO_DEBUG("%s\n", str); + A5O_DEBUG("%s\n", str); } /* The [xkeymap] section can be useful, e.g. if trying to play a - * game which has X and Y hardcoded as ALLEGRO_KEY_X and ALLEGRO_KEY_Y to mean + * game which has X and Y hardcoded as A5O_KEY_X and A5O_KEY_Y to mean * left/right movement, but on the X11 keyboard X and Y are far apart. * For normal use, a user never should have to touch [xkeymap] anymore * though, and proper written programs will not hardcode such mappings. */ - ALLEGRO_CONFIG *c = al_get_system_config(); + A5O_CONFIG *c = al_get_system_config(); char const *key; - ALLEGRO_CONFIG_ENTRY *it; + A5O_CONFIG_ENTRY *it; key = al_get_first_config_entry(c, "xkeymap", &it); while (key) { char const *val; @@ -664,7 +664,7 @@ static bool _al_xwin_get_keyboard_mapping(void) int scancode = strtol(val, NULL, 10); if (keycode > 0 && scancode > 0) { keycode_to_scancode[keycode] = scancode; - ALLEGRO_WARN("User override: KeySym %i assigned to %i.\n", + A5O_WARN("User override: KeySym %i assigned to %i.\n", keycode, scancode); } key = al_get_next_config_entry(&it); @@ -681,22 +681,22 @@ static bool _al_xwin_get_keyboard_mapping(void) static void x_set_leds(int leds) { XKeyboardControl values; - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); ASSERT(xkeyboard_installed); _al_mutex_lock(&system->lock); values.led = 1; - values.led_mode = leds & ALLEGRO_KEYMOD_NUMLOCK ? LedModeOn : LedModeOff; + values.led_mode = leds & A5O_KEYMOD_NUMLOCK ? LedModeOn : LedModeOff; XChangeKeyboardControl(system->x11display, KBLed | KBLedMode, &values); values.led = 2; - values.led_mode = leds & ALLEGRO_KEYMOD_CAPSLOCK ? LedModeOn : LedModeOff; + values.led_mode = leds & A5O_KEYMOD_CAPSLOCK ? LedModeOn : LedModeOff; XChangeKeyboardControl(system->x11display, KBLed | KBLedMode, &values); values.led = 3; - values.led_mode = leds & ALLEGRO_KEYMOD_SCROLLLOCK ? LedModeOn : LedModeOff; + values.led_mode = leds & A5O_KEYMOD_SCROLLLOCK ? LedModeOn : LedModeOff; XChangeKeyboardControl(system->x11display, KBLed | KBLedMode, &values); _al_mutex_unlock(&system->lock); @@ -709,14 +709,14 @@ static void x_set_leds(int leds) */ static int x_keyboard_init(void) { -#ifdef ALLEGRO_XWINDOWS_WITH_XIM +#ifdef A5O_XWINDOWS_WITH_XIM char *old_locale; XIMStyles *xim_styles; XIMStyle xim_style = 0; char *imvalret; int i; #endif - ALLEGRO_SYSTEM_XGLX *s = (void *)al_get_system_driver(); + A5O_SYSTEM_XGLX *s = (void *)al_get_system_driver(); if (xkeyboard_installed) return 0; @@ -734,14 +734,14 @@ static int x_keyboard_init(void) Bool supported; XkbSetDetectableAutoRepeat(s->x11display, True, &supported); if (!supported) { - ALLEGRO_WARN("XkbSetDetectableAutoRepeat failed.\n"); + A5O_WARN("XkbSetDetectableAutoRepeat failed.\n"); } -#ifdef ALLEGRO_XWINDOWS_WITH_XIM - ALLEGRO_INFO("Using X Input Method.\n"); +#ifdef A5O_XWINDOWS_WITH_XIM + A5O_INFO("Using X Input Method.\n"); old_locale = setlocale(LC_CTYPE, NULL); - ALLEGRO_DEBUG("Old locale: %s\n", old_locale ? old_locale : "(null)"); + A5O_DEBUG("Old locale: %s\n", old_locale ? old_locale : "(null)"); if (old_locale) { /* The return value of setlocale() may be clobbered by the next call * to setlocale() so we must copy it. @@ -751,7 +751,7 @@ static int x_keyboard_init(void) /* Otherwise we are restricted to ISO-8859-1 characters. */ if (setlocale(LC_CTYPE, "") == NULL) { - ALLEGRO_WARN("Could not set default locale.\n"); + A5O_WARN("Could not set default locale.\n"); } /* By default never use an input method as we are not prepared to @@ -759,16 +759,16 @@ static int x_keyboard_init(void) */ char const *modifiers = XSetLocaleModifiers("@im=none"); if (modifiers == NULL) { - ALLEGRO_WARN("XSetLocaleModifiers failed.\n"); + A5O_WARN("XSetLocaleModifiers failed.\n"); } xim = XOpenIM(s->x11display, NULL, NULL, NULL); if (xim == NULL) { - ALLEGRO_WARN("XOpenIM failed.\n"); + A5O_WARN("XOpenIM failed.\n"); } if (old_locale) { - ALLEGRO_DEBUG("Restoring old locale: %s\n", old_locale); + A5O_DEBUG("Restoring old locale: %s\n", old_locale); setlocale(LC_CTYPE, old_locale); free(old_locale); } @@ -776,7 +776,7 @@ static int x_keyboard_init(void) if (xim) { imvalret = XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL); if (imvalret != NULL || xim_styles == NULL) { - ALLEGRO_WARN("Input method doesn't support any styles.\n"); + A5O_WARN("Input method doesn't support any styles.\n"); } if (xim_styles) { @@ -790,10 +790,10 @@ static int x_keyboard_init(void) } if (xim_style == 0) { - ALLEGRO_WARN("Input method doesn't support the style we support.\n"); + A5O_WARN("Input method doesn't support the style we support.\n"); } else { - ALLEGRO_INFO("Input method style = %ld\n", xim_style); + A5O_INFO("Input method style = %ld\n", xim_style); } XFree(xim_styles); } @@ -804,17 +804,17 @@ static int x_keyboard_init(void) XNInputStyle, xim_style, NULL); if (xic == NULL) { - ALLEGRO_WARN("XCreateIC failed.\n"); + A5O_WARN("XCreateIC failed.\n"); } else { - ALLEGRO_INFO("XCreateIC succeeded.\n"); + A5O_INFO("XCreateIC succeeded.\n"); } /* In case al_install_keyboard() is called when there already is * a display, we set it as client window. */ - ALLEGRO_DISPLAY *display = al_get_current_display(); - ALLEGRO_DISPLAY_XGLX *display_glx = (void *)display; + A5O_DISPLAY *display = al_get_current_display(); + A5O_DISPLAY_XGLX *display_glx = (void *)display; if (display_glx && xic) XSetICValues(xic, XNClientWindow, display_glx->window, NULL); } @@ -842,11 +842,11 @@ static void x_keyboard_exit(void) return; xkeyboard_installed = 0; - ALLEGRO_SYSTEM_XGLX *s = (void *)al_get_system_driver(); + A5O_SYSTEM_XGLX *s = (void *)al_get_system_driver(); _al_mutex_lock(&s->lock); -#ifdef ALLEGRO_XWINDOWS_WITH_XIM +#ifdef A5O_XWINDOWS_WITH_XIM if (xic) { XDestroyIC(xic); @@ -886,10 +886,10 @@ static void x_keyboard_exit(void) /* forward declarations */ static bool xkeybd_init_keyboard(void); static void xkeybd_exit_keyboard(void); -static ALLEGRO_KEYBOARD *xkeybd_get_keyboard(void); +static A5O_KEYBOARD *xkeybd_get_keyboard(void); static bool xkeybd_set_keyboard_leds(int leds); static const char *xkeybd_keycode_to_name(int keycode); -static void xkeybd_get_keyboard_state(ALLEGRO_KEYBOARD_STATE *ret_state); +static void xkeybd_get_keyboard_state(A5O_KEYBOARD_STATE *ret_state); static void xkeybd_clear_keyboard_state(void); @@ -897,7 +897,7 @@ static void xkeybd_clear_keyboard_state(void); /* the driver vtable */ #define KEYDRV_XWIN AL_ID('X','W','I','N') -static ALLEGRO_KEYBOARD_DRIVER keydrv_xwin = +static A5O_KEYBOARD_DRIVER keydrv_xwin = { KEYDRV_XWIN, "", @@ -914,7 +914,7 @@ static ALLEGRO_KEYBOARD_DRIVER keydrv_xwin = -ALLEGRO_KEYBOARD_DRIVER *_al_xwin_keyboard_driver(void) +A5O_KEYBOARD_DRIVER *_al_xwin_keyboard_driver(void) { return &keydrv_xwin; } @@ -940,7 +940,7 @@ static bool xkeybd_init_keyboard(void) if (value) { the_keyboard.three_finger_flag = !strncmp(value, "true", 4); } - ALLEGRO_DEBUG("Three finger flag enabled: %s\n", + A5O_DEBUG("Three finger flag enabled: %s\n", the_keyboard.three_finger_flag ? "true" : "false"); //_xwin_keydrv_set_leds(_key_shifts); @@ -966,11 +966,11 @@ static void xkeybd_exit_keyboard(void) /* xkeybd_get_keyboard: - * Returns the address of a ALLEGRO_KEYBOARD structure representing the keyboard. + * Returns the address of a A5O_KEYBOARD structure representing the keyboard. */ -static ALLEGRO_KEYBOARD *xkeybd_get_keyboard(void) +static A5O_KEYBOARD *xkeybd_get_keyboard(void) { - return (ALLEGRO_KEYBOARD *)&the_keyboard; + return (A5O_KEYBOARD *)&the_keyboard; } @@ -999,7 +999,7 @@ static const char *xkeybd_keycode_to_name(int keycode) /* xkeybd_get_keyboard_state: * Copy the current keyboard state into RET_STATE, with any necessary locking. */ -static void xkeybd_get_keyboard_state(ALLEGRO_KEYBOARD_STATE *ret_state) +static void xkeybd_get_keyboard_state(A5O_KEYBOARD_STATE *ret_state) { _al_event_source_lock(&the_keyboard.parent.es); { @@ -1030,7 +1030,7 @@ static void xkeybd_clear_keyboard_state(void) * The caller must lock the X-display. */ static void handle_key_press(int mycode, int unichar, int filtered, - unsigned int modifiers, ALLEGRO_DISPLAY *display) + unsigned int modifiers, A5O_DISPLAY *display) { bool is_repeat; @@ -1045,9 +1045,9 @@ static void handle_key_press(int mycode, int unichar, int filtered, /* Generate the events if necessary. */ if (_al_event_source_needs_to_generate_event(&the_keyboard.parent.es)) { - ALLEGRO_EVENT event; + A5O_EVENT event; - event.keyboard.type = ALLEGRO_EVENT_KEY_DOWN; + event.keyboard.type = A5O_EVENT_KEY_DOWN; event.keyboard.timestamp = al_get_time(); event.keyboard.display = display; event.keyboard.keycode = last_press_code; @@ -1063,8 +1063,8 @@ static void handle_key_press(int mycode, int unichar, int filtered, /* Don't send KEY_CHAR for events filtered by an input method, * nor modifier keys. */ - if (!filtered && mycode < ALLEGRO_KEY_MODIFIERS) { - event.keyboard.type = ALLEGRO_EVENT_KEY_CHAR; + if (!filtered && mycode < A5O_KEY_MODIFIERS) { + event.keyboard.type = A5O_EVENT_KEY_CHAR; event.keyboard.unichar = unichar; event.keyboard.modifiers = modifiers; event.keyboard.repeat = is_repeat; @@ -1075,10 +1075,10 @@ static void handle_key_press(int mycode, int unichar, int filtered, _al_event_source_unlock(&the_keyboard.parent.es); // FIXME? -#ifndef ALLEGRO_RASPBERRYPI +#ifndef A5O_RASPBERRYPI /* Toggle mouse grab key. The system driver should not be locked here. */ if (last_press_code && !is_repeat) { - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); if (system->toggle_mouse_grab_keycode && system->toggle_mouse_grab_keycode == mycode && (modifiers & system->toggle_mouse_grab_modifiers) @@ -1094,11 +1094,11 @@ static void handle_key_press(int mycode, int unichar, int filtered, /* Exit by Ctrl-Alt-End. */ if ((the_keyboard.three_finger_flag) - && ((mycode == ALLEGRO_KEY_DELETE) || (mycode == ALLEGRO_KEY_END)) - && (modifiers & ALLEGRO_KEYMOD_CTRL) - && (modifiers & (ALLEGRO_KEYMOD_ALT | ALLEGRO_KEYMOD_ALTGR))) + && ((mycode == A5O_KEY_DELETE) || (mycode == A5O_KEY_END)) + && (modifiers & A5O_KEYMOD_CTRL) + && (modifiers & (A5O_KEYMOD_ALT | A5O_KEYMOD_ALTGR))) { - ALLEGRO_WARN("Three finger combo detected. SIGTERMing " + A5O_WARN("Three finger combo detected. SIGTERMing " "pid %d\n", main_pid); kill(main_pid, SIGTERM); } @@ -1110,7 +1110,7 @@ static void handle_key_press(int mycode, int unichar, int filtered, * Hook for the X event dispatcher to handle key releases. * The caller must lock the X-display. */ -static void handle_key_release(int mycode, unsigned int modifiers, ALLEGRO_DISPLAY *display) +static void handle_key_release(int mycode, unsigned int modifiers, A5O_DISPLAY *display) { if (last_press_code == mycode) last_press_code = -1; @@ -1122,8 +1122,8 @@ static void handle_key_release(int mycode, unsigned int modifiers, ALLEGRO_DISPL /* Generate the release event if necessary. */ if (_al_event_source_needs_to_generate_event(&the_keyboard.parent.es)) { - ALLEGRO_EVENT event; - event.keyboard.type = ALLEGRO_EVENT_KEY_UP; + A5O_EVENT event; + event.keyboard.type = A5O_EVENT_KEY_UP; event.keyboard.timestamp = al_get_time(); event.keyboard.display = display; event.keyboard.keycode = mycode; diff --git a/src/x/xmousenu.c b/src/x/xmousenu.c index c2a258eef8..f0fe4f59f2 100644 --- a/src/x/xmousenu.c +++ b/src/x/xmousenu.c @@ -18,7 +18,7 @@ */ -#define ALLEGRO_NO_COMPATIBILITY +#define A5O_NO_COMPATIBILITY #include #include @@ -31,56 +31,56 @@ #include "allegro5/internal/aintern_xmouse.h" #include "allegro5/internal/aintern_xsystem.h" -#ifdef ALLEGRO_RASPBERRYPI +#ifdef A5O_RASPBERRYPI #include "allegro5/internal/aintern_raspberrypi.h" #include "allegro5/internal/aintern_vector.h" -#define ALLEGRO_SYSTEM_XGLX ALLEGRO_SYSTEM_RASPBERRYPI -#define ALLEGRO_DISPLAY_XGLX ALLEGRO_DISPLAY_RASPBERRYPI +#define A5O_SYSTEM_XGLX A5O_SYSTEM_RASPBERRYPI +#define A5O_DISPLAY_XGLX A5O_DISPLAY_RASPBERRYPI #endif -ALLEGRO_DEBUG_CHANNEL("mouse") +A5O_DEBUG_CHANNEL("mouse") -typedef struct ALLEGRO_MOUSE_XWIN +typedef struct A5O_MOUSE_XWIN { - ALLEGRO_MOUSE parent; - ALLEGRO_MOUSE_STATE state; + A5O_MOUSE parent; + A5O_MOUSE_STATE state; int min_x, min_y; int max_x, max_y; -} ALLEGRO_MOUSE_XWIN; +} A5O_MOUSE_XWIN; static bool xmouse_installed = false; /* the one and only mouse object */ -static ALLEGRO_MOUSE_XWIN the_mouse; +static A5O_MOUSE_XWIN the_mouse; /* forward declarations */ static bool xmouse_init(void); static void xmouse_exit(void); -static ALLEGRO_MOUSE *xmouse_get_mouse(void); +static A5O_MOUSE *xmouse_get_mouse(void); static unsigned int xmouse_get_mouse_num_buttons(void); static unsigned int xmouse_get_mouse_num_axes(void); -static bool xmouse_set_mouse_xy(ALLEGRO_DISPLAY *,int x, int y); +static bool xmouse_set_mouse_xy(A5O_DISPLAY *,int x, int y); static bool xmouse_set_mouse_axis(int which, int z); -static void xmouse_get_state(ALLEGRO_MOUSE_STATE *ret_state); +static void xmouse_get_state(A5O_MOUSE_STATE *ret_state); -static void wheel_motion_handler(int x_button, ALLEGRO_DISPLAY *display); +static void wheel_motion_handler(int x_button, A5O_DISPLAY *display); static unsigned int x_button_to_al_button(unsigned int x_button); static void generate_mouse_event(unsigned int type, int x, int y, int z, int w, float pressure, int dx, int dy, int dz, int dw, unsigned int button, - ALLEGRO_DISPLAY *display); + A5O_DISPLAY *display); /* the driver vtable */ #define MOUSEDRV_XWIN AL_ID('X','W','I','N') -static ALLEGRO_MOUSE_DRIVER mousedrv_xwin = +static A5O_MOUSE_DRIVER mousedrv_xwin = { MOUSEDRV_XWIN, "", @@ -98,7 +98,7 @@ static ALLEGRO_MOUSE_DRIVER mousedrv_xwin = -ALLEGRO_MOUSE_DRIVER *_al_xwin_mouse_driver(void) +A5O_MOUSE_DRIVER *_al_xwin_mouse_driver(void) { return &mousedrv_xwin; } @@ -109,8 +109,8 @@ ALLEGRO_MOUSE_DRIVER *_al_xwin_mouse_driver(void) */ static bool xmouse_init(void) { - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); - ALLEGRO_DISPLAY *display; + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_DISPLAY *display; int x, y; if (system->x11display == NULL) @@ -153,13 +153,13 @@ static void xmouse_exit(void) /* xmouse_get_mouse: - * Returns the address of a ALLEGRO_MOUSE structure representing the mouse. + * Returns the address of a A5O_MOUSE structure representing the mouse. */ -static ALLEGRO_MOUSE *xmouse_get_mouse(void) +static A5O_MOUSE *xmouse_get_mouse(void) { ASSERT(xmouse_installed); - return (ALLEGRO_MOUSE *)&the_mouse; + return (A5O_MOUSE *)&the_mouse; } @@ -171,7 +171,7 @@ static unsigned int xmouse_get_mouse_num_buttons(void) { int num_buttons; unsigned char map[32]; - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); ASSERT(xmouse_installed); @@ -189,7 +189,7 @@ static unsigned int xmouse_get_mouse_num_buttons(void) for (i = 0; i < num_buttons; i++) { sprintf(debug + strlen(debug), "%2d,", map[i]); } - ALLEGRO_DEBUG("XGetPointerMapping: %s\n", debug); + A5O_DEBUG("XGetPointerMapping: %s\n", debug); #endif if (num_buttons < 1) @@ -216,14 +216,14 @@ static unsigned int xmouse_get_mouse_num_axes(void) /* xmouse_set_mouse_xy: * Set the mouse position. Return true if successful. */ -static bool xmouse_set_mouse_xy(ALLEGRO_DISPLAY *display, int x, int y) +static bool xmouse_set_mouse_xy(A5O_DISPLAY *display, int x, int y) { if (!xmouse_installed) return false; - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); Display *x11display = system->x11display; - ALLEGRO_DISPLAY_XGLX *d = (void *)display; + A5O_DISPLAY_XGLX *d = (void *)display; int window_width = al_get_display_width(display); int window_height = al_get_display_height(display); @@ -233,7 +233,7 @@ static bool xmouse_set_mouse_xy(ALLEGRO_DISPLAY *display, int x, int y) the_mouse.state.x = x; the_mouse.state.y = y; -#ifdef ALLEGRO_RASPBERRYPI +#ifdef A5O_RASPBERRYPI float scale_x, scale_y; _al_raspberrypi_get_mouse_scale_ratios(&scale_x, &scale_y); x /= scale_x; @@ -288,7 +288,7 @@ static bool xmouse_set_mouse_axis(int which, int v) the_mouse.state.w = w; generate_mouse_event( - ALLEGRO_EVENT_MOUSE_AXES, + A5O_EVENT_MOUSE_AXES, the_mouse.state.x, the_mouse.state.y, the_mouse.state.z, the_mouse.state.w, the_mouse.state.pressure, 0, 0, dz, dw, @@ -306,7 +306,7 @@ static bool xmouse_set_mouse_axis(int which, int v) /* xmouse_get_state: * Copy the current mouse state into RET_STATE, with any necessary locking. */ -static void xmouse_get_state(ALLEGRO_MOUSE_STATE *ret_state) +static void xmouse_get_state(A5O_MOUSE_STATE *ret_state) { ASSERT(xmouse_installed); @@ -324,7 +324,7 @@ static void xmouse_get_state(ALLEGRO_MOUSE_STATE *ret_state) * server. */ void _al_xwin_mouse_button_press_handler(int x_button, - ALLEGRO_DISPLAY *display) + A5O_DISPLAY *display) { unsigned int al_button; @@ -344,7 +344,7 @@ void _al_xwin_mouse_button_press_handler(int x_button, the_mouse.state.pressure = the_mouse.state.buttons ? 1.0 : 0.0; /* TODO */ generate_mouse_event( - ALLEGRO_EVENT_MOUSE_BUTTON_DOWN, + A5O_EVENT_MOUSE_BUTTON_DOWN, the_mouse.state.x, the_mouse.state.y, the_mouse.state.z, the_mouse.state.w, the_mouse.state.pressure, 0, 0, 0, 0, @@ -359,7 +359,7 @@ void _al_xwin_mouse_button_press_handler(int x_button, * Called by _al_xwin_mouse_button_press_handler() if the ButtonPress event * received from the X server is actually for a mouse wheel movement. */ -static void wheel_motion_handler(int x_button, ALLEGRO_DISPLAY *display) +static void wheel_motion_handler(int x_button, A5O_DISPLAY *display) { int dz = 0, dw = 0; if (x_button == Button4) dz = 1; @@ -377,7 +377,7 @@ static void wheel_motion_handler(int x_button, ALLEGRO_DISPLAY *display) the_mouse.state.w += dw; generate_mouse_event( - ALLEGRO_EVENT_MOUSE_AXES, + A5O_EVENT_MOUSE_AXES, the_mouse.state.x, the_mouse.state.y, the_mouse.state.z, the_mouse.state.w, the_mouse.state.pressure, 0, 0, dz, dw, @@ -393,7 +393,7 @@ static void wheel_motion_handler(int x_button, ALLEGRO_DISPLAY *display) * X server. */ void _al_xwin_mouse_button_release_handler(int x_button, - ALLEGRO_DISPLAY *display) + A5O_DISPLAY *display) { int al_button; @@ -410,7 +410,7 @@ void _al_xwin_mouse_button_release_handler(int x_button, the_mouse.state.pressure = the_mouse.state.buttons ? 1.0 : 0.0; /* TODO */ generate_mouse_event( - ALLEGRO_EVENT_MOUSE_BUTTON_UP, + A5O_EVENT_MOUSE_BUTTON_UP, the_mouse.state.x, the_mouse.state.y, the_mouse.state.z, the_mouse.state.w, the_mouse.state.pressure, 0, 0, 0, 0, @@ -426,10 +426,10 @@ void _al_xwin_mouse_button_release_handler(int x_button, * server. */ void _al_xwin_mouse_motion_notify_handler(int x, int y, - ALLEGRO_DISPLAY *display) + A5O_DISPLAY *display) { - ALLEGRO_DISPLAY_XGLX *glx = (void *)display; - int event_type = ALLEGRO_EVENT_MOUSE_AXES; + A5O_DISPLAY_XGLX *glx = (void *)display; + int event_type = A5O_EVENT_MOUSE_AXES; if (!xmouse_installed) return; @@ -437,12 +437,12 @@ void _al_xwin_mouse_motion_notify_handler(int x, int y, /* Is this an event generated in response to al_set_mouse_xy? */ if (glx->mouse_warp) { glx->mouse_warp = false; - event_type = ALLEGRO_EVENT_MOUSE_WARPED; + event_type = A5O_EVENT_MOUSE_WARPED; } _al_event_source_lock(&the_mouse.parent.es); -#ifdef ALLEGRO_RASPBERRYPI +#ifdef A5O_RASPBERRYPI float scale_x, scale_y; _al_raspberrypi_get_mouse_scale_ratios(&scale_x, &scale_y); x *= scale_x; @@ -503,9 +503,9 @@ static void generate_mouse_event(unsigned int type, int x, int y, int z, int w, float pressure, int dx, int dy, int dz, int dw, unsigned int button, - ALLEGRO_DISPLAY *display) + A5O_DISPLAY *display) { - ALLEGRO_EVENT event; + A5O_EVENT event; if (!_al_event_source_needs_to_generate_event(&the_mouse.parent.es)) return; @@ -531,7 +531,7 @@ static void generate_mouse_event(unsigned int type, /* _al_xwin_mouse_switch_handler: * Handle a focus switch event. */ -void _al_xwin_mouse_switch_handler(ALLEGRO_DISPLAY *display, +void _al_xwin_mouse_switch_handler(A5O_DISPLAY *display, const XCrossingEvent *event) { int event_type; @@ -549,13 +549,13 @@ void _al_xwin_mouse_switch_handler(ALLEGRO_DISPLAY *display, the_mouse.state.display = display; the_mouse.state.x = event->x; the_mouse.state.y = event->y; - event_type = ALLEGRO_EVENT_MOUSE_ENTER_DISPLAY; + event_type = A5O_EVENT_MOUSE_ENTER_DISPLAY; break; case LeaveNotify: the_mouse.state.display = NULL; the_mouse.state.x = event->x; the_mouse.state.y = event->y; - event_type = ALLEGRO_EVENT_MOUSE_LEAVE_DISPLAY; + event_type = A5O_EVENT_MOUSE_LEAVE_DISPLAY; break; default: ASSERT(false); @@ -573,10 +573,10 @@ void _al_xwin_mouse_switch_handler(ALLEGRO_DISPLAY *display, _al_event_source_unlock(&the_mouse.parent.es); } -bool _al_xwin_grab_mouse(ALLEGRO_DISPLAY *display) +bool _al_xwin_grab_mouse(A5O_DISPLAY *display) { - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; int grab; bool ret; @@ -597,7 +597,7 @@ bool _al_xwin_grab_mouse(ALLEGRO_DISPLAY *display) bool _al_xwin_ungrab_mouse(void) { - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); _al_mutex_lock(&system->lock); XUngrabPointer(system->x11display, CurrentTime); diff --git a/src/x/xrandr.c b/src/x/xrandr.c index 36f3857837..31c79a7997 100644 --- a/src/x/xrandr.c +++ b/src/x/xrandr.c @@ -4,9 +4,9 @@ #include "allegro5/internal/aintern_xfullscreen.h" #include "allegro5/internal/aintern_xsystem.h" -#ifdef ALLEGRO_XWINDOWS_WITH_XRANDR +#ifdef A5O_XWINDOWS_WITH_XRANDR -ALLEGRO_DEBUG_CHANNEL("xrandr") +A5O_DEBUG_CHANNEL("xrandr") typedef struct xrandr_screen xrandr_screen; typedef struct xrandr_crtc xrandr_crtc; @@ -111,8 +111,8 @@ static void xrandr_clear_fake_refresh_rates(xrandr_mode *modes, int nmode) } } - ALLEGRO_WARN("Zeroing out fake refresh rates from nvidia proprietary driver.\n"); - ALLEGRO_WARN("Disable the DynamicTwinView driver option to avoid this.\n"); + A5O_WARN("Zeroing out fake refresh rates from nvidia proprietary driver.\n"); + A5O_WARN("Disable the DynamicTwinView driver option to avoid this.\n"); for (i = 0; i < nmode; i++) { modes[i].refresh = 0; @@ -131,7 +131,7 @@ static void xrandr_copy_output(xrandr_output *output, RROutput id, XRROutputInfo output->connection = rroutput->connection; output->subpixel_order = rroutput->subpixel_order; - ALLEGRO_DEBUG("output[%s] %s on crtc %i.\n", output->name, output->connection == RR_Connected ? "Connected" : "Not Connected", (int)output->crtc); + A5O_DEBUG("output[%s] %s on crtc %i.\n", output->name, output->connection == RR_Connected ? "Connected" : "Not Connected", (int)output->crtc); _al_vector_init(&output->crtcs, sizeof(RRCrtc)); if(rroutput->ncrtc) { @@ -173,7 +173,7 @@ static void xrandr_copy_crtc(xrandr_crtc *crtc, RRCrtc id, XRRCrtcInfo *rrcrtc) _al_vector_append_array(&crtc->connected, rrcrtc->noutput, rrcrtc->outputs); } - ALLEGRO_DEBUG("found %i outputs.\n", rrcrtc->noutput); + A5O_DEBUG("found %i outputs.\n", rrcrtc->noutput); _al_vector_init(&crtc->possible, sizeof(RROutput)); if(rrcrtc->npossible) { @@ -181,7 +181,7 @@ static void xrandr_copy_crtc(xrandr_crtc *crtc, RRCrtc id, XRRCrtcInfo *rrcrtc) int i; for(i = 0; i < rrcrtc->npossible; i++) { - ALLEGRO_DEBUG("output[%i] %i.\n", i, (int)rrcrtc->possible[i]); + A5O_DEBUG("output[%i] %i.\n", i, (int)rrcrtc->possible[i]); } } @@ -192,7 +192,7 @@ static void xrandr_copy_crtc(xrandr_crtc *crtc, RRCrtc id, XRRCrtcInfo *rrcrtc) crtc->align = CRTC_POS_NONE; } -static void xrandr_copy_screen(ALLEGRO_SYSTEM_XGLX *s, xrandr_screen *screen, XRRScreenResources *res) +static void xrandr_copy_screen(A5O_SYSTEM_XGLX *s, xrandr_screen *screen, XRRScreenResources *res) { int j; @@ -208,9 +208,9 @@ static void xrandr_copy_screen(ALLEGRO_SYSTEM_XGLX *s, xrandr_screen *screen, XR _al_vector_init(&screen->crtcs, sizeof(xrandr_crtc)); if(res->ncrtc) { - ALLEGRO_DEBUG("found %i crtcs.\n", res->ncrtc); + A5O_DEBUG("found %i crtcs.\n", res->ncrtc); for(j = 0; j < res->ncrtc; j++) { - ALLEGRO_DEBUG("crtc[%i] %i.\n", j, (int)res->crtcs[j]); + A5O_DEBUG("crtc[%i] %i.\n", j, (int)res->crtcs[j]); xrandr_crtc *crtc = _al_vector_alloc_back(&screen->crtcs); XRRCrtcInfo *rrcrtc = XRRGetCrtcInfo(s->x11display, res, res->crtcs[j]); @@ -222,9 +222,9 @@ static void xrandr_copy_screen(ALLEGRO_SYSTEM_XGLX *s, xrandr_screen *screen, XR _al_vector_init(&screen->outputs, sizeof(xrandr_output)); if(res->noutput) { - ALLEGRO_DEBUG("found %i outputs.\n", res->noutput); + A5O_DEBUG("found %i outputs.\n", res->noutput); for(j = 0; j < res->noutput; j++) { - ALLEGRO_DEBUG("output[%i] %i.\n", j, (int)res->outputs[j]); + A5O_DEBUG("output[%i] %i.\n", j, (int)res->outputs[j]); xrandr_output *output = _al_vector_alloc_back(&screen->outputs); XRROutputInfo *rroutput = XRRGetOutputInfo(s->x11display, res, res->outputs[j]); @@ -236,7 +236,7 @@ static void xrandr_copy_screen(ALLEGRO_SYSTEM_XGLX *s, xrandr_screen *screen, XR } } -static xrandr_crtc *xrandr_fetch_crtc(ALLEGRO_SYSTEM_XGLX *s, int sid, RRCrtc id) +static xrandr_crtc *xrandr_fetch_crtc(A5O_SYSTEM_XGLX *s, int sid, RRCrtc id) { unsigned int i; @@ -251,7 +251,7 @@ static xrandr_crtc *xrandr_fetch_crtc(ALLEGRO_SYSTEM_XGLX *s, int sid, RRCrtc id return NULL; } -static xrandr_output *xrandr_fetch_output(ALLEGRO_SYSTEM_XGLX *s, int sid, RROutput id) +static xrandr_output *xrandr_fetch_output(A5O_SYSTEM_XGLX *s, int sid, RROutput id) { unsigned int i; @@ -266,7 +266,7 @@ static xrandr_output *xrandr_fetch_output(ALLEGRO_SYSTEM_XGLX *s, int sid, RROut return NULL; } -static xrandr_mode *xrandr_fetch_mode(ALLEGRO_SYSTEM_XGLX *s, int sid, RRMode id) +static xrandr_mode *xrandr_fetch_mode(A5O_SYSTEM_XGLX *s, int sid, RRMode id) { unsigned int i; @@ -281,12 +281,12 @@ static xrandr_mode *xrandr_fetch_mode(ALLEGRO_SYSTEM_XGLX *s, int sid, RRMode id return NULL; } -static inline xrandr_crtc *xrandr_map_to_crtc(ALLEGRO_SYSTEM_XGLX *s, int sid, int adapter) +static inline xrandr_crtc *xrandr_map_to_crtc(A5O_SYSTEM_XGLX *s, int sid, int adapter) { return xrandr_fetch_crtc(s, sid, *(RRCrtc*)_al_vector_ref(&s->xrandr_adaptermap, adapter)); } -static inline xrandr_output *xrandr_map_adapter(ALLEGRO_SYSTEM_XGLX *s, int sid, int adapter) +static inline xrandr_output *xrandr_map_adapter(A5O_SYSTEM_XGLX *s, int sid, int adapter) { xrandr_crtc *crtc = xrandr_map_to_crtc(s, sid, adapter); return xrandr_fetch_output(s, sid, *(RROutput*)_al_vector_ref(&crtc->connected, 0)); @@ -309,9 +309,9 @@ static void xrandr_combine_output_rect(struct xrandr_rect *rect, xrandr_crtc *cr /* begin vtable methods */ -static int xrandr_get_xscreen(ALLEGRO_SYSTEM_XGLX *s, int adapter); +static int xrandr_get_xscreen(A5O_SYSTEM_XGLX *s, int adapter); -static bool xrandr_query(ALLEGRO_SYSTEM_XGLX *s) +static bool xrandr_query(A5O_SYSTEM_XGLX *s) { int screen_count = ScreenCount(s->x11display); int i; @@ -325,12 +325,12 @@ static bool xrandr_query(ALLEGRO_SYSTEM_XGLX *s) XRRScreenResources *res = XRRGetScreenResources(s->x11display, XRootWindow(s->x11display, i)); if(!res) { - ALLEGRO_DEBUG("failed to get screen resources for screen %i\n", i); + A5O_DEBUG("failed to get screen resources for screen %i\n", i); continue; } if(!res->noutput) { - ALLEGRO_DEBUG("screen %i doesn't have any outputs.\n", i); + A5O_DEBUG("screen %i doesn't have any outputs.\n", i); continue; } @@ -366,11 +366,11 @@ static bool xrandr_query(ALLEGRO_SYSTEM_XGLX *s) if(not_clone) { RRCrtc *crtc_ptr = _al_vector_alloc_back(&s->xrandr_adaptermap); - ALLEGRO_DEBUG("Map Allegro Adadpter %i to RandR CRTC %i.\n", (int)(_al_vector_size(&s->xrandr_adaptermap)-1), (int)crtc->id); + A5O_DEBUG("Map Allegro Adadpter %i to RandR CRTC %i.\n", (int)(_al_vector_size(&s->xrandr_adaptermap)-1), (int)crtc->id); *crtc_ptr = crtc->id; } else { - ALLEGRO_DEBUG("RandR CRTC %i is a clone, ignoring.\n", (int)crtc->id); + A5O_DEBUG("RandR CRTC %i is a clone, ignoring.\n", (int)crtc->id); } } @@ -397,29 +397,29 @@ static bool xrandr_query(ALLEGRO_SYSTEM_XGLX *s) if(crtc->x == crtc_j->x + (int)crtc_j->width) { crtc->align_to = crtc_j->id; crtc->align = CRTC_POS_RIGHTOF; - ALLEGRO_DEBUG("Adapter %i is RightOf Adapter %i.\n", i, j); + A5O_DEBUG("Adapter %i is RightOf Adapter %i.\n", i, j); } else if(crtc->x + (int)crtc->width == crtc_j->x) { crtc->align_to = crtc_j->id; crtc->align = CRTC_POS_LEFTOF; - ALLEGRO_DEBUG("Adapter %i is LeftOf Adapter %i.\n", i, j); + A5O_DEBUG("Adapter %i is LeftOf Adapter %i.\n", i, j); } else if(crtc->y == crtc_j->y + (int)crtc_j->height) { crtc->align_to = crtc_j->id; crtc->align = CRTC_POS_BELOW; - ALLEGRO_DEBUG("Adapter %i is Below Adapter %i.\n", i, j); + A5O_DEBUG("Adapter %i is Below Adapter %i.\n", i, j); } else if(crtc->y + (int)crtc->height == crtc_j->y) { crtc->align_to = crtc_j->id; crtc->align = CRTC_POS_ABOVE; - ALLEGRO_DEBUG("Adapter %i is Above Adapter %i.\n", i, j); + A5O_DEBUG("Adapter %i is Above Adapter %i.\n", i, j); } } } -#ifdef ALLEGRO_XWINDOWS_WITH_XINERAMA +#ifdef A5O_XWINDOWS_WITH_XINERAMA if (s->xinerama_available && s->xinerama_screen_count != (int)_al_vector_size(&s->xrandr_adaptermap)) { - ALLEGRO_WARN("XRandR and Xinerama seem to disagree on how many screens there are (%i vs %i), going to ignore XRandR.\n", (int)_al_vector_size(&s->xrandr_adaptermap), s->xinerama_screen_count); + A5O_WARN("XRandR and Xinerama seem to disagree on how many screens there are (%i vs %i), going to ignore XRandR.\n", (int)_al_vector_size(&s->xrandr_adaptermap), s->xinerama_screen_count); // only actually going to ignore the output count, and setting of modes on the extra xinerama screens. ret = false; } @@ -428,7 +428,7 @@ static bool xrandr_query(ALLEGRO_SYSTEM_XGLX *s) return ret; } -static int xrandr_get_num_modes(ALLEGRO_SYSTEM_XGLX *s, int adapter) +static int xrandr_get_num_modes(A5O_SYSTEM_XGLX *s, int adapter) { if(adapter < 0 || adapter >= (int)_al_vector_size(&s->xrandr_adaptermap)) return 0; @@ -438,7 +438,7 @@ static int xrandr_get_num_modes(ALLEGRO_SYSTEM_XGLX *s, int adapter) return _al_vector_size(&output->modes); } -static ALLEGRO_DISPLAY_MODE *xrandr_get_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter, int id, ALLEGRO_DISPLAY_MODE *amode) +static A5O_DISPLAY_MODE *xrandr_get_mode(A5O_SYSTEM_XGLX *s, int adapter, int id, A5O_DISPLAY_MODE *amode) { int xscreen = _al_xglx_get_xscreen(s, adapter); xrandr_output *output = xrandr_map_adapter(s, xscreen, adapter); @@ -456,7 +456,7 @@ static ALLEGRO_DISPLAY_MODE *xrandr_get_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter return amode; } -static bool xrandr_realign_crtc_origin(ALLEGRO_SYSTEM_XGLX *s, int xscreen, xrandr_crtc *crtc, int new_w, int new_h, int *x, int *y) +static bool xrandr_realign_crtc_origin(A5O_SYSTEM_XGLX *s, int xscreen, xrandr_crtc *crtc, int new_w, int new_h, int *x, int *y) { bool ret; @@ -491,7 +491,7 @@ static bool xrandr_realign_crtc_origin(ALLEGRO_SYSTEM_XGLX *s, int xscreen, xran break; default: - ALLEGRO_WARN("unknown crtc alignment flag (%i)!", crtc->align); + A5O_WARN("unknown crtc alignment flag (%i)!", crtc->align); ret = false; break; } @@ -499,7 +499,7 @@ static bool xrandr_realign_crtc_origin(ALLEGRO_SYSTEM_XGLX *s, int xscreen, xran return ret; } -static bool xrandr_set_mode(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, int w, int h, int format, int refresh) +static bool xrandr_set_mode(A5O_SYSTEM_XGLX *s, A5O_DISPLAY_XGLX *d, int w, int h, int format, int refresh) { int adapter = _al_xglx_get_adapter(s, d, false); int xscreen = _al_xglx_get_xscreen(s, adapter); @@ -510,16 +510,16 @@ static bool xrandr_set_mode(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, int xrandr_mode *cur_mode = xrandr_fetch_mode(s, xscreen, crtc->mode); if((int)cur_mode->width == w && (int)cur_mode->height == h && (refresh == 0 || refresh == (int)cur_mode->refresh)) { - ALLEGRO_DEBUG("mode already set, good to go\n"); + A5O_DEBUG("mode already set, good to go\n"); return true; } else { - ALLEGRO_DEBUG("new mode: %dx%d@%d old mode: %dx%d@%d.\n", w, h, refresh, cur_mode->width, cur_mode->height, cur_mode->refresh); + A5O_DEBUG("new mode: %dx%d@%d old mode: %dx%d@%d.\n", w, h, refresh, cur_mode->width, cur_mode->height, cur_mode->refresh); } int mode_idx = _al_xglx_fullscreen_select_mode(s, adapter, w, h, format, refresh); if(mode_idx == -1) { - ALLEGRO_DEBUG("mode %dx%d@%d not found\n", w, h, refresh); + A5O_DEBUG("mode %dx%d@%d not found\n", w, h, refresh); return false; } @@ -530,7 +530,7 @@ static bool xrandr_set_mode(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, int xrandr_realign_crtc_origin(s, xscreen, crtc, w, h, &new_x, &new_y); - ALLEGRO_DEBUG("xrandr: set mode %i+%i-%ix%i on adapter %i\n", new_x, new_y, w, h, adapter); + A5O_DEBUG("xrandr: set mode %i+%i-%ix%i on adapter %i\n", new_x, new_y, w, h, adapter); _al_mutex_lock(&s->lock); @@ -548,7 +548,7 @@ static bool xrandr_set_mode(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, int ); if (ok != RRSetConfigSuccess) { - ALLEGRO_ERROR("XRandR failed to set mode.\n"); + A5O_ERROR("XRandR failed to set mode.\n"); _al_mutex_unlock(&s->lock); return false; } @@ -581,20 +581,20 @@ static bool xrandr_set_mode(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, int return true; } -static void xrandr_restore_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter) +static void xrandr_restore_mode(A5O_SYSTEM_XGLX *s, int adapter) { int xscreen = _al_xglx_get_xscreen(s, adapter); xrandr_screen *screen = _al_vector_ref(&s->xrandr_screens, xscreen); xrandr_crtc *crtc = xrandr_map_to_crtc(s, xscreen, adapter); if(crtc->mode == crtc->original_mode) { - ALLEGRO_DEBUG("current crtc mode (%i) equals the original mode (%i), not restoring.\n", (int)crtc->mode, (int)crtc->original_mode); + A5O_DEBUG("current crtc mode (%i) equals the original mode (%i), not restoring.\n", (int)crtc->mode, (int)crtc->original_mode); return; } xrandr_mode *orig_mode = xrandr_fetch_mode(s, xscreen, crtc->original_mode); - ALLEGRO_DEBUG("restore mode %i+%i-%ix%i@%i on adapter %i\n", crtc->original_xoff, crtc->original_yoff, orig_mode->width, orig_mode->height, orig_mode->refresh, adapter); + A5O_DEBUG("restore mode %i+%i-%ix%i@%i on adapter %i\n", crtc->original_xoff, crtc->original_yoff, orig_mode->width, orig_mode->height, orig_mode->refresh, adapter); _al_mutex_lock(&s->lock); @@ -613,7 +613,7 @@ static void xrandr_restore_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter) ); if(ok != RRSetConfigSuccess) { - ALLEGRO_ERROR("failed to restore mode.\n"); + A5O_ERROR("failed to restore mode.\n"); } // XSync(s->x11display, False); @@ -621,7 +621,7 @@ static void xrandr_restore_mode(ALLEGRO_SYSTEM_XGLX *s, int adapter) _al_mutex_unlock(&s->lock); } -static void xrandr_get_display_offset(ALLEGRO_SYSTEM_XGLX *s, int adapter, int *x, int *y) +static void xrandr_get_display_offset(A5O_SYSTEM_XGLX *s, int adapter, int *x, int *y) { int xscreen = _al_xglx_get_xscreen(s, adapter); @@ -633,15 +633,15 @@ static void xrandr_get_display_offset(ALLEGRO_SYSTEM_XGLX *s, int adapter, int * *x = crtc->x; *y = crtc->y; - ALLEGRO_DEBUG("display offset: %ix%i.\n", *x, *y); + A5O_DEBUG("display offset: %ix%i.\n", *x, *y); } -static int xrandr_get_num_adapters(ALLEGRO_SYSTEM_XGLX *s) +static int xrandr_get_num_adapters(A5O_SYSTEM_XGLX *s) { return _al_vector_size(&s->xrandr_adaptermap); } -static bool xrandr_get_monitor_info(ALLEGRO_SYSTEM_XGLX *s, int adapter, ALLEGRO_MONITOR_INFO *mi) +static bool xrandr_get_monitor_info(A5O_SYSTEM_XGLX *s, int adapter, A5O_MONITOR_INFO *mi) { if(adapter < 0 || adapter >= (int)_al_vector_size(&s->xrandr_adaptermap)) return false; @@ -658,7 +658,7 @@ static bool xrandr_get_monitor_info(ALLEGRO_SYSTEM_XGLX *s, int adapter, ALLEGRO return true; } -static int xrandr_get_default_adapter(ALLEGRO_SYSTEM_XGLX *s) +static int xrandr_get_default_adapter(A5O_SYSTEM_XGLX *s) { // if we have more than one xrandr_screen, we're in multi-head x mode if(_al_vector_size(&s->xrandr_screens) > 1) @@ -679,12 +679,12 @@ static int xrandr_get_default_adapter(ALLEGRO_SYSTEM_XGLX *s) } } - ALLEGRO_DEBUG("selected default adapter: %i.\n", default_adapter); + A5O_DEBUG("selected default adapter: %i.\n", default_adapter); return default_adapter; } -static int xrandr_get_xscreen(ALLEGRO_SYSTEM_XGLX *s, int adapter) +static int xrandr_get_xscreen(A5O_SYSTEM_XGLX *s, int adapter) { // more than one screen means we have multi-head x mode if(_al_vector_size(&s->xrandr_screens) > 1) @@ -694,38 +694,38 @@ static int xrandr_get_xscreen(ALLEGRO_SYSTEM_XGLX *s, int adapter) return 0; } -static void xrandr_handle_xevent(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, XEvent *e) +static void xrandr_handle_xevent(A5O_SYSTEM_XGLX *s, A5O_DISPLAY_XGLX *d, XEvent *e) { if(e->type == s->xrandr_event_base + RRNotify) { XRRNotifyEvent *rre = (XRRNotifyEvent*)e; if(rre->subtype == RRNotify_CrtcChange) { XRRCrtcChangeNotifyEvent *rrce = (XRRCrtcChangeNotifyEvent*)rre; - ALLEGRO_DEBUG("RRNotify_CrtcChange!\n"); + A5O_DEBUG("RRNotify_CrtcChange!\n"); xrandr_crtc *crtc = xrandr_fetch_crtc(s, d->xscreen, rrce->crtc); if(!crtc) { - ALLEGRO_DEBUG("invalid RRCrtc(%i).\n", (int)rrce->crtc); + A5O_DEBUG("invalid RRCrtc(%i).\n", (int)rrce->crtc); return; } if(rrce->mode != crtc->mode) { - ALLEGRO_DEBUG("mode changed from %i to %i.\n", (int)crtc->mode, (int)rrce->mode); + A5O_DEBUG("mode changed from %i to %i.\n", (int)crtc->mode, (int)rrce->mode); crtc->mode = rrce->mode; } if(rrce->rotation != crtc->rotation) { - ALLEGRO_DEBUG("rotation changed from %i to %i.\n", crtc->rotation, rrce->rotation); + A5O_DEBUG("rotation changed from %i to %i.\n", crtc->rotation, rrce->rotation); crtc->rotation = rrce->rotation; } if(rrce->x != crtc->x || rrce->y != crtc->y) { - ALLEGRO_DEBUG("origin changed from %i+%i to %i+%i.\n", crtc->x, crtc->y, rrce->x, rrce->y); + A5O_DEBUG("origin changed from %i+%i to %i+%i.\n", crtc->x, crtc->y, rrce->x, rrce->y); crtc->x = rrce->x; crtc->y = rrce->y; } if(rrce->width != crtc->width || rrce->height != crtc->height) { - ALLEGRO_DEBUG("size changed from %ix%i to %ix%i.\n", crtc->width, crtc->height, rrce->width, rrce->height); + A5O_DEBUG("size changed from %ix%i to %ix%i.\n", crtc->width, crtc->height, rrce->width, rrce->height); crtc->width = rrce->width; crtc->height = rrce->height; } @@ -738,14 +738,14 @@ static void xrandr_handle_xevent(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d xrandr_output *output = xrandr_fetch_output(s, d->xscreen, rroe->output); if(!output) { - ALLEGRO_DEBUG("invalid RROutput(%i).\n", (int)rroe->output); + A5O_DEBUG("invalid RROutput(%i).\n", (int)rroe->output); return; } - ALLEGRO_DEBUG("xrandr: RRNotify_OutputChange %s!\n", output->name); + A5O_DEBUG("xrandr: RRNotify_OutputChange %s!\n", output->name); if(rroe->crtc != output->crtc) { - ALLEGRO_DEBUG("crtc changed from %i to %i.\n", (int)output->crtc, (int)rroe->crtc); + A5O_DEBUG("crtc changed from %i to %i.\n", (int)output->crtc, (int)rroe->crtc); output->crtc = rroe->crtc; } @@ -753,7 +753,7 @@ static void xrandr_handle_xevent(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d // that is, what happens when a monitor is connected, and disconnected... // IE: CHECK! if(rroe->connection != output->connection) { - ALLEGRO_DEBUG("connection changed from %i to %i.\n", output->connection, rroe->connection); + A5O_DEBUG("connection changed from %i to %i.\n", output->connection, rroe->connection); output->connection = rroe->connection; } @@ -761,17 +761,17 @@ static void xrandr_handle_xevent(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d output->timestamp = screen->timestamp; } else if(rre->subtype == RRNotify_OutputProperty) { - ALLEGRO_DEBUG("xrandr: RRNotify_OutputProperty!\n"); + A5O_DEBUG("xrandr: RRNotify_OutputProperty!\n"); } else { - ALLEGRO_DEBUG("xrandr: RRNotify_Unknown(%i)!\n", rre->subtype); + A5O_DEBUG("xrandr: RRNotify_Unknown(%i)!\n", rre->subtype); } } else if(e->type == s->xrandr_event_base + RRScreenChangeNotify) { XRRScreenChangeNotifyEvent *rre = (XRRScreenChangeNotifyEvent*)e; XRRUpdateConfiguration( e ); - ALLEGRO_DEBUG("RRScreenChangeNotify!\n"); + A5O_DEBUG("RRScreenChangeNotify!\n"); /* XXX I don't think we need to actually handle this event fully, * it only really deals with the virtual screen as a whole it seems @@ -787,7 +787,7 @@ static void xrandr_handle_xevent(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d /* begin "public" ctor/dtor methods */ -void _al_xsys_xrandr_init(ALLEGRO_SYSTEM_XGLX *s) +void _al_xsys_xrandr_init(A5O_SYSTEM_XGLX *s) { int error_base = 0; @@ -796,30 +796,30 @@ void _al_xsys_xrandr_init(ALLEGRO_SYSTEM_XGLX *s) if (XRRQueryExtension(s->x11display, &s->xrandr_event_base, &error_base)) { int minor_version = 0, major_version = 0; int status = XRRQueryVersion(s->x11display, &major_version, &minor_version); - ALLEGRO_INFO("XRandR version: %i.%i\n", major_version, minor_version); + A5O_INFO("XRandR version: %i.%i\n", major_version, minor_version); if (!status) { - ALLEGRO_WARN("XRandR not available, XRRQueryVersion failed.\n"); + A5O_WARN("XRandR not available, XRRQueryVersion failed.\n"); } else if (major_version == 1 && minor_version < 2) { /* this is unlikely to happen, unless the user has an ancient Xorg, Xorg will just emulate the latest version and return that instead of what the driver actually supports, stupid. */ - ALLEGRO_WARN("XRandR not available, unsupported version: %i.%i\n", major_version, minor_version); + A5O_WARN("XRandR not available, unsupported version: %i.%i\n", major_version, minor_version); } else { bool ret = xrandr_query(s); if (ret) { - ALLEGRO_INFO("XRandR is active\n"); + A5O_INFO("XRandR is active\n"); s->xrandr_available = 1; } else { - ALLEGRO_INFO("XRandR is not active\n"); + A5O_INFO("XRandR is not active\n"); } } } else { - ALLEGRO_WARN("XRandR extension is not available.\n"); + A5O_WARN("XRandR extension is not available.\n"); } if (s->xrandr_available) { @@ -839,11 +839,11 @@ void _al_xsys_xrandr_init(ALLEGRO_SYSTEM_XGLX *s) _al_mutex_unlock(&s->lock); } -void _al_xsys_xrandr_exit(ALLEGRO_SYSTEM_XGLX *s) +void _al_xsys_xrandr_exit(A5O_SYSTEM_XGLX *s) { #if 0 // int i; - ALLEGRO_DEBUG("XRandR exiting.\n"); + A5O_DEBUG("XRandR exiting.\n"); // for (i = 0; i < s->xrandr_output_count; i++) { // XRRFreeOutputInfo(s->xrandr_outputs[i]); @@ -853,7 +853,7 @@ void _al_xsys_xrandr_exit(ALLEGRO_SYSTEM_XGLX *s) // XRRFreeScreenResources(s->xrandr_res[i]); // } - ALLEGRO_DEBUG("XRRFreeScreenResources\n"); + A5O_DEBUG("XRRFreeScreenResources\n"); //if (s->xrandr_res) // XRRFreeScreenResources(s->xrandr_res); @@ -866,7 +866,7 @@ void _al_xsys_xrandr_exit(ALLEGRO_SYSTEM_XGLX *s) s->xrandr_output_count = 0; s->xrandr_outputs = NULL; - ALLEGRO_DEBUG("XRandR exit finished.\n"); + A5O_DEBUG("XRandR exit finished.\n"); #endif /* 0 */ int i; @@ -901,6 +901,6 @@ void _al_xsys_xrandr_exit(ALLEGRO_SYSTEM_XGLX *s) } -#endif /* ALLEGRO_XWINDOWS_WITH_XRANDR */ +#endif /* A5O_XWINDOWS_WITH_XRANDR */ /* vim: set sts=3 sw=3 et: */ diff --git a/src/x/xsystem.c b/src/x/xsystem.c index cf2e2a88de..f9c446c255 100644 --- a/src/x/xsystem.c +++ b/src/x/xsystem.c @@ -24,33 +24,33 @@ extern int _Xdebug; /* part of Xlib */ #include "xicon.h" -ALLEGRO_DEBUG_CHANNEL("system") +A5O_DEBUG_CHANNEL("system") -static ALLEGRO_SYSTEM_INTERFACE *xglx_vt; +static A5O_SYSTEM_INTERFACE *xglx_vt; -ALLEGRO_BITMAP *_al_xwin_initial_icon = NULL; +A5O_BITMAP *_al_xwin_initial_icon = NULL; static bool xglx_inhibit_screensaver(bool inhibit); /* Function: al_x_set_initial_icon */ -bool al_x_set_initial_icon(ALLEGRO_BITMAP *bitmap) +bool al_x_set_initial_icon(A5O_BITMAP *bitmap) { - ALLEGRO_STATE state; - al_store_state(&state, ALLEGRO_STATE_NEW_BITMAP_PARAMETERS); - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + A5O_STATE state; + al_store_state(&state, A5O_STATE_NEW_BITMAP_PARAMETERS); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); al_destroy_bitmap(_al_xwin_initial_icon); _al_xwin_initial_icon = al_clone_bitmap(bitmap); al_restore_state(&state); return true; } -static ALLEGRO_SYSTEM *xglx_initialize(int flags) +static A5O_SYSTEM *xglx_initialize(int flags) { Display *x11display; Display *gfxdisplay; - ALLEGRO_SYSTEM_XGLX *s; + A5O_SYSTEM_XGLX *s; (void)flags; @@ -66,13 +66,13 @@ static ALLEGRO_SYSTEM *xglx_initialize(int flags) /* Never ask. */ gfxdisplay = XOpenDisplay(0); if (!gfxdisplay) { - ALLEGRO_ERROR("XOpenDisplay failed second time.\n"); + A5O_ERROR("XOpenDisplay failed second time.\n"); XCloseDisplay(x11display); return NULL; } } else { - ALLEGRO_INFO("XOpenDisplay failed; assuming headless mode.\n"); + A5O_INFO("XOpenDisplay failed; assuming headless mode.\n"); gfxdisplay = NULL; } @@ -85,7 +85,7 @@ static ALLEGRO_SYSTEM *xglx_initialize(int flags) s->inhibit_screensaver = false; s->screen_saver_query_available = false; - _al_vector_init(&s->system.displays, sizeof (ALLEGRO_DISPLAY_XGLX *)); + _al_vector_init(&s->system.displays, sizeof (A5O_DISPLAY_XGLX *)); s->system.vt = xglx_vt; @@ -93,9 +93,9 @@ static ALLEGRO_SYSTEM *xglx_initialize(int flags) s->x11display = x11display; if (s->x11display) { - ALLEGRO_INFO("XGLX driver connected to X11 (%s %d).\n", + A5O_INFO("XGLX driver connected to X11 (%s %d).\n", ServerVendor(s->x11display), VendorRelease(s->x11display)); - ALLEGRO_INFO("X11 protocol version %d.%d.\n", + A5O_INFO("X11 protocol version %d.%d.\n", ProtocolVersion(s->x11display), ProtocolRevision(s->x11display)); /* We need to put *some* atom into the ClientMessage we send for @@ -111,7 +111,7 @@ static ALLEGRO_SYSTEM *xglx_initialize(int flags) _al_thread_create(&s->xevents_thread, _al_xwin_background_thread, s); s->have_xevents_thread = true; - ALLEGRO_INFO("events thread spawned.\n"); + A5O_INFO("events thread spawned.\n"); } const char *binding = al_get_config_value(al_get_system_config(), @@ -120,10 +120,10 @@ static ALLEGRO_SYSTEM *xglx_initialize(int flags) s->toggle_mouse_grab_keycode = _al_parse_key_binding(binding, &s->toggle_mouse_grab_modifiers); if (s->toggle_mouse_grab_keycode) { - ALLEGRO_DEBUG("Toggle mouse grab key: '%s'\n", binding); + A5O_DEBUG("Toggle mouse grab key: '%s'\n", binding); } else { - ALLEGRO_WARN("Cannot parse key binding '%s'\n", binding); + A5O_WARN("Cannot parse key binding '%s'\n", binding); } } @@ -132,10 +132,10 @@ static ALLEGRO_SYSTEM *xglx_initialize(int flags) static void xglx_shutdown_system(void) { - ALLEGRO_SYSTEM *s = al_get_system_driver(); - ALLEGRO_SYSTEM_XGLX *sx = (void *)s; + A5O_SYSTEM *s = al_get_system_driver(); + A5O_SYSTEM_XGLX *sx = (void *)s; - ALLEGRO_INFO("shutting down.\n"); + A5O_INFO("shutting down.\n"); if (sx->have_xevents_thread) { _al_thread_join(&sx->xevents_thread); @@ -144,8 +144,8 @@ static void xglx_shutdown_system(void) /* Close all open displays. */ while (_al_vector_size(&s->displays) > 0) { - ALLEGRO_DISPLAY **dptr = _al_vector_ref(&s->displays, 0); - ALLEGRO_DISPLAY *d = *dptr; + A5O_DISPLAY **dptr = _al_vector_ref(&s->displays, 0); + A5O_DISPLAY *d = *dptr; al_destroy_display(d); } _al_vector_free(&s->displays); @@ -165,7 +165,7 @@ static void xglx_shutdown_system(void) if (sx->x11display) { XCloseDisplay(sx->x11display); sx->x11display = None; - ALLEGRO_DEBUG("xsys: close x11display.\n"); + A5O_DEBUG("xsys: close x11display.\n"); } if (sx->gfxdisplay) { @@ -176,58 +176,58 @@ static void xglx_shutdown_system(void) al_free(sx); } -static ALLEGRO_DISPLAY_INTERFACE *xglx_get_display_driver(void) +static A5O_DISPLAY_INTERFACE *xglx_get_display_driver(void) { - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); _al_mutex_lock(&system->lock); /* _al_display_xglx_driver has global state. */ - ALLEGRO_DISPLAY_INTERFACE *driver = _al_display_xglx_driver(); + A5O_DISPLAY_INTERFACE *driver = _al_display_xglx_driver(); _al_mutex_unlock(&system->lock); return driver; } -static ALLEGRO_KEYBOARD_DRIVER *xglx_get_keyboard_driver(void) +static A5O_KEYBOARD_DRIVER *xglx_get_keyboard_driver(void) { return _al_xwin_keyboard_driver(); } -static ALLEGRO_MOUSE_DRIVER *xglx_get_mouse_driver(void) +static A5O_MOUSE_DRIVER *xglx_get_mouse_driver(void) { return _al_xwin_mouse_driver(); } -static ALLEGRO_JOYSTICK_DRIVER *xglx_get_joystick_driver(void) +static A5O_JOYSTICK_DRIVER *xglx_get_joystick_driver(void) { return _al_joystick_driver_list[0].driver; } -static ALLEGRO_HAPTIC_DRIVER *xglx_get_haptic_driver(void) +static A5O_HAPTIC_DRIVER *xglx_get_haptic_driver(void) { return _al_haptic_driver_list[0].driver; } -static ALLEGRO_TOUCH_INPUT_DRIVER *xglx_get_touch_driver(void) +static A5O_TOUCH_INPUT_DRIVER *xglx_get_touch_driver(void) { return _al_touch_input_driver_list[0].driver; } static int xglx_get_num_video_adapters(void) { - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); return _al_xglx_get_num_video_adapters(system); } -static bool xglx_get_monitor_info(int adapter, ALLEGRO_MONITOR_INFO *info) +static bool xglx_get_monitor_info(int adapter, A5O_MONITOR_INFO *info) { - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); return _al_xglx_get_monitor_info(system, adapter, info); } static bool xglx_get_cursor_position(int *ret_x, int *ret_y) { - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); Window root = RootWindow(system->x11display, 0); Window child; int wx, wy; @@ -242,10 +242,10 @@ static bool xglx_get_cursor_position(int *ret_x, int *ret_y) static bool xglx_inhibit_screensaver(bool inhibit) { - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); int temp, version_min, version_max; -#ifdef ALLEGRO_XWINDOWS_WITH_XSCREENSAVER +#ifdef A5O_XWINDOWS_WITH_XSCREENSAVER if (!XScreenSaverQueryExtension(system->x11display, &temp, &temp) || !XScreenSaverQueryVersion(system->x11display, &version_max, &version_min) || version_max < 1 || (version_max == 1 && version_min < 1)) { @@ -276,23 +276,23 @@ static bool xglx_inhibit_screensaver(bool inhibit) static int xglx_get_num_display_modes(void) { int adapter = al_get_new_display_adapter(); - ALLEGRO_SYSTEM_XGLX *s = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); + A5O_SYSTEM_XGLX *s = (A5O_SYSTEM_XGLX *)al_get_system_driver(); return _al_xglx_get_num_display_modes(s, adapter); } -static ALLEGRO_DISPLAY_MODE *xglx_get_display_mode(int mode, ALLEGRO_DISPLAY_MODE *dm) +static A5O_DISPLAY_MODE *xglx_get_display_mode(int mode, A5O_DISPLAY_MODE *dm) { int adapter = al_get_new_display_adapter(); - ALLEGRO_SYSTEM_XGLX *s = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); + A5O_SYSTEM_XGLX *s = (A5O_SYSTEM_XGLX *)al_get_system_driver(); return _al_xglx_get_display_mode(s, adapter, mode, dm); } static int xglx_get_monitor_dpi(int adapter) { - ALLEGRO_MONITOR_INFO info; - ALLEGRO_SYSTEM_XGLX *s = (void *)al_get_system_driver(); + A5O_MONITOR_INFO info; + A5O_SYSTEM_XGLX *s = (void *)al_get_system_driver(); int x2_mm; int y2_mm; int dpi_hori; @@ -312,14 +312,14 @@ static int xglx_get_monitor_dpi(int adapter) } /* Internal function to get a reference to this driver. */ -ALLEGRO_SYSTEM_INTERFACE *_al_system_xglx_driver(void) +A5O_SYSTEM_INTERFACE *_al_system_xglx_driver(void) { if (xglx_vt) return xglx_vt; xglx_vt = al_calloc(1, sizeof *xglx_vt); - xglx_vt->id = ALLEGRO_SYSTEM_ID_XGLX; + xglx_vt->id = A5O_SYSTEM_ID_XGLX; xglx_vt->initialize = xglx_initialize; xglx_vt->get_display_driver = xglx_get_display_driver; xglx_vt->get_keyboard_driver = xglx_get_keyboard_driver; diff --git a/src/x/xtouch.c b/src/x/xtouch.c index bd858cac2b..f5cdf3c2c1 100644 --- a/src/x/xtouch.c +++ b/src/x/xtouch.c @@ -15,7 +15,7 @@ * See readme.txt for copyright information. */ -#define ALLEGRO_NO_COMPATIBILITY +#define A5O_NO_COMPATIBILITY #include "allegro5/allegro.h" #include "allegro5/internal/aintern.h" @@ -26,21 +26,21 @@ #include "allegro5/internal/aintern_xsystem.h" #include "allegro5/internal/aintern_xtouch.h" -#ifdef ALLEGRO_XWINDOWS_WITH_XINPUT2 +#ifdef A5O_XWINDOWS_WITH_XINPUT2 #include #include -ALLEGRO_DEBUG_CHANNEL("touch") +A5O_DEBUG_CHANNEL("touch") /* the one and only touch object */ -static ALLEGRO_TOUCH_INPUT_STATE touch_input_state; -static ALLEGRO_TOUCH_INPUT touch_input; -static ALLEGRO_MOUSE_STATE mouse_state; -static int touch_ids[ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT]; /* the XInput id for touches */ +static A5O_TOUCH_INPUT_STATE touch_input_state; +static A5O_TOUCH_INPUT touch_input; +static A5O_MOUSE_STATE mouse_state; +static int touch_ids[A5O_TOUCH_INPUT_MAX_TOUCH_COUNT]; /* the XInput id for touches */ static int primary_touch_id = -1; static bool installed = false; static size_t initiali_time_stamp = ~0; @@ -51,7 +51,7 @@ static void reset_touch_input_state(void) { int i; - for (i = 0; i < ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT; i++) { + for (i = 0; i < A5O_TOUCH_INPUT_MAX_TOUCH_COUNT; i++) { touch_input_state.touches[i].id = -1; } } @@ -59,25 +59,25 @@ static void reset_touch_input_state(void) static void generate_touch_input_event(unsigned int type, double timestamp, int id, float x, float y, float dx, float dy, bool primary, - ALLEGRO_DISPLAY *disp) + A5O_DISPLAY *disp) { - ALLEGRO_EVENT event; + A5O_EVENT event; bool want_touch_event = _al_event_source_needs_to_generate_event(&touch_input.es); bool want_mouse_emulation_event; - if (touch_input.mouse_emulation_mode == ALLEGRO_MOUSE_EMULATION_5_0_x) { + if (touch_input.mouse_emulation_mode == A5O_MOUSE_EMULATION_5_0_x) { want_mouse_emulation_event = _al_event_source_needs_to_generate_event(&touch_input.mouse_emulation_es) && al_is_mouse_installed(); } else { want_mouse_emulation_event = _al_event_source_needs_to_generate_event(&touch_input.mouse_emulation_es) && primary && al_is_mouse_installed(); } - if (touch_input.mouse_emulation_mode == ALLEGRO_MOUSE_EMULATION_NONE) + if (touch_input.mouse_emulation_mode == A5O_MOUSE_EMULATION_NONE) want_mouse_emulation_event = false; - else if (touch_input.mouse_emulation_mode == ALLEGRO_MOUSE_EMULATION_INCLUSIVE) + else if (touch_input.mouse_emulation_mode == A5O_MOUSE_EMULATION_INCLUSIVE) want_touch_event = al_is_mouse_installed() ? (want_touch_event && !primary) : want_touch_event; - else if (touch_input.mouse_emulation_mode == ALLEGRO_MOUSE_EMULATION_EXCLUSIVE) + else if (touch_input.mouse_emulation_mode == A5O_MOUSE_EMULATION_EXCLUSIVE) want_touch_event = al_is_mouse_installed() ? false : want_touch_event; @@ -86,7 +86,7 @@ static void generate_touch_input_event(unsigned int type, double timestamp, if (want_touch_event) { event.touch.type = type; - event.touch.display = (ALLEGRO_DISPLAY*)disp; + event.touch.display = (A5O_DISPLAY*)disp; event.touch.timestamp = timestamp; event.touch.id = id; event.touch.x = x; @@ -100,12 +100,12 @@ static void generate_touch_input_event(unsigned int type, double timestamp, _al_event_source_unlock(&touch_input.es); } - if (touch_input.mouse_emulation_mode != ALLEGRO_MOUSE_EMULATION_NONE) { + if (touch_input.mouse_emulation_mode != A5O_MOUSE_EMULATION_NONE) { mouse_state.x = (int)x; mouse_state.y = (int)y; - if (type == ALLEGRO_EVENT_TOUCH_BEGIN) + if (type == A5O_EVENT_TOUCH_BEGIN) mouse_state.buttons++; - else if (type == ALLEGRO_EVENT_TOUCH_END) + else if (type == A5O_EVENT_TOUCH_END) mouse_state.buttons--; mouse_state.pressure = mouse_state.buttons ? 1.0 : 0.0; /* TODO */ @@ -114,22 +114,22 @@ static void generate_touch_input_event(unsigned int type, double timestamp, if (want_mouse_emulation_event) { switch (type) { - case ALLEGRO_EVENT_TOUCH_BEGIN: type = ALLEGRO_EVENT_MOUSE_BUTTON_DOWN; break; - case ALLEGRO_EVENT_TOUCH_CANCEL: - case ALLEGRO_EVENT_TOUCH_END: type = ALLEGRO_EVENT_MOUSE_BUTTON_UP; break; - case ALLEGRO_EVENT_TOUCH_MOVE: type = ALLEGRO_EVENT_MOUSE_AXES; break; + case A5O_EVENT_TOUCH_BEGIN: type = A5O_EVENT_MOUSE_BUTTON_DOWN; break; + case A5O_EVENT_TOUCH_CANCEL: + case A5O_EVENT_TOUCH_END: type = A5O_EVENT_MOUSE_BUTTON_UP; break; + case A5O_EVENT_TOUCH_MOVE: type = A5O_EVENT_MOUSE_AXES; break; } event.mouse.type = type; event.mouse.timestamp = timestamp; - event.mouse.display = (ALLEGRO_DISPLAY*)disp; + event.mouse.display = (A5O_DISPLAY*)disp; event.mouse.x = (int)x; event.mouse.y = (int)y; event.mouse.dx = (int)dx; event.mouse.dy = (int)dy; event.mouse.dz = 0; event.mouse.dw = 0; - if (touch_input.mouse_emulation_mode != ALLEGRO_MOUSE_EMULATION_5_0_x) { + if (touch_input.mouse_emulation_mode != A5O_MOUSE_EMULATION_5_0_x) { event.mouse.button = 1; } else { @@ -137,7 +137,7 @@ static void generate_touch_input_event(unsigned int type, double timestamp, } event.mouse.pressure = mouse_state.pressure; - if (touch_input.mouse_emulation_mode != ALLEGRO_MOUSE_EMULATION_5_0_x) { + if (touch_input.mouse_emulation_mode != A5O_MOUSE_EMULATION_5_0_x) { al_set_mouse_xy(event.mouse.display, event.mouse.x, event.mouse.y); } @@ -152,7 +152,7 @@ static int find_free_touch_state_index(void) { int i; - for (i = 0; i < ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT; i++) + for (i = 0; i < A5O_TOUCH_INPUT_MAX_TOUCH_COUNT; i++) if (touch_input_state.touches[i].id < 0) return i; @@ -164,7 +164,7 @@ static int find_touch_state_index_with_id(int id) { int i; - for (i = 0; i < ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT; i++) + for (i = 0; i < A5O_TOUCH_INPUT_MAX_TOUCH_COUNT; i++) if (touch_ids[i] == id) return i; @@ -172,13 +172,13 @@ static int find_touch_state_index_with_id(int id) } -static void touch_input_handle_begin(int id, double timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY *disp) +static void touch_input_handle_begin(int id, double timestamp, float x, float y, bool primary, A5O_DISPLAY *disp) { int index= find_free_touch_state_index(); if (index < 0) return; - ALLEGRO_TOUCH_STATE* state = touch_input_state.touches + index; + A5O_TOUCH_STATE* state = touch_input_state.touches + index; (void)primary; if (NULL == state) @@ -194,7 +194,7 @@ static void touch_input_handle_begin(int id, double timestamp, float x, float y, state->display = disp; _al_event_source_unlock(&touch_input.es); - generate_touch_input_event(ALLEGRO_EVENT_TOUCH_BEGIN, timestamp, + generate_touch_input_event(A5O_EVENT_TOUCH_BEGIN, timestamp, state->id, state->x, state->y, state->dx, state->dy, state->primary, disp); @@ -202,13 +202,13 @@ static void touch_input_handle_begin(int id, double timestamp, float x, float y, } -static void touch_input_handle_end(int id, double timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY *disp) +static void touch_input_handle_end(int id, double timestamp, float x, float y, bool primary, A5O_DISPLAY *disp) { int index= find_touch_state_index_with_id(id); if (index < 0) return; - ALLEGRO_TOUCH_STATE* state = touch_input_state.touches + index; + A5O_TOUCH_STATE* state = touch_input_state.touches + index; (void)primary; if (NULL == state) @@ -221,7 +221,7 @@ static void touch_input_handle_end(int id, double timestamp, float x, float y, b state->y = y; _al_event_source_unlock(&touch_input.es); - generate_touch_input_event(ALLEGRO_EVENT_TOUCH_END, timestamp, + generate_touch_input_event(A5O_EVENT_TOUCH_END, timestamp, state->id, state->x, state->y, state->dx, state->dy, state->primary, disp); @@ -232,13 +232,13 @@ static void touch_input_handle_end(int id, double timestamp, float x, float y, b } -static void touch_input_handle_move(int id, double timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY *disp) +static void touch_input_handle_move(int id, double timestamp, float x, float y, bool primary, A5O_DISPLAY *disp) { int index= find_touch_state_index_with_id(id); if (index < 0) return; - ALLEGRO_TOUCH_STATE* state = touch_input_state.touches + index; + A5O_TOUCH_STATE* state = touch_input_state.touches + index; (void)primary; if (NULL == state) @@ -254,19 +254,19 @@ static void touch_input_handle_move(int id, double timestamp, float x, float y, state->y = y; _al_event_source_unlock(&touch_input.es); - generate_touch_input_event(ALLEGRO_EVENT_TOUCH_MOVE, timestamp, + generate_touch_input_event(A5O_EVENT_TOUCH_MOVE, timestamp, state->id, state->x, state->y, state->dx, state->dy, state->primary, disp); } -static void touch_input_handle_cancel(int id, double timestamp, float x, float y, bool primary, ALLEGRO_DISPLAY *disp) +static void touch_input_handle_cancel(int id, double timestamp, float x, float y, bool primary, A5O_DISPLAY *disp) { int index= find_touch_state_index_with_id(id); if (index < 0) return; - ALLEGRO_TOUCH_STATE* state = touch_input_state.touches + index; + A5O_TOUCH_STATE* state = touch_input_state.touches + index; (void)primary; if (NULL == state) @@ -279,7 +279,7 @@ static void touch_input_handle_cancel(int id, double timestamp, float x, float y state->y = y; _al_event_source_unlock(&touch_input.es); - generate_touch_input_event(ALLEGRO_EVENT_TOUCH_CANCEL, timestamp, + generate_touch_input_event(A5O_EVENT_TOUCH_CANCEL, timestamp, state->id, state->x, state->y, state->dx, state->dy, state->primary, disp); _al_event_source_lock(&touch_input.es); @@ -290,14 +290,14 @@ static void touch_input_handle_cancel(int id, double timestamp, float x, float y static bool init_touch_input_api(void) { - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); Display *dpy = system->x11display; /* check XInput extension */ int ev; int err; if (!XQueryExtension(dpy, "XInputExtension", &opcode, &ev, &err)) { - ALLEGRO_DEBUG("XInput extension not available. Touch input unavailable.\n"); + A5O_DEBUG("XInput extension not available. Touch input unavailable.\n"); return false; } @@ -306,7 +306,7 @@ static bool init_touch_input_api(void) int minor = 2; int rc = XIQueryVersion(dpy, &major, &minor); if (rc != Success) { - ALLEGRO_DEBUG("XInput version is too old (%d.%d): Needs 2.2. Touch input unavailable.\n", major, minor); + A5O_DEBUG("XInput version is too old (%d.%d): Needs 2.2. Touch input unavailable.\n", major, minor); return false; } @@ -321,7 +321,7 @@ static bool init_touch_input_api(void) XITouchClassInfo *class = (XITouchClassInfo*)(dev->classes[j]); if (class->type == XITouchClass) { touch_devid = dev->deviceid; - ALLEGRO_DEBUG("Found touchscreen deviceid: %i\n", touch_devid); + A5O_DEBUG("Found touchscreen deviceid: %i\n", touch_devid); goto STOP_SEARCH_DEVICE; } } @@ -331,7 +331,7 @@ static bool init_touch_input_api(void) if (i >= cnt) { /* no device found */ - ALLEGRO_DEBUG("No touchscreen device found.\n"); + A5O_DEBUG("No touchscreen device found.\n"); return false; } @@ -347,7 +347,7 @@ static bool xtouch_init(void) if (!init_touch_input_api()) return false; - ALLEGRO_DEBUG("XInput2 touch input initialized.\n"); + A5O_DEBUG("XInput2 touch input initialized.\n"); memset(&touch_input, 0, sizeof(touch_input)); reset_touch_input_state(); @@ -356,7 +356,7 @@ static bool xtouch_init(void) _al_event_source_init(&touch_input.es); _al_event_source_init(&touch_input.mouse_emulation_es); - touch_input.mouse_emulation_mode = ALLEGRO_MOUSE_EMULATION_TRANSPARENT; + touch_input.mouse_emulation_mode = A5O_MOUSE_EMULATION_TRANSPARENT; initiali_time_stamp = al_get_time(); @@ -371,13 +371,13 @@ static void xtouch_exit(void) } -static ALLEGRO_TOUCH_INPUT* get_touch_input(void) +static A5O_TOUCH_INPUT* get_touch_input(void) { return &touch_input; } -static void get_touch_input_state(ALLEGRO_TOUCH_INPUT_STATE *ret_state) +static void get_touch_input_state(A5O_TOUCH_INPUT_STATE *ret_state) { _al_event_source_lock(&touch_input.es); *ret_state = touch_input_state; @@ -390,8 +390,8 @@ static void set_mouse_emulation_mode(int mode) if (touch_input.mouse_emulation_mode != mode) { int i; - for (i = 0; i < ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT; i++) { - ALLEGRO_TOUCH_STATE* touch = touch_input_state.touches + i; + for (i = 0; i < A5O_TOUCH_INPUT_MAX_TOUCH_COUNT; i++) { + A5O_TOUCH_STATE* touch = touch_input_state.touches + i; if (touch->id > 0) { touch_input_handle_cancel(touch_ids[i], initiali_time_stamp, @@ -407,7 +407,7 @@ static void set_mouse_emulation_mode(int mode) /* the driver vtable */ #define TOUCHDRV_XWIN AL_ID('X','W','I','N') -static ALLEGRO_TOUCH_INPUT_DRIVER touchdrv_xwin = +static A5O_TOUCH_INPUT_DRIVER touchdrv_xwin = { TOUCHDRV_XWIN, xtouch_init, @@ -422,15 +422,15 @@ static ALLEGRO_TOUCH_INPUT_DRIVER touchdrv_xwin = _AL_DRIVER_INFO _al_touch_input_driver_list[] = { -#ifdef ALLEGRO_XWINDOWS_WITH_XINPUT2 +#ifdef A5O_XWINDOWS_WITH_XINPUT2 {TOUCHDRV_XWIN, &touchdrv_xwin, true}, #endif {0, NULL, 0} }; -void _al_x_handle_touch_event(ALLEGRO_SYSTEM_XGLX *s, ALLEGRO_DISPLAY_XGLX *d, XEvent *e) +void _al_x_handle_touch_event(A5O_SYSTEM_XGLX *s, A5O_DISPLAY_XGLX *d, XEvent *e) { -#ifdef ALLEGRO_XWINDOWS_WITH_XINPUT2 +#ifdef A5O_XWINDOWS_WITH_XINPUT2 Display *x11display = s->x11display; XGenericEventCookie *cookie = &e->xcookie; if (!installed) diff --git a/src/x/xwindow.c b/src/x/xwindow.c index f52b9bb9ad..e21d195a52 100644 --- a/src/x/xwindow.c +++ b/src/x/xwindow.c @@ -9,20 +9,20 @@ #include "allegro5/internal/aintern_xsystem.h" #include "allegro5/internal/aintern_xwindow.h" -#ifdef ALLEGRO_RASPBERRYPI +#ifdef A5O_RASPBERRYPI #include "allegro5/internal/aintern_raspberrypi.h" -#define ALLEGRO_SYSTEM_XGLX ALLEGRO_SYSTEM_RASPBERRYPI -#define ALLEGRO_DISPLAY_XGLX ALLEGRO_DISPLAY_RASPBERRYPI +#define A5O_SYSTEM_XGLX A5O_SYSTEM_RASPBERRYPI +#define A5O_DISPLAY_XGLX A5O_DISPLAY_RASPBERRYPI #endif -ALLEGRO_DEBUG_CHANNEL("xwindow") +A5O_DEBUG_CHANNEL("xwindow") #define X11_ATOM(x) XInternAtom(x11, #x, False); -void _al_xwin_set_size_hints(ALLEGRO_DISPLAY *d, int x_off, int y_off) +void _al_xwin_set_size_hints(A5O_DISPLAY *d, int x_off, int y_off) { - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (void *)d; + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (void *)d; XSizeHints *sizehints; XWMHints *wmhints; XClassHint *classhints; @@ -31,7 +31,7 @@ void _al_xwin_set_size_hints(ALLEGRO_DISPLAY *d, int x_off, int y_off) sizehints = XAllocSizeHints(); sizehints->flags = 0; -#ifdef ALLEGRO_RASPBERRYPI +#ifdef A5O_RASPBERRYPI int x, y; _al_raspberrypi_get_screen_info(&x, &y, &w, &h); #else @@ -41,14 +41,14 @@ void _al_xwin_set_size_hints(ALLEGRO_DISPLAY *d, int x_off, int y_off) /* Do not force the size of the window on resizeable or fullscreen windows */ /* on fullscreen windows, it confuses most X Window Managers */ - if (!(d->flags & ALLEGRO_RESIZABLE) && !(d->flags & ALLEGRO_FULLSCREEN)) { + if (!(d->flags & A5O_RESIZABLE) && !(d->flags & A5O_FULLSCREEN)) { sizehints->flags |= PMinSize | PMaxSize | PBaseSize; sizehints->min_width = sizehints->max_width = sizehints->base_width = w; sizehints->min_height = sizehints->max_height = sizehints->base_height = h; } /* Constrain the window if needed. */ - if (d->use_constraints && (d->flags & ALLEGRO_RESIZABLE) && + if (d->use_constraints && (d->flags & A5O_RESIZABLE) && (d->min_w > 0 || d->min_h > 0 || d->max_w > 0 || d->max_h > 0)) { sizehints->flags |= PMinSize | PMaxSize | PBaseSize; @@ -63,13 +63,13 @@ void _al_xwin_set_size_hints(ALLEGRO_DISPLAY *d, int x_off, int y_off) // Tell WMs to respect our chosen position, otherwise the x_off/y_off // positions passed to XCreateWindow will be ignored by most WMs. if (x_off != INT_MAX && y_off != INT_MAX) { - ALLEGRO_DEBUG("Force window position to %d, %d.\n", x_off, y_off); + A5O_DEBUG("Force window position to %d, %d.\n", x_off, y_off); sizehints->flags |= PPosition; sizehints->x = x_off; sizehints->y = y_off; } - if (d->flags & ALLEGRO_FULLSCREEN) { + if (d->flags & A5O_FULLSCREEN) { /* kwin will improperly layer a panel over our window on a second display without this. * some other Size flags may cause glitches with various WMs, but this seems to be ok * with metacity and kwin. As noted in xdpy_create_display, compiz is just broken. @@ -84,7 +84,7 @@ void _al_xwin_set_size_hints(ALLEGRO_DISPLAY *d, int x_off, int y_off) wmhints->input = True; wmhints->flags = InputHint; - ALLEGRO_PATH *exepath = al_get_standard_path(ALLEGRO_EXENAME_PATH); + A5O_PATH *exepath = al_get_standard_path(A5O_EXENAME_PATH); /* Setup the class hints so we can get an icon (AfterStep) * We must use the executable filename here. @@ -107,10 +107,10 @@ void _al_xwin_set_size_hints(ALLEGRO_DISPLAY *d, int x_off, int y_off) } -void _al_xwin_reset_size_hints(ALLEGRO_DISPLAY *d) +void _al_xwin_reset_size_hints(A5O_DISPLAY *d) { - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (void *)d; + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (void *)d; XSizeHints *hints; hints = XAllocSizeHints(); @@ -129,16 +129,16 @@ void _al_xwin_reset_size_hints(ALLEGRO_DISPLAY *d) /* Note: The system mutex must be locked (exactly once) before * calling this as we call _al_display_xglx_await_resize. */ -void _al_xwin_set_fullscreen_window(ALLEGRO_DISPLAY *display, int value) +void _al_xwin_set_fullscreen_window(A5O_DISPLAY *display, int value) { - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; Display *x11 = system->x11display; -#ifndef ALLEGRO_RASPBERRYPI +#ifndef A5O_RASPBERRYPI int old_resize_count = glx->resize_count; #endif - ALLEGRO_DEBUG("Toggling _NET_WM_STATE_FULLSCREEN hint: %d\n", value); + A5O_DEBUG("Toggling _NET_WM_STATE_FULLSCREEN hint: %d\n", value); XEvent xev; xev.xclient.type = ClientMessage; @@ -159,7 +159,7 @@ void _al_xwin_set_fullscreen_window(ALLEGRO_DISPLAY *display, int value) XSendEvent( x11, -#if !defined ALLEGRO_RASPBERRYPI +#if !defined A5O_RASPBERRYPI RootWindowOfScreen(ScreenOfDisplay(x11, glx->xscreen)), #else RootWindowOfScreen(ScreenOfDisplay(x11, DefaultScreen(x11))), @@ -167,7 +167,7 @@ void _al_xwin_set_fullscreen_window(ALLEGRO_DISPLAY *display, int value) False, SubstructureRedirectMask | SubstructureNotifyMask, &xev); -#if !defined ALLEGRO_RASPBERRYPI +#if !defined A5O_RASPBERRYPI if (value == 2) { /* Only wait for a resize if toggling. */ _al_display_xglx_await_resize(display, old_resize_count, true); @@ -176,13 +176,13 @@ void _al_xwin_set_fullscreen_window(ALLEGRO_DISPLAY *display, int value) } -void _al_xwin_set_above(ALLEGRO_DISPLAY *display, int value) +void _al_xwin_set_above(A5O_DISPLAY *display, int value) { - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; Display *x11 = system->x11display; - ALLEGRO_DEBUG("Toggling _NET_WM_STATE_ABOVE hint: %d\n", value); + A5O_DEBUG("Toggling _NET_WM_STATE_ABOVE hint: %d\n", value); XEvent xev; xev.xclient.type = ClientMessage; @@ -206,10 +206,10 @@ void _al_xwin_set_above(ALLEGRO_DISPLAY *display, int value) } -void _al_xwin_set_frame(ALLEGRO_DISPLAY *display, bool frame_on) +void _al_xwin_set_frame(A5O_DISPLAY *display, bool frame_on) { - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; Display *x11 = system->x11display; Atom hints; @@ -232,9 +232,9 @@ void _al_xwin_set_frame(ALLEGRO_DISPLAY *display, bool frame_on) (void *)&motif, sizeof motif / 4); if (frame_on) - display->flags &= ~ALLEGRO_FRAMELESS; + display->flags &= ~A5O_FRAMELESS; else - display->flags |= ALLEGRO_FRAMELESS; + display->flags |= A5O_FRAMELESS; } #endif } @@ -248,12 +248,12 @@ void _al_xwin_set_frame(ALLEGRO_DISPLAY *display, bool frame_on) * and draw the window yourself? */ static bool xdpy_set_icon_inner(Display *x11display, Window window, - ALLEGRO_BITMAP *bitmap, int prop_mode) + A5O_BITMAP *bitmap, int prop_mode) { int w, h; int data_size; unsigned long *data; /* Yes, unsigned long, even on 64-bit platforms! */ - ALLEGRO_LOCKED_REGION *lr; + A5O_LOCKED_REGION *lr; bool ret; w = al_get_bitmap_width(bitmap); @@ -263,11 +263,11 @@ static bool xdpy_set_icon_inner(Display *x11display, Window window, if (!data) return false; - lr = al_lock_bitmap(bitmap, ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA, - ALLEGRO_LOCK_READONLY); + lr = al_lock_bitmap(bitmap, A5O_PIXEL_FORMAT_ANY_WITH_ALPHA, + A5O_LOCK_READONLY); if (lr) { int x, y; - ALLEGRO_COLOR c; + A5O_COLOR c; unsigned char r, g, b, a; Atom _NET_WM_ICON; @@ -299,11 +299,11 @@ static bool xdpy_set_icon_inner(Display *x11display, Window window, } -void _al_xwin_set_icons(ALLEGRO_DISPLAY *d, - int num_icons, ALLEGRO_BITMAP *bitmaps[]) +void _al_xwin_set_icons(A5O_DISPLAY *d, + int num_icons, A5O_BITMAP *bitmaps[]) { - ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)d; + A5O_SYSTEM_XGLX *system = (A5O_SYSTEM_XGLX *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)d; int prop_mode = PropModeReplace; int i; @@ -323,13 +323,13 @@ void _al_xwin_set_icons(ALLEGRO_DISPLAY *d, /* Note: The system mutex must be locked (exactly once) before * calling this as we call _al_display_xglx_await_resize. */ -void _al_xwin_maximize(ALLEGRO_DISPLAY *display, bool maximized) +void _al_xwin_maximize(A5O_DISPLAY *display, bool maximized) { -#ifndef ALLEGRO_RASPBERRYPI - if (!!(display->flags & ALLEGRO_MAXIMIZED) == maximized) +#ifndef A5O_RASPBERRYPI + if (!!(display->flags & A5O_MAXIMIZED) == maximized) return; - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; Display *x11 = system->x11display; int old_resize_count = glx->resize_count; @@ -357,11 +357,11 @@ void _al_xwin_maximize(ALLEGRO_DISPLAY *display, bool maximized) } -void _al_xwin_check_maximized(ALLEGRO_DISPLAY *display) +void _al_xwin_check_maximized(A5O_DISPLAY *display) { -#ifndef ALLEGRO_RASPBERRYPI - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; +#ifndef A5O_RASPBERRYPI + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; Display *x11 = system->x11display; Atom type; Atom horz = X11_ATOM(_NET_WM_STATE_MAXIMIZED_HORZ); @@ -384,26 +384,26 @@ void _al_xwin_check_maximized(ALLEGRO_DISPLAY *display) maximized |= 2; } XFree(p8); - display->flags &= ~ALLEGRO_MAXIMIZED; + display->flags &= ~A5O_MAXIMIZED; if (maximized == 3) - display->flags |= ALLEGRO_MAXIMIZED; + display->flags |= A5O_MAXIMIZED; #endif } /* Function: al_get_x_window_id */ -XID al_get_x_window_id(ALLEGRO_DISPLAY *display) +XID al_get_x_window_id(A5O_DISPLAY *display) { ASSERT(display != NULL); - return ((ALLEGRO_DISPLAY_XGLX*)display)->window; + return ((A5O_DISPLAY_XGLX*)display)->window; } // Note: this only seems to work after the window has been mapped -void _al_xwin_get_borders(ALLEGRO_DISPLAY *display) { - ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display; - ALLEGRO_SYSTEM_XGLX *system = (void *)al_get_system_driver(); +void _al_xwin_get_borders(A5O_DISPLAY *display) { + A5O_DISPLAY_XGLX *glx = (A5O_DISPLAY_XGLX *)display; + A5O_SYSTEM_XGLX *system = (void *)al_get_system_driver(); Display *x11 = system->x11display; Atom type; @@ -420,16 +420,16 @@ void _al_xwin_get_borders(ALLEGRO_DISPLAY *display) { glx->border_top = (int)((long *)property)[2]; glx->border_bottom = (int)((long *)property)[3]; glx->borders_known = true; - ALLEGRO_DEBUG("_NET_FRAME_EXTENTS: %d %d %d %d\n", glx->border_left, glx->border_top, + A5O_DEBUG("_NET_FRAME_EXTENTS: %d %d %d %d\n", glx->border_left, glx->border_top, glx->border_right, glx->border_bottom); } else { - ALLEGRO_DEBUG("Unexpected _NET_FRAME_EXTENTS format: nitems=%lu\n", nitems); + A5O_DEBUG("Unexpected _NET_FRAME_EXTENTS format: nitems=%lu\n", nitems); } XFree(property); } else { - ALLEGRO_DEBUG("Could not read _NET_FRAME_EXTENTS\n"); + A5O_DEBUG("Could not read _NET_FRAME_EXTENTS\n"); } } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3102e312f8..cd7878fb85 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,9 +1,9 @@ -if(NOT ALLEGRO_LINK_WITH OR NOT ALLEGRO_MAIN_LINK_WITH OR +if(NOT A5O_LINK_WITH OR NOT A5O_MAIN_LINK_WITH OR NOT IMAGE_LINK_WITH OR NOT COLOR_LINK_WITH OR NOT FONT_LINK_WITH OR NOT TTF_LINK_WITH OR NOT PRIMITIVES_LINK_WITH) message(STATUS "Not building tests due to missing library. " - "Have: ${ALLEGRO_LINK_WITH} ${ALLEGRO_MAIN_LINK_WITH} " + "Have: ${A5O_LINK_WITH} ${A5O_MAIN_LINK_WITH} " "${IMAGE_LINK_WITH} ${COLOR_LINK_WITH} " "${FONT_LINK_WITH} ${TTF_LINK_WITH} " "${PRIMITIVES_LINK_WITH}") @@ -30,10 +30,10 @@ if(MSVC) endif(MSVC) if(WANT_MONOLITH) - set(LINK_WITH ${ALLEGRO_MONOLITH_LINK_WITH}) + set(LINK_WITH ${A5O_MONOLITH_LINK_WITH}) else() - set(LINK_WITH ${ALLEGRO_LINK_WITH} - ${ALLEGRO_MAIN_LINK_WITH} + set(LINK_WITH ${A5O_LINK_WITH} + ${A5O_MAIN_LINK_WITH} ${IMAGE_LINK_WITH} ${COLOR_LINK_WITH} ${FONT_LINK_WITH} diff --git a/tests/manual_bmpsuite2.ini b/tests/manual_bmpsuite2.ini index 7ba0f69ceb..83b08950db 100644 --- a/tests/manual_bmpsuite2.ini +++ b/tests/manual_bmpsuite2.ini @@ -80,7 +80,7 @@ rle8-encoded-320x240 =bmptestsuite-0.9/valid/rle8-encoded-320x240.bmp op0=buf = al_create_bitmap(640, 480) op1=al_set_target_bitmap(buf) op2=al_clear_to_color(#ff00ff) -op3=al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) +op3=al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) op4=al_draw_bitmap(bmp, 0, 0, 0) op5=al_set_target_bitmap(target) op6=al_draw_bitmap(buf, 0, 0, 0) diff --git a/tests/manual_bmpsuite3.ini b/tests/manual_bmpsuite3.ini index c3207960bc..d3e4fe34ca 100644 --- a/tests/manual_bmpsuite3.ini +++ b/tests/manual_bmpsuite3.ini @@ -13,7 +13,7 @@ trans = wvnet/trans.bmp op0=buf = al_create_bitmap(640, 480) op1=al_set_target_bitmap(buf) op2=al_clear_to_color(#ff00ff) -op3=al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) +op3=al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) op4=al_draw_bitmap(bmp, 0, 0, 0) op5=al_set_target_bitmap(target) op6=al_draw_bitmap(buf, 0, 0, 0) diff --git a/tests/test_backbuffer.ini b/tests/test_backbuffer.ini index 3064d7a143..6fd97422aa 100644 --- a/tests/test_backbuffer.ini +++ b/tests/test_backbuffer.ini @@ -14,17 +14,17 @@ mysha=../examples/data/mysha.pcx #[test bb2bb hflip] #extend=test bb2bb -#flags=ALLEGRO_FLIP_HORIZONTAL +#flags=A5O_FLIP_HORIZONTAL #hash=BROKEN #[test bb2bb vflip] #extend=test bb2bb -#flags=ALLEGRO_FLIP_VERTICAL +#flags=A5O_FLIP_VERTICAL #hash=BROKEN #[test bb2bb vhflip] #extend=test bb2bb -#flags=ALLEGRO_FLIP_VERTICAL|ALLEGRO_FLIP_HORIZONTAL +#flags=A5O_FLIP_VERTICAL|A5O_FLIP_HORIZONTAL #hash=BROKEN @@ -66,15 +66,15 @@ hash_hw=a22aae19 #[test bbsrc hflip] #extend=test bbsrc -#flags=ALLEGRO_FLIP_HORIZONTAL +#flags=A5O_FLIP_HORIZONTAL #[test bbsrc vflip] #extend=test bbsrc -#flags=ALLEGRO_FLIP_VERTICAL +#flags=A5O_FLIP_VERTICAL #[test bbsrc vhflip] #extend=test bbsrc -#flags=ALLEGRO_FLIP_HORIZONTAL|ALLEGRO_FLIP_VERTICAL +#flags=A5O_FLIP_HORIZONTAL|A5O_FLIP_VERTICAL #[test bbsrc scale] @@ -83,15 +83,15 @@ hash_hw=a22aae19 #[test bbsrc scale hflip] #extend=test bbsrc scale -#flags=ALLEGRO_FLIP_HORIZONTAL +#flags=A5O_FLIP_HORIZONTAL #[test bbsrc scale vflip] #extend=test bbsrc scale -#flags=ALLEGRO_FLIP_VERTICAL +#flags=A5O_FLIP_VERTICAL #[test bbsrc scale vhflip] #extend=test bbsrc scale -#flags=ALLEGRO_FLIP_VERTICAL|ALLEGRO_FLIP_HORIZONTAL +#flags=A5O_FLIP_VERTICAL|A5O_FLIP_HORIZONTAL #[test bbsrc rotate] @@ -100,12 +100,12 @@ hash_hw=a22aae19 #[test bbsrc rotate hflip] #extend=test bbsrc rotate -#flags=ALLEGRO_FLIP_HORIZONTAL +#flags=A5O_FLIP_HORIZONTAL #[test bbsrc rotate vflip] #extend=test bbsrc rotate -#flags=ALLEGRO_FLIP_VERTICAL +#flags=A5O_FLIP_VERTICAL #[test bbsrc rotate vhflip] #extend=test bbsrc rotate -#flags=ALLEGRO_FLIP_HORIZONTAL|ALLEGRO_FLIP_VERTICAL +#flags=A5O_FLIP_HORIZONTAL|A5O_FLIP_VERTICAL diff --git a/tests/test_bitmaps.ini b/tests/test_bitmaps.ini index 696b6f88fb..ec3bf825ed 100644 --- a/tests/test_bitmaps.ini +++ b/tests/test_bitmaps.ini @@ -10,17 +10,17 @@ hash=dabe9c74 [test blit vflip] extend=test blit -flags=ALLEGRO_FLIP_VERTICAL +flags=A5O_FLIP_VERTICAL hash=ee8c112c [test blit hflip] extend=test blit -flags=ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_HORIZONTAL hash=7e343e90 [test blit vhflip] extend=test blit -flags=ALLEGRO_FLIP_VERTICAL|ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_VERTICAL|A5O_FLIP_HORIZONTAL hash=72d59a18 [test region] @@ -32,17 +32,17 @@ hash=8e5335ae [test region hflip] extend=test region -flags=ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_HORIZONTAL hash=569472fc [test region vflip] extend=test region -flags=ALLEGRO_FLIP_VERTICAL +flags=A5O_FLIP_VERTICAL hash=f479bb0d [test region vhflip] extend=test region -flags=ALLEGRO_FLIP_HORIZONTAL|ALLEGRO_FLIP_VERTICAL +flags=A5O_FLIP_HORIZONTAL|A5O_FLIP_VERTICAL hash=cadc1987 [test scale min] @@ -53,18 +53,18 @@ hash=ae4b4301 [test scale min vflip] extend=test scale min -flags=ALLEGRO_FLIP_VERTICAL +flags=A5O_FLIP_VERTICAL hash=973bd6bd sig=DLLLLLLLLELLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL [test scale min hflip] extend=test scale min -flags=ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_HORIZONTAL hash=807e7ae5 [test scale min vhflip] extend=test scale min -flags=ALLEGRO_FLIP_VERTICAL|ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_VERTICAL|A5O_FLIP_HORIZONTAL hash=5c2b54ad [test scale max] @@ -76,13 +76,13 @@ sig=EEEEEEDDCEFGPGEEDDFKjsebEDDGwvsVaEEDHvcgQPKDDHogTKMFEE4EaNLN9DE22254I222DDDD [test scale max hflip] extend=test scale max -flags=ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_HORIZONTAL hash=99b05f69 sig=CDEEEEEEECDEMFRFFECDEairgGFDEIZburwFDEMOTlrvGDECLLUeqGDD2HMNaA3222385222DDDDDDDDD [test scale max vflip] extend=test scale max -flags=ALLEGRO_FLIP_VERTICAL +flags=A5O_FLIP_VERTICAL hash=d9f0a6ea sig=22221222222VM2K222GmePLLDEEJrmeRQJEDHuuoTUHDDFlovXaEDDEFPsgVEDCEEEEEEEDCIIIIIIHHH @@ -97,28 +97,28 @@ sig=ggggggggggggggggggggggggggggggggggggggggXPQQQggggQEEEEggggQEEFFggggQFOtsgggg [test scale max2 vflip] extend=test scale max2 -flags=ALLEGRO_FLIP_VERTICAL +flags=A5O_FLIP_VERTICAL hash=e6bc6d52 sig=ggggggggggggggggggggggggggggggggggggggggTJJJJggggJ222BggggJ22LGggggJ1baOggggVIkgP [test scale max2 negy hflip] extend=test scale max2 dh=-600 -flags=ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_HORIZONTAL hash=e6bc6d52 sig=ggggPDEEYggggPCDEXggggPDDEDggggOCDDEggggYTTUUgggggggggggggggggggggggggggggggggggg [test scale max2 negy vhflip] extend=test scale max2 dh=-600 -flags=ALLEGRO_FLIP_VERTICAL|ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_VERTICAL|A5O_FLIP_HORIZONTAL hash=cf1b15e6 sig=ggggQEEDMggggQDE7HggggJ1211ggggJ2222ggggWPPPPgggggggggggggggggggggggggggggggggggg [test scale max2 negx vflip] extend=test scale max2 dw=-600 -flags=ALLEGRO_FLIP_VERTICAL +flags=A5O_FLIP_VERTICAL hash=635d9cf1 sig=ggggggggggggggggggggggggggggggggggggJJJJWgggg9222PggggHK22PggggOab1PggggQgkIYgggg @@ -130,17 +130,17 @@ sig=tmnFUggggrrIFUggggFFEEUggggEEEEUggggUUUTbggggggggggggggggggggggggggggggggggg [test scale max2 negx negy hflip] extend=test scale max2 negx negy -flags=ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_HORIZONTAL sig=ZEEDTggggXEDCTggggDEDCTggggEDDCTggggUTTTagggggggggggggggggggggggggggggggggggggggg [test scale max2 negx negy vflip] extend=test scale max2 negx negy -flags=ALLEGRO_FLIP_VERTICAL +flags=A5O_FLIP_VERTICAL sig=QgkHYggggOaZ2PggggHH22Pgggg9222PggggPPPPZgggggggggggggggggggggggggggggggggggggggg [test scale max2 negx negy vhflip] extend=test scale max2 negx negy -flags=ALLEGRO_FLIP_VERTICAL|ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_VERTICAL|A5O_FLIP_HORIZONTAL sig=MCEEUggggG7EDUgggg1121Pgggg2222PggggPPPPZgggggggggggggggggggggggggggggggggggggggg [test rotate] @@ -165,7 +165,7 @@ sig=LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLkLLLLLLLIRLLLLLLOLcLLLLLLLOQkLLLLLLGaXeLLLLLL [test rotate 1.0 vflip] extend=test rotate 1.0 -flags=ALLEGRO_FLIP_VERTICAL +flags=A5O_FLIP_VERTICAL hash=5b75eca4 sig=LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLSNLLLLLLYTPHLLLLLLeVNLLLLLLL+WMLLLLLLhgNLL @@ -183,13 +183,13 @@ sig=LLifZHLLLLLLgUJLLLLLLaYKLLLLLLKfOILLLLLLTJLLLLLLLkLLLLLLLLLLLLLLLLLLLLLLLLLL [test rotate -2.0 hflip] extend=test rotate -2.0 -flags=ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_HORIZONTAL hash=0a4986c3 sig=LLVSMGLLLLLLYSKLLLLLLabULLLLLLPTNMLLLLLLlNLLLLLLLiLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL [test rotate -2.0 vhflip] extend=test rotate -2.0 -flags=ALLEGRO_FLIP_VERTICAL|ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_VERTICAL|A5O_FLIP_HORIZONTAL hash=4ddeb3e3 sig=LLJPcKLLLLLLJcZLLLLLLKWgLLLLLLIYUjLLLLLLNBLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL @@ -235,19 +235,19 @@ sig=nhjTTOLOOlgdgSOJMMNnORRVNKLKOngKDEHKKKTnQYYKKKKMfnifKKKKKThiKKKKKKKWkKKKKKKK [test scaled rotate 4 vflip] extend=test scaled rotate 4 -flags=ALLEGRO_FLIP_VERTICAL +flags=A5O_FLIP_VERTICAL hash=055000e8 sig=NSTPVQYDjMHQMTVWYnGKJKOJPXVFHOOQJKNKKGMONQMKKKKKSOPMKKKKKINNKKKKKKKONKKKKKKKKKKKK [test scaled rotate 4 hflip] extend=test scaled rotate 4 -flags=ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_HORIZONTAL hash=59ba09c8 sig=mbfcaSMKOieel/TMNNQihgcHMONOYfi//DNKLbgclyqKKKLdhcnmKKKKKiflKKKKKKLlhKKKKKKKLKKKK [test scaled rotate 4 vhflip] extend=test scaled rotate 4 -flags=ALLEGRO_FLIP_VERTICAL|ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_VERTICAL|A5O_FLIP_HORIZONTAL hash=e3236edd sig=NVTZGmClnNRYXVf/ClGPUTPRsDhGJQSLMNlKKKMKNLOKKKKMLNNNKKKKKLLNKKKKKKKNNKKKKKKKKKKKK @@ -270,7 +270,7 @@ hash=ec890555 [test sub src hflip] extend=test sub src -flags=ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_HORIZONTAL hash=8862d735 sig=QNOQQLLLLDGbSVLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL @@ -284,17 +284,17 @@ hash=208f7025 [test sub src outside hflip] extend=test sub src outside -flags=ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_HORIZONTAL hash=c72f2d45 [test sub src outside vflip] extend=test sub src outside -flags=ALLEGRO_FLIP_VERTICAL +flags=A5O_FLIP_VERTICAL hash=287e0fbd [test sub src outside vhflip] extend=test sub src outside -flags=ALLEGRO_FLIP_VERTICAL|ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_VERTICAL|A5O_FLIP_HORIZONTAL hash=4696783d [test sub src outside scale] @@ -308,19 +308,19 @@ sig=LLLLLLLLLLTNKKNXbkLmnkkffVhLnNOhcv/zLKZPaepcOLKNKZYYNOLMNMMOSOOLONIHHKLNLLLL [test sub src outside scale hflip] extend=test sub src outside scale -flags=ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_HORIZONTAL hash=898f5e8d sig=LLLLLLLLLjcRKKKRWLYYheknnjLW/P+UWYkLQ/qgPaRRLLQWZXQJKLNRQOKONQLLMIFGOKNLLLLLLLLLL [test sub src outside scale vflip] extend=test sub src outside scale -flags=ALLEGRO_FLIP_VERTICAL +flags=A5O_FLIP_VERTICAL hash=762b67d5 sig=LMPLHHMLMLQMHJSWNNLLPMZXYSNLMdMjbdLDLcbOmfgkmLjhTQReegLLLLLLLLLLLLLLLLLLLLLLLLLLL [test sub src outside scale vhflip] extend=test sub src outside scale -flags=ALLEGRO_FLIP_HORIZONTAL|ALLEGRO_FLIP_VERTICAL +flags=A5O_FLIP_HORIZONTAL|A5O_FLIP_VERTICAL hash=7c95685d sig=LNJGGONOLNNVMMGKPLMUfdWRKJLh/hcUaYVLmkekXhYjLfeYVPYjkLLLLLLLLLLLLLLLLLLLLLLLLLLLL @@ -368,19 +368,19 @@ sig=LLLZLCLLLLLLPLDLLLLLLMLDLLLLLL2A2LLLLLLLRLLLLLLLLRLLLLLLLLRLLLLLLLLRLLLLLLLL [test sub transform hflip] extend=test sub transform -flags=ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_HORIZONTAL hash=ee8a23a0 sig=LLLCLZLLLLLLDLPLLLLLLDLMLLLLLL2A2LLLLLLLRLLLLLLLLRLLLLLLLLRLLLLLLLLRLLLLLLLLRLLLL [test sub transform vflip] extend=test sub transform -flags=ALLEGRO_FLIP_VERTICAL +flags=A5O_FLIP_VERTICAL hash=9290db87 sig=LLL2B1LLLLLLKLDLLLLLLVLCLLLLLLEKCLLLLLLLRLLLLLLLLRLLLLLLLLRLLLLLLLLRLLLLLLLLRLLLL [test sub transform vhflip] extend=test sub transform -flags=ALLEGRO_FLIP_VERTICAL|ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_VERTICAL|A5O_FLIP_HORIZONTAL hash=d43a7e7c sig=LLL1A2LLLLLLDLLLLLLLLCLVLLLLLLCKELLLLLLLRLLLLLLLLRLLLLLLLLRLLLLLLLLRLLLLLLLLRLLLL @@ -397,19 +397,19 @@ sig=LLLZLCLLLLLLPLDLLLLLLMLDLLLLLL2A2LLLLLLLRLLLLLLLLRLLLLLLLLRLLLLLLLLRLLLLLLLL [test region transform hflip] extend=test region transform -flags=ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_HORIZONTAL hash=ee8a23a0 sig=LLLCLZLLLLLLDLPLLLLLLDLMLLLLLL2A2LLLLLLLRLLLLLLLLRLLLLLLLLRLLLLLLLLRLLLLLLLLRLLLL [test region transform vflip] extend=test region transform -flags=ALLEGRO_FLIP_VERTICAL +flags=A5O_FLIP_VERTICAL hash=9290db87 sig=LLL2B1LLLLLLKLDLLLLLLVLCLLLLLLEKCLLLLLLLRLLLLLLLLRLLLLLLLLRLLLLLLLLRLLLLLLLLRLLLL [test region transform vhflip] extend=test region transform -flags=ALLEGRO_FLIP_VERTICAL|ALLEGRO_FLIP_HORIZONTAL +flags=A5O_FLIP_VERTICAL|A5O_FLIP_HORIZONTAL hash=d43a7e7c sig=LLL1A2LLLLLLDLLLLLLLLCLVLLLLLLCKELLLLLLLRLLLLLLLLRLLLLLLLLRLLLLLLLLRLLLLLLLLRLLLL diff --git a/tests/test_blend.ini b/tests/test_blend.ini index 62dc19c20f..6f58b2418b 100644 --- a/tests/test_blend.ini +++ b/tests/test_blend.ini @@ -19,96 +19,96 @@ op9=al_draw_bitmap(green, x, 245, 0) op10=al_set_blender(mode, src, dst4) op11=al_draw_bitmap(green, x, 365, 0) op12=al_set_target_bitmap(target) -op13=al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO) +op13=al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO) op14=al_draw_bitmap(bkg, 0, 0, 0) -op15=al_set_separate_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ZERO, ALLEGRO_ONE) +op15=al_set_separate_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ZERO, A5O_ONE) op16=al_draw_bitmap(b, 0, 0, 0) x=140 [template dst=1,0,a,ia] extend=template -dst1=ALLEGRO_ONE -dst2=ALLEGRO_ZERO -dst3=ALLEGRO_ALPHA -dst4=ALLEGRO_INVERSE_ALPHA +dst1=A5O_ONE +dst2=A5O_ZERO +dst3=A5O_ALPHA +dst4=A5O_INVERSE_ALPHA [template dst=sc,dc,isc,idc] extend=template -dst1=ALLEGRO_SRC_COLOR -dst2=ALLEGRO_DEST_COLOR -dst3=ALLEGRO_INVERSE_SRC_COLOR -dst4=ALLEGRO_INVERSE_DEST_COLOR +dst1=A5O_SRC_COLOR +dst2=A5O_DEST_COLOR +dst3=A5O_INVERSE_SRC_COLOR +dst4=A5O_INVERSE_DEST_COLOR [template dst=cc,icc] extend=template -dst1=ALLEGRO_SRC_COLOR -dst2=ALLEGRO_DEST_COLOR -dst3=ALLEGRO_SRC_COLOR -dst4=ALLEGRO_DEST_COLOR +dst1=A5O_SRC_COLOR +dst2=A5O_DEST_COLOR +dst3=A5O_SRC_COLOR +dst4=A5O_DEST_COLOR #-----------------------------------------------------------------------------# [template mode=ADD dst=1,0,a,ia] extend=template dst=1,0,a,ia -mode=ALLEGRO_ADD +mode=A5O_ADD [test blend mode=ADD src=1 dst=1,0,a,ia] extend=template mode=ADD dst=1,0,a,ia -src=ALLEGRO_ONE +src=A5O_ONE hash=7bc85f46 sig=GDD9PNGlHJJqJIHHHHEDL3566KLCCH78T6QCBCCBDFHCF9A76MM5bBCAZ66676BBAP7B8ALAABJ8CUBQA [test blend mode=ADD src=0 dst=1,0,a,ia] extend=template mode=ADD dst=1,0,a,ia -src=ALLEGRO_ZERO +src=A5O_ZERO hash=441baf02 sig=GDA9BAGHHJJJJIHHHHED665767LCC676766CBCCBDFHCF9A66A95ABCA866676BBA77A7A6AAB6886B5A [test blend mode=ADD src=a dst=1,0,a,ia] extend=template mode=ADD dst=1,0,a,ia -src=ALLEGRO_ALPHA +src=A5O_ALPHA hash=a8d416f9 sig=GDB9NMGlHJJoJIHHHHEDJ5576KLCCH76T6PCBCCBDFHCF9A66LL5bBCAY66676BBAM7A9ALAABI89TBPA [test blend mode=ADD src=ia dst=1,0,a,ia] extend=template mode=ADD dst=1,0,a,ia -src=ALLEGRO_INVERSE_ALPHA +src=A5O_INVERSE_ALPHA hash=16223282 sig=GDB9DCGIHJJMJIHHHHED655566LCC676666CBCCBDFHCF9A76BB5ABCA966676BBA87B7A6AAB6896B5A [test blend mode=ADD src=sc dst=1,0,a,ia] extend=template mode=ADD dst=1,0,a,ia -src=ALLEGRO_SRC_COLOR +src=A5O_SRC_COLOR hash=f926f4cd sig=GDA9KJGeHJJhJIHHHHEDF5556ELCCB76L6ICBCCBDFHCF9A66II5TBCAR66676BBAH7A7AFAABC89LBIA [test blend mode=ADD src=dc dst=1,0,a,ia] extend=template mode=ADD dst=1,0,a,ia -src=ALLEGRO_DEST_COLOR +src=A5O_DEST_COLOR hash=b2630b89 sig=GDA9HGGeHJJjJIHHHHED855568LCC776D68CBCCBDFHCF9A66IH5MBCAE66676BBA87A6A6AAB6885B6A [test blend mode=ADD src=isc dst=1,0,a,ia] extend=template mode=ADD dst=1,0,a,ia -src=ALLEGRO_INVERSE_SRC_COLOR +src=A5O_INVERSE_SRC_COLOR hash=1e52eaf0 sig=GDC9FEGLHJJQJIHHHHED655566LCC676766CBCCBDFHCF9A76DC5EBCAC66676BBA97B7A7AAB6896B6A [test blend mode=ADD src=idc dst=1,0,a,ia] extend=template mode=ADD dst=1,0,a,ia -src=ALLEGRO_INVERSE_DEST_COLOR +src=A5O_INVERSE_DEST_COLOR hash=fe52c382 sig=GDC9LKGgHJJiJIHHHHED955568LCC87686ACBCCBDFHCF9A76JI5YBCAW66676BBAD7A7ABAABB8AFBCA [test blend mode=ADD src=cc dst=1,0,a,ia] extend=template mode=ADD dst=1,0,a,ia -src=ALLEGRO_CONST_COLOR +src=A5O_CONST_COLOR hash=4ee1eaca sig=GDC9OMGkHJJoJIHHHHEDH3556GLCCE77N6KCBCCBDFHCF9A76LL5ZBCAW66676BBAK7B8AHAABG8BOBLA [test blend mode=ADD src=icc dst=1,0,a,ia] extend=template mode=ADD dst=1,0,a,ia -src=ALLEGRO_INVERSE_CONST_COLOR +src=A5O_INVERSE_CONST_COLOR hash=83ed9c53 sig=GDA9CBGJHJJMJIHHHHED665767LCC676766CBCCBDFHCF9A66BA5DBCAA66676BBA87A7A7AAB6886B5A @@ -116,65 +116,65 @@ sig=GDA9CBGJHJJMJIHHHHED665767LCC676766CBCCBDFHCF9A66BA5DBCAA66676BBA87A7A7AAB68 [template mode=ADD dst=sc,dc,isc,idc] extend=template dst=sc,dc,isc,idc -mode=ALLEGRO_ADD +mode=A5O_ADD [test blend mode=ADD src=1 dst=sc,dc,isc,idc] extend=template mode=ADD dst=sc,dc,isc,idc -src=ALLEGRO_ONE +src=A5O_ONE hash=0ce01bb8 sig=GD76AA6VHJJZ66676HEDV6AG7YLCCT6Dn8ZCBCCBDFIDF9ACCPPDYBCAXCCEFABBAU98E7TAABR7Ca8YA [test blend mode=ADD src=0 dst=sc,dc,isc,idc] extend=template mode=ADD dst=sc,dc,isc,idc -src=ALLEGRO_ZERO +src=A5O_ZERO hash=90e041ac sig=GD664468HJJA66676HED869879LCC867C88CBCCBDFIDF9AAC88D5BCA6CCEFABBA878878AAB777787A [test blend mode=ADD src=a dst=sc,dc,isc,idc] extend=template mode=ADD dst=sc,dc,isc,idc -src=ALLEGRO_ALPHA +src=A5O_ALPHA hash=a2c1dee3 sig=GD66BA6VHJJY66676HEDS69F7XLCCR6An8ZCBCCBDFIDF9AACMMDXBCAUCCEFABBAS88D7SAABQ79a8YA [test blend mode=ADD src=ia dst=sc,dc,isc,idc] extend=template mode=ADD dst=sc,dc,isc,idc -src=ALLEGRO_INVERSE_ALPHA +src=A5O_INVERSE_ALPHA hash=597e5032 sig=GD763369HJJC66676HED96A97ALCC969D88CBCCBDFIDF9ABCAAD6BCA7CCEFABBA988978AAB878787A [test blend mode=ADD src=sc dst=sc,dc,isc,idc] extend=template mode=ADD dst=sc,dc,isc,idc -src=ALLEGRO_SRC_COLOR +src=A5O_SRC_COLOR hash=901f4244 sig=GD66776NHJJR66676HEDN69D7RLCCM69f8RCBCCBDFIDF9AACJJDQBCAOCCEFABBAN88C7MAABK78S8QA [test blend mode=ADD src=dc dst=sc,dc,isc,idc] extend=template mode=ADD dst=sc,dc,isc,idc -src=ALLEGRO_DEST_COLOR +src=A5O_DEST_COLOR hash=b80bdb24 sig=GD66556OHJJS66676HEDI6AC7LLCCH69a8JCBCCBDFIDF9AACEEDBBCA8CCEFABBAE88A7DAABC77B8EA [test blend mode=ADD src=isc dst=sc,dc,isc,idc] extend=template mode=ADD dst=sc,dc,isc,idc -src=ALLEGRO_INVERSE_SRC_COLOR +src=A5O_INVERSE_SRC_COLOR hash=020d43da sig=GD76556CHJJF66676HEDB6AA7CLCCB69F8ACBCCBDFIDF9ABCBBD6BCA8CCEFABBAB8897AAABA79989A [test blend mode=ADD src=idc dst=sc,dc,isc,idc] extend=template mode=ADD dst=sc,dc,isc,idc -src=ALLEGRO_INVERSE_DEST_COLOR +src=A5O_INVERSE_DEST_COLOR hash=2349d015 sig=GD76996QHJJS66676HEDI6AC7LLCCH6AU8MCBCCBDFIDF9ABCFEDGBCAICCEFABBAL88B7KAABJ79Q8OA [test blend mode=ADD src=cc dst=sc,dc,isc,idc] extend=template mode=ADD dst=sc,dc,isc,idc -src=ALLEGRO_CONST_COLOR +src=A5O_CONST_COLOR hash=d2c79eaa sig=GD76996THJJX66676HEDT6AF7WLCCR6Cl8XCBCCBDFIDF9ACCNNDTBCASCCEFABBAS98E7RAABP7BX8WA [test blend mode=ADD src=icc dst=sc,dc,isc,idc] extend=template mode=ADD dst=sc,dc,isc,idc -src=ALLEGRO_INVERSE_CONST_COLOR +src=A5O_INVERSE_CONST_COLOR hash=5f617039 sig=GD66556BHJJD66676HED96987ALCC967E89CBCCBDFIDF9AAC88D6BCA7CCEFABBA978879AAB877888A @@ -182,66 +182,66 @@ sig=GD66556BHJJD66676HED96987ALCC967E89CBCCBDFIDF9AAC88D6BCA7CCEFABBA978879AAB87 [template mode=ADD dst=cc,icc] extend=template dst=cc,icc -mode=ALLEGRO_ADD +mode=A5O_ADD [test blend mode=ADD src=1 dst=cc,icc] extend=template mode=ADD dst=cc,icc -src=ALLEGRO_ONE +src=A5O_ONE hash=65dca8dc sig=GD76AA6VHJJZ66676HEDV6AG7YLCCT6Dn8ZCBCCBDFIDF9A76BB5TBCAV66676BBAP4685NAABL59V6SA [test blend mode=ADD src=0 dst=cc,icc] extend=template mode=ADD dst=cc,icc -src=ALLEGRO_ZERO +src=A5O_ZERO hash=182efe77 sig=GD664468HJJA66676HED869879LCC867C88CBCCBDFIDF9A665556BCA666676BBA656656AAB555565A [test blend mode=ADD src=a dst=cc,icc] extend=template mode=ADD dst=cc,icc -src=ALLEGRO_ALPHA +src=A5O_ALPHA hash=8272bd59 sig=GD66BA6VHJJY66676HEDS69F7XLCCR6An8ZCBCCBDFIDF9A66BB5TBCAT66676BBAO5685NAABK57V6SA [test blend mode=ADD src=ia dst=cc,icc] extend=template mode=ADD dst=cc,icc -src=ALLEGRO_INVERSE_ALPHA +src=A5O_INVERSE_ALPHA hash=6202d315 sig=GD763369HJJC66676HED96A97ALCC969D88CBCCBDFIDF9A764456BCA666676BBA746556AAB556565A [test blend mode=ADD src=sc dst=cc,icc] extend=template mode=ADD dst=cc,icc -src=ALLEGRO_SRC_COLOR +src=A5O_SRC_COLOR hash=0a7aa6df sig=GD66776NHJJR66676HEDN69D7RLCCM69f8RCBCCBDFIDF9A66885LBCAN66676BBAI5665GAABE56N6KA [test blend mode=ADD src=dc dst=cc,icc] extend=template mode=ADD dst=cc,icc -src=ALLEGRO_DEST_COLOR +src=A5O_DEST_COLOR hash=a314996a sig=GD66556OHJJS66676HEDI6AC7LLCCH69a8JCBCCBDFIDF9A66885EBCAA66676BBA956658AAB755668A [test blend mode=ADD src=isc dst=cc,icc] extend=template mode=ADD dst=cc,icc -src=ALLEGRO_INVERSE_SRC_COLOR +src=A5O_INVERSE_SRC_COLOR hash=81205c32 sig=GD76556CHJJF66676HEDB6AA7CLCCB69F8ACBCCBDFIDF9A76665ABCAA66676BBA846657AAB756767A [test blend mode=ADD src=idc dst=cc,icc] extend=template mode=ADD dst=cc,icc -src=ALLEGRO_INVERSE_DEST_COLOR +src=A5O_INVERSE_DEST_COLOR hash=3c6243b3 sig=GD76996QHJJS66676HEDI6AC7LLCCH6AU8MCBCCBDFIDF9A76995QBCAR66676BBAG5675FAABE57L6IA [test blend mode=ADD src=cc dst=cc,icc] extend=template mode=ADD dst=cc,icc -src=ALLEGRO_CONST_COLOR +src=A5O_CONST_COLOR hash=15e071c8 sig=GD76996THJJX66676HEDT6AF7WLCCR6Cl8XCBCCBDFIDF9A76AA5RBCAS66676BBAM4675KAABH58Q6OA [test blend mode=ADD src=icc dst=cc,icc] extend=template mode=ADD dst=cc,icc -src=ALLEGRO_INVERSE_CONST_COLOR +src=A5O_INVERSE_CONST_COLOR hash=de752105 sig=GD66556BHJJD66676HED96987ALCC967E89CBCCBDFIDF9A666659BCA866676BBA756657AAB655666A @@ -249,65 +249,65 @@ sig=GD66556BHJJD66676HED96987ALCC967E89CBCCBDFIDF9A666659BCA866676BBA756657AAB65 [template mode=DEST_MINUS_SRC dst=1,0,a,ia] extend=template dst=1,0,a,ia -mode=ALLEGRO_DEST_MINUS_SRC +mode=A5O_DEST_MINUS_SRC [test blend mode=DEST_MINUS_SRC src=1 dst=1,0,a,ia] extend=template mode=DEST_MINUS_SRC dst=1,0,a,ia -src=ALLEGRO_ONE +src=A5O_ONE hash=2e819fcc sig=GD9966G6HJJ7JIHHHHED665767LCC676766CBCCBDFHCF9A666556BCA666676BBA76A7A7AAB6886B6A [test blend mode=DEST_MINUS_SRC src=0 dst=1,0,a,ia] extend=template mode=DEST_MINUS_SRC dst=1,0,a,ia -src=ALLEGRO_ZERO +src=A5O_ZERO hash=441baf02 sig=GDA9BAGHHJJJJIHHHHED665767LCC676766CBCCBDFHCF9A66A95ABCA866676BBA77A7A6AAB6886B5A [test blend mode=DEST_MINUS_SRC src=a dst=1,0,a,ia] extend=template mode=DEST_MINUS_SRC dst=1,0,a,ia -src=ALLEGRO_ALPHA +src=A5O_ALPHA hash=6fcd619c sig=GD9977G6HJJ7JIHHHHED665767LCC676766CBCCBDFHCF9A666556BCA666676BBA86A7A7AAB6886B6A [test blend mode=DEST_MINUS_SRC src=ia dst=1,0,a,ia] extend=template mode=DEST_MINUS_SRC dst=1,0,a,ia -src=ALLEGRO_INVERSE_ALPHA +src=A5O_INVERSE_ALPHA hash=77192dfe sig=GD9998GGHJJHJIHHHHED665767LCC676766CBCCBDFHCF9A66985ABCA766676BBA76A7A7AAB6886B6A [test blend mode=DEST_MINUS_SRC src=sc dst=1,0,a,ia] extend=template mode=DEST_MINUS_SRC dst=1,0,a,ia -src=ALLEGRO_SRC_COLOR +src=A5O_SRC_COLOR hash=2dc73562 sig=GD9977G6HJJ7JIHHHHED665767LCC676766CBCCBDFHCF9A666556BCA666676BBA86A7A7AAB6886B6A [test blend mode=DEST_MINUS_SRC src=dc dst=1,0,a,ia] extend=template mode=DEST_MINUS_SRC dst=1,0,a,ia -src=ALLEGRO_DEST_COLOR +src=A5O_DEST_COLOR hash=683a8d24 sig=GD9977G6HJJ7JIHHHHED665767LCC676766CBCCBDFHCF9A666556BCA666676BBA86A7A7AAB6886B6A [test blend mode=DEST_MINUS_SRC src=isc dst=1,0,a,ia] extend=template mode=DEST_MINUS_SRC dst=1,0,a,ia -src=ALLEGRO_INVERSE_SRC_COLOR +src=A5O_INVERSE_SRC_COLOR hash=c590b4b7 sig=GD9977GCHJJEJIHHHHED665767LCC676766CBCCBDFHCF9A668756BCA566676BBA76A7A7AAB6886B6A [test blend mode=DEST_MINUS_SRC src=idc dst=1,0,a,ia] extend=template mode=DEST_MINUS_SRC dst=1,0,a,ia -src=ALLEGRO_INVERSE_DEST_COLOR +src=A5O_INVERSE_DEST_COLOR hash=c0986966 sig=GD9977G6HJJ7JIHHHHED665767LCC676766CBCCBDFHCF9A666556BCA666676BBA76A7A7AAB6886B6A [test blend mode=DEST_MINUS_SRC src=cc dst=1,0,a,ia] extend=template mode=DEST_MINUS_SRC dst=1,0,a,ia -src=ALLEGRO_CONST_COLOR +src=A5O_CONST_COLOR hash=38f39dec sig=GD9966G6HJJ7JIHHHHED665767LCC676766CBCCBDFHCF9A666556BCA666676BBA86A7A7AAB6886B6A [test blend mode=DEST_MINUS_SRC src=icc dst=1,0,a,ia] extend=template mode=DEST_MINUS_SRC dst=1,0,a,ia -src=ALLEGRO_INVERSE_CONST_COLOR +src=A5O_INVERSE_CONST_COLOR hash=6eb30b02 sig=GDA9A9GEHJJGJIHHHHED665767LCC676766CBCCBDFHCF9A669957BCA566676BBA77A7A7AAB6886B6A @@ -315,65 +315,65 @@ sig=GDA9A9GEHJJGJIHHHHED665767LCC676766CBCCBDFHCF9A669957BCA566676BBA77A7A7AAB68 [template mode=DEST_MINUS_SRC dst=sc,dc,isc,idc] extend=template dst=sc,dc,isc,idc -mode=ALLEGRO_DEST_MINUS_SRC +mode=A5O_DEST_MINUS_SRC [test blend mode=DEST_MINUS_SRC src=1 dst=sc,dc,isc,idc] extend=template mode=DEST_MINUS_SRC dst=sc,dc,isc,idc -src=ALLEGRO_ONE +src=A5O_ONE hash=8b11d273 sig=GD666666HJJ666676HED669777LCC667786CBCCBDFIDF9AAC65D6BCA6CCEFABBA768777AAB677686A [test blend mode=DEST_MINUS_SRC src=0 dst=sc,dc,isc,idc] extend=template mode=DEST_MINUS_SRC dst=sc,dc,isc,idc -src=ALLEGRO_ZERO +src=A5O_ZERO hash=90e041ac sig=GD664468HJJA66676HED869879LCC867C88CBCCBDFIDF9AAC88D5BCA6CCEFABBA878878AAB777787A [test blend mode=DEST_MINUS_SRC src=a dst=sc,dc,isc,idc] extend=template mode=DEST_MINUS_SRC dst=sc,dc,isc,idc -src=ALLEGRO_ALPHA +src=A5O_ALPHA hash=b4a2ce11 sig=GD666666HJJ666676HED669777LCC667786CBCCBDFIDF9AAC55D6BCA6CCEFABBA768777AAB677686A [test blend mode=DEST_MINUS_SRC src=ia dst=sc,dc,isc,idc] extend=template mode=DEST_MINUS_SRC dst=sc,dc,isc,idc -src=ALLEGRO_INVERSE_ALPHA +src=A5O_INVERSE_ALPHA hash=59fcf94a sig=GD665568HJJA66676HED769778LCC767B88CBCCBDFIDF9AAC55D6BCA6CCEFABBA768777AAB777686A [test blend mode=DEST_MINUS_SRC src=sc dst=sc,dc,isc,idc] extend=template mode=DEST_MINUS_SRC dst=sc,dc,isc,idc -src=ALLEGRO_SRC_COLOR +src=A5O_SRC_COLOR hash=861e7e3e sig=GD666666HJJ666676HED669777LCC667786CBCCBDFIDF9AAC55D6BCA6CCEFABBA768777AAB677686A [test blend mode=DEST_MINUS_SRC src=dc dst=sc,dc,isc,idc] extend=template mode=DEST_MINUS_SRC dst=sc,dc,isc,idc -src=ALLEGRO_DEST_COLOR +src=A5O_DEST_COLOR hash=d0317d02 sig=GD666666HJJ666676HED669777LCC667786CBCCBDFIDF9AAC55D6BCA6CCEFABBA768777AAB677686A [test blend mode=DEST_MINUS_SRC src=isc dst=sc,dc,isc,idc] extend=template mode=DEST_MINUS_SRC dst=sc,dc,isc,idc -src=ALLEGRO_INVERSE_SRC_COLOR +src=A5O_INVERSE_SRC_COLOR hash=6d493d98 sig=GD664466HJJ866676HED669777LCC667A87CBCCBDFIDF9AAC55D6BCA6CCEFABBA668776AAB677585A [test blend mode=DEST_MINUS_SRC src=idc dst=sc,dc,isc,idc] extend=template mode=DEST_MINUS_SRC dst=sc,dc,isc,idc -src=ALLEGRO_INVERSE_DEST_COLOR +src=A5O_INVERSE_DEST_COLOR hash=18079776 sig=GD666666HJJ666676HED669777LCC667786CBCCBDFIDF9AAC55D6BCA6CCEFABBA768777AAB677686A [test blend mode=DEST_MINUS_SRC src=cc dst=sc,dc,isc,idc] extend=template mode=DEST_MINUS_SRC dst=sc,dc,isc,idc -src=ALLEGRO_CONST_COLOR +src=A5O_CONST_COLOR hash=ed43510b sig=GD666666HJJ666676HED669777LCC667786CBCCBDFIDF9AAC65D6BCA6CCEFABBA768777AAB677686A [test blend mode=DEST_MINUS_SRC src=icc dst=sc,dc,isc,idc] extend=template mode=DEST_MINUS_SRC dst=sc,dc,isc,idc -src=ALLEGRO_INVERSE_CONST_COLOR +src=A5O_INVERSE_CONST_COLOR hash=c347651f sig=GD663366HJJ866676HED769878LCC767A86CBCCBDFIDF9AAC88D6BCA6CCEFABBA778877AAB676585A @@ -381,65 +381,65 @@ sig=GD663366HJJ866676HED769878LCC767A86CBCCBDFIDF9AAC88D6BCA6CCEFABBA778877AAB67 [template mode=DEST_MINUS_SRC dst=cc,icc] extend=template dst=cc,icc -mode=ALLEGRO_DEST_MINUS_SRC +mode=A5O_DEST_MINUS_SRC [test blend mode=DEST_MINUS_SRC src=1 dst=cc,icc] extend=template mode=DEST_MINUS_SRC dst=cc,icc -src=ALLEGRO_ONE +src=A5O_ONE hash=d68bdd68 sig=GD666666HJJ666676HED669777LCC667786CBCCBDFIDF9A666556BCA666676BBA766757AAB655666A [test blend mode=DEST_MINUS_SRC src=0 dst=cc,icc] extend=template mode=DEST_MINUS_SRC dst=cc,icc -src=ALLEGRO_ZERO +src=A5O_ZERO hash=182efe77 sig=GD664468HJJA66676HED869879LCC867C88CBCCBDFIDF9A665556BCA666676BBA656656AAB555565A [test blend mode=DEST_MINUS_SRC src=a dst=cc,icc] extend=template mode=DEST_MINUS_SRC dst=cc,icc -src=ALLEGRO_ALPHA +src=A5O_ALPHA hash=cb2229b3 sig=GD666666HJJ666676HED669777LCC667786CBCCBDFIDF9A666556BCA666676BBA766757AAB655666A [test blend mode=DEST_MINUS_SRC src=ia dst=cc,icc] extend=template mode=DEST_MINUS_SRC dst=cc,icc -src=ALLEGRO_INVERSE_ALPHA +src=A5O_INVERSE_ALPHA hash=cbb32185 sig=GD665568HJJA66676HED769778LCC767B88CBCCBDFIDF9A666656BCA566676BBA666756AAB655565A [test blend mode=DEST_MINUS_SRC src=sc dst=cc,icc] extend=template mode=DEST_MINUS_SRC dst=cc,icc -src=ALLEGRO_SRC_COLOR +src=A5O_SRC_COLOR hash=128074a2 sig=GD666666HJJ666676HED669777LCC667786CBCCBDFIDF9A666556BCA666676BBA766757AAB655666A [test blend mode=DEST_MINUS_SRC src=dc dst=cc,icc] extend=template mode=DEST_MINUS_SRC dst=cc,icc -src=ALLEGRO_DEST_COLOR +src=A5O_DEST_COLOR hash=07b128cd sig=GD666666HJJ666676HED669777LCC667786CBCCBDFIDF9A666556BCA666676BBA766757AAB655666A [test blend mode=DEST_MINUS_SRC src=isc dst=cc,icc] extend=template mode=DEST_MINUS_SRC dst=cc,icc -src=ALLEGRO_INVERSE_SRC_COLOR +src=A5O_INVERSE_SRC_COLOR hash=3704cd4c sig=GD664466HJJ866676HED669777LCC667A87CBCCBDFIDF9A665555BCA566676BBA666756AAB555564A [test blend mode=DEST_MINUS_SRC src=idc dst=cc,icc] extend=template mode=DEST_MINUS_SRC dst=cc,icc -src=ALLEGRO_INVERSE_DEST_COLOR +src=A5O_INVERSE_DEST_COLOR hash=6df57d07 sig=GD666666HJJ666676HED669777LCC667786CBCCBDFIDF9A666556BCA666676BBA766757AAB655666A [test blend mode=DEST_MINUS_SRC src=cc dst=cc,icc] extend=template mode=DEST_MINUS_SRC dst=cc,icc -src=ALLEGRO_CONST_COLOR +src=A5O_CONST_COLOR hash=66a06ce3 sig=GD666666HJJ666676HED669777LCC667786CBCCBDFIDF9A666556BCA666676BBA766757AAB655666A [test blend mode=DEST_MINUS_SRC src=icc dst=cc,icc] extend=template mode=DEST_MINUS_SRC dst=cc,icc -src=ALLEGRO_INVERSE_CONST_COLOR +src=A5O_INVERSE_CONST_COLOR hash=1222ba8b sig=GD663366HJJ866676HED769878LCC767A86CBCCBDFIDF9A664454BCA466676BBA556655AAB555464A @@ -448,65 +448,65 @@ sig=GD663366HJJ866676HED769878LCC767A86CBCCBDFIDF9A664454BCA466676BBA556655AAB55 [template mode=SRC_MINUS_DEST dst=1,0,a,ia] extend=template dst=1,0,a,ia -mode=ALLEGRO_SRC_MINUS_DEST +mode=A5O_SRC_MINUS_DEST [test blend mode=SRC_MINUS_DEST src=1 dst=1,0,a,ia] extend=template mode=SRC_MINUS_DEST dst=1,0,a,ia -src=ALLEGRO_ONE +src=A5O_ONE hash=2a79c7ac sig=GD666667HJJ766676HEDL3566KLCCH78T6QCBCCBDFHCF9A665559BCAC66676BBAL5775KAABH67T7PA [test blend mode=SRC_MINUS_DEST src=0 dst=1,0,a,ia] extend=template mode=SRC_MINUS_DEST dst=1,0,a,ia -src=ALLEGRO_ZERO +src=A5O_ZERO hash=82bce5d4 sig=GD666666HJJ666676HED665767LCC676766CBCCBDFHCF9A666556BCA666676BBA767757AAB666676A [test blend mode=SRC_MINUS_DEST src=a dst=1,0,a,ia] extend=template mode=SRC_MINUS_DEST dst=1,0,a,ia -src=ALLEGRO_ALPHA +src=A5O_ALPHA hash=98761b88 sig=GD666667HJJ766676HEDJ5576KLCCH76T6PCBCCBDFHCF9A666659BCAB66676BBAJ6785KAABG67S7PA [test blend mode=SRC_MINUS_DEST src=ia dst=1,0,a,ia] extend=template mode=SRC_MINUS_DEST dst=1,0,a,ia -src=ALLEGRO_INVERSE_ALPHA +src=A5O_INVERSE_ALPHA hash=5bc32bdb sig=GD666666HJJ666676HED655566LCC676666CBCCBDFHCF9A666556BCA666676BBA767757AAB666676A [test blend mode=SRC_MINUS_DEST src=sc dst=1,0,a,ia] extend=template mode=SRC_MINUS_DEST dst=1,0,a,ia -src=ALLEGRO_SRC_COLOR +src=A5O_SRC_COLOR hash=bebf46ff sig=GD666667HJJ766676HEDF5556ELCCB76L6ICBCCBDFHCF9A665558BCAA66676BBAF6765EAABB66L7IA [test blend mode=SRC_MINUS_DEST src=dc dst=1,0,a,ia] extend=template mode=SRC_MINUS_DEST dst=1,0,a,ia -src=ALLEGRO_DEST_COLOR +src=A5O_DEST_COLOR hash=721318ba sig=GD666666HJJ666676HED855568LCC776D68CBCCBDFHCF9A666556BCA666676BBA767656AAB666576A [test blend mode=SRC_MINUS_DEST src=isc dst=1,0,a,ia] extend=template mode=SRC_MINUS_DEST dst=1,0,a,ia -src=ALLEGRO_INVERSE_SRC_COLOR +src=A5O_INVERSE_SRC_COLOR hash=b3cf8aac sig=GD666666HJJ666676HED655566LCC676766CBCCBDFHCF9A666556BCA666676BBA767757AAB666676A [test blend mode=SRC_MINUS_DEST src=idc dst=1,0,a,ia] extend=template mode=SRC_MINUS_DEST dst=1,0,a,ia -src=ALLEGRO_INVERSE_DEST_COLOR +src=A5O_INVERSE_DEST_COLOR hash=0793889c sig=GD666666HJJ666676HED955568LCC87686ACBCCBDFHCF9A666556BCA666676BBAB6775BAABA67F7CA [test blend mode=SRC_MINUS_DEST src=cc dst=1,0,a,ia] extend=template mode=SRC_MINUS_DEST dst=1,0,a,ia -src=ALLEGRO_CONST_COLOR +src=A5O_CONST_COLOR hash=8d0c7f68 sig=GD665565HJJ666676HEDH3556GLCCE77N6KCBCCBDFHCF9A665457BCAA66676BBAH5765GAABD67N7KA [test blend mode=SRC_MINUS_DEST src=icc dst=1,0,a,ia] extend=template mode=SRC_MINUS_DEST dst=1,0,a,ia -src=ALLEGRO_INVERSE_CONST_COLOR +src=A5O_INVERSE_CONST_COLOR hash=82bce5d4 sig=GD666666HJJ666676HED665767LCC676766CBCCBDFHCF9A666556BCA666676BBA767757AAB666676A @@ -514,65 +514,65 @@ sig=GD666666HJJ666676HED665767LCC676766CBCCBDFHCF9A666556BCA666676BBA767757AAB66 [template mode=SRC_MINUS_DEST dst=sc,dc,isc,idc] extend=template dst=sc,dc,isc,idc -mode=ALLEGRO_SRC_MINUS_DEST +mode=A5O_SRC_MINUS_DEST [test blend mode=SRC_MINUS_DEST src=1 dst=sc,dc,isc,idc] extend=template mode=SRC_MINUS_DEST dst=sc,dc,isc,idc -src=ALLEGRO_ONE +src=A5O_ONE hash=a5bc2ba0 sig=GD666669HJJA66676HEDB55569LCC97696ECBCCBDFHCF9A66885IBCAM66676BBAC5755BAAB967H7DA [test blend mode=SRC_MINUS_DEST src=0 dst=sc,dc,isc,idc] extend=template mode=SRC_MINUS_DEST dst=sc,dc,isc,idc -src=ALLEGRO_ZERO +src=A5O_ZERO hash=82bce5d4 sig=GD666666HJJ666676HED665767LCC676766CBCCBDFHCF9A666556BCA666676BBA767757AAB666676A [test blend mode=SRC_MINUS_DEST src=a dst=sc,dc,isc,idc] extend=template mode=SRC_MINUS_DEST dst=sc,dc,isc,idc -src=ALLEGRO_ALPHA +src=A5O_ALPHA hash=eda1ec1b sig=GD667769HJJ966676HEDA65769LCC97696ECBCCBDFHCF9A66985IBCAL66676BBAB6765BAAB966G7DA [test blend mode=SRC_MINUS_DEST src=ia dst=sc,dc,isc,idc] extend=template mode=SRC_MINUS_DEST dst=sc,dc,isc,idc -src=ALLEGRO_INVERSE_ALPHA +src=A5O_INVERSE_ALPHA hash=33a0483e sig=GD666666HJJ666676HED665767LCC676766CBCCBDFHCF9A665555BCA666676BBA767757AAB666676A [test blend mode=SRC_MINUS_DEST src=sc dst=sc,dc,isc,idc] extend=template mode=SRC_MINUS_DEST dst=sc,dc,isc,idc -src=ALLEGRO_SRC_COLOR +src=A5O_SRC_COLOR hash=fb2978c6 sig=GD666667HJJ766676HED965669LCC77696BCBCCBDFHCF9A66775FBCAG66676BBAA67659AAB866D7BA [test blend mode=SRC_MINUS_DEST src=dc dst=sc,dc,isc,idc] extend=template mode=SRC_MINUS_DEST dst=sc,dc,isc,idc -src=ALLEGRO_DEST_COLOR +src=A5O_DEST_COLOR hash=5a1c8feb sig=GD666666HJJ666676HED665666LCC675666CBCCBDFHCF9A665555BCA566676BBA667655AAB566574A [test blend mode=SRC_MINUS_DEST src=isc dst=sc,dc,isc,idc] extend=template mode=SRC_MINUS_DEST dst=sc,dc,isc,idc -src=ALLEGRO_INVERSE_SRC_COLOR +src=A5O_INVERSE_SRC_COLOR hash=612ad8c8 sig=GD666666HJJ666676HED665767LCC676766CBCCBDFHCF9A665555BCA666676BBA767757AAB666676A [test blend mode=SRC_MINUS_DEST src=idc dst=sc,dc,isc,idc] extend=template mode=SRC_MINUS_DEST dst=sc,dc,isc,idc -src=ALLEGRO_INVERSE_DEST_COLOR +src=A5O_INVERSE_DEST_COLOR hash=77b28a0b sig=GD666666HJJ666676HED665666LCC676567CBCCBDFHCF9A666659BCAC66676BBA767757AAB766876A [test blend mode=SRC_MINUS_DEST src=cc dst=sc,dc,isc,idc] extend=template mode=SRC_MINUS_DEST dst=sc,dc,isc,idc -src=ALLEGRO_CONST_COLOR +src=A5O_CONST_COLOR hash=70d42cc2 sig=GD665667HJJ766676HED955567LCC77666BCBCCBDFHCF9A66775FBCAH66676BBA957558AAB766D79A [test blend mode=SRC_MINUS_DEST src=icc dst=sc,dc,isc,idc] extend=template mode=SRC_MINUS_DEST dst=sc,dc,isc,idc -src=ALLEGRO_INVERSE_CONST_COLOR +src=A5O_INVERSE_CONST_COLOR hash=82bce5d4 sig=GD666666HJJ666676HED665767LCC676766CBCCBDFHCF9A666556BCA666676BBA767757AAB666676A @@ -580,65 +580,65 @@ sig=GD666666HJJ666676HED665767LCC676766CBCCBDFHCF9A666556BCA666676BBA767757AAB66 [template mode=SRC_MINUS_DEST dst=cc,icc] extend=template dst=cc,icc -mode=ALLEGRO_SRC_MINUS_DEST +mode=A5O_SRC_MINUS_DEST [test blend mode=SRC_MINUS_DEST src=1 dst=cc,icc] extend=template mode=SRC_MINUS_DEST dst=cc,icc -src=ALLEGRO_ONE +src=A5O_ONE hash=ec7a13cf sig=GD666669HJJA66676HEDB55569LCC97696ECBCCBDFHCF9A66665CBCAE66676BBAF5765FAABD67M7IA [test blend mode=SRC_MINUS_DEST src=0 dst=cc,icc] extend=template mode=SRC_MINUS_DEST dst=cc,icc -src=ALLEGRO_ZERO +src=A5O_ZERO hash=82bce5d4 sig=GD666666HJJ666676HED665767LCC676766CBCCBDFHCF9A666556BCA666676BBA767757AAB666676A [test blend mode=SRC_MINUS_DEST src=a dst=cc,icc] extend=template mode=SRC_MINUS_DEST dst=cc,icc -src=ALLEGRO_ALPHA +src=A5O_ALPHA hash=4176dbb1 sig=GD667769HJJ966676HEDA65769LCC97696ECBCCBDFHCF9A66665CBCAD66676BBAF6775FAABC67L7IA [test blend mode=SRC_MINUS_DEST src=ia dst=cc,icc] extend=template mode=SRC_MINUS_DEST dst=cc,icc -src=ALLEGRO_INVERSE_ALPHA +src=A5O_INVERSE_ALPHA hash=8db00872 sig=GD666666HJJ666676HED665767LCC676766CBCCBDFHCF9A666556BCA666676BBA767757AAB666676A [test blend mode=SRC_MINUS_DEST src=sc dst=cc,icc] extend=template mode=SRC_MINUS_DEST dst=cc,icc -src=ALLEGRO_SRC_COLOR +src=A5O_SRC_COLOR hash=1bd139f8 sig=GD666667HJJ766676HED965669LCC77696BCBCCBDFHCF9A665558BCAA66676BBAB6765BAAB966G7DA [test blend mode=SRC_MINUS_DEST src=dc dst=cc,icc] extend=template mode=SRC_MINUS_DEST dst=cc,icc -src=ALLEGRO_DEST_COLOR +src=A5O_DEST_COLOR hash=ac5b10cc sig=GD666666HJJ666676HED665666LCC675666CBCCBDFHCF9A666556BCA666676BBA667656AAB666575A [test blend mode=SRC_MINUS_DEST src=isc dst=cc,icc] extend=template mode=SRC_MINUS_DEST dst=cc,icc -src=ALLEGRO_INVERSE_SRC_COLOR +src=A5O_INVERSE_SRC_COLOR hash=e2a893a6 sig=GD666666HJJ666676HED665767LCC676766CBCCBDFHCF9A666556BCA666676BBA767757AAB666676A [test blend mode=SRC_MINUS_DEST src=idc dst=cc,icc] extend=template mode=SRC_MINUS_DEST dst=cc,icc -src=ALLEGRO_INVERSE_DEST_COLOR +src=A5O_INVERSE_DEST_COLOR hash=c7613016 sig=GD666666HJJ666676HED665666LCC676567CBCCBDFHCF9A666556BCA666676BBA867758AAB766A78A [test blend mode=SRC_MINUS_DEST src=cc dst=cc,icc] extend=template mode=SRC_MINUS_DEST dst=cc,icc -src=ALLEGRO_CONST_COLOR +src=A5O_CONST_COLOR hash=abe19282 sig=GD665667HJJ766676HED955567LCC77666BCBCCBDFHCF9A665559BCAC66676BBAD5755CAABA67I7EA [test blend mode=SRC_MINUS_DEST src=icc dst=cc,icc] extend=template mode=SRC_MINUS_DEST dst=cc,icc -src=ALLEGRO_INVERSE_CONST_COLOR +src=A5O_INVERSE_CONST_COLOR hash=82bce5d4 sig=GD666666HJJ666676HED665767LCC676766CBCCBDFHCF9A666556BCA666676BBA767757AAB666676A #-----------------------------------------------------------------------------# @@ -651,8 +651,8 @@ op2=al_clear_to_color(#ffffff) op3=al_set_target_bitmap(target) op4=al_clear_to_color(#808080) op5=al_draw_line(10, 10, 190, 10, white, 2) -op6=al_set_blender(ALLEGRO_DEST_MINUS_SRC, ALLEGRO_ALPHA, ALLEGRO_ONE) +op6=al_set_blender(A5O_DEST_MINUS_SRC, A5O_ALPHA, A5O_ONE) op7=al_draw_bitmap(image, 10, 20, 0) -op8=al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) +op8=al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) op9=al_draw_line(10, 190, 190, 190, white, 2) hash=610f2805 diff --git a/tests/test_blend_target.ini b/tests/test_blend_target.ini index 4ed24ff13a..9416852b8d 100644 --- a/tests/test_blend_target.ini +++ b/tests/test_blend_target.ini @@ -5,9 +5,9 @@ mysha=../examples/data/mysha.pcx op0=t1 = al_create_sub_bitmap(target, 0, 0, 300, 200) op1=t2 = al_create_sub_bitmap(target, 300, 0, 300, 200) op2=al_set_target_bitmap(t1) -op3=al_set_bitmap_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO) +op3=al_set_bitmap_blender(A5O_ADD, A5O_ONE, A5O_ZERO) op4=al_set_target_bitmap(t2) -op5=al_set_bitmap_blender(ALLEGRO_ADD, ALLEGRO_SRC_COLOR, ALLEGRO_ZERO) +op5=al_set_bitmap_blender(A5O_ADD, A5O_SRC_COLOR, A5O_ZERO) op6=al_set_target_bitmap(target) op7=al_set_target_bitmap(t1) op8=al_draw_bitmap(mysha, 0, 0, 0) @@ -23,7 +23,7 @@ hash=252ba460 sig=FtZD39g32vmREBdCA3jLLEIP813222200100000000000000000000000000000000000000000000000 [test reset] -op0=al_set_bitmap_blender(ALLEGRO_ADD, ALLEGRO_SRC_COLOR, ALLEGRO_ZERO) +op0=al_set_bitmap_blender(A5O_ADD, A5O_SRC_COLOR, A5O_ZERO) op1=al_draw_bitmap(mysha, 0, 0, 0) op2=al_reset_bitmap_blender(mysha) op3=al_draw_bitmap(mysha, 100, 0, 0) diff --git a/tests/test_ciede2000.ini b/tests/test_ciede2000.ini index 56d7484d59..3235614154 100644 --- a/tests/test_ciede2000.ini +++ b/tests/test_ciede2000.ini @@ -6,13 +6,13 @@ builtin=al_create_builtin_font() op0=c1 = al_color_lab(l1, a1, b1) op1=c2 = al_color_lab(l2, a2, b2) op2=d = al_color_distance_ciede2000(c1, c2) -op3=al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA) +op3=al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA) op4=x=fdif(d, d2000) # we only test if the result is within one percent because we are not # very numerically stable op5=x=fmul(x, 100) op6=x=round(x) -op7=al_draw_text(builtin, white, 0, 0, ALLEGRO_ALIGN_LEFT, x); +op7=al_draw_text(builtin, white, 0, 0, A5O_ALIGN_LEFT, x); hash=fd053345 sw_only=true diff --git a/tests/test_compressed.ini b/tests/test_compressed.ini index 00957372ee..44a7246af0 100644 --- a/tests/test_compressed.ini +++ b/tests/test_compressed.ini @@ -25,7 +25,7 @@ hw_only = true op0=b = al_load_bitmap(filename) op1=al_set_target_bitmap(b) # Need to lock, otherwise the triangles of the rectangle will lock separately and result in diagonal artifacts -op2=al_lock_bitmap_region(b, 7, 7, 166, 126, ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_READWRITE) +op2=al_lock_bitmap_region(b, 7, 7, 166, 126, A5O_PIXEL_FORMAT_ANY, A5O_LOCK_READWRITE) op3=al_draw_filled_rectangle(8, 8, 164, 124, #ff00ff) op4=al_unlock_bitmap(b) op5=al_set_target_bitmap(target) @@ -125,7 +125,7 @@ sig=LLZD50000LL0050000ZLL0500002222000000000000000000000000000000000000000000000 [convert from] hw_only = true op0=b = al_load_bitmap(filename) -op1=al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_RGB_565) +op1=al_set_new_bitmap_format(A5O_PIXEL_FORMAT_RGB_565) op2=al_convert_bitmap(b) op3=al_draw_bitmap(b, 0, 0, 0) @@ -147,22 +147,22 @@ sig=ftZD50000um0050000jLL0500002222000000000000000000000000000000000000000000000 [convert to] hw_only = true filename = ../examples/data/blue_box.png -op0=al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_RGB_565) +op0=al_set_new_bitmap_format(A5O_PIXEL_FORMAT_RGB_565) op1=b = al_load_bitmap(filename) op3=al_convert_bitmap(b) op4=al_draw_bitmap(b, 0, 0, 0) [test convert to dxt1] extend=convert to -op2=al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1) +op2=al_set_new_bitmap_format(A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1) sig=OA0000000OA0000000000000000000000000000000000000000000000000000000000000000000000 [test convert to dxt3] extend=convert to -op2=al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3) +op2=al_set_new_bitmap_format(A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3) sig=OA0000000OA0000000000000000000000000000000000000000000000000000000000000000000000 [test convert to dxt5] extend=convert to -op2=al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5) +op2=al_set_new_bitmap_format(A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5) sig=OA0000000OA0000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/tests/test_convert.ini b/tests/test_convert.ini index 946a7694c0..d91f25edd3 100644 --- a/tests/test_convert.ini +++ b/tests/test_convert.ini @@ -3,8 +3,8 @@ hw_only = true skip_on_xvfb = true op0= al_clear_to_color(#554321) -op1= al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP) -op2= al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_RGB_565) +op1= al_set_new_bitmap_flags(A5O_MEMORY_BITMAP) +op2= al_set_new_bitmap_format(A5O_PIXEL_FORMAT_RGB_565) op3= bmp = al_create_bitmap(360, 120) op4= al_set_target_bitmap(bmp) op5= al_clear_to_color(#00000000) @@ -12,14 +12,14 @@ op6= al_draw_filled_rectangle(0, 0, 120, 120, red) op7= al_draw_filled_rectangle(120, 0, 240, 120, green) op8= al_draw_filled_rectangle(240, 0, 360, 120, blue) op9= al_set_target_bitmap(target) -op10=al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP) -op11=al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_RGBA_8888) +op10=al_set_new_bitmap_flags(A5O_VIDEO_BITMAP) +op11=al_set_new_bitmap_format(A5O_PIXEL_FORMAT_RGBA_8888) op12=al_convert_bitmap(bmp) op13=al_draw_bitmap(bmp, 0, 0, 0) hash=955d3cc5 [test convert back] extend=test convert -op1=al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP) -op10=al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP) +op1=al_set_new_bitmap_flags(A5O_VIDEO_BITMAP) +op10=al_set_new_bitmap_flags(A5O_MEMORY_BITMAP) hash=77b58ac5 diff --git a/tests/test_driver.c b/tests/test_driver.c index 94bce21854..84d35a952b 100644 --- a/tests/test_driver.c +++ b/tests/test_driver.c @@ -4,7 +4,7 @@ * By Peter Wang. */ -#define ALLEGRO_UNSTABLE +#define A5O_UNSTABLE #include #include #include @@ -23,8 +23,8 @@ #define MAX_POLYGONS 8 typedef struct { - ALLEGRO_USTR *name; - ALLEGRO_BITMAP *bitmap[2]; + A5O_USTR *name; + A5O_BITMAP *bitmap[2]; } Bitmap; typedef enum { @@ -33,8 +33,8 @@ typedef enum { } BmpType; typedef struct { - ALLEGRO_USTR *name; - ALLEGRO_TRANSFORM transform; + A5O_USTR *name; + A5O_TRANSFORM transform; } Transform; typedef struct { @@ -42,23 +42,23 @@ typedef struct { int y; int w; int h; - ALLEGRO_LOCKED_REGION *lr; + A5O_LOCKED_REGION *lr; } LockRegion; typedef struct { - ALLEGRO_USTR *name; - ALLEGRO_FONT *font; + A5O_USTR *name; + A5O_FONT *font; } NamedFont; int argc; char **argv; -ALLEGRO_DISPLAY *display; -ALLEGRO_BITMAP *membuf; +A5O_DISPLAY *display; +A5O_BITMAP *membuf; Bitmap bitmaps[MAX_BITMAPS]; LockRegion lock_region; Transform transforms[MAX_TRANS]; NamedFont fonts[MAX_FONTS]; -ALLEGRO_VERTEX vertices[MAX_VERTICES]; +A5O_VERTEX vertices[MAX_VERTICES]; float simple_vertices[2 * MAX_VERTICES]; int num_simple_vertices; int vertex_counts[MAX_POLYGONS]; @@ -141,11 +141,11 @@ static char const *bmp_type_to_string(BmpType bmp_type) return "error"; } -static ALLEGRO_BITMAP *create_fallback_bitmap(void) +static A5O_BITMAP *create_fallback_bitmap(void) { - ALLEGRO_BITMAP *bmp = al_create_bitmap(256, 256); - ALLEGRO_FONT *builtin_font = al_create_builtin_font(); - ALLEGRO_STATE state; + A5O_BITMAP *bmp = al_create_bitmap(256, 256); + A5O_FONT *builtin_font = al_create_builtin_font(); + A5O_STATE state; if (!bmp) { fatal_error("couldn't create a backup bitmap"); @@ -153,7 +153,7 @@ static ALLEGRO_BITMAP *create_fallback_bitmap(void) if (!builtin_font) { fatal_error("couldn't create a builtin font"); } - al_store_state(&state, ALLEGRO_STATE_BITMAP); + al_store_state(&state, A5O_STATE_BITMAP); al_set_target_bitmap(bmp); al_clear_to_color(al_map_rgb_f(0.5, 0, 0)); al_draw_text(builtin_font, al_map_rgb_f(1, 1, 1), 0, 0, 0, "fallback"); @@ -163,9 +163,9 @@ static ALLEGRO_BITMAP *create_fallback_bitmap(void) return bmp; } -static ALLEGRO_BITMAP *load_relative_bitmap(char const *filename, int flags) +static A5O_BITMAP *load_relative_bitmap(char const *filename, int flags) { - ALLEGRO_BITMAP *bmp; + A5O_BITMAP *bmp; bmp = al_load_bitmap_flags(filename, flags); if (!bmp) { @@ -175,11 +175,11 @@ static ALLEGRO_BITMAP *load_relative_bitmap(char const *filename, int flags) return bmp; } -static void load_bitmaps(ALLEGRO_CONFIG const *cfg, const char *section, +static void load_bitmaps(A5O_CONFIG const *cfg, const char *section, BmpType bmp_type, int flags) { int i = 0; - ALLEGRO_CONFIG_ENTRY *iter; + A5O_CONFIG_ENTRY *iter; char const *key; char const *value; @@ -200,7 +200,7 @@ static void load_bitmaps(ALLEGRO_CONFIG const *cfg, const char *section, num_global_bitmaps = i; } -static ALLEGRO_BITMAP **reserve_local_bitmap(const char *name, BmpType bmp_type) +static A5O_BITMAP **reserve_local_bitmap(const char *name, BmpType bmp_type) { int i; @@ -235,21 +235,21 @@ static void unload_data(void) num_global_bitmaps = 0; } -static void set_target_reset(ALLEGRO_BITMAP *target) +static void set_target_reset(A5O_BITMAP *target) { - ALLEGRO_TRANSFORM ident; + A5O_TRANSFORM ident; al_set_target_bitmap(target); al_clear_to_color(al_map_rgb(0, 0, 0)); al_reset_clipping_rectangle(); - al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO); + al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO); al_identity_transform(&ident); al_use_transform(&ident); al_orthographic_transform(&ident, 0, 0, -1, al_get_bitmap_width(target), al_get_bitmap_height(target), 1); al_use_projection_transform(&ident); } -static char const *resolve_var(ALLEGRO_CONFIG const *cfg, char const *section, +static char const *resolve_var(A5O_CONFIG const *cfg, char const *section, char const *v) { char const *vv = al_get_config_value(cfg, section, v); @@ -263,7 +263,7 @@ static bool get_bool(char const *value) : atoi(value); } -static ALLEGRO_COLOR get_color(char const *value) +static A5O_COLOR get_color(char const *value) { int r, g, b, a; float rf, gf, bf; @@ -277,8 +277,8 @@ static ALLEGRO_COLOR get_color(char const *value) return al_color_name(value); } -static ALLEGRO_BITMAP *get_bitmap(char const *value, BmpType bmp_type, - ALLEGRO_BITMAP *target) +static A5O_BITMAP *get_bitmap(char const *value, BmpType bmp_type, + A5O_BITMAP *target) { int i; @@ -299,50 +299,50 @@ static ALLEGRO_BITMAP *get_bitmap(char const *value, BmpType bmp_type, static int get_load_bitmap_flag(char const *value) { - if (streq(value, "ALLEGRO_NO_PREMULTIPLIED_ALPHA")) - return ALLEGRO_NO_PREMULTIPLIED_ALPHA; - if (streq(value, "ALLEGRO_KEEP_INDEX")) - return ALLEGRO_KEEP_INDEX; + if (streq(value, "A5O_NO_PREMULTIPLIED_ALPHA")) + return A5O_NO_PREMULTIPLIED_ALPHA; + if (streq(value, "A5O_KEEP_INDEX")) + return A5O_KEEP_INDEX; return atoi(value); } static int get_draw_bitmap_flag(char const *value) { - if (streq(value, "ALLEGRO_FLIP_HORIZONTAL")) - return ALLEGRO_FLIP_HORIZONTAL; - if (streq(value, "ALLEGRO_FLIP_VERTICAL")) - return ALLEGRO_FLIP_VERTICAL; - if (streq(value, "ALLEGRO_FLIP_VERTICAL|ALLEGRO_FLIP_HORIZONTAL")) - return ALLEGRO_FLIP_VERTICAL|ALLEGRO_FLIP_HORIZONTAL; - if (streq(value, "ALLEGRO_FLIP_HORIZONTAL|ALLEGRO_FLIP_VERTICAL")) - return ALLEGRO_FLIP_HORIZONTAL|ALLEGRO_FLIP_VERTICAL; + if (streq(value, "A5O_FLIP_HORIZONTAL")) + return A5O_FLIP_HORIZONTAL; + if (streq(value, "A5O_FLIP_VERTICAL")) + return A5O_FLIP_VERTICAL; + if (streq(value, "A5O_FLIP_VERTICAL|A5O_FLIP_HORIZONTAL")) + return A5O_FLIP_VERTICAL|A5O_FLIP_HORIZONTAL; + if (streq(value, "A5O_FLIP_HORIZONTAL|A5O_FLIP_VERTICAL")) + return A5O_FLIP_HORIZONTAL|A5O_FLIP_VERTICAL; return atoi(value); } static int get_blender_op(char const *value) { - return streq(value, "ALLEGRO_ADD") ? ALLEGRO_ADD - : streq(value, "ALLEGRO_DEST_MINUS_SRC") ? ALLEGRO_DEST_MINUS_SRC - : streq(value, "ALLEGRO_SRC_MINUS_DEST") ? ALLEGRO_SRC_MINUS_DEST + return streq(value, "A5O_ADD") ? A5O_ADD + : streq(value, "A5O_DEST_MINUS_SRC") ? A5O_DEST_MINUS_SRC + : streq(value, "A5O_SRC_MINUS_DEST") ? A5O_SRC_MINUS_DEST : atoi(value); } static int get_blend_factor(char const *value) { - return streq(value, "ALLEGRO_ZERO") ? ALLEGRO_ZERO - : streq(value, "ALLEGRO_ONE") ? ALLEGRO_ONE - : streq(value, "ALLEGRO_ALPHA") ? ALLEGRO_ALPHA - : streq(value, "ALLEGRO_INVERSE_ALPHA") ? ALLEGRO_INVERSE_ALPHA - : streq(value, "ALLEGRO_SRC_COLOR") ? ALLEGRO_SRC_COLOR - : streq(value, "ALLEGRO_DEST_COLOR") ? ALLEGRO_DEST_COLOR - : streq(value, "ALLEGRO_INVERSE_SRC_COLOR") ? ALLEGRO_INVERSE_SRC_COLOR - : streq(value, "ALLEGRO_INVERSE_DEST_COLOR") ? ALLEGRO_INVERSE_DEST_COLOR - : streq(value, "ALLEGRO_CONST_COLOR") ? ALLEGRO_CONST_COLOR - : streq(value, "ALLEGRO_INVERSE_CONST_COLOR") ? ALLEGRO_INVERSE_CONST_COLOR + return streq(value, "A5O_ZERO") ? A5O_ZERO + : streq(value, "A5O_ONE") ? A5O_ONE + : streq(value, "A5O_ALPHA") ? A5O_ALPHA + : streq(value, "A5O_INVERSE_ALPHA") ? A5O_INVERSE_ALPHA + : streq(value, "A5O_SRC_COLOR") ? A5O_SRC_COLOR + : streq(value, "A5O_DEST_COLOR") ? A5O_DEST_COLOR + : streq(value, "A5O_INVERSE_SRC_COLOR") ? A5O_INVERSE_SRC_COLOR + : streq(value, "A5O_INVERSE_DEST_COLOR") ? A5O_INVERSE_DEST_COLOR + : streq(value, "A5O_CONST_COLOR") ? A5O_CONST_COLOR + : streq(value, "A5O_INVERSE_CONST_COLOR") ? A5O_INVERSE_CONST_COLOR : atoi(value); } -static ALLEGRO_TRANSFORM *get_transform(const char *name) +static A5O_TRANSFORM *get_transform(const char *name) { int i; @@ -363,36 +363,36 @@ static ALLEGRO_TRANSFORM *get_transform(const char *name) static int get_pixel_format(char const *v) { - int format = streq(v, "ALLEGRO_PIXEL_FORMAT_ANY") ? ALLEGRO_PIXEL_FORMAT_ANY - : streq(v, "ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA") ? ALLEGRO_PIXEL_FORMAT_ANY_NO_ALPHA - : streq(v, "ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA") ? ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA - : streq(v, "ALLEGRO_PIXEL_FORMAT_ANY_15_NO_ALPHA") ? ALLEGRO_PIXEL_FORMAT_ANY_15_NO_ALPHA - : streq(v, "ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA") ? ALLEGRO_PIXEL_FORMAT_ANY_16_NO_ALPHA - : streq(v, "ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA") ? ALLEGRO_PIXEL_FORMAT_ANY_16_WITH_ALPHA - : streq(v, "ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA") ? ALLEGRO_PIXEL_FORMAT_ANY_24_NO_ALPHA - : streq(v, "ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA") ? ALLEGRO_PIXEL_FORMAT_ANY_32_NO_ALPHA - : streq(v, "ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA") ? ALLEGRO_PIXEL_FORMAT_ANY_32_WITH_ALPHA - : streq(v, "ALLEGRO_PIXEL_FORMAT_ARGB_8888") ? ALLEGRO_PIXEL_FORMAT_ARGB_8888 - : streq(v, "ALLEGRO_PIXEL_FORMAT_RGBA_8888") ? ALLEGRO_PIXEL_FORMAT_RGBA_8888 - : streq(v, "ALLEGRO_PIXEL_FORMAT_ARGB_4444") ? ALLEGRO_PIXEL_FORMAT_ARGB_4444 - : streq(v, "ALLEGRO_PIXEL_FORMAT_RGB_888") ? ALLEGRO_PIXEL_FORMAT_RGB_888 - : streq(v, "ALLEGRO_PIXEL_FORMAT_RGB_565") ? ALLEGRO_PIXEL_FORMAT_RGB_565 - : streq(v, "ALLEGRO_PIXEL_FORMAT_RGB_555") ? ALLEGRO_PIXEL_FORMAT_RGB_555 - : streq(v, "ALLEGRO_PIXEL_FORMAT_RGBA_5551") ? ALLEGRO_PIXEL_FORMAT_RGBA_5551 - : streq(v, "ALLEGRO_PIXEL_FORMAT_ARGB_1555") ? ALLEGRO_PIXEL_FORMAT_ARGB_1555 - : streq(v, "ALLEGRO_PIXEL_FORMAT_ABGR_8888") ? ALLEGRO_PIXEL_FORMAT_ABGR_8888 - : streq(v, "ALLEGRO_PIXEL_FORMAT_XBGR_8888") ? ALLEGRO_PIXEL_FORMAT_XBGR_8888 - : streq(v, "ALLEGRO_PIXEL_FORMAT_BGR_888") ? ALLEGRO_PIXEL_FORMAT_BGR_888 - : streq(v, "ALLEGRO_PIXEL_FORMAT_BGR_565") ? ALLEGRO_PIXEL_FORMAT_BGR_565 - : streq(v, "ALLEGRO_PIXEL_FORMAT_BGR_555") ? ALLEGRO_PIXEL_FORMAT_BGR_555 - : streq(v, "ALLEGRO_PIXEL_FORMAT_RGBX_8888") ? ALLEGRO_PIXEL_FORMAT_RGBX_8888 - : streq(v, "ALLEGRO_PIXEL_FORMAT_XRGB_8888") ? ALLEGRO_PIXEL_FORMAT_XRGB_8888 - : streq(v, "ALLEGRO_PIXEL_FORMAT_ABGR_F32") ? ALLEGRO_PIXEL_FORMAT_ABGR_F32 - : streq(v, "ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE") ? ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE - : streq(v, "ALLEGRO_PIXEL_FORMAT_RGBA_4444") ? ALLEGRO_PIXEL_FORMAT_RGBA_4444 - : streq(v, "ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1") ? ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1 - : streq(v, "ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3") ? ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3 - : streq(v, "ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5") ? ALLEGRO_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5 + int format = streq(v, "A5O_PIXEL_FORMAT_ANY") ? A5O_PIXEL_FORMAT_ANY + : streq(v, "A5O_PIXEL_FORMAT_ANY_NO_ALPHA") ? A5O_PIXEL_FORMAT_ANY_NO_ALPHA + : streq(v, "A5O_PIXEL_FORMAT_ANY_WITH_ALPHA") ? A5O_PIXEL_FORMAT_ANY_WITH_ALPHA + : streq(v, "A5O_PIXEL_FORMAT_ANY_15_NO_ALPHA") ? A5O_PIXEL_FORMAT_ANY_15_NO_ALPHA + : streq(v, "A5O_PIXEL_FORMAT_ANY_16_NO_ALPHA") ? A5O_PIXEL_FORMAT_ANY_16_NO_ALPHA + : streq(v, "A5O_PIXEL_FORMAT_ANY_16_WITH_ALPHA") ? A5O_PIXEL_FORMAT_ANY_16_WITH_ALPHA + : streq(v, "A5O_PIXEL_FORMAT_ANY_24_NO_ALPHA") ? A5O_PIXEL_FORMAT_ANY_24_NO_ALPHA + : streq(v, "A5O_PIXEL_FORMAT_ANY_32_NO_ALPHA") ? A5O_PIXEL_FORMAT_ANY_32_NO_ALPHA + : streq(v, "A5O_PIXEL_FORMAT_ANY_32_WITH_ALPHA") ? A5O_PIXEL_FORMAT_ANY_32_WITH_ALPHA + : streq(v, "A5O_PIXEL_FORMAT_ARGB_8888") ? A5O_PIXEL_FORMAT_ARGB_8888 + : streq(v, "A5O_PIXEL_FORMAT_RGBA_8888") ? A5O_PIXEL_FORMAT_RGBA_8888 + : streq(v, "A5O_PIXEL_FORMAT_ARGB_4444") ? A5O_PIXEL_FORMAT_ARGB_4444 + : streq(v, "A5O_PIXEL_FORMAT_RGB_888") ? A5O_PIXEL_FORMAT_RGB_888 + : streq(v, "A5O_PIXEL_FORMAT_RGB_565") ? A5O_PIXEL_FORMAT_RGB_565 + : streq(v, "A5O_PIXEL_FORMAT_RGB_555") ? A5O_PIXEL_FORMAT_RGB_555 + : streq(v, "A5O_PIXEL_FORMAT_RGBA_5551") ? A5O_PIXEL_FORMAT_RGBA_5551 + : streq(v, "A5O_PIXEL_FORMAT_ARGB_1555") ? A5O_PIXEL_FORMAT_ARGB_1555 + : streq(v, "A5O_PIXEL_FORMAT_ABGR_8888") ? A5O_PIXEL_FORMAT_ABGR_8888 + : streq(v, "A5O_PIXEL_FORMAT_XBGR_8888") ? A5O_PIXEL_FORMAT_XBGR_8888 + : streq(v, "A5O_PIXEL_FORMAT_BGR_888") ? A5O_PIXEL_FORMAT_BGR_888 + : streq(v, "A5O_PIXEL_FORMAT_BGR_565") ? A5O_PIXEL_FORMAT_BGR_565 + : streq(v, "A5O_PIXEL_FORMAT_BGR_555") ? A5O_PIXEL_FORMAT_BGR_555 + : streq(v, "A5O_PIXEL_FORMAT_RGBX_8888") ? A5O_PIXEL_FORMAT_RGBX_8888 + : streq(v, "A5O_PIXEL_FORMAT_XRGB_8888") ? A5O_PIXEL_FORMAT_XRGB_8888 + : streq(v, "A5O_PIXEL_FORMAT_ABGR_F32") ? A5O_PIXEL_FORMAT_ABGR_F32 + : streq(v, "A5O_PIXEL_FORMAT_ABGR_8888_LE") ? A5O_PIXEL_FORMAT_ABGR_8888_LE + : streq(v, "A5O_PIXEL_FORMAT_RGBA_4444") ? A5O_PIXEL_FORMAT_RGBA_4444 + : streq(v, "A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1") ? A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT1 + : streq(v, "A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3") ? A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT3 + : streq(v, "A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5") ? A5O_PIXEL_FORMAT_COMPRESSED_RGBA_DXT5 : -1; if (format == -1) fatal_error("invalid format: %s", v); @@ -401,16 +401,16 @@ static int get_pixel_format(char const *v) static int get_lock_bitmap_flags(char const *v) { - return streq(v, "ALLEGRO_LOCK_READWRITE") ? ALLEGRO_LOCK_READWRITE - : streq(v, "ALLEGRO_LOCK_READONLY") ? ALLEGRO_LOCK_READONLY - : streq(v, "ALLEGRO_LOCK_WRITEONLY") ? ALLEGRO_LOCK_WRITEONLY + return streq(v, "A5O_LOCK_READWRITE") ? A5O_LOCK_READWRITE + : streq(v, "A5O_LOCK_READONLY") ? A5O_LOCK_READONLY + : streq(v, "A5O_LOCK_WRITEONLY") ? A5O_LOCK_WRITEONLY : atoi(v); } static int get_bitmap_flags(char const *v) { - return streq(v, "ALLEGRO_MEMORY_BITMAP") ? ALLEGRO_MEMORY_BITMAP - : streq(v, "ALLEGRO_VIDEO_BITMAP") ? ALLEGRO_VIDEO_BITMAP + return streq(v, "A5O_MEMORY_BITMAP") ? A5O_MEMORY_BITMAP + : streq(v, "A5O_VIDEO_BITMAP") ? A5O_VIDEO_BITMAP : atoi(v); } @@ -418,7 +418,7 @@ static void fill_lock_region(LockRegion *lr, float alphafactor, bool blended) { int x, y; float r, g, b, a; - ALLEGRO_COLOR c; + A5O_COLOR c; for (y = 0; y < lr->h; y++) { for (x = 0; x < lr->w; x++) { @@ -441,25 +441,25 @@ static void fill_lock_region(LockRegion *lr, float alphafactor, bool blended) static int get_load_font_flags(char const *v) { - return streq(v, "ALLEGRO_NO_PREMULTIPLIED_ALPHA") ? ALLEGRO_NO_PREMULTIPLIED_ALPHA - : streq(v, "ALLEGRO_TTF_NO_KERNING") ? ALLEGRO_TTF_NO_KERNING - : streq(v, "ALLEGRO_TTF_MONOCHROME") ? ALLEGRO_TTF_MONOCHROME + return streq(v, "A5O_NO_PREMULTIPLIED_ALPHA") ? A5O_NO_PREMULTIPLIED_ALPHA + : streq(v, "A5O_TTF_NO_KERNING") ? A5O_TTF_NO_KERNING + : streq(v, "A5O_TTF_MONOCHROME") ? A5O_TTF_MONOCHROME : atoi(v); } -static void load_fonts(ALLEGRO_CONFIG const *cfg, const char *section) +static void load_fonts(A5O_CONFIG const *cfg, const char *section) { #define MAXBUF 80 int i = 0; - ALLEGRO_CONFIG_ENTRY *iter; + A5O_CONFIG_ENTRY *iter; char const *key; char arg[14][MAXBUF]; key = al_get_first_config_entry(cfg, section, &iter); while (key && i < MAX_FONTS) { char const *stmt = al_get_config_value(cfg, section, key); - ALLEGRO_FONT *font = NULL; + A5O_FONT *font = NULL; bool load_stmt = false; if (SCAN("al_load_font", 3)) { @@ -498,7 +498,7 @@ static void load_fonts(ALLEGRO_CONFIG const *cfg, const char *section) #undef MAXBUF } -static ALLEGRO_FONT *get_font(char const *name) +static A5O_FONT *get_font(char const *name) { int i; @@ -516,20 +516,20 @@ static ALLEGRO_FONT *get_font(char const *name) static int get_font_align(char const *value) { - return streq(value, "ALLEGRO_ALIGN_LEFT") ? ALLEGRO_ALIGN_LEFT - : streq(value, "ALLEGRO_ALIGN_CENTRE") ? ALLEGRO_ALIGN_CENTRE - : streq(value, "ALLEGRO_ALIGN_RIGHT") ? ALLEGRO_ALIGN_RIGHT - : streq(value, "ALLEGRO_ALIGN_INTEGER") ? ALLEGRO_ALIGN_INTEGER - : streq(value, "ALLEGRO_ALIGN_LEFT|ALLEGRO_ALIGN_INTEGER") - ? ALLEGRO_ALIGN_LEFT | ALLEGRO_ALIGN_INTEGER - : streq(value, "ALLEGRO_ALIGN_RIGHT|ALLEGRO_ALIGN_INTEGER") - ? ALLEGRO_ALIGN_RIGHT | ALLEGRO_ALIGN_INTEGER - : streq(value, "ALLEGRO_ALIGN_CENTRE|ALLEGRO_ALIGN_INTEGER") - ? ALLEGRO_ALIGN_CENTRE | ALLEGRO_ALIGN_INTEGER + return streq(value, "A5O_ALIGN_LEFT") ? A5O_ALIGN_LEFT + : streq(value, "A5O_ALIGN_CENTRE") ? A5O_ALIGN_CENTRE + : streq(value, "A5O_ALIGN_RIGHT") ? A5O_ALIGN_RIGHT + : streq(value, "A5O_ALIGN_INTEGER") ? A5O_ALIGN_INTEGER + : streq(value, "A5O_ALIGN_LEFT|A5O_ALIGN_INTEGER") + ? A5O_ALIGN_LEFT | A5O_ALIGN_INTEGER + : streq(value, "A5O_ALIGN_RIGHT|A5O_ALIGN_INTEGER") + ? A5O_ALIGN_RIGHT | A5O_ALIGN_INTEGER + : streq(value, "A5O_ALIGN_CENTRE|A5O_ALIGN_INTEGER") + ? A5O_ALIGN_CENTRE | A5O_ALIGN_INTEGER : atoi(value); } -static void set_config_int(ALLEGRO_CONFIG *cfg, char const *section, +static void set_config_int(A5O_CONFIG *cfg, char const *section, char const *var, int value) { char buf[40]; @@ -537,7 +537,7 @@ static void set_config_int(ALLEGRO_CONFIG *cfg, char const *section, al_set_config_value(cfg, section, var, buf); } -static void set_config_float(ALLEGRO_CONFIG *cfg, char const *section, +static void set_config_float(A5O_CONFIG *cfg, char const *section, char const *var, float value) { char buf[40]; @@ -545,7 +545,7 @@ static void set_config_float(ALLEGRO_CONFIG *cfg, char const *section, al_set_config_value(cfg, section, var, buf); } -static void fill_vertices(ALLEGRO_CONFIG const *cfg, char const *name) +static void fill_vertices(A5O_CONFIG const *cfg, char const *name) { #define MAXBUF 80 @@ -577,7 +577,7 @@ static void fill_vertices(ALLEGRO_CONFIG const *cfg, char const *name) #undef MAXBUF } -static void fill_simple_vertices(ALLEGRO_CONFIG const *cfg, char const *name) +static void fill_simple_vertices(A5O_CONFIG const *cfg, char const *name) { #define MAXBUF 80 @@ -605,7 +605,7 @@ static void fill_simple_vertices(ALLEGRO_CONFIG const *cfg, char const *name) #undef MAXBUF } -static void fill_vertex_counts(ALLEGRO_CONFIG const *cfg, char const *name) +static void fill_vertex_counts(A5O_CONFIG const *cfg, char const *name) { #define MAXBUF 80 @@ -632,32 +632,32 @@ static void fill_vertex_counts(ALLEGRO_CONFIG const *cfg, char const *name) static int get_prim_type(char const *value) { - return streq(value, "ALLEGRO_PRIM_POINT_LIST") ? ALLEGRO_PRIM_POINT_LIST - : streq(value, "ALLEGRO_PRIM_LINE_LIST") ? ALLEGRO_PRIM_LINE_LIST - : streq(value, "ALLEGRO_PRIM_LINE_STRIP") ? ALLEGRO_PRIM_LINE_STRIP - : streq(value, "ALLEGRO_PRIM_LINE_LOOP") ? ALLEGRO_PRIM_LINE_LOOP - : streq(value, "ALLEGRO_PRIM_TRIANGLE_LIST") ? ALLEGRO_PRIM_TRIANGLE_LIST - : streq(value, "ALLEGRO_PRIM_TRIANGLE_STRIP") ? ALLEGRO_PRIM_TRIANGLE_STRIP - : streq(value, "ALLEGRO_PRIM_TRIANGLE_FAN") ? ALLEGRO_PRIM_TRIANGLE_FAN + return streq(value, "A5O_PRIM_POINT_LIST") ? A5O_PRIM_POINT_LIST + : streq(value, "A5O_PRIM_LINE_LIST") ? A5O_PRIM_LINE_LIST + : streq(value, "A5O_PRIM_LINE_STRIP") ? A5O_PRIM_LINE_STRIP + : streq(value, "A5O_PRIM_LINE_LOOP") ? A5O_PRIM_LINE_LOOP + : streq(value, "A5O_PRIM_TRIANGLE_LIST") ? A5O_PRIM_TRIANGLE_LIST + : streq(value, "A5O_PRIM_TRIANGLE_STRIP") ? A5O_PRIM_TRIANGLE_STRIP + : streq(value, "A5O_PRIM_TRIANGLE_FAN") ? A5O_PRIM_TRIANGLE_FAN : atoi(value); } static int get_line_join(char const *value) { - return streq(value, "ALLEGRO_LINE_JOIN_NONE") ? ALLEGRO_LINE_JOIN_NONE - : streq(value, "ALLEGRO_LINE_JOIN_BEVEL") ? ALLEGRO_LINE_JOIN_BEVEL - : streq(value, "ALLEGRO_LINE_JOIN_ROUND") ? ALLEGRO_LINE_JOIN_ROUND - : streq(value, "ALLEGRO_LINE_JOIN_MITER") ? ALLEGRO_LINE_JOIN_MITER + return streq(value, "A5O_LINE_JOIN_NONE") ? A5O_LINE_JOIN_NONE + : streq(value, "A5O_LINE_JOIN_BEVEL") ? A5O_LINE_JOIN_BEVEL + : streq(value, "A5O_LINE_JOIN_ROUND") ? A5O_LINE_JOIN_ROUND + : streq(value, "A5O_LINE_JOIN_MITER") ? A5O_LINE_JOIN_MITER : atoi(value); } static int get_line_cap(char const *value) { - return streq(value, "ALLEGRO_LINE_CAP_NONE") ? ALLEGRO_LINE_CAP_NONE - : streq(value, "ALLEGRO_LINE_CAP_SQUARE") ? ALLEGRO_LINE_CAP_SQUARE - : streq(value, "ALLEGRO_LINE_CAP_ROUND") ? ALLEGRO_LINE_CAP_ROUND - : streq(value, "ALLEGRO_LINE_CAP_TRIANGLE") ? ALLEGRO_LINE_CAP_TRIANGLE - : streq(value, "ALLEGRO_LINE_CAP_CLOSED") ? ALLEGRO_LINE_CAP_CLOSED + return streq(value, "A5O_LINE_CAP_NONE") ? A5O_LINE_CAP_NONE + : streq(value, "A5O_LINE_CAP_SQUARE") ? A5O_LINE_CAP_SQUARE + : streq(value, "A5O_LINE_CAP_ROUND") ? A5O_LINE_CAP_ROUND + : streq(value, "A5O_LINE_CAP_TRIANGLE") ? A5O_LINE_CAP_TRIANGLE + : streq(value, "A5O_LINE_CAP_CLOSED") ? A5O_LINE_CAP_CLOSED : atoi(value); } @@ -667,9 +667,9 @@ static int get_line_cap(char const *value) #define FNV_OFFSET_BASIS 2166136261UL #define FNV_PRIME 16777619 -static uint32_t hash_bitmap(ALLEGRO_BITMAP *bmp) +static uint32_t hash_bitmap(A5O_BITMAP *bmp) { - ALLEGRO_LOCKED_REGION *lr; + A5O_LOCKED_REGION *lr; int x, y, w, h; uint32_t hash; @@ -677,8 +677,8 @@ static uint32_t hash_bitmap(ALLEGRO_BITMAP *bmp) h = al_get_bitmap_height(bmp); hash = FNV_OFFSET_BASIS; - lr = al_lock_bitmap(bmp, ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE, - ALLEGRO_LOCK_READONLY); + lr = al_lock_bitmap(bmp, A5O_PIXEL_FORMAT_ABGR_8888_LE, + A5O_LOCK_READONLY); for (y = 0; y < h; y++) { /* Oops, I unintentially committed the first version of this with signed @@ -710,14 +710,14 @@ static uint32_t hash_bitmap(ALLEGRO_BITMAP *bmp) #define SIG_LEN (SIG_GRID * SIG_GRID) #define SIG_LENZ (SIG_LEN + 1) -static int patch_intensity(ALLEGRO_BITMAP *bmp, int cx, int cy) +static int patch_intensity(A5O_BITMAP *bmp, int cx, int cy) { float sum = 0.0; int x, y; for (y = -3; y <= 3; y++) { for (x = -3; x <= 3; x++) { - ALLEGRO_COLOR c = al_get_pixel(bmp, cx + x, cy + y); + A5O_COLOR c = al_get_pixel(bmp, cx + x, cy + y); sum += c.r + c.g + c.b; } } @@ -739,14 +739,14 @@ static int base64_decode(char c) return -1; } -static void compute_signature(ALLEGRO_BITMAP *bmp, char sig[SIG_LENZ]) +static void compute_signature(A5O_BITMAP *bmp, char sig[SIG_LENZ]) { int w = al_get_bitmap_width(bmp); int h = al_get_bitmap_height(bmp); int x, y; int n = 0; - al_lock_bitmap(bmp, ALLEGRO_PIXEL_FORMAT_ANY, ALLEGRO_LOCK_READONLY); + al_lock_bitmap(bmp, A5O_PIXEL_FORMAT_ANY, A5O_LOCK_READONLY); for (y = 0; y < SIG_GRID; y++) { for (x = 0; x < SIG_GRID; x++) { @@ -785,8 +785,8 @@ static bool similar_signatures(char const sig1[SIG_LEN], char const sig2[SIG_LEN return ((float)correct / SIG_LEN) > 0.95; } -static bool check_hash(ALLEGRO_CONFIG const *cfg, char const *testname, - ALLEGRO_BITMAP *bmp, BmpType bmp_type) +static bool check_hash(A5O_CONFIG const *cfg, char const *testname, + A5O_BITMAP *bmp, BmpType bmp_type) { char const *bt = bmp_type_to_string(bmp_type); char hash[16]; @@ -840,17 +840,17 @@ static bool check_hash(ALLEGRO_CONFIG const *cfg, char const *testname, return false; } -static double bitmap_dissimilarity(ALLEGRO_BITMAP *bmp1, ALLEGRO_BITMAP *bmp2) +static double bitmap_dissimilarity(A5O_BITMAP *bmp1, A5O_BITMAP *bmp2) { - ALLEGRO_LOCKED_REGION *lr1; - ALLEGRO_LOCKED_REGION *lr2; + A5O_LOCKED_REGION *lr1; + A5O_LOCKED_REGION *lr2; int x, y, w, h; double sqerr = 0.0; - lr1 = al_lock_bitmap(bmp1, ALLEGRO_PIXEL_FORMAT_RGBA_8888, - ALLEGRO_LOCK_READONLY); - lr2 = al_lock_bitmap(bmp2, ALLEGRO_PIXEL_FORMAT_RGBA_8888, - ALLEGRO_LOCK_READONLY); + lr1 = al_lock_bitmap(bmp1, A5O_PIXEL_FORMAT_RGBA_8888, + A5O_LOCK_READONLY); + lr2 = al_lock_bitmap(bmp2, A5O_PIXEL_FORMAT_RGBA_8888, + A5O_LOCK_READONLY); w = al_get_bitmap_width(bmp1); h = al_get_bitmap_height(bmp1); @@ -871,9 +871,9 @@ static double bitmap_dissimilarity(ALLEGRO_BITMAP *bmp1, ALLEGRO_BITMAP *bmp2) return sqrt(sqerr / (w*h*4.0)); } -static bool check_similarity(ALLEGRO_CONFIG const *cfg, +static bool check_similarity(A5O_CONFIG const *cfg, char const *testname, - ALLEGRO_BITMAP *bmp1, ALLEGRO_BITMAP *bmp2, BmpType bmp_type, bool reliable) + A5O_BITMAP *bmp1, A5O_BITMAP *bmp2, BmpType bmp_type, bool reliable) { char const *bt = bmp_type_to_string(bmp_type); double rms = bitmap_dissimilarity(bmp1, bmp2); @@ -941,8 +941,8 @@ static bool check_similarity(ALLEGRO_CONFIG const *cfg, } } -static bool do_test(ALLEGRO_CONFIG *cfg, char const *testname, - ALLEGRO_BITMAP *target, int bmp_type, bool reliable, bool do_check_hash) +static bool do_test(A5O_CONFIG *cfg, char const *testname, + A5O_BITMAP *target, int bmp_type, bool reliable, bool do_check_hash) { #define MAXBUF 80 @@ -1039,7 +1039,7 @@ static bool do_test(ALLEGRO_CONFIG *cfg, char const *testname, } if (SCANLVAL("al_clone_bitmap", 1)) { - ALLEGRO_BITMAP **bmp = reserve_local_bitmap(lval, bmp_type); + A5O_BITMAP **bmp = reserve_local_bitmap(lval, bmp_type); (*bmp) = al_clone_bitmap(B(0)); continue; } @@ -1135,24 +1135,24 @@ static bool do_test(ALLEGRO_CONFIG *cfg, char const *testname, } if (SCANLVAL("al_create_bitmap", 2)) { - ALLEGRO_BITMAP **bmp = reserve_local_bitmap(lval, bmp_type); + A5O_BITMAP **bmp = reserve_local_bitmap(lval, bmp_type); (*bmp) = al_create_bitmap(I(0), I(1)); continue; } if (SCANLVAL("al_create_sub_bitmap", 5)) { - ALLEGRO_BITMAP **bmp = reserve_local_bitmap(lval, bmp_type); + A5O_BITMAP **bmp = reserve_local_bitmap(lval, bmp_type); (*bmp) = al_create_sub_bitmap(B(0), I(1), I(2), I(3), I(4)); continue; } if (SCANLVAL("al_load_bitmap", 1)) { - ALLEGRO_BITMAP **bmp = reserve_local_bitmap(lval, bmp_type); + A5O_BITMAP **bmp = reserve_local_bitmap(lval, bmp_type); (*bmp) = load_relative_bitmap(V(0), 0); continue; } if (SCANLVAL("al_load_bitmap_flags", 2)) { - ALLEGRO_BITMAP **bmp = reserve_local_bitmap(lval, bmp_type); + A5O_BITMAP **bmp = reserve_local_bitmap(lval, bmp_type); (*bmp) = load_relative_bitmap(V(0), get_load_bitmap_flag(V(1))); continue; } @@ -1207,14 +1207,14 @@ static bool do_test(ALLEGRO_CONFIG *cfg, char const *testname, /* Conversion */ if (SCAN("al_convert_bitmap", 1)) { - ALLEGRO_BITMAP *bmp = B(0); + A5O_BITMAP *bmp = B(0); al_convert_bitmap(bmp); continue; } /* Locking */ if (SCAN("al_lock_bitmap", 3)) { - ALLEGRO_BITMAP *bmp = B(0); + A5O_BITMAP *bmp = B(0); lock_region.x = 0; lock_region.y = 0; lock_region.w = al_get_bitmap_width(bmp); @@ -1225,7 +1225,7 @@ static bool do_test(ALLEGRO_CONFIG *cfg, char const *testname, continue; } if (SCAN("al_lock_bitmap_region", 7)) { - ALLEGRO_BITMAP *bmp = B(0); + A5O_BITMAP *bmp = B(0); lock_region.x = I(1); lock_region.y = I(2); lock_region.w = I(3); @@ -1513,7 +1513,7 @@ static bool do_test(ALLEGRO_CONFIG *cfg, char const *testname, continue; } if (SCANLVAL("al_color_lab", 3)) { - ALLEGRO_COLOR rgb = al_color_lab(F(0), F(1), F(2)); + A5O_COLOR rgb = al_color_lab(F(0), F(1), F(2)); char hex[100]; sprintf(hex, "%f/%f/%f", rgb.r, rgb.g, rgb.b); al_set_config_value(cfg, testname, lval, hex); @@ -1523,7 +1523,7 @@ static bool do_test(ALLEGRO_CONFIG *cfg, char const *testname, fatal_error("statement didn't scan: %s", stmt); } - al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ANY_WITH_ALPHA); + al_set_new_bitmap_format(A5O_PIXEL_FORMAT_ANY_WITH_ALPHA); bool good; if (do_check_hash) { @@ -1536,7 +1536,7 @@ static bool do_test(ALLEGRO_CONFIG *cfg, char const *testname, total_tests++; if (save_outputs && (!save_on_failure || !good)) { - ALLEGRO_USTR *filename = al_ustr_newf("%s [%s].png", testname, + A5O_USTR *filename = al_ustr_newf("%s [%s].png", testname, bmp_type_to_string(bmp_type)); al_save_bitmap(al_cstr(filename), target); al_ustr_free(filename); @@ -1575,7 +1575,7 @@ static bool do_test(ALLEGRO_CONFIG *cfg, char const *testname, #undef MAXBUF } -static void sw_hw_test(ALLEGRO_CONFIG *cfg, char const *testname) +static void sw_hw_test(A5O_CONFIG *cfg, char const *testname) { bool reliable = true; char const *hw_only_str = al_get_config_value(cfg, testname, "hw_only"); @@ -1590,7 +1590,7 @@ static void sw_hw_test(ALLEGRO_CONFIG *cfg, char const *testname) return; } - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); if (!hw_only) { reliable = do_test(cfg, testname, membuf, SW, true, true); } @@ -1598,7 +1598,7 @@ static void sw_hw_test(ALLEGRO_CONFIG *cfg, char const *testname) if (sw_only) return; if (display) { - al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP); + al_set_new_bitmap_flags(A5O_VIDEO_BITMAP); do_test(cfg, testname, al_get_backbuffer(display), HW, reliable, hw_only); } else if (hw_only) { printf("WARNING: Skipping hardware-only test due to the --no-display flag: %s\n", @@ -1607,20 +1607,20 @@ static void sw_hw_test(ALLEGRO_CONFIG *cfg, char const *testname) } } -static bool section_exists(ALLEGRO_CONFIG const *cfg, char const *section) +static bool section_exists(A5O_CONFIG const *cfg, char const *section) { - ALLEGRO_CONFIG_ENTRY *iter; + A5O_CONFIG_ENTRY *iter; return al_get_first_config_entry(cfg, section, &iter) != NULL; } static void merge_config_sections( - ALLEGRO_CONFIG *targ_cfg, char const *targ_section, - ALLEGRO_CONFIG const *src_cfg, char const *src_section) + A5O_CONFIG *targ_cfg, char const *targ_section, + A5O_CONFIG const *src_cfg, char const *src_section) { char const *key; char const *value; - ALLEGRO_CONFIG_ENTRY *iter; + A5O_CONFIG_ENTRY *iter; value = al_get_config_value(src_cfg, src_section, "extend"); if (value) { @@ -1641,10 +1641,10 @@ static void merge_config_sections( } } -static void run_test(ALLEGRO_CONFIG const *cfg, char const *section) +static void run_test(A5O_CONFIG const *cfg, char const *section) { char const *extend; - ALLEGRO_CONFIG *cfg2; + A5O_CONFIG *cfg2; if (!section_exists(cfg, section)) { fatal_error("section not found: %s", section); @@ -1660,9 +1660,9 @@ static void run_test(ALLEGRO_CONFIG const *cfg, char const *section) al_destroy_config(cfg2); } -static void run_matching_tests(ALLEGRO_CONFIG const *cfg, const char *prefix) +static void run_matching_tests(A5O_CONFIG const *cfg, const char *prefix) { - ALLEGRO_CONFIG_SECTION *iter; + A5O_CONFIG_SECTION *iter; char const *section; for (section = al_get_first_config_section(cfg, &iter); @@ -1674,9 +1674,9 @@ static void run_matching_tests(ALLEGRO_CONFIG const *cfg, const char *prefix) } } -static void partial_tests(ALLEGRO_CONFIG const *cfg, int n) +static void partial_tests(A5O_CONFIG const *cfg, int n) { - ALLEGRO_USTR *name = al_ustr_new(""); + A5O_USTR *name = al_ustr_new(""); while (n > 0) { /* Automatically prepend "test" for convenience. */ @@ -1713,7 +1713,7 @@ static bool has_suffix(char const *s, char const *suf) static void process_ini_files(void) { - ALLEGRO_CONFIG *cfg; + A5O_CONFIG *cfg; int n; while (argc > 0) { @@ -1729,12 +1729,12 @@ static void process_ini_files(void) argc--; argv++; - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); - load_bitmaps(cfg, "bitmaps", SW, ALLEGRO_NO_PREMULTIPLIED_ALPHA); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); + load_bitmaps(cfg, "bitmaps", SW, A5O_NO_PREMULTIPLIED_ALPHA); if (display) { - al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP); - load_bitmaps(cfg, "bitmaps", HW, ALLEGRO_NO_PREMULTIPLIED_ALPHA); + al_set_new_bitmap_flags(A5O_VIDEO_BITMAP); + load_bitmaps(cfg, "bitmaps", HW, A5O_NO_PREMULTIPLIED_ALPHA); } load_fonts(cfg, "fonts"); @@ -1824,24 +1824,24 @@ int main(int _argc, char *_argv[]) verbose++; } else if (streq(opt, "--force-opengl-1.2")) { - ALLEGRO_CONFIG *cfg = al_get_system_config(); + A5O_CONFIG *cfg = al_get_system_config(); al_set_config_value(cfg, "opengl", "force_opengl_version", "1.2"); - display_flags |= ALLEGRO_OPENGL; + display_flags |= A5O_OPENGL; } else if (streq(opt, "--force-opengl-2.0")) { - ALLEGRO_CONFIG *cfg = al_get_system_config(); + A5O_CONFIG *cfg = al_get_system_config(); al_set_config_value(cfg, "opengl", "force_opengl_version", "2.0"); - display_flags |= ALLEGRO_OPENGL; + display_flags |= A5O_OPENGL; } else if (streq(opt, "--force-opengl")) { - display_flags |= ALLEGRO_OPENGL; + display_flags |= A5O_OPENGL; } else if (streq(opt, "--force-d3d")) { /* Don't try this at home. */ - display_flags |= ALLEGRO_DIRECT3D_INTERNAL; + display_flags |= A5O_DIRECT3D_INTERNAL; } else if (streq(opt, "--use-shaders")) { - display_flags |= ALLEGRO_PROGRAMMABLE_PIPELINE; + display_flags |= A5O_PROGRAMMABLE_PIPELINE; } else if (streq(opt, "-h") || streq(opt, "--help")) { printf("Usage:\n%s%s", _argv[0], help_str); @@ -1860,7 +1860,7 @@ int main(int _argc, char *_argv[]) } } - al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP); + al_set_new_bitmap_flags(A5O_MEMORY_BITMAP); if (want_display) { membuf = al_create_bitmap( diff --git a/tests/test_driver.txt b/tests/test_driver.txt index 1bd3748971..9577034744 100644 --- a/tests/test_driver.txt +++ b/tests/test_driver.txt @@ -64,11 +64,11 @@ The [bitmaps] section defines a list of bitmaps to load, relative to the tests directory. Each key name is then a valid bitmap literal. The name 'target' refers to the default target bitmap. -ALLEGRO_COLOR literals may be written as #rrggbb, #rrggbbaa or a named +A5O_COLOR literals may be written as #rrggbb, #rrggbbaa or a named color (e.g. purple). Integer, float and enumeration literals are written as per C. -(Note that "ALLEGRO_FLIP_HORIZONTAL|ALLEGRO_FLIP_VERTICAL" must be written +(Note that "A5O_FLIP_HORIZONTAL|A5O_FLIP_VERTICAL" must be written without whitespace, because we don't have a proper parser.) String literals are not supported, but you can use a variable whose value diff --git a/tests/test_fonts.ini b/tests/test_fonts.ini index caab8f8670..11b7f8988a 100644 --- a/tests/test_fonts.ini +++ b/tests/test_fonts.ini @@ -12,7 +12,7 @@ ttf_px3=al_load_ttf_font_stretch(ttf_filename, -24, -32, flags) bmp_filename=../examples/data/a4_font.tga ascii_filename=../examples/data/fixed_font.tga ttf_filename=../examples/data/DejaVuSans.ttf -flags=ALLEGRO_NO_PREMULTIPLIED_ALPHA +flags=A5O_NO_PREMULTIPLIED_ALPHA [text] en=Welcome to Allegro @@ -23,11 +23,11 @@ missing=here -> รก <- is unicode #00E1 [test font bmp] extend=text op0=al_clear_to_color(rosybrown) -op1=al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) +op1=al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) op2= -op3=al_draw_text(font, darkred, 320, 100, ALLEGRO_ALIGN_LEFT, en) -op4=al_draw_text(font, white, 320, 150, ALLEGRO_ALIGN_CENTRE, en) -op5=al_draw_text(font, blue, 320, 200, ALLEGRO_ALIGN_RIGHT, en) +op3=al_draw_text(font, darkred, 320, 100, A5O_ALIGN_LEFT, en) +op4=al_draw_text(font, white, 320, 150, A5O_ALIGN_CENTRE, en) +op5=al_draw_text(font, blue, 320, 200, A5O_ALIGN_RIGHT, en) op6= font=bmpfont hash=68f73534 @@ -40,15 +40,15 @@ op6=al_hold_bitmap_drawing(false) [test font builtin] extend=text op0=al_clear_to_color(rosybrown) -op1=al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) -op2=al_draw_text(font, darkred, 320, 100, ALLEGRO_ALIGN_LEFT, en) -op3=al_draw_text(font, white, 320, 150, ALLEGRO_ALIGN_CENTRE, latin1) +op1=al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) +op2=al_draw_text(font, darkred, 320, 100, A5O_ALIGN_LEFT, en) +op3=al_draw_text(font, white, 320, 150, A5O_ALIGN_CENTRE, latin1) font=builtin hash=502aa12f [test font ttf] extend=test font bmp -op6=al_draw_text(font, khaki, 320, 300, ALLEGRO_ALIGN_CENTRE, gr) +op6=al_draw_text(font, khaki, 320, 300, A5O_ALIGN_CENTRE, gr) font=ttf # Result changes with the FreeType configuration of the system. hash=off @@ -81,7 +81,7 @@ font=ttf_px3 [test font bmp justify] extend=text op0=al_clear_to_color(#886655) -op1=al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) +op1=al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) op2=al_draw_justified_text(bmpfont, black, 100, 540, 100, 0, 0, en) op3=al_draw_justified_text(bmpfont, black, 100, 540, 150, 1000, 0, en) hash=6a402079 @@ -96,16 +96,16 @@ hash=off [test font complex] extend=text op0=al_clear_to_color(#665544) -op1=al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) +op1=al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) op2=al_build_transform(T, cx, cy, 2.0, 2.0, -0.3) op3=al_use_transform(T) -op4=al_draw_text(ttf, #aabbcc80, 0, 0, ALLEGRO_ALIGN_CENTRE, en) +op4=al_draw_text(ttf, #aabbcc80, 0, 0, A5O_ALIGN_CENTRE, en) op5=al_build_transform(T, cx, cy, 2.0, 2.0, 0.3) op6=al_use_transform(T) -op7=al_draw_text(ttf, #eebbaa80, 0, 0, ALLEGRO_ALIGN_CENTRE, gr) +op7=al_draw_text(ttf, #eebbaa80, 0, 0, A5O_ALIGN_CENTRE, gr) op8=al_build_transform(T2, cx, 360, 20, 20, 0) op9=al_use_transform(T2) -op10=al_draw_text(bmpfont, #88888855, 0, 0, ALLEGRO_ALIGN_CENTRE, yeah) +op10=al_draw_text(bmpfont, #88888855, 0, 0, A5O_ALIGN_CENTRE, yeah) cx=320 cy=200 yeah=yeah! @@ -114,14 +114,14 @@ hash=off [test font dimensions ttf en] op0= al_clear_to_color(#665544) -op1= al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) +op1= al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) op2= al_translate_transform(T, 100, 100) op3= al_use_transform(T) op4= al_get_text_dimensions(font, str, bbx, bby, bbw, bbh) # We can't actually draw it without introducing arithmetic. #op5=al_draw_rectangle(bbx, bby, bbx+bbw, bby+bbh, black, 0) op5= -op6= al_draw_text(font, #aabbcc80, 0, 0, ALLEGRO_ALIGN_LEFT, str) +op6= al_draw_text(font, #aabbcc80, 0, 0, A5O_ALIGN_LEFT, str) op7= op8= al_translate_transform(T, 0, 100) op9= al_use_transform(T) @@ -133,7 +133,7 @@ op13=de = al_get_font_descent(font) op14=al_draw_rectangle(0, 0, w, h, black, 0) op15=al_draw_line(0, as, w, as, black, 0) op16=al_draw_line(0, de, w, de, black, 0) -op17=al_draw_text(font, #aabbcc80, 0, 0, ALLEGRO_ALIGN_LEFT, str) +op17=al_draw_text(font, #aabbcc80, 0, 0, A5O_ALIGN_LEFT, str) font=ttf str=Welcome to Allegro hash=off @@ -155,10 +155,10 @@ op1=al_set_target_bitmap(image) op2=al_clear_to_color(white) op3=al_set_target_bitmap(target) op4=al_clear_to_color(#00000000) -op5=al_draw_text(bmpfont, red, 0, 0, ALLEGRO_ALIGN_LEFT, str) -op6=al_set_blender(ALLEGRO_DEST_MINUS_SRC, ALLEGRO_ALPHA, ALLEGRO_ONE) +op5=al_draw_text(bmpfont, red, 0, 0, A5O_ALIGN_LEFT, str) +op6=al_set_blender(A5O_DEST_MINUS_SRC, A5O_ALPHA, A5O_ONE) op7=al_draw_rectangle(45, 45, 75, 75, #ffffff40, 1) -op8=al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA) +op8=al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA) op9=al_draw_tinted_bitmap(image, #ffffffff, 50, 50, 0) str=Hello hash=249efe55 @@ -166,7 +166,7 @@ hash=249efe55 # Per glyph drawing [test font glyph simple builtin en] op0= al_clear_to_color(#665544) -op1= al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) +op1= al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) op2= x = int(100) op3= y = int(100) op4= @@ -202,13 +202,13 @@ sig=LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL # Per glyph drawing [test font glyph match builtin en] op0= al_clear_to_color(#665544) -op1= al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) +op1= al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) op2= x = int(100) op3= y = int(100) op4= # al_hold_bitmap_drawing(0) -op5= al_draw_text(font, blue, x, y, ALLEGRO_ALIGN_LEFT, str) -op6= al_draw_text(font, text_color, x, y, ALLEGRO_ALIGN_LEFT, str) +op5= al_draw_text(font, blue, x, y, A5O_ALIGN_LEFT, str) +op6= al_draw_text(font, text_color, x, y, A5O_ALIGN_LEFT, str) op7= glyph_Tu_k = al_get_glyph_advance(font, glyph_T, glyph_u) op8= glyph_ul_k = al_get_glyph_advance(font, glyph_u, glyph_l) op9= glyph_li_k = al_get_glyph_advance(font, glyph_l, glyph_i) @@ -272,7 +272,7 @@ sig=LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL [test font fallback] extend=text -op0=al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) +op0=al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) op1=al_clear_to_color(black) op2=al_draw_text(asciifont, yellow, 100, 100, 0, missing) op3=al_set_fallback_font(asciifont, builtin) diff --git a/tests/test_image.ini b/tests/test_image.ini index c81cee86f3..65b6d6b2d1 100644 --- a/tests/test_image.ini +++ b/tests/test_image.ini @@ -11,12 +11,12 @@ op0=temp = al_create_bitmap(640, 480) op1=al_set_target_bitmap(temp) op2=al_clear_to_color(brown) op3=b = al_load_bitmap_flags(filename, flags) -op4=al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA) +op4=al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA) op5=al_draw_bitmap(b, 0, 0, 0) op6=al_set_target_bitmap(target) -op7=al_set_separate_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ZERO, ALLEGRO_ONE) +op7=al_set_separate_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ZERO, A5O_ONE) op8=al_draw_bitmap(temp, 0, 0, 0) -flags=ALLEGRO_NO_PREMULTIPLIED_ALPHA +flags=A5O_NO_PREMULTIPLIED_ALPHA [test bmp] extend=template @@ -73,26 +73,26 @@ hash=48965052 [test bmp indexed] extend=template filename=../examples/data/alexlogo.bmp -flags=ALLEGRO_KEEP_INDEX +flags=A5O_KEEP_INDEX hash=1d899e47 [test bmp indexed uncompressed] extend=template filename=../examples/data/gradient1.bmp -flags=ALLEGRO_KEEP_INDEX +flags=A5O_KEEP_INDEX hash=b5ba9d35 [test pcx indexed] extend=template filename=../examples/data/allegro.pcx -flags=ALLEGRO_KEEP_INDEX +flags=A5O_KEEP_INDEX hash=681b712d hash_hw=6fb8e2d5 [test png indexed] extend=template filename=../examples/data/alexlogo.png -flags=ALLEGRO_KEEP_INDEX +flags=A5O_KEEP_INDEX hash=1d899e47 [test png palette] @@ -110,7 +110,7 @@ hash=9e6b5342 [save template] op0=al_save_bitmap(filename, allegro) -op1=b = al_load_bitmap_flags(filename, ALLEGRO_NO_PREMULTIPLIED_ALPHA) +op1=b = al_load_bitmap_flags(filename, A5O_NO_PREMULTIPLIED_ALPHA) op2=al_clear_to_color(brown) op3=al_draw_bitmap(b, 0, 0, 0) @@ -145,7 +145,7 @@ filename=tmp.webp hash=c44929e5 [identify] -op0=al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA) +op0=al_set_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA) op1=ext = al_identify_bitmap(filename) op2=al_draw_text(builtin, yellow, 0, 0, 0, ext) diff --git a/tests/test_locking.ini b/tests/test_locking.ini index 08e54a8007..fc09404957 100644 --- a/tests/test_locking.ini +++ b/tests/test_locking.ini @@ -18,111 +18,111 @@ op6= fill_lock_region(alphafactor, false) op7= al_unlock_bitmap(bmp) op8= op9= al_set_target_bitmap(target) -op10=al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) +op10=al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) op11=al_draw_bitmap(bmp, 0, 0, 0) -flags=ALLEGRO_LOCK_WRITEONLY +flags=A5O_LOCK_WRITEONLY alphafactor=1.0 [test texture 32b ARGB_8888] extend=texture -format=ALLEGRO_PIXEL_FORMAT_ARGB_8888 +format=A5O_PIXEL_FORMAT_ARGB_8888 hash=25e01c26 sig=FFFFFFFFFFFDDEGKMFFFEEGJOQFFFEGINTVFFFFHLQYZFFFFINUcdFFFGKPXhiFFFHLSbmmFFFFFFFFFF [test texture 32b RGBA_8888] extend=texture -format=ALLEGRO_PIXEL_FORMAT_RGBA_8888 +format=A5O_PIXEL_FORMAT_RGBA_8888 hash=25e01c26 sig=FFFFFFFFFFFDDEGKMFFFEEGJOQFFFEGINTVFFFFHLQYZFFFFINUcdFFFGKPXhiFFFHLSbmmFFFFFFFFFF [test texture 16b ARGB_4444] extend=texture -format=ALLEGRO_PIXEL_FORMAT_ARGB_4444 +format=A5O_PIXEL_FORMAT_ARGB_4444 hash=94ba90ac sig=FFFFFFFFFFFDDDEIKFFFEEFIMOFFFEEHKQSFFFFGKOWXFFFFHMRabFFFGIOVffFFFGJQXkjFFFFFFFFFF [test texture 24b RGB_888] extend=texture -format=ALLEGRO_PIXEL_FORMAT_RGB_888 +format=A5O_PIXEL_FORMAT_RGB_888 hash=5a844e39 sig=FFFFFFFFFFF59DHLMFFF9DIMQQFFFCHMRWVFFFGLRWcZFFFJPWcieFFFNUahniFFFRYfmtnFFFFFFFFFF [test texture 16b RGB_565] extend=texture -format=ALLEGRO_PIXEL_FORMAT_RGB_565 +format=A5O_PIXEL_FORMAT_RGB_565 hash=7ee470cd [test texture 15b RGB_555] extend=texture -format=ALLEGRO_PIXEL_FORMAT_RGB_555 +format=A5O_PIXEL_FORMAT_RGB_555 hash=d8bcc9c6 [test texture 16b RGBA_5551] extend=texture -format=ALLEGRO_PIXEL_FORMAT_RGBA_5551 +format=A5O_PIXEL_FORMAT_RGBA_5551 alphafactor=2.0 hash=752a4074 [test texture 16b ARGB_1555] extend=texture -format=ALLEGRO_PIXEL_FORMAT_ARGB_1555 +format=A5O_PIXEL_FORMAT_ARGB_1555 alphafactor=2.0 hash=752a4074 [test texture 32b ABGR_8888] extend=texture -format=ALLEGRO_PIXEL_FORMAT_ABGR_8888 +format=A5O_PIXEL_FORMAT_ABGR_8888 hash=25e01c26 sig=FFFFFFFFFFFDDEGKMFFFEEGJOQFFFEGINTVFFFFHLQYZFFFFINUcdFFFGKPXhiFFFHLSbmmFFFFFFFFFF [test texture 32b XBGR_8888] extend=texture -format=ALLEGRO_PIXEL_FORMAT_XBGR_8888 +format=A5O_PIXEL_FORMAT_XBGR_8888 hash=5a844e39 sig=FFFFFFFFFFF59DHLMFFF9DIMQQFFFCHMRWVFFFGLRWcZFFFJPWcieFFFNUahniFFFRYfmtnFFFFFFFFFF [test texture 24b BGR_888] extend=texture -format=ALLEGRO_PIXEL_FORMAT_BGR_888 +format=A5O_PIXEL_FORMAT_BGR_888 hash=5a844e39 sig=FFFFFFFFFFF59DHLMFFF9DIMQQFFFCHMRWVFFFGLRWcZFFFJPWcieFFFNUahniFFFRYfmtnFFFFFFFFFF [test texture 16b BGR_565] extend=texture -format=ALLEGRO_PIXEL_FORMAT_BGR_565 +format=A5O_PIXEL_FORMAT_BGR_565 hash=7ee470cd [test texture 15b BGR_555] extend=texture -format=ALLEGRO_PIXEL_FORMAT_BGR_555 +format=A5O_PIXEL_FORMAT_BGR_555 hash=d8bcc9c6 [test texture 32b RGBX_8888] extend=texture -format=ALLEGRO_PIXEL_FORMAT_RGBX_8888 +format=A5O_PIXEL_FORMAT_RGBX_8888 hash=5a844e39 sig=FFFFFFFFFFF59DHLMFFF9DIMQQFFFCHMRWVFFFGLRWcZFFFJPWcieFFFNUahniFFFRYfmtnFFFFFFFFFF [test texture 32b XRGB_8888] extend=texture -format=ALLEGRO_PIXEL_FORMAT_XRGB_8888 +format=A5O_PIXEL_FORMAT_XRGB_8888 hash=5a844e39 sig=FFFFFFFFFFF59DHLMFFF9DIMQQFFFCHMRWVFFFGLRWcZFFFJPWcieFFFNUahniFFFRYfmtnFFFFFFFFFF [test texture f32 ABGR_F32] extend=texture -format=ALLEGRO_PIXEL_FORMAT_ABGR_F32 +format=A5O_PIXEL_FORMAT_ABGR_F32 hash=25e01c26 sig=FFFFFFFFFFFDDEGKMFFFEEGJOQFFFEGINTVFFFFHLQYZFFFFINUcdFFFGKPXhiFFFHLSbmmFFFFFFFFFF [test texture 32b ABGR_8888_LE] extend=texture -format=ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE +format=A5O_PIXEL_FORMAT_ABGR_8888_LE hash=25e01c26 sig=FFFFFFFFFFFDDEGKMFFFEEGJOQFFFEGINTVFFFFHLQYZFFFFINUcdFFFGKPXhiFFFHLSbmmFFFFFFFFFF [test texture 16b RGBA_4444] extend=texture -format=ALLEGRO_PIXEL_FORMAT_RGBA_4444 +format=A5O_PIXEL_FORMAT_RGBA_4444 hash=94ba90ac sig=FFFFFFFFFFFDDDEIKFFFEEFIMOFFFEEHKQSFFFFGKOWXFFFFHMRabFFFGIOVffFFFGJQXkjFFFFFFFFFF diff --git a/tests/test_locking2.ini b/tests/test_locking2.ini index 4d61c6c236..edd5bd1c91 100644 --- a/tests/test_locking2.ini +++ b/tests/test_locking2.ini @@ -1,5 +1,5 @@ [texture rw] -op0= al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) +op0= al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) op1= op2= bmp = al_create_bitmap(640, 480) op3= al_set_target_bitmap(bmp) @@ -11,106 +11,106 @@ op8= op9= al_set_target_bitmap(target) op10=al_clear_to_color(#00ff00) # Don't assume the screen has an alpha channel, it may be 24 bit. -op11=al_set_separate_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ZERO, ALLEGRO_ONE) +op11=al_set_separate_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ZERO, A5O_ONE) op12=al_draw_bitmap(bmp, 0, 0, 0) -flags=ALLEGRO_LOCK_READWRITE +flags=A5O_LOCK_READWRITE alphafactor=1.0 [test texture rw 32b ARGB_8888] extend=texture rw -format=ALLEGRO_PIXEL_FORMAT_ARGB_8888 +format=A5O_PIXEL_FORMAT_ARGB_8888 hash=d4866407 sig=FFFFFFFFFFFEEFHKMFFFFFHKOQFFFFHJMSUFFFGILPWZFFFGJMSadFFFHKOUeiFFFHLQXimFFFFFFFFFF [test texture rw 32b RGBA_8888] extend=texture rw -format=ALLEGRO_PIXEL_FORMAT_RGBA_8888 +format=A5O_PIXEL_FORMAT_RGBA_8888 hash=d4866407 sig=FFFFFFFFFFFEEFHKMFFFFFHKOQFFFFHJMSUFFFGILPWZFFFGJMSadFFFHKOUeiFFFHLQXimFFFFFFFFFF [test texture rw 16b ARGB_4444] extend=texture rw -format=ALLEGRO_PIXEL_FORMAT_ARGB_4444 +format=A5O_PIXEL_FORMAT_ARGB_4444 hash=32b551c9 [test texture rw 24b RGB_888] extend=texture rw -format=ALLEGRO_PIXEL_FORMAT_RGB_888 +format=A5O_PIXEL_FORMAT_RGB_888 hash=dc5525e2 [test texture rw 16b RGB_565] extend=texture rw -format=ALLEGRO_PIXEL_FORMAT_RGB_565 +format=A5O_PIXEL_FORMAT_RGB_565 hash=a51f89f0 [test texture rw 15b RGB_555] extend=texture rw -format=ALLEGRO_PIXEL_FORMAT_RGB_555 +format=A5O_PIXEL_FORMAT_RGB_555 hash=200647c4 [test texture rw 16b RGBA_5551] extend=texture rw -format=ALLEGRO_PIXEL_FORMAT_RGBA_5551 +format=A5O_PIXEL_FORMAT_RGBA_5551 hash=c42fb611 # NOTE: the correct output for this is all green except for one pixel column # on the right. [test texture rw 16b ARGB_1555] extend=texture rw -format=ALLEGRO_PIXEL_FORMAT_ARGB_1555 +format=A5O_PIXEL_FORMAT_ARGB_1555 hash=c42fb611 # NOTE: the correct output for this is all green except for one pixel column # on the right. [test texture rw 32b ABGR_8888] extend=texture rw -format=ALLEGRO_PIXEL_FORMAT_ABGR_8888 +format=A5O_PIXEL_FORMAT_ABGR_8888 hash=d4866407 sig=FFFFFFFFFFFEEFHKMFFFFFHKOQFFFFHJMSUFFFGILPWZFFFGJMSadFFFHKOUeiFFFHLQXimFFFFFFFFFF [test texture rw 32b XBGR_8888] extend=texture rw -format=ALLEGRO_PIXEL_FORMAT_XBGR_8888 +format=A5O_PIXEL_FORMAT_XBGR_8888 hash=dc5525e2 [test texture rw 24b BGR_888] extend=texture rw -format=ALLEGRO_PIXEL_FORMAT_BGR_888 +format=A5O_PIXEL_FORMAT_BGR_888 hash=dc5525e2 [test texture rw 16b BGR_565] extend=texture rw -format=ALLEGRO_PIXEL_FORMAT_BGR_565 +format=A5O_PIXEL_FORMAT_BGR_565 hash=a51f89f0 [test texture rw 15b BGR_555] extend=texture rw -format=ALLEGRO_PIXEL_FORMAT_BGR_555 +format=A5O_PIXEL_FORMAT_BGR_555 hash=200647c4 [test texture rw 32b RGBX_8888] extend=texture rw -format=ALLEGRO_PIXEL_FORMAT_RGBX_8888 +format=A5O_PIXEL_FORMAT_RGBX_8888 hash=dc5525e2 [test texture rw 32b XRGB_8888] extend=texture rw -format=ALLEGRO_PIXEL_FORMAT_XRGB_8888 +format=A5O_PIXEL_FORMAT_XRGB_8888 hash=dc5525e2 [test texture rw f32 ABGR_F32] extend=texture rw -format=ALLEGRO_PIXEL_FORMAT_ABGR_F32 +format=A5O_PIXEL_FORMAT_ABGR_F32 hash=d4866407 sig=FFFFFFFFFFFEEFHKMFFFFFHKOQFFFFHJMSUFFFGILPWZFFFGJMSadFFFHKOUeiFFFHLQXimFFFFFFFFFF [test texture rw 32b ABGR_8888_LE] extend=texture rw -format=ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE +format=A5O_PIXEL_FORMAT_ABGR_8888_LE hash=d4866407 sig=FFFFFFFFFFFEEFHKMFFFFFHKOQFFFFHJMSUFFFGILPWZFFFGJMSadFFFHKOUeiFFFHLQXimFFFFFFFFFF [test texture rw 16b RGBA_4444] extend=texture rw -format=ALLEGRO_PIXEL_FORMAT_RGBA_4444 +format=A5O_PIXEL_FORMAT_RGBA_4444 hash=32b551c9 diff --git a/tests/test_prim.ini b/tests/test_prim.ini index 07298748b5..1a6e88c366 100644 --- a/tests/test_prim.ini +++ b/tests/test_prim.ini @@ -8,11 +8,11 @@ obp=../examples/data/obp.jpg op0= al_draw_bitmap(bkg, 0, 0, 0) op1= al_build_transform(trans, 320, 240, 1, 1, 1.0) op2= -op3= al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE) +op3= al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE) op4= al_use_transform(trans) -op5= al_draw_prim(verts, 0, tex, 0, 4, ALLEGRO_PRIM_LINE_LIST) -op6= al_draw_prim(verts, 0, tex, 4, 9, ALLEGRO_PRIM_LINE_STRIP) -op7= al_draw_prim(verts, 0, tex, 9, 13, ALLEGRO_PRIM_LINE_LOOP) +op5= al_draw_prim(verts, 0, tex, 0, 4, A5O_PRIM_LINE_LIST) +op6= al_draw_prim(verts, 0, tex, 4, 9, A5O_PRIM_LINE_STRIP) +op7= al_draw_prim(verts, 0, tex, 9, 13, A5O_PRIM_LINE_LOOP) verts=vtx_ll tex=0 @@ -22,7 +22,7 @@ hash=3e2bdb71 [test ll notex opaque] extend=ll -op3=al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO) +op3=al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO) hash=8e491071 [test ll tex blend] @@ -38,13 +38,13 @@ hash=cccd8111 [test ll tex opaque] extend=ll -op3=al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO) +op3=al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO) tex=texture hash=be2f916a [test ll tex opaque white] extend=ll -op3=al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO) +op3=al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO) verts=vtx_ll_white tex=texture hash=92099701 @@ -54,7 +54,7 @@ hash=92099701 op0= al_draw_bitmap(bkg, 0, 0, 0) op1= al_build_transform(trans, 320, 240, 0.75, 0.75, theta) op2= -op3= al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE) +op3= al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE) op4= al_use_transform(trans) op5= al_draw_line(-300, -200, 300, 200, #008080ff, thickness) op6= al_draw_triangle(-150, -250, 0, 250, 150, -250, #800080ff, thickness) @@ -122,7 +122,7 @@ hash=2e3bd424 op0= al_draw_bitmap(bkg, 0, 0, 0) op1= al_build_transform(trans, 320, 240, 0.75, 0.75, theta) op2= -op3= al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE) +op3= al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE) op4= al_use_transform(trans) op5= op6= al_draw_filled_triangle(-100, -100, -150, 200, 100, 200, #80b24c) @@ -148,7 +148,7 @@ op0= subbmp = al_create_sub_bitmap(target, 60, 60, 540, 380) op1= al_set_target_bitmap(subbmp) op2= al_draw_bitmap(bkg, 0, 0, 0) op3= -op4= al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE) +op4= al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE) op5= al_build_transform(trans, 320, 240, 0.75, 0.75, theta) op6= al_use_transform(trans) op7= al_draw_filled_triangle(-100, -100, -150, 200, 100, 200, #80b24c) @@ -167,7 +167,7 @@ hash=52d7f9fd [test circle] op0=al_clear_to_color(#884444) op1=al_draw_circle(200, 150, 100, #66aa0080, 10) -op2=al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_ONE) +op2=al_set_blender(A5O_ADD, A5O_ALPHA, A5O_ONE) op3=al_draw_circle(350, 250, 200, #00aaaa80, 50) op4=al_draw_filled_circle(250, 175, 75, #aa660080) hash=484ad11f @@ -187,16 +187,16 @@ op0= op1=al_draw_bitmap(bkg, 0, 0, 0) op2=al_build_transform(t, 320, 240, 1, 1, 1.0) op3=al_use_transform(t) -op4=al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE) -op5=al_draw_prim(vtx_notex, 0, 0, 0, 6, ALLEGRO_PRIM_TRIANGLE_FAN) -op6=al_draw_prim(vtx_notex, 0, 0, 7, 13, ALLEGRO_PRIM_TRIANGLE_LIST) -op7=al_draw_prim(vtx_notex, 0, 0, 14, 20, ALLEGRO_PRIM_TRIANGLE_STRIP) +op4=al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE) +op5=al_draw_prim(vtx_notex, 0, 0, 0, 6, A5O_PRIM_TRIANGLE_FAN) +op6=al_draw_prim(vtx_notex, 0, 0, 7, 13, A5O_PRIM_TRIANGLE_LIST) +op7=al_draw_prim(vtx_notex, 0, 0, 14, 20, A5O_PRIM_TRIANGLE_STRIP) hash=1312b9c9 sig=766666666766P66766656657K776767676667666975I5666LK556766KPJ6766657NJ7576776666766 [test filled notex opaque] extend=test filled notex blend -op4=al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO) +op4=al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO) hash=2ac96499 sig=766666666766I66766656657E776767676667666775B5666FE556766EID6766657GC7576776666766 @@ -205,10 +205,10 @@ op0= op1=al_draw_bitmap(bkg, 0, 0, 0) op2=al_build_transform(t, 320, 240, 1, 1, 1.0) op3=al_use_transform(t) -op4=al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE) -op5=al_draw_prim(vtx_tex, 0, tex, 0, 6, ALLEGRO_PRIM_TRIANGLE_FAN) -op6=al_draw_prim(vtx_tex, 0, tex, 7, 13, ALLEGRO_PRIM_TRIANGLE_LIST) -op7=al_draw_prim(vtx_tex, 0, tex, 14, 20, ALLEGRO_PRIM_TRIANGLE_STRIP) +op4=al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE) +op5=al_draw_prim(vtx_tex, 0, tex, 0, 6, A5O_PRIM_TRIANGLE_FAN) +op6=al_draw_prim(vtx_tex, 0, tex, 7, 13, A5O_PRIM_TRIANGLE_LIST) +op7=al_draw_prim(vtx_tex, 0, tex, 14, 20, A5O_PRIM_TRIANGLE_STRIP) tex=texture hash=04d0ae2f sig=766666666766B66766656657977676767666766687585666NP556766RXS6766657fR7576776666766 @@ -221,7 +221,7 @@ sig=000000000006B66700006657900006767600006687500006NP550000RXS67000000000000000 [test filled textured opaque] extend=test filled textured blend -op4=al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO) +op4=al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO) hash=67cc8955 sig=766666666766466766656657377676767666766677515666IK556766LTN6766657cK7576776666766 @@ -237,16 +237,16 @@ op0=tex = al_create_sub_bitmap(obp, 70, 60, 322, 303) op1=al_draw_bitmap(bkg, 0, 0, 0) op2=al_build_transform(t, 320, 240, 1, 1, 1.0) op3=al_use_transform(t) -op4=al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ONE) -op5=al_draw_prim(vtx_tex2, 0, tex, 0, 6, ALLEGRO_PRIM_TRIANGLE_FAN) -op6=al_draw_prim(vtx_tex2, 0, tex, 7, 13, ALLEGRO_PRIM_TRIANGLE_LIST) -op7=al_draw_prim(vtx_tex2, 0, tex, 14, 20, ALLEGRO_PRIM_TRIANGLE_STRIP) +op4=al_set_blender(A5O_ADD, A5O_ONE, A5O_ONE) +op5=al_draw_prim(vtx_tex2, 0, tex, 0, 6, A5O_PRIM_TRIANGLE_FAN) +op6=al_draw_prim(vtx_tex2, 0, tex, 7, 13, A5O_PRIM_TRIANGLE_LIST) +op7=al_draw_prim(vtx_tex2, 0, tex, 14, 20, A5O_PRIM_TRIANGLE_STRIP) hash=891747fe sig=766666666766J66766656657D776767676667666A75G5666ML556766NNK6766657MM7576776666766 [test filled subtexture opaque] extend=test filled subtexture blend -op4=al_set_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO) +op4=al_set_blender(A5O_ADD, A5O_ONE, A5O_ZERO) hash=325bf4a2 sig=766666666766C66766656657777676767666766687595666GF556766GHE6766657GE7576776666766 @@ -255,8 +255,8 @@ op0= op1=al_draw_bitmap(bkg, 0, 0, 0) op2=al_build_transform(t, 320, 240, 1, 1, 1.0) op3=al_use_transform(t) -op4=al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) -op5=al_draw_prim(vtx_tex3, 0, texture, 0, 6, ALLEGRO_PRIM_TRIANGLE_FAN) +op4=al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) +op5=al_draw_prim(vtx_tex3, 0, texture, 0, 6, A5O_PRIM_TRIANGLE_FAN) hash=e16da3fc sig=7666666667666667666566576776767676667666675656669A556766ACA6766657FA7576776666766 @@ -268,7 +268,7 @@ op3=al_clear_to_color(orange) op4= op5=al_build_transform(Tsub, 300, 10, 5, 4, 1.0) op6=al_use_transform(Tsub) -op7=al_draw_prim(vtx_tex, 0, texture, 0, 6, ALLEGRO_PRIM_TRIANGLE_FAN) +op7=al_draw_prim(vtx_tex, 0, texture, 0, 6, A5O_PRIM_TRIANGLE_FAN) hash=19fb34dc sig=WWWWWWWWWWWWWWWWWWWWWWWWWWWZZZZgZWWWZZY7bZWWWZgEM5ZWWWgUaHAeWWWP8gUf7WWWCUEgNgWWW @@ -281,14 +281,14 @@ hash=49c3d736 # This test used to cause a division-by-zero. op0=al_build_transform(t, 320, 240, 1, 1, theta) op1=al_use_transform(t) -op2=al_draw_prim(vtx_divbyzero, 0, texture, 0, 4, ALLEGRO_PRIM_TRIANGLE_FAN) +op2=al_draw_prim(vtx_divbyzero, 0, texture, 0, 4, A5O_PRIM_TRIANGLE_FAN) theta=4.84207964 hash=a95ea313 sig=0000000000000Ca000000EgW00000bBgSK0000TWPYa0000NMgEX00000gbX000000MM0000000000000 [test pieslice] # 5.1 additions scheduled to be backported to 5.0.6 -op0=al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) +op0=al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) op1=al_draw_pieslice(160, 240, 100, 1.0, 6.0, blue, 10) op2=al_draw_pieslice(160, 240, 100, 1.0, 6.0, yellow, 1) op3=al_draw_filled_pieslice(480, 240, 200, 1.0, 1.5, #aa333388) @@ -299,7 +299,7 @@ sig=00000000000000C6000OO0CCC005002ICC00C00IIII0030O1DDI300NN0DICC000000ICC00000 [test elliptical arc] # 5.1 addition scheduled to be backported to 5.0.6 -op0=al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) +op0=al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) op1=al_draw_elliptical_arc(160, 240, 50, 100, -1.5, 4.5, #ff5555aa, 50) op2=al_draw_elliptical_arc(160, 240, 50, 100, 2.0, 4.5, #55ff55aa, 40) op3=al_draw_elliptical_arc(160, 240, 50, 100, 2.0, 4.5, yellow, 0) diff --git a/tests/test_prim2.ini b/tests/test_prim2.ini index 72ffb9ce4f..f958317b68 100644 --- a/tests/test_prim2.ini +++ b/tests/test_prim2.ini @@ -22,8 +22,8 @@ sig=0DMMMMMC0CMMMMMMM9MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM9MMMMMMM60AMM op0=al_clear_to_color(white) op1=al_draw_polyline(verts, join, cap, color, thickness, miter_limit) verts=vtx_triangle -join=ALLEGRO_LINE_JOIN_NONE -cap=ALLEGRO_LINE_CAP_NONE +join=A5O_LINE_JOIN_NONE +cap=A5O_LINE_CAP_NONE color=#8080aa thickness=1.0 miter_limit=1.0 @@ -56,44 +56,44 @@ hash=08066329 [test polyline join bevel] extend=squiggle base -join=ALLEGRO_LINE_JOIN_BEVEL +join=A5O_LINE_JOIN_BEVEL hash=1452f13d [test polyline join round] extend=squiggle base -join=ALLEGRO_LINE_JOIN_ROUND +join=A5O_LINE_JOIN_ROUND hash=e3be6520 [test polyline join miter1] extend=squiggle base -join=ALLEGRO_LINE_JOIN_MITER +join=A5O_LINE_JOIN_MITER miter_limit=1.0 hash=0cc7a65d [test polyline join miter2] extend=squiggle base -join=ALLEGRO_LINE_JOIN_MITER +join=A5O_LINE_JOIN_MITER miter_limit=2.0 hash=973b5a4d [test polyline cap square] extend=squiggle base -cap=ALLEGRO_LINE_CAP_SQUARE +cap=A5O_LINE_CAP_SQUARE hash=8df5cafc [test polyline cap round] extend=squiggle base -cap=ALLEGRO_LINE_CAP_ROUND +cap=A5O_LINE_CAP_ROUND hash=a308506c [test polyline cap triangle] extend=squiggle base -cap=ALLEGRO_LINE_CAP_TRIANGLE +cap=A5O_LINE_CAP_TRIANGLE hash=680ab634 [test polyline cap closed] extend=squiggle base -cap=ALLEGRO_LINE_CAP_CLOSED +cap=A5O_LINE_CAP_CLOSED hash=6f62fb5c # The backbuffer may not have an alpha channel so we draw to an @@ -102,13 +102,13 @@ hash=6f62fb5c op0=b = al_create_bitmap(640, 480) op1=al_set_target_bitmap(b) op2=al_clear_to_color(white) -op3=al_set_blender(ALLEGRO_ADD, ALLEGRO_ALPHA, ALLEGRO_INVERSE_ALPHA) +op3=al_set_blender(A5O_ADD, A5O_ALPHA, A5O_INVERSE_ALPHA) op4=al_draw_polygon(vtx_concave, join, #4444aa80, 25, 1) op5=al_set_target_bitmap(target) -op6=al_set_separate_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_INVERSE_ALPHA, ALLEGRO_ADD, ALLEGRO_ZERO, ALLEGRO_ONE) +op6=al_set_separate_blender(A5O_ADD, A5O_ONE, A5O_INVERSE_ALPHA, A5O_ADD, A5O_ZERO, A5O_ONE) op7=al_clear_to_color(brown) op8=al_draw_bitmap(b, 0, 0, 0) -join=ALLEGRO_LINE_JOIN_ROUND +join=A5O_LINE_JOIN_ROUND hash=2c6d9cdc [test filled polygon] diff --git a/tools/macosx/fixbundle.c b/tools/macosx/fixbundle.c index 76b6c814ac..699945039b 100644 --- a/tools/macosx/fixbundle.c +++ b/tools/macosx/fixbundle.c @@ -16,7 +16,7 @@ * See readme.txt for copyright information. */ -#define ALLEGRO_USE_CONSOLE +#define A5O_USE_CONSOLE #include #include @@ -272,8 +272,8 @@ static int load_resource(char *datafile, char *name, ICON_DATA *icon) static void usage(void) { - fprintf(stderr, "\nMacOS X application bundle fixer utility for Allegro " ALLEGRO_VERSION_STR "\n" - "By Angelo Mottola, " ALLEGRO_DATE_STR "\n\n" + fprintf(stderr, "\nMacOS X application bundle fixer utility for Allegro " A5O_VERSION_STR "\n" + "By Angelo Mottola, " A5O_DATE_STR "\n\n" "Usage: fixbundle exename [-m] [-o bundlename] [-v version] [-V long_version]\n" "\t\t[-e] [[-d datafile] [[palette] [-{16,32,48,128}] icon] ...]\n" "\twhere icon is either a datafile bitmap or a RLE sprite object, either\n" diff --git a/tools/win/wfixicon.c b/tools/win/wfixicon.c index 3a91633335..58ede16d0b 100644 --- a/tools/win/wfixicon.c +++ b/tools/win/wfixicon.c @@ -16,7 +16,7 @@ */ -#define ALLEGRO_USE_CONSOLE +#define A5O_USE_CONSOLE #include #include @@ -169,8 +169,8 @@ int save_ico(const char *filename, BITMAP *bmp[], int num, PALETTE pal[]) void usage(void) { - printf("\nWindows icon converter for Allegro " ALLEGRO_VERSION_STR "\n"); - printf("By Elias Pschernig, " ALLEGRO_DATE_STR "\n\n"); + printf("\nWindows icon converter for Allegro " A5O_VERSION_STR "\n"); + printf("By Elias Pschernig, " A5O_DATE_STR "\n\n"); printf("Usage: wfixicon icon [-r[o]] bitmap [bitmap...]\n"); printf(" or\n"); printf(" wfixicon icon [-r[o]] -d datafile object [palette] [object...]\n"); @@ -308,11 +308,11 @@ int main(int argc, char *argv[]) if (call_windres) { replace_extension(res_name, argv[1], "res", sizeof(res_name)); -#if defined ALLEGRO_MINGW32 +#if defined A5O_MINGW32 sprintf(str, "windres -O coff -o %s -i %s", res_name, rc_name); -#elif defined ALLEGRO_MSVC +#elif defined A5O_MSVC sprintf(str, "rc -fo %s %s", res_name, rc_name); -#elif defined ALLEGRO_BCC32 +#elif defined A5O_BCC32 sprintf(str, "brc32 -r -fo %s %s", res_name, rc_name); #endif diff --git a/tools/x11/xfixicon.sh b/tools/x11/xfixicon.sh index 28d826ca03..36bf148c75 100644 --- a/tools/x11/xfixicon.sh +++ b/tools/x11/xfixicon.sh @@ -38,7 +38,7 @@ fi echo "#include " > $outfile cat /tmp/allegico_xpm.xpm | sed -e 's,static char,static const char,' >> $outfile -echo "#if defined ALLEGRO_WITH_XWINDOWS && defined ALLEGRO_USE_CONSTRUCTOR" >> $outfile +echo "#if defined A5O_WITH_XWINDOWS && defined A5O_USE_CONSTRUCTOR" >> $outfile echo "extern void *allegro_icon;" >> $outfile echo "CONSTRUCTOR_FUNCTION(static void _set_allegro_icon(void));" >> $outfile echo "static void _set_allegro_icon(void)" >> $outfile