Files
Cubed/include/Cubed/dev_panel.hpp
zhenyan121 03259f323c refactor: config (#30)
* refactor(config): replace singleton with dependency injection

* refactor(client_player): return ChunkPosSet by value in non-const getter

Copy the internal set under the mutex lock to avoid exposing a mutable reference that could be used unsafely after the lock is released. This fixes a potential data race when the caller holds the returned reference beyond the critical section. Also update the caller in `client_world` to remove the now-unnecessary `std::move`.

* fix(gameplay): prevent use-after-free in pending delete queues during destruction

* refactor(config): separate game and server configuration with explicit paths
2026-07-11 09:22:40 +08:00

72 lines
1.7 KiB
C++

#pragma once
#include "Cubed/config.hpp"
#include <toml++/toml.hpp>
namespace Cubed {
class App;
class ClientPlayer;
class DevPanel {
struct ConfigView {
float fov = 70.0f;
bool fullscreen = false;
bool v_sync = true;
float mouse_sensitivity = 0.15f;
int width = 800;
int height = 600;
int rendering_distance = 24;
int aniso = 1;
int max_aniso = 1;
bool is_enable_aniso = false;
bool is_support_aniso = true;
bool is_reload = true;
float volume_music = 1.0f;
float volume_sfx = 1.0f;
};
struct PlayerProfile {
int game_mode = 0;
int gait = 0;
float pos[3] = {0.0f, 0.0f, 0.0f};
};
public:
DevPanel(App& app);
void init();
void render();
private:
App& m_app;
Config& m_config;
ConfigView m_config_view;
ClientPlayer* m_player;
PlayerProfile m_player_profile;
bool m_need_save_config = false;
bool m_gen_thread_running = true;
int m_theme = 0;
int m_pre_set_day_tick = 0;
int m_pre_set_tick_speed = 1;
bool m_tick_frezze = false;
int m_samples_idx = 1;
int m_threads = 1;
int m_chunk_style = 0;
void show_about_table_bar();
void show_biome_table_bar();
void show_time_table_bar();
void show_cave_table_bar();
void show_river_table_bar();
void show_chunk_table_bar();
void show_settings_tab_item();
void show_world_tab_item();
void show_server_world_table_bar();
void show_client_world_table_bar();
void show_player_tab_item();
void show_items_tab_item();
void show_shader_tab_item();
void update_config_view();
void update_player_profile();
};
} // namespace Cubed