cOMS/ui/attribute/UIAttributeShadow.h
Dennis Eichhorn 4f1cbd98f9
Some checks failed
Microsoft C++ Code Analysis / Analyze (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (autobuild, c-cpp) (push) Has been cancelled
started templating
2025-03-21 01:08:09 +00:00

45 lines
1.0 KiB
C

#ifndef COMS_UI_ATTRIBUTE_SHADOW_H
#define COMS_UI_ATTRIBUTE_SHADOW_H
#include "../../stdlib/Types.h"
struct UIAttributeShadow {
f32 angle;
uint32 color;
byte fade;
byte offset;
};
inline
void ui_attr_shadow_serialize(const UIAttributeShadow* __restrict shadow, byte** __restrict pos)
{
*((f32 *) *pos) = SWAP_ENDIAN_LITTLE(shadow->angle);
*pos += sizeof(shadow->angle);
*((uint32 *) *pos) = SWAP_ENDIAN_LITTLE(shadow->color);
*pos += sizeof(shadow->color);
**pos = shadow->fade;
*pos += sizeof(shadow->fade);
**pos = shadow->offset;
*pos += sizeof(shadow->offset);
}
inline
void ui_attr_shadow_unserialize(UIAttributeShadow* __restrict shadow, const byte** __restrict pos)
{
shadow->angle = SWAP_ENDIAN_LITTLE(*((f32 *) *pos));
*pos += sizeof(shadow->angle);
shadow->color = SWAP_ENDIAN_LITTLE(*((uint32 *) *pos));
*pos += sizeof(shadow->color);
shadow->fade = **pos;
*pos += sizeof(shadow->fade);
shadow->offset = **pos;
*pos += sizeof(shadow->offset);
}
#endif