debug window: use block type from slider in block picking

hud
EmaMaker 2023-09-18 21:00:55 +02:00
parent 52696f2dde
commit 07068d740a
2 changed files with 5 additions and 3 deletions

View File

@ -34,6 +34,7 @@ namespace chunkmanager
// Queue of chunks to be meshed
ChunkPriorityQueue chunks_to_mesh_queue;
int block_to_place{2};
// Init chunkmanager. Chunk indices and start threads
int chunks_volume_real;
@ -86,6 +87,8 @@ namespace chunkmanager
update_thread = std::thread(update);
gen_thread = std::thread(generate);
mesh_thread = std::thread(mesh);
debug::window::set_parameter("block_type_return", &block_to_place);
}
// Method for world generation thread(s)
@ -254,7 +257,7 @@ namespace chunkmanager
if(!chunks.find(a1, calculateIndex(px1, py1, pz1))) return;
Chunk::Chunk* c1 = a1->second;
// place the new block (only stone for now)
c1->setBlock( Block::STONE, bx1, by1, bz1);
c1->setBlock((Block)block_to_place, bx1, by1, bz1);
// mark the mesh of the chunk the be updated
chunks_to_mesh_queue.push(std::make_pair(c1, MESHING_PRIORITY_PLAYER_EDIT));

View File

@ -59,7 +59,6 @@ namespace debug{
parameters[key] = value;
}
int block_type{0};
void show_debug_window(){
ImGui::Begin("Debug Window");
@ -92,7 +91,7 @@ namespace debug{
ImGui::SliderInt("Crosshair type",
std::any_cast<int*>(parameters.at("crosshair_type_return")), 0, 1);
ImGui::SliderInt("Block to place",
block_type, 2, 6);
std::any_cast<int*>(parameters.at("block_type_return")), 2, 6);
}
if(ImGui::CollapsingHeader("Mesh")){