Debian Codegraph @

src/types.h

raw symbols SCIP
1
2 /**
3 *
4 * @file types.h
5 *
6 * Part of the OpenJazz project
7 *
8 * @par History:
9 * - 23rd August 2005: Created OpenJazz.h
10 * - 1st November 2023: Created types.h from parts of OpenJazz.h
11 *
12 * @par Licence:
13 * Copyright (c) 2005-2017 AJ Thomson
14 * Copyright (c) 2015-2026 Carsten Teibes
15 *
16 * OpenJazz is distributed under the terms of
17 * the GNU General Public License, version 2.0
18 *
19 */
20
21
22 #ifndef OJ_TYPES_H
23 #define OJ_TYPES_Hcxx . . $ `src/types.h:23:9`!
24
25 // Constants
26
27 // Numbers in -10 exponent fixed point
28 #define FEcxx . . $ `src/types.h:28:9`! 128
29 #define FQcxx . . $ `src/types.h:29:9`! 256
30 #define FHcxx . . $ `src/types.h:30:9`! 512
31 #define F1cxx . . $ `src/types.h:31:9`! 1024
32 #define F2cxx . . $ `src/types.h:32:9`! 2048
33 #define F4cxx . . $ `src/types.h:33:9`! 4096
34 #define F8cxx . . $ `src/types.h:34:9`! 8192
35 #define F10cxx . . $ `src/types.h:35:9`! 10240
36 #define F12cxx . . $ `src/types.h:36:9`! 12288
37 #define F16cxx . . $ `src/types.h:37:9`! 16384
38 #define F20cxx . . $ `src/types.h:38:9`! 20480
39 #define F24cxx . . $ `src/types.h:39:9`! 24576
40 #define F32cxx . . $ `src/types.h:40:9`! 32768
41 #define F36cxx . . $ `src/types.h:41:9`! 36864
42 #define F40cxx . . $ `src/types.h:42:9`! 40960
43 #define F80cxx . . $ `src/types.h:43:9`! 81920
44 #define F64cxx . . $ `src/types.h:44:9`! 65536
45 #define F100cxx . . $ `src/types.h:45:9`! 102400
46 #define F160cxx . . $ `src/types.h:46:9`! 163840
47 #define F192cxx . . $ `src/types.h:47:9`! 196608
48
49 // Macros
50
51 // For fixed-point operations
52 #define FTOIcxx . . $ `src/types.h:52:9`!(x) ((x) >> 10) ///< Fixed to Int
53 #define ITOFcxx . . $ `src/types.h:53:9`!(x) ((x) << 10) ///< Int to Fixed
54 #define MULcxx . . $ `src/types.h:54:9`!(x, y) (((x) * (y)) >> 10) ///< multiplication
55 #define DIVcxx . . $ `src/types.h:55:9`!(x, y) (((x) << 10) / (y)) ///< division
56
57 // For boundary checking, TODO: use std::clamp with c++17
58 #define CLAMPcxx . . $ `src/types.h:58:9`!(v, l, h) (((v) < (l)) ? (l) : (((v) > (h)) ? (h) : (v)))
59
60 // For easier conversion of strongly typed enums
61 #define MAKE_ENUM_CLASScxx . . $ `src/types.h:61:9`!(name, ...) \
62 enum class name : unsigned { __VA_ARGS__ }; \
63 inline constexpr unsigned operator+ (name const val) noexcept { \
64 return static_cast<unsigned>(val); \
65 }
66
67 #define OJ_UNUSEDcxx . . $ `src/types.h:67:9`!(v) (void)(v)
68
69 // Datatypes
70
71 typedef int fixedcxx . . $ fixed#; ///< Custom fixed-point data type
72
73 namespace SEcxx . . $ SE/ {
74 enum Typecxx . . $ SE/Type# : int; ///< Sound Index type
75 }
76
77 MAKE_ENUM_CLASScxx . . $ `src/types.h:61:9`!(scalerType,
78 None,
79 Bilinear,
80 Scale2x,
81 hqx
82 );
83
84 MAKE_ENUM_CLASScxx . . $ `src/types.h:61:9`!(hudType,
85 Classic,
86 FPS,
87 Modern
88 );
89
90 MAKE_ENUM_CLASScxx . . $ `src/types.h:61:9`!(difficultyType,
91 Easy,
92 Normal,
93 Hard,
94 Turbo
95 );
96
97 MAKE_ENUM_CLASScxx . . $ `src/types.h:61:9`!(alignX,
98 Left,
99 Center,
100 Right
101 );
102
103 MAKE_ENUM_CLASScxx . . $ `src/types.h:61:9`!(alignY,
104 Top,
105 Center,
106 Bottom
107 );
108
109 struct Pointcxx . . $ Point# {
110 Pointcxx . . $ Point#Point(49f6e7a06ebc5aa8).() : xcxx . . $ Point#x.(0), ycxx . . $ Point#y.(0) {}
111 Pointcxx . . $ Point#Point(3e454b8ccf442868).(int x, int y) : xcxx . . $ Point#x.(x), ycxx . . $ Point#y.(y) {}
112
113 bool operatorcxx . . $ Point#`operator==`(e6e8bbeb68a2a00a).==(const Pointcxx . . $ Point#& other) const {
114 return (xcxx . . $ Point#x. == other.xcxx . . $ Point#x.) && (ycxx . . $ Point#y. == other.ycxx . . $ Point#y.);
115 }
116
117 int xcxx . . $ Point#x., ycxx . . $ Point#y.;
118 };
119
120 #endif