mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-09 02:07:04 +08:00
fix(input): reset key status on pause
This commit is contained in:
@@ -68,7 +68,7 @@ public:
|
||||
void set_uuid(std::string_view uuid);
|
||||
std::string get_uuid() const;
|
||||
const std::string& get_name() const;
|
||||
|
||||
void reset_key_status();
|
||||
void init(std::string_view name);
|
||||
|
||||
float yaw() const;
|
||||
|
||||
@@ -85,6 +85,7 @@ public:
|
||||
void change_pool_threads(int threads);
|
||||
void reload_config(bool chunk_build = true);
|
||||
void request_chunk();
|
||||
void reset_key_status();
|
||||
std::vector<glm::vec4>& planes();
|
||||
const std::vector<const ChunkRenderSnapshot*>& render_snapshots() const;
|
||||
const std::vector<PlayerRenderData>& render_player_data() const;
|
||||
|
||||
@@ -634,6 +634,18 @@ std::string ClientPlayer::get_uuid() const {
|
||||
return m_uuid;
|
||||
}
|
||||
const std::string& ClientPlayer::get_name() const { return m_name; }
|
||||
|
||||
void ClientPlayer::reset_key_status() {
|
||||
m_mouse_state.left = false;
|
||||
m_mouse_state.right = false;
|
||||
m_move_state.left = false;
|
||||
m_move_state.right = false;
|
||||
m_move_state.back = false;
|
||||
m_move_state.forward = false;
|
||||
m_move_state.down = false;
|
||||
m_move_state.up = false;
|
||||
}
|
||||
|
||||
void ClientPlayer::init(std::string_view name) {
|
||||
|
||||
m_name = name;
|
||||
|
||||
@@ -670,7 +670,7 @@ void ClientWorld::request_chunk() {
|
||||
Logger::info("Send Chunk Request Success");
|
||||
m_requesting_chunk = false;
|
||||
}
|
||||
|
||||
void ClientWorld::reset_key_status() { m_player.reset_key_status(); }
|
||||
void ClientWorld::receive_chunk(std::vector<uint8_t> raw_data,
|
||||
PacketHeader header) {
|
||||
|
||||
|
||||
@@ -261,5 +261,8 @@ void WorldScene::set_pause(bool pause) {
|
||||
auto& window = m_scene_manager.app().window();
|
||||
Logger::info("pause {}", m_paused);
|
||||
window.set_game_running(!m_paused);
|
||||
if (m_paused) {
|
||||
m_client_world.reset_key_status();
|
||||
}
|
||||
}
|
||||
} // namespace Cubed
|
||||
Reference in New Issue
Block a user