22 #ifndef ALCACHOFA_COMMON_H 23 #define ALCACHOFA_COMMON_H 25 #include "common/rect.h" 26 #include "common/serializer.h" 27 #include "common/stream.h" 28 #include "common/str-enc.h" 29 #include "common/stack.h" 30 #include "math/vector2d.h" 31 #include "math/vector3d.h" 35 enum class CursorType {
44 enum class Direction {
53 enum class MainCharacterKind {
59 enum class EasingType {
66 constexpr
const int32 kDirectionCount = 4;
67 constexpr
const int8 kOrderCount = 70;
68 constexpr
const int8 kForegroundOrderCount = 10;
73 static constexpr
const Color kWhite = { 255, 255, 255, 255 };
74 static constexpr
const Color kBlack = { 0, 0, 0, 255 };
75 static constexpr
const Color kClear = { 0, 0, 0, 0 };
76 static constexpr
const Color kDebugRed = { 250, 0, 0, 70 };
77 static constexpr
const Color kDebugGreen = { 0, 255, 0, 85 };
78 static constexpr
const Color kDebugBlue = { 0, 0, 255, 110 };
79 static constexpr
const Color kDebugLightBlue = { 80, 80, 255, 190 };
89 inline bool isReleased()
const {
return _counter == 0; }
90 inline uint counter()
const {
return _counter; }
95 const char *
const _name;
109 inline bool isReleased()
const {
return _semaphore ==
nullptr; }
111 void debug(
const char *action);
113 const char *_name =
"<uninitialized>";
117 bool isPowerOfTwo(int16 x);
119 float ease(
float t, EasingType type);
123 Common::CodePage from = Common::CodePage::kISO8859_1,
124 Common::CodePage to = Common::CodePage::kUtf8);
126 Math::Vector3d as3D(
const Math::Vector2d &v);
128 Math::Vector2d as2D(
const Math::Vector3d &v);
139 auto size = array.
size();
140 serializer.syncAsUint32LE(size);
142 serializer.syncArray(array.
data(), size, serializeFunction);
147 auto size = stack.size();
148 serializer.syncAsUint32LE(size);
149 if (serializer.isLoading()) {
150 for (uint i = 0; i < size; i++) {
152 serializeFunction(serializer, value);
156 for (uint i = 0; i < size; i++)
157 serializeFunction(serializer, stack[i]);
164 int32 intValue =
static_cast<int32
>(enumValue);
165 serializer.syncAsSint32LE(intValue);
166 enumValue =
static_cast<T
>(intValue);
171 #endif // ALCACHOFA_COMMON_H Definition: alcachofa.h:45
const T * data() const
Definition: array.h:208
Definition: display_client.h:58
Definition: serializer.h:79
void debug(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
size_type size() const
Definition: array.h:316
void resize(size_type newSize)
Definition: array.h:412
This fake semaphore does not work in multi-threaded scenarios It is used as a safer option for a simp...
Definition: common.h:85