mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-04-10 06:14:07 +08:00
fix: outline not disappearing when no block is targeted
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <Cubed/config.hpp>
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
struct MoveState {
|
||||
bool forward = false;
|
||||
@@ -30,6 +31,7 @@ private:
|
||||
glm::vec3 m_right;
|
||||
MoveState m_move_state;
|
||||
|
||||
std::optional<glm::ivec3> m_look_block_pos = std::nullopt;
|
||||
std::string m_name;
|
||||
World& m_world;
|
||||
|
||||
@@ -39,6 +41,7 @@ public:
|
||||
Player(World& world, const std::string& name);
|
||||
~Player();
|
||||
const glm::vec3& get_front() const;
|
||||
const std::optional<glm::ivec3>& get_look_block_pos() const;
|
||||
const glm::vec3& get_player_pos() const;
|
||||
const MoveState& get_move_state() const;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <Cubed/gameplay/chunk.hpp>
|
||||
@@ -8,7 +9,6 @@ class Player;
|
||||
class World {
|
||||
private:
|
||||
BlockRenderData m_block_render_data;
|
||||
glm::ivec3 last_block_pos = glm::ivec3(0, 0, 0);
|
||||
std::unordered_map<ChunkPos , Chunk, ChunkPos::Hash> m_chunks;
|
||||
std::unordered_map<std::size_t, Player> m_players;
|
||||
public:
|
||||
@@ -17,11 +17,10 @@ public:
|
||||
~World();
|
||||
|
||||
const BlockRenderData& get_block_render_data(int x, int y ,int z);
|
||||
const glm::ivec3& get_last_block_pos() const;
|
||||
const std::optional<glm::ivec3>& get_look_block_pos(const std::string& name) const;
|
||||
Player& get_player(const std::string& name);
|
||||
void init_world();
|
||||
bool is_block(const glm::ivec3& block_pos) const;
|
||||
void mark_looked_block(const glm::ivec3& block_pos);
|
||||
void render();
|
||||
void update(float delta_time);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user