X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Finterface.cpp;h=f4b13b015d6d69fcbf6adbfc6e0a92d6c3d6454e;hb=3072e2cd49ad1614100d1a1c73afe6a4888fb875;hp=03c059f7301dfb644b2ef7ddbebce72a91ad3eb5;hpb=5868f740c492a924cb865644b6201db1632b7376;p=blank.git diff --git a/src/interface.cpp b/src/interface.cpp index 03c059f..f4b13b0 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -73,6 +73,11 @@ void Interface::Handle(const SDL_KeyboardEvent &event) { PrintBlockInfo(); } break; + case SDLK_l: + if (event.state == SDL_PRESSED) { + PrintLightInfo(); + } + break; case SDLK_p: if (event.state == SDL_PRESSED) { PrintSelectionInfo(); @@ -104,6 +109,13 @@ void Interface::PrintBlockInfo() { Print(aim_chunk->BlockAt(aim_block)); } +void Interface::PrintLightInfo() { + std::cout + << "light level " << world.PlayerChunk().GetLight(world.Player().Position()) + << " at position " << world.Player().Position() + << std::endl; +} + void Interface::PrintSelectionInfo() { std::cout << std::endl; Print(selection); @@ -148,13 +160,13 @@ void Interface::PlaceBlock() { mod_chunk = &world.Next(*aim_chunk, aim_normal); next_pos -= aim_normal * glm::vec3(Chunk::Extent()); } - mod_chunk->BlockAt(next_pos) = selection; + mod_chunk->SetBlock(next_pos, selection); mod_chunk->Invalidate(); } void Interface::RemoveBlock() { if (!aim_chunk) return; - aim_chunk->BlockAt(aim_block) = remove; + aim_chunk->SetBlock(aim_block, remove); aim_chunk->Invalidate(); }