OGLplus  (0.59.0) a C++ wrapper for rendering APIs

config.hpp
Go to the documentation of this file.
1 #ifndef OALPLUS_AL_API_CONFIG_HPP
9 #define OALPLUS_AL_API_CONFIG_HPP
10 
11 #include "../config/basic.hpp"
12 #include <eagine/maybe_unused.hpp>
13 
14 #ifndef OALPLUS_HAS_AL
15 #if defined(AL_NO_ERROR)
16 #define OALPLUS_HAS_AL 1
17 #else
18 #define OALPLUS_HAS_AL 0
19 #endif
20 #endif // OALPLUS_HAS_AL
21 
22 #if !OALPLUS_HAS_AL
23 #include <cstdint>
24 #endif
25 
26 namespace eagine::oalp {
27 //------------------------------------------------------------------------------
30 struct al_types {
32  using void_ptr_type = void*;
33 
35  using const_void_ptr_type = const void*;
36 #if OALPLUS_HAS_AL
37  static constexpr bool has_api = true;
38 
40  using enum_type = ALenum;
41 
43  using char_type = ALchar;
44 
46  using bool_type = ALboolean;
47 
49  using byte_type = ALbyte;
50 
52  using ubyte_type = ALubyte;
53 
55  using short_type = ALshort;
56 
58  using ushort_type = ALushort;
59 
61  using int_type = ALint;
62 
64  using uint_type = ALuint;
65 
67  using name_type = ALuint;
68 
70  using size_type = ALsizei;
71 
73  using float_type = ALfloat;
74 
76  using double_type = ALdouble;
77 #else
78  static constexpr bool has_api = false;
79  using enum_type = int;
80  using char_type = char;
81  using bool_type = bool;
82  using byte_type = char;
83  using ubyte_type = unsigned char;
84  using short_type = short;
85  using ushort_type = unsigned short;
86  using int_type = int;
87  using uint_type = unsigned;
88  using name_type = unsigned;
89  using size_type = std::intptr_t;
90  using float_type = float;
91  using double_type = double;
92 #endif
93 
94  static constexpr auto bool_true(bool_type b) noexcept -> bool {
95 #if OALPLUS_HAS_AL
96  return b == AL_TRUE;
97 #else
98  return b;
99 #endif
100  }
101 
102  static constexpr auto error_code_no_error(enum_type ec) noexcept -> bool {
103 #if OALPLUS_HAS_AL
104  return ec == AL_NO_ERROR;
105 #else
106  EAGINE_MAYBE_UNUSED(ec);
107  return false;
108 #endif
109  }
110 };
111 //------------------------------------------------------------------------------
112 } // namespace eagine::oalp
113 
114 #endif // OALPLUS_AL_API_CONFIG_HPP
const void * const_void_ptr_type
Untyped const pointer type.
Definition: config.hpp:35
Collection of aliases for AL types.
Definition: config.hpp:30
void * void_ptr_type
Untyped pointer type.
Definition: config.hpp:32
AL-related code is placed in this namespace.
Definition: oalplus.hpp:11

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).