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/stack.h" 29 #include "math/vector2d.h" 30 #include "math/vector3d.h" 34 enum class CursorType {
43 enum class Direction {
52 enum class MainCharacterKind {
58 enum class EasingType {
65 constexpr
const int32 kDirectionCount = 4;
66 constexpr
const int8 kOrderCount = 70;
67 constexpr
const int8 kForegroundOrderCount = 10;
72 static constexpr
const Color kWhite = { 255, 255, 255, 255 };
73 static constexpr
const Color kBlack = { 0, 0, 0, 255 };
74 static constexpr
const Color kClear = { 0, 0, 0, 0 };
75 static constexpr
const Color kDebugRed = { 250, 0, 0, 70 };
76 static constexpr
const Color kDebugGreen = { 0, 255, 0, 85 };
77 static constexpr
const Color kDebugBlue = { 0, 0, 255, 110 };
78 static constexpr
const Color kDebugLightBlue = { 80, 80, 255, 190 };
88 inline bool isReleased()
const {
return _counter == 0; }
89 inline uint counter()
const {
return _counter; }
94 const char *
const _name;
108 inline bool isReleased()
const {
return _semaphore ==
nullptr; }
110 void debug(
const char *action);
112 const char *_name =
"<uninitialized>";
116 float ease(
float t, EasingType type);
118 Math::Vector3d as3D(
const Math::Vector2d &v);
120 Math::Vector2d as2D(
const Math::Vector3d &v);
131 auto size = array.
size();
132 serializer.syncAsUint32LE(size);
134 serializer.syncArray(array.
data(), size, serializeFunction);
139 auto size = stack.size();
140 serializer.syncAsUint32LE(size);
141 if (serializer.isLoading()) {
142 for (uint i = 0; i < size; i++) {
144 serializeFunction(serializer, value);
148 for (uint i = 0; i < size; i++)
149 serializeFunction(serializer, stack[i]);
156 int32 intValue =
static_cast<int32
>(enumValue);
157 serializer.syncAsSint32LE(intValue);
158 enumValue =
static_cast<T
>(intValue);
163 #endif // ALCACHOFA_COMMON_H Definition: alcachofa.h:45
const T * data() const
Definition: array.h:210
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:318
void resize(size_type newSize)
Definition: array.h:414
This fake semaphore does not work in multi-threaded scenarios It is used as a safer option for a simp...
Definition: common.h:84