Add current progression

This commit is contained in:
Julian
2020-03-28 13:50:48 +01:00
parent 72129de8f0
commit c5f9dfd628
12 changed files with 169 additions and 17 deletions

View File

@@ -28,6 +28,7 @@ enum class GameMessageType
TEST,
SETNAME,
PHYSICSTATEMESSAGE,
INPUTSTATEMESSAGE,
COUNT
};
@@ -86,11 +87,31 @@ public:
YOJIMBO_VIRTUAL_SERIALIZE_FUNCTIONS();
};
class InputStateMessage : public yojimbo::Message
{
public:
float m_vel_x, m_vel_y;
InputStateMessage() : m_vel_x(0), m_vel_y(0) {}
template <typename Stream>
bool Serialize(Stream &stream)
{
serialize_float(stream, m_vel_x);
serialize_float(stream, m_vel_y);
return true;
}
YOJIMBO_VIRTUAL_SERIALIZE_FUNCTIONS();
};
// the message factory
YOJIMBO_MESSAGE_FACTORY_START(GameMessageFactory, (int)GameMessageType::COUNT);
YOJIMBO_DECLARE_MESSAGE_TYPE((int)GameMessageType::TEST, TestMessage);
YOJIMBO_DECLARE_MESSAGE_TYPE((int)GameMessageType::SETNAME, SetNameMessage);
YOJIMBO_DECLARE_MESSAGE_TYPE((int)GameMessageType::PHYSICSTATEMESSAGE, PhysicStateMessage);
YOJIMBO_DECLARE_MESSAGE_TYPE((int)GameMessageType::INPUTSTATEMESSAGE, InputStateMessage);
YOJIMBO_MESSAGE_FACTORY_FINISH();
// the adapter