metaforce/Runtime/GuiSys/CGuiFuncParm.hpp

45 lines
856 B
C++

#ifndef __URDE_CGUIFUNCPARM_HPP__
#define __URDE_CGUIFUNCPARM_HPP__
#include "RetroTypes.hpp"
namespace urde
{
class CGuiFuncParm
{
friend class CGuiMessage;
public:
enum class Type
{
Null = -1,
Int = 0,
Float = 1,
IntrusivePointer = 2
};
private:
Type x0_type = Type::Null;
union
{
intptr_t x4_int;
float x4_float;
void* x4_ptr = nullptr;
};
public:
CGuiFuncParm() = default;
CGuiFuncParm(intptr_t arg) : x0_type(Type::Int), x4_int(arg) {}
CGuiFuncParm(float arg) : x0_type(Type::Float), x4_float(arg) {}
CGuiFuncParm(void* arg) : x0_type(Type::IntrusivePointer), x4_ptr(arg) {}
~CGuiFuncParm()
{
if (x0_type == Type::IntrusivePointer)
delete static_cast<u8*>(x4_ptr);
}
};
}
#endif // __URDE_CGUIFUNCPARM_HPP__