#include #include #include #include #include #include #include "world/world_internals.h" namespace deerith { } void deerith::process_player_input() { if (self_entity == entt::null) return; glm::vec2 movment = get_joystick_axes(0, 0); if (!is_windows_focused()) { movment = glm::vec2(0, 0); } entity_sync_client_position_t &entity_sync_position = get_component(self_entity); entity_sync_position.move_input = movment; entity_sync_position.position = entity_sync_position.position.read_value() + movment * 0.1f; } void deerith::send_player_input() { if (self_entity == entt::null) return; entity_sync_client_position_t &entity_sync_position = get_component(self_entity); sync_entity_player_position_packet_t packet{}; packet.input_transport.load(entity_sync_position.move_input); packet.position_transport.load(entity_sync_position.position); router_send_packet(packet, get_server_client()); }